@3mo/data-grid 0.5.12 → 0.5.14
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/CsvGenerator.d.ts.map +1 -1
- package/dist/CsvGenerator.js +19 -6
- package/dist/DataGrid.d.ts +14 -14
- package/dist/DataGrid.js +22 -22
- package/dist/DataGridCell.d.ts +1 -1
- package/dist/DataGridCell.d.ts.map +1 -1
- package/dist/DataGridFooter.js +92 -92
- package/dist/DataGridHeaderSeparator.d.ts +1 -1
- package/dist/DataGridHeaderSeparator.d.ts.map +1 -1
- package/dist/DataGridHeaderSeparator.js +1 -1
- package/dist/DataGridPrimaryContextMenuItem.js +5 -5
- package/dist/FieldSelectDataGridPageSize.js +7 -7
- package/dist/columns/DataGridColumnImage.js +2 -2
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CsvGenerator.d.ts","sourceRoot":"","sources":["../CsvGenerator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7C,qBAAa,YAAY;IACxB,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"CsvGenerator.d.ts","sourceRoot":"","sources":["../CsvGenerator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAE7C,qBAAa,YAAY;IACxB,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC;CA0BrD"}
|
package/dist/CsvGenerator.js
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
import { Downloader } from '@3mo/downloader';
|
|
2
2
|
export class CsvGenerator {
|
|
3
3
|
static generate(dataGrid) {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
const flattenedData = [...dataGrid['getFlattenedData']()];
|
|
5
|
+
const maxLevel = Math.max(...flattenedData.map(d => d.level));
|
|
6
|
+
const [firstHeading, ...restHeadings] = dataGrid.visibleColumns.map(c => c.heading);
|
|
7
|
+
const rows = [
|
|
8
|
+
[firstHeading, ...Array.from({ length: maxLevel }).fill(''), ...restHeadings],
|
|
9
|
+
...flattenedData.map(d => {
|
|
10
|
+
const nestedPadding = Array.from({ length: d.level }).fill('');
|
|
11
|
+
const childrenPadding = Array.from({ length: maxLevel - d.level }).fill('');
|
|
12
|
+
const [first, ...rest] = dataGrid.visibleColumns.flatMap(column => getValueByKeyPath(d.data, column.dataSelector));
|
|
13
|
+
return [
|
|
14
|
+
...nestedPadding,
|
|
15
|
+
first,
|
|
16
|
+
...childrenPadding,
|
|
17
|
+
...rest
|
|
18
|
+
];
|
|
19
|
+
})
|
|
20
|
+
];
|
|
21
|
+
const csv = rows.map(row => row.join(',')).join('\n');
|
|
8
22
|
// @ts-expect-error manifest can be undefined
|
|
9
|
-
const
|
|
10
|
-
const fileName = (manifest?.short_name ?? '') + 'Export'.replace(/ /g, '_');
|
|
23
|
+
const fileName = (globalThis.manifest?.short_name ?? '') + 'Export'.replace(/ /g, '_');
|
|
11
24
|
Downloader.download(`data:text/csv;charset=utf-8,${encodeURIComponent(csv)}`, `${fileName}.csv`);
|
|
12
25
|
}
|
|
13
26
|
}
|
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 {
|
|
@@ -799,16 +799,16 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
799
799
|
}
|
|
800
800
|
*getFlattenedData() {
|
|
801
801
|
if (!this.subDataGridDataSelector) {
|
|
802
|
-
yield* this.data;
|
|
802
|
+
yield* this.data.map(d => ({ level: 0, data: d }));
|
|
803
803
|
return;
|
|
804
804
|
}
|
|
805
|
-
const flatten = (data) => {
|
|
805
|
+
const flatten = (data, level = 0) => {
|
|
806
806
|
const subData = getValueByKeyPath(data, this.subDataGridDataSelector);
|
|
807
807
|
return [
|
|
808
|
-
data,
|
|
808
|
+
{ data, level },
|
|
809
809
|
...!Array.isArray(subData)
|
|
810
810
|
? []
|
|
811
|
-
: subData.flatMap(flatten)
|
|
811
|
+
: subData.flatMap(d => flatten(d, level + 1))
|
|
812
812
|
];
|
|
813
813
|
};
|
|
814
814
|
for (const data of this.data) {
|
|
@@ -817,7 +817,7 @@ let DataGrid = DataGrid_1 = class DataGrid extends Component {
|
|
|
817
817
|
return;
|
|
818
818
|
}
|
|
819
819
|
get flattenedData() {
|
|
820
|
-
return [...this.getFlattenedData()];
|
|
820
|
+
return [...this.getFlattenedData()].map(({ data }) => data);
|
|
821
821
|
}
|
|
822
822
|
get sortedData() {
|
|
823
823
|
const sorting = this.getSorting();
|
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/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) {
|
|
@@ -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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var DataGridHeaderSeparator_1;
|
|
2
2
|
import { __decorate } from "tslib";
|
|
3
3
|
import { Component, component, property, html, css, state, event, eventListener, style } from '@a11d/lit';
|
|
4
|
-
/** @fires columnUpdate
|
|
4
|
+
/** @fires columnUpdate */
|
|
5
5
|
let DataGridHeaderSeparator = DataGridHeaderSeparator_1 = class DataGridHeaderSeparator extends Component {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
@@ -3,11 +3,11 @@ import { component, css } from '@a11d/lit';
|
|
|
3
3
|
import { ContextMenuItem } from '@3mo/context-menu';
|
|
4
4
|
let DataGridPrimaryContextMenuItem = class DataGridPrimaryContextMenuItem extends ContextMenuItem {
|
|
5
5
|
static get styles() {
|
|
6
|
-
return css `
|
|
7
|
-
${super.styles}
|
|
8
|
-
:host {
|
|
9
|
-
font-weight: bold;
|
|
10
|
-
}
|
|
6
|
+
return css `
|
|
7
|
+
${super.styles}
|
|
8
|
+
:host {
|
|
9
|
+
font-weight: bold;
|
|
10
|
+
}
|
|
11
11
|
`;
|
|
12
12
|
}
|
|
13
13
|
};
|
|
@@ -4,13 +4,13 @@ import { component, html, property } from '@a11d/lit';
|
|
|
4
4
|
import { FieldSelect } from '@3mo/select-field';
|
|
5
5
|
let FieldSelectDataGridPageSize = FieldSelectDataGridPageSize_1 = class FieldSelectDataGridPageSize extends FieldSelect {
|
|
6
6
|
get optionsTemplate() {
|
|
7
|
-
return html `
|
|
8
|
-
${!this.dataGrid || !this.dataGrid.supportsDynamicPageSize ? html.nothing : html `
|
|
9
|
-
<mo-option value='auto'>Auto</mo-option>
|
|
10
|
-
`}
|
|
11
|
-
${FieldSelectDataGridPageSize_1.data.map(size => html `
|
|
12
|
-
<mo-option value=${size}>${size.format()}</mo-option>
|
|
13
|
-
`)}
|
|
7
|
+
return html `
|
|
8
|
+
${!this.dataGrid || !this.dataGrid.supportsDynamicPageSize ? html.nothing : html `
|
|
9
|
+
<mo-option value='auto'>Auto</mo-option>
|
|
10
|
+
`}
|
|
11
|
+
${FieldSelectDataGridPageSize_1.data.map(size => html `
|
|
12
|
+
<mo-option value=${size}>${size.format()}</mo-option>
|
|
13
|
+
`)}
|
|
14
14
|
`;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
@@ -11,8 +11,8 @@ let DataGridColumnImage = class DataGridColumnImage extends DataGridColumn {
|
|
|
11
11
|
}
|
|
12
12
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
13
13
|
getContentTemplate(value, _data) {
|
|
14
|
-
return !value ? html.nothing : html `
|
|
15
|
-
<img style='vertical-align: middle' src=${value} onload='this.hidden = false' onerror='this.hidden = true'/>
|
|
14
|
+
return !value ? html.nothing : html `
|
|
15
|
+
<img style='vertical-align: middle' src=${value} onload='this.hidden = false' onerror='this.hidden = true'/>
|
|
16
16
|
`;
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -13,29 +13,29 @@ let DataGridFooterSum = class DataGridFooterSum extends Component {
|
|
|
13
13
|
this.heading = '';
|
|
14
14
|
}
|
|
15
15
|
static get styles() {
|
|
16
|
-
return css `
|
|
17
|
-
:host {
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
position: relative;
|
|
21
|
-
max-height: 100%;
|
|
22
|
-
line-height: 1em;
|
|
23
|
-
user-select: all;
|
|
24
|
-
align-items: flex-end;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
div {
|
|
28
|
-
color: var(--mo-color-gray);
|
|
29
|
-
font-size: 0.75rem;
|
|
30
|
-
}
|
|
16
|
+
return css `
|
|
17
|
+
:host {
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-direction: column;
|
|
20
|
+
position: relative;
|
|
21
|
+
max-height: 100%;
|
|
22
|
+
line-height: 1em;
|
|
23
|
+
user-select: all;
|
|
24
|
+
align-items: flex-end;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
div {
|
|
28
|
+
color: var(--mo-color-gray);
|
|
29
|
+
font-size: 0.75rem;
|
|
30
|
+
}
|
|
31
31
|
`;
|
|
32
32
|
}
|
|
33
33
|
get template() {
|
|
34
|
-
return html `
|
|
35
|
-
<div>${this.heading}</div>
|
|
36
|
-
<mo-flex direction='horizontal' justifyContent='center'>
|
|
37
|
-
<slot></slot>
|
|
38
|
-
</mo-flex>
|
|
34
|
+
return html `
|
|
35
|
+
<div>${this.heading}</div>
|
|
36
|
+
<mo-flex direction='horizontal' justifyContent='center'>
|
|
37
|
+
<slot></slot>
|
|
38
|
+
</mo-flex>
|
|
39
39
|
`;
|
|
40
40
|
}
|
|
41
41
|
};
|