@exmg/exm-grid 1.1.36 → 1.2.0
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/.rollup.cache/root/repo/packages/exm-grid/dist/index.d.ts +14 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/index.js +14 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/search/exm-toolbar-search.d.ts +25 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/search/exm-toolbar-search.js +88 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-base-toolbar-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-base-toolbar-styles-css.js +98 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-common-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-common-styles-css.js +104 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-pagination-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-pagination-styles-css.js +104 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-setting-selection-list-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-setting-selection-list-styles-css.js +12 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-styles-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/styles/exm-grid-styles-css.js +414 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-base-toolbar.d.ts +23 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-base-toolbar.js +94 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-pagination.d.ts +37 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-pagination.js +153 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-setting-selection-list.d.ts +24 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-setting-selection-list.js +124 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-smart-toolbar.d.ts +31 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-smart-toolbar.js +138 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar-css.d.ts +1 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar-filters.d.ts +36 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar-filters.js +77 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar.d.ts +41 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid-toolbar.js +198 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid.d.ts +130 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/exm-grid.js +333 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-column-sortable.d.ts +12 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-column-sortable.js +50 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-expandable.d.ts +9 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-expandable.js +42 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-selectable.d.ts +20 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-selectable.js +204 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-sortable.d.ts +9 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/featrues/exm-row-sortable.js +50 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-smart-toolbar-types.d.ts +17 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-smart-toolbar-types.js +6 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-toolbar-types.d.ts +55 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-toolbar-types.js +16 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-types.d.ts +15 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/utils/exm-query-selectors.d.ts +12 -0
- package/.rollup.cache/root/repo/packages/exm-grid/dist/table/utils/exm-query-selectors.js +37 -0
- package/dist/index.js +3 -3
- package/dist/search/exm-toolbar-search.js +6 -5
- package/dist/styles/exm-grid-base-toolbar-styles-css.js +5 -2
- package/dist/styles/exm-grid-common-styles-css.js +5 -2
- package/dist/styles/exm-grid-pagination-styles-css.js +5 -2
- package/dist/styles/exm-grid-setting-selection-list-styles-css.js +5 -2
- package/dist/styles/exm-grid-styles-css.js +5 -2
- package/dist/table/exm-grid-base-toolbar.js +5 -3
- package/dist/table/exm-grid-pagination.js +5 -3
- package/dist/table/exm-grid-setting-selection-list.js +5 -3
- package/dist/table/exm-grid-smart-toolbar.js +8 -6
- package/dist/table/exm-grid-toolbar-filters.js +6 -4
- package/dist/table/exm-grid-toolbar.js +6 -4
- package/dist/table/exm-grid.js +7 -5
- package/dist/table/featrues/exm-column-sortable.js +4 -2
- package/dist/table/featrues/exm-row-expandable.js +4 -2
- package/dist/table/featrues/exm-row-selectable.js +4 -2
- package/dist/table/featrues/exm-row-sortable.js +4 -2
- package/dist/table/types/exm-grid-smart-toolbar-types.js +5 -3
- package/dist/table/types/exm-grid-toolbar-types.js +9 -7
- package/dist/table/utils/exm-query-selectors.js +4 -2
- package/package.json +4 -4
- /package/{dist → .rollup.cache/root/repo/packages/exm-grid/dist}/table/exm-grid-toolbar-css.js +0 -0
- /package/{dist → .rollup.cache/root/repo/packages/exm-grid/dist}/table/types/exm-grid-types.js +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export class ExmColumnSortable {
|
|
2
|
+
constructor(qs, de, dsc, dsd) {
|
|
3
|
+
this.querySelectors = qs;
|
|
4
|
+
this.dispatchEvent = de;
|
|
5
|
+
this.defaultSortColumn = dsc;
|
|
6
|
+
this.defaultSortDirection = dsd;
|
|
7
|
+
}
|
|
8
|
+
initFeature() {
|
|
9
|
+
this.querySelectors.getColumns('th[data-sort]').forEach((column) => {
|
|
10
|
+
const columnId = column.getAttribute('data-sort') || column.getAttribute('data-column-key');
|
|
11
|
+
// set default sort column if any
|
|
12
|
+
if (!!this.defaultSortColumn && !!this.defaultSortDirection && this.defaultSortColumn === columnId) {
|
|
13
|
+
column.setAttribute('data-sort-direction', this.defaultSortDirection);
|
|
14
|
+
}
|
|
15
|
+
this.registerListeners(column, columnId);
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
registerListeners(column, columnId) {
|
|
19
|
+
column.addEventListener('click', () => {
|
|
20
|
+
const columnSortDirection = column.getAttribute('data-sort-direction');
|
|
21
|
+
const nextSortDirection = columnSortDirection === 'ASC' ? 'DESC' : columnSortDirection === 'DESC' ? undefined : 'ASC';
|
|
22
|
+
// reset previous
|
|
23
|
+
this.querySelectors
|
|
24
|
+
.getColumns('th[data-sort-direction=ASC], th[data-sort-direction=DESC]')
|
|
25
|
+
.forEach((alreadySortedColumn) => {
|
|
26
|
+
if (alreadySortedColumn !== column) {
|
|
27
|
+
alreadySortedColumn.removeAttribute('data-sort-direction');
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
if (nextSortDirection) {
|
|
31
|
+
column.setAttribute('data-sort-direction', nextSortDirection);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
column.removeAttribute('data-sort-direction');
|
|
35
|
+
}
|
|
36
|
+
this.fireSortChanged(columnId, nextSortDirection);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
fireSortChanged(columnId, sortDirection) {
|
|
40
|
+
this.dispatchEvent(new CustomEvent('exm-grid-sort-change', {
|
|
41
|
+
bubbles: true,
|
|
42
|
+
composed: true,
|
|
43
|
+
detail: {
|
|
44
|
+
column: columnId,
|
|
45
|
+
sortDirection: sortDirection ? sortDirection : undefined,
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=exm-column-sortable.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExmQuerySelectors } from '../utils/exm-query-selectors.js';
|
|
2
|
+
export declare class ExmRowExpandable {
|
|
3
|
+
private querySelectors;
|
|
4
|
+
private expandableToggleSelector;
|
|
5
|
+
constructor(qs: ExmQuerySelectors, ets: string);
|
|
6
|
+
initFeature(): void;
|
|
7
|
+
updateFeature(): void;
|
|
8
|
+
private registerClickListener;
|
|
9
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export class ExmRowExpandable {
|
|
2
|
+
constructor(qs, ets) {
|
|
3
|
+
this.querySelectors = qs;
|
|
4
|
+
this.expandableToggleSelector = ets;
|
|
5
|
+
}
|
|
6
|
+
initFeature() {
|
|
7
|
+
this.querySelectors
|
|
8
|
+
.getTableBody()
|
|
9
|
+
.querySelectorAll(`${this.expandableToggleSelector}:not([data-is-expandable])`)
|
|
10
|
+
.forEach((triggerElement) => {
|
|
11
|
+
triggerElement.setAttribute('data-is-expandable', '');
|
|
12
|
+
this.registerClickListener(triggerElement);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
updateFeature() {
|
|
16
|
+
this.initFeature();
|
|
17
|
+
}
|
|
18
|
+
registerClickListener(triggerElement) {
|
|
19
|
+
triggerElement.addEventListener('click', (event) => {
|
|
20
|
+
const parentRow = triggerElement.closest('tr');
|
|
21
|
+
const rowDetail = parentRow && parentRow.nextElementSibling;
|
|
22
|
+
if (!parentRow || !rowDetail) {
|
|
23
|
+
// console.error(`Cannot find parent <tr> for selector ${this.expandableToggleSelector}`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
event.preventDefault();
|
|
27
|
+
event.stopPropagation();
|
|
28
|
+
const isExpanded = triggerElement.hasAttribute('data-is-expanded');
|
|
29
|
+
if (isExpanded) {
|
|
30
|
+
triggerElement.removeAttribute('data-is-expanded');
|
|
31
|
+
rowDetail.removeAttribute('data-is-row-expanded');
|
|
32
|
+
parentRow.removeAttribute('data-has-expanded-detail');
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
triggerElement.setAttribute('data-is-expanded', '');
|
|
36
|
+
rowDetail.setAttribute('data-is-row-expanded', '');
|
|
37
|
+
parentRow.setAttribute('data-has-expanded-detail', '');
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=exm-row-expandable.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ExmQuerySelectors } from '../utils/exm-query-selectors.js';
|
|
2
|
+
export declare class ExmRowSelectable {
|
|
3
|
+
allCheckbox?: HTMLInputElement;
|
|
4
|
+
selectedRows: HTMLTableRowElement[];
|
|
5
|
+
private querySelectors;
|
|
6
|
+
private dispatchEvent;
|
|
7
|
+
private selectableCheckboxSelector?;
|
|
8
|
+
private disableRowClickSelection;
|
|
9
|
+
constructor(qs: ExmQuerySelectors, de: (event: Event) => boolean, drcs: boolean, scs?: string);
|
|
10
|
+
initFeature(bodyRows: NodeListOf<HTMLTableRowElement>): void;
|
|
11
|
+
updateFeature(bodyRows: NodeListOf<HTMLTableRowElement>): void;
|
|
12
|
+
syncSelectedItems(): void;
|
|
13
|
+
private fireSelectableRows;
|
|
14
|
+
private updateBodyRowsListeners;
|
|
15
|
+
private initAllCheckbox;
|
|
16
|
+
private syncRowSelectionWithBodyCheckboxes;
|
|
17
|
+
private getBodyCheckboxes;
|
|
18
|
+
private handleAllCheckboxStateChange;
|
|
19
|
+
private updateSelectAllCheckbox;
|
|
20
|
+
}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
const checkCheckbox = (checkboxElement) => {
|
|
2
|
+
checkboxElement.setAttribute('checked', 'checked');
|
|
3
|
+
checkboxElement.removeAttribute('indeterminate');
|
|
4
|
+
checkboxElement.checked = true;
|
|
5
|
+
};
|
|
6
|
+
const uncheckCheckbox = (checkboxElement) => {
|
|
7
|
+
checkboxElement.removeAttribute('checked');
|
|
8
|
+
checkboxElement.removeAttribute('indeterminate');
|
|
9
|
+
checkboxElement.checked = false;
|
|
10
|
+
};
|
|
11
|
+
const indeterminateCheckbox = (checkboxElement) => {
|
|
12
|
+
checkboxElement.removeAttribute('checked');
|
|
13
|
+
checkboxElement.setAttribute('indeterminate', 'true');
|
|
14
|
+
checkboxElement.checked = true;
|
|
15
|
+
};
|
|
16
|
+
const syncCheckboxAttrFromProp = (checkboxElement) => {
|
|
17
|
+
if (checkboxElement.checked) {
|
|
18
|
+
checkboxElement.setAttribute('checked', 'checked');
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
checkboxElement.removeAttribute('checked');
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
export class ExmRowSelectable {
|
|
25
|
+
constructor(qs, de, drcs, scs) {
|
|
26
|
+
this.selectedRows = [];
|
|
27
|
+
this.querySelectors = qs;
|
|
28
|
+
this.dispatchEvent = de;
|
|
29
|
+
this.selectableCheckboxSelector = scs;
|
|
30
|
+
this.disableRowClickSelection = drcs;
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line
|
|
33
|
+
initFeature(bodyRows) {
|
|
34
|
+
const fireEvent = this.initAllCheckbox();
|
|
35
|
+
const rowsSelectionSyncShouldTriggerEvent = this.syncRowSelectionWithBodyCheckboxes();
|
|
36
|
+
this.updateBodyRowsListeners(bodyRows);
|
|
37
|
+
if (fireEvent || rowsSelectionSyncShouldTriggerEvent) {
|
|
38
|
+
this.fireSelectableRows();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// eslint-disable-next-line
|
|
42
|
+
updateFeature(bodyRows) {
|
|
43
|
+
this.updateBodyRowsListeners(bodyRows);
|
|
44
|
+
const rowsSelectionSyncShouldTriggerEvent = this.syncRowSelectionWithBodyCheckboxes();
|
|
45
|
+
this.updateSelectAllCheckbox();
|
|
46
|
+
if (rowsSelectionSyncShouldTriggerEvent) {
|
|
47
|
+
this.fireSelectableRows();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
syncSelectedItems() {
|
|
51
|
+
if (this.syncRowSelectionWithBodyCheckboxes()) {
|
|
52
|
+
this.fireSelectableRows();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
fireSelectableRows() {
|
|
56
|
+
this.dispatchEvent(new CustomEvent('exm-grid-selected-rows-change', {
|
|
57
|
+
bubbles: true,
|
|
58
|
+
composed: true,
|
|
59
|
+
detail: {
|
|
60
|
+
rows: [...this.selectedRows],
|
|
61
|
+
},
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
// eslint-disable-next-line
|
|
65
|
+
updateBodyRowsListeners(bodyRows) {
|
|
66
|
+
bodyRows.forEach((row) => {
|
|
67
|
+
row.setAttribute('data-is-selectable', '');
|
|
68
|
+
row.addEventListener('click', (e) => {
|
|
69
|
+
const target = e.target;
|
|
70
|
+
// Also TR needed for initial auto selected rows on init / if disable row selection it is only possible to use the md-checkbox
|
|
71
|
+
if ((this.disableRowClickSelection && target.tagName !== 'MD-CHECKBOX' && target.tagName !== 'TR') ||
|
|
72
|
+
(target.tagName !== 'TR' && target.tagName !== 'TD' && target.tagName !== 'MD-CHECKBOX')) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const index = this.selectedRows.indexOf(row);
|
|
76
|
+
const isRowAlreadySelected = index > -1;
|
|
77
|
+
if (isRowAlreadySelected) {
|
|
78
|
+
row.removeAttribute('data-selected');
|
|
79
|
+
this.selectedRows.splice(index, 1);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
row.setAttribute('data-selected', '');
|
|
83
|
+
this.selectedRows.push(row);
|
|
84
|
+
}
|
|
85
|
+
const rowCheckbox = this.selectableCheckboxSelector && row.querySelector(this.selectableCheckboxSelector);
|
|
86
|
+
if (rowCheckbox && rowCheckbox !== e.target) {
|
|
87
|
+
if (isRowAlreadySelected) {
|
|
88
|
+
uncheckCheckbox(rowCheckbox);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
checkCheckbox(rowCheckbox);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
else if (rowCheckbox) {
|
|
95
|
+
syncCheckboxAttrFromProp(rowCheckbox);
|
|
96
|
+
}
|
|
97
|
+
this.updateSelectAllCheckbox();
|
|
98
|
+
this.fireSelectableRows();
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
initAllCheckbox() {
|
|
103
|
+
let fireEvent = false;
|
|
104
|
+
this.allCheckbox = this.selectableCheckboxSelector
|
|
105
|
+
? this.querySelectors.getColumn(this.selectableCheckboxSelector)
|
|
106
|
+
: undefined;
|
|
107
|
+
if (this.allCheckbox) {
|
|
108
|
+
if (this.allCheckbox.checked) {
|
|
109
|
+
this.handleAllCheckboxStateChange();
|
|
110
|
+
fireEvent = true;
|
|
111
|
+
}
|
|
112
|
+
this.allCheckbox.addEventListener('change', () => {
|
|
113
|
+
syncCheckboxAttrFromProp(this.allCheckbox);
|
|
114
|
+
this.handleAllCheckboxStateChange();
|
|
115
|
+
this.fireSelectableRows();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return fireEvent;
|
|
119
|
+
}
|
|
120
|
+
syncRowSelectionWithBodyCheckboxes() {
|
|
121
|
+
let fireEvent = false;
|
|
122
|
+
if (this.selectableCheckboxSelector) {
|
|
123
|
+
// remove row attribute data-selected if checkbox not selected
|
|
124
|
+
this.querySelectors
|
|
125
|
+
.getTableBody()
|
|
126
|
+
.querySelectorAll(`tr[data-selected] ${this.selectableCheckboxSelector}:not([checked])`)
|
|
127
|
+
.forEach((uncheckedCheckbox) => {
|
|
128
|
+
const row = uncheckedCheckbox.closest('tr');
|
|
129
|
+
if (row) {
|
|
130
|
+
row.removeAttribute('data-selected');
|
|
131
|
+
fireEvent = true;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
// add row attribute data-selected if checkbox is selected
|
|
135
|
+
this.querySelectors
|
|
136
|
+
.getTableBody()
|
|
137
|
+
.querySelectorAll(`tr:not([data-selected]) ${this.selectableCheckboxSelector}[checked]`)
|
|
138
|
+
.forEach((checkedCheckbox) => {
|
|
139
|
+
const row = checkedCheckbox.closest('tr');
|
|
140
|
+
if (row) {
|
|
141
|
+
row.setAttribute('data-selected', '');
|
|
142
|
+
fireEvent = true;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
const prevSelectedRowsCount = this.selectedRows.length;
|
|
146
|
+
this.selectedRows = Array.from(this.querySelectors.getTableBody().querySelectorAll('tr[data-selected]'));
|
|
147
|
+
if (prevSelectedRowsCount !== this.selectedRows.length) {
|
|
148
|
+
fireEvent = true;
|
|
149
|
+
}
|
|
150
|
+
if (this.allCheckbox && !this.allCheckbox.checked) {
|
|
151
|
+
if (this.selectedRows.length && this.selectedRows.length === this.querySelectors.getBodyRows().length) {
|
|
152
|
+
checkCheckbox(this.allCheckbox);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return fireEvent;
|
|
157
|
+
}
|
|
158
|
+
getBodyCheckboxes() {
|
|
159
|
+
return this.selectableCheckboxSelector
|
|
160
|
+
? Array.from(this.querySelectors.getTableBody().querySelectorAll(this.selectableCheckboxSelector))
|
|
161
|
+
: [];
|
|
162
|
+
}
|
|
163
|
+
handleAllCheckboxStateChange() {
|
|
164
|
+
if (this.allCheckbox.checked) {
|
|
165
|
+
this.allCheckbox.removeAttribute('indeterminate');
|
|
166
|
+
this.selectedRows = [];
|
|
167
|
+
this.querySelectors.getBodyRows().forEach((row) => {
|
|
168
|
+
row.setAttribute('data-selected', '');
|
|
169
|
+
this.selectedRows.push(row);
|
|
170
|
+
});
|
|
171
|
+
this.getBodyCheckboxes().forEach((checkbox) => {
|
|
172
|
+
checkCheckbox(checkbox);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
this.allCheckbox.removeAttribute('indeterminate');
|
|
177
|
+
this.selectedRows = [];
|
|
178
|
+
this.querySelectors
|
|
179
|
+
.getTableBody()
|
|
180
|
+
.querySelectorAll('tr[data-selected]')
|
|
181
|
+
.forEach((row) => {
|
|
182
|
+
row.removeAttribute('data-selected');
|
|
183
|
+
});
|
|
184
|
+
this.getBodyCheckboxes().forEach((checkbox) => {
|
|
185
|
+
uncheckCheckbox(checkbox);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
updateSelectAllCheckbox() {
|
|
190
|
+
const selectedRowsCount = this.selectedRows.length;
|
|
191
|
+
if (this.allCheckbox) {
|
|
192
|
+
if (!this.allCheckbox.checked && selectedRowsCount === this.querySelectors.getBodyRows().length) {
|
|
193
|
+
checkCheckbox(this.allCheckbox);
|
|
194
|
+
}
|
|
195
|
+
else if (selectedRowsCount === 0) {
|
|
196
|
+
uncheckCheckbox(this.allCheckbox);
|
|
197
|
+
}
|
|
198
|
+
else if (selectedRowsCount < this.querySelectors.getBodyRows().length) {
|
|
199
|
+
indeterminateCheckbox(this.allCheckbox);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
//# sourceMappingURL=exm-row-selectable.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ExmQuerySelectors } from '../utils/exm-query-selectors.js';
|
|
2
|
+
export declare class ExmRowSortable {
|
|
3
|
+
private querySelectors;
|
|
4
|
+
constructor(qs: ExmQuerySelectors);
|
|
5
|
+
initFeature(): void;
|
|
6
|
+
updateFeature(): void;
|
|
7
|
+
private getRowDetailQuerySelectorFactory;
|
|
8
|
+
private registerMouseListenersHideDetailOnStartDragging;
|
|
9
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export class ExmRowSortable {
|
|
2
|
+
constructor(qs) {
|
|
3
|
+
this.querySelectors = qs;
|
|
4
|
+
}
|
|
5
|
+
initFeature() {
|
|
6
|
+
this.querySelectors
|
|
7
|
+
.getTableBody()
|
|
8
|
+
.querySelectorAll('tr:not([data-initialized]) .grid-row-drag-handler, tr:not([data-initialized]).grid-row-drag-handler')
|
|
9
|
+
.forEach((element) => {
|
|
10
|
+
this.registerMouseListenersHideDetailOnStartDragging(element);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
updateFeature() {
|
|
14
|
+
this.initFeature();
|
|
15
|
+
}
|
|
16
|
+
getRowDetailQuerySelectorFactory(element) {
|
|
17
|
+
const row = element.closest('tr');
|
|
18
|
+
const rowId = row && row.getAttribute('data-row-key');
|
|
19
|
+
if (rowId) {
|
|
20
|
+
return () => this.querySelectors.getTableBody().querySelector(`tr[data-row-detail-key="${rowId}"]`) ||
|
|
21
|
+
undefined;
|
|
22
|
+
}
|
|
23
|
+
return () => undefined;
|
|
24
|
+
}
|
|
25
|
+
registerMouseListenersHideDetailOnStartDragging(element) {
|
|
26
|
+
const getRowDetail = this.getRowDetailQuerySelectorFactory(element);
|
|
27
|
+
if (element.closest('td')) {
|
|
28
|
+
// ignore click (won't eventually select row) when trigger is element embedded in table cell
|
|
29
|
+
element.addEventListener('click', (event) => event.stopPropagation());
|
|
30
|
+
}
|
|
31
|
+
element.addEventListener('mousedown', (event) => {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
const rowDetail = getRowDetail();
|
|
34
|
+
if (rowDetail && rowDetail.hasAttribute('data-is-row-expanded')) {
|
|
35
|
+
rowDetail.style.display = 'none';
|
|
36
|
+
const handlerMouseUp = () => {
|
|
37
|
+
const rowDetailToRevert = getRowDetail();
|
|
38
|
+
if (rowDetailToRevert && rowDetailToRevert.hasAttribute('data-is-row-expanded')) {
|
|
39
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
rowDetailToRevert.style.display = null;
|
|
42
|
+
}
|
|
43
|
+
this.querySelectors.getTableBody().removeEventListener('mouseup', handlerMouseUp);
|
|
44
|
+
};
|
|
45
|
+
this.querySelectors.getTableBody().addEventListener('mouseup', handlerMouseUp);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=exm-row-sortable.js.map
|
package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-smart-toolbar-types.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ActionWithCondition<TCondition extends BaseActionCondition = BaseActionCondition> {
|
|
2
|
+
id: string;
|
|
3
|
+
icon?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
condition?: TCondition;
|
|
7
|
+
}
|
|
8
|
+
export declare enum ActionConditionType {
|
|
9
|
+
AmountOfSelectedItemsRange = "amount_of_items_range"
|
|
10
|
+
}
|
|
11
|
+
export interface BaseActionCondition {
|
|
12
|
+
type?: ActionConditionType;
|
|
13
|
+
}
|
|
14
|
+
export interface ActionAmountSelectedItemsCondition extends BaseActionCondition {
|
|
15
|
+
min?: number;
|
|
16
|
+
max?: number;
|
|
17
|
+
}
|
package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-smart-toolbar-types.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// eslint-disable-next-line no-shadow
|
|
2
|
+
export var ActionConditionType;
|
|
3
|
+
(function (ActionConditionType) {
|
|
4
|
+
ActionConditionType["AmountOfSelectedItemsRange"] = "amount_of_items_range";
|
|
5
|
+
})(ActionConditionType || (ActionConditionType = {}));
|
|
6
|
+
//# sourceMappingURL=exm-grid-smart-toolbar-types.js.map
|
package/.rollup.cache/root/repo/packages/exm-grid/dist/table/types/exm-grid-toolbar-types.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface Action {
|
|
2
|
+
id: string;
|
|
3
|
+
icon?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
tooltip?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* ID MUST BE UNIQUE HERE
|
|
9
|
+
*/
|
|
10
|
+
export interface Filter<TConfig extends BaseFilterConfig = BaseFilterConfig> {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
config: TConfig;
|
|
15
|
+
}
|
|
16
|
+
export declare enum FilterConfigType {
|
|
17
|
+
SingleSelect = "single_select"
|
|
18
|
+
}
|
|
19
|
+
export interface BaseFilterConfig {
|
|
20
|
+
type?: FilterConfigType;
|
|
21
|
+
}
|
|
22
|
+
export interface FilterSingleSelectConfig extends BaseFilterConfig {
|
|
23
|
+
data: {
|
|
24
|
+
id: string;
|
|
25
|
+
title: string;
|
|
26
|
+
}[];
|
|
27
|
+
}
|
|
28
|
+
export interface Setting<TConfig extends BaseSettingConfig = BaseSettingConfig> {
|
|
29
|
+
id: string;
|
|
30
|
+
icon?: string;
|
|
31
|
+
dialogTitle?: string;
|
|
32
|
+
tooltip?: string;
|
|
33
|
+
config: TConfig;
|
|
34
|
+
}
|
|
35
|
+
export declare enum SettingConfigType {
|
|
36
|
+
SelectionList = "selection_list"
|
|
37
|
+
}
|
|
38
|
+
export declare enum SettingConfigId {
|
|
39
|
+
ColumnSelector = "column-selector"
|
|
40
|
+
}
|
|
41
|
+
export interface BaseSettingConfig {
|
|
42
|
+
type?: SettingConfigType;
|
|
43
|
+
}
|
|
44
|
+
export interface SettingSelectionListItem {
|
|
45
|
+
id: string;
|
|
46
|
+
title: string;
|
|
47
|
+
selected?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface SettingSelectionListConfig extends BaseSettingConfig {
|
|
50
|
+
data: SettingSelectionListItem[];
|
|
51
|
+
}
|
|
52
|
+
export interface EventDetailGridToolbarSettingChanged {
|
|
53
|
+
id: string;
|
|
54
|
+
value: SettingSelectionListItem[];
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// eslint-disable-next-line no-shadow
|
|
2
|
+
export var FilterConfigType;
|
|
3
|
+
(function (FilterConfigType) {
|
|
4
|
+
FilterConfigType["SingleSelect"] = "single_select";
|
|
5
|
+
})(FilterConfigType || (FilterConfigType = {}));
|
|
6
|
+
// eslint-disable-next-line no-shadow
|
|
7
|
+
export var SettingConfigType;
|
|
8
|
+
(function (SettingConfigType) {
|
|
9
|
+
SettingConfigType["SelectionList"] = "selection_list";
|
|
10
|
+
})(SettingConfigType || (SettingConfigType = {}));
|
|
11
|
+
// eslint-disable-next-line no-shadow
|
|
12
|
+
export var SettingConfigId;
|
|
13
|
+
(function (SettingConfigId) {
|
|
14
|
+
SettingConfigId["ColumnSelector"] = "column-selector";
|
|
15
|
+
})(SettingConfigId || (SettingConfigId = {}));
|
|
16
|
+
//# sourceMappingURL=exm-grid-toolbar-types.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type SORT_DIRECTION = 'ASC' | 'DESC';
|
|
2
|
+
export interface EventDetailSortChange {
|
|
3
|
+
column: string;
|
|
4
|
+
sortDirection?: SORT_DIRECTION;
|
|
5
|
+
}
|
|
6
|
+
export interface EventDetailSelectedRowsChange {
|
|
7
|
+
rows: HTMLTableRowElement[];
|
|
8
|
+
}
|
|
9
|
+
export interface EventDetailRowsOrderChanged<T extends any = any> {
|
|
10
|
+
items: T[];
|
|
11
|
+
}
|
|
12
|
+
export interface EventDetailRowsOrderUpdated {
|
|
13
|
+
sourceIndex: number;
|
|
14
|
+
targetIndex: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class ExmQuerySelectors {
|
|
2
|
+
private table;
|
|
3
|
+
private tableBody;
|
|
4
|
+
constructor(t: HTMLTableElement, tb: HTMLTableSectionElement);
|
|
5
|
+
getTable(): HTMLTableElement;
|
|
6
|
+
getTableBody(): HTMLElement;
|
|
7
|
+
getColumns(selector?: string): NodeListOf<HTMLElement>;
|
|
8
|
+
getColumn<T extends HTMLElement>(selector?: string): T | undefined;
|
|
9
|
+
getBodyRowSelector(selector?: string): string;
|
|
10
|
+
getBodyRows(): NodeListOf<HTMLTableRowElement>;
|
|
11
|
+
getBodyRowsNotInitialized(): NodeListOf<HTMLTableRowElement>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class ExmQuerySelectors {
|
|
2
|
+
constructor(t, tb) {
|
|
3
|
+
this.table = t;
|
|
4
|
+
this.tableBody = tb;
|
|
5
|
+
}
|
|
6
|
+
getTable() {
|
|
7
|
+
if (!this.table) {
|
|
8
|
+
throw new Error('Element table not found. Slot hast to define <table>');
|
|
9
|
+
}
|
|
10
|
+
return this.table;
|
|
11
|
+
}
|
|
12
|
+
getTableBody() {
|
|
13
|
+
if (!this.tableBody) {
|
|
14
|
+
throw new Error('Element tbody not found. Slot hast to define <tbody class="grid-data">');
|
|
15
|
+
}
|
|
16
|
+
return this.tableBody;
|
|
17
|
+
}
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
getColumns(selector = 'th') {
|
|
20
|
+
return this.getTable().querySelectorAll(`.grid-columns ${selector}`);
|
|
21
|
+
}
|
|
22
|
+
getColumn(selector = 'th') {
|
|
23
|
+
return this.getTable().querySelector(`.grid-columns ${selector}`) || undefined;
|
|
24
|
+
}
|
|
25
|
+
getBodyRowSelector(selector = '') {
|
|
26
|
+
return `tr:not(.grid-row-detail)${selector}`;
|
|
27
|
+
}
|
|
28
|
+
// eslint-disable-next-line
|
|
29
|
+
getBodyRows() {
|
|
30
|
+
return this.getTableBody().querySelectorAll(this.getBodyRowSelector());
|
|
31
|
+
}
|
|
32
|
+
// eslint-disable-next-line
|
|
33
|
+
getBodyRowsNotInitialized() {
|
|
34
|
+
return this.getTableBody().querySelectorAll(this.getBodyRowSelector(':not([data-initialized])'));
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=exm-query-selectors.js.map
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,13 @@ export { ExmGrid } from './table/exm-grid.js';
|
|
|
2
2
|
export { ExmGridPagination } from './table/exm-grid-pagination.js';
|
|
3
3
|
export { ExmGridBaseToolbar } from './table/exm-grid-base-toolbar.js';
|
|
4
4
|
export { ExmGridSmartToolbar } from './table/exm-grid-smart-toolbar.js';
|
|
5
|
-
export { ActionConditionType
|
|
5
|
+
export { ActionConditionType } from './table/types/exm-grid-smart-toolbar-types.js';
|
|
6
6
|
export { ExmGridToolbar } from './table/exm-grid-toolbar.js';
|
|
7
|
-
export { FilterConfigType, SettingConfigId, SettingConfigType
|
|
7
|
+
export { FilterConfigType, SettingConfigId, SettingConfigType } from './table/types/exm-grid-toolbar-types.js';
|
|
8
8
|
export { ToolbarSearch } from './search/exm-toolbar-search.js';
|
|
9
9
|
export { ExmGridToolbarFilters } from './table/exm-grid-toolbar-filters.js';
|
|
10
10
|
export { style as gridStyles } from './styles/exm-grid-styles-css.js';
|
|
11
11
|
export { style as gridBaseToolbarStyles } from './styles/exm-grid-base-toolbar-styles-css.js';
|
|
12
12
|
export { style as gridCommonStyles } from './styles/exm-grid-common-styles-css.js';
|
|
13
13
|
export { style as gridPaginationStyles } from './styles/exm-grid-pagination-styles-css.js';
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { __decorate } from
|
|
1
|
+
import { __decorate } from 'tslib';
|
|
2
2
|
import { css, html } from 'lit';
|
|
3
|
-
import {
|
|
4
|
-
import { ExmgElement } from '@exmg/lit-base/index.js';
|
|
3
|
+
import { state, property, query, customElement } from 'lit/decorators.js';
|
|
4
|
+
import { ExmgElement, debounce, async } from '@exmg/lit-base/index.js';
|
|
5
5
|
import { classMap } from 'lit/directives/class-map.js';
|
|
6
|
-
import { async, debounce } from '@exmg/lit-base/index.js';
|
|
7
6
|
import '@exmg/exm-search/exm-search.js';
|
|
8
7
|
import '@material/web/icon/icon.js';
|
|
9
8
|
import '@material/web/iconbutton/icon-button.js';
|
|
10
9
|
import '@material/web/focus/md-focus-ring.js';
|
|
10
|
+
|
|
11
11
|
let ToolbarSearch = class ToolbarSearch extends ExmgElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
@@ -84,5 +84,6 @@ __decorate([
|
|
|
84
84
|
ToolbarSearch = __decorate([
|
|
85
85
|
customElement('exm-toolbar-search')
|
|
86
86
|
], ToolbarSearch);
|
|
87
|
+
|
|
87
88
|
export { ToolbarSearch };
|
|
88
|
-
//# sourceMappingURL=exm-toolbar-search.js.map
|
|
89
|
+
//# sourceMappingURL=exm-toolbar-search.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const style = css `
|
|
3
4
|
:host {
|
|
4
5
|
display: block;
|
|
5
6
|
-moz-osx-font-smoothing: grayscale;
|
|
@@ -95,4 +96,6 @@ export const style = css `
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
`;
|
|
98
|
-
|
|
99
|
+
|
|
100
|
+
export { style };
|
|
101
|
+
//# sourceMappingURL=exm-grid-base-toolbar-styles-css.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const style = css `
|
|
3
4
|
:host {
|
|
4
5
|
display: block;
|
|
5
6
|
-moz-osx-font-smoothing: grayscale;
|
|
@@ -101,4 +102,6 @@ export const style = css `
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
`;
|
|
104
|
-
|
|
105
|
+
|
|
106
|
+
export { style };
|
|
107
|
+
//# sourceMappingURL=exm-grid-common-styles-css.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const style = css `
|
|
3
4
|
:host {
|
|
4
5
|
display: block;
|
|
5
6
|
-moz-osx-font-smoothing: grayscale;
|
|
@@ -101,4 +102,6 @@ export const style = css `
|
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
`;
|
|
104
|
-
|
|
105
|
+
|
|
106
|
+
export { style };
|
|
107
|
+
//# sourceMappingURL=exm-grid-pagination-styles-css.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
const style = css `
|
|
3
4
|
:host {
|
|
4
5
|
display: block;
|
|
5
6
|
position: relative;
|
|
@@ -9,4 +10,6 @@ export const style = css `
|
|
|
9
10
|
color: var(--mdc-theme-primary);
|
|
10
11
|
}
|
|
11
12
|
`;
|
|
12
|
-
|
|
13
|
+
|
|
14
|
+
export { style };
|
|
15
|
+
//# sourceMappingURL=exm-grid-setting-selection-list-styles-css.js.map
|