Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

restructure table options and make sticky first column a setting

Vincent16303bc314b2
diff --git a/ui/component/or-asset-viewer/src/index.ts b/ui/component/or-asset-viewer/src/index.ts
index d0777e520..956d67afe 100644
--- a/ui/component/or-asset-viewer/src/index.ts
+++ b/ui/component/or-asset-viewer/src/index.ts
@@ -650,7 +650,7 @@ export class OrAssetViewer extends subscribe(manager)(translate(i18next)(LitElem
}
</style>
<or-icon id="asset-group-add-remove-columns" icon="plus-minus" @click="${() => attributePickerModalOpen()}"></or-icon>
- <or-table hidden .id="${panelName}-attribute-table"></or-table>
+ <or-table hidden .id="${panelName}-attribute-table" .options="{stickyFirstColumn:true}"></or-table>
<span><or-translate id="${panelName}-attribute-table-msg" value="loading"></or-translate></span>
<or-mwc-dialog id="${panelName}-attribute-modal" dialogTitle="addRemoveAttributes" .dialogActions="${attributePickerModalActions}"></or-mwc-dialog>
`;
diff --git a/ui/component/or-table/src/index.ts b/ui/component/or-table/src/index.ts
index e56ddfb88..c7ff4ec14 100644
--- a/ui/component/or-table/src/index.ts
+++ b/ui/component/or-table/src/index.ts
@@ -7,6 +7,11 @@ import {DefaultColor1, DefaultColor4, DefaultColor8} from "@openremote/core";
const dataTableStyle = require("!!raw-loader!@material/data-table/dist/mdc.data-table.css");
+interface TableOptions {
+ columnFilter?: string[];
+ stickyFirstColumn?: boolean;
+}
+
// language=CSS
const style = css`
@@ -71,7 +76,10 @@ export class OrTable extends LitElement {
public rows!: string[][];
@property({type: Array})
- public columnFilter?: string[];
+ public options?: TableOptions = {
+ columnFilter: [],
+ stickyFirstColumn: true
+ };
protected render() {
@@ -86,7 +94,7 @@ export class OrTable extends LitElement {
</tr>
</thead>`;
return html`
- <div class="mdc-data-table">
+ <div class="mdc-data-table ${classMap({"has-sticky-first-column": !!this.options!.stickyFirstColumn})}">
<table class="mdc-data-table__table" aria-label="Dessert calories">
${headerTemplate}
<tbody class="mdc-data-table__content">