@3mo/data-grid 0.5.12 → 0.5.13
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.d.ts +14 -14
- package/dist/DataGrid.js +17 -17
- package/dist/DataGridCell.d.ts +1 -1
- package/dist/DataGridCell.d.ts.map +1 -1
- package/dist/DataGridCell.js +40 -40
- package/dist/DataGridFooter.js +92 -92
- package/dist/DataGridHeader.js +90 -90
- package/dist/DataGridHeaderSeparator.d.ts +1 -1
- package/dist/DataGridHeaderSeparator.d.ts.map +1 -1
- package/dist/DataGridHeaderSeparator.js +46 -46
- package/dist/DataGridPrimaryContextMenuItem.js +5 -5
- package/dist/DataGridSidePanel.js +108 -108
- package/dist/FieldSelectDataGridPageSize.js +7 -7
- package/dist/columns/DataGridColumnBoolean.js +9 -9
- package/dist/columns/DataGridColumnImage.js +2 -2
- package/dist/columns/DataGridColumnText.js +5 -5
- package/dist/columns/date-time/DataGridColumnDateTimeBase.js +9 -9
- package/dist/columns/number/DataGridColumnCurrency.js +9 -9
- package/dist/columns/number/DataGridColumnNumber.js +5 -5
- package/dist/columns/number/DataGridColumnPercent.js +6 -6
- package/dist/columns/number/DataGridFooterSum.js +20 -20
- package/dist/custom-elements.json +6068 -0
- package/dist/excel.svg.js +47 -47
- package/dist/rows/DataGridDefaultRow.js +1 -1
- package/dist/rows/DataGridRow.d.ts +1 -1
- package/dist/rows/DataGridRow.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
package/dist/DataGrid.d.ts
CHANGED
|
@@ -81,20 +81,20 @@ export type DataGridSorting<TData> = DataGridSortingDefinition<TData> | Array<Da
|
|
|
81
81
|
* @cssprop --mo-data-grid-cell-padding - The inline padding of the cells. Default to 3px.
|
|
82
82
|
* @cssprop --mo-data-grid-column-sub-row-indentation - The indentation of the first column in the sub row. Default to 10px.
|
|
83
83
|
*
|
|
84
|
-
* @fires dataChange
|
|
85
|
-
* @fires selectionChange
|
|
86
|
-
* @fires pageChange
|
|
87
|
-
* @fires paginationChange
|
|
88
|
-
* @fires columnsChange
|
|
89
|
-
* @fires sidePanelOpen
|
|
90
|
-
* @fires sidePanelClose
|
|
91
|
-
* @fires sortingChange
|
|
92
|
-
* @fires rowDetailsOpen
|
|
93
|
-
* @fires rowDetailsClose
|
|
94
|
-
* @fires rowClick
|
|
95
|
-
* @fires rowDoubleClick
|
|
96
|
-
* @fires rowMiddleClick
|
|
97
|
-
* @fires cellEdit
|
|
84
|
+
* @fires dataChange
|
|
85
|
+
* @fires selectionChange
|
|
86
|
+
* @fires pageChange
|
|
87
|
+
* @fires paginationChange
|
|
88
|
+
* @fires columnsChange
|
|
89
|
+
* @fires sidePanelOpen
|
|
90
|
+
* @fires sidePanelClose
|
|
91
|
+
* @fires sortingChange
|
|
92
|
+
* @fires rowDetailsOpen
|
|
93
|
+
* @fires rowDetailsClose
|
|
94
|
+
* @fires rowClick
|
|
95
|
+
* @fires rowDoubleClick
|
|
96
|
+
* @fires rowMiddleClick
|
|
97
|
+
* @fires cellEdit
|
|
98
98
|
*/
|
|
99
99
|
export declare class DataGrid<TData, TDetailsElement extends Element | undefined = undefined> extends Component {
|
|
100
100
|
static readonly rowHeight: LocalStorage<number>;
|
package/dist/DataGrid.js
CHANGED
|
@@ -101,20 +101,20 @@ export var DataGridEditability;
|
|
|
101
101
|
* @cssprop --mo-data-grid-cell-padding - The inline padding of the cells. Default to 3px.
|
|
102
102
|
* @cssprop --mo-data-grid-column-sub-row-indentation - The indentation of the first column in the sub row. Default to 10px.
|
|
103
103
|
*
|
|
104
|
-
* @fires dataChange
|
|
105
|
-
* @fires selectionChange
|
|
106
|
-
* @fires pageChange
|
|
107
|
-
* @fires paginationChange
|
|
108
|
-
* @fires columnsChange
|
|
109
|
-
* @fires sidePanelOpen
|
|
110
|
-
* @fires sidePanelClose
|
|
111
|
-
* @fires sortingChange
|
|
112
|
-
* @fires rowDetailsOpen
|
|
113
|
-
* @fires rowDetailsClose
|
|
114
|
-
* @fires rowClick
|
|
115
|
-
* @fires rowDoubleClick
|
|
116
|
-
* @fires rowMiddleClick
|
|
117
|
-
* @fires cellEdit
|
|
104
|
+
* @fires dataChange
|
|
105
|
+
* @fires selectionChange
|
|
106
|
+
* @fires pageChange
|
|
107
|
+
* @fires paginationChange
|
|
108
|
+
* @fires columnsChange
|
|
109
|
+
* @fires sidePanelOpen
|
|
110
|
+
* @fires sidePanelClose
|
|
111
|
+
* @fires sortingChange
|
|
112
|
+
* @fires rowDetailsOpen
|
|
113
|
+
* @fires rowDetailsClose
|
|
114
|
+
* @fires rowClick
|
|
115
|
+
* @fires rowDoubleClick
|
|
116
|
+
* @fires rowMiddleClick
|
|
117
|
+
* @fires cellEdit
|
|
118
118
|
*/
|
|
119
119
|
let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
120
120
|
constructor() {
|
|
@@ -391,7 +391,7 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
391
391
|
--mo-data-grid-row-tree-line-width: 8px;
|
|
392
392
|
--mo-details-data-grid-start-margin: 26px;
|
|
393
393
|
|
|
394
|
-
--mo-data-grid-selection-background:
|
|
394
|
+
--mo-data-grid-selection-background: color-mix(in srgb, var(--mo-color-accent), transparent 50%);
|
|
395
395
|
display: flex;
|
|
396
396
|
flex-direction: column;
|
|
397
397
|
height: 100%;
|
|
@@ -399,11 +399,11 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
399
399
|
}
|
|
400
400
|
|
|
401
401
|
:host([data-theme=light]) {
|
|
402
|
-
--mo-data-grid-alternating-background:
|
|
402
|
+
--mo-data-grid-alternating-background: color-mix(in srgb, black, transparent 95%);
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
:host([data-theme=dark]) {
|
|
406
|
-
--mo-data-grid-alternating-background:
|
|
406
|
+
--mo-data-grid-alternating-background: color-mix(in srgb, black, transparent 80%);
|
|
407
407
|
}
|
|
408
408
|
|
|
409
409
|
:host([preventVerticalContentScroll]) mo-scroller {
|
package/dist/DataGridCell.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class DataGridCell<TValue extends KeyPathValueOf<TData>, TData =
|
|
|
12
12
|
column: ColumnDefinition<TData, TValue>;
|
|
13
13
|
row: DataGridRow<TData, TDetailsElement>;
|
|
14
14
|
private editing;
|
|
15
|
-
get dataGrid(): import("
|
|
15
|
+
get dataGrid(): import("DataGrid.js").DataGrid<TData, TDetailsElement>;
|
|
16
16
|
get data(): TData;
|
|
17
17
|
get dataSelector(): object extends TData ? string : TData extends readonly any[] ? Extract<keyof TData, `${number}`> | (Extract<keyof TData, `${number}`> extends infer T ? T extends Extract<keyof TData, `${number}`> ? T extends keyof TData ? `${T}.${object extends TData[T] ? string : TData[T] extends infer T_1 ? T_1 extends TData[T] ? T_1 extends readonly any[] ? Extract<keyof T_1, `${number}`> | (Extract<keyof T_1, `${number}`> extends infer T_2 ? T_2 extends Extract<keyof T_1, `${number}`> ? T_2 extends keyof T_1 ? never : never : never : never) : T_1 extends object ? Extract<keyof T_1, string> | (Extract<keyof T_1, string> extends infer T_3 ? T_3 extends Extract<keyof T_1, string> ? T_3 extends keyof T_1 ? never : never : never : never) : never : never : never}` : never : never : never) : TData extends object ? Extract<keyof TData, string> | (Extract<keyof TData, string> extends infer T_4 ? T_4 extends Extract<keyof TData, string> ? T_4 extends keyof TData ? `${T_4}.${object extends TData[T_4] ? string : TData[T_4] extends infer T_5 ? T_5 extends TData[T_4] ? T_5 extends readonly any[] ? Extract<keyof T_5, `${number}`> | (Extract<keyof T_5, `${number}`> extends infer T_6 ? T_6 extends Extract<keyof T_5, `${number}`> ? T_6 extends keyof T_5 ? never : never : never : never) : T_5 extends object ? Extract<keyof T_5, string> | (Extract<keyof T_5, string> extends infer T_7 ? T_7 extends Extract<keyof T_5, string> ? T_7 extends keyof T_5 ? never : never : never : never) : never : never : never}` : never : never : never) : never;
|
|
18
18
|
private get cellIndex();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridCell.d.ts","sourceRoot":"","sources":["../DataGridCell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAA6C,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAG/G,OAAO,EAAE,gBAAgB,EAAuB,WAAW,EAAE,MAAM,YAAY,CAAA;AAO/E;;;;;;GAMG;AACH,qBACa,YAAY,CAAC,MAAM,SAAS,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,eAAe,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,CAAE,SAAQ,SAAS;IAC1H,KAAK,EAAG,MAAM,CAAA;IACd,MAAM,EAAG,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACxC,GAAG,EAAG,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;IAQlE,OAAO,CAAC,OAAO,CAAQ;IAE1B,IAAI,QAAQ,
|
|
1
|
+
{"version":3,"file":"DataGridCell.d.ts","sourceRoot":"","sources":["../DataGridCell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,SAAS,EAA6C,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAG/G,OAAO,EAAE,gBAAgB,EAAuB,WAAW,EAAE,MAAM,YAAY,CAAA;AAO/E;;;;;;GAMG;AACH,qBACa,YAAY,CAAC,MAAM,SAAS,cAAc,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,GAAG,EAAE,eAAe,SAAS,OAAO,GAAG,SAAS,GAAG,SAAS,CAAE,SAAQ,SAAS;IAC1H,KAAK,EAAG,MAAM,CAAA;IACd,MAAM,EAAG,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;IACxC,GAAG,EAAG,WAAW,CAAC,KAAK,EAAE,eAAe,CAAC,CAAA;IAQlE,OAAO,CAAC,OAAO,CAAQ;IAE1B,IAAI,QAAQ,2DAA+B;IAC3C,IAAI,IAAI,UAA2B;IACnC,IAAI,YAAY,+/CAAsC;IAEtD,OAAO,KAAK,SAAS,GAAkD;IACvE,OAAO,KAAK,QAAQ,GAA0D;IAE9E,OAAO,KAAK,gBAAgB,GAAuD;IAEnF,OAAO,KAAK,UAAU,GAIrB;IAED,IAAI,SAAS,YAGZ;IAGD,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,YAAY;IAO/C,SAAS,CAAC,iBAAiB,CAAC,KAAK,EAAE,UAAU;cAQ7B,aAAa,CAAC,KAAK,EAAE,aAAa;IA2ClD,OAAO,CAAC,SAAS;IAWjB,WAAoB,MAAM,kCA0CzB;IAED,OAAO,KAAK,OAAO,GAAmC;IAEtD,cAAuB,QAAQ,uBAU9B;IAED,OAAO,KAAK,eAAe,GAE1B;IAED,OAAO,KAAK,mBAAmB,GAE9B;CACD;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,mBAAmB,EAAE,YAAY,CAAC,OAAO,CAAC,CAAA;KAC1C;CACD"}
|
package/dist/DataGridCell.js
CHANGED
|
@@ -99,46 +99,46 @@ let DataGridCell = class DataGridCell extends Component {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
static get styles() {
|
|
102
|
-
return css `
|
|
103
|
-
:host {
|
|
104
|
-
position: relative;
|
|
105
|
-
padding-inline: var(--mo-data-grid-cell-padding, 3px);
|
|
106
|
-
user-select: none;
|
|
107
|
-
line-height: var(--mo-data-grid-row-height);
|
|
108
|
-
white-space: nowrap;
|
|
109
|
-
overflow: hidden !important;
|
|
110
|
-
text-overflow: ellipsis;
|
|
111
|
-
font-size: var(--mo-data-grid-cell-font-size);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
:host(:not([isEditing]):focus) {
|
|
115
|
-
outline: 2px solid var(--mo-color-accent);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
:host([isEditing]) {
|
|
119
|
-
display: grid;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
:host([alignment=end]) {
|
|
123
|
-
text-align: end;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
:host([alignment=start]) {
|
|
127
|
-
text-align: start
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
:host([alignment=center]) {
|
|
131
|
-
text-align: center;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
:host > :first-child {
|
|
135
|
-
line-height: var(--mo-data-grid-row-height);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
:host([isEditing]) > :first-child {
|
|
139
|
-
align-self: center;
|
|
140
|
-
justify-self: stretch;
|
|
141
|
-
}
|
|
102
|
+
return css `
|
|
103
|
+
:host {
|
|
104
|
+
position: relative;
|
|
105
|
+
padding-inline: var(--mo-data-grid-cell-padding, 3px);
|
|
106
|
+
user-select: none;
|
|
107
|
+
line-height: var(--mo-data-grid-row-height);
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
overflow: hidden !important;
|
|
110
|
+
text-overflow: ellipsis;
|
|
111
|
+
font-size: var(--mo-data-grid-cell-font-size);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
:host(:not([isEditing]):focus) {
|
|
115
|
+
outline: 2px solid var(--mo-color-accent);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host([isEditing]) {
|
|
119
|
+
display: grid;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
:host([alignment=end]) {
|
|
123
|
+
text-align: end;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
:host([alignment=start]) {
|
|
127
|
+
text-align: start
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
:host([alignment=center]) {
|
|
131
|
+
text-align: center;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host > :first-child {
|
|
135
|
+
line-height: var(--mo-data-grid-row-height);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
:host([isEditing]) > :first-child {
|
|
139
|
+
align-self: center;
|
|
140
|
+
justify-self: stretch;
|
|
141
|
+
}
|
|
142
142
|
`;
|
|
143
143
|
}
|
|
144
144
|
get tooltip() { return this.valueTextContent; }
|
package/dist/DataGridFooter.js
CHANGED
|
@@ -23,33 +23,33 @@ let DataGridFooter = class DataGridFooter extends Component {
|
|
|
23
23
|
this.manualPageSize = false;
|
|
24
24
|
}
|
|
25
25
|
static get styles() {
|
|
26
|
-
return css `
|
|
27
|
-
:host {
|
|
28
|
-
grid-column: 1 / last-line;
|
|
29
|
-
grid-row: 3;
|
|
30
|
-
min-height: var(--mo-data-grid-footer-min-height);
|
|
31
|
-
background: var(--mo-data-grid-footer-background);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
:host(:not([hideTopBorder])) {
|
|
35
|
-
border-top: var(--mo-data-grid-border);
|
|
36
|
-
}
|
|
26
|
+
return css `
|
|
27
|
+
:host {
|
|
28
|
+
grid-column: 1 / last-line;
|
|
29
|
+
grid-row: 3;
|
|
30
|
+
min-height: var(--mo-data-grid-footer-min-height);
|
|
31
|
+
background: var(--mo-data-grid-footer-background);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host(:not([hideTopBorder])) {
|
|
35
|
+
border-top: var(--mo-data-grid-border);
|
|
36
|
+
}
|
|
37
37
|
`;
|
|
38
38
|
}
|
|
39
39
|
get template() {
|
|
40
40
|
this.toggleAttribute('hideTopBorder', this.dataGrid.hasFooter === false);
|
|
41
|
-
return this.dataGrid.hasFooter === false ? html.nothing : html `
|
|
42
|
-
<mo-flex direction='horizontal' justifyContent='space-between' alignItems='center' wrap='wrap-reverse' gap='6px' ${style({ flex: '1', padding: '0 6px', height: '100%' })}>
|
|
43
|
-
<mo-flex direction='horizontal' alignItems='center' gap='3vw' ${style({ flexBasis: 'auto' })}>
|
|
44
|
-
${this.paginationTemplate}
|
|
45
|
-
${this.exportTemplate}
|
|
46
|
-
</mo-flex>
|
|
47
|
-
|
|
48
|
-
<mo-flex direction='horizontal' alignItems='center' gap='10px' wrap='wrap-reverse' ${style({ paddingInlineEnd: 'var(--mo-data-grid-footer-trailing-padding)' })}>
|
|
49
|
-
${this.dataGrid.sumsTemplate}
|
|
50
|
-
<slot name='sum'></slot>
|
|
51
|
-
</mo-flex>
|
|
52
|
-
</mo-flex>
|
|
41
|
+
return this.dataGrid.hasFooter === false ? html.nothing : html `
|
|
42
|
+
<mo-flex direction='horizontal' justifyContent='space-between' alignItems='center' wrap='wrap-reverse' gap='6px' ${style({ flex: '1', padding: '0 6px', height: '100%' })}>
|
|
43
|
+
<mo-flex direction='horizontal' alignItems='center' gap='3vw' ${style({ flexBasis: 'auto' })}>
|
|
44
|
+
${this.paginationTemplate}
|
|
45
|
+
${this.exportTemplate}
|
|
46
|
+
</mo-flex>
|
|
47
|
+
|
|
48
|
+
<mo-flex direction='horizontal' alignItems='center' gap='10px' wrap='wrap-reverse' ${style({ paddingInlineEnd: 'var(--mo-data-grid-footer-trailing-padding)' })}>
|
|
49
|
+
${this.dataGrid.sumsTemplate}
|
|
50
|
+
<slot name='sum'></slot>
|
|
51
|
+
</mo-flex>
|
|
52
|
+
</mo-flex>
|
|
53
53
|
`;
|
|
54
54
|
}
|
|
55
55
|
get paginationTemplate() {
|
|
@@ -62,53 +62,53 @@ let DataGridFooter = class DataGridFooter extends Component {
|
|
|
62
62
|
`${(Math.min(from, to)).format()}-${to.format()}`,
|
|
63
63
|
hasUnknownDataLength ? undefined : this.dataGrid.dataLength.format(),
|
|
64
64
|
].filter(Boolean).join(' / ');
|
|
65
|
-
return !this.dataGrid.hasPagination ? html.nothing : html `
|
|
66
|
-
<mo-flex direction='horizontal' alignItems='center' gap='1vw'>
|
|
67
|
-
<mo-flex direction='horizontal' gap='4px' alignItems='center' justifyContent='center'>
|
|
68
|
-
<mo-icon-button dense icon=${isRtl ? 'last_page' : 'first_page'}
|
|
69
|
-
?disabled=${this.page === 1}
|
|
70
|
-
@click=${() => this.setPage(1)}
|
|
71
|
-
></mo-icon-button>
|
|
72
|
-
|
|
73
|
-
<mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_right' : 'keyboard_arrow_left'}
|
|
74
|
-
?disabled=${this.page === 1}
|
|
75
|
-
@click=${() => this.setPage(this.page - 1)}
|
|
76
|
-
></mo-icon-button>
|
|
77
|
-
|
|
78
|
-
<div ${style({ cursor: 'pointer', width: hasUnknownDataLength ? '40px' : '75px', textAlign: 'center' })}>
|
|
79
|
-
${this.manualPagination ? html `
|
|
80
|
-
<mo-field-number dense
|
|
81
|
-
value=${this.page}
|
|
82
|
-
@change=${(e) => this.handleManualPageChange(e.detail)}>
|
|
83
|
-
</mo-field-number>
|
|
84
|
-
` : html `
|
|
85
|
-
<div ${style({ fontSize: 'small' })} @click=${() => this.manualPagination = hasUnknownDataLength === false}>${pageText}</div>
|
|
86
|
-
`}
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
|
|
90
|
-
?disabled=${!this.dataGrid.hasNextPage}
|
|
91
|
-
@click=${() => this.setPage(this.page + 1)}
|
|
92
|
-
></mo-icon-button>
|
|
93
|
-
|
|
94
|
-
<mo-icon-button dense icon=${isRtl ? 'first_page' : 'last_page'}
|
|
95
|
-
?disabled=${hasUnknownDataLength || this.page === this.dataGrid.maxPage}
|
|
96
|
-
@click=${() => this.setPage(this.dataGrid.maxPage ?? 1)}
|
|
97
|
-
></mo-icon-button>
|
|
98
|
-
</mo-flex>
|
|
99
|
-
|
|
100
|
-
<div ${style({ color: 'var(--mo-color-gray)', marginInlineStart: '8px' })}>
|
|
101
|
-
${!this.manualPageSize ? html `
|
|
102
|
-
<div ${style({ fontSize: 'small' })} @click=${() => this.manualPageSize = true}>${pageSizeText}</div>
|
|
103
|
-
` : html `
|
|
104
|
-
<mo-field-select-data-grid-page-size dense ${style({ width: '90px' })}
|
|
105
|
-
.dataGrid=${this.dataGrid}
|
|
106
|
-
value=${ifDefined(this.dataGrid.pagination)}
|
|
107
|
-
@change=${(e) => this.handlePaginationChange(e.detail)}>
|
|
108
|
-
</mo-field-select-data-grid-page-size>
|
|
109
|
-
`}
|
|
110
|
-
</div>
|
|
111
|
-
</mo-flex>
|
|
65
|
+
return !this.dataGrid.hasPagination ? html.nothing : html `
|
|
66
|
+
<mo-flex direction='horizontal' alignItems='center' gap='1vw'>
|
|
67
|
+
<mo-flex direction='horizontal' gap='4px' alignItems='center' justifyContent='center'>
|
|
68
|
+
<mo-icon-button dense icon=${isRtl ? 'last_page' : 'first_page'}
|
|
69
|
+
?disabled=${this.page === 1}
|
|
70
|
+
@click=${() => this.setPage(1)}
|
|
71
|
+
></mo-icon-button>
|
|
72
|
+
|
|
73
|
+
<mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_right' : 'keyboard_arrow_left'}
|
|
74
|
+
?disabled=${this.page === 1}
|
|
75
|
+
@click=${() => this.setPage(this.page - 1)}
|
|
76
|
+
></mo-icon-button>
|
|
77
|
+
|
|
78
|
+
<div ${style({ cursor: 'pointer', width: hasUnknownDataLength ? '40px' : '75px', textAlign: 'center' })}>
|
|
79
|
+
${this.manualPagination ? html `
|
|
80
|
+
<mo-field-number dense
|
|
81
|
+
value=${this.page}
|
|
82
|
+
@change=${(e) => this.handleManualPageChange(e.detail)}>
|
|
83
|
+
</mo-field-number>
|
|
84
|
+
` : html `
|
|
85
|
+
<div ${style({ fontSize: 'small' })} @click=${() => this.manualPagination = hasUnknownDataLength === false}>${pageText}</div>
|
|
86
|
+
`}
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<mo-icon-button dense icon=${isRtl ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}
|
|
90
|
+
?disabled=${!this.dataGrid.hasNextPage}
|
|
91
|
+
@click=${() => this.setPage(this.page + 1)}
|
|
92
|
+
></mo-icon-button>
|
|
93
|
+
|
|
94
|
+
<mo-icon-button dense icon=${isRtl ? 'first_page' : 'last_page'}
|
|
95
|
+
?disabled=${hasUnknownDataLength || this.page === this.dataGrid.maxPage}
|
|
96
|
+
@click=${() => this.setPage(this.dataGrid.maxPage ?? 1)}
|
|
97
|
+
></mo-icon-button>
|
|
98
|
+
</mo-flex>
|
|
99
|
+
|
|
100
|
+
<div ${style({ color: 'var(--mo-color-gray)', marginInlineStart: '8px' })}>
|
|
101
|
+
${!this.manualPageSize ? html `
|
|
102
|
+
<div ${style({ fontSize: 'small' })} @click=${() => this.manualPageSize = true}>${pageSizeText}</div>
|
|
103
|
+
` : html `
|
|
104
|
+
<mo-field-select-data-grid-page-size dense ${style({ width: '90px' })}
|
|
105
|
+
.dataGrid=${this.dataGrid}
|
|
106
|
+
value=${ifDefined(this.dataGrid.pagination)}
|
|
107
|
+
@change=${(e) => this.handlePaginationChange(e.detail)}>
|
|
108
|
+
</mo-field-select-data-grid-page-size>
|
|
109
|
+
`}
|
|
110
|
+
</div>
|
|
111
|
+
</mo-flex>
|
|
112
112
|
`;
|
|
113
113
|
}
|
|
114
114
|
handlePaginationChange(value) {
|
|
@@ -126,28 +126,28 @@ let DataGridFooter = class DataGridFooter extends Component {
|
|
|
126
126
|
this.manualPagination = false;
|
|
127
127
|
}
|
|
128
128
|
get exportTemplate() {
|
|
129
|
-
return !this.dataGrid.exportable ? html.nothing : html `
|
|
130
|
-
<style>
|
|
131
|
-
#export {
|
|
132
|
-
height: 21px;
|
|
133
|
-
width: 21px;
|
|
134
|
-
aspect-ratio: 1 / 1;
|
|
135
|
-
transition: .25s;
|
|
136
|
-
-webkit-filter: grayscale(100%);
|
|
137
|
-
filter: grayscale(100%);
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
#export:hover {
|
|
142
|
-
-webkit-filter: grayscale(0%);
|
|
143
|
-
filter: grayscale(0%);
|
|
144
|
-
}
|
|
145
|
-
</style>
|
|
146
|
-
<img id='export'
|
|
147
|
-
src=${`data:image/svg+xml,${encodeURIComponent(excelSvg)}`}
|
|
148
|
-
${tooltip(t('Export current view to Excel'), TooltipPlacement.BlockStart)}
|
|
149
|
-
@click=${() => this.dataGrid.exportExcelFile()}
|
|
150
|
-
/>
|
|
129
|
+
return !this.dataGrid.exportable ? html.nothing : html `
|
|
130
|
+
<style>
|
|
131
|
+
#export {
|
|
132
|
+
height: 21px;
|
|
133
|
+
width: 21px;
|
|
134
|
+
aspect-ratio: 1 / 1;
|
|
135
|
+
transition: .25s;
|
|
136
|
+
-webkit-filter: grayscale(100%);
|
|
137
|
+
filter: grayscale(100%);
|
|
138
|
+
cursor: pointer;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
#export:hover {
|
|
142
|
+
-webkit-filter: grayscale(0%);
|
|
143
|
+
filter: grayscale(0%);
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
146
|
+
<img id='export'
|
|
147
|
+
src=${`data:image/svg+xml,${encodeURIComponent(excelSvg)}`}
|
|
148
|
+
${tooltip(t('Export current view to Excel'), TooltipPlacement.BlockStart)}
|
|
149
|
+
@click=${() => this.dataGrid.exportExcelFile()}
|
|
150
|
+
/>
|
|
151
151
|
`;
|
|
152
152
|
}
|
|
153
153
|
setPage(value) {
|
package/dist/DataGridHeader.js
CHANGED
|
@@ -40,45 +40,45 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
40
40
|
this.dataGrid.selectionChange.unsubscribe(this.handleDataGridSelectionChange);
|
|
41
41
|
}
|
|
42
42
|
static get styles() {
|
|
43
|
-
return css `
|
|
44
|
-
:host {
|
|
45
|
-
--mo-data-grid-header-separator-height: 15px;
|
|
46
|
-
--mo-data-grid-header-separator-width: 2px;
|
|
47
|
-
display: inherit;
|
|
48
|
-
font-size: small;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
#header {
|
|
52
|
-
border-top: var(--mo-data-grid-border);
|
|
53
|
-
border-bottom: var(--mo-data-grid-border);
|
|
54
|
-
position: relative;
|
|
55
|
-
height: var(--mo-data-grid-header-height);
|
|
56
|
-
background: var(--mo-data-grid-header-background);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.headerContent {
|
|
60
|
-
padding: 0 var(--mo-data-grid-cell-padding, 3px);
|
|
61
|
-
display: inline-block;
|
|
62
|
-
overflow: hidden !important;
|
|
63
|
-
color: var(--mo-color-foreground);
|
|
64
|
-
font-weight: 500;
|
|
65
|
-
line-height: var(--mo-data-grid-header-height);
|
|
66
|
-
white-space: nowrap;
|
|
67
|
-
text-overflow: ellipsis;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.sort-rank {
|
|
71
|
-
background: var(--mo-color-transparent-gray-3);
|
|
72
|
-
color: var(--mo-color-foreground);
|
|
73
|
-
border: 1px solid var(--mo-color-gray-transparent);
|
|
74
|
-
border-radius: 50%;
|
|
75
|
-
width: 20px;
|
|
76
|
-
height: 20px;
|
|
77
|
-
aspect-ratio: 1 / 1;
|
|
78
|
-
display: flex;
|
|
79
|
-
align-items: center;
|
|
80
|
-
justify-content: center;
|
|
81
|
-
}
|
|
43
|
+
return css `
|
|
44
|
+
:host {
|
|
45
|
+
--mo-data-grid-header-separator-height: 15px;
|
|
46
|
+
--mo-data-grid-header-separator-width: 2px;
|
|
47
|
+
display: inherit;
|
|
48
|
+
font-size: small;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
#header {
|
|
52
|
+
border-top: var(--mo-data-grid-border);
|
|
53
|
+
border-bottom: var(--mo-data-grid-border);
|
|
54
|
+
position: relative;
|
|
55
|
+
height: var(--mo-data-grid-header-height);
|
|
56
|
+
background: var(--mo-data-grid-header-background);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.headerContent {
|
|
60
|
+
padding: 0 var(--mo-data-grid-cell-padding, 3px);
|
|
61
|
+
display: inline-block;
|
|
62
|
+
overflow: hidden !important;
|
|
63
|
+
color: var(--mo-color-foreground);
|
|
64
|
+
font-weight: 500;
|
|
65
|
+
line-height: var(--mo-data-grid-header-height);
|
|
66
|
+
white-space: nowrap;
|
|
67
|
+
text-overflow: ellipsis;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.sort-rank {
|
|
71
|
+
background: var(--mo-color-transparent-gray-3);
|
|
72
|
+
color: var(--mo-color-foreground);
|
|
73
|
+
border: 1px solid var(--mo-color-gray-transparent);
|
|
74
|
+
border-radius: 50%;
|
|
75
|
+
width: 20px;
|
|
76
|
+
height: 20px;
|
|
77
|
+
aspect-ratio: 1 / 1;
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
justify-content: center;
|
|
81
|
+
}
|
|
82
82
|
`;
|
|
83
83
|
}
|
|
84
84
|
get skeletonColumns() {
|
|
@@ -93,75 +93,75 @@ let DataGridHeader = class DataGridHeader extends Component {
|
|
|
93
93
|
return this.dataGrid.dataColumnsWidths.join(' var(--mo-data-grid-columns-gap) ');
|
|
94
94
|
}
|
|
95
95
|
get template() {
|
|
96
|
-
return html `
|
|
97
|
-
<mo-grid id='header' columns=${this.skeletonColumns} columnGap='var(--mo-data-grid-columns-gap)'>
|
|
98
|
-
${this.detailsExpanderTemplate}
|
|
99
|
-
${this.selectionTemplate}
|
|
100
|
-
${this.contentTemplate}
|
|
101
|
-
${this.moreTemplate}
|
|
102
|
-
</mo-grid>
|
|
96
|
+
return html `
|
|
97
|
+
<mo-grid id='header' columns=${this.skeletonColumns} columnGap='var(--mo-data-grid-columns-gap)'>
|
|
98
|
+
${this.detailsExpanderTemplate}
|
|
99
|
+
${this.selectionTemplate}
|
|
100
|
+
${this.contentTemplate}
|
|
101
|
+
${this.moreTemplate}
|
|
102
|
+
</mo-grid>
|
|
103
103
|
`;
|
|
104
104
|
}
|
|
105
105
|
get detailsExpanderTemplate() {
|
|
106
|
-
return this.dataGrid.hasDetails === false ? html.nothing : html `
|
|
107
|
-
<mo-flex justifyContent='center' alignItems='center'>
|
|
108
|
-
${!this.dataGrid.hasDetails || !this.dataGrid.multipleDetails ? html.nothing : html `
|
|
109
|
-
<mo-icon-button dense ${style({ padding: '-10px 0px 0 -10px' })}
|
|
110
|
-
${style({ display: 'inherit' })}
|
|
111
|
-
icon=${this.dataGrid.allRowDetailsOpen ? 'unfold_less' : 'unfold_more'}
|
|
112
|
-
@click=${() => this.toggleAllDetails()}
|
|
113
|
-
></mo-icon-button>
|
|
114
|
-
`}
|
|
115
|
-
</mo-flex>
|
|
106
|
+
return this.dataGrid.hasDetails === false ? html.nothing : html `
|
|
107
|
+
<mo-flex justifyContent='center' alignItems='center'>
|
|
108
|
+
${!this.dataGrid.hasDetails || !this.dataGrid.multipleDetails ? html.nothing : html `
|
|
109
|
+
<mo-icon-button dense ${style({ padding: '-10px 0px 0 -10px' })}
|
|
110
|
+
${style({ display: 'inherit' })}
|
|
111
|
+
icon=${this.dataGrid.allRowDetailsOpen ? 'unfold_less' : 'unfold_more'}
|
|
112
|
+
@click=${() => this.toggleAllDetails()}
|
|
113
|
+
></mo-icon-button>
|
|
114
|
+
`}
|
|
115
|
+
</mo-flex>
|
|
116
116
|
`;
|
|
117
117
|
}
|
|
118
118
|
get selectionTemplate() {
|
|
119
|
-
return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? html.nothing : html `
|
|
120
|
-
<mo-flex justifyContent='center' alignItems='center'>
|
|
121
|
-
${this.dataGrid.selectionMode !== DataGridSelectionMode.Multiple ? html.nothing : html `
|
|
122
|
-
<mo-checkbox ${style({ position: 'absolute' })} .selected=${this.selection} @change=${this.handleSelectionChange}></mo-checkbox>
|
|
123
|
-
`}
|
|
124
|
-
</mo-flex>
|
|
119
|
+
return this.dataGrid.hasSelection === false || this.dataGrid.selectionCheckboxesHidden ? html.nothing : html `
|
|
120
|
+
<mo-flex justifyContent='center' alignItems='center'>
|
|
121
|
+
${this.dataGrid.selectionMode !== DataGridSelectionMode.Multiple ? html.nothing : html `
|
|
122
|
+
<mo-checkbox ${style({ position: 'absolute' })} .selected=${this.selection} @change=${this.handleSelectionChange}></mo-checkbox>
|
|
123
|
+
`}
|
|
124
|
+
</mo-flex>
|
|
125
125
|
`;
|
|
126
126
|
}
|
|
127
127
|
get contentTemplate() {
|
|
128
|
-
return html `
|
|
129
|
-
<mo-grid columns=${this.separatorAdjustedColumns}>
|
|
130
|
-
${join(this.dataGrid.visibleColumns.map(column => this.getHeaderCellTemplate(column)), index => html `
|
|
131
|
-
<mo-data-grid-header-separator
|
|
132
|
-
.dataGrid=${this.dataGrid}
|
|
133
|
-
.column=${this.dataGrid.visibleColumns[index]}
|
|
134
|
-
@columnUpdate=${() => this.dataGrid.requestUpdate()}
|
|
135
|
-
></mo-data-grid-header-separator>
|
|
136
|
-
`)}
|
|
137
|
-
</mo-grid>
|
|
128
|
+
return html `
|
|
129
|
+
<mo-grid columns=${this.separatorAdjustedColumns}>
|
|
130
|
+
${join(this.dataGrid.visibleColumns.map(column => this.getHeaderCellTemplate(column)), index => html `
|
|
131
|
+
<mo-data-grid-header-separator
|
|
132
|
+
.dataGrid=${this.dataGrid}
|
|
133
|
+
.column=${this.dataGrid.visibleColumns[index]}
|
|
134
|
+
@columnUpdate=${() => this.dataGrid.requestUpdate()}
|
|
135
|
+
></mo-data-grid-header-separator>
|
|
136
|
+
`)}
|
|
137
|
+
</mo-grid>
|
|
138
138
|
`;
|
|
139
139
|
}
|
|
140
140
|
getHeaderCellTemplate(column) {
|
|
141
141
|
const sortingDefinition = this.dataGrid.getSortingDefinition(column);
|
|
142
142
|
const sortIcon = !sortingDefinition ? undefined : sortingDefinition.strategy === DataGridSortingStrategy.Ascending ? 'arrow_upward' : 'arrow_downward';
|
|
143
143
|
const sortingRank = !sortingDefinition || this.dataGrid.getSorting().length <= 1 ? undefined : sortingDefinition.rank;
|
|
144
|
-
return html `
|
|
145
|
-
<mo-flex direction=${column.alignment === 'end' ? 'horizontal-reversed' : 'horizontal'} alignItems='center'
|
|
146
|
-
${style({ overflow: 'hidden', position: 'relative', cursor: 'pointer', userSelect: 'none' })}
|
|
147
|
-
@click=${() => this.sort(column)}
|
|
148
|
-
>
|
|
149
|
-
<div class='headerContent' ${style({ width: '100%', textAlign: column.alignment })} title=${column.title || column.heading}>${column.heading}</div>
|
|
150
|
-
|
|
151
|
-
${sortIcon === undefined ? html.nothing : html `
|
|
152
|
-
${!sortingRank ? html.nothing : html `<span class='sort-rank'>${sortingRank}</span>`}
|
|
153
|
-
<mo-icon ${style({ color: 'var(--mo-color-accent)' })} icon=${ifDefined(sortIcon)}></mo-icon>
|
|
154
|
-
`}
|
|
155
|
-
</mo-flex>
|
|
144
|
+
return html `
|
|
145
|
+
<mo-flex direction=${column.alignment === 'end' ? 'horizontal-reversed' : 'horizontal'} alignItems='center'
|
|
146
|
+
${style({ overflow: 'hidden', position: 'relative', cursor: 'pointer', userSelect: 'none' })}
|
|
147
|
+
@click=${() => this.sort(column)}
|
|
148
|
+
>
|
|
149
|
+
<div class='headerContent' ${style({ width: '100%', textAlign: column.alignment })} title=${column.title || column.heading}>${column.heading}</div>
|
|
150
|
+
|
|
151
|
+
${sortIcon === undefined ? html.nothing : html `
|
|
152
|
+
${!sortingRank ? html.nothing : html `<span class='sort-rank'>${sortingRank}</span>`}
|
|
153
|
+
<mo-icon ${style({ color: 'var(--mo-color-accent)' })} icon=${ifDefined(sortIcon)}></mo-icon>
|
|
154
|
+
`}
|
|
155
|
+
</mo-flex>
|
|
156
156
|
`;
|
|
157
157
|
}
|
|
158
158
|
get moreTemplate() {
|
|
159
|
-
return this.dataGrid.hasToolbar || this.dataGrid.sidePanelHidden ? html.nothing : html `
|
|
160
|
-
<mo-flex alignItems='center' justifyContent='center' ${style({ marginInlineEnd: '8px', cursor: 'pointer', position: 'relative' })}>
|
|
161
|
-
<mo-icon-button dense icon='settings' ${style({ color: 'var(--mo-color-accent)', fontSize: 'large' })}
|
|
162
|
-
@click=${() => this.dataGrid.navigateToSidePanelTab(this.dataGrid.sidePanelTab ? undefined : DataGridSidePanelTab.Settings)}
|
|
163
|
-
></mo-icon-button>
|
|
164
|
-
</mo-flex>
|
|
159
|
+
return this.dataGrid.hasToolbar || this.dataGrid.sidePanelHidden ? html.nothing : html `
|
|
160
|
+
<mo-flex alignItems='center' justifyContent='center' ${style({ marginInlineEnd: '8px', cursor: 'pointer', position: 'relative' })}>
|
|
161
|
+
<mo-icon-button dense icon='settings' ${style({ color: 'var(--mo-color-accent)', fontSize: 'large' })}
|
|
162
|
+
@click=${() => this.dataGrid.navigateToSidePanelTab(this.dataGrid.sidePanelTab ? undefined : DataGridSidePanelTab.Settings)}
|
|
163
|
+
></mo-icon-button>
|
|
164
|
+
</mo-flex>
|
|
165
165
|
`;
|
|
166
166
|
}
|
|
167
167
|
sort(column) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '@a11d/lit';
|
|
2
2
|
import { ColumnDefinition, DataGrid } from './index.js';
|
|
3
|
-
/** @fires columnUpdate
|
|
3
|
+
/** @fires columnUpdate */
|
|
4
4
|
export declare class DataGridHeaderSeparator extends Component {
|
|
5
5
|
static disableResizing: boolean;
|
|
6
6
|
readonly columnUpdate: EventDispatcher;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataGridHeaderSeparator.d.ts","sourceRoot":"","sources":["../DataGridHeaderSeparator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsE,MAAM,WAAW,CAAA;AACzG,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEvD,
|
|
1
|
+
{"version":3,"file":"DataGridHeaderSeparator.d.ts","sourceRoot":"","sources":["../DataGridHeaderSeparator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAsE,MAAM,WAAW,CAAA;AACzG,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAEvD,0BAA0B;AAC1B,qBACa,uBAAwB,SAAQ,SAAS;IACrD,MAAM,CAAC,eAAe,UAAQ;IAErB,QAAQ,CAAC,YAAY,EAAG,eAAe,CAAA;IAEpB,QAAQ,EAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC5B,MAAM,EAAG,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAErD,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,KAAK,CAAI;IAE1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAK;IAE7B,OAAO,CAAC,YAAY,CAAC,CAAQ;IAC7B,OAAO,CAAC,WAAW,CAAC,CAAQ;IAE5B,WAAoB,MAAM,kCAuCzB;IAED,cAAuB,QAAQ,0CAW9B;IAGD,SAAS,CAAC,aAAa;IAavB,SAAS,CAAC,eAAe,CAAC,CAAC,EAAE,UAAU;IAmBvC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAM/B;IAED,OAAO,CAAC,cAAc;CAmBtB;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,+BAA+B,EAAE,uBAAuB,CAAA;KACxD;CACD"}
|