@3mo/data-grid 0.26.3 → 0.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DataGrid.js +246 -246
- package/dist/DataGridCell.d.ts.map +1 -1
- package/dist/DataGridCell.js +47 -45
- package/dist/DataGridColumn.js +29 -29
- package/dist/DataGridColumnHeader.js +226 -226
- package/dist/DataGridHeader.js +100 -100
- package/dist/custom-elements.json +2 -2
- package/dist/rows/DataGridDefaultRow.js +26 -26
- package/dist/rows/DataGridRow.js +222 -222
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +59 -59
package/dist/DataGridHeader.js
CHANGED
|
@@ -55,98 +55,98 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
55
55
|
this.columnHeaders.forEach(h => h.requestUpdate());
|
|
56
56
|
}
|
|
57
57
|
static get styles() {
|
|
58
|
-
return css `
|
|
59
|
-
:host {
|
|
60
|
-
--mo-data-grid-header-separator-height: 15px;
|
|
61
|
-
--mo-data-grid-header-separator-width: 2px;
|
|
62
|
-
display: grid;
|
|
63
|
-
grid-template-columns: subgrid;
|
|
64
|
-
position: sticky;
|
|
65
|
-
grid-column: -1 / 1;
|
|
66
|
-
background: var(--mo-data-grid-header-background, var(--mo-data-grid-sticky-part-color));
|
|
67
|
-
top: 0;
|
|
68
|
-
z-index: 4;
|
|
69
|
-
font-size: small;
|
|
70
|
-
border-block: var(--mo-data-grid-border);
|
|
71
|
-
height: var(--mo-data-grid-header-height);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
.reorder, .details, .selection, .actions, .context-menu {
|
|
75
|
-
position: sticky;
|
|
76
|
-
background: var(--mo-data-grid-sticky-part-color);
|
|
77
|
-
z-index: 5;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.actions, .context-menu {
|
|
81
|
-
inset-inline-end: 0px;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.actions {
|
|
85
|
-
mo-icon-button {
|
|
86
|
-
color: var(--mo-color-accent);
|
|
87
|
-
font-size: large;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.context-menu {
|
|
92
|
-
background-color: var(--mo-color-surface);
|
|
93
|
-
&[data-multiple-selected] {
|
|
94
|
-
background-color: var(--mo-color-accent);
|
|
95
|
-
}
|
|
96
|
-
mo-icon-button {
|
|
97
|
-
color: var(--mo-color-on-accent);
|
|
98
|
-
font-size: 20px;
|
|
99
|
-
&:not([data-multiple-selected]) {
|
|
100
|
-
opacity: 0;
|
|
101
|
-
pointer-events: none;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
58
|
+
return css `
|
|
59
|
+
:host {
|
|
60
|
+
--mo-data-grid-header-separator-height: 15px;
|
|
61
|
+
--mo-data-grid-header-separator-width: 2px;
|
|
62
|
+
display: grid;
|
|
63
|
+
grid-template-columns: subgrid;
|
|
64
|
+
position: sticky;
|
|
65
|
+
grid-column: -1 / 1;
|
|
66
|
+
background: var(--mo-data-grid-header-background, var(--mo-data-grid-sticky-part-color));
|
|
67
|
+
top: 0;
|
|
68
|
+
z-index: 4;
|
|
69
|
+
font-size: small;
|
|
70
|
+
border-block: var(--mo-data-grid-border);
|
|
71
|
+
height: var(--mo-data-grid-header-height);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.reorder, .details, .selection, .actions, .context-menu {
|
|
75
|
+
position: sticky;
|
|
76
|
+
background: var(--mo-data-grid-sticky-part-color);
|
|
77
|
+
z-index: 5;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.actions, .context-menu {
|
|
81
|
+
inset-inline-end: 0px;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.actions {
|
|
85
|
+
mo-icon-button {
|
|
86
|
+
color: var(--mo-color-accent);
|
|
87
|
+
font-size: large;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.context-menu {
|
|
92
|
+
background-color: var(--mo-color-surface);
|
|
93
|
+
&[data-multiple-selected] {
|
|
94
|
+
background-color: var(--mo-color-accent);
|
|
95
|
+
}
|
|
96
|
+
mo-icon-button {
|
|
97
|
+
color: var(--mo-color-on-accent);
|
|
98
|
+
font-size: 20px;
|
|
99
|
+
&:not([data-multiple-selected]) {
|
|
100
|
+
opacity: 0;
|
|
101
|
+
pointer-events: none;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
105
|
`;
|
|
106
106
|
}
|
|
107
107
|
get template() {
|
|
108
|
-
return html `
|
|
109
|
-
${this.reorderabilityTemplate}
|
|
110
|
-
${this.detailsExpanderTemplate}
|
|
111
|
-
${this.selectionTemplate}
|
|
112
|
-
${this.contentTemplate}
|
|
113
|
-
${this.fillerTemplate}
|
|
114
|
-
${this.actionsTemplate}
|
|
108
|
+
return html `
|
|
109
|
+
${this.reorderabilityTemplate}
|
|
110
|
+
${this.detailsExpanderTemplate}
|
|
111
|
+
${this.selectionTemplate}
|
|
112
|
+
${this.contentTemplate}
|
|
113
|
+
${this.fillerTemplate}
|
|
114
|
+
${this.actionsTemplate}
|
|
115
115
|
`;
|
|
116
116
|
}
|
|
117
117
|
get reorderabilityTemplate() {
|
|
118
|
-
return !this.dataGrid.reorderabilityController.enabled ? html.nothing : html `
|
|
119
|
-
<mo-flex class='reorder'
|
|
120
|
-
${style({ insetInlineStart: this.dataGrid.columnsController.getStickyColumnInsetInline('reordering') })}
|
|
121
|
-
${this.getResizeObserver('reordering')}
|
|
122
|
-
></mo-flex>
|
|
118
|
+
return !this.dataGrid.reorderabilityController.enabled ? html.nothing : html `
|
|
119
|
+
<mo-flex class='reorder'
|
|
120
|
+
${style({ insetInlineStart: this.dataGrid.columnsController.getStickyColumnInsetInline('reordering') })}
|
|
121
|
+
${this.getResizeObserver('reordering')}
|
|
122
|
+
></mo-flex>
|
|
123
123
|
`;
|
|
124
124
|
}
|
|
125
125
|
get detailsExpanderTemplate() {
|
|
126
|
-
return this.dataGrid.hasDetails === false ? html.nothing : html `
|
|
127
|
-
<mo-flex class='details' justifyContent='center' alignItems='center'
|
|
128
|
-
${style({ insetInlineStart: this.dataGrid.columnsController.getStickyColumnInsetInline('details') })}
|
|
129
|
-
${this.getResizeObserver('details')}
|
|
130
|
-
>
|
|
131
|
-
${!this.dataGrid.hasDetails || !this.dataGrid.multipleDetails ? html.nothing : html `
|
|
132
|
-
<mo-icon-button dense
|
|
133
|
-
icon=${this.dataGrid.allRowDetailsOpen ? 'unfold_less' : 'unfold_more'}
|
|
134
|
-
@click=${() => this.toggleAllDetails()}
|
|
135
|
-
></mo-icon-button>
|
|
136
|
-
`}
|
|
137
|
-
</mo-flex>
|
|
126
|
+
return this.dataGrid.hasDetails === false ? html.nothing : html `
|
|
127
|
+
<mo-flex class='details' justifyContent='center' alignItems='center'
|
|
128
|
+
${style({ insetInlineStart: this.dataGrid.columnsController.getStickyColumnInsetInline('details') })}
|
|
129
|
+
${this.getResizeObserver('details')}
|
|
130
|
+
>
|
|
131
|
+
${!this.dataGrid.hasDetails || !this.dataGrid.multipleDetails ? html.nothing : html `
|
|
132
|
+
<mo-icon-button dense
|
|
133
|
+
icon=${this.dataGrid.allRowDetailsOpen ? 'unfold_less' : 'unfold_more'}
|
|
134
|
+
@click=${() => this.toggleAllDetails()}
|
|
135
|
+
></mo-icon-button>
|
|
136
|
+
`}
|
|
137
|
+
</mo-flex>
|
|
138
138
|
`;
|
|
139
139
|
}
|
|
140
140
|
get selectionTemplate() {
|
|
141
|
-
return !this.dataGrid.hasSelection ? html.nothing : html `
|
|
142
|
-
<mo-flex class='selection' justifyContent='center' alignItems='center'
|
|
143
|
-
${style({ insetInlineStart: this.dataGrid.columnsController.getStickyColumnInsetInline('selection') })}
|
|
144
|
-
${this.getResizeObserver('selection')}
|
|
145
|
-
>
|
|
146
|
-
${this.dataGrid.selectability !== DataGridSelectability.Multiple ? html.nothing : html `
|
|
147
|
-
<mo-checkbox .selected=${live(this.selection)} @change=${this.handleSelectionChange}></mo-checkbox>
|
|
148
|
-
`}
|
|
149
|
-
</mo-flex>
|
|
141
|
+
return !this.dataGrid.hasSelection ? html.nothing : html `
|
|
142
|
+
<mo-flex class='selection' justifyContent='center' alignItems='center'
|
|
143
|
+
${style({ insetInlineStart: this.dataGrid.columnsController.getStickyColumnInsetInline('selection') })}
|
|
144
|
+
${this.getResizeObserver('selection')}
|
|
145
|
+
>
|
|
146
|
+
${this.dataGrid.selectability !== DataGridSelectability.Multiple ? html.nothing : html `
|
|
147
|
+
<mo-checkbox .selected=${live(this.selection)} @change=${this.handleSelectionChange}></mo-checkbox>
|
|
148
|
+
`}
|
|
149
|
+
</mo-flex>
|
|
150
150
|
`;
|
|
151
151
|
}
|
|
152
152
|
get selection() {
|
|
@@ -160,10 +160,10 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
get contentTemplate() {
|
|
163
|
-
return html `
|
|
164
|
-
${repeat(this.dataGrid.visibleColumns, c => c.dataSelector, (column, index) => html `
|
|
165
|
-
<mo-data-grid-column-header .reorderabilityController=${this.reorderabilityController} .index=${index} .column=${column}></mo-data-grid-column-header>
|
|
166
|
-
`)}
|
|
163
|
+
return html `
|
|
164
|
+
${repeat(this.dataGrid.visibleColumns, c => c.dataSelector, (column, index) => html `
|
|
165
|
+
<mo-data-grid-column-header .reorderabilityController=${this.reorderabilityController} .index=${index} .column=${column}></mo-data-grid-column-header>
|
|
166
|
+
`)}
|
|
167
167
|
`;
|
|
168
168
|
}
|
|
169
169
|
get fillerTemplate() {
|
|
@@ -172,25 +172,25 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
172
172
|
get actionsTemplate() {
|
|
173
173
|
if (this.dataGrid.hasContextMenu) {
|
|
174
174
|
const multipleSelected = this.dataGrid.selectedData.length > 1;
|
|
175
|
-
return html `
|
|
176
|
-
<mo-flex ?data-multiple-selected=${multipleSelected} class='context-menu' alignItems='end' justifyContent='center' ${this.getResizeObserver('actions')}>
|
|
177
|
-
<mo-popover-container>
|
|
178
|
-
<mo-icon-button ?data-multiple-selected=${multipleSelected} dense icon='more_vert' title=${t('Actions for ${count:pluralityNumber} selected entries', { count: this.dataGrid.selectedData.length })}></mo-icon-button>
|
|
179
|
-
|
|
180
|
-
<mo-menu slot='popover'>
|
|
181
|
-
${this.dataGrid.contextMenuController.getMenuContentTemplate()}
|
|
182
|
-
</mo-menu>
|
|
183
|
-
</mo-popover-container>
|
|
184
|
-
</mo-flex>
|
|
175
|
+
return html `
|
|
176
|
+
<mo-flex ?data-multiple-selected=${multipleSelected} class='context-menu' alignItems='end' justifyContent='center' ${this.getResizeObserver('actions')}>
|
|
177
|
+
<mo-popover-container>
|
|
178
|
+
<mo-icon-button ?data-multiple-selected=${multipleSelected} dense icon='more_vert' title=${t('Actions for ${count:pluralityNumber} selected entries', { count: this.dataGrid.selectedData.length })}></mo-icon-button>
|
|
179
|
+
|
|
180
|
+
<mo-menu slot='popover'>
|
|
181
|
+
${this.dataGrid.contextMenuController.getMenuContentTemplate()}
|
|
182
|
+
</mo-menu>
|
|
183
|
+
</mo-popover-container>
|
|
184
|
+
</mo-flex>
|
|
185
185
|
`;
|
|
186
186
|
}
|
|
187
187
|
if (!this.dataGrid.hasToolbar && !this.dataGrid.sidePanelHidden) {
|
|
188
|
-
return html `
|
|
189
|
-
<mo-flex class='actions' alignItems='end' justifyContent='center' ${this.getResizeObserver('actions')}>
|
|
190
|
-
<mo-icon-button dense icon='settings'
|
|
191
|
-
@click=${() => this.dataGrid.navigateToSidePanelTab(this.dataGrid.sidePanelTab ? undefined : DataGridSidePanelTab.Settings)}
|
|
192
|
-
></mo-icon-button>
|
|
193
|
-
</mo-flex>
|
|
188
|
+
return html `
|
|
189
|
+
<mo-flex class='actions' alignItems='end' justifyContent='center' ${this.getResizeObserver('actions')}>
|
|
190
|
+
<mo-icon-button dense icon='settings'
|
|
191
|
+
@click=${() => this.dataGrid.navigateToSidePanelTab(this.dataGrid.sidePanelTab ? undefined : DataGridSidePanelTab.Settings)}
|
|
192
|
+
></mo-icon-button>
|
|
193
|
+
</mo-flex>
|
|
194
194
|
`;
|
|
195
195
|
}
|
|
196
196
|
return html.nothing;
|
|
@@ -772,7 +772,7 @@
|
|
|
772
772
|
{
|
|
773
773
|
"name": "resizeController",
|
|
774
774
|
"type": "ResizeController<number>",
|
|
775
|
-
"default": "\"new ResizeController(this, {\\
|
|
775
|
+
"default": "\"new ResizeController(this, {\\n\\t\\tcallback: () => requestIdleCallback(() => this.column.widthInPixels = this.getBoundingClientRect().width)\\n\\t})\""
|
|
776
776
|
},
|
|
777
777
|
{
|
|
778
778
|
"name": "template",
|
|
@@ -846,7 +846,7 @@
|
|
|
846
846
|
{
|
|
847
847
|
"name": "reorderabilityController",
|
|
848
848
|
"type": "ReorderabilityController",
|
|
849
|
-
"default": "\"new ReorderabilityController(this, {\\
|
|
849
|
+
"default": "\"new ReorderabilityController(this, {\\n\\t\\thandleReorder: (source, destination) => {\\n\\t\\t\\tconst sourceColumn = this.dataGrid.visibleColumns[source]!\\n\\t\\t\\tconst destinationColumn = this.dataGrid.visibleColumns[destination]!\\n\\t\\t\\tconst sourceIndex = this.dataGrid.columns.indexOf(sourceColumn)\\n\\t\\t\\tconst destinationIndex = this.dataGrid.columns.indexOf(destinationColumn)\\n\\t\\t\\tthis.dataGrid.columns.splice(sourceIndex, 1)\\n\\t\\t\\tthis.dataGrid.columns.splice(destinationIndex, 0, sourceColumn)\\n\\t\\t\\tthis.dataGrid.setColumns(this.dataGrid.columns)\\n\\t\\t}\\n\\t})\""
|
|
850
850
|
}
|
|
851
851
|
]
|
|
852
852
|
},
|
|
@@ -3,25 +3,25 @@ import { css, component, html } from '@a11d/lit';
|
|
|
3
3
|
import { DataGridRow } from './DataGridRow.js';
|
|
4
4
|
let DataGridDefaultRow = class DataGridDefaultRow extends DataGridRow {
|
|
5
5
|
static get styles() {
|
|
6
|
-
return css `
|
|
7
|
-
${super.styles}
|
|
8
|
-
|
|
9
|
-
:host {
|
|
10
|
-
display: grid;
|
|
11
|
-
grid-template-columns: subgrid;
|
|
12
|
-
grid-column: -1 / 1;
|
|
13
|
-
min-height: var(--mo-data-grid-row-height);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
mo-flex {
|
|
17
|
-
white-space: nowrap;
|
|
18
|
-
text-overflow: ellipsis;
|
|
19
|
-
overflow: hidden;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
#selectionContainer {
|
|
23
|
-
height: var(--mo-data-grid-row-height);
|
|
24
|
-
}
|
|
6
|
+
return css `
|
|
7
|
+
${super.styles}
|
|
8
|
+
|
|
9
|
+
:host {
|
|
10
|
+
display: grid;
|
|
11
|
+
grid-template-columns: subgrid;
|
|
12
|
+
grid-column: -1 / 1;
|
|
13
|
+
min-height: var(--mo-data-grid-row-height);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
mo-flex {
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
text-overflow: ellipsis;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#selectionContainer {
|
|
23
|
+
height: var(--mo-data-grid-row-height);
|
|
24
|
+
}
|
|
25
25
|
`;
|
|
26
26
|
}
|
|
27
27
|
updated(...parameters) {
|
|
@@ -32,13 +32,13 @@ let DataGridDefaultRow = class DataGridDefaultRow extends DataGridRow {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
get rowTemplate() {
|
|
35
|
-
return html `
|
|
36
|
-
${this.reorderabilityTemplate}
|
|
37
|
-
${this.detailsExpanderTemplate}
|
|
38
|
-
${this.selectionTemplate}
|
|
39
|
-
${this.dataGrid.columns.map(column => this.getCellTemplate(column))}
|
|
40
|
-
${this.fillerTemplate}
|
|
41
|
-
${this.contextMenuIconButtonTemplate}
|
|
35
|
+
return html `
|
|
36
|
+
${this.reorderabilityTemplate}
|
|
37
|
+
${this.detailsExpanderTemplate}
|
|
38
|
+
${this.selectionTemplate}
|
|
39
|
+
${this.dataGrid.columns.map(column => this.getCellTemplate(column))}
|
|
40
|
+
${this.fillerTemplate}
|
|
41
|
+
${this.contextMenuIconButtonTemplate}
|
|
42
42
|
`;
|
|
43
43
|
}
|
|
44
44
|
};
|