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