@xplortech/apollo-core 3.1.0 → 3.2.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 +120 -14
- package/build/components/avatar.css +1 -1
- package/build/components/data-card.css +1 -1
- package/build/components/dropdown.css +1 -1
- package/build/components/input-time.css +1 -1
- package/build/components/large-card.css +1 -1
- package/build/components/list-item.css +1 -1
- package/build/components/modal.css +1 -1
- package/build/components/popover.css +1 -1
- package/build/components/side-nav.css +1 -1
- package/build/components/spotlight.css +1 -1
- package/build/components/table-cell-base.css +1 -0
- package/build/components/table-cell.css +1 -0
- package/build/components/table-footer-cell.css +1 -1
- package/build/components/table-header-cell.css +1 -1
- package/build/components/table.css +1 -1
- package/build/components/tag.css +1 -1
- package/build/components/toast.css +1 -1
- package/build/components/toggle.css +1 -1
- package/build/components/toolbar.css +1 -1
- package/build/components/tooltip.css +1 -1
- package/build/components/top-nav.css +1 -1
- package/build/components-manifest.json +19 -3
- package/build/core.css +1 -1
- package/build/style.css +1 -1
- package/build/variables/apollo.css +4 -0
- package/build/variables/field-edge.css +4 -0
- package/build/vendor/flatpickr.css +1 -1
- package/dist/apollo-core/apollo-core.css +1 -1
- package/dist/apollo-core/apollo-core.esm.js +1 -1
- package/dist/apollo-core/p-045a4538.entry.js +1 -0
- package/dist/apollo-core/{p-d443291f.entry.js → p-050a8bf2.entry.js} +1 -1
- package/dist/apollo-core/p-08767607.entry.js +1 -0
- package/dist/apollo-core/{p-149ddd12.entry.js → p-11914cd4.entry.js} +1 -1
- package/dist/apollo-core/{p-581b702c.entry.js → p-14e86de8.entry.js} +1 -1
- package/dist/apollo-core/p-194c0ccd.entry.js +1 -0
- package/dist/apollo-core/p-1c031055.entry.js +1 -0
- package/dist/apollo-core/p-24f7280a.entry.js +1 -0
- package/dist/apollo-core/{p-47bda204.entry.js → p-24fa8a03.entry.js} +1 -1
- package/dist/apollo-core/{p-91895c40.entry.js → p-2971e2ec.entry.js} +1 -1
- package/dist/apollo-core/{p-0958c719.entry.js → p-3417c1ce.entry.js} +1 -1
- package/dist/apollo-core/p-3713cd77.entry.js +1 -0
- package/dist/apollo-core/p-386851a2.entry.js +1 -0
- package/dist/apollo-core/p-3cd1238b.entry.js +1 -0
- package/dist/apollo-core/p-45c872d2.entry.js +1 -0
- package/dist/apollo-core/{p-b45179fb.entry.js → p-49531864.entry.js} +1 -1
- package/dist/apollo-core/p-4e3c6616.entry.js +1 -0
- package/dist/apollo-core/p-5b9fd96e.entry.js +1 -0
- package/dist/apollo-core/p-5c3be343.entry.js +1 -0
- package/dist/apollo-core/p-5cbf5d42.entry.js +1 -0
- package/dist/apollo-core/p-5ec2b180.entry.js +1 -0
- package/dist/apollo-core/{p-790709c0.entry.js → p-64f5c129.entry.js} +1 -1
- package/dist/apollo-core/{p-28bce81a.entry.js → p-65f6b66c.entry.js} +1 -1
- package/dist/apollo-core/{p-d9070ae5.entry.js → p-715baae0.entry.js} +1 -1
- package/dist/apollo-core/p-72e0455f.entry.js +1 -0
- package/dist/apollo-core/p-7ac7fbc0.entry.js +1 -0
- package/dist/apollo-core/p-7d70e089.entry.js +1 -0
- package/dist/apollo-core/{p-d41b8f46.entry.js → p-7eb02cf3.entry.js} +1 -1
- package/dist/apollo-core/p-7f4463ff.entry.js +1 -0
- package/dist/apollo-core/p-808f3d9c.entry.js +1 -0
- package/dist/apollo-core/p-87582346.entry.js +1 -0
- package/dist/apollo-core/{p-2c995d80.entry.js → p-8f8f4759.entry.js} +1 -1
- package/dist/apollo-core/{p-5d9a593e.entry.js → p-907bc21e.entry.js} +1 -1
- package/dist/apollo-core/p-9905c77c.entry.js +1 -0
- package/dist/apollo-core/{p-54903322.entry.js → p-9d731673.entry.js} +1 -1
- package/dist/apollo-core/{p-2938ab4f.entry.js → p-9feaa8be.entry.js} +1 -1
- package/dist/apollo-core/p-O7gQjVdS.js +1 -0
- package/dist/apollo-core/p-a6ecca68.entry.js +1 -0
- package/dist/apollo-core/p-a789c272.entry.js +1 -0
- package/dist/apollo-core/{p-06a9a27b.entry.js → p-aeb2bcb8.entry.js} +1 -1
- package/dist/apollo-core/p-b3b4678b.entry.js +1 -0
- package/dist/apollo-core/{p-82812126.entry.js → p-b64ed46d.entry.js} +1 -1
- package/dist/apollo-core/{p-0368a1df.entry.js → p-bc821e69.entry.js} +1 -1
- package/dist/apollo-core/p-bd493c4a.entry.js +1 -0
- package/dist/apollo-core/p-bdcece21.entry.js +1 -0
- package/dist/apollo-core/{p-cdb5b5c4.entry.js → p-bfb7a83a.entry.js} +1 -1
- package/dist/apollo-core/{p-cdacfcd4.entry.js → p-c22f70f4.entry.js} +1 -1
- package/dist/apollo-core/{p-5730d96c.entry.js → p-c5bc3b2c.entry.js} +1 -1
- package/dist/apollo-core/{p-4ad79534.entry.js → p-ca83003e.entry.js} +1 -1
- package/dist/apollo-core/p-d3230277.entry.js +1 -0
- package/dist/apollo-core/p-d3ada7d0.entry.js +1 -0
- package/dist/apollo-core/{p-d0bc7c45.entry.js → p-d469bf5d.entry.js} +1 -1
- package/dist/apollo-core/p-d7f8ee34.entry.js +1 -0
- package/dist/apollo-core/p-d879c349.entry.js +1 -0
- package/dist/apollo-core/{p-2139f9f6.entry.js → p-df257cbf.entry.js} +1 -1
- package/dist/apollo-core/p-e09d8beb.entry.js +1 -0
- package/dist/apollo-core/p-e4d50301.entry.js +1 -0
- package/dist/apollo-core/{p-f3a2c79b.entry.js → p-ea9cdd65.entry.js} +1 -1
- package/dist/apollo-core/{p-ca4652b3.entry.js → p-eba654a3.entry.js} +1 -1
- package/dist/apollo-core/{p-4a2323b3.entry.js → p-ee68bed6.entry.js} +1 -1
- package/dist/apollo-core/{p-abdf199b.entry.js → p-f384a990.entry.js} +1 -1
- package/dist/apollo-core/{p-4d4acd1f.entry.js → p-f579e4b0.entry.js} +1 -1
- package/dist/apollo-core/{p-d724c419.entry.js → p-fcb17ff9.entry.js} +1 -1
- package/dist/apollo-core/{p-e2890eb1.entry.js → p-ff16f574.entry.js} +1 -1
- package/dist/cjs/apollo-core.cjs.js +1 -1
- package/dist/cjs/index-3cBvw409.js +8 -12
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/table-internal-DssCrBs_.js +67 -0
- 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_3.cjs.entry.js +4 -4
- package/dist/cjs/xpl-backdrop.cjs.entry.js +1 -1
- package/dist/cjs/xpl-badge.cjs.entry.js +1 -1
- package/dist/cjs/xpl-banner.cjs.entry.js +2 -2
- package/dist/cjs/xpl-breadcrumb-item.cjs.entry.js +1 -1
- package/dist/cjs/xpl-breadcrumbs.cjs.entry.js +1 -1
- package/dist/cjs/xpl-button-row.cjs.entry.js +1 -1
- package/dist/cjs/xpl-button.cjs.entry.js +1 -1
- package/dist/cjs/xpl-calendar.cjs.entry.js +1 -1
- package/dist/cjs/xpl-checkbox.cjs.entry.js +3 -3
- package/dist/cjs/xpl-choicelist.cjs.entry.js +1 -1
- package/dist/cjs/xpl-content-area.cjs.entry.js +1 -1
- package/dist/cjs/xpl-dashboard.cjs.entry.js +1 -1
- package/dist/cjs/xpl-data-card.cjs.entry.js +2 -2
- package/dist/cjs/xpl-dropdown_4.cjs.entry.js +8 -8
- 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 +2 -2
- 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-header-accordion.cjs.entry.js +1 -1
- package/dist/cjs/xpl-icon.cjs.entry.js +2 -2
- package/dist/cjs/xpl-input-color.cjs.entry.js +8 -8
- package/dist/cjs/xpl-input-phone.cjs.entry.js +5 -5
- package/dist/cjs/xpl-input-time.cjs.entry.js +2 -2
- package/dist/cjs/xpl-input_4.cjs.entry.js +10 -10
- package/dist/cjs/xpl-large-card.cjs.entry.js +1 -1
- package/dist/cjs/xpl-list.cjs.entry.js +2 -2
- package/dist/cjs/xpl-main-nav.cjs.entry.js +1 -1
- package/dist/cjs/xpl-modal.cjs.entry.js +1 -1
- package/dist/cjs/xpl-nav-header-menu.cjs.entry.js +2 -2
- package/dist/cjs/xpl-nav-item.cjs.entry.js +2 -2
- package/dist/cjs/xpl-pagination.cjs.entry.js +4 -4
- package/dist/cjs/xpl-panel.cjs.entry.js +2 -2
- package/dist/cjs/xpl-popover.cjs.entry.js +4 -4
- package/dist/cjs/xpl-progress-bar.cjs.entry.js +2 -2
- package/dist/cjs/xpl-progress-indicator.cjs.entry.js +1 -1
- package/dist/cjs/xpl-secondary-nav.cjs.entry.js +1 -1
- package/dist/cjs/xpl-select_2.cjs.entry.js +9 -9
- package/dist/cjs/xpl-side-nav-header-item.cjs.entry.js +2 -2
- package/dist/cjs/xpl-side-nav-item.cjs.entry.js +2 -2
- package/dist/cjs/xpl-side-nav-section.cjs.entry.js +5 -5
- package/dist/cjs/xpl-side-nav.cjs.entry.js +2 -2
- package/dist/cjs/xpl-skeleton.cjs.entry.js +1 -1
- package/dist/cjs/xpl-slideout.cjs.entry.js +1 -1
- package/dist/cjs/xpl-tab-panel.cjs.entry.js +2 -2
- package/dist/cjs/xpl-table-body.cjs.entry.js +1 -1
- package/dist/cjs/xpl-table-cell_3.cjs.entry.js +228 -0
- package/dist/cjs/xpl-table-footer.cjs.entry.js +1 -1
- package/dist/cjs/xpl-table-header.cjs.entry.js +1 -1
- package/dist/cjs/xpl-table-row.cjs.entry.js +43 -2
- package/dist/cjs/xpl-table.cjs.entry.js +1204 -80
- package/dist/cjs/xpl-tabs.cjs.entry.js +5 -5
- package/dist/cjs/xpl-toast.cjs.entry.js +2 -2
- package/dist/cjs/xpl-toggle.cjs.entry.js +3 -3
- package/dist/cjs/xpl-toolbar.cjs.entry.js +2 -2
- package/dist/cjs/xpl-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/xpl-top-nav-item.cjs.entry.js +2 -2
- package/dist/cjs/xpl-top-nav-menu.cjs.entry.js +2 -2
- package/dist/cjs/xpl-top-nav.cjs.entry.js +5 -5
- package/dist/cjs/xpl-utility-bar.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -1
- 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 +3 -3
- 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 +4 -4
- package/dist/collection/components/xpl-dynamic-table/xpl-dynamic-table.js +2 -2
- 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 +1 -1
- 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/xpl-pagination.js +4 -4
- 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 +7 -7
- package/dist/collection/components/xpl-side-nav/xpl-side-nav-header-item/xpl-side-nav-header-item.js +2 -2
- 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-section/xpl-side-nav-section.js +5 -5
- 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/utils/move-row-dom.js +50 -0
- package/dist/collection/components/xpl-table/utils/table-internal.js +57 -0
- package/dist/collection/components/xpl-table/xpl-table-body/xpl-table-body.js +1 -1
- package/dist/collection/components/xpl-table/xpl-table-cell/xpl-table-cell.js +167 -0
- package/dist/collection/components/xpl-table/xpl-table-footer/xpl-table-footer.js +1 -1
- package/dist/collection/components/xpl-table/xpl-table-footer-cell/xpl-table-footer-cell.js +2 -2
- package/dist/collection/components/xpl-table/xpl-table-header-cell/xpl-table-header-cell.js +402 -0
- package/dist/collection/components/xpl-table/xpl-table-row/xpl-table-row.js +44 -2
- package/dist/collection/components/xpl-table/xpl-table.js +1427 -116
- package/dist/collection/components/xpl-table-header/xpl-table-header.js +1 -1
- 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-menu/xpl-top-nav-menu.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.d.ts +3 -1
- package/dist/components/index.js +1 -1
- package/dist/components/{p-oIn1krdu.js → p-1D7CWIJ-.js} +1 -1
- package/dist/components/{p-xtOHikY0.js → p-2cJsJK3-.js} +1 -1
- package/dist/components/{p-DYmvElhR.js → p-8zrW9vEC.js} +1 -1
- package/dist/components/p-B56GeUtW.js +1 -0
- package/dist/components/p-B6YLKDUX.js +1 -0
- package/dist/components/{p-D--kzomA.js → p-B7aaJikj.js} +1 -1
- package/dist/components/{p-U0JYwf4c.js → p-BOm_p_mz.js} +1 -1
- package/dist/components/p-BZIZSovL.js +1 -0
- package/dist/components/{p-xFsB212F.js → p-Btb2UkLz.js} +1 -1
- package/dist/components/{p-DAb-txW3.js → p-C0AbGd4t.js} +1 -1
- package/dist/components/p-CFXvQqUO.js +1 -0
- package/dist/components/{p-l3EZ-agL.js → p-CQjJIHK6.js} +1 -1
- package/dist/components/{p-Chpgh5SL.js → p-CV5nn1zR.js} +1 -1
- package/dist/components/p-CdRmVtIN.js +1 -0
- package/dist/components/p-CgemLtmL.js +1 -0
- package/dist/components/p-CmbpWpb0.js +1 -0
- package/dist/components/p-CuVYRPvz.js +1 -0
- package/dist/components/{p-JyNpXfDe.js → p-D09sGbzs.js} +1 -1
- package/dist/components/{p-BdpZR4KO.js → p-DTh_zemx.js} +1 -1
- package/dist/components/{p-CiHTfk3E.js → p-DoVubWyd.js} +1 -1
- package/dist/components/p-Dp62sBqX.js +1 -0
- package/dist/components/p-DqgnC_vS.js +1 -0
- package/dist/components/p-DtV4i45B.js +1 -0
- package/dist/components/{p-wIU7KUhA.js → p-ohy3NrgH.js} +1 -1
- package/dist/components/p-rLxtqgsy.js +1 -0
- package/dist/components/xpl-accordion.js +1 -1
- package/dist/components/xpl-application-shell.js +1 -1
- package/dist/components/xpl-avatar.js +1 -1
- package/dist/components/xpl-backdrop.js +1 -1
- package/dist/components/xpl-badge.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-button.js +1 -1
- package/dist/components/xpl-calendar.js +1 -1
- package/dist/components/xpl-checkbox.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-divider.js +1 -1
- package/dist/components/xpl-dropdown-group.js +1 -1
- package/dist/components/xpl-dropdown-heading.js +1 -1
- package/dist/components/xpl-dropdown-option.js +1 -1
- package/dist/components/xpl-dropdown.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-icon.js +1 -1
- package/dist/components/xpl-input-color.js +1 -1
- package/dist/components/xpl-input-date.js +1 -1
- package/dist/components/xpl-input-file.js +1 -1
- package/dist/components/xpl-input-phone.js +1 -1
- package/dist/components/xpl-input-search.js +1 -1
- package/dist/components/xpl-input-time.js +1 -1
- package/dist/components/xpl-input.js +1 -1
- package/dist/components/xpl-large-card.js +1 -1
- package/dist/components/xpl-list-item.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-popover.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-radio.js +1 -1
- package/dist/components/xpl-secondary-nav.js +1 -1
- package/dist/components/xpl-select.js +1 -1
- package/dist/components/xpl-side-nav-header-item.js +1 -1
- package/dist/components/xpl-side-nav-item.js +1 -1
- package/dist/components/xpl-side-nav-section.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-spotlight.js +1 -1
- package/dist/components/xpl-tab-panel.js +1 -1
- package/dist/components/xpl-tab.js +1 -1
- package/dist/components/xpl-table-body.js +1 -1
- package/dist/components/xpl-table-cell.d.ts +11 -0
- package/dist/components/xpl-table-cell.js +1 -0
- package/dist/components/xpl-table-footer-cell.js +1 -1
- package/dist/components/xpl-table-footer.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-row.js +1 -1
- package/dist/components/xpl-table.js +1 -1
- package/dist/components/xpl-tabs.js +1 -1
- package/dist/components/xpl-tag.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-tooltip.js +1 -1
- package/dist/components/xpl-top-nav-item.js +1 -1
- package/dist/components/xpl-top-nav-menu.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-avatar/readme.md +1 -1
- package/dist/docs/xpl-checkbox/readme.md +1 -3
- package/dist/docs/xpl-data-card/readme.md +1 -1
- package/dist/docs/xpl-dynamic-table/readme.md +4 -1
- package/dist/docs/xpl-dynamic-table-cell/readme.md +2 -0
- package/dist/docs/xpl-dynamic-table-row/readme.md +2 -0
- package/dist/docs/xpl-icon/readme.md +1 -1
- package/dist/docs/xpl-input/xpl-input-time/readme.md +1 -1
- package/dist/docs/xpl-large-card/readme.md +1 -1
- package/dist/docs/xpl-modal/readme.md +2 -2
- package/dist/docs/xpl-popover/readme.md +1 -2
- package/dist/docs/xpl-slideout/readme.md +1 -1
- package/dist/docs/xpl-spotlight/readme.md +1 -0
- package/dist/docs/xpl-table/readme.md +178 -20
- package/dist/docs/xpl-table/xpl-table-body/readme.md +4 -4
- package/dist/docs/xpl-table/xpl-table-cell/readme.md +53 -0
- package/dist/docs/xpl-table/xpl-table-footer/readme.md +4 -4
- package/dist/docs/xpl-table/xpl-table-footer-cell/readme.md +24 -15
- package/dist/docs/xpl-table/xpl-table-header-cell/readme.md +84 -0
- package/dist/docs/xpl-table/xpl-table-row/readme.md +18 -14
- package/dist/docs/xpl-toast/readme.md +2 -2
- package/dist/docs/xpl-toggle/readme.md +1 -1
- package/dist/docs/xpl-toolbar/readme.md +5 -3
- package/dist/docs/xpl-tooltip/readme.md +1 -2
- package/dist/docs.json +776 -113
- package/dist/esm/apollo-core.js +1 -1
- package/dist/esm/index-ukZKsqqq.js +8 -12
- package/dist/esm/loader.js +1 -1
- package/dist/esm/table-internal-O7gQjVdS.js +59 -0
- package/dist/esm/xpl-accordion.entry.js +2 -2
- package/dist/esm/xpl-application-shell.entry.js +1 -1
- package/dist/esm/xpl-avatar_3.entry.js +4 -4
- package/dist/esm/xpl-backdrop.entry.js +1 -1
- package/dist/esm/xpl-badge.entry.js +1 -1
- package/dist/esm/xpl-banner.entry.js +2 -2
- package/dist/esm/xpl-breadcrumb-item.entry.js +1 -1
- package/dist/esm/xpl-breadcrumbs.entry.js +1 -1
- package/dist/esm/xpl-button-row.entry.js +1 -1
- package/dist/esm/xpl-button.entry.js +1 -1
- package/dist/esm/xpl-calendar.entry.js +1 -1
- package/dist/esm/xpl-checkbox.entry.js +3 -3
- package/dist/esm/xpl-choicelist.entry.js +1 -1
- package/dist/esm/xpl-content-area.entry.js +1 -1
- package/dist/esm/xpl-dashboard.entry.js +1 -1
- package/dist/esm/xpl-data-card.entry.js +2 -2
- package/dist/esm/xpl-dropdown_4.entry.js +8 -8
- 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 +2 -2
- package/dist/esm/xpl-grid-item.entry.js +1 -1
- package/dist/esm/xpl-grid.entry.js +1 -1
- package/dist/esm/xpl-header-accordion.entry.js +1 -1
- package/dist/esm/xpl-icon.entry.js +2 -2
- package/dist/esm/xpl-input-color.entry.js +8 -8
- package/dist/esm/xpl-input-phone.entry.js +5 -5
- package/dist/esm/xpl-input-time.entry.js +2 -2
- package/dist/esm/xpl-input_4.entry.js +10 -10
- package/dist/esm/xpl-large-card.entry.js +1 -1
- package/dist/esm/xpl-list.entry.js +2 -2
- package/dist/esm/xpl-main-nav.entry.js +1 -1
- package/dist/esm/xpl-modal.entry.js +1 -1
- package/dist/esm/xpl-nav-header-menu.entry.js +2 -2
- package/dist/esm/xpl-nav-item.entry.js +2 -2
- package/dist/esm/xpl-pagination.entry.js +4 -4
- package/dist/esm/xpl-panel.entry.js +2 -2
- package/dist/esm/xpl-popover.entry.js +4 -4
- package/dist/esm/xpl-progress-bar.entry.js +2 -2
- package/dist/esm/xpl-progress-indicator.entry.js +1 -1
- package/dist/esm/xpl-secondary-nav.entry.js +1 -1
- package/dist/esm/xpl-select_2.entry.js +9 -9
- package/dist/esm/xpl-side-nav-header-item.entry.js +2 -2
- package/dist/esm/xpl-side-nav-item.entry.js +2 -2
- package/dist/esm/xpl-side-nav-section.entry.js +5 -5
- package/dist/esm/xpl-side-nav.entry.js +2 -2
- package/dist/esm/xpl-skeleton.entry.js +1 -1
- package/dist/esm/xpl-slideout.entry.js +1 -1
- package/dist/esm/xpl-tab-panel.entry.js +2 -2
- package/dist/esm/xpl-table-body.entry.js +1 -1
- package/dist/esm/xpl-table-cell_3.entry.js +224 -0
- package/dist/esm/xpl-table-footer.entry.js +1 -1
- package/dist/esm/xpl-table-header.entry.js +1 -1
- package/dist/esm/xpl-table-row.entry.js +44 -3
- package/dist/esm/xpl-table.entry.js +1204 -80
- package/dist/esm/xpl-tabs.entry.js +5 -5
- package/dist/esm/xpl-toast.entry.js +2 -2
- package/dist/esm/xpl-toggle.entry.js +3 -3
- package/dist/esm/xpl-toolbar.entry.js +2 -2
- package/dist/esm/xpl-tooltip.entry.js +1 -1
- package/dist/esm/xpl-top-nav-item.entry.js +2 -2
- package/dist/esm/xpl-top-nav-menu.entry.js +2 -2
- package/dist/esm/xpl-top-nav.entry.js +5 -5
- package/dist/esm/xpl-utility-bar.entry.js +1 -1
- package/dist/types/components/xpl-table/utils/move-row-dom.d.ts +3 -0
- package/dist/types/components/xpl-table/utils/table-internal.d.ts +8 -0
- package/dist/types/components/xpl-table/xpl-table-cell/xpl-table-cell.d.ts +11 -0
- package/dist/types/components/xpl-table/xpl-table-header-cell/xpl-table-header-cell.d.ts +33 -0
- package/dist/types/components/xpl-table/xpl-table-row/xpl-table-row.d.ts +7 -0
- package/dist/types/components/xpl-table/xpl-table.d.ts +126 -22
- package/dist/types/components.d.ts +238 -60
- package/hydrate/index.js +1670 -266
- package/hydrate/index.mjs +1670 -266
- package/package.json +7 -7
- package/dist/apollo-core/p-056a99e4.entry.js +0 -1
- package/dist/apollo-core/p-068e3532.entry.js +0 -1
- package/dist/apollo-core/p-0a0a6e43.entry.js +0 -1
- package/dist/apollo-core/p-1a94c2d9.entry.js +0 -1
- package/dist/apollo-core/p-2faa7b9c.entry.js +0 -1
- package/dist/apollo-core/p-30b1b700.entry.js +0 -1
- package/dist/apollo-core/p-32084caf.entry.js +0 -1
- package/dist/apollo-core/p-38586952.entry.js +0 -1
- package/dist/apollo-core/p-50fae269.entry.js +0 -1
- package/dist/apollo-core/p-60cb3cfb.entry.js +0 -1
- package/dist/apollo-core/p-722b145a.entry.js +0 -1
- package/dist/apollo-core/p-75e5bfe0.entry.js +0 -1
- package/dist/apollo-core/p-77fe3cc1.entry.js +0 -1
- package/dist/apollo-core/p-83bb7607.entry.js +0 -1
- package/dist/apollo-core/p-8664d88b.entry.js +0 -1
- package/dist/apollo-core/p-8a925e9d.entry.js +0 -1
- package/dist/apollo-core/p-9064badb.entry.js +0 -1
- package/dist/apollo-core/p-969d5cca.entry.js +0 -1
- package/dist/apollo-core/p-99a79cf4.entry.js +0 -1
- package/dist/apollo-core/p-ae8a5f66.entry.js +0 -1
- package/dist/apollo-core/p-af8ebf49.entry.js +0 -1
- package/dist/apollo-core/p-b29025b2.entry.js +0 -1
- package/dist/apollo-core/p-b5a61076.entry.js +0 -1
- package/dist/apollo-core/p-bf7d8e18.entry.js +0 -1
- package/dist/apollo-core/p-c48e4884.entry.js +0 -1
- package/dist/apollo-core/p-cb5b15c2.entry.js +0 -1
- package/dist/apollo-core/p-cc57f20d.entry.js +0 -1
- package/dist/apollo-core/p-dca48977.entry.js +0 -1
- package/dist/apollo-core/p-e1833287.entry.js +0 -1
- package/dist/apollo-core/p-e2b73b60.entry.js +0 -1
- package/dist/apollo-core/p-e7e445b0.entry.js +0 -1
- package/dist/apollo-core/p-f1c103ff.entry.js +0 -1
- package/dist/apollo-core/p-ffc2f0cf.entry.js +0 -1
- package/dist/cjs/xpl-table-footer-cell.cjs.entry.js +0 -18
- package/dist/cjs/xpl-table-header-cell.cjs.entry.js +0 -59
- package/dist/collection/components/xpl-table-header-cell/xpl-table-header-cell.js +0 -190
- package/dist/components/p-9VnxPQLs.js +0 -1
- package/dist/components/p-B2oLZUDD.js +0 -1
- package/dist/components/p-BYYFsuD3.js +0 -1
- package/dist/components/p-BZtxVB1R.js +0 -1
- package/dist/components/p-CnVGKN63.js +0 -1
- package/dist/components/p-Cz7zDaI4.js +0 -1
- package/dist/components/p-D4rv6CNJ.js +0 -1
- package/dist/components/p-EfW0v54z.js +0 -1
- package/dist/components/p-YG9Jza0y.js +0 -1
- package/dist/docs/xpl-table-header-cell/readme.md +0 -47
- package/dist/esm/xpl-table-footer-cell.entry.js +0 -16
- package/dist/esm/xpl-table-header-cell.entry.js +0 -57
- package/dist/types/components/xpl-table-header-cell/xpl-table-header-cell.d.ts +0 -13
|
@@ -1,67 +1,148 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-ukZKsqqq.js';
|
|
2
|
+
import { T as TimerManager } from './lifecycle-Dqb1pIRo.js';
|
|
3
|
+
import { R as ROW_REORDER_MARK, S as SELECTION_MARK, c as cycleSortDirection, g as getGridColumnWidthFromHeaderCell, a as getIconType } from './table-internal-O7gQjVdS.js';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
case 'desc':
|
|
8
|
-
return 'arrow-down';
|
|
9
|
-
default:
|
|
10
|
-
return 'dash';
|
|
5
|
+
function getNearestTableBodyRowFromNode(node) {
|
|
6
|
+
const el = node instanceof HTMLElement ? node : null;
|
|
7
|
+
if (!el) {
|
|
8
|
+
return null;
|
|
11
9
|
}
|
|
12
|
-
|
|
10
|
+
const row = el.closest('xpl-table-row');
|
|
11
|
+
return row != null ? row : null;
|
|
12
|
+
}
|
|
13
|
+
function getNextVisibleTableBodyRowAfter(element) {
|
|
14
|
+
const parent = element.parentElement;
|
|
15
|
+
if (!parent)
|
|
16
|
+
return null;
|
|
17
|
+
const siblings = Array.from(parent.children);
|
|
18
|
+
const idx = siblings.indexOf(element);
|
|
19
|
+
if (idx === -1)
|
|
20
|
+
return null;
|
|
21
|
+
for (let i = idx + 1; i < siblings.length; i += 1) {
|
|
22
|
+
const n = siblings[i];
|
|
23
|
+
if (n.tagName.toLowerCase() === 'xpl-table-row' && !n.hasAttribute('hidden')) {
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
function moveRowInTableBody(body, draggedRow, dropTargetRow) {
|
|
30
|
+
if (draggedRow === dropTargetRow || draggedRow.parentElement !== body) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (dropTargetRow.parentElement !== body) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const visible = Array.from(body.children).filter((c) => c.tagName.toLowerCase() === 'xpl-table-row' && !c.hasAttribute('hidden'));
|
|
37
|
+
const fromIndex = visible.indexOf(draggedRow);
|
|
38
|
+
const toIndex = visible.indexOf(dropTargetRow);
|
|
39
|
+
if (fromIndex === -1 || toIndex === -1 || fromIndex === toIndex) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (fromIndex < toIndex) {
|
|
43
|
+
const nextVisible = getNextVisibleTableBodyRowAfter(dropTargetRow);
|
|
44
|
+
if (nextVisible) {
|
|
45
|
+
body.insertBefore(draggedRow, nextVisible);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
body.insertBefore(draggedRow, null);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
body.insertBefore(draggedRow, dropTargetRow);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function bodyRowFromDragTarget(target) {
|
|
57
|
+
return getNearestTableBodyRowFromNode(target);
|
|
58
|
+
}
|
|
59
|
+
function tableBodyRowFromEvent(ev) {
|
|
60
|
+
const path = typeof ev.composedPath === 'function' ? ev.composedPath() : [];
|
|
61
|
+
const row = path.find((n) => n instanceof HTMLElement && n.tagName.toLowerCase() === 'xpl-table-row');
|
|
62
|
+
return row ?? bodyRowFromDragTarget(ev.target);
|
|
63
|
+
}
|
|
64
|
+
function reorderDragHandleFromEvent(ev) {
|
|
65
|
+
const path = typeof ev.composedPath === 'function' ? ev.composedPath() : [];
|
|
66
|
+
const handle = path.find((n) => n instanceof HTMLElement && n.classList.contains('xpl-table__row-drag-handle'));
|
|
67
|
+
return handle ?? null;
|
|
68
|
+
}
|
|
13
69
|
const Table = class {
|
|
14
70
|
constructor(hostRef) {
|
|
15
71
|
registerInstance(this, hostRef);
|
|
16
|
-
this.
|
|
72
|
+
this.rowOrderChange = createEvent(this, "rowOrderChange", 3);
|
|
73
|
+
this.rowSelectionChange = createEvent(this, "rowSelectionChange", 3);
|
|
17
74
|
this.sortChanged = createEvent(this, "sortChanged", 3);
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
75
|
+
this.tableSelect = createEvent(this, "tableSelect", 7);
|
|
76
|
+
this.columnWidthsToken = '';
|
|
77
|
+
this.lastEmittedRowSelectionKey = '';
|
|
78
|
+
this.draggedRow = null;
|
|
79
|
+
this.pendingDragRow = null;
|
|
80
|
+
this.pointerUpClearPending = null;
|
|
81
|
+
this.reorderKeyboardTimers = new TimerManager();
|
|
82
|
+
this.onReorderHandleKeydown = (ev) => {
|
|
83
|
+
this.handleReorderHandleKeyDown(ev);
|
|
84
|
+
};
|
|
21
85
|
this.areAllSelected = false;
|
|
86
|
+
this.colCount = 0;
|
|
22
87
|
this.hasScrolled = false;
|
|
88
|
+
this.keyboardReorderRowId = null;
|
|
89
|
+
this.reorderLiveMessage = '';
|
|
90
|
+
this.rowData = [];
|
|
91
|
+
this.rowFooterData = [];
|
|
92
|
+
this.selected = [];
|
|
93
|
+
this.selectedRowIds = [];
|
|
23
94
|
this.sortTypeArray = [];
|
|
95
|
+
this.isSortable = false;
|
|
96
|
+
this.rowReorderable = false;
|
|
97
|
+
this.selectedValues = [];
|
|
98
|
+
this.sortableColumns = [];
|
|
99
|
+
this.onGridScroll = (e) => {
|
|
100
|
+
this.hasScrolled = e.target.scrollLeft > 0;
|
|
101
|
+
};
|
|
24
102
|
this.selectAll = (e) => {
|
|
25
|
-
const
|
|
103
|
+
const { target } = e;
|
|
104
|
+
if (!(target instanceof HTMLInputElement))
|
|
105
|
+
return;
|
|
106
|
+
const { checked } = target;
|
|
26
107
|
this.areAllSelected = checked;
|
|
27
108
|
this.selected =
|
|
28
|
-
this.selectedValues.length > 0
|
|
29
|
-
? Array.from(this.el.querySelectorAll('tbody td:first-child
|
|
109
|
+
this.selectedValues && this.selectedValues.length > 0
|
|
110
|
+
? Array.from(this.el.querySelectorAll('tbody td:first-child input')).map((input) => (checked ? input?.value : checked))
|
|
30
111
|
: this.selected.map(() => checked);
|
|
31
|
-
this.
|
|
112
|
+
this.onSelectionChange();
|
|
32
113
|
};
|
|
33
114
|
this.selectOne = (e, checkboxIdx) => {
|
|
34
|
-
const
|
|
35
|
-
|
|
115
|
+
const { target } = e;
|
|
116
|
+
if (!(target instanceof HTMLInputElement))
|
|
117
|
+
return;
|
|
118
|
+
const { checked, value } = target;
|
|
119
|
+
this.areAllSelected = false;
|
|
36
120
|
this.selected = this.selected.map((v, selectedIdx) => {
|
|
37
121
|
if (selectedIdx !== checkboxIdx)
|
|
38
122
|
return v;
|
|
39
|
-
return this.selectedValues.length > 0
|
|
123
|
+
return this.selectedValues && this.selectedValues.length > 0
|
|
40
124
|
? checked
|
|
41
|
-
?
|
|
125
|
+
? value
|
|
42
126
|
: checked
|
|
43
127
|
: checked;
|
|
44
128
|
});
|
|
45
|
-
this.
|
|
46
|
-
this.onChange();
|
|
129
|
+
this.onSelectionChange();
|
|
47
130
|
};
|
|
48
|
-
this.
|
|
131
|
+
this.onSelectionChange = () => {
|
|
49
132
|
this.tableSelect.emit({
|
|
50
133
|
selected: this.selected,
|
|
51
134
|
areAllSelected: this.areAllSelected,
|
|
52
135
|
});
|
|
53
136
|
};
|
|
54
|
-
this.
|
|
137
|
+
this.onLegacyScroll = () => {
|
|
55
138
|
this.hasScrolled = this.container.scrollLeft > 0;
|
|
56
139
|
};
|
|
57
140
|
this.sortBy = (col, sortTypeArray) => {
|
|
58
141
|
const handleSort = (a, b) => {
|
|
59
|
-
if (a[col].toLocaleLowerCase() < b[col].toLocaleLowerCase())
|
|
142
|
+
if (a[col].toLocaleLowerCase() < b[col].toLocaleLowerCase())
|
|
60
143
|
return -1;
|
|
61
|
-
|
|
62
|
-
if (a[col].toLocaleLowerCase() > b[col].toLocaleLowerCase()) {
|
|
144
|
+
if (a[col].toLocaleLowerCase() > b[col].toLocaleLowerCase())
|
|
63
145
|
return 1;
|
|
64
|
-
}
|
|
65
146
|
return 0;
|
|
66
147
|
};
|
|
67
148
|
switch (sortTypeArray[col]) {
|
|
@@ -72,7 +153,7 @@ const Table = class {
|
|
|
72
153
|
this.rowData.sort((a, b) => handleSort(b, a));
|
|
73
154
|
break;
|
|
74
155
|
default:
|
|
75
|
-
this.rowData = this.data ? Array.from(this.data) : [];
|
|
156
|
+
this.rowData = this.data !== undefined ? Array.from(this.data) : [];
|
|
76
157
|
this.sortTypeArray[col] = null;
|
|
77
158
|
break;
|
|
78
159
|
}
|
|
@@ -81,44 +162,69 @@ const Table = class {
|
|
|
81
162
|
this.setData = () => {
|
|
82
163
|
this.rowData = this.data !== undefined ? Array.from(this.data) : [];
|
|
83
164
|
};
|
|
165
|
+
this.setFooterData = () => {
|
|
166
|
+
this.rowFooterData = this.footer !== undefined ? Array.from(this.footer) : [];
|
|
167
|
+
};
|
|
84
168
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
clickEvt.stopPropagation();
|
|
88
|
-
if (!isColumnSortable)
|
|
89
|
-
return;
|
|
90
|
-
this.sortTypeArray = this.sortTypeArray.map((val, i) => {
|
|
91
|
-
if (i !== colNum)
|
|
92
|
-
return null;
|
|
93
|
-
switch (val) {
|
|
94
|
-
case 'asc':
|
|
95
|
-
return 'desc';
|
|
96
|
-
case 'desc':
|
|
97
|
-
return null;
|
|
98
|
-
default:
|
|
99
|
-
return 'asc';
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
const evt = this.sortChanged.emit({
|
|
103
|
-
colNum,
|
|
104
|
-
colName,
|
|
105
|
-
sortTypeArr: this.sortTypeArray,
|
|
106
|
-
});
|
|
107
|
-
if (!evt.defaultPrevented)
|
|
108
|
-
this.sortBy(colNum, this.sortTypeArray);
|
|
169
|
+
watchColumns() {
|
|
170
|
+
this.sortTypeArray = this.columns ? this.columns.map(() => null) : [];
|
|
109
171
|
}
|
|
110
172
|
watchData() {
|
|
111
173
|
this.setData();
|
|
112
174
|
}
|
|
113
|
-
|
|
114
|
-
this.
|
|
175
|
+
watchFooterData() {
|
|
176
|
+
this.setFooterData();
|
|
177
|
+
}
|
|
178
|
+
watchReorderHandleIcon() {
|
|
179
|
+
if (this.isLegacyMode || !this.rowReorderable)
|
|
180
|
+
return;
|
|
181
|
+
this.syncInjectedReorderHandleIcons();
|
|
182
|
+
}
|
|
183
|
+
watchReorderHandleIconKeyboard() {
|
|
184
|
+
if (this.isLegacyMode || !this.rowReorderable)
|
|
185
|
+
return;
|
|
186
|
+
this.syncInjectedReorderHandleIcons();
|
|
187
|
+
}
|
|
188
|
+
watchRowReorderable(next) {
|
|
189
|
+
if (this.isLegacyMode)
|
|
190
|
+
return;
|
|
191
|
+
if (!next) {
|
|
192
|
+
this.keyboardReorderRowId = null;
|
|
193
|
+
this.syncReorderHandleKeyboardA11y(null);
|
|
194
|
+
this.removeManagedReorderCells();
|
|
195
|
+
this.draggedRow = null;
|
|
196
|
+
this.pendingDragRow = null;
|
|
197
|
+
this.clearPendingDragListeners();
|
|
198
|
+
this.reorderLiveMessage = '';
|
|
199
|
+
this.queryBodyRows().forEach((r) => {
|
|
200
|
+
r.removeAttribute('draggable');
|
|
201
|
+
r.querySelector('.xpl-table__row-drag-handle')?.removeAttribute('draggable');
|
|
202
|
+
r.classList.remove('xpl-table-row--dragging', 'xpl-table-row--drag-over');
|
|
203
|
+
});
|
|
204
|
+
this.colCount = 0;
|
|
205
|
+
this.columnWidthsToken = '';
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
watchSelectable(next) {
|
|
209
|
+
if (this.isLegacyMode)
|
|
210
|
+
return;
|
|
211
|
+
if (!next) {
|
|
212
|
+
this.selectedRowIds = [];
|
|
213
|
+
this.lastEmittedRowSelectionKey = '';
|
|
214
|
+
this.colCount = 0;
|
|
215
|
+
this.columnWidthsToken = '';
|
|
216
|
+
this.syncRowSelectedProps();
|
|
217
|
+
}
|
|
115
218
|
}
|
|
116
219
|
componentWillLoad() {
|
|
117
|
-
this.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
220
|
+
if (this.isLegacyMode) {
|
|
221
|
+
this.ensureSelectAllValue();
|
|
222
|
+
this.areAllSelected = false;
|
|
223
|
+
this.setData();
|
|
224
|
+
this.setFooterData();
|
|
225
|
+
this.selected = new Array(this.rowData.length).fill(false);
|
|
226
|
+
this.sortTypeArray = this.columns ? this.columns.map(() => null) : [];
|
|
227
|
+
}
|
|
122
228
|
}
|
|
123
229
|
ensureSelectAllValue() {
|
|
124
230
|
if (this.selectAllValue !== undefined) {
|
|
@@ -138,43 +244,1061 @@ const Table = class {
|
|
|
138
244
|
this.selectAllValue = `select-all-${Table.selectAllSeq}`;
|
|
139
245
|
this.el.setAttribute('data-select-all-value', this.selectAllValue);
|
|
140
246
|
}
|
|
141
|
-
|
|
247
|
+
componentDidLoad() {
|
|
248
|
+
if (!this.isLegacyMode) {
|
|
249
|
+
this.syncCompositionalLayout();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
componentDidUpdate() {
|
|
253
|
+
if (!this.isLegacyMode) {
|
|
254
|
+
this.syncCompositionalLayout();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
disconnectedCallback() {
|
|
258
|
+
this.clearPendingDragListeners();
|
|
259
|
+
this.detachReorderHandleKeydownListeners();
|
|
260
|
+
this.reorderKeyboardTimers.dispose();
|
|
261
|
+
if (this.reorderAnnounceRaf !== undefined) {
|
|
262
|
+
cancelAnimationFrame(this.reorderAnnounceRaf);
|
|
263
|
+
this.reorderAnnounceRaf = undefined;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
handleHeaderCellColumnWidthsChange(ev) {
|
|
267
|
+
if (this.isLegacyMode)
|
|
268
|
+
return;
|
|
269
|
+
const t = ev.target;
|
|
270
|
+
if (!(t instanceof Node) || !this.el.contains(t))
|
|
271
|
+
return;
|
|
272
|
+
this.updateColumnWidths();
|
|
273
|
+
}
|
|
274
|
+
handleCompositionalCheckboxChange(ev) {
|
|
275
|
+
if (this.isLegacyMode || !this.selectable)
|
|
276
|
+
return;
|
|
277
|
+
if (!this.isEventFromThisTable(ev.target))
|
|
278
|
+
return;
|
|
279
|
+
const path = ev.composedPath?.() ?? [];
|
|
280
|
+
let checkboxHost = (path.length > 0 ? path : [ev.target].filter((n) => n != null)).find((n) => n instanceof HTMLElement && n.tagName.toLowerCase() === 'xpl-checkbox');
|
|
281
|
+
if (!checkboxHost &&
|
|
282
|
+
ev.target &&
|
|
283
|
+
typeof ev.target.closest === 'function') {
|
|
284
|
+
checkboxHost = ev.target.closest('xpl-checkbox') ?? undefined;
|
|
285
|
+
}
|
|
286
|
+
if (!checkboxHost || !this.el.contains(checkboxHost))
|
|
287
|
+
return;
|
|
288
|
+
const row = checkboxHost.closest('xpl-table-row');
|
|
289
|
+
if (!row || !this.isDirectChildBodyRow(row))
|
|
290
|
+
return;
|
|
291
|
+
const cell = checkboxHost.closest('xpl-table-cell');
|
|
292
|
+
if (!cell)
|
|
293
|
+
return;
|
|
294
|
+
const selectionIdx = this.getSelectionColumnIndex();
|
|
295
|
+
if (selectionIdx === null)
|
|
296
|
+
return;
|
|
297
|
+
const bodyCells = Table.getBodyRowCells(row);
|
|
298
|
+
const colIdx = bodyCells.indexOf(cell);
|
|
299
|
+
if (colIdx !== selectionIdx)
|
|
300
|
+
return;
|
|
301
|
+
ev.stopPropagation();
|
|
302
|
+
const rowId = Table.getRowIdForRow(row);
|
|
303
|
+
if (!rowId || row.disabled)
|
|
304
|
+
return;
|
|
305
|
+
const input = checkboxHost.querySelector('input[type="checkbox"]');
|
|
306
|
+
if (!input)
|
|
307
|
+
return;
|
|
308
|
+
const { checked } = input;
|
|
309
|
+
if (checked) {
|
|
310
|
+
if (!this.selectedRowIds.includes(rowId)) {
|
|
311
|
+
this.selectedRowIds = [...this.selectedRowIds, rowId];
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
else {
|
|
315
|
+
this.selectedRowIds = this.selectedRowIds.filter((id) => id !== rowId);
|
|
316
|
+
}
|
|
317
|
+
this.applyHeaderCheckboxState();
|
|
318
|
+
this.syncRowSelectedProps();
|
|
319
|
+
this.emitCompositionalSelection();
|
|
320
|
+
}
|
|
321
|
+
handleCompositionalHeaderCheckboxChange(ev) {
|
|
322
|
+
if (this.isLegacyMode || !this.selectable)
|
|
323
|
+
return;
|
|
324
|
+
if (!this.isEventFromThisTable(ev.target))
|
|
325
|
+
return;
|
|
326
|
+
const path = ev.composedPath?.() ?? [];
|
|
327
|
+
let headerCell = (path.length > 0 ? path : [ev.target].filter((n) => n != null)).find((n) => n instanceof HTMLElement &&
|
|
328
|
+
n.tagName.toLowerCase() === 'xpl-table-header-cell' &&
|
|
329
|
+
n.getAttribute('type') === 'checkbox');
|
|
330
|
+
if (!headerCell && ev.target && typeof ev.target.closest === 'function') {
|
|
331
|
+
const maybeCell = ev.target.closest('xpl-table-header-cell[type="checkbox"]');
|
|
332
|
+
if (maybeCell instanceof HTMLElement) {
|
|
333
|
+
headerCell = maybeCell;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (!headerCell || !this.el.contains(headerCell))
|
|
337
|
+
return;
|
|
338
|
+
if (!this.isCellInOurCompositionalHeader(headerCell))
|
|
339
|
+
return;
|
|
340
|
+
const headerCells = this.getCompositionalHeaderCells();
|
|
341
|
+
if (!headerCells.includes(headerCell))
|
|
342
|
+
return;
|
|
343
|
+
const checked = !!ev.detail;
|
|
344
|
+
const selectableRows = this.querySelectableBodyRows();
|
|
345
|
+
const ids = selectableRows
|
|
346
|
+
.map((r) => Table.getRowIdForRow(r))
|
|
347
|
+
.filter((id) => !!id);
|
|
348
|
+
if (checked) {
|
|
349
|
+
this.selectedRowIds = [...ids];
|
|
350
|
+
}
|
|
351
|
+
else {
|
|
352
|
+
this.selectedRowIds = [];
|
|
353
|
+
}
|
|
354
|
+
this.applyBodyCheckboxStates();
|
|
355
|
+
this.syncRowSelectedProps();
|
|
356
|
+
this.emitCompositionalSelection();
|
|
357
|
+
}
|
|
358
|
+
handlePointerDownExitKeyboardReorder(ev) {
|
|
359
|
+
if (this.isLegacyMode || !this.rowReorderable || this.keyboardReorderRowId === null) {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
const t = ev.target;
|
|
363
|
+
if (!(t instanceof Node) || !this.el.contains(t)) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
const row = t instanceof Element ? t.closest('xpl-table-row') : null;
|
|
367
|
+
if (!row || !this.isDirectChildBodyRow(row)) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
this.keyboardReorderRowId = null;
|
|
371
|
+
this.syncReorderHandleKeyboardA11y(null);
|
|
372
|
+
}
|
|
373
|
+
handleReorderHandleKeyDown(ev) {
|
|
374
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
const rawPath = typeof ev.composedPath === 'function' ? ev.composedPath() : [];
|
|
378
|
+
const path = rawPath.length > 0 ? rawPath : ev.target ? [ev.target] : [];
|
|
379
|
+
let handle = path.find((n) => n instanceof HTMLElement && n.classList.contains('xpl-table__row-drag-handle'));
|
|
380
|
+
if (!handle &&
|
|
381
|
+
ev.target instanceof HTMLElement &&
|
|
382
|
+
ev.target.classList.contains('xpl-table__row-drag-handle')) {
|
|
383
|
+
handle = ev.target;
|
|
384
|
+
}
|
|
385
|
+
if (!handle || !this.el.contains(handle)) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
const row = handle.closest('xpl-table-row');
|
|
389
|
+
if (!row || !this.isDirectChildBodyRow(row)) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const rowId = Table.getRowIdForRow(row) ?? '';
|
|
393
|
+
if (!rowId) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const isKbd = this.keyboardReorderRowId === rowId;
|
|
397
|
+
const isEscapeKey = ev.key === 'Escape' ||
|
|
398
|
+
ev.key === 'Esc' ||
|
|
399
|
+
ev.code === 'Escape' ||
|
|
400
|
+
ev.keyCode === 27;
|
|
401
|
+
if (row.disabled) {
|
|
402
|
+
if (isEscapeKey && isKbd) {
|
|
403
|
+
ev.preventDefault();
|
|
404
|
+
this.keyboardReorderRowId = null;
|
|
405
|
+
this.syncReorderHandleKeyboardA11y(null);
|
|
406
|
+
}
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
if (isEscapeKey) {
|
|
410
|
+
if (isKbd) {
|
|
411
|
+
ev.preventDefault();
|
|
412
|
+
this.keyboardReorderRowId = null;
|
|
413
|
+
this.syncReorderHandleKeyboardA11y(null);
|
|
414
|
+
}
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
if (!isKbd) {
|
|
418
|
+
if (ev.key === 'Enter' || ev.key === ' ') {
|
|
419
|
+
ev.preventDefault();
|
|
420
|
+
this.keyboardReorderRowId = rowId;
|
|
421
|
+
this.syncReorderHandleKeyboardA11y(rowId);
|
|
422
|
+
}
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
if (ev.key === 'ArrowUp' || ev.key === 'ArrowDown') {
|
|
426
|
+
ev.preventDefault();
|
|
427
|
+
const dir = ev.key === 'ArrowUp' ? 'up' : 'down';
|
|
428
|
+
this.performKeyboardRowReorder(rowId, dir);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
handleRowReorderPointerDown(ev) {
|
|
432
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
433
|
+
return;
|
|
434
|
+
}
|
|
435
|
+
const handle = reorderDragHandleFromEvent(ev);
|
|
436
|
+
if (!handle) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
const table = handle.closest('xpl-table');
|
|
440
|
+
if (table !== this.el) {
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const row = bodyRowFromDragTarget(handle);
|
|
444
|
+
if (!row || row.disabled) {
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
448
|
+
if (!body || row.parentElement !== body) {
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
this.clearPendingDragListeners();
|
|
452
|
+
this.pendingDragRow = row;
|
|
453
|
+
const onPointerEnd = () => {
|
|
454
|
+
this.clearPendingDragListeners();
|
|
455
|
+
this.pendingDragRow = null;
|
|
456
|
+
};
|
|
457
|
+
document.addEventListener('pointerup', onPointerEnd, true);
|
|
458
|
+
document.addEventListener('pointercancel', onPointerEnd, true);
|
|
459
|
+
this.pointerUpClearPending = () => {
|
|
460
|
+
document.removeEventListener('pointerup', onPointerEnd, true);
|
|
461
|
+
document.removeEventListener('pointercancel', onPointerEnd, true);
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
handleRowReorderDragStart(ev) {
|
|
465
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const row = tableBodyRowFromEvent(ev);
|
|
469
|
+
if (!row) {
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
if (row.closest('xpl-table') !== this.el) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
476
|
+
if (!body || row.parentElement !== body) {
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
if (row.disabled || this.pendingDragRow !== row) {
|
|
480
|
+
ev.preventDefault();
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
this.keyboardReorderRowId = null;
|
|
484
|
+
this.syncReorderHandleKeyboardA11y(null);
|
|
485
|
+
this.clearPendingDragListeners();
|
|
486
|
+
this.pendingDragRow = null;
|
|
487
|
+
this.draggedRow = row;
|
|
488
|
+
if (ev.dataTransfer) {
|
|
489
|
+
ev.dataTransfer.effectAllowed = 'move';
|
|
490
|
+
ev.dataTransfer.setData('text/plain', Table.getRowIdForRow(row) ?? '');
|
|
491
|
+
}
|
|
492
|
+
row.classList.add('xpl-table-row--dragging');
|
|
493
|
+
}
|
|
494
|
+
handleRowReorderDragEnd(ev) {
|
|
495
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
const row = tableBodyRowFromEvent(ev);
|
|
499
|
+
if (!row || row.closest('xpl-table') !== this.el) {
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
row.classList.remove('xpl-table-row--dragging');
|
|
503
|
+
this.clearReorderDragOverClasses();
|
|
504
|
+
this.draggedRow = null;
|
|
505
|
+
}
|
|
506
|
+
handleRowReorderDragOver(ev) {
|
|
507
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
const row = tableBodyRowFromEvent(ev);
|
|
511
|
+
if (!row || row.closest('xpl-table') !== this.el) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
515
|
+
if (!body || row.parentElement !== body || row.disabled) {
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
ev.preventDefault();
|
|
519
|
+
if (ev.dataTransfer) {
|
|
520
|
+
ev.dataTransfer.dropEffect = 'move';
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
handleRowReorderDragEnter(ev) {
|
|
524
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
const row = tableBodyRowFromEvent(ev);
|
|
528
|
+
if (!row || row.closest('xpl-table') !== this.el) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
532
|
+
if (!body || row.parentElement !== body || row.disabled) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
ev.preventDefault();
|
|
536
|
+
row.classList.add('xpl-table-row--drag-over');
|
|
537
|
+
}
|
|
538
|
+
handleRowReorderDragLeave(ev) {
|
|
539
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
const row = tableBodyRowFromEvent(ev);
|
|
543
|
+
if (!row || row.closest('xpl-table') !== this.el) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
const related = ev.relatedTarget;
|
|
547
|
+
if (related && row.contains(related)) {
|
|
548
|
+
return;
|
|
549
|
+
}
|
|
550
|
+
row.classList.remove('xpl-table-row--drag-over');
|
|
551
|
+
}
|
|
552
|
+
handleRowReorderDrop(ev) {
|
|
553
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
ev.preventDefault();
|
|
557
|
+
const dropRow = tableBodyRowFromEvent(ev);
|
|
558
|
+
if (!dropRow || dropRow.closest('xpl-table') !== this.el) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
562
|
+
if (!body || dropRow.parentElement !== body || dropRow.disabled) {
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
const source = this.draggedRow;
|
|
566
|
+
if (!source || source.disabled) {
|
|
567
|
+
this.draggedRow = null;
|
|
568
|
+
this.clearReorderDragOverClasses();
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
if (source === dropRow) {
|
|
572
|
+
this.clearReorderDragOverClasses();
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
const visible = this.getVisibleBodyRowsForReorder();
|
|
576
|
+
const fromIndex = visible.indexOf(source);
|
|
577
|
+
const toIndex = visible.indexOf(dropRow);
|
|
578
|
+
if (fromIndex === -1 || toIndex === -1) {
|
|
579
|
+
this.clearReorderDragOverClasses();
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
const direction = fromIndex > toIndex ? 'up' : 'down';
|
|
583
|
+
const rowId = Table.getRowIdForRow(source) ?? '';
|
|
584
|
+
const runMove = () => {
|
|
585
|
+
moveRowInTableBody(body, source, dropRow);
|
|
586
|
+
};
|
|
587
|
+
runMove();
|
|
588
|
+
const orderedRowIds = this.getVisibleBodyRowsForReorder().map((r) => Table.getRowIdForRow(r) ?? '');
|
|
589
|
+
this.rowOrderChange.emit({
|
|
590
|
+
rowId,
|
|
591
|
+
direction,
|
|
592
|
+
orderedRowIds,
|
|
593
|
+
fromIndex,
|
|
594
|
+
toIndex,
|
|
595
|
+
});
|
|
596
|
+
this.announceRowReorder(rowId, orderedRowIds);
|
|
597
|
+
this.clearReorderDragOverClasses();
|
|
598
|
+
if (this.selectable) {
|
|
599
|
+
this.applyBodyCheckboxStates();
|
|
600
|
+
this.applyHeaderCheckboxState();
|
|
601
|
+
this.syncRowSelectedProps();
|
|
602
|
+
}
|
|
603
|
+
this.updateColumnWidths();
|
|
604
|
+
}
|
|
605
|
+
get isLegacyMode() {
|
|
606
|
+
return this.columns !== undefined || this.data !== undefined || this.footer !== undefined;
|
|
607
|
+
}
|
|
608
|
+
ensureTableInstanceId() {
|
|
609
|
+
if (this.tableInstanceId)
|
|
610
|
+
return;
|
|
611
|
+
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
612
|
+
this.tableInstanceId = crypto.randomUUID();
|
|
613
|
+
}
|
|
614
|
+
else {
|
|
615
|
+
this.tableInstanceId = Math.random().toString(36).slice(2);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
generateRowId() {
|
|
619
|
+
this.ensureTableInstanceId();
|
|
620
|
+
if (typeof crypto !== 'undefined' && crypto.randomUUID) {
|
|
621
|
+
return `${this.tableInstanceId}-${crypto.randomUUID()}`;
|
|
622
|
+
}
|
|
623
|
+
return `${this.tableInstanceId}-${Math.random().toString(36).slice(2)}`;
|
|
624
|
+
}
|
|
625
|
+
syncCompositionalLayout() {
|
|
626
|
+
if (this.isLegacyMode)
|
|
627
|
+
return;
|
|
628
|
+
if (this.rowReorderable) {
|
|
629
|
+
this.syncReorderColumn();
|
|
630
|
+
}
|
|
631
|
+
else {
|
|
632
|
+
this.removeManagedReorderCells();
|
|
633
|
+
}
|
|
634
|
+
if (this.selectable) {
|
|
635
|
+
this.ensureTableInstanceId();
|
|
636
|
+
this.pruneStaleSelectedRowIds();
|
|
637
|
+
this.ensureBodyRowIds();
|
|
638
|
+
this.applyBodyCheckboxStates();
|
|
639
|
+
this.applyHeaderCheckboxState();
|
|
640
|
+
this.syncRowSelectedProps();
|
|
641
|
+
}
|
|
642
|
+
if (this.rowReorderable && this.selectable) {
|
|
643
|
+
this.normalizeManagedColumnsOrder();
|
|
644
|
+
}
|
|
645
|
+
this.updateColumnWidths();
|
|
646
|
+
}
|
|
647
|
+
getDirectChildTableSection(tag) {
|
|
648
|
+
const el = Array.from(this.el.children).find((c) => c.tagName.toLowerCase() === tag);
|
|
649
|
+
return el ?? null;
|
|
650
|
+
}
|
|
651
|
+
isDirectChildBodyRow(row) {
|
|
652
|
+
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
653
|
+
return body !== null && row.parentElement === body;
|
|
654
|
+
}
|
|
655
|
+
isCellInOurCompositionalHeader(cell) {
|
|
656
|
+
const header = cell.closest('xpl-table-header');
|
|
657
|
+
return header !== null && header.parentElement === this.el;
|
|
658
|
+
}
|
|
659
|
+
getSelectionColumnIndex() {
|
|
660
|
+
const headerCells = this.getCompositionalHeaderCells();
|
|
661
|
+
const idx = headerCells.findIndex((c) => c.getAttribute('type') === 'checkbox');
|
|
662
|
+
return idx >= 0 ? idx : null;
|
|
663
|
+
}
|
|
664
|
+
static getBodyRowCells(row) {
|
|
665
|
+
return Array.from(row.children).filter((c) => c.tagName.toLowerCase() === 'xpl-table-cell');
|
|
666
|
+
}
|
|
667
|
+
queryBodyRows() {
|
|
668
|
+
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
669
|
+
if (!body)
|
|
670
|
+
return [];
|
|
671
|
+
return Array.from(body.children).filter((c) => c.tagName.toLowerCase() === 'xpl-table-row');
|
|
672
|
+
}
|
|
673
|
+
querySelectableBodyRows() {
|
|
674
|
+
return this.queryBodyRows().filter((row) => !row.disabled);
|
|
675
|
+
}
|
|
676
|
+
static getRowIdForRow(row) {
|
|
677
|
+
const id = row.getAttribute('row-id')?.trim();
|
|
678
|
+
return id || null;
|
|
679
|
+
}
|
|
680
|
+
ensureBodyRowIds() {
|
|
681
|
+
this.queryBodyRows().forEach((row) => {
|
|
682
|
+
if (Table.getRowIdForRow(row))
|
|
683
|
+
return;
|
|
684
|
+
row.setAttribute('row-id', this.generateRowId());
|
|
685
|
+
});
|
|
686
|
+
}
|
|
687
|
+
removeManagedReorderCells() {
|
|
688
|
+
this.el.querySelectorAll(`[${ROW_REORDER_MARK}]`).forEach((node) => {
|
|
689
|
+
if (!(node instanceof Element))
|
|
690
|
+
return;
|
|
691
|
+
if (node.closest('xpl-table') !== this.el)
|
|
692
|
+
return;
|
|
693
|
+
node.parentElement?.removeChild(node);
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
getSelectionSlotCellForReorderOrder(row) {
|
|
697
|
+
const idx = this.getSelectionColumnIndex();
|
|
698
|
+
if (idx === null) {
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
const cells = Array.from(row.children);
|
|
702
|
+
const cell = cells[idx];
|
|
703
|
+
if (!cell) {
|
|
704
|
+
return null;
|
|
705
|
+
}
|
|
706
|
+
const tag = cell.tagName.toLowerCase();
|
|
707
|
+
if (tag === 'xpl-table-header-cell') {
|
|
708
|
+
return cell.getAttribute('type') === 'checkbox' ? cell : null;
|
|
709
|
+
}
|
|
710
|
+
if (tag === 'xpl-table-cell') {
|
|
711
|
+
if (cell.hasAttribute(SELECTION_MARK)) {
|
|
712
|
+
return cell;
|
|
713
|
+
}
|
|
714
|
+
return cell.querySelector('xpl-checkbox') ? cell : null;
|
|
715
|
+
}
|
|
716
|
+
if (tag === 'xpl-table-footer-cell') {
|
|
717
|
+
return cell;
|
|
718
|
+
}
|
|
719
|
+
return null;
|
|
720
|
+
}
|
|
721
|
+
normalizeManagedColumnsOrder() {
|
|
722
|
+
const fix = (row) => {
|
|
723
|
+
const re = row.querySelector(`:scope > [${ROW_REORDER_MARK}]`);
|
|
724
|
+
const se = this.getSelectionSlotCellForReorderOrder(row);
|
|
725
|
+
if (!re || !se) {
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
const siblings = Array.from(row.children);
|
|
729
|
+
const iRe = siblings.indexOf(re);
|
|
730
|
+
const iSe = siblings.indexOf(se);
|
|
731
|
+
if (iRe > iSe) {
|
|
732
|
+
row.insertBefore(re, se);
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
const header = Array.from(this.el.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-header') ?? null;
|
|
736
|
+
if (header) {
|
|
737
|
+
const firstRow = Array.from(header.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-row');
|
|
738
|
+
const container = firstRow ?? header;
|
|
739
|
+
fix(container);
|
|
740
|
+
}
|
|
741
|
+
this.queryBodyRows().forEach((row) => fix(row));
|
|
742
|
+
const footer = this.getDirectChildTableSection('xpl-table-footer');
|
|
743
|
+
if (footer) {
|
|
744
|
+
Array.from(footer.children)
|
|
745
|
+
.filter((c) => c.tagName.toLowerCase() === 'xpl-table-row')
|
|
746
|
+
.forEach((row) => fix(row));
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
syncReorderColumn() {
|
|
750
|
+
if (!this.rowReorderable || this.isLegacyMode)
|
|
751
|
+
return;
|
|
752
|
+
this.ensureBodyRowIds();
|
|
753
|
+
this.ensureHeaderReorderCell();
|
|
754
|
+
this.ensureBodyReorderCells();
|
|
755
|
+
this.ensureFooterReorderCells();
|
|
756
|
+
this.applyReorderRowDraggableState();
|
|
757
|
+
}
|
|
758
|
+
ensureHeaderReorderCell() {
|
|
759
|
+
const header = Array.from(this.el.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-header') ?? null;
|
|
760
|
+
if (!header)
|
|
761
|
+
return;
|
|
762
|
+
const firstRow = Array.from(header.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-row');
|
|
763
|
+
const container = firstRow ?? header;
|
|
764
|
+
if (Array.from(container.children).some((c) => c.tagName.toLowerCase() === 'xpl-table-header-cell' &&
|
|
765
|
+
c.hasAttribute(ROW_REORDER_MARK))) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
const cell = document.createElement('xpl-table-header-cell');
|
|
769
|
+
cell.setAttribute(ROW_REORDER_MARK, '');
|
|
770
|
+
cell.setAttribute('type', 'empty');
|
|
771
|
+
cell.setAttribute('width', '48');
|
|
772
|
+
cell.setAttribute('align', 'center');
|
|
773
|
+
container.insertBefore(cell, container.firstChild);
|
|
774
|
+
}
|
|
775
|
+
ensureBodyReorderCells() {
|
|
776
|
+
this.queryBodyRows().forEach((row) => {
|
|
777
|
+
const managed = Array.from(row.children).filter((c) => c.tagName.toLowerCase() === 'xpl-table-cell' &&
|
|
778
|
+
c.hasAttribute(ROW_REORDER_MARK));
|
|
779
|
+
if (managed.length > 1) {
|
|
780
|
+
for (let i = 1; i < managed.length; i += 1) {
|
|
781
|
+
managed[i].remove();
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
let cell = managed[0];
|
|
785
|
+
if (!cell) {
|
|
786
|
+
const newCell = document.createElement('xpl-table-cell');
|
|
787
|
+
newCell.setAttribute(ROW_REORDER_MARK, '');
|
|
788
|
+
newCell.setAttribute('width', '48');
|
|
789
|
+
newCell.setAttribute('align', 'center');
|
|
790
|
+
const btn = document.createElement('button');
|
|
791
|
+
btn.type = 'button';
|
|
792
|
+
btn.className = 'xpl-table__row-drag-handle';
|
|
793
|
+
btn.setAttribute('aria-label', 'Reorder row');
|
|
794
|
+
btn.setAttribute('aria-pressed', 'false');
|
|
795
|
+
const iconName = this.getResolvedIconForRow(Table.getRowIdForRow(row) ?? '');
|
|
796
|
+
if (iconName) {
|
|
797
|
+
const icon = document.createElement('xpl-icon');
|
|
798
|
+
icon.setAttribute('icon', iconName);
|
|
799
|
+
icon.setAttribute('size', '16');
|
|
800
|
+
btn.appendChild(icon);
|
|
801
|
+
}
|
|
802
|
+
newCell.appendChild(btn);
|
|
803
|
+
row.insertBefore(newCell, row.firstChild);
|
|
804
|
+
cell = newCell;
|
|
805
|
+
}
|
|
806
|
+
else {
|
|
807
|
+
cell.setAttribute('align', 'center');
|
|
808
|
+
}
|
|
809
|
+
const btn = cell.querySelector('.xpl-table__row-drag-handle');
|
|
810
|
+
if (btn) {
|
|
811
|
+
btn.disabled = row.disabled;
|
|
812
|
+
}
|
|
813
|
+
});
|
|
814
|
+
this.syncInjectedReorderHandleIcons();
|
|
815
|
+
this.attachReorderHandleKeydownListeners();
|
|
816
|
+
}
|
|
817
|
+
getResolvedIconForRow(rowId) {
|
|
818
|
+
const inKeyboardMode = this.keyboardReorderRowId !== null &&
|
|
819
|
+
rowId !== '' &&
|
|
820
|
+
rowId === this.keyboardReorderRowId;
|
|
821
|
+
if (inKeyboardMode) {
|
|
822
|
+
if (this.reorderHandleIconKeyboard === '') {
|
|
823
|
+
return null;
|
|
824
|
+
}
|
|
825
|
+
return this.reorderHandleIconKeyboard ?? 'caret-expand-y';
|
|
826
|
+
}
|
|
827
|
+
if (this.reorderHandleIcon === '') {
|
|
828
|
+
return null;
|
|
829
|
+
}
|
|
830
|
+
return this.reorderHandleIcon ?? 'grip-dots-vertical';
|
|
831
|
+
}
|
|
832
|
+
syncInjectedReorderHandleIcons() {
|
|
833
|
+
this.queryBodyRows().forEach((row) => {
|
|
834
|
+
const btn = row.querySelector('.xpl-table__row-drag-handle');
|
|
835
|
+
if (!btn) {
|
|
836
|
+
return;
|
|
837
|
+
}
|
|
838
|
+
const rowId = Table.getRowIdForRow(row) ?? '';
|
|
839
|
+
const iconName = this.getResolvedIconForRow(rowId);
|
|
840
|
+
btn.querySelectorAll('xpl-icon').forEach((n) => n.remove());
|
|
841
|
+
if (iconName) {
|
|
842
|
+
const icon = document.createElement('xpl-icon');
|
|
843
|
+
icon.setAttribute('icon', iconName);
|
|
844
|
+
icon.setAttribute('size', '16');
|
|
845
|
+
btn.appendChild(icon);
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
syncReorderHandleKeyboardA11y(activeId) {
|
|
850
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
this.queryBodyRows().forEach((row) => {
|
|
854
|
+
const btn = row.querySelector('.xpl-table__row-drag-handle');
|
|
855
|
+
if (!btn) {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
const rid = Table.getRowIdForRow(row) ?? '';
|
|
859
|
+
const isActive = activeId !== null && rid === activeId;
|
|
860
|
+
btn.classList.toggle('xpl-table__row-drag-handle--keyboard-mode', isActive);
|
|
861
|
+
btn.setAttribute('aria-pressed', isActive ? 'true' : 'false');
|
|
862
|
+
btn.setAttribute('aria-label', isActive
|
|
863
|
+
? 'Press arrow up or down to reorder, Escape to exit'
|
|
864
|
+
: 'Press Enter or Space to activate keyboard reorder mode, or drag to reorder');
|
|
865
|
+
});
|
|
866
|
+
this.syncInjectedReorderHandleIcons();
|
|
867
|
+
}
|
|
868
|
+
attachReorderHandleKeydownListeners() {
|
|
869
|
+
if (this.isLegacyMode || !this.rowReorderable) {
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
this.queryBodyRows().forEach((row) => {
|
|
873
|
+
const btn = row.querySelector('.xpl-table__row-drag-handle');
|
|
874
|
+
if (!btn || btn.dataset.xplReorderKbdBound === 'true') {
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
btn.dataset.xplReorderKbdBound = 'true';
|
|
878
|
+
btn.addEventListener('keydown', this.onReorderHandleKeydown);
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
detachReorderHandleKeydownListeners() {
|
|
882
|
+
if (!this.el) {
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
this.el
|
|
886
|
+
.querySelectorAll('.xpl-table__row-drag-handle[data-xpl-reorder-kbd-bound="true"]')
|
|
887
|
+
.forEach((btn) => {
|
|
888
|
+
btn.removeEventListener('keydown', this.onReorderHandleKeydown);
|
|
889
|
+
delete btn.dataset.xplReorderKbdBound;
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
performKeyboardRowReorder(rowId, direction) {
|
|
893
|
+
const body = this.getDirectChildTableSection('xpl-table-body');
|
|
894
|
+
if (!body) {
|
|
895
|
+
return false;
|
|
896
|
+
}
|
|
897
|
+
const visible = this.getVisibleBodyRowsForReorder();
|
|
898
|
+
const itemIndex = visible.findIndex((r) => Table.getRowIdForRow(r) === rowId);
|
|
899
|
+
if (itemIndex === -1) {
|
|
900
|
+
return false;
|
|
901
|
+
}
|
|
902
|
+
const targetIndex = direction === 'up' ? itemIndex - 1 : itemIndex + 1;
|
|
903
|
+
if (targetIndex < 0 || targetIndex >= visible.length) {
|
|
904
|
+
return false;
|
|
905
|
+
}
|
|
906
|
+
const fromIndex = itemIndex;
|
|
907
|
+
const item = visible[itemIndex];
|
|
908
|
+
const targetItem = visible[targetIndex];
|
|
909
|
+
if (direction === 'up') {
|
|
910
|
+
body.insertBefore(item, targetItem);
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
const nextVisible = getNextVisibleTableBodyRowAfter(targetItem);
|
|
914
|
+
if (nextVisible) {
|
|
915
|
+
body.insertBefore(item, nextVisible);
|
|
916
|
+
}
|
|
917
|
+
else {
|
|
918
|
+
body.appendChild(item);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
const orderedRowIds = this.getVisibleBodyRowsForReorder().map((r) => Table.getRowIdForRow(r) ?? '');
|
|
922
|
+
const toIndex = orderedRowIds.indexOf(rowId);
|
|
923
|
+
this.rowOrderChange.emit({
|
|
924
|
+
rowId,
|
|
925
|
+
direction,
|
|
926
|
+
orderedRowIds,
|
|
927
|
+
fromIndex,
|
|
928
|
+
toIndex,
|
|
929
|
+
});
|
|
930
|
+
this.announceRowReorder(rowId, orderedRowIds);
|
|
931
|
+
this.clearReorderDragOverClasses();
|
|
932
|
+
if (this.selectable) {
|
|
933
|
+
this.applyBodyCheckboxStates();
|
|
934
|
+
this.applyHeaderCheckboxState();
|
|
935
|
+
this.syncRowSelectedProps();
|
|
936
|
+
}
|
|
937
|
+
this.updateColumnWidths();
|
|
938
|
+
this.reorderKeyboardTimers.requestAnimationFrame(() => {
|
|
939
|
+
if (!this.el.isConnected) {
|
|
940
|
+
return;
|
|
941
|
+
}
|
|
942
|
+
const moved = this.getVisibleBodyRowsForReorder().find((r) => Table.getRowIdForRow(r) === rowId);
|
|
943
|
+
const btn = moved?.querySelector('.xpl-table__row-drag-handle');
|
|
944
|
+
btn?.focus();
|
|
945
|
+
});
|
|
946
|
+
return true;
|
|
947
|
+
}
|
|
948
|
+
ensureFooterReorderCells() {
|
|
949
|
+
const footer = this.getDirectChildTableSection('xpl-table-footer');
|
|
950
|
+
if (!footer)
|
|
951
|
+
return;
|
|
952
|
+
Array.from(footer.children)
|
|
953
|
+
.filter((c) => c.tagName.toLowerCase() === 'xpl-table-row')
|
|
954
|
+
.forEach((row) => {
|
|
955
|
+
if (Array.from(row.children).some((c) => c.tagName.toLowerCase() === 'xpl-table-footer-cell' &&
|
|
956
|
+
c.hasAttribute(ROW_REORDER_MARK))) {
|
|
957
|
+
return;
|
|
958
|
+
}
|
|
959
|
+
const cell = document.createElement('xpl-table-footer-cell');
|
|
960
|
+
cell.setAttribute(ROW_REORDER_MARK, '');
|
|
961
|
+
cell.setAttribute('width', '48');
|
|
962
|
+
cell.setAttribute('align', 'center');
|
|
963
|
+
row.insertBefore(cell, row.firstChild);
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
static supportsSubgridBodyRow() {
|
|
967
|
+
return (typeof CSS !== 'undefined' &&
|
|
968
|
+
typeof CSS.supports === 'function' &&
|
|
969
|
+
CSS.supports('grid-template-columns', 'subgrid'));
|
|
970
|
+
}
|
|
971
|
+
applyReorderRowDraggableState() {
|
|
972
|
+
const useRowDrag = Table.supportsSubgridBodyRow();
|
|
973
|
+
this.queryBodyRows().forEach((row) => {
|
|
974
|
+
const btn = row.querySelector('.xpl-table__row-drag-handle');
|
|
975
|
+
btn?.removeAttribute('draggable');
|
|
976
|
+
row.removeAttribute('draggable');
|
|
977
|
+
if (!this.rowReorderable || row.disabled) {
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
if (!btn) {
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
if (useRowDrag) {
|
|
984
|
+
row.setAttribute('draggable', 'true');
|
|
985
|
+
}
|
|
986
|
+
else {
|
|
987
|
+
btn.setAttribute('draggable', 'true');
|
|
988
|
+
}
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
getVisibleBodyRowsForReorder() {
|
|
992
|
+
return this.queryBodyRows().filter((r) => !r.hasAttribute('hidden'));
|
|
993
|
+
}
|
|
994
|
+
clearReorderDragOverClasses() {
|
|
995
|
+
this.queryBodyRows().forEach((r) => r.classList.remove('xpl-table-row--drag-over'));
|
|
996
|
+
}
|
|
997
|
+
clearPendingDragListeners() {
|
|
998
|
+
if (this.pointerUpClearPending) {
|
|
999
|
+
this.pointerUpClearPending();
|
|
1000
|
+
this.pointerUpClearPending = null;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
announceRowReorder(movedRowId, orderedRowIds) {
|
|
1004
|
+
if (!this.rowReorderable || !movedRowId) {
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
const index = orderedRowIds.indexOf(movedRowId);
|
|
1008
|
+
if (index < 0) {
|
|
1009
|
+
return;
|
|
1010
|
+
}
|
|
1011
|
+
this.reorderLiveMessage = '';
|
|
1012
|
+
if (this.reorderAnnounceRaf !== undefined) {
|
|
1013
|
+
cancelAnimationFrame(this.reorderAnnounceRaf);
|
|
1014
|
+
}
|
|
1015
|
+
this.reorderAnnounceRaf = requestAnimationFrame(() => {
|
|
1016
|
+
this.reorderAnnounceRaf = undefined;
|
|
1017
|
+
if (!this.el.isConnected) {
|
|
1018
|
+
return;
|
|
1019
|
+
}
|
|
1020
|
+
this.reorderLiveMessage = `Row ${movedRowId}, now position ${index + 1} of ${orderedRowIds.length}`;
|
|
1021
|
+
});
|
|
1022
|
+
}
|
|
1023
|
+
pruneStaleSelectedRowIds() {
|
|
1024
|
+
const validIds = new Set(this.queryBodyRows()
|
|
1025
|
+
.map((r) => Table.getRowIdForRow(r))
|
|
1026
|
+
.filter((id) => !!id));
|
|
1027
|
+
const next = this.selectedRowIds.filter((id) => validIds.has(id));
|
|
1028
|
+
if (next.length === this.selectedRowIds.length)
|
|
1029
|
+
return;
|
|
1030
|
+
this.selectedRowIds = next;
|
|
1031
|
+
this.applyBodyCheckboxStates();
|
|
1032
|
+
this.applyHeaderCheckboxState();
|
|
1033
|
+
this.syncRowSelectedProps();
|
|
1034
|
+
this.emitCompositionalSelection();
|
|
1035
|
+
}
|
|
1036
|
+
static getBodyRowCheckboxAriaLabel(row, selectionColIndex) {
|
|
1037
|
+
const cells = Table.getBodyRowCells(row);
|
|
1038
|
+
const labelCell = cells.find((c, i) => (selectionColIndex === null || i !== selectionColIndex) &&
|
|
1039
|
+
!c.hasAttribute(ROW_REORDER_MARK));
|
|
1040
|
+
const first = labelCell ?? cells[0];
|
|
1041
|
+
if (!first)
|
|
1042
|
+
return 'Select row';
|
|
1043
|
+
const raw = first.textContent?.replace(/\s+/g, ' ').trim() ?? '';
|
|
1044
|
+
if (!raw)
|
|
1045
|
+
return 'Select row';
|
|
1046
|
+
const truncated = raw.length > 100 ? `${raw.slice(0, 100)}…` : raw;
|
|
1047
|
+
return `Select row, ${truncated}`;
|
|
1048
|
+
}
|
|
1049
|
+
applyBodyCheckboxStates() {
|
|
1050
|
+
const selectionIdx = this.getSelectionColumnIndex();
|
|
1051
|
+
if (selectionIdx === null)
|
|
1052
|
+
return;
|
|
1053
|
+
this.queryBodyRows().forEach((row) => {
|
|
1054
|
+
const rowId = Table.getRowIdForRow(row);
|
|
1055
|
+
const cells = Table.getBodyRowCells(row);
|
|
1056
|
+
const cell = cells[selectionIdx];
|
|
1057
|
+
const cb = cell?.querySelector('xpl-checkbox');
|
|
1058
|
+
if (!cb || !rowId)
|
|
1059
|
+
return;
|
|
1060
|
+
cb.checked = this.selectedRowIds.includes(rowId);
|
|
1061
|
+
cb.disabled = row.disabled;
|
|
1062
|
+
cb.value = rowId;
|
|
1063
|
+
cb.setAttribute('aria-label', Table.getBodyRowCheckboxAriaLabel(row, selectionIdx));
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
getHeaderCheckboxCell() {
|
|
1067
|
+
const idx = this.getSelectionColumnIndex();
|
|
1068
|
+
if (idx === null)
|
|
1069
|
+
return null;
|
|
1070
|
+
const cells = this.getCompositionalHeaderCells();
|
|
1071
|
+
const cell = cells[idx];
|
|
1072
|
+
if (!cell || cell.getAttribute('type') !== 'checkbox')
|
|
1073
|
+
return null;
|
|
1074
|
+
return cell;
|
|
1075
|
+
}
|
|
1076
|
+
applyHeaderCheckboxState() {
|
|
1077
|
+
const cell = this.getHeaderCheckboxCell();
|
|
1078
|
+
if (!cell)
|
|
1079
|
+
return;
|
|
1080
|
+
const selectableRows = this.querySelectableBodyRows();
|
|
1081
|
+
const ids = selectableRows
|
|
1082
|
+
.map((r) => Table.getRowIdForRow(r))
|
|
1083
|
+
.filter((id) => !!id);
|
|
1084
|
+
const selectedCount = ids.filter((id) => this.selectedRowIds.includes(id)).length;
|
|
1085
|
+
const allSelected = ids.length > 0 && selectedCount === ids.length;
|
|
1086
|
+
const indeterminate = selectedCount > 0 && !allSelected;
|
|
1087
|
+
cell.checked = allSelected;
|
|
1088
|
+
cell.indeterminate = indeterminate;
|
|
1089
|
+
}
|
|
1090
|
+
syncRowSelectedProps() {
|
|
1091
|
+
this.queryBodyRows().forEach((row) => {
|
|
1092
|
+
const id = Table.getRowIdForRow(row);
|
|
1093
|
+
const selected = id ? this.selectedRowIds.includes(id) : false;
|
|
1094
|
+
row.selected = selected;
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
emitCompositionalSelection() {
|
|
1098
|
+
const ids = this.selectedRowIds;
|
|
1099
|
+
const key = ids.join('\u0001');
|
|
1100
|
+
if (key === this.lastEmittedRowSelectionKey) {
|
|
1101
|
+
return;
|
|
1102
|
+
}
|
|
1103
|
+
this.lastEmittedRowSelectionKey = key;
|
|
1104
|
+
this.rowSelectionChange.emit({ selectedRowIds: [...ids] });
|
|
1105
|
+
}
|
|
1106
|
+
isEventFromThisTable(target) {
|
|
1107
|
+
if (target == null || typeof target !== 'object')
|
|
1108
|
+
return false;
|
|
1109
|
+
const t = target;
|
|
1110
|
+
const start = 'closest' in t && typeof t.closest === 'function'
|
|
1111
|
+
? t
|
|
1112
|
+
: 'parentElement' in t
|
|
1113
|
+
? t.parentElement
|
|
1114
|
+
: null;
|
|
1115
|
+
if (!start)
|
|
1116
|
+
return false;
|
|
1117
|
+
const nearest = start.closest('xpl-table');
|
|
1118
|
+
return nearest === this.el;
|
|
1119
|
+
}
|
|
1120
|
+
static sortKeyFromHeaderCell(cell, columnIndex) {
|
|
1121
|
+
const c = cell;
|
|
1122
|
+
const raw = (c.sortKey ?? c.label ?? '').trim();
|
|
1123
|
+
if (raw.length > 0) {
|
|
1124
|
+
return raw.replace(/ /g, '-').toLowerCase();
|
|
1125
|
+
}
|
|
1126
|
+
return `column-${columnIndex}`;
|
|
1127
|
+
}
|
|
1128
|
+
handleCompositionalHeaderSort(ev) {
|
|
1129
|
+
if (this.isLegacyMode)
|
|
1130
|
+
return;
|
|
1131
|
+
if (!this.isEventFromThisTable(ev.target))
|
|
1132
|
+
return;
|
|
1133
|
+
ev.stopPropagation();
|
|
1134
|
+
const source = ev.target;
|
|
1135
|
+
const headerRow = source.closest('xpl-table-header xpl-table-row') ?? source.closest('xpl-table-row');
|
|
1136
|
+
if (!headerRow || !this.el.contains(headerRow))
|
|
1137
|
+
return;
|
|
1138
|
+
const cells = Array.from(headerRow.querySelectorAll('xpl-table-header-cell'));
|
|
1139
|
+
const { columnIndex } = ev.detail;
|
|
1140
|
+
const target = cells[columnIndex];
|
|
1141
|
+
if (!target?.sortable)
|
|
1142
|
+
return;
|
|
1143
|
+
const next = cycleSortDirection(target.sortDirection);
|
|
1144
|
+
cells.forEach((cell, i) => {
|
|
1145
|
+
const hc = cell;
|
|
1146
|
+
if (!hc.sortable)
|
|
1147
|
+
return;
|
|
1148
|
+
hc.sortDirection = i === columnIndex ? next : null;
|
|
1149
|
+
});
|
|
1150
|
+
const sortState = {};
|
|
1151
|
+
cells.forEach((cell, i) => {
|
|
1152
|
+
const hc = cell;
|
|
1153
|
+
if (!hc.sortable)
|
|
1154
|
+
return;
|
|
1155
|
+
sortState[Table.sortKeyFromHeaderCell(hc, i)] = hc.sortDirection ?? null;
|
|
1156
|
+
});
|
|
1157
|
+
const sortTypeArr = cells.map((cell) => {
|
|
1158
|
+
const hc = cell;
|
|
1159
|
+
return hc.sortable ? (hc.sortDirection ?? null) : null;
|
|
1160
|
+
});
|
|
1161
|
+
const colName = Table.sortKeyFromHeaderCell(cells[columnIndex], columnIndex);
|
|
1162
|
+
const detail = {
|
|
1163
|
+
...sortState,
|
|
1164
|
+
colNum: columnIndex,
|
|
1165
|
+
colName,
|
|
1166
|
+
sortTypeArr,
|
|
1167
|
+
};
|
|
1168
|
+
this.sortChanged.emit(detail);
|
|
1169
|
+
}
|
|
1170
|
+
legacySortStatePayload() {
|
|
1171
|
+
const out = {};
|
|
1172
|
+
if (!this.columns?.length)
|
|
1173
|
+
return out;
|
|
1174
|
+
this.columns.forEach((col, i) => {
|
|
1175
|
+
const key = col.replace(/ /g, '-').toLowerCase();
|
|
1176
|
+
out[key] = this.sortTypeArray[i] ?? null;
|
|
1177
|
+
});
|
|
1178
|
+
return out;
|
|
1179
|
+
}
|
|
1180
|
+
legacySortChangedDetail(colNum) {
|
|
1181
|
+
const base = this.legacySortStatePayload();
|
|
1182
|
+
const title = this.columns?.[colNum] ?? '';
|
|
1183
|
+
const colName = title.replace(/ /g, '-').toLowerCase();
|
|
1184
|
+
return {
|
|
1185
|
+
...base,
|
|
1186
|
+
colNum,
|
|
1187
|
+
colName,
|
|
1188
|
+
sortTypeArr: [...this.sortTypeArray],
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
getCompositionalHeaderCells() {
|
|
1192
|
+
const header = Array.from(this.el.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-header') ?? null;
|
|
1193
|
+
if (!header)
|
|
1194
|
+
return [];
|
|
1195
|
+
const firstRow = Array.from(header.children).find((c) => c.tagName.toLowerCase() === 'xpl-table-row');
|
|
1196
|
+
const container = firstRow ?? header;
|
|
1197
|
+
return Array.from(container.children).filter((c) => c.tagName.toLowerCase() === 'xpl-table-header-cell');
|
|
1198
|
+
}
|
|
1199
|
+
updateColumnWidths() {
|
|
1200
|
+
const headerCells = this.getCompositionalHeaderCells();
|
|
1201
|
+
const columnWidths = headerCells.map((cell) => getGridColumnWidthFromHeaderCell(cell));
|
|
1202
|
+
const next = columnWidths.join(' ');
|
|
1203
|
+
const n = headerCells.length;
|
|
1204
|
+
if (n === this.colCount && this.colCount > 0 && this.columnWidthsToken === next) {
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
this.el.style.setProperty('--column-widths', next);
|
|
1208
|
+
this.colCount = n;
|
|
1209
|
+
this.columnWidthsToken = next;
|
|
1210
|
+
}
|
|
1211
|
+
handleSort(clickEvt, isColumnSortable, colNum) {
|
|
1212
|
+
clickEvt.preventDefault();
|
|
1213
|
+
clickEvt.stopPropagation();
|
|
1214
|
+
if (!isColumnSortable)
|
|
1215
|
+
return;
|
|
1216
|
+
this.sortTypeArray = this.sortTypeArray.map((val, i) => {
|
|
1217
|
+
if (i !== colNum)
|
|
1218
|
+
return null;
|
|
1219
|
+
switch (val) {
|
|
1220
|
+
case 'asc':
|
|
1221
|
+
return 'desc';
|
|
1222
|
+
case 'desc':
|
|
1223
|
+
return null;
|
|
1224
|
+
default:
|
|
1225
|
+
return 'asc';
|
|
1226
|
+
}
|
|
1227
|
+
});
|
|
1228
|
+
const evt = this.sortChanged.emit(this.legacySortChangedDetail(colNum));
|
|
1229
|
+
if (!evt.defaultPrevented)
|
|
1230
|
+
this.sortBy(colNum, this.sortTypeArray);
|
|
1231
|
+
}
|
|
1232
|
+
renderLegacy() {
|
|
142
1233
|
if (this.columns &&
|
|
143
1234
|
(!this.sortTypeArray || this.sortTypeArray.length !== this.columns.length)) {
|
|
144
1235
|
this.sortTypeArray = this.columns.map(() => null);
|
|
145
1236
|
}
|
|
146
|
-
|
|
147
|
-
this.sortTypeArray = [];
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
render() {
|
|
151
|
-
const rowFooterData = this.footer !== undefined ? Array.from(this.footer) : [];
|
|
152
|
-
return (h(Host, { key: '1e6bf436320a44e1e22e8590a881bc90c4a091d5' }, h("div", { key: '3d2e5361fbe615a6ae8ebe916ce07e00f82c444c', class: "xpl-table-container", onScroll: this.onScroll, ref: (el) => {
|
|
1237
|
+
return (h(Host, null, h("div", { class: "xpl-table-container", onScroll: this.onLegacyScroll, ref: (el) => {
|
|
153
1238
|
if (el)
|
|
154
1239
|
this.container = el;
|
|
155
|
-
} }, h("table", {
|
|
1240
|
+
} }, h("table", { class: {
|
|
156
1241
|
'xpl-table': true,
|
|
1242
|
+
'xpl-table--legacy': true,
|
|
157
1243
|
'xpl-table--striped': !!this.striped,
|
|
158
1244
|
'xpl-table--freeze': !!this.freeze,
|
|
159
1245
|
'xpl-table--has-scrolled': this.hasScrolled,
|
|
160
|
-
} }, this.columns && (h("thead",
|
|
161
|
-
const iconType = getIconType(this.sortTypeArray?.[i]);
|
|
162
|
-
const isColumnSortable = !!(this.isSortable && this.sortableColumns[i]);
|
|
163
|
-
return (h("th", null, h("label", { onClick: (e) => this.handleSort(e, isColumnSortable, i
|
|
164
|
-
this.selected.some((a) => a), onClick: (e) =>
|
|
165
|
-
|
|
1246
|
+
} }, this.columns && (h("thead", null, this.columns.map((column, i) => {
|
|
1247
|
+
const iconType = getIconType(this.sortTypeArray?.[i] ?? null);
|
|
1248
|
+
const isColumnSortable = !!(this.isSortable && this.sortableColumns?.[i]);
|
|
1249
|
+
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 &&
|
|
1250
|
+
this.selected.some((a) => a), onClick: (e) => {
|
|
1251
|
+
e.stopPropagation();
|
|
1252
|
+
this.selectAll(e);
|
|
1253
|
+
}, type: "checkbox", value: this.selectAllValue })), column, isColumnSortable && !!this.sortTypeArray[i] && (h("xpl-icon", { icon: iconType, size: 16 })))));
|
|
1254
|
+
}))), h("tbody", null, this.rowData.map((row, rowNum) => (h("tr", { class: this.selected && this.selected[rowNum]
|
|
166
1255
|
? 'xpl-table-row-selected'
|
|
167
|
-
: '' }, row.map((cell, i) => (h("td", null, this.multiselect && i === 0 ? (h("label",
|
|
1256
|
+
: '' }, 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 &&
|
|
1257
|
+
this.selectedValues.length > 0
|
|
168
1258
|
? this.selectedValues[rowNum]
|
|
169
|
-
: `xpl-table-checkbox-${rowNum}
|
|
1259
|
+
: `xpl-table-checkbox-${rowNum}` }), h("div", { innerHTML: cell }))) : (h("div", { innerHTML: cell }))))))))), this.rowFooterData?.length > 0 && (h("tfoot", null, this.rowFooterData.map((row) => (h("tr", null, row.map((cell) => (h("td", null, h("div", { innerHTML: cell })))))))))))));
|
|
1260
|
+
}
|
|
1261
|
+
renderCompositional() {
|
|
1262
|
+
const selectionToolbarCount = this.selectedRowIds.length;
|
|
1263
|
+
return (h(Host, { role: "grid", "aria-label": this.label, "aria-colcount": this.colCount > 0 ? this.colCount : undefined, class: {
|
|
1264
|
+
'xpl-table': true,
|
|
1265
|
+
'xpl-table--striped': !!this.striped,
|
|
1266
|
+
'xpl-table--freeze': !!this.freeze,
|
|
1267
|
+
'xpl-table--has-scrolled': this.hasScrolled,
|
|
1268
|
+
'xpl-table--selectable': !!this.selectable,
|
|
1269
|
+
'xpl-table--selection-active': !!this.selectable && this.selectedRowIds.length > 0,
|
|
1270
|
+
'xpl-table--row-reorderable': !!this.rowReorderable,
|
|
1271
|
+
}, 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: {
|
|
1272
|
+
'xpl-toolbar': true,
|
|
1273
|
+
hidden: selectionToolbarCount === 0,
|
|
1274
|
+
'xpl-table__toolbar': true,
|
|
1275
|
+
} }, 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)));
|
|
1276
|
+
}
|
|
1277
|
+
render() {
|
|
1278
|
+
return this.isLegacyMode ? this.renderLegacy() : this.renderCompositional();
|
|
170
1279
|
}
|
|
171
1280
|
get el() { return getElement(this); }
|
|
172
1281
|
static get watchers() { return {
|
|
1282
|
+
"columns": [{
|
|
1283
|
+
"watchColumns": 0
|
|
1284
|
+
}],
|
|
173
1285
|
"data": [{
|
|
174
1286
|
"watchData": 0
|
|
175
1287
|
}],
|
|
176
|
-
"
|
|
177
|
-
"
|
|
1288
|
+
"footer": [{
|
|
1289
|
+
"watchFooterData": 0
|
|
1290
|
+
}],
|
|
1291
|
+
"reorderHandleIcon": [{
|
|
1292
|
+
"watchReorderHandleIcon": 0
|
|
1293
|
+
}],
|
|
1294
|
+
"reorderHandleIconKeyboard": [{
|
|
1295
|
+
"watchReorderHandleIconKeyboard": 0
|
|
1296
|
+
}],
|
|
1297
|
+
"rowReorderable": [{
|
|
1298
|
+
"watchRowReorderable": 0
|
|
1299
|
+
}],
|
|
1300
|
+
"selectable": [{
|
|
1301
|
+
"watchSelectable": 0
|
|
178
1302
|
}]
|
|
179
1303
|
}; }
|
|
180
1304
|
};
|