@xplortech/apollo-core 2.7.0 → 2.7.1
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/.typings/apollo-components.html-data.json +97 -180
- package/build/style.css +220 -951
- package/dist/apollo-core/apollo-core.css +5 -35
- package/dist/apollo-core/apollo-core.esm.js +1 -1
- package/dist/apollo-core/{p-6c956d4e.entry.js → p-0bf50890.entry.js} +1 -1
- package/dist/apollo-core/p-1947e7a8.entry.js +1 -0
- package/dist/apollo-core/p-27928cb0.entry.js +1 -0
- package/dist/apollo-core/p-34438721.entry.js +1 -0
- package/dist/apollo-core/p-35c2f72d.entry.js +1 -0
- package/dist/apollo-core/p-368c81f1.entry.js +1 -0
- package/dist/apollo-core/p-36ba29da.entry.js +1 -0
- package/dist/apollo-core/p-406b27a8.entry.js +1 -0
- package/dist/apollo-core/p-5d63b4ce.entry.js +1 -0
- package/dist/apollo-core/{p-7eb86c63.entry.js → p-6a15f1e0.entry.js} +1 -1
- package/dist/apollo-core/p-8d692d05.entry.js +1 -0
- package/dist/apollo-core/{p-28d12fd3.entry.js → p-b61d7952.entry.js} +1 -1
- package/dist/apollo-core/{p-084d26ed.entry.js → p-ca127ee8.entry.js} +1 -1
- package/dist/apollo-core/p-d1c9c233.entry.js +1 -0
- package/dist/apollo-core/p-dc205893.entry.js +1 -0
- package/dist/apollo-core/p-e2a5d41c.entry.js +1 -0
- package/dist/cjs/apollo-core.cjs.js +1 -1
- package/dist/cjs/index-BQ97-AWw.js +10 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/xpl-accordion.cjs.entry.js +2 -2
- package/dist/cjs/xpl-application-shell.cjs.entry.js +1 -1
- package/dist/cjs/{xpl-avatar_61.cjs.entry.js → xpl-avatar_54.cjs.entry.js} +238 -1683
- package/dist/cjs/xpl-button-row.cjs.entry.js +1 -1
- package/dist/cjs/xpl-calendar.cjs.entry.js +1 -1
- package/dist/cjs/xpl-dynamic-table-cell.cjs.entry.js +2 -2
- package/dist/cjs/xpl-dynamic-table-row.cjs.entry.js +2 -2
- package/dist/cjs/xpl-dynamic-table.cjs.entry.js +1 -1
- package/dist/cjs/xpl-grid-item.cjs.entry.js +1 -1
- package/dist/cjs/xpl-grid.cjs.entry.js +1 -1
- package/dist/cjs/xpl-large-card.cjs.entry.js +1 -1
- package/dist/cjs/xpl-main-nav.cjs.entry.js +1 -1
- package/dist/cjs/xpl-table-header-cell.cjs.entry.js +57 -0
- package/dist/cjs/xpl-table-header.cjs.entry.js +14 -0
- package/dist/cjs/xpl-toggle.cjs.entry.js +3 -3
- package/dist/cjs/xpl-toolbar.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +2 -7
- package/dist/collection/components/xpl-accordion/xpl-accordion.js +2 -2
- package/dist/collection/components/xpl-application-shell/xpl-application-shell.js +1 -1
- package/dist/collection/components/xpl-backdrop/xpl-backdrop.js +1 -1
- package/dist/collection/components/xpl-badge/xpl-badge.js +1 -1
- package/dist/collection/components/xpl-banner/xpl-banner.js +2 -2
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js +1 -1
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js +1 -1
- package/dist/collection/components/xpl-button/xpl-button.js +1 -1
- package/dist/collection/components/xpl-button-row/xpl-button-row.js +1 -1
- package/dist/collection/components/xpl-calendar/xpl-calendar.js +1 -1
- package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +25 -25
- package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +1 -1
- package/dist/collection/components/xpl-content-area/xpl-content-area.js +1 -1
- package/dist/collection/components/xpl-dashboard/xpl-dashboard.js +1 -1
- package/dist/collection/components/xpl-data-card/xpl-data-card.js +2 -2
- package/dist/collection/components/xpl-divider/xpl-divider.js +1 -1
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-group/xpl-dropdown-group.js +1 -1
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-heading/xpl-dropdown-heading.js +1 -1
- package/dist/collection/components/xpl-dropdown/xpl-dropdown-option/xpl-dropdown-option.js +2 -2
- package/dist/collection/components/xpl-dropdown/xpl-dropdown.js +77 -7
- package/dist/collection/components/xpl-dynamic-table/xpl-dynamic-table.js +1 -1
- package/dist/collection/components/xpl-dynamic-table-cell/xpl-dynamic-table-cell.js +2 -2
- package/dist/collection/components/xpl-dynamic-table-row/xpl-dynamic-table-row.js +2 -2
- package/dist/collection/components/xpl-grid/xpl-grid.js +1 -1
- package/dist/collection/components/xpl-grid-item/xpl-grid-item.js +1 -1
- package/dist/collection/components/xpl-header-accordion/xpl-header-accordion.js +53 -46
- package/dist/collection/components/xpl-icon/xpl-icon.js +2 -2
- package/dist/collection/components/xpl-input/xpl-input-color/xpl-input-color.js +8 -8
- package/dist/collection/components/xpl-input/xpl-input-date/xpl-input-date.js +3 -3
- package/dist/collection/components/xpl-input/xpl-input-file/xpl-input-file.js +4 -4
- package/dist/collection/components/xpl-input/xpl-input-phone/xpl-input-phone.js +5 -5
- package/dist/collection/components/xpl-input/xpl-input-search/xpl-input-search.js +1 -1
- package/dist/collection/components/xpl-input/xpl-input-time/xpl-input-time.js +2 -2
- package/dist/collection/components/xpl-input/xpl-input.js +2 -2
- package/dist/collection/components/xpl-large-card/xpl-large-card.js +1 -1
- package/dist/collection/components/xpl-list/xpl-list.js +2 -2
- package/dist/collection/components/xpl-main-nav/xpl-main-nav.js +1 -1
- package/dist/collection/components/xpl-modal/xpl-modal.js +1 -1
- package/dist/collection/components/xpl-nav-item/xpl-nav-item.js +2 -2
- package/dist/collection/components/xpl-pagination/pagination.stories.js +18 -0
- package/dist/collection/components/xpl-pagination/xpl-pagination.js +7 -3
- package/dist/collection/components/xpl-panel/xpl-panel.js +2 -2
- package/dist/collection/components/xpl-popover/xpl-popover.js +4 -4
- package/dist/collection/components/xpl-progress-bar/xpl-progress-bar.js +2 -2
- package/dist/collection/components/xpl-progress-indicator/xpl-progress-indicator.js +1 -1
- package/dist/collection/components/xpl-radio/xpl-radio.js +3 -3
- package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +1 -1
- package/dist/collection/components/xpl-select/xpl-select.js +58 -6
- package/dist/collection/components/xpl-side-nav/xpl-side-nav-item/xpl-side-nav-item.js +2 -2
- package/dist/collection/components/xpl-side-nav/xpl-side-nav.js +2 -2
- package/dist/collection/components/xpl-skeleton/xpl-skeleton.js +1 -1
- package/dist/collection/components/xpl-slideout/xpl-slideout.js +1 -1
- package/dist/collection/components/xpl-tab-panel/xpl-tab-panel.js +2 -2
- package/dist/collection/components/xpl-table/table.stories.js +67 -319
- package/dist/collection/components/xpl-table/xpl-table.js +151 -1456
- package/dist/collection/components/xpl-table-header/table-header.stories.js +126 -0
- package/dist/collection/components/xpl-table-header/xpl-table-header.js +7 -0
- package/dist/collection/components/xpl-table-header-cell/table-header-cell.stories.js +75 -0
- package/dist/collection/components/xpl-table-header-cell/xpl-table-header-cell.js +188 -0
- package/dist/collection/components/xpl-tabs/xpl-tabs.js +5 -5
- package/dist/collection/components/xpl-tag/xpl-tag.js +2 -2
- package/dist/collection/components/xpl-toast/xpl-toast.js +2 -2
- package/dist/collection/components/xpl-toggle/xpl-toggle.js +3 -3
- package/dist/collection/components/xpl-toolbar/xpl-toolbar.js +2 -2
- package/dist/collection/components/xpl-tooltip/xpl-tooltip.js +1 -1
- package/dist/collection/components/xpl-top-nav/xpl-nav-header-menu/xpl-nav-header-menu.js +2 -2
- package/dist/collection/components/xpl-top-nav/xpl-top-nav-item/xpl-top-nav-item.js +2 -2
- package/dist/collection/components/xpl-top-nav/xpl-top-nav.js +5 -5
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/xpl-accordion.js +1 -1
- package/dist/components/xpl-application-shell.js +1 -1
- package/dist/components/xpl-backdrop2.js +1 -1
- package/dist/components/xpl-badge2.js +1 -1
- package/dist/components/xpl-banner.js +1 -1
- package/dist/components/xpl-breadcrumb-item.js +1 -1
- package/dist/components/xpl-breadcrumbs.js +1 -1
- package/dist/components/xpl-button-row.js +1 -1
- package/dist/components/xpl-button2.js +1 -1
- package/dist/components/xpl-calendar.js +1 -1
- package/dist/components/xpl-checkbox2.js +1 -1
- package/dist/components/xpl-choicelist.js +1 -1
- package/dist/components/xpl-content-area.js +1 -1
- package/dist/components/xpl-dashboard.js +1 -1
- package/dist/components/xpl-data-card.js +1 -1
- package/dist/components/xpl-divider2.js +1 -1
- package/dist/components/xpl-dropdown-group2.js +1 -1
- package/dist/components/xpl-dropdown-heading2.js +1 -1
- package/dist/components/xpl-dropdown-option2.js +1 -1
- package/dist/components/xpl-dropdown2.js +1 -1
- package/dist/components/xpl-dynamic-table-cell.js +1 -1
- package/dist/components/xpl-dynamic-table-row.js +1 -1
- package/dist/components/xpl-dynamic-table.js +1 -1
- package/dist/components/xpl-grid-item.js +1 -1
- package/dist/components/xpl-grid.js +1 -1
- package/dist/components/xpl-header-accordion.js +1 -1
- package/dist/components/xpl-icon2.js +1 -1
- package/dist/components/xpl-input-date2.js +1 -1
- package/dist/components/xpl-input-file2.js +1 -1
- package/dist/components/xpl-input-search2.js +1 -1
- package/dist/components/xpl-input2.js +1 -1
- package/dist/components/xpl-large-card.js +1 -1
- package/dist/components/xpl-list.js +1 -1
- package/dist/components/xpl-main-nav.js +1 -1
- package/dist/components/xpl-modal.js +1 -1
- package/dist/components/xpl-nav-header-menu.js +1 -1
- package/dist/components/xpl-nav-item.js +1 -1
- package/dist/components/xpl-pagination.js +1 -1
- package/dist/components/xpl-panel.js +1 -1
- package/dist/components/xpl-popover2.js +1 -1
- package/dist/components/xpl-progress-bar.js +1 -1
- package/dist/components/xpl-progress-indicator.js +1 -1
- package/dist/components/xpl-radio2.js +1 -1
- package/dist/components/xpl-secondary-nav.js +1 -1
- package/dist/components/xpl-select2.js +1 -1
- package/dist/components/xpl-side-nav-item.js +1 -1
- package/dist/components/xpl-side-nav.js +1 -1
- package/dist/components/xpl-skeleton.js +1 -1
- package/dist/components/xpl-slideout.js +1 -1
- package/dist/components/xpl-tab-panel.js +1 -1
- package/dist/components/xpl-table-header-cell.js +1 -1
- package/dist/components/xpl-table-header.js +1 -1
- package/dist/components/xpl-table.js +1 -1
- package/dist/components/xpl-tabs.js +1 -1
- package/dist/components/xpl-tag2.js +1 -1
- package/dist/components/xpl-toast.js +1 -1
- package/dist/components/xpl-toggle.js +1 -1
- package/dist/components/xpl-toolbar.js +1 -1
- package/dist/components/xpl-tooltip2.js +1 -1
- package/dist/components/xpl-top-nav-item2.js +1 -1
- package/dist/components/xpl-top-nav.js +1 -1
- package/dist/components/xpl-utility-bar.js +1 -1
- package/dist/docs/xpl-checkbox/readme.md +5 -7
- package/dist/docs/xpl-dropdown/readme.md +13 -11
- package/dist/docs/xpl-dynamic-table/readme.md +19 -22
- package/dist/docs/xpl-dynamic-table-cell/readme.md +18 -20
- package/dist/docs/xpl-dynamic-table-row/readme.md +19 -21
- package/dist/docs/xpl-icon/readme.md +1 -1
- package/dist/docs/xpl-select/readme.md +17 -15
- package/dist/docs/xpl-table/readme.md +46 -110
- package/dist/docs/{xpl-table/xpl-table-header → xpl-table-header}/readme.md +13 -13
- package/dist/docs/xpl-table-header-cell/readme.md +47 -0
- package/dist/esm/apollo-core.js +1 -1
- package/dist/esm/index-C7bgJs6C.js +10 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/xpl-accordion.entry.js +2 -2
- package/dist/esm/xpl-application-shell.entry.js +1 -1
- package/dist/esm/{xpl-avatar_61.entry.js → xpl-avatar_54.entry.js} +239 -1677
- package/dist/esm/xpl-button-row.entry.js +1 -1
- package/dist/esm/xpl-calendar.entry.js +1 -1
- package/dist/esm/xpl-dynamic-table-cell.entry.js +2 -2
- package/dist/esm/xpl-dynamic-table-row.entry.js +2 -2
- package/dist/esm/xpl-dynamic-table.entry.js +1 -1
- package/dist/esm/xpl-grid-item.entry.js +1 -1
- package/dist/esm/xpl-grid.entry.js +1 -1
- package/dist/esm/xpl-large-card.entry.js +1 -1
- package/dist/esm/xpl-main-nav.entry.js +1 -1
- package/dist/esm/xpl-table-header-cell.entry.js +55 -0
- package/dist/esm/xpl-table-header.entry.js +12 -0
- package/dist/esm/xpl-toggle.entry.js +3 -3
- package/dist/esm/xpl-toolbar.entry.js +2 -2
- package/dist/types/components/xpl-checkbox/xpl-checkbox.d.ts +2 -2
- package/dist/types/components/xpl-dropdown/xpl-dropdown.d.ts +5 -0
- package/dist/types/components/xpl-header-accordion/xpl-header-accordion.d.ts +10 -9
- package/dist/types/components/xpl-pagination/pagination.stories.d.ts +13 -0
- package/dist/types/components/xpl-select/xpl-select.d.ts +3 -0
- package/dist/types/components/xpl-table/table.stories.d.ts +19 -161
- package/dist/types/components/xpl-table/xpl-table.d.ts +21 -123
- package/dist/types/components/{xpl-table/xpl-table-header → xpl-table-header}/table-header.stories.d.ts +16 -13
- package/dist/types/components/{xpl-table/xpl-table-header-cell → xpl-table-header-cell}/table-header-cell.stories.d.ts +20 -24
- package/dist/types/components/xpl-table-header-cell/xpl-table-header-cell.d.ts +13 -0
- package/dist/types/components.d.ts +89 -391
- package/package.json +10 -1
- package/dist/apollo-core/p-146d5d55.entry.js +0 -1
- package/dist/apollo-core/p-16742606.entry.js +0 -1
- package/dist/apollo-core/p-3eb5eb7c.entry.js +0 -1
- package/dist/apollo-core/p-4882f0bd.entry.js +0 -1
- package/dist/apollo-core/p-64b34268.entry.js +0 -1
- package/dist/apollo-core/p-71b75f36.entry.js +0 -1
- package/dist/apollo-core/p-84254a24.entry.js +0 -1
- package/dist/apollo-core/p-9f2a0321.entry.js +0 -1
- package/dist/apollo-core/p-cde83ab0.entry.js +0 -1
- package/dist/apollo-core/p-e7363036.entry.js +0 -1
- package/dist/collection/components/xpl-table/utils/move-row-dom.js +0 -50
- package/dist/collection/components/xpl-table/utils/table-internal.js +0 -58
- package/dist/collection/components/xpl-table/xpl-table-body/xpl-table-body.js +0 -7
- package/dist/collection/components/xpl-table/xpl-table-cell/xpl-table-cell.js +0 -155
- package/dist/collection/components/xpl-table/xpl-table-footer/xpl-table-footer.js +0 -7
- package/dist/collection/components/xpl-table/xpl-table-footer-cell/xpl-table-footer-cell.js +0 -37
- package/dist/collection/components/xpl-table/xpl-table-header/table-header.stories.js +0 -131
- package/dist/collection/components/xpl-table/xpl-table-header/xpl-table-header.js +0 -7
- package/dist/collection/components/xpl-table/xpl-table-header-cell/table-header-cell.stories.js +0 -105
- package/dist/collection/components/xpl-table/xpl-table-header-cell/xpl-table-header-cell.js +0 -402
- package/dist/collection/components/xpl-table/xpl-table-row/xpl-table-row.js +0 -121
- package/dist/components/lifecycle.js +0 -1
- package/dist/components/xpl-table-body.d.ts +0 -11
- package/dist/components/xpl-table-body.js +0 -1
- package/dist/components/xpl-table-cell.d.ts +0 -11
- package/dist/components/xpl-table-cell.js +0 -1
- package/dist/components/xpl-table-cell2.js +0 -1
- package/dist/components/xpl-table-footer-cell.d.ts +0 -11
- package/dist/components/xpl-table-footer-cell.js +0 -1
- package/dist/components/xpl-table-footer-cell2.js +0 -1
- package/dist/components/xpl-table-footer.d.ts +0 -11
- package/dist/components/xpl-table-footer.js +0 -1
- package/dist/components/xpl-table-header-cell2.js +0 -1
- package/dist/components/xpl-table-row.d.ts +0 -11
- package/dist/components/xpl-table-row.js +0 -1
- package/dist/docs/xpl-table/xpl-table-body/readme.md +0 -10
- package/dist/docs/xpl-table/xpl-table-cell/readme.md +0 -33
- package/dist/docs/xpl-table/xpl-table-footer/readme.md +0 -10
- package/dist/docs/xpl-table/xpl-table-footer-cell/readme.md +0 -30
- package/dist/docs/xpl-table/xpl-table-header-cell/readme.md +0 -66
- package/dist/docs/xpl-table/xpl-table-row/readme.md +0 -19
- package/dist/types/components/xpl-table/utils/move-row-dom.d.ts +0 -3
- package/dist/types/components/xpl-table/utils/table-internal.d.ts +0 -8
- package/dist/types/components/xpl-table/xpl-table-body/xpl-table-body.d.ts +0 -3
- package/dist/types/components/xpl-table/xpl-table-cell/xpl-table-cell.d.ts +0 -11
- package/dist/types/components/xpl-table/xpl-table-footer/xpl-table-footer.d.ts +0 -3
- package/dist/types/components/xpl-table/xpl-table-footer-cell/xpl-table-footer-cell.d.ts +0 -4
- package/dist/types/components/xpl-table/xpl-table-header-cell/xpl-table-header-cell.d.ts +0 -32
- package/dist/types/components/xpl-table/xpl-table-row/xpl-table-row.d.ts +0 -13
- /package/dist/types/components/{xpl-table/xpl-table-header → xpl-table-header}/xpl-table-header.d.ts +0 -0
|
@@ -1,1147 +1,91 @@
|
|
|
1
1
|
import { Host, h, } from "@stencil/core";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.pendingDragRow = null;
|
|
25
|
-
this.pointerUpClearPending = null;
|
|
26
|
-
this.reorderKeyboardTimers = new TimerManager();
|
|
27
|
-
this.onReorderHandleKeydown = (ev) => {
|
|
28
|
-
this.handleReorderHandleKeyDown(ev);
|
|
29
|
-
};
|
|
30
|
-
this.areAllSelected = false;
|
|
31
|
-
this.colCount = 0;
|
|
32
|
-
this.hasScrolled = false;
|
|
33
|
-
this.keyboardReorderRowId = null;
|
|
34
|
-
this.reorderLiveMessage = '';
|
|
35
|
-
this.rowData = [];
|
|
36
|
-
this.rowFooterData = [];
|
|
37
|
-
this.selected = [];
|
|
38
|
-
this.selectedRowIds = [];
|
|
39
|
-
this.sortTypeArray = [];
|
|
40
|
-
this.isSortable = false;
|
|
41
|
-
this.selectedValues = [];
|
|
42
|
-
this.sortableColumns = [];
|
|
43
|
-
this.onGridScroll = (e) => {
|
|
44
|
-
this.hasScrolled = e.target.scrollLeft > 0;
|
|
45
|
-
};
|
|
46
|
-
this.selectAll = (e) => {
|
|
47
|
-
const { target } = e;
|
|
48
|
-
if (!(target instanceof HTMLInputElement))
|
|
49
|
-
return;
|
|
50
|
-
const { checked } = target;
|
|
51
|
-
this.areAllSelected = checked;
|
|
52
|
-
this.selected =
|
|
53
|
-
this.selectedValues.length > 0
|
|
54
|
-
? Array.from(this.el.querySelectorAll('tbody td:first-child input')).map((input) => (checked ? input === null || input === void 0 ? void 0 : input.value : checked))
|
|
55
|
-
: this.selected.map(() => checked);
|
|
56
|
-
this.onSelectionChange();
|
|
57
|
-
};
|
|
58
|
-
this.selectOne = (e, checkboxIdx) => {
|
|
59
|
-
const { target } = e;
|
|
60
|
-
if (!(target instanceof HTMLInputElement))
|
|
61
|
-
return;
|
|
62
|
-
const { checked, value } = target;
|
|
63
|
-
this.areAllSelected = false;
|
|
64
|
-
this.selected = this.selected.map((v, selectedIdx) => {
|
|
65
|
-
if (selectedIdx !== checkboxIdx)
|
|
66
|
-
return v;
|
|
67
|
-
return this.selectedValues.length > 0 ? (checked ? value : checked) : checked;
|
|
68
|
-
});
|
|
69
|
-
this.onSelectionChange();
|
|
70
|
-
};
|
|
71
|
-
this.onSelectionChange = () => {
|
|
72
|
-
this.tableSelect.emit({
|
|
73
|
-
selected: this.selected,
|
|
74
|
-
areAllSelected: this.areAllSelected,
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
this.onLegacyScroll = () => {
|
|
78
|
-
this.hasScrolled = this.container.scrollLeft > 0;
|
|
79
|
-
};
|
|
80
|
-
this.sortBy = (col, sortTypeArray) => {
|
|
81
|
-
const handleSort = (a, b) => {
|
|
82
|
-
if (a[col].toLocaleLowerCase() < b[col].toLocaleLowerCase())
|
|
83
|
-
return -1;
|
|
84
|
-
if (a[col].toLocaleLowerCase() > b[col].toLocaleLowerCase())
|
|
85
|
-
return 1;
|
|
86
|
-
return 0;
|
|
87
|
-
};
|
|
88
|
-
switch (sortTypeArray[col]) {
|
|
89
|
-
case 'asc':
|
|
90
|
-
this.rowData.sort((a, b) => handleSort(a, b));
|
|
91
|
-
break;
|
|
92
|
-
case 'desc':
|
|
93
|
-
this.rowData.sort((a, b) => handleSort(b, a));
|
|
94
|
-
break;
|
|
95
|
-
default:
|
|
96
|
-
this.rowData = this.data;
|
|
97
|
-
this.sortTypeArray[col] = null;
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
this.rowData = Array.from(this.rowData);
|
|
101
|
-
};
|
|
102
|
-
this.setData = () => {
|
|
103
|
-
this.rowData = this.data !== undefined ? Array.from(this.data) : [];
|
|
104
|
-
};
|
|
105
|
-
this.setFooterData = () => {
|
|
106
|
-
this.rowFooterData = this.footer !== undefined ? Array.from(this.footer) : [];
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
watchColumns() {
|
|
110
|
-
this.sortTypeArray = this.columns ? this.columns.map(() => null) : [];
|
|
111
|
-
}
|
|
112
|
-
watchData() {
|
|
113
|
-
this.setData();
|
|
114
|
-
}
|
|
115
|
-
watchFooterData() {
|
|
116
|
-
this.setFooterData();
|
|
117
|
-
}
|
|
118
|
-
watchReorderHandleIcon() {
|
|
119
|
-
if (this.isLegacyMode || !this.rowReorderable)
|
|
120
|
-
return;
|
|
121
|
-
this.syncInjectedReorderHandleIcons();
|
|
122
|
-
}
|
|
123
|
-
watchReorderHandleIconKeyboard() {
|
|
124
|
-
if (this.isLegacyMode || !this.rowReorderable)
|
|
125
|
-
return;
|
|
126
|
-
this.syncInjectedReorderHandleIcons();
|
|
127
|
-
}
|
|
128
|
-
watchRowReorderable(next) {
|
|
129
|
-
if (this.isLegacyMode)
|
|
130
|
-
return;
|
|
131
|
-
if (!next) {
|
|
132
|
-
this.keyboardReorderRowId = null;
|
|
133
|
-
this.syncReorderHandleKeyboardA11y(null);
|
|
134
|
-
this.removeManagedReorderCells();
|
|
135
|
-
this.draggedRow = null;
|
|
136
|
-
this.pendingDragRow = null;
|
|
137
|
-
this.clearPendingDragListeners();
|
|
138
|
-
this.reorderLiveMessage = '';
|
|
139
|
-
this.queryBodyRows().forEach((r) => {
|
|
140
|
-
var _a;
|
|
141
|
-
r.removeAttribute('draggable');
|
|
142
|
-
(_a = r.querySelector('.xpl-table__row-drag-handle')) === null || _a === void 0 ? void 0 : _a.removeAttribute('draggable');
|
|
143
|
-
r.classList.remove('xpl-table-row--dragging', 'xpl-table-row--drag-over');
|
|
144
|
-
});
|
|
145
|
-
this.colCount = 0;
|
|
146
|
-
this.columnWidthsToken = '';
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
watchSelectable(next) {
|
|
150
|
-
if (this.isLegacyMode)
|
|
151
|
-
return;
|
|
152
|
-
if (!next) {
|
|
153
|
-
this.selectedRowIds = [];
|
|
154
|
-
this.lastEmittedRowSelectionKey = '';
|
|
155
|
-
this.colCount = 0;
|
|
156
|
-
this.columnWidthsToken = '';
|
|
157
|
-
this.syncRowSelectedProps();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
componentWillLoad() {
|
|
161
|
-
if (this.isLegacyMode) {
|
|
162
|
-
this.areAllSelected = false;
|
|
163
|
-
this.setData();
|
|
164
|
-
this.setFooterData();
|
|
165
|
-
this.selected = new Array(this.rowData.length).fill(false);
|
|
166
|
-
this.sortTypeArray = this.columns ? this.columns.map(() => null) : [];
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
componentDidLoad() {
|
|
170
|
-
if (!this.isLegacyMode) {
|
|
171
|
-
this.syncCompositionalLayout();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
componentDidUpdate() {
|
|
175
|
-
if (!this.isLegacyMode) {
|
|
176
|
-
this.syncCompositionalLayout();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
disconnectedCallback() {
|
|
180
|
-
this.clearPendingDragListeners();
|
|
181
|
-
this.detachReorderHandleKeydownListeners();
|
|
182
|
-
this.reorderKeyboardTimers.dispose();
|
|
183
|
-
if (this.reorderAnnounceRaf !== undefined) {
|
|
184
|
-
cancelAnimationFrame(this.reorderAnnounceRaf);
|
|
185
|
-
this.reorderAnnounceRaf = undefined;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
handleHeaderCellColumnWidthsChange(ev) {
|
|
189
|
-
if (this.isLegacyMode)
|
|
190
|
-
return;
|
|
191
|
-
const t = ev.target;
|
|
192
|
-
if (!(t instanceof Node) || !this.el.contains(t))
|
|
193
|
-
return;
|
|
194
|
-
this.updateColumnWidths();
|
|
195
|
-
}
|
|
196
|
-
handleCompositionalCheckboxChange(ev) {
|
|
197
|
-
var _a, _b;
|
|
198
|
-
if (this.isLegacyMode || !this.selectable)
|
|
199
|
-
return;
|
|
200
|
-
if (!this.isEventFromThisTable(ev.target))
|
|
201
|
-
return;
|
|
202
|
-
const path = (_b = (_a = ev.composedPath) === null || _a === void 0 ? void 0 : _a.call(ev)) !== null && _b !== void 0 ? _b : [];
|
|
203
|
-
let checkboxHost = (path.length > 0 ? path : [ev.target].filter((n) => n != null)).find((n) => n instanceof HTMLElement && n.tagName.toLowerCase() === 'xpl-checkbox');
|
|
204
|
-
if (!checkboxHost &&
|
|
205
|
-
ev.target &&
|
|
206
|
-
typeof ev.target.closest === 'function') {
|
|
207
|
-
checkboxHost = ev.target.closest('xpl-checkbox');
|
|
208
|
-
}
|
|
209
|
-
if (!checkboxHost || !this.el.contains(checkboxHost))
|
|
210
|
-
return;
|
|
211
|
-
const row = checkboxHost.closest('xpl-table-row');
|
|
212
|
-
if (!row || !this.isDirectChildBodyRow(row))
|
|
213
|
-
return;
|
|
214
|
-
const cell = checkboxHost.closest('xpl-table-cell');
|
|
215
|
-
if (!cell)
|
|
216
|
-
return;
|
|
217
|
-
const selectionIdx = this.getSelectionColumnIndex();
|
|
218
|
-
if (selectionIdx === null)
|
|
219
|
-
return;
|
|
220
|
-
const bodyCells = Table.getBodyRowCells(row);
|
|
221
|
-
const colIdx = bodyCells.indexOf(cell);
|
|
222
|
-
if (colIdx !== selectionIdx)
|
|
223
|
-
return;
|
|
224
|
-
ev.stopPropagation();
|
|
225
|
-
const rowId = Table.getRowIdForRow(row);
|
|
226
|
-
if (!rowId || row.disabled)
|
|
227
|
-
return;
|
|
228
|
-
const input = checkboxHost.querySelector('input[type="checkbox"]');
|
|
229
|
-
if (!input)
|
|
230
|
-
return;
|
|
231
|
-
const { checked } = input;
|
|
232
|
-
if (checked) {
|
|
233
|
-
if (!this.selectedRowIds.includes(rowId)) {
|
|
234
|
-
this.selectedRowIds = [...this.selectedRowIds, rowId];
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
this.selectedRowIds = this.selectedRowIds.filter((id) => id !== rowId);
|
|
239
|
-
}
|
|
240
|
-
this.applyHeaderCheckboxState();
|
|
241
|
-
this.syncRowSelectedProps();
|
|
242
|
-
this.emitCompositionalSelection();
|
|
243
|
-
}
|
|
244
|
-
handleCompositionalHeaderCheckboxChange(ev) {
|
|
245
|
-
var _a, _b;
|
|
246
|
-
if (this.isLegacyMode || !this.selectable)
|
|
247
|
-
return;
|
|
248
|
-
if (!this.isEventFromThisTable(ev.target))
|
|
249
|
-
return;
|
|
250
|
-
const path = (_b = (_a = ev.composedPath) === null || _a === void 0 ? void 0 : _a.call(ev)) !== null && _b !== void 0 ? _b : [];
|
|
251
|
-
let headerCell = (path.length > 0 ? path : [ev.target].filter((n) => n != null)).find((n) => n instanceof HTMLElement &&
|
|
252
|
-
n.tagName.toLowerCase() === 'xpl-table-header-cell' &&
|
|
253
|
-
n.getAttribute('type') === 'checkbox');
|
|
254
|
-
if (!headerCell && ev.target && typeof ev.target.closest === 'function') {
|
|
255
|
-
headerCell = ev.target.closest('xpl-table-header-cell[type="checkbox"]');
|
|
256
|
-
}
|
|
257
|
-
if (!headerCell || !this.el.contains(headerCell))
|
|
258
|
-
return;
|
|
259
|
-
if (!this.isCellInOurCompositionalHeader(headerCell))
|
|
260
|
-
return;
|
|
261
|
-
const headerCells = this.getCompositionalHeaderCells();
|
|
262
|
-
if (!headerCells.includes(headerCell))
|
|
263
|
-
return;
|
|
264
|
-
const checked = !!ev.detail;
|
|
265
|
-
const selectableRows = this.querySelectableBodyRows();
|
|
266
|
-
const ids = selectableRows
|
|
267
|
-
.map((r) => Table.getRowIdForRow(r))
|
|
268
|
-
.filter((id) => !!id);
|
|
269
|
-
if (checked) {
|
|
270
|
-
this.selectedRowIds = [...ids];
|
|
271
|
-
}
|
|
272
|
-
else {
|
|
273
|
-
this.selectedRowIds = [];
|
|
274
|
-
}
|
|
275
|
-
this.applyBodyCheckboxStates();
|
|
276
|
-
this.syncRowSelectedProps();
|
|
277
|
-
this.emitCompositionalSelection();
|
|
278
|
-
}
|
|
279
|
-
handlePointerDownExitKeyboardReorder(ev) {
|
|
280
|
-
if (this.isLegacyMode || !this.rowReorderable || this.keyboardReorderRowId === null) {
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
const t = ev.target;
|
|
284
|
-
if (!(t instanceof Node) || !this.el.contains(t)) {
|
|
285
|
-
return;
|
|
286
|
-
}
|
|
287
|
-
const row = t instanceof Element ? t.closest('xpl-table-row') : null;
|
|
288
|
-
if (!row || !this.isDirectChildBodyRow(row)) {
|
|
289
|
-
return;
|
|
290
|
-
}
|
|
291
|
-
this.keyboardReorderRowId = null;
|
|
292
|
-
this.syncReorderHandleKeyboardA11y(null);
|
|
293
|
-
}
|
|
294
|
-
handleReorderHandleKeyDown(ev) {
|
|
295
|
-
var _a;
|
|
296
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
const rawPath = typeof ev.composedPath === 'function' ? ev.composedPath() : [];
|
|
300
|
-
const path = rawPath.length > 0 ? rawPath : ev.target ? [ev.target] : [];
|
|
301
|
-
let handle = path.find((n) => n instanceof HTMLElement && n.classList.contains('xpl-table__row-drag-handle'));
|
|
302
|
-
if (!handle &&
|
|
303
|
-
ev.target instanceof HTMLElement &&
|
|
304
|
-
ev.target.classList.contains('xpl-table__row-drag-handle')) {
|
|
305
|
-
handle = ev.target;
|
|
306
|
-
}
|
|
307
|
-
if (!handle || !this.el.contains(handle)) {
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
const row = handle.closest('xpl-table-row');
|
|
311
|
-
if (!row || !this.isDirectChildBodyRow(row)) {
|
|
312
|
-
return;
|
|
313
|
-
}
|
|
314
|
-
const rowId = (_a = Table.getRowIdForRow(row)) !== null && _a !== void 0 ? _a : '';
|
|
315
|
-
if (!rowId) {
|
|
316
|
-
return;
|
|
317
|
-
}
|
|
318
|
-
const isKbd = this.keyboardReorderRowId === rowId;
|
|
319
|
-
const isEscapeKey = ev.key === 'Escape' ||
|
|
320
|
-
ev.key === 'Esc' ||
|
|
321
|
-
ev.code === 'Escape' ||
|
|
322
|
-
ev.keyCode === 27;
|
|
323
|
-
if (row.disabled) {
|
|
324
|
-
if (isEscapeKey && isKbd) {
|
|
325
|
-
ev.preventDefault();
|
|
326
|
-
this.keyboardReorderRowId = null;
|
|
327
|
-
this.syncReorderHandleKeyboardA11y(null);
|
|
328
|
-
}
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
if (isEscapeKey) {
|
|
332
|
-
if (isKbd) {
|
|
333
|
-
ev.preventDefault();
|
|
334
|
-
this.keyboardReorderRowId = null;
|
|
335
|
-
this.syncReorderHandleKeyboardA11y(null);
|
|
336
|
-
}
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
if (!isKbd) {
|
|
340
|
-
if (ev.key === 'Enter' || ev.key === ' ') {
|
|
341
|
-
ev.preventDefault();
|
|
342
|
-
this.keyboardReorderRowId = rowId;
|
|
343
|
-
this.syncReorderHandleKeyboardA11y(rowId);
|
|
344
|
-
}
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {
|
|
348
|
-
ev.preventDefault();
|
|
349
|
-
const dir = ev.key === 'ArrowUp' ? 'up' : 'down';
|
|
350
|
-
this.performKeyboardRowReorder(rowId, dir);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
handleRowReorderPointerDown(ev) {
|
|
354
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
const handle = reorderDragHandleFromEvent(ev);
|
|
358
|
-
if (!handle) {
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
|
-
const table = handle.closest('xpl-table');
|
|
362
|
-
if (table !== this.el) {
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
const row = bodyRowFromDragTarget(handle);
|
|
366
|
-
if (!row || row.disabled) {
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
370
|
-
if (!body || row.parentElement !== body) {
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
this.clearPendingDragListeners();
|
|
374
|
-
this.pendingDragRow = row;
|
|
375
|
-
const onPointerEnd = () => {
|
|
376
|
-
this.clearPendingDragListeners();
|
|
377
|
-
this.pendingDragRow = null;
|
|
378
|
-
};
|
|
379
|
-
document.addEventListener('pointerup', onPointerEnd, true);
|
|
380
|
-
document.addEventListener('pointercancel', onPointerEnd, true);
|
|
381
|
-
this.pointerUpClearPending = () => {
|
|
382
|
-
document.removeEventListener('pointerup', onPointerEnd, true);
|
|
383
|
-
document.removeEventListener('pointercancel', onPointerEnd, true);
|
|
384
|
-
};
|
|
385
|
-
}
|
|
386
|
-
handleRowReorderDragStart(ev) {
|
|
387
|
-
var _a;
|
|
388
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
const row = tableBodyRowFromEvent(ev);
|
|
392
|
-
if (!row) {
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
if (row.closest('xpl-table') !== this.el) {
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
399
|
-
if (!body || row.parentElement !== body) {
|
|
400
|
-
return;
|
|
401
|
-
}
|
|
402
|
-
if (row.disabled || this.pendingDragRow !== row) {
|
|
403
|
-
ev.preventDefault();
|
|
404
|
-
return;
|
|
405
|
-
}
|
|
406
|
-
this.keyboardReorderRowId = null;
|
|
407
|
-
this.syncReorderHandleKeyboardA11y(null);
|
|
408
|
-
this.clearPendingDragListeners();
|
|
409
|
-
this.pendingDragRow = null;
|
|
410
|
-
this.draggedRow = row;
|
|
411
|
-
if (ev.dataTransfer) {
|
|
412
|
-
ev.dataTransfer.effectAllowed = 'move';
|
|
413
|
-
ev.dataTransfer.setData('text/plain', (_a = Table.getRowIdForRow(row)) !== null && _a !== void 0 ? _a : '');
|
|
414
|
-
}
|
|
415
|
-
row.classList.add('xpl-table-row--dragging');
|
|
416
|
-
}
|
|
417
|
-
handleRowReorderDragEnd(ev) {
|
|
418
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
const row = tableBodyRowFromEvent(ev);
|
|
422
|
-
if (!row || row.closest('xpl-table') !== this.el) {
|
|
423
|
-
return;
|
|
424
|
-
}
|
|
425
|
-
row.classList.remove('xpl-table-row--dragging');
|
|
426
|
-
this.clearReorderDragOverClasses();
|
|
427
|
-
this.draggedRow = null;
|
|
428
|
-
}
|
|
429
|
-
handleRowReorderDragOver(ev) {
|
|
430
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
const row = tableBodyRowFromEvent(ev);
|
|
434
|
-
if (!row || row.closest('xpl-table') !== this.el) {
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
438
|
-
if (!body || row.parentElement !== body || row.disabled) {
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
ev.preventDefault();
|
|
442
|
-
if (ev.dataTransfer) {
|
|
443
|
-
ev.dataTransfer.dropEffect = 'move';
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
handleRowReorderDragEnter(ev) {
|
|
447
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
const row = tableBodyRowFromEvent(ev);
|
|
451
|
-
if (!row || row.closest('xpl-table') !== this.el) {
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
455
|
-
if (!body || row.parentElement !== body || row.disabled) {
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
ev.preventDefault();
|
|
459
|
-
row.classList.add('xpl-table-row--drag-over');
|
|
460
|
-
}
|
|
461
|
-
handleRowReorderDragLeave(ev) {
|
|
462
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
const row = tableBodyRowFromEvent(ev);
|
|
466
|
-
if (!row || row.closest('xpl-table') !== this.el) {
|
|
467
|
-
return;
|
|
468
|
-
}
|
|
469
|
-
const related = ev.relatedTarget;
|
|
470
|
-
if (related && row.contains(related)) {
|
|
471
|
-
return;
|
|
472
|
-
}
|
|
473
|
-
row.classList.remove('xpl-table-row--drag-over');
|
|
474
|
-
}
|
|
475
|
-
handleRowReorderDrop(ev) {
|
|
476
|
-
var _a;
|
|
477
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
|
-
ev.preventDefault();
|
|
481
|
-
const dropRow = tableBodyRowFromEvent(ev);
|
|
482
|
-
if (!dropRow || dropRow.closest('xpl-table') !== this.el) {
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
486
|
-
if (!body || dropRow.parentElement !== body || dropRow.disabled) {
|
|
487
|
-
return;
|
|
488
|
-
}
|
|
489
|
-
const source = this.draggedRow;
|
|
490
|
-
if (!source || source.disabled) {
|
|
491
|
-
this.draggedRow = null;
|
|
492
|
-
this.clearReorderDragOverClasses();
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
|
-
if (source === dropRow) {
|
|
496
|
-
this.clearReorderDragOverClasses();
|
|
497
|
-
return;
|
|
498
|
-
}
|
|
499
|
-
const visible = this.getVisibleBodyRowsForReorder();
|
|
500
|
-
const fromIndex = visible.indexOf(source);
|
|
501
|
-
const toIndex = visible.indexOf(dropRow);
|
|
502
|
-
if (fromIndex === -1 || toIndex === -1) {
|
|
503
|
-
this.clearReorderDragOverClasses();
|
|
504
|
-
return;
|
|
505
|
-
}
|
|
506
|
-
const direction = fromIndex > toIndex ? 'up' : 'down';
|
|
507
|
-
const rowId = (_a = Table.getRowIdForRow(source)) !== null && _a !== void 0 ? _a : '';
|
|
508
|
-
const runMove = () => {
|
|
509
|
-
moveRowInTableBody(body, source, dropRow);
|
|
510
|
-
};
|
|
511
|
-
runMove();
|
|
512
|
-
const orderedRowIds = this.getVisibleBodyRowsForReorder().map((r) => { var _a; return (_a = Table.getRowIdForRow(r)) !== null && _a !== void 0 ? _a : ''; });
|
|
513
|
-
this.rowOrderChange.emit({
|
|
514
|
-
rowId,
|
|
515
|
-
direction,
|
|
516
|
-
orderedRowIds,
|
|
517
|
-
fromIndex,
|
|
518
|
-
toIndex,
|
|
519
|
-
});
|
|
520
|
-
this.announceRowReorder(rowId, orderedRowIds);
|
|
521
|
-
this.clearReorderDragOverClasses();
|
|
522
|
-
if (this.selectable) {
|
|
523
|
-
this.applyBodyCheckboxStates();
|
|
524
|
-
this.applyHeaderCheckboxState();
|
|
525
|
-
this.syncRowSelectedProps();
|
|
526
|
-
}
|
|
527
|
-
this.updateColumnWidths();
|
|
528
|
-
}
|
|
529
|
-
get isLegacyMode() {
|
|
530
|
-
return this.columns !== undefined || this.data !== undefined || this.footer !== undefined;
|
|
531
|
-
}
|
|
532
|
-
ensureTableInstanceId() {
|
|
533
|
-
if (this.tableInstanceId)
|
|
534
|
-
return;
|
|
535
|
-
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
536
|
-
this.tableInstanceId = crypto.randomUUID();
|
|
537
|
-
}
|
|
538
|
-
else {
|
|
539
|
-
this.tableInstanceId = Math.random().toString(36).slice(2);
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
generateRowId() {
|
|
543
|
-
this.ensureTableInstanceId();
|
|
544
|
-
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
545
|
-
return `${this.tableInstanceId}-${crypto.randomUUID()}`;
|
|
546
|
-
}
|
|
547
|
-
return `${this.tableInstanceId}-${Math.random().toString(36).slice(2)}`;
|
|
548
|
-
}
|
|
549
|
-
syncCompositionalLayout() {
|
|
550
|
-
if (this.isLegacyMode)
|
|
551
|
-
return;
|
|
552
|
-
if (this.rowReorderable) {
|
|
553
|
-
this.syncReorderColumn();
|
|
554
|
-
}
|
|
555
|
-
else {
|
|
556
|
-
this.removeManagedReorderCells();
|
|
557
|
-
}
|
|
558
|
-
if (this.selectable) {
|
|
559
|
-
this.ensureTableInstanceId();
|
|
560
|
-
this.pruneStaleSelectedRowIds();
|
|
561
|
-
this.ensureBodyRowIds();
|
|
562
|
-
this.applyBodyCheckboxStates();
|
|
563
|
-
this.applyHeaderCheckboxState();
|
|
564
|
-
this.syncRowSelectedProps();
|
|
565
|
-
}
|
|
566
|
-
if (this.rowReorderable && this.selectable) {
|
|
567
|
-
this.normalizeManagedColumnsOrder();
|
|
568
|
-
}
|
|
569
|
-
this.updateColumnWidths();
|
|
570
|
-
}
|
|
571
|
-
getDirectChildTableSection(tag) {
|
|
572
|
-
var _a;
|
|
573
|
-
const el = Array.from(this.el.children).find((c) => c.tagName.toLowerCase() === tag);
|
|
574
|
-
return (_a = el) !== null && _a !== void 0 ? _a : null;
|
|
575
|
-
}
|
|
576
|
-
isDirectChildBodyRow(row) {
|
|
577
|
-
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
578
|
-
return body !== null && row.parentElement === body;
|
|
579
|
-
}
|
|
580
|
-
isCellInOurCompositionalHeader(cell) {
|
|
581
|
-
const header = cell.closest('xpl-table-header');
|
|
582
|
-
return header !== null && header.parentElement === this.el;
|
|
583
|
-
}
|
|
584
|
-
getSelectionColumnIndex() {
|
|
585
|
-
const headerCells = this.getCompositionalHeaderCells();
|
|
586
|
-
const idx = headerCells.findIndex((c) => c.getAttribute('type') === 'checkbox');
|
|
587
|
-
return idx >= 0 ? idx : null;
|
|
588
|
-
}
|
|
589
|
-
static getBodyRowCells(row) {
|
|
590
|
-
return Array.from(row.children).filter((c) => c.tagName.toLowerCase() === 'xpl-table-cell');
|
|
591
|
-
}
|
|
592
|
-
queryBodyRows() {
|
|
593
|
-
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
594
|
-
if (!body)
|
|
595
|
-
return [];
|
|
596
|
-
return Array.from(body.children).filter((c) => c.tagName.toLowerCase() === 'xpl-table-row');
|
|
597
|
-
}
|
|
598
|
-
querySelectableBodyRows() {
|
|
599
|
-
return this.queryBodyRows().filter((row) => !row.disabled);
|
|
600
|
-
}
|
|
601
|
-
static getRowIdForRow(row) {
|
|
602
|
-
var _a;
|
|
603
|
-
const id = (_a = row.getAttribute('row-id')) === null || _a === void 0 ? void 0 : _a.trim();
|
|
604
|
-
return id || null;
|
|
605
|
-
}
|
|
606
|
-
ensureBodyRowIds() {
|
|
607
|
-
this.queryBodyRows().forEach((row) => {
|
|
608
|
-
if (Table.getRowIdForRow(row))
|
|
609
|
-
return;
|
|
610
|
-
row.setAttribute('row-id', this.generateRowId());
|
|
611
|
-
});
|
|
612
|
-
}
|
|
613
|
-
removeManagedReorderCells() {
|
|
614
|
-
this.el.querySelectorAll(`[${ROW_REORDER_MARK}]`).forEach((node) => {
|
|
615
|
-
var _a;
|
|
616
|
-
if (!(node instanceof Element))
|
|
617
|
-
return;
|
|
618
|
-
if (node.closest('xpl-table') !== this.el)
|
|
619
|
-
return;
|
|
620
|
-
(_a = node.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(node);
|
|
621
|
-
});
|
|
622
|
-
}
|
|
623
|
-
getSelectionSlotCellForReorderOrder(row) {
|
|
624
|
-
const idx = this.getSelectionColumnIndex();
|
|
625
|
-
if (idx === null) {
|
|
626
|
-
return null;
|
|
627
|
-
}
|
|
628
|
-
const cells = Array.from(row.children);
|
|
629
|
-
const cell = cells[idx];
|
|
630
|
-
if (!cell) {
|
|
631
|
-
return null;
|
|
632
|
-
}
|
|
633
|
-
const tag = cell.tagName.toLowerCase();
|
|
634
|
-
if (tag === 'xpl-table-header-cell') {
|
|
635
|
-
return cell.getAttribute('type') === 'checkbox' ? cell : null;
|
|
636
|
-
}
|
|
637
|
-
if (tag === 'xpl-table-cell') {
|
|
638
|
-
if (cell.hasAttribute(SELECTION_MARK)) {
|
|
639
|
-
return cell;
|
|
640
|
-
}
|
|
641
|
-
return cell.querySelector('xpl-checkbox') ? cell : null;
|
|
642
|
-
}
|
|
643
|
-
if (tag === 'xpl-table-footer-cell') {
|
|
644
|
-
return cell;
|
|
645
|
-
}
|
|
646
|
-
return null;
|
|
647
|
-
}
|
|
648
|
-
normalizeManagedColumnsOrder() {
|
|
649
|
-
var _a;
|
|
650
|
-
const fix = (row) => {
|
|
651
|
-
const re = row.querySelector(`:scope > [${ROW_REORDER_MARK}]`);
|
|
652
|
-
const se = this.getSelectionSlotCellForReorderOrder(row);
|
|
653
|
-
if (!re || !se) {
|
|
654
|
-
return;
|
|
655
|
-
}
|
|
656
|
-
const siblings = Array.from(row.children);
|
|
657
|
-
const iRe = siblings.indexOf(re);
|
|
658
|
-
const iSe = siblings.indexOf(se);
|
|
659
|
-
if (iRe > iSe) {
|
|
660
|
-
row.insertBefore(re, se);
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
const header = (_a = Array.from(this.el.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-header')) !== null && _a !== void 0 ? _a : null;
|
|
664
|
-
if (header) {
|
|
665
|
-
const firstRow = Array.from(header.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-row');
|
|
666
|
-
const container = firstRow !== null && firstRow !== void 0 ? firstRow : header;
|
|
667
|
-
fix(container);
|
|
668
|
-
}
|
|
669
|
-
this.queryBodyRows().forEach((row) => fix(row));
|
|
670
|
-
const footer = this.getDirectChildTableSection('xpl-table-footer');
|
|
671
|
-
if (footer) {
|
|
672
|
-
Array.from(footer.children)
|
|
673
|
-
.filter((c) => c.tagName.toLowerCase() === 'xpl-table-row')
|
|
674
|
-
.forEach((row) => fix(row));
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
syncReorderColumn() {
|
|
678
|
-
if (!this.rowReorderable || this.isLegacyMode)
|
|
679
|
-
return;
|
|
680
|
-
this.ensureBodyRowIds();
|
|
681
|
-
this.ensureHeaderReorderCell();
|
|
682
|
-
this.ensureBodyReorderCells();
|
|
683
|
-
this.ensureFooterReorderCells();
|
|
684
|
-
this.applyReorderRowDraggableState();
|
|
685
|
-
}
|
|
686
|
-
ensureHeaderReorderCell() {
|
|
687
|
-
var _a;
|
|
688
|
-
const header = (_a = Array.from(this.el.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-header')) !== null && _a !== void 0 ? _a : null;
|
|
689
|
-
if (!header)
|
|
690
|
-
return;
|
|
691
|
-
const firstRow = Array.from(header.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-row');
|
|
692
|
-
const container = firstRow !== null && firstRow !== void 0 ? firstRow : header;
|
|
693
|
-
if (Array.from(container.children).some((c) => c.tagName.toLowerCase() === 'xpl-table-header-cell' &&
|
|
694
|
-
c.hasAttribute(ROW_REORDER_MARK))) {
|
|
695
|
-
return;
|
|
696
|
-
}
|
|
697
|
-
const cell = document.createElement('xpl-table-header-cell');
|
|
698
|
-
cell.setAttribute(ROW_REORDER_MARK, '');
|
|
699
|
-
cell.setAttribute('type', 'empty');
|
|
700
|
-
cell.setAttribute('width', '48');
|
|
701
|
-
cell.setAttribute('align', 'center');
|
|
702
|
-
container.insertBefore(cell, container.firstChild);
|
|
703
|
-
}
|
|
704
|
-
ensureBodyReorderCells() {
|
|
705
|
-
this.queryBodyRows().forEach((row) => {
|
|
706
|
-
var _a;
|
|
707
|
-
const managed = Array.from(row.children).filter((c) => c.tagName.toLowerCase() === 'xpl-table-cell' &&
|
|
708
|
-
c.hasAttribute(ROW_REORDER_MARK));
|
|
709
|
-
if (managed.length > 1) {
|
|
710
|
-
for (let i = 1; i < managed.length; i += 1) {
|
|
711
|
-
managed[i].remove();
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
let cell = managed[0];
|
|
715
|
-
if (!cell) {
|
|
716
|
-
const newCell = document.createElement('xpl-table-cell');
|
|
717
|
-
newCell.setAttribute(ROW_REORDER_MARK, '');
|
|
718
|
-
newCell.setAttribute('width', '48');
|
|
719
|
-
newCell.setAttribute('align', 'center');
|
|
720
|
-
const btn = document.createElement('button');
|
|
721
|
-
btn.type = 'button';
|
|
722
|
-
btn.className = 'xpl-table__row-drag-handle';
|
|
723
|
-
btn.setAttribute('aria-label', 'Reorder row');
|
|
724
|
-
btn.setAttribute('aria-pressed', 'false');
|
|
725
|
-
const iconName = this.getResolvedIconForRow((_a = Table.getRowIdForRow(row)) !== null && _a !== void 0 ? _a : '');
|
|
726
|
-
if (iconName) {
|
|
727
|
-
const icon = document.createElement('xpl-icon');
|
|
728
|
-
icon.setAttribute('icon', iconName);
|
|
729
|
-
icon.setAttribute('size', '16');
|
|
730
|
-
btn.appendChild(icon);
|
|
731
|
-
}
|
|
732
|
-
newCell.appendChild(btn);
|
|
733
|
-
row.insertBefore(newCell, row.firstChild);
|
|
734
|
-
cell = newCell;
|
|
735
|
-
}
|
|
736
|
-
else {
|
|
737
|
-
cell.setAttribute('align', 'center');
|
|
738
|
-
}
|
|
739
|
-
const btn = cell.querySelector('.xpl-table__row-drag-handle');
|
|
740
|
-
if (btn) {
|
|
741
|
-
btn.disabled = row.disabled;
|
|
742
|
-
}
|
|
743
|
-
});
|
|
744
|
-
this.syncInjectedReorderHandleIcons();
|
|
745
|
-
this.attachReorderHandleKeydownListeners();
|
|
746
|
-
}
|
|
747
|
-
getResolvedIconForRow(rowId) {
|
|
748
|
-
var _a, _b;
|
|
749
|
-
const inKeyboardMode = this.keyboardReorderRowId !== null &&
|
|
750
|
-
rowId !== '' &&
|
|
751
|
-
rowId === this.keyboardReorderRowId;
|
|
752
|
-
if (inKeyboardMode) {
|
|
753
|
-
if (this.reorderHandleIconKeyboard === '') {
|
|
754
|
-
return null;
|
|
755
|
-
}
|
|
756
|
-
return (_a = this.reorderHandleIconKeyboard) !== null && _a !== void 0 ? _a : 'caret-expand-y';
|
|
757
|
-
}
|
|
758
|
-
if (this.reorderHandleIcon === '') {
|
|
759
|
-
return null;
|
|
760
|
-
}
|
|
761
|
-
return (_b = this.reorderHandleIcon) !== null && _b !== void 0 ? _b : 'grip-dots-vertical';
|
|
762
|
-
}
|
|
763
|
-
syncInjectedReorderHandleIcons() {
|
|
764
|
-
this.queryBodyRows().forEach((row) => {
|
|
765
|
-
var _a;
|
|
766
|
-
const btn = row.querySelector('.xpl-table__row-drag-handle');
|
|
767
|
-
if (!btn) {
|
|
768
|
-
return;
|
|
769
|
-
}
|
|
770
|
-
const rowId = (_a = Table.getRowIdForRow(row)) !== null && _a !== void 0 ? _a : '';
|
|
771
|
-
const iconName = this.getResolvedIconForRow(rowId);
|
|
772
|
-
btn.querySelectorAll('xpl-icon').forEach((n) => n.remove());
|
|
773
|
-
if (iconName) {
|
|
774
|
-
const icon = document.createElement('xpl-icon');
|
|
775
|
-
icon.setAttribute('icon', iconName);
|
|
776
|
-
icon.setAttribute('size', '16');
|
|
777
|
-
btn.appendChild(icon);
|
|
778
|
-
}
|
|
779
|
-
});
|
|
780
|
-
}
|
|
781
|
-
syncReorderHandleKeyboardA11y(activeId) {
|
|
782
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
783
|
-
return;
|
|
784
|
-
}
|
|
785
|
-
this.queryBodyRows().forEach((row) => {
|
|
786
|
-
var _a;
|
|
787
|
-
const btn = row.querySelector('.xpl-table__row-drag-handle');
|
|
788
|
-
if (!btn) {
|
|
789
|
-
return;
|
|
790
|
-
}
|
|
791
|
-
const rid = (_a = Table.getRowIdForRow(row)) !== null && _a !== void 0 ? _a : '';
|
|
792
|
-
const isActive = activeId !== null && rid === activeId;
|
|
793
|
-
btn.classList.toggle('xpl-table__row-drag-handle--keyboard-mode', isActive);
|
|
794
|
-
btn.setAttribute('aria-pressed', isActive ? 'true' : 'false');
|
|
795
|
-
btn.setAttribute('aria-label', isActive
|
|
796
|
-
? 'Press arrow up or down to reorder, Escape to exit'
|
|
797
|
-
: 'Press Enter or Space to activate keyboard reorder mode, or drag to reorder');
|
|
798
|
-
});
|
|
799
|
-
this.syncInjectedReorderHandleIcons();
|
|
800
|
-
}
|
|
801
|
-
attachReorderHandleKeydownListeners() {
|
|
802
|
-
if (this.isLegacyMode || !this.rowReorderable) {
|
|
803
|
-
return;
|
|
804
|
-
}
|
|
805
|
-
this.queryBodyRows().forEach((row) => {
|
|
806
|
-
const btn = row.querySelector('.xpl-table__row-drag-handle');
|
|
807
|
-
if (!btn || btn.dataset.xplReorderKbdBound === 'true') {
|
|
808
|
-
return;
|
|
809
|
-
}
|
|
810
|
-
btn.dataset.xplReorderKbdBound = 'true';
|
|
811
|
-
btn.addEventListener('keydown', this.onReorderHandleKeydown);
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
detachReorderHandleKeydownListeners() {
|
|
815
|
-
if (!this.el) {
|
|
816
|
-
return;
|
|
817
|
-
}
|
|
818
|
-
this.el
|
|
819
|
-
.querySelectorAll('.xpl-table__row-drag-handle[data-xpl-reorder-kbd-bound="true"]')
|
|
820
|
-
.forEach((btn) => {
|
|
821
|
-
btn.removeEventListener('keydown', this.onReorderHandleKeydown);
|
|
822
|
-
delete btn.dataset.xplReorderKbdBound;
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
performKeyboardRowReorder(rowId, direction) {
|
|
826
|
-
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
827
|
-
if (!body) {
|
|
828
|
-
return false;
|
|
829
|
-
}
|
|
830
|
-
const visible = this.getVisibleBodyRowsForReorder();
|
|
831
|
-
const itemIndex = visible.findIndex((r) => Table.getRowIdForRow(r) === rowId);
|
|
832
|
-
if (itemIndex === -1) {
|
|
833
|
-
return false;
|
|
834
|
-
}
|
|
835
|
-
const targetIndex = direction === 'up' ? itemIndex - 1 : itemIndex + 1;
|
|
836
|
-
if (targetIndex < 0 || targetIndex >= visible.length) {
|
|
837
|
-
return false;
|
|
838
|
-
}
|
|
839
|
-
const fromIndex = itemIndex;
|
|
840
|
-
const item = visible[itemIndex];
|
|
841
|
-
const targetItem = visible[targetIndex];
|
|
842
|
-
if (direction === 'up') {
|
|
843
|
-
body.insertBefore(item, targetItem);
|
|
844
|
-
}
|
|
845
|
-
else {
|
|
846
|
-
const nextVisible = getNextVisibleTableBodyRowAfter(targetItem);
|
|
847
|
-
if (nextVisible) {
|
|
848
|
-
body.insertBefore(item, nextVisible);
|
|
849
|
-
}
|
|
850
|
-
else {
|
|
851
|
-
body.appendChild(item);
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
const orderedRowIds = this.getVisibleBodyRowsForReorder().map((r) => { var _a; return (_a = Table.getRowIdForRow(r)) !== null && _a !== void 0 ? _a : ''; });
|
|
855
|
-
const toIndex = orderedRowIds.indexOf(rowId);
|
|
856
|
-
this.rowOrderChange.emit({
|
|
857
|
-
rowId,
|
|
858
|
-
direction,
|
|
859
|
-
orderedRowIds,
|
|
860
|
-
fromIndex,
|
|
861
|
-
toIndex,
|
|
862
|
-
});
|
|
863
|
-
this.announceRowReorder(rowId, orderedRowIds);
|
|
864
|
-
this.clearReorderDragOverClasses();
|
|
865
|
-
if (this.selectable) {
|
|
866
|
-
this.applyBodyCheckboxStates();
|
|
867
|
-
this.applyHeaderCheckboxState();
|
|
868
|
-
this.syncRowSelectedProps();
|
|
869
|
-
}
|
|
870
|
-
this.updateColumnWidths();
|
|
871
|
-
this.reorderKeyboardTimers.requestAnimationFrame(() => {
|
|
872
|
-
if (!this.el.isConnected) {
|
|
873
|
-
return;
|
|
874
|
-
}
|
|
875
|
-
const moved = this.getVisibleBodyRowsForReorder().find((r) => Table.getRowIdForRow(r) === rowId);
|
|
876
|
-
const btn = moved === null || moved === void 0 ? void 0 : moved.querySelector('.xpl-table__row-drag-handle');
|
|
877
|
-
btn === null || btn === void 0 ? void 0 : btn.focus();
|
|
878
|
-
});
|
|
879
|
-
return true;
|
|
880
|
-
}
|
|
881
|
-
ensureFooterReorderCells() {
|
|
882
|
-
const footer = this.getDirectChildTableSection('xpl-table-footer');
|
|
883
|
-
if (!footer)
|
|
884
|
-
return;
|
|
885
|
-
Array.from(footer.children)
|
|
886
|
-
.filter((c) => c.tagName.toLowerCase() === 'xpl-table-row')
|
|
887
|
-
.forEach((row) => {
|
|
888
|
-
if (Array.from(row.children).some((c) => c.tagName.toLowerCase() === 'xpl-table-footer-cell' &&
|
|
889
|
-
c.hasAttribute(ROW_REORDER_MARK))) {
|
|
890
|
-
return;
|
|
891
|
-
}
|
|
892
|
-
const cell = document.createElement('xpl-table-footer-cell');
|
|
893
|
-
cell.setAttribute(ROW_REORDER_MARK, '');
|
|
894
|
-
cell.setAttribute('width', '48');
|
|
895
|
-
cell.setAttribute('align', 'center');
|
|
896
|
-
row.insertBefore(cell, row.firstChild);
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
static supportsSubgridBodyRow() {
|
|
900
|
-
return (typeof CSS !== 'undefined' &&
|
|
901
|
-
typeof CSS.supports === 'function' &&
|
|
902
|
-
CSS.supports('grid-template-columns', 'subgrid'));
|
|
903
|
-
}
|
|
904
|
-
applyReorderRowDraggableState() {
|
|
905
|
-
const useRowDrag = Table.supportsSubgridBodyRow();
|
|
906
|
-
this.queryBodyRows().forEach((row) => {
|
|
907
|
-
const btn = row.querySelector('.xpl-table__row-drag-handle');
|
|
908
|
-
btn === null || btn === void 0 ? void 0 : btn.removeAttribute('draggable');
|
|
909
|
-
row.removeAttribute('draggable');
|
|
910
|
-
if (!this.rowReorderable || row.disabled) {
|
|
911
|
-
return;
|
|
912
|
-
}
|
|
913
|
-
if (!btn) {
|
|
914
|
-
return;
|
|
915
|
-
}
|
|
916
|
-
if (useRowDrag) {
|
|
917
|
-
row.setAttribute('draggable', 'true');
|
|
918
|
-
}
|
|
919
|
-
else {
|
|
920
|
-
btn.setAttribute('draggable', 'true');
|
|
921
|
-
}
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
getVisibleBodyRowsForReorder() {
|
|
925
|
-
return this.queryBodyRows().filter((r) => !r.hasAttribute('hidden'));
|
|
926
|
-
}
|
|
927
|
-
clearReorderDragOverClasses() {
|
|
928
|
-
this.queryBodyRows().forEach((r) => r.classList.remove('xpl-table-row--drag-over'));
|
|
929
|
-
}
|
|
930
|
-
clearPendingDragListeners() {
|
|
931
|
-
if (this.pointerUpClearPending) {
|
|
932
|
-
this.pointerUpClearPending();
|
|
933
|
-
this.pointerUpClearPending = null;
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
announceRowReorder(movedRowId, orderedRowIds) {
|
|
937
|
-
if (!this.rowReorderable || !movedRowId) {
|
|
938
|
-
return;
|
|
939
|
-
}
|
|
940
|
-
const index = orderedRowIds.indexOf(movedRowId);
|
|
941
|
-
if (index < 0) {
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
this.reorderLiveMessage = '';
|
|
945
|
-
if (this.reorderAnnounceRaf !== undefined) {
|
|
946
|
-
cancelAnimationFrame(this.reorderAnnounceRaf);
|
|
947
|
-
}
|
|
948
|
-
this.reorderAnnounceRaf = requestAnimationFrame(() => {
|
|
949
|
-
this.reorderAnnounceRaf = undefined;
|
|
950
|
-
if (!this.el.isConnected) {
|
|
951
|
-
return;
|
|
952
|
-
}
|
|
953
|
-
this.reorderLiveMessage = `Row ${movedRowId}, now position ${index + 1} of ${orderedRowIds.length}`;
|
|
954
|
-
});
|
|
955
|
-
}
|
|
956
|
-
pruneStaleSelectedRowIds() {
|
|
957
|
-
const validIds = new Set(this.queryBodyRows()
|
|
958
|
-
.map((r) => Table.getRowIdForRow(r))
|
|
959
|
-
.filter((id) => !!id));
|
|
960
|
-
const next = this.selectedRowIds.filter((id) => validIds.has(id));
|
|
961
|
-
if (next.length === this.selectedRowIds.length)
|
|
962
|
-
return;
|
|
963
|
-
this.selectedRowIds = next;
|
|
964
|
-
this.applyBodyCheckboxStates();
|
|
965
|
-
this.applyHeaderCheckboxState();
|
|
966
|
-
this.syncRowSelectedProps();
|
|
967
|
-
this.emitCompositionalSelection();
|
|
968
|
-
}
|
|
969
|
-
static getBodyRowCheckboxAriaLabel(row, selectionColIndex) {
|
|
970
|
-
var _a, _b;
|
|
971
|
-
const cells = Table.getBodyRowCells(row);
|
|
972
|
-
const labelCell = cells.find((c, i) => (selectionColIndex === null || i !== selectionColIndex) &&
|
|
973
|
-
!c.hasAttribute(ROW_REORDER_MARK));
|
|
974
|
-
const first = labelCell !== null && labelCell !== void 0 ? labelCell : cells[0];
|
|
975
|
-
if (!first)
|
|
976
|
-
return 'Select row';
|
|
977
|
-
const raw = (_b = (_a = first.textContent) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, ' ').trim()) !== null && _b !== void 0 ? _b : '';
|
|
978
|
-
if (!raw)
|
|
979
|
-
return 'Select row';
|
|
980
|
-
const truncated = raw.length > 100 ? `${raw.slice(0, 100)}…` : raw;
|
|
981
|
-
return `Select row, ${truncated}`;
|
|
982
|
-
}
|
|
983
|
-
applyBodyCheckboxStates() {
|
|
984
|
-
const selectionIdx = this.getSelectionColumnIndex();
|
|
985
|
-
if (selectionIdx === null)
|
|
986
|
-
return;
|
|
987
|
-
this.queryBodyRows().forEach((row) => {
|
|
988
|
-
const rowId = Table.getRowIdForRow(row);
|
|
989
|
-
const cells = Table.getBodyRowCells(row);
|
|
990
|
-
const cell = cells[selectionIdx];
|
|
991
|
-
const cb = cell === null || cell === void 0 ? void 0 : cell.querySelector('xpl-checkbox');
|
|
992
|
-
if (!cb || !rowId)
|
|
993
|
-
return;
|
|
994
|
-
cb.checked = this.selectedRowIds.includes(rowId);
|
|
995
|
-
cb.disabled = row.disabled;
|
|
996
|
-
cb.value = rowId;
|
|
997
|
-
cb.setAttribute('aria-label', Table.getBodyRowCheckboxAriaLabel(row, selectionIdx));
|
|
998
|
-
});
|
|
999
|
-
}
|
|
1000
|
-
getHeaderCheckboxCell() {
|
|
1001
|
-
const idx = this.getSelectionColumnIndex();
|
|
1002
|
-
if (idx === null)
|
|
1003
|
-
return null;
|
|
1004
|
-
const cells = this.getCompositionalHeaderCells();
|
|
1005
|
-
const cell = cells[idx];
|
|
1006
|
-
if (!cell || cell.getAttribute('type') !== 'checkbox')
|
|
1007
|
-
return null;
|
|
1008
|
-
return cell;
|
|
1009
|
-
}
|
|
1010
|
-
applyHeaderCheckboxState() {
|
|
1011
|
-
const cell = this.getHeaderCheckboxCell();
|
|
1012
|
-
if (!cell)
|
|
1013
|
-
return;
|
|
1014
|
-
const selectableRows = this.querySelectableBodyRows();
|
|
1015
|
-
const ids = selectableRows
|
|
1016
|
-
.map((r) => Table.getRowIdForRow(r))
|
|
1017
|
-
.filter((id) => !!id);
|
|
1018
|
-
const selectedCount = ids.filter((id) => this.selectedRowIds.includes(id)).length;
|
|
1019
|
-
const allSelected = ids.length > 0 && selectedCount === ids.length;
|
|
1020
|
-
const indeterminate = selectedCount > 0 && !allSelected;
|
|
1021
|
-
cell.checked = allSelected;
|
|
1022
|
-
cell.indeterminate = indeterminate;
|
|
1023
|
-
}
|
|
1024
|
-
syncRowSelectedProps() {
|
|
1025
|
-
this.queryBodyRows().forEach((row) => {
|
|
1026
|
-
const id = Table.getRowIdForRow(row);
|
|
1027
|
-
const selected = id ? this.selectedRowIds.includes(id) : false;
|
|
1028
|
-
row.selected = selected;
|
|
1029
|
-
});
|
|
1030
|
-
}
|
|
1031
|
-
emitCompositionalSelection() {
|
|
1032
|
-
const ids = this.selectedRowIds;
|
|
1033
|
-
const key = ids.join('\u0001');
|
|
1034
|
-
if (key === this.lastEmittedRowSelectionKey) {
|
|
1035
|
-
return;
|
|
1036
|
-
}
|
|
1037
|
-
this.lastEmittedRowSelectionKey = key;
|
|
1038
|
-
this.rowSelectionChange.emit({ selectedRowIds: [...ids] });
|
|
1039
|
-
}
|
|
1040
|
-
isEventFromThisTable(target) {
|
|
1041
|
-
if (target == null || typeof target !== 'object')
|
|
1042
|
-
return false;
|
|
1043
|
-
const t = target;
|
|
1044
|
-
const start = 'closest' in t && typeof t.closest === 'function'
|
|
1045
|
-
? t
|
|
1046
|
-
: 'parentElement' in t
|
|
1047
|
-
? t.parentElement
|
|
1048
|
-
: null;
|
|
1049
|
-
if (!start)
|
|
1050
|
-
return false;
|
|
1051
|
-
const nearest = start.closest('xpl-table');
|
|
1052
|
-
return nearest === this.el;
|
|
1053
|
-
}
|
|
1054
|
-
static sortKeyFromHeaderCell(cell, columnIndex) {
|
|
1055
|
-
var _a, _b;
|
|
1056
|
-
const c = cell;
|
|
1057
|
-
const raw = ((_b = (_a = c.sortKey) !== null && _a !== void 0 ? _a : c.label) !== null && _b !== void 0 ? _b : '').trim();
|
|
1058
|
-
if (raw.length > 0) {
|
|
1059
|
-
return raw.replace(/ /g, '-').toLowerCase();
|
|
1060
|
-
}
|
|
1061
|
-
return `column-${columnIndex}`;
|
|
1062
|
-
}
|
|
1063
|
-
handleCompositionalHeaderSort(ev) {
|
|
1064
|
-
var _a;
|
|
1065
|
-
if (this.isLegacyMode)
|
|
1066
|
-
return;
|
|
1067
|
-
if (!this.isEventFromThisTable(ev.target))
|
|
1068
|
-
return;
|
|
1069
|
-
const source = ev.target;
|
|
1070
|
-
const headerRow = (_a = source.closest('xpl-table-header xpl-table-row')) !== null && _a !== void 0 ? _a : source.closest('xpl-table-row');
|
|
1071
|
-
if (!headerRow || !this.el.contains(headerRow))
|
|
1072
|
-
return;
|
|
1073
|
-
const cells = Array.from(headerRow.querySelectorAll('xpl-table-header-cell'));
|
|
1074
|
-
const { columnIndex } = ev.detail;
|
|
1075
|
-
const target = cells[columnIndex];
|
|
1076
|
-
if (!(target === null || target === void 0 ? void 0 : target.sortable))
|
|
1077
|
-
return;
|
|
1078
|
-
const next = cycleSortDirection(target.sortDirection);
|
|
1079
|
-
cells.forEach((cell, i) => {
|
|
1080
|
-
const hc = cell;
|
|
1081
|
-
if (!hc.sortable)
|
|
2
|
+
const getIconType = (sortType) => {
|
|
3
|
+
switch (sortType) {
|
|
4
|
+
case 'asc':
|
|
5
|
+
return 'arrow-up';
|
|
6
|
+
case 'desc':
|
|
7
|
+
return 'arrow-down';
|
|
8
|
+
default:
|
|
9
|
+
return 'dash';
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export class Table {
|
|
13
|
+
constructor() {
|
|
14
|
+
this.selectedValues = [];
|
|
15
|
+
this.isSortable = false;
|
|
16
|
+
this.sortableColumns = [];
|
|
17
|
+
this.areAllSelected = false;
|
|
18
|
+
this.hasScrolled = false;
|
|
19
|
+
this.sortTypeArray = [];
|
|
20
|
+
this.selectAllValue = Math.random().toString(36).slice(2);
|
|
21
|
+
this.selectAll = (e) => {
|
|
22
|
+
const { target } = e;
|
|
23
|
+
if (!(target instanceof HTMLInputElement))
|
|
1082
24
|
return;
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
25
|
+
const { checked } = target;
|
|
26
|
+
this.areAllSelected = checked;
|
|
27
|
+
this.selected =
|
|
28
|
+
this.selectedValues.length > 0
|
|
29
|
+
?
|
|
30
|
+
Array.from(this.el.querySelectorAll('tbody td:first-child input')).map((input) => checked ? input === null || input === void 0 ? void 0 : input.value : checked)
|
|
31
|
+
: this.selected.map(() => checked);
|
|
32
|
+
this.onChange();
|
|
33
|
+
};
|
|
34
|
+
this.selectOne = (e, checkboxIdx) => {
|
|
35
|
+
const { target } = e;
|
|
36
|
+
if (!(target instanceof HTMLInputElement))
|
|
1090
37
|
return;
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
const
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
}
|
|
1140
|
-
this.el.style.setProperty('--column-widths', next);
|
|
1141
|
-
this.colCount = n;
|
|
1142
|
-
this.columnWidthsToken = next;
|
|
38
|
+
const { checked, value } = target;
|
|
39
|
+
this.areAllSelected = false;
|
|
40
|
+
this.selected = this.selected.map((v, selectedIdx) => {
|
|
41
|
+
if (selectedIdx !== checkboxIdx)
|
|
42
|
+
return v;
|
|
43
|
+
return this.selectedValues.length > 0 ? (checked ? value : checked) : checked;
|
|
44
|
+
});
|
|
45
|
+
this.onChange();
|
|
46
|
+
};
|
|
47
|
+
this.onChange = () => {
|
|
48
|
+
this.tableSelect.emit({
|
|
49
|
+
selected: this.selected,
|
|
50
|
+
areAllSelected: this.areAllSelected,
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
this.onScroll = () => {
|
|
54
|
+
this.hasScrolled = this.container.scrollLeft > 0;
|
|
55
|
+
};
|
|
56
|
+
this.sortBy = (col, sortTypeArray) => {
|
|
57
|
+
const handleSort = (a, b) => {
|
|
58
|
+
if (a[col].toLocaleLowerCase() < b[col].toLocaleLowerCase()) {
|
|
59
|
+
return -1;
|
|
60
|
+
}
|
|
61
|
+
if (a[col].toLocaleLowerCase() > b[col].toLocaleLowerCase()) {
|
|
62
|
+
return 1;
|
|
63
|
+
}
|
|
64
|
+
return 0;
|
|
65
|
+
};
|
|
66
|
+
switch (sortTypeArray[col]) {
|
|
67
|
+
case 'asc':
|
|
68
|
+
this.rowData.sort((a, b) => handleSort(a, b));
|
|
69
|
+
break;
|
|
70
|
+
case 'desc':
|
|
71
|
+
this.rowData.sort((a, b) => handleSort(b, a));
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
this.rowData = this.data;
|
|
75
|
+
this.sortTypeArray[col] = null;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
this.rowData = Array.from(this.rowData);
|
|
79
|
+
this.render();
|
|
80
|
+
};
|
|
81
|
+
this.setData = () => {
|
|
82
|
+
this.rowData = this.data !== undefined ? Array.from(this.data) : [];
|
|
83
|
+
};
|
|
84
|
+
this.setFooterData = () => {
|
|
85
|
+
this.rowFooterData = this.footer !== undefined ? Array.from(this.footer) : [];
|
|
86
|
+
};
|
|
1143
87
|
}
|
|
1144
|
-
handleSort(clickEvt, isColumnSortable, colNum) {
|
|
88
|
+
handleSort(clickEvt, isColumnSortable, colNum, colName) {
|
|
1145
89
|
clickEvt.preventDefault();
|
|
1146
90
|
clickEvt.stopPropagation();
|
|
1147
91
|
if (!isColumnSortable)
|
|
@@ -1158,57 +102,57 @@ export class Table {
|
|
|
1158
102
|
return 'asc';
|
|
1159
103
|
}
|
|
1160
104
|
});
|
|
1161
|
-
const evt = this.sortChanged.emit(
|
|
105
|
+
const evt = this.sortChanged.emit({
|
|
106
|
+
colNum,
|
|
107
|
+
colName,
|
|
108
|
+
sortTypeArr: this.sortTypeArray,
|
|
109
|
+
});
|
|
1162
110
|
if (!evt.defaultPrevented)
|
|
1163
111
|
this.sortBy(colNum, this.sortTypeArray);
|
|
1164
112
|
}
|
|
1165
|
-
|
|
113
|
+
watchData() {
|
|
114
|
+
this.setData();
|
|
115
|
+
}
|
|
116
|
+
watchFooterData() {
|
|
117
|
+
this.setFooterData();
|
|
118
|
+
}
|
|
119
|
+
watchColumns() {
|
|
120
|
+
this.sortTypeArray = this.columns ? this.columns.map(() => null) : [];
|
|
121
|
+
}
|
|
122
|
+
componentWillLoad() {
|
|
123
|
+
this.areAllSelected = false;
|
|
124
|
+
this.setData();
|
|
125
|
+
this.setFooterData();
|
|
126
|
+
this.selected = new Array(this.rowData.length).fill(false);
|
|
127
|
+
this.sortTypeArray = this.columns ? this.columns.map(() => null) : [];
|
|
128
|
+
}
|
|
129
|
+
render() {
|
|
1166
130
|
var _a;
|
|
1167
131
|
if (this.columns &&
|
|
1168
132
|
(!this.sortTypeArray || this.sortTypeArray.length !== this.columns.length)) {
|
|
1169
133
|
this.sortTypeArray = this.columns.map(() => null);
|
|
1170
134
|
}
|
|
1171
|
-
return (h(Host,
|
|
135
|
+
return (h(Host, { key: '10b0bfd08e28fada9a2c8509d405c5314cce1689' }, h("div", { key: '8e5b4fe928618b175a58f858f6cfd65f4bd29c53', class: "xpl-table-container", onScroll: this.onScroll, ref: (el) => {
|
|
1172
136
|
this.container = el;
|
|
1173
|
-
} }, h("table", { class: {
|
|
137
|
+
} }, h("table", { key: 'a6df646737b9a1d5e67cebe9eaad41911ab606ca', class: {
|
|
1174
138
|
'xpl-table': true,
|
|
1175
|
-
'xpl-table--legacy': true,
|
|
1176
139
|
'xpl-table--striped': this.striped,
|
|
1177
140
|
'xpl-table--freeze': this.freeze,
|
|
1178
141
|
'xpl-table--has-scrolled': this.hasScrolled,
|
|
1179
|
-
} }, this.columns && (h("thead",
|
|
1180
|
-
var _a
|
|
1181
|
-
const iconType = getIconType((
|
|
142
|
+
} }, this.columns && (h("thead", { key: '5f14766107d69f26b865f63c323d417f43260267' }, this.columns.map((column, i) => {
|
|
143
|
+
var _a;
|
|
144
|
+
const iconType = getIconType((_a = this.sortTypeArray) === null || _a === void 0 ? void 0 : _a[i]);
|
|
1182
145
|
const isColumnSortable = !!(this.isSortable && this.sortableColumns[i]);
|
|
1183
|
-
return (h("th", null, h("label", { onClick: (e) => this.handleSort(e, isColumnSortable, i), class: isColumnSortable ? 'cursor-pointer' : '' }, this.multiselect && i === 0 && (h("input", { checked: this.areAllSelected, id: "__xpl-table-th", indeterminate: !this.areAllSelected &&
|
|
146
|
+
return (h("th", null, h("label", { onClick: (e) => this.handleSort(e, isColumnSortable, i, column.replace(/ /g, '-').toLowerCase()), class: isColumnSortable ? 'cursor-pointer' : '' }, this.multiselect && i === 0 && (h("input", { checked: this.areAllSelected, id: "__xpl-table-th", indeterminate: !this.areAllSelected &&
|
|
1184
147
|
this.selected.some((a) => a), onClick: (e) => {
|
|
1185
148
|
e.stopPropagation();
|
|
1186
149
|
this.selectAll(e);
|
|
1187
150
|
}, type: "checkbox", value: `select-all-${this.selectAllValue}` })), column, isColumnSortable && !!this.sortTypeArray[i] && (h("xpl-icon", { icon: iconType, size: 16 })))));
|
|
1188
|
-
}))), h("tbody",
|
|
151
|
+
}))), h("tbody", { key: 'b13ca1d1a738de189d4f040dfd309187671b341d' }, this.rowData.map((row, rowNum) => (h("tr", { class: this.selected && this.selected[rowNum]
|
|
1189
152
|
? 'xpl-table-row-selected'
|
|
1190
153
|
: '' }, row.map((cell, i) => (h("td", null, this.multiselect && i === 0 ? (h("label", { htmlFor: `__xpl-table-row-${rowNum}` }, h("input", { id: `__xpl-table-row-${rowNum}`, checked: !!this.selected[rowNum], type: "checkbox", onChange: (e) => this.selectOne(e, rowNum), value: this.selectedValues.length > 0
|
|
1191
154
|
? this.selectedValues[rowNum]
|
|
1192
|
-
: `xpl-table-checkbox-${rowNum}` }), h("div", { innerHTML: cell }))) : (h("div", { innerHTML: cell }))))))))), ((_a = this.rowFooterData) === null || _a === void 0 ? void 0 : _a.length) > 0 && (h("tfoot",
|
|
1193
|
-
}
|
|
1194
|
-
renderCompositional() {
|
|
1195
|
-
const selectionToolbarCount = this.selectedRowIds.length;
|
|
1196
|
-
return (h(Host, { role: "grid", "aria-label": this.label, "aria-colcount": this.colCount > 0 ? this.colCount : undefined, class: {
|
|
1197
|
-
'xpl-table': true,
|
|
1198
|
-
'xpl-table--striped': this.striped,
|
|
1199
|
-
'xpl-table--freeze': this.freeze,
|
|
1200
|
-
'xpl-table--has-scrolled': this.hasScrolled,
|
|
1201
|
-
'xpl-table--selectable': !!this.selectable,
|
|
1202
|
-
'xpl-table--selection-active': !!this.selectable && this.selectedRowIds.length > 0,
|
|
1203
|
-
'xpl-table--row-reorderable': !!this.rowReorderable,
|
|
1204
|
-
}, onScroll: this.onGridScroll }, this.rowReorderable && (h("div", { class: "xpl-table__reorder-live", "aria-live": "assertive", "aria-atomic": "true" }, this.reorderLiveMessage)), this.selectable && (h("div", { class: {
|
|
1205
|
-
'xpl-toolbar': true,
|
|
1206
|
-
hidden: selectionToolbarCount === 0,
|
|
1207
|
-
'xpl-table__toolbar': true,
|
|
1208
|
-
} }, h("div", { class: "toolbar" }, h("p", { class: "selected-item-count" }, selectionToolbarCount, " Selected"), h("div", { class: "actions" }, h("slot", { name: "toolbar-actions-left" }), h("slot", { name: "toolbar-actions-right" }))))), h("slot", null)));
|
|
1209
|
-
}
|
|
1210
|
-
render() {
|
|
1211
|
-
return this.isLegacyMode ? this.renderLegacy() : this.renderCompositional();
|
|
155
|
+
: `xpl-table-checkbox-${rowNum}` }), h("div", { innerHTML: cell }))) : (h("div", { innerHTML: cell }))))))))), ((_a = this.rowFooterData) === null || _a === void 0 ? void 0 : _a.length) > 0 && (h("tfoot", { key: '5d45854ba21aa7e0bfaaf3b8a537e0c121538ac9' }, this.rowFooterData.map((row) => (h("tr", null, row.map((cell) => (h("td", null, h("div", { innerHTML: cell })))))))))))));
|
|
1212
156
|
}
|
|
1213
157
|
static get is() { return "xpl-table"; }
|
|
1214
158
|
static get properties() {
|
|
@@ -1224,11 +168,8 @@ export class Table {
|
|
|
1224
168
|
"required": false,
|
|
1225
169
|
"optional": true,
|
|
1226
170
|
"docs": {
|
|
1227
|
-
"tags": [
|
|
1228
|
-
|
|
1229
|
-
"text": "Legacy data-driven table API only (`columns` / `data` / `footer`). May be removed in a future major release.\n\nThe header values for each column."
|
|
1230
|
-
}],
|
|
1231
|
-
"text": ""
|
|
171
|
+
"tags": [],
|
|
172
|
+
"text": "The header values for each column."
|
|
1232
173
|
},
|
|
1233
174
|
"getter": false,
|
|
1234
175
|
"setter": false
|
|
@@ -1244,11 +185,8 @@ export class Table {
|
|
|
1244
185
|
"required": false,
|
|
1245
186
|
"optional": true,
|
|
1246
187
|
"docs": {
|
|
1247
|
-
"tags": [
|
|
1248
|
-
|
|
1249
|
-
"text": "Legacy data-driven table API only (`columns` / `data` / `footer`). May be removed in a future major release.\n\nThe data for the body of the table."
|
|
1250
|
-
}],
|
|
1251
|
-
"text": ""
|
|
188
|
+
"tags": [],
|
|
189
|
+
"text": "The data for the body of the table."
|
|
1252
190
|
},
|
|
1253
191
|
"getter": false,
|
|
1254
192
|
"setter": false
|
|
@@ -1264,11 +202,8 @@ export class Table {
|
|
|
1264
202
|
"required": false,
|
|
1265
203
|
"optional": true,
|
|
1266
204
|
"docs": {
|
|
1267
|
-
"tags": [
|
|
1268
|
-
|
|
1269
|
-
"text": "Legacy data-driven table API only (`columns` / `data` / `footer`). May be removed in a future major release.\n\nThe data for the footer of the table."
|
|
1270
|
-
}],
|
|
1271
|
-
"text": ""
|
|
205
|
+
"tags": [],
|
|
206
|
+
"text": "The data for the footer of the table."
|
|
1272
207
|
},
|
|
1273
208
|
"getter": false,
|
|
1274
209
|
"setter": false
|
|
@@ -1285,14 +220,14 @@ export class Table {
|
|
|
1285
220
|
"optional": true,
|
|
1286
221
|
"docs": {
|
|
1287
222
|
"tags": [],
|
|
1288
|
-
"text": "When true, the first
|
|
223
|
+
"text": "When true, the first column of the table is sticky and will cover the leftmost rows in a horizontally scrollable container."
|
|
1289
224
|
},
|
|
1290
225
|
"getter": false,
|
|
1291
226
|
"setter": false,
|
|
1292
227
|
"reflect": false,
|
|
1293
228
|
"attribute": "freeze"
|
|
1294
229
|
},
|
|
1295
|
-
"
|
|
230
|
+
"multiselect": {
|
|
1296
231
|
"type": "boolean",
|
|
1297
232
|
"mutable": false,
|
|
1298
233
|
"complexType": {
|
|
@@ -1302,39 +237,16 @@ export class Table {
|
|
|
1302
237
|
},
|
|
1303
238
|
"required": false,
|
|
1304
239
|
"optional": true,
|
|
1305
|
-
"docs": {
|
|
1306
|
-
"tags": [{
|
|
1307
|
-
"name": "deprecated",
|
|
1308
|
-
"text": "Legacy data-driven table API only. May be removed in a future major release.\n\nToggles to show the sort button on each table head."
|
|
1309
|
-
}],
|
|
1310
|
-
"text": ""
|
|
1311
|
-
},
|
|
1312
|
-
"getter": false,
|
|
1313
|
-
"setter": false,
|
|
1314
|
-
"reflect": false,
|
|
1315
|
-
"attribute": "is-sortable",
|
|
1316
|
-
"defaultValue": "false"
|
|
1317
|
-
},
|
|
1318
|
-
"label": {
|
|
1319
|
-
"type": "string",
|
|
1320
|
-
"mutable": false,
|
|
1321
|
-
"complexType": {
|
|
1322
|
-
"original": "string",
|
|
1323
|
-
"resolved": "string",
|
|
1324
|
-
"references": {}
|
|
1325
|
-
},
|
|
1326
|
-
"required": false,
|
|
1327
|
-
"optional": true,
|
|
1328
240
|
"docs": {
|
|
1329
241
|
"tags": [],
|
|
1330
|
-
"text": "
|
|
242
|
+
"text": "Toggles a selectable checkbox for each row in the table"
|
|
1331
243
|
},
|
|
1332
244
|
"getter": false,
|
|
1333
245
|
"setter": false,
|
|
1334
246
|
"reflect": false,
|
|
1335
|
-
"attribute": "
|
|
247
|
+
"attribute": "multiselect"
|
|
1336
248
|
},
|
|
1337
|
-
"
|
|
249
|
+
"striped": {
|
|
1338
250
|
"type": "boolean",
|
|
1339
251
|
"mutable": false,
|
|
1340
252
|
"complexType": {
|
|
@@ -1344,76 +256,34 @@ export class Table {
|
|
|
1344
256
|
},
|
|
1345
257
|
"required": false,
|
|
1346
258
|
"optional": true,
|
|
1347
|
-
"docs": {
|
|
1348
|
-
"tags": [{
|
|
1349
|
-
"name": "deprecated",
|
|
1350
|
-
"text": "Legacy data-driven table API only. May be removed in a future major release.\n\nToggles a selectable checkbox for each row in the table."
|
|
1351
|
-
}],
|
|
1352
|
-
"text": ""
|
|
1353
|
-
},
|
|
1354
|
-
"getter": false,
|
|
1355
|
-
"setter": false,
|
|
1356
|
-
"reflect": false,
|
|
1357
|
-
"attribute": "multiselect"
|
|
1358
|
-
},
|
|
1359
|
-
"reorderHandleIcon": {
|
|
1360
|
-
"type": "string",
|
|
1361
|
-
"mutable": false,
|
|
1362
|
-
"complexType": {
|
|
1363
|
-
"original": "string",
|
|
1364
|
-
"resolved": "string",
|
|
1365
|
-
"references": {}
|
|
1366
|
-
},
|
|
1367
|
-
"required": false,
|
|
1368
|
-
"optional": true,
|
|
1369
|
-
"docs": {
|
|
1370
|
-
"tags": [],
|
|
1371
|
-
"text": "Icon name for the optional `xpl-icon` inside each **managed** reorder grip when the row is **not** in\nkeyboard reorder mode (pointer / idle). Set to `\"\"` to omit the icon so you can style the button or author a\nfully custom reorder column in markup. When omitted, defaults to `grip-dots-vertical`."
|
|
1372
|
-
},
|
|
1373
|
-
"getter": false,
|
|
1374
|
-
"setter": false,
|
|
1375
|
-
"reflect": false,
|
|
1376
|
-
"attribute": "reorder-handle-icon"
|
|
1377
|
-
},
|
|
1378
|
-
"reorderHandleIconKeyboard": {
|
|
1379
|
-
"type": "string",
|
|
1380
|
-
"mutable": false,
|
|
1381
|
-
"complexType": {
|
|
1382
|
-
"original": "string",
|
|
1383
|
-
"resolved": "string",
|
|
1384
|
-
"references": {}
|
|
1385
|
-
},
|
|
1386
|
-
"required": false,
|
|
1387
|
-
"optional": true,
|
|
1388
259
|
"docs": {
|
|
1389
260
|
"tags": [],
|
|
1390
|
-
"text": "
|
|
261
|
+
"text": "Toggles an optional styling of the background of each even row of the table body."
|
|
1391
262
|
},
|
|
1392
263
|
"getter": false,
|
|
1393
264
|
"setter": false,
|
|
1394
265
|
"reflect": false,
|
|
1395
|
-
"attribute": "
|
|
266
|
+
"attribute": "striped"
|
|
1396
267
|
},
|
|
1397
|
-
"
|
|
1398
|
-
"type": "
|
|
268
|
+
"selectedValues": {
|
|
269
|
+
"type": "unknown",
|
|
1399
270
|
"mutable": false,
|
|
1400
271
|
"complexType": {
|
|
1401
|
-
"original": "
|
|
1402
|
-
"resolved": "
|
|
272
|
+
"original": "string[]",
|
|
273
|
+
"resolved": "string[]",
|
|
1403
274
|
"references": {}
|
|
1404
275
|
},
|
|
1405
276
|
"required": false,
|
|
1406
277
|
"optional": true,
|
|
1407
278
|
"docs": {
|
|
1408
279
|
"tags": [],
|
|
1409
|
-
"text": "
|
|
280
|
+
"text": "The values for the input for each row when multiselect is activated."
|
|
1410
281
|
},
|
|
1411
282
|
"getter": false,
|
|
1412
283
|
"setter": false,
|
|
1413
|
-
"
|
|
1414
|
-
"attribute": "row-reorderable"
|
|
284
|
+
"defaultValue": "[]"
|
|
1415
285
|
},
|
|
1416
|
-
"
|
|
286
|
+
"isSortable": {
|
|
1417
287
|
"type": "boolean",
|
|
1418
288
|
"mutable": false,
|
|
1419
289
|
"complexType": {
|
|
@@ -1425,33 +295,13 @@ export class Table {
|
|
|
1425
295
|
"optional": true,
|
|
1426
296
|
"docs": {
|
|
1427
297
|
"tags": [],
|
|
1428
|
-
"text": "
|
|
298
|
+
"text": "Toggles to show the sort button on each table head"
|
|
1429
299
|
},
|
|
1430
300
|
"getter": false,
|
|
1431
301
|
"setter": false,
|
|
1432
302
|
"reflect": false,
|
|
1433
|
-
"attribute": "
|
|
1434
|
-
|
|
1435
|
-
"selectedValues": {
|
|
1436
|
-
"type": "unknown",
|
|
1437
|
-
"mutable": false,
|
|
1438
|
-
"complexType": {
|
|
1439
|
-
"original": "string[]",
|
|
1440
|
-
"resolved": "string[]",
|
|
1441
|
-
"references": {}
|
|
1442
|
-
},
|
|
1443
|
-
"required": false,
|
|
1444
|
-
"optional": true,
|
|
1445
|
-
"docs": {
|
|
1446
|
-
"tags": [{
|
|
1447
|
-
"name": "deprecated",
|
|
1448
|
-
"text": "Legacy data-driven table API only. May be removed in a future major release.\n\nThe values for the input for each row when multiselect is activated."
|
|
1449
|
-
}],
|
|
1450
|
-
"text": ""
|
|
1451
|
-
},
|
|
1452
|
-
"getter": false,
|
|
1453
|
-
"setter": false,
|
|
1454
|
-
"defaultValue": "[]"
|
|
303
|
+
"attribute": "is-sortable",
|
|
304
|
+
"defaultValue": "false"
|
|
1455
305
|
},
|
|
1456
306
|
"sortableColumns": {
|
|
1457
307
|
"type": "unknown",
|
|
@@ -1463,87 +313,40 @@ export class Table {
|
|
|
1463
313
|
},
|
|
1464
314
|
"required": false,
|
|
1465
315
|
"optional": true,
|
|
1466
|
-
"docs": {
|
|
1467
|
-
"tags": [{
|
|
1468
|
-
"name": "deprecated",
|
|
1469
|
-
"text": "Use the compositional slot-based API instead. Will be removed in a future major release.\n\nManually determined if the column is sortable."
|
|
1470
|
-
}],
|
|
1471
|
-
"text": ""
|
|
1472
|
-
},
|
|
1473
|
-
"getter": false,
|
|
1474
|
-
"setter": false,
|
|
1475
|
-
"defaultValue": "[]"
|
|
1476
|
-
},
|
|
1477
|
-
"striped": {
|
|
1478
|
-
"type": "boolean",
|
|
1479
|
-
"mutable": false,
|
|
1480
|
-
"complexType": {
|
|
1481
|
-
"original": "boolean",
|
|
1482
|
-
"resolved": "boolean",
|
|
1483
|
-
"references": {}
|
|
1484
|
-
},
|
|
1485
|
-
"required": false,
|
|
1486
|
-
"optional": true,
|
|
1487
316
|
"docs": {
|
|
1488
317
|
"tags": [],
|
|
1489
|
-
"text": "
|
|
318
|
+
"text": "Manually determined if the column is sortable"
|
|
1490
319
|
},
|
|
1491
320
|
"getter": false,
|
|
1492
321
|
"setter": false,
|
|
1493
|
-
"
|
|
1494
|
-
"attribute": "striped"
|
|
322
|
+
"defaultValue": "[]"
|
|
1495
323
|
}
|
|
1496
324
|
};
|
|
1497
325
|
}
|
|
1498
326
|
static get states() {
|
|
1499
327
|
return {
|
|
1500
328
|
"areAllSelected": {},
|
|
1501
|
-
"colCount": {},
|
|
1502
|
-
"hasScrolled": {},
|
|
1503
|
-
"keyboardReorderRowId": {},
|
|
1504
|
-
"reorderLiveMessage": {},
|
|
1505
329
|
"rowData": {},
|
|
1506
330
|
"rowFooterData": {},
|
|
331
|
+
"hasScrolled": {},
|
|
1507
332
|
"selected": {},
|
|
1508
|
-
"selectedRowIds": {},
|
|
1509
333
|
"sortTypeArray": {}
|
|
1510
334
|
};
|
|
1511
335
|
}
|
|
1512
336
|
static get events() {
|
|
1513
337
|
return [{
|
|
1514
|
-
"method": "
|
|
1515
|
-
"name": "
|
|
1516
|
-
"bubbles":
|
|
1517
|
-
"cancelable": true,
|
|
1518
|
-
"composed": true,
|
|
1519
|
-
"docs": {
|
|
1520
|
-
"tags": [],
|
|
1521
|
-
"text": "Emitted after body rows are reordered via drag-and-drop (compositional `row-reorderable` mode)."
|
|
1522
|
-
},
|
|
1523
|
-
"complexType": {
|
|
1524
|
-
"original": "XplTableRowOrderChangeDetail",
|
|
1525
|
-
"resolved": "XplTableRowOrderChangeDetail",
|
|
1526
|
-
"references": {
|
|
1527
|
-
"XplTableRowOrderChangeDetail": {
|
|
1528
|
-
"location": "local",
|
|
1529
|
-
"path": "/home/runner/work/apollo/apollo/packages/apollo-core/src/components/components/xpl-table/xpl-table.tsx",
|
|
1530
|
-
"id": "src/components/components/xpl-table/xpl-table.tsx::XplTableRowOrderChangeDetail"
|
|
1531
|
-
}
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
}, {
|
|
1535
|
-
"method": "rowSelectionChange",
|
|
1536
|
-
"name": "rowSelectionChange",
|
|
1537
|
-
"bubbles": false,
|
|
338
|
+
"method": "tableSelect",
|
|
339
|
+
"name": "tableSelect",
|
|
340
|
+
"bubbles": true,
|
|
1538
341
|
"cancelable": true,
|
|
1539
342
|
"composed": true,
|
|
1540
343
|
"docs": {
|
|
1541
344
|
"tags": [],
|
|
1542
|
-
"text": "
|
|
345
|
+
"text": "Callback function that is called when the checkbox for a row of a\n`multiselect` table is checked"
|
|
1543
346
|
},
|
|
1544
347
|
"complexType": {
|
|
1545
|
-
"original": "
|
|
1546
|
-
"resolved": "
|
|
348
|
+
"original": "any",
|
|
349
|
+
"resolved": "any",
|
|
1547
350
|
"references": {}
|
|
1548
351
|
}
|
|
1549
352
|
}, {
|
|
@@ -1554,32 +357,11 @@ export class Table {
|
|
|
1554
357
|
"composed": true,
|
|
1555
358
|
"docs": {
|
|
1556
359
|
"tags": [],
|
|
1557
|
-
"text": "
|
|
1558
|
-
},
|
|
1559
|
-
"complexType": {
|
|
1560
|
-
"original": "XplTableSortChangedDetail",
|
|
1561
|
-
"resolved": "XplTableSortChangedDetail",
|
|
1562
|
-
"references": {
|
|
1563
|
-
"XplTableSortChangedDetail": {
|
|
1564
|
-
"location": "local",
|
|
1565
|
-
"path": "/home/runner/work/apollo/apollo/packages/apollo-core/src/components/components/xpl-table/xpl-table.tsx",
|
|
1566
|
-
"id": "src/components/components/xpl-table/xpl-table.tsx::XplTableSortChangedDetail"
|
|
1567
|
-
}
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
}, {
|
|
1571
|
-
"method": "tableSelect",
|
|
1572
|
-
"name": "tableSelect",
|
|
1573
|
-
"bubbles": true,
|
|
1574
|
-
"cancelable": true,
|
|
1575
|
-
"composed": true,
|
|
1576
|
-
"docs": {
|
|
1577
|
-
"tags": [],
|
|
1578
|
-
"text": "Callback function that is called when the checkbox for a row of a\n`multiselect` table is checked."
|
|
360
|
+
"text": "Emits an event whenever the sort changes.\nThe 'sortChanged' event passes an object with colNum (number), colName (string), sortTypeArr(string[]).\nThe default action can be overridden by calling event.preventDefault()."
|
|
1579
361
|
},
|
|
1580
362
|
"complexType": {
|
|
1581
|
-
"original": "
|
|
1582
|
-
"resolved": "
|
|
363
|
+
"original": "{\n colNum: number;\n colName: string;\n sortTypeArr: string[];\n }",
|
|
364
|
+
"resolved": "{ colNum: number; colName: string; sortTypeArr: string[]; }",
|
|
1583
365
|
"references": {}
|
|
1584
366
|
}
|
|
1585
367
|
}];
|
|
@@ -1587,101 +369,14 @@ export class Table {
|
|
|
1587
369
|
static get elementRef() { return "el"; }
|
|
1588
370
|
static get watchers() {
|
|
1589
371
|
return [{
|
|
1590
|
-
"propName": "columns",
|
|
1591
|
-
"methodName": "watchColumns"
|
|
1592
|
-
}, {
|
|
1593
372
|
"propName": "data",
|
|
1594
373
|
"methodName": "watchData"
|
|
1595
374
|
}, {
|
|
1596
375
|
"propName": "footer",
|
|
1597
376
|
"methodName": "watchFooterData"
|
|
1598
377
|
}, {
|
|
1599
|
-
"propName": "
|
|
1600
|
-
"methodName": "
|
|
1601
|
-
}, {
|
|
1602
|
-
"propName": "reorderHandleIconKeyboard",
|
|
1603
|
-
"methodName": "watchReorderHandleIconKeyboard"
|
|
1604
|
-
}, {
|
|
1605
|
-
"propName": "rowReorderable",
|
|
1606
|
-
"methodName": "watchRowReorderable"
|
|
1607
|
-
}, {
|
|
1608
|
-
"propName": "selectable",
|
|
1609
|
-
"methodName": "watchSelectable"
|
|
1610
|
-
}];
|
|
1611
|
-
}
|
|
1612
|
-
static get listeners() {
|
|
1613
|
-
return [{
|
|
1614
|
-
"name": "xplTableColumnWidthsChange",
|
|
1615
|
-
"method": "handleHeaderCellColumnWidthsChange",
|
|
1616
|
-
"target": undefined,
|
|
1617
|
-
"capture": false,
|
|
1618
|
-
"passive": false
|
|
1619
|
-
}, {
|
|
1620
|
-
"name": "checkboxChange",
|
|
1621
|
-
"method": "handleCompositionalCheckboxChange",
|
|
1622
|
-
"target": undefined,
|
|
1623
|
-
"capture": false,
|
|
1624
|
-
"passive": false
|
|
1625
|
-
}, {
|
|
1626
|
-
"name": "headerCheckboxChange",
|
|
1627
|
-
"method": "handleCompositionalHeaderCheckboxChange",
|
|
1628
|
-
"target": undefined,
|
|
1629
|
-
"capture": false,
|
|
1630
|
-
"passive": false
|
|
1631
|
-
}, {
|
|
1632
|
-
"name": "pointerdown",
|
|
1633
|
-
"method": "handlePointerDownExitKeyboardReorder",
|
|
1634
|
-
"target": undefined,
|
|
1635
|
-
"capture": true,
|
|
1636
|
-
"passive": true
|
|
1637
|
-
}, {
|
|
1638
|
-
"name": "pointerdown",
|
|
1639
|
-
"method": "handleRowReorderPointerDown",
|
|
1640
|
-
"target": undefined,
|
|
1641
|
-
"capture": true,
|
|
1642
|
-
"passive": true
|
|
1643
|
-
}, {
|
|
1644
|
-
"name": "dragstart",
|
|
1645
|
-
"method": "handleRowReorderDragStart",
|
|
1646
|
-
"target": undefined,
|
|
1647
|
-
"capture": true,
|
|
1648
|
-
"passive": true
|
|
1649
|
-
}, {
|
|
1650
|
-
"name": "dragend",
|
|
1651
|
-
"method": "handleRowReorderDragEnd",
|
|
1652
|
-
"target": undefined,
|
|
1653
|
-
"capture": true,
|
|
1654
|
-
"passive": true
|
|
1655
|
-
}, {
|
|
1656
|
-
"name": "dragover",
|
|
1657
|
-
"method": "handleRowReorderDragOver",
|
|
1658
|
-
"target": undefined,
|
|
1659
|
-
"capture": true,
|
|
1660
|
-
"passive": false
|
|
1661
|
-
}, {
|
|
1662
|
-
"name": "dragenter",
|
|
1663
|
-
"method": "handleRowReorderDragEnter",
|
|
1664
|
-
"target": undefined,
|
|
1665
|
-
"capture": true,
|
|
1666
|
-
"passive": false
|
|
1667
|
-
}, {
|
|
1668
|
-
"name": "dragleave",
|
|
1669
|
-
"method": "handleRowReorderDragLeave",
|
|
1670
|
-
"target": undefined,
|
|
1671
|
-
"capture": true,
|
|
1672
|
-
"passive": true
|
|
1673
|
-
}, {
|
|
1674
|
-
"name": "drop",
|
|
1675
|
-
"method": "handleRowReorderDrop",
|
|
1676
|
-
"target": undefined,
|
|
1677
|
-
"capture": true,
|
|
1678
|
-
"passive": false
|
|
1679
|
-
}, {
|
|
1680
|
-
"name": "headerSortChange",
|
|
1681
|
-
"method": "handleCompositionalHeaderSort",
|
|
1682
|
-
"target": undefined,
|
|
1683
|
-
"capture": false,
|
|
1684
|
-
"passive": false
|
|
378
|
+
"propName": "columns",
|
|
379
|
+
"methodName": "watchColumns"
|
|
1685
380
|
}];
|
|
1686
381
|
}
|
|
1687
382
|
}
|