@pine-ds/core 3.12.1 → 3.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/mock-pds-modal.js +9 -5
- package/components/mock-pds-modal.js.map +1 -1
- package/components/pds-alert.js +1 -1
- package/components/pds-alert.js.map +1 -1
- package/components/pds-avatar.js +18 -5
- package/components/pds-avatar.js.map +1 -1
- package/components/pds-button2.js.map +1 -1
- package/components/pds-checkbox2.js.map +1 -1
- package/components/pds-chip2.js.map +1 -1
- package/components/pds-combobox.js +1 -1
- package/components/pds-combobox.js.map +1 -1
- package/components/pds-dropdown-menu-item.js +1 -1
- package/components/pds-dropdown-menu-item.js.map +1 -1
- package/components/pds-filter.js +1 -1
- package/components/pds-filter.js.map +1 -1
- package/components/pds-input.js +6 -2
- package/components/pds-input.js.map +1 -1
- package/components/pds-link2.js +1 -1
- package/components/pds-link2.js.map +1 -1
- package/components/pds-modal.js +7 -6
- package/components/pds-modal.js.map +1 -1
- package/components/pds-radio-group.js +1 -1
- package/components/pds-radio-group.js.map +1 -1
- package/components/pds-radio.js +1 -1
- package/components/pds-radio.js.map +1 -1
- package/components/pds-select.js +14 -2
- package/components/pds-select.js.map +1 -1
- package/components/pds-tab.js +20 -4
- package/components/pds-tab.js.map +1 -1
- package/components/pds-table-cell2.js.map +1 -1
- package/components/pds-table-head-cell2.js +61 -5
- package/components/pds-table-head-cell2.js.map +1 -1
- package/components/pds-table-head.js +15 -3
- package/components/pds-table-head.js.map +1 -1
- package/components/pds-table-row.js +100 -4
- package/components/pds-table-row.js.map +1 -1
- package/components/pds-table.js +50 -3
- package/components/pds-table.js.map +1 -1
- package/components/pds-textarea.js +9 -5
- package/components/pds-textarea.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mock-pds-modal.cjs.entry.js +9 -5
- package/dist/cjs/mock-pds-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-alert.cjs.entry.js +1 -1
- package/dist/cjs/pds-alert.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-avatar.cjs.entry.js +17 -5
- package/dist/cjs/pds-avatar.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-button.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-checkbox.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-chip.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-combobox.cjs.entry.js +1 -1
- package/dist/cjs/pds-combobox.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-dropdown-menu-item.cjs.entry.js +1 -1
- package/dist/cjs/pds-dropdown-menu-item.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-filter.cjs.entry.js +1 -1
- package/dist/cjs/pds-filter.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-input.cjs.entry.js +6 -2
- package/dist/cjs/pds-input.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-link.cjs.entry.js +1 -1
- package/dist/cjs/pds-link.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-modal.cjs.entry.js +7 -6
- package/dist/cjs/pds-modal.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/pds-radio-group.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-radio.cjs.entry.js +1 -1
- package/dist/cjs/pds-radio.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-select.cjs.entry.js +14 -2
- package/dist/cjs/pds-select.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-tab.cjs.entry.js +19 -4
- package/dist/cjs/pds-tab.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-table-cell.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-table-head-cell.cjs.entry.js +57 -4
- package/dist/cjs/pds-table-head-cell.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-table-head.cjs.entry.js +12 -2
- package/dist/cjs/pds-table-head.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-table-row.cjs.entry.js +97 -3
- package/dist/cjs/pds-table-row.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-table.cjs.entry.js +47 -3
- package/dist/cjs/pds-table.entry.cjs.js.map +1 -1
- package/dist/cjs/pds-textarea.cjs.entry.js +9 -5
- package/dist/cjs/pds-textarea.entry.cjs.js.map +1 -1
- package/dist/cjs/pine-core.cjs.js +1 -1
- package/dist/collection/components/pds-alert/pds-alert.css +22 -0
- package/dist/collection/components/pds-avatar/pds-avatar.css +14 -1
- package/dist/collection/components/pds-avatar/pds-avatar.js +39 -4
- package/dist/collection/components/pds-avatar/pds-avatar.js.map +1 -1
- package/dist/collection/components/pds-avatar/stories/pds-avatar.stories.js +15 -0
- package/dist/collection/components/pds-button/pds-button.css +3 -0
- package/dist/collection/components/pds-checkbox/pds-checkbox.css +2 -0
- package/dist/collection/components/pds-chip/pds-chip.css +7 -0
- package/dist/collection/components/pds-combobox/pds-combobox.css +6 -1
- package/dist/collection/components/pds-dropdown-menu/pds-dropdown-menu-item/pds-dropdown-menu-item.css +4 -3
- package/dist/collection/components/pds-filters/pds-filter/pds-filter.css +1 -1
- package/dist/collection/components/pds-input/pds-input.css +5 -3
- package/dist/collection/components/pds-input/pds-input.js +24 -1
- package/dist/collection/components/pds-input/pds-input.js.map +1 -1
- package/dist/collection/components/pds-link/pds-link.css +3 -3
- package/dist/collection/components/pds-modal/pds-modal.css +1 -0
- package/dist/collection/components/pds-modal/pds-modal.js +7 -6
- package/dist/collection/components/pds-modal/pds-modal.js.map +1 -1
- package/dist/collection/components/pds-modal/test/mock-pds-modal.js +10 -6
- package/dist/collection/components/pds-modal/test/mock-pds-modal.js.map +1 -1
- package/dist/collection/components/pds-radio/pds-radio.css +4 -1
- package/dist/collection/components/pds-radio-group/pds-radio-group.css +3 -1
- package/dist/collection/components/pds-select/pds-select.css +5 -3
- package/dist/collection/components/pds-select/pds-select.js +71 -2
- package/dist/collection/components/pds-select/pds-select.js.map +1 -1
- package/dist/collection/components/pds-table/pds-table-cell/pds-table-cell.css +1 -0
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.css +18 -0
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.js +57 -1
- package/dist/collection/components/pds-table/pds-table-head/pds-table-head.js.map +1 -1
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.css +12 -2
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js +87 -4
- package/dist/collection/components/pds-table/pds-table-head-cell/pds-table-head-cell.js.map +1 -1
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.css +10 -0
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.js +102 -2
- package/dist/collection/components/pds-table/pds-table-row/pds-table-row.js.map +1 -1
- package/dist/collection/components/pds-table/pds-table.css +2 -0
- package/dist/collection/components/pds-table/pds-table.js +112 -3
- package/dist/collection/components/pds-table/pds-table.js.map +1 -1
- package/dist/collection/components/pds-table/stories/pds-table.stories.js +150 -5
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.css +23 -4
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.js +41 -3
- package/dist/collection/components/pds-tabs/pds-tab/pds-tab.js.map +1 -1
- package/dist/collection/components/pds-textarea/pds-textarea.css +3 -1
- package/dist/collection/components/pds-textarea/pds-textarea.js +27 -4
- package/dist/collection/components/pds-textarea/pds-textarea.js.map +1 -1
- package/dist/docs.json +341 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mock-pds-modal.entry.js +9 -5
- package/dist/esm/mock-pds-modal.entry.js.map +1 -1
- package/dist/esm/pds-alert.entry.js +1 -1
- package/dist/esm/pds-alert.entry.js.map +1 -1
- package/dist/esm/pds-avatar.entry.js +17 -5
- package/dist/esm/pds-avatar.entry.js.map +1 -1
- package/dist/esm/pds-button.entry.js.map +1 -1
- package/dist/esm/pds-checkbox.entry.js.map +1 -1
- package/dist/esm/pds-chip.entry.js.map +1 -1
- package/dist/esm/pds-combobox.entry.js +1 -1
- package/dist/esm/pds-combobox.entry.js.map +1 -1
- package/dist/esm/pds-dropdown-menu-item.entry.js +1 -1
- package/dist/esm/pds-dropdown-menu-item.entry.js.map +1 -1
- package/dist/esm/pds-filter.entry.js +1 -1
- package/dist/esm/pds-filter.entry.js.map +1 -1
- package/dist/esm/pds-input.entry.js +6 -2
- package/dist/esm/pds-input.entry.js.map +1 -1
- package/dist/esm/pds-link.entry.js +1 -1
- package/dist/esm/pds-link.entry.js.map +1 -1
- package/dist/esm/pds-modal.entry.js +7 -6
- package/dist/esm/pds-modal.entry.js.map +1 -1
- package/dist/esm/pds-radio-group.entry.js +1 -1
- package/dist/esm/pds-radio-group.entry.js.map +1 -1
- package/dist/esm/pds-radio.entry.js +1 -1
- package/dist/esm/pds-radio.entry.js.map +1 -1
- package/dist/esm/pds-select.entry.js +14 -2
- package/dist/esm/pds-select.entry.js.map +1 -1
- package/dist/esm/pds-tab.entry.js +19 -4
- package/dist/esm/pds-tab.entry.js.map +1 -1
- package/dist/esm/pds-table-cell.entry.js.map +1 -1
- package/dist/esm/pds-table-head-cell.entry.js +57 -4
- package/dist/esm/pds-table-head-cell.entry.js.map +1 -1
- package/dist/esm/pds-table-head.entry.js +12 -2
- package/dist/esm/pds-table-head.entry.js.map +1 -1
- package/dist/esm/pds-table-row.entry.js +97 -3
- package/dist/esm/pds-table-row.entry.js.map +1 -1
- package/dist/esm/pds-table.entry.js +47 -3
- package/dist/esm/pds-table.entry.js.map +1 -1
- package/dist/esm/pds-textarea.entry.js +9 -5
- package/dist/esm/pds-textarea.entry.js.map +1 -1
- package/dist/esm/pine-core.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mock-pds-modal.entry.js +1 -1
- package/dist/esm-es5/mock-pds-modal.entry.js.map +1 -1
- package/dist/esm-es5/pds-alert.entry.js +1 -1
- package/dist/esm-es5/pds-alert.entry.js.map +1 -1
- package/dist/esm-es5/pds-avatar.entry.js +1 -1
- package/dist/esm-es5/pds-avatar.entry.js.map +1 -1
- package/dist/esm-es5/pds-button.entry.js.map +1 -1
- package/dist/esm-es5/pds-checkbox.entry.js.map +1 -1
- package/dist/esm-es5/pds-chip.entry.js.map +1 -1
- package/dist/esm-es5/pds-combobox.entry.js +1 -1
- package/dist/esm-es5/pds-combobox.entry.js.map +1 -1
- package/dist/esm-es5/pds-dropdown-menu-item.entry.js +1 -1
- package/dist/esm-es5/pds-dropdown-menu-item.entry.js.map +1 -1
- package/dist/esm-es5/pds-filter.entry.js +1 -1
- package/dist/esm-es5/pds-filter.entry.js.map +1 -1
- package/dist/esm-es5/pds-input.entry.js +1 -1
- package/dist/esm-es5/pds-input.entry.js.map +1 -1
- package/dist/esm-es5/pds-link.entry.js +1 -1
- package/dist/esm-es5/pds-link.entry.js.map +1 -1
- package/dist/esm-es5/pds-modal.entry.js +1 -1
- package/dist/esm-es5/pds-modal.entry.js.map +1 -1
- package/dist/esm-es5/pds-radio-group.entry.js +1 -1
- package/dist/esm-es5/pds-radio-group.entry.js.map +1 -1
- package/dist/esm-es5/pds-radio.entry.js +1 -1
- package/dist/esm-es5/pds-radio.entry.js.map +1 -1
- package/dist/esm-es5/pds-select.entry.js +1 -1
- package/dist/esm-es5/pds-select.entry.js.map +1 -1
- package/dist/esm-es5/pds-tab.entry.js +1 -1
- package/dist/esm-es5/pds-tab.entry.js.map +1 -1
- package/dist/esm-es5/pds-table-cell.entry.js.map +1 -1
- package/dist/esm-es5/pds-table-head-cell.entry.js +1 -1
- package/dist/esm-es5/pds-table-head-cell.entry.js.map +1 -1
- package/dist/esm-es5/pds-table-head.entry.js +1 -1
- package/dist/esm-es5/pds-table-head.entry.js.map +1 -1
- package/dist/esm-es5/pds-table-row.entry.js +1 -1
- package/dist/esm-es5/pds-table-row.entry.js.map +1 -1
- package/dist/esm-es5/pds-table.entry.js +1 -1
- package/dist/esm-es5/pds-table.entry.js.map +1 -1
- package/dist/esm-es5/pds-textarea.entry.js +1 -1
- package/dist/esm-es5/pds-textarea.entry.js.map +1 -1
- package/dist/esm-es5/pine-core.js +1 -1
- package/dist/pine-core/mock-pds-modal.entry.esm.js.map +1 -1
- package/dist/pine-core/p--gPqixhD.system.js.map +1 -1
- package/dist/pine-core/p-002fe322.system.entry.js +2 -0
- package/dist/pine-core/p-002fe322.system.entry.js.map +1 -0
- package/dist/pine-core/p-098cbcd7.system.entry.js +2 -0
- package/dist/pine-core/p-098cbcd7.system.entry.js.map +1 -0
- package/dist/pine-core/p-35f644cf.system.entry.js +2 -0
- package/dist/pine-core/{p-36ad78b5.system.entry.js.map → p-35f644cf.system.entry.js.map} +1 -1
- package/dist/pine-core/p-41d89f20.entry.js +2 -0
- package/dist/pine-core/p-41d89f20.entry.js.map +1 -0
- package/dist/pine-core/p-478d1107.entry.js +2 -0
- package/dist/pine-core/{p-41cc9270.entry.js.map → p-478d1107.entry.js.map} +1 -1
- package/dist/pine-core/p-4SEjggIC.system.js.map +1 -0
- package/dist/pine-core/p-4d25449c.entry.js +2 -0
- package/dist/pine-core/p-4d25449c.entry.js.map +1 -0
- package/dist/pine-core/p-534e44cb.system.entry.js +4 -0
- package/dist/pine-core/{p-bee8d4b8.system.entry.js.map → p-534e44cb.system.entry.js.map} +1 -1
- package/dist/pine-core/p-54a56826.entry.js +3 -0
- package/dist/pine-core/{p-66160018.entry.js.map → p-54a56826.entry.js.map} +1 -1
- package/dist/pine-core/p-5b7ab891.entry.js +2 -0
- package/dist/pine-core/{p-233a6680.entry.js.map → p-5b7ab891.entry.js.map} +1 -1
- package/dist/pine-core/p-646ac76d.entry.js +2 -0
- package/dist/pine-core/p-646ac76d.entry.js.map +1 -0
- package/dist/pine-core/p-6bc7d67f.system.entry.js +2 -0
- package/dist/pine-core/{p-c03e2c5d.system.entry.js.map → p-6bc7d67f.system.entry.js.map} +1 -1
- package/dist/pine-core/p-6fcac53b.entry.js +2 -0
- package/dist/pine-core/{p-96be2d57.entry.js.map → p-6fcac53b.entry.js.map} +1 -1
- package/dist/pine-core/{p-2d3da08b.system.entry.js → p-8f2a5a4c.system.entry.js} +2 -2
- package/dist/pine-core/p-8f2a5a4c.system.entry.js.map +1 -0
- package/dist/pine-core/{p-43f1eead.entry.js → p-9b3794cd.entry.js} +2 -2
- package/dist/pine-core/p-9b3794cd.entry.js.map +1 -0
- package/dist/pine-core/p-9bfaed7e.system.entry.js +2 -0
- package/dist/pine-core/p-9bfaed7e.system.entry.js.map +1 -0
- package/dist/pine-core/p-9c0ec80a.entry.js +2 -0
- package/dist/pine-core/p-9c0ec80a.entry.js.map +1 -0
- package/dist/pine-core/{p-3f8a5f3d.system.entry.js → p-9d6b6ff3.system.entry.js} +2 -2
- package/dist/pine-core/p-9d6b6ff3.system.entry.js.map +1 -0
- package/dist/pine-core/p-9e62c418.system.entry.js +2 -0
- package/dist/pine-core/p-9e62c418.system.entry.js.map +1 -0
- package/dist/pine-core/p-B4EMeCRH.system.js.map +1 -0
- package/dist/pine-core/p-BCKPcTKX.system.js.map +1 -0
- package/dist/pine-core/p-B_Co5NfG.system.js.map +1 -0
- package/dist/pine-core/p-Bjj4Pcbb.system.js.map +1 -0
- package/dist/pine-core/p-Bnp3zJ0T.system.js.map +1 -0
- package/dist/pine-core/p-C48G0LPH.system.js.map +1 -0
- package/dist/pine-core/p-CCgKUhC7.system.js.map +1 -0
- package/dist/pine-core/p-CTfQ_9yC.system.js.map +1 -0
- package/dist/pine-core/p-CXGuX44q.system.js.map +1 -1
- package/dist/pine-core/p-DAvCgWA9.system.js.map +1 -0
- package/dist/pine-core/p-DSwKfctG.system.js.map +1 -0
- package/dist/pine-core/p-DfCCzxYg.system.js.map +1 -0
- package/dist/pine-core/p-DpeOrUYB.system.js.map +1 -1
- package/dist/pine-core/p-DyrNlfLT.system.js.map +1 -0
- package/dist/pine-core/p-JAVnELnm.system.js +1 -1
- package/dist/pine-core/p-LEkjdrKv.system.js.map +1 -0
- package/dist/pine-core/p-PMNjgK0C.system.js.map +1 -0
- package/dist/pine-core/p-WhfStK1C.system.js.map +1 -1
- package/dist/pine-core/p-XCTiWii8.system.js.map +1 -0
- package/dist/pine-core/p-a737df90.entry.js +2 -0
- package/dist/pine-core/{p-d5731a05.entry.js.map → p-a737df90.entry.js.map} +1 -1
- package/dist/pine-core/p-a847fad3.entry.js +2 -0
- package/dist/pine-core/p-a847fad3.entry.js.map +1 -0
- package/dist/pine-core/p-ac2f9463.entry.js +2 -0
- package/dist/pine-core/p-ac2f9463.entry.js.map +1 -0
- package/dist/pine-core/p-b30424e3.system.entry.js +2 -0
- package/dist/pine-core/{p-a4d094da.system.entry.js.map → p-b30424e3.system.entry.js.map} +1 -1
- package/dist/pine-core/p-bbc349b3.system.entry.js +2 -0
- package/dist/pine-core/p-bbc349b3.system.entry.js.map +1 -0
- package/dist/pine-core/p-cb6c279a.system.entry.js +2 -0
- package/dist/pine-core/{p-6bc81a5b.system.entry.js.map → p-cb6c279a.system.entry.js.map} +1 -1
- package/dist/pine-core/p-cf2e1c07.system.entry.js +2 -0
- package/dist/pine-core/{p-e31ea2ae.system.entry.js.map → p-cf2e1c07.system.entry.js.map} +1 -1
- package/dist/pine-core/p-d98310b9.system.entry.js +2 -0
- package/dist/pine-core/p-d98310b9.system.entry.js.map +1 -0
- package/dist/pine-core/{p-b8047816.system.entry.js → p-dcc6ad67.system.entry.js} +2 -2
- package/dist/pine-core/{p-b8047816.system.entry.js.map → p-dcc6ad67.system.entry.js.map} +1 -1
- package/dist/pine-core/p-e011d7e5.entry.js +2 -0
- package/dist/pine-core/p-e011d7e5.entry.js.map +1 -0
- package/dist/pine-core/p-e2104c31.entry.js +2 -0
- package/dist/pine-core/{p-66597ea5.entry.js.map → p-e2104c31.entry.js.map} +1 -1
- package/dist/pine-core/p-e3d76aa3.system.entry.js +2 -0
- package/dist/pine-core/p-e3d76aa3.system.entry.js.map +1 -0
- package/dist/pine-core/p-e8aad8dc.entry.js +2 -0
- package/dist/pine-core/p-e8aad8dc.entry.js.map +1 -0
- package/dist/pine-core/p-f69d3fd6.entry.js +2 -0
- package/dist/pine-core/p-f69d3fd6.entry.js.map +1 -0
- package/dist/pine-core/p-f79f6f08.system.entry.js +2 -0
- package/dist/pine-core/p-f79f6f08.system.entry.js.map +1 -0
- package/dist/pine-core/p-f82b464c.entry.js +2 -0
- package/dist/pine-core/{p-4c0797f2.entry.js.map → p-f82b464c.entry.js.map} +1 -1
- package/dist/pine-core/p-fc0ee6da.entry.js +2 -0
- package/dist/pine-core/p-fc0ee6da.entry.js.map +1 -0
- package/dist/pine-core/p-fe28b975.system.entry.js +2 -0
- package/dist/pine-core/p-fe28b975.system.entry.js.map +1 -0
- package/dist/pine-core/p-jBhqNO5u.system.js.map +1 -0
- package/dist/pine-core/p-r_cS5LMw.system.js.map +1 -0
- package/dist/pine-core/pds-alert.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-avatar.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-button.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-checkbox.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-chip.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-combobox.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-dropdown-menu-item.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-filter.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-input.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-link.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-modal.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-radio-group.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-radio.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-select.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-tab.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-table-cell.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-table-head-cell.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-table-head.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-table-row.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-table.entry.esm.js.map +1 -1
- package/dist/pine-core/pds-textarea.entry.esm.js.map +1 -1
- package/dist/pine-core/pine-core.esm.js +1 -1
- package/dist/types/components/pds-avatar/pds-avatar.d.ts +5 -0
- package/dist/types/components/pds-input/pds-input.d.ts +5 -0
- package/dist/types/components/pds-modal/test/mock-pds-modal.d.ts +2 -2
- package/dist/types/components/pds-select/pds-select.d.ts +16 -1
- package/dist/types/components/pds-table/pds-table-head/pds-table-head.d.ts +10 -0
- package/dist/types/components/pds-table/pds-table-head-cell/pds-table-head-cell.d.ts +18 -1
- package/dist/types/components/pds-table/pds-table-row/pds-table-row.d.ts +19 -0
- package/dist/types/components/pds-table/pds-table.d.ts +22 -1
- package/dist/types/components/pds-tabs/pds-tab/pds-tab.d.ts +6 -0
- package/dist/types/components/pds-textarea/pds-textarea.d.ts +5 -0
- package/dist/types/components.d.ts +101 -3
- package/dist/vscode.html-data.json +63 -6
- package/hydrate/index.js +318 -53
- package/hydrate/index.mjs +318 -53
- package/package.json +5 -5
- package/dist/pine-core/p-04f92b5a.system.entry.js +0 -2
- package/dist/pine-core/p-04f92b5a.system.entry.js.map +0 -1
- package/dist/pine-core/p-11d69ad5.system.entry.js +0 -2
- package/dist/pine-core/p-11d69ad5.system.entry.js.map +0 -1
- package/dist/pine-core/p-1282026f.entry.js +0 -2
- package/dist/pine-core/p-1282026f.entry.js.map +0 -1
- package/dist/pine-core/p-233a6680.entry.js +0 -2
- package/dist/pine-core/p-2d3da08b.system.entry.js.map +0 -1
- package/dist/pine-core/p-36ad78b5.system.entry.js +0 -2
- package/dist/pine-core/p-372a6081.entry.js +0 -2
- package/dist/pine-core/p-372a6081.entry.js.map +0 -1
- package/dist/pine-core/p-3f8a5f3d.system.entry.js.map +0 -1
- package/dist/pine-core/p-3fd0f8a9.system.entry.js +0 -2
- package/dist/pine-core/p-3fd0f8a9.system.entry.js.map +0 -1
- package/dist/pine-core/p-41cc9270.entry.js +0 -2
- package/dist/pine-core/p-43f1eead.entry.js.map +0 -1
- package/dist/pine-core/p-46e5a568.entry.js +0 -2
- package/dist/pine-core/p-46e5a568.entry.js.map +0 -1
- package/dist/pine-core/p-4c0797f2.entry.js +0 -2
- package/dist/pine-core/p-5d7c4fbb.entry.js +0 -2
- package/dist/pine-core/p-5d7c4fbb.entry.js.map +0 -1
- package/dist/pine-core/p-6150fb43.system.entry.js +0 -2
- package/dist/pine-core/p-6150fb43.system.entry.js.map +0 -1
- package/dist/pine-core/p-65c566a2.system.entry.js +0 -2
- package/dist/pine-core/p-65c566a2.system.entry.js.map +0 -1
- package/dist/pine-core/p-66160018.entry.js +0 -3
- package/dist/pine-core/p-66597ea5.entry.js +0 -2
- package/dist/pine-core/p-6bc81a5b.system.entry.js +0 -2
- package/dist/pine-core/p-6c3299f9.system.entry.js +0 -2
- package/dist/pine-core/p-6c3299f9.system.entry.js.map +0 -1
- package/dist/pine-core/p-6de73f62.entry.js +0 -2
- package/dist/pine-core/p-6de73f62.entry.js.map +0 -1
- package/dist/pine-core/p-8d6fa6f7.entry.js +0 -2
- package/dist/pine-core/p-8d6fa6f7.entry.js.map +0 -1
- package/dist/pine-core/p-96be2d57.entry.js +0 -2
- package/dist/pine-core/p-9ddf4f1f.entry.js +0 -2
- package/dist/pine-core/p-9ddf4f1f.entry.js.map +0 -1
- package/dist/pine-core/p-B81sAPMq.system.js.map +0 -1
- package/dist/pine-core/p-BUwuPP5j.system.js.map +0 -1
- package/dist/pine-core/p-BVjyFx0r.system.js.map +0 -1
- package/dist/pine-core/p-C9T6sYau.system.js.map +0 -1
- package/dist/pine-core/p-CWaidsBR.system.js.map +0 -1
- package/dist/pine-core/p-Ch7MRoFE.system.js.map +0 -1
- package/dist/pine-core/p-CiqRCskL.system.js.map +0 -1
- package/dist/pine-core/p-CoF_9_BM.system.js.map +0 -1
- package/dist/pine-core/p-CrzS8Mmy.system.js.map +0 -1
- package/dist/pine-core/p-Cwz8YTwo.system.js.map +0 -1
- package/dist/pine-core/p-DaQV83Gx.system.js.map +0 -1
- package/dist/pine-core/p-GKNvlYGa.system.js.map +0 -1
- package/dist/pine-core/p-Ma8AuMzD.system.js.map +0 -1
- package/dist/pine-core/p-RO-Y2DRT.system.js.map +0 -1
- package/dist/pine-core/p-a4d094da.system.entry.js +0 -2
- package/dist/pine-core/p-ac050f83.entry.js +0 -2
- package/dist/pine-core/p-ac050f83.entry.js.map +0 -1
- package/dist/pine-core/p-b59ac781.entry.js +0 -2
- package/dist/pine-core/p-b59ac781.entry.js.map +0 -1
- package/dist/pine-core/p-b6a503cc.system.entry.js +0 -2
- package/dist/pine-core/p-b6a503cc.system.entry.js.map +0 -1
- package/dist/pine-core/p-b9a14564.system.entry.js +0 -2
- package/dist/pine-core/p-b9a14564.system.entry.js.map +0 -1
- package/dist/pine-core/p-bee8d4b8.system.entry.js +0 -4
- package/dist/pine-core/p-c03e2c5d.system.entry.js +0 -2
- package/dist/pine-core/p-c2d17093.system.entry.js +0 -2
- package/dist/pine-core/p-c2d17093.system.entry.js.map +0 -1
- package/dist/pine-core/p-cf4df489.entry.js +0 -2
- package/dist/pine-core/p-cf4df489.entry.js.map +0 -1
- package/dist/pine-core/p-d5731a05.entry.js +0 -2
- package/dist/pine-core/p-e31ea2ae.system.entry.js +0 -2
- package/dist/pine-core/p-eHySdsWM.system.js.map +0 -1
- package/dist/pine-core/p-qkIMFuAW.system.js.map +0 -1
- package/dist/pine-core/p-s-tFgs4I.system.js.map +0 -1
- package/dist/pine-core/p-uv97KtT8.system.js.map +0 -1
|
@@ -18,6 +18,16 @@ export class PdsTableHeadCell {
|
|
|
18
18
|
* @defaultValue false
|
|
19
19
|
*/
|
|
20
20
|
this.isSelected = false;
|
|
21
|
+
/**
|
|
22
|
+
* Determines if the parent table-head has the border attribute.
|
|
23
|
+
* @defaultValue false
|
|
24
|
+
*/
|
|
25
|
+
this.hasHeadBorder = false;
|
|
26
|
+
/**
|
|
27
|
+
* Determines if the parent table-head has the background attribute.
|
|
28
|
+
* @defaultValue false
|
|
29
|
+
*/
|
|
30
|
+
this.hasHeadBackground = false;
|
|
21
31
|
/**
|
|
22
32
|
* Handles scroll events to update fixed column shadow state.
|
|
23
33
|
* Updates the tableScrolling state to control CSS classes for fixed column shadows.
|
|
@@ -46,8 +56,25 @@ export class PdsTableHeadCell {
|
|
|
46
56
|
}
|
|
47
57
|
};
|
|
48
58
|
}
|
|
49
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Programmatically sets this column as the active sort column with the specified direction.
|
|
61
|
+
* Used by pds-table to apply a default sort on initial load.
|
|
62
|
+
* @param direction - The sort direction to apply ('asc' or 'desc')
|
|
63
|
+
*/
|
|
64
|
+
async setActiveSort(direction) {
|
|
65
|
+
if (!this.sortable)
|
|
66
|
+
return;
|
|
67
|
+
this.sortingDirection = direction;
|
|
68
|
+
this.hostElement.classList.add('is-active');
|
|
69
|
+
}
|
|
70
|
+
componentWillLoad() {
|
|
71
|
+
// Set initial references and state before first render
|
|
50
72
|
this.tableRef = this.hostElement.closest('pds-table');
|
|
73
|
+
const tableHead = this.hostElement.closest('pds-table-head');
|
|
74
|
+
if (tableHead) {
|
|
75
|
+
this.hasHeadBorder = tableHead.hasAttribute('border');
|
|
76
|
+
this.hasHeadBackground = tableHead.hasAttribute('background');
|
|
77
|
+
}
|
|
51
78
|
}
|
|
52
79
|
componentDidLoad() {
|
|
53
80
|
if (this.tableRef && this.tableRef.responsive && this.tableRef.fixedColumn) {
|
|
@@ -55,9 +82,29 @@ export class PdsTableHeadCell {
|
|
|
55
82
|
// This enables the first column header to show a shadow when the table is scrolled horizontally
|
|
56
83
|
this.setupScrollListener();
|
|
57
84
|
}
|
|
85
|
+
// Watch for changes to the parent table-head's border and background attributes
|
|
86
|
+
const tableHead = this.hostElement.closest('pds-table-head');
|
|
87
|
+
if (tableHead && typeof MutationObserver !== 'undefined') {
|
|
88
|
+
// Defensive guard: disconnect existing observer before creating a new one
|
|
89
|
+
if (this.headObserver) {
|
|
90
|
+
this.headObserver.disconnect();
|
|
91
|
+
}
|
|
92
|
+
this.headObserver = new MutationObserver(() => {
|
|
93
|
+
// Update state when border or background attributes change
|
|
94
|
+
this.hasHeadBorder = tableHead.hasAttribute('border');
|
|
95
|
+
this.hasHeadBackground = tableHead.hasAttribute('background');
|
|
96
|
+
});
|
|
97
|
+
this.headObserver.observe(tableHead, {
|
|
98
|
+
attributes: true,
|
|
99
|
+
attributeFilter: ['border', 'background']
|
|
100
|
+
});
|
|
101
|
+
}
|
|
58
102
|
}
|
|
59
103
|
disconnectedCallback() {
|
|
60
104
|
this.cleanupScrollListener();
|
|
105
|
+
if (this.headObserver) {
|
|
106
|
+
this.headObserver.disconnect();
|
|
107
|
+
}
|
|
61
108
|
}
|
|
62
109
|
setupScrollListener() {
|
|
63
110
|
var _a;
|
|
@@ -115,14 +162,20 @@ export class PdsTableHeadCell {
|
|
|
115
162
|
if (this.tableRef && this.tableRef.fixedColumn && this.tableScrolling) {
|
|
116
163
|
classNames.push('has-scrolled');
|
|
117
164
|
}
|
|
165
|
+
if (this.hasHeadBackground) {
|
|
166
|
+
classNames.push('has-head-background');
|
|
167
|
+
}
|
|
168
|
+
if (this.hasHeadBorder) {
|
|
169
|
+
classNames.push('has-head-border');
|
|
170
|
+
}
|
|
118
171
|
return classNames.join(' ');
|
|
119
172
|
}
|
|
120
173
|
render() {
|
|
121
|
-
return (h(Host, { key: '
|
|
174
|
+
return (h(Host, { key: '18228c7b1950668f12f983d9e5364bbf2deb3f1a', class: this.classNames(), role: "columnheader", onClick: this.toggleSort, part: "head-cell", style: this.tableRef &&
|
|
122
175
|
this.tableRef.fixedColumn &&
|
|
123
176
|
this.tableRef.selectable
|
|
124
177
|
? { '--fixed-cell-position': '40px' }
|
|
125
|
-
: {} }, h("slot", { key: '
|
|
178
|
+
: {} }, h("slot", { key: '283f5e031cc8fe521c25af8060ce51c3ebaffa93' }), this.sortable && (h("pds-icon", { key: 'a7e172c6fbf1185ab9885af04bcf2f2449370e6b', icon: this.sortingDirection === 'asc' ? upSmall : downSmall, part: "sort-icon" }))));
|
|
126
179
|
}
|
|
127
180
|
static get is() { return "pds-table-head-cell"; }
|
|
128
181
|
static get encapsulation() { return "shadow"; }
|
|
@@ -182,7 +235,9 @@ export class PdsTableHeadCell {
|
|
|
182
235
|
return {
|
|
183
236
|
"sortingDirection": {},
|
|
184
237
|
"tableScrolling": {},
|
|
185
|
-
"isSelected": {}
|
|
238
|
+
"isSelected": {},
|
|
239
|
+
"hasHeadBorder": {},
|
|
240
|
+
"hasHeadBackground": {}
|
|
186
241
|
};
|
|
187
242
|
}
|
|
188
243
|
static get events() {
|
|
@@ -203,6 +258,34 @@ export class PdsTableHeadCell {
|
|
|
203
258
|
}
|
|
204
259
|
}];
|
|
205
260
|
}
|
|
261
|
+
static get methods() {
|
|
262
|
+
return {
|
|
263
|
+
"setActiveSort": {
|
|
264
|
+
"complexType": {
|
|
265
|
+
"signature": "(direction: \"asc\" | \"desc\") => Promise<void>",
|
|
266
|
+
"parameters": [{
|
|
267
|
+
"name": "direction",
|
|
268
|
+
"type": "\"desc\" | \"asc\"",
|
|
269
|
+
"docs": "- The sort direction to apply ('asc' or 'desc')"
|
|
270
|
+
}],
|
|
271
|
+
"references": {
|
|
272
|
+
"Promise": {
|
|
273
|
+
"location": "global",
|
|
274
|
+
"id": "global::Promise"
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
"return": "Promise<void>"
|
|
278
|
+
},
|
|
279
|
+
"docs": {
|
|
280
|
+
"text": "Programmatically sets this column as the active sort column with the specified direction.\nUsed by pds-table to apply a default sort on initial load.",
|
|
281
|
+
"tags": [{
|
|
282
|
+
"name": "param",
|
|
283
|
+
"text": "direction - The sort direction to apply ('asc' or 'desc')"
|
|
284
|
+
}]
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
206
289
|
static get elementRef() { return "hostElement"; }
|
|
207
290
|
}
|
|
208
291
|
//# sourceMappingURL=pds-table-head-cell.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-table-head-cell.js","sourceRoot":"","sources":["../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,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACjC,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,gBAAgB,KAAK,IAAI,EAAE,CAAC;YACpD,UAAU,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACnD,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACtE,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDACH,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,EACxB,IAAI,EAAC,cAAc,EACnB,OAAO,EAAE,IAAI,CAAC,UAAU,EACxB,IAAI,EAAC,WAAW,EAChB,KAAK,EACH,IAAI,CAAC,QAAQ;gBACb,IAAI,CAAC,QAAQ,CAAC,WAAW;gBACzB,IAAI,CAAC,QAAQ,CAAC,UAAU;gBACtB,CAAC,CAAC,EAAE,uBAAuB,EAAE,MAAM,EAAE;gBACrC,CAAC,CAAC,EAAE;YAGR,8DAAa;YACZ,IAAI,CAAC,QAAQ,IAAI,CAChB,iEAAU,IAAI,EAAE,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAC,WAAW,GAAG,CAC3F,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, Prop, h, Event, EventEmitter, State } from '@stencil/core';\n\nimport { downSmall, upSmall } from '@pine-ds/icons/icons';\n\n@Component({\n tag: 'pds-table-head-cell',\n styleUrls: ['pds-table-head-cell.scss'],\n shadow: true,\n})\nexport class PdsTableHeadCell {\n @Element() hostElement: HTMLPdsTableHeadCellElement;\n private tableRef: HTMLPdsTableElement;\n private scrollContainer: HTMLElement | null = null;\n private setupTimer: number | undefined;\n private setupRetries: number = 0;\n\n /**\n * Sets the text alignment within the head cell.\n */\n @Prop() cellAlign?: 'start' | 'center' | 'end' | 'justify';\n\n /**\n * Determines whether the table column is sortable when set to `true`.\n */\n @Prop() sortable: boolean;\n\n /**\n * Event emitted to signal that a table column header has been sorted, providing information about the sorted column's name and sorting direction.\n */\n @Event() pdsTableSort: EventEmitter<{ column: string; direction: string }>;\n\n /**\n * The direction of sorting.\n */\n @State() private sortingDirection: 'asc' | 'desc' = 'asc';\n\n /**\n * Determines if the table is currently scrolling.\n * @defaultValue false\n */\n @State() private tableScrolling: boolean = false;\n\n /**\n * Determines if the table row is currently selected.\n * @defaultValue false\n */\n @State() isSelected: boolean = false;\n\n componentWillRender() {\n this.tableRef = this.hostElement.closest('pds-table') as HTMLPdsTableElement;\n }\n\n componentDidLoad() {\n if (this.tableRef && this.tableRef.responsive && this.tableRef.fixedColumn) {\n // For responsive tables with fixed columns, set up scroll detection\n // This enables the first column header to show a shadow when the table is scrolled horizontally\n this.setupScrollListener();\n }\n }\n\n disconnectedCallback() {\n this.cleanupScrollListener();\n }\n\n private setupScrollListener() {\n if (!this.tableRef) return;\n\n // Query shadowRoot once and cache the container\n const container = this.tableRef.shadowRoot?.querySelector('.pds-table-responsive-container') as HTMLElement;\n\n if (container) {\n // Container available immediately\n this.scrollContainer = container;\n this.scrollContainer.addEventListener('scroll', this.handleScroll, { passive: true });\n this.handleScroll(); // Initial check\n this.setupRetries = 0; // Reset counter on success\n } else {\n // Container not ready, set up timer for retry with bounds\n this.setupTimer = window.setTimeout(() => {\n if (this.scrollContainer) return; // Already found\n this.setupRetries = (this.setupRetries || 0) + 1;\n if (this.setupRetries <= 50) {\n this.setupScrollListener();\n } else {\n console.warn('Failed to find responsive container after 50 attempts');\n }\n }, 100);\n }\n }\n\n private cleanupScrollListener() {\n if (this.scrollContainer) {\n this.scrollContainer.removeEventListener('scroll', this.handleScroll);\n this.scrollContainer = null;\n }\n\n if (this.setupTimer !== undefined) {\n window.clearTimeout(this.setupTimer);\n this.setupTimer = undefined;\n }\n\n this.setupRetries = 0; // Reset retry counter\n }\n\n /**\n * Handles scroll events to update fixed column shadow state.\n * Updates the tableScrolling state to control CSS classes for fixed column shadows.\n * @private\n */\n private handleScroll = () => {\n if (!this.scrollContainer) {\n return;\n }\n\n try {\n this.tableScrolling = this.scrollContainer.scrollLeft > 0;\n } catch (error) {\n console.warn('Scroll handler error:', error);\n }\n };\n\n private toggleSort = () => {\n if (this.sortable) {\n const column = this.hostElement.innerText.trim();\n this.sortingDirection = this.sortingDirection === 'asc' ? 'desc' : 'asc';\n\n this.tableRef.querySelectorAll('pds-table-head-cell').forEach((headCell) => {\n headCell.classList.remove('is-active');\n });\n\n this.hostElement.classList.toggle('is-active');\n this.pdsTableSort.emit({ column, direction: this.sortingDirection });\n }\n }\n\n private classNames() {\n const classNames = [];\n\n if (this.tableRef && this.tableRef.compact) {\n classNames.push('is-compact');\n }\n\n if (this.cellAlign) {\n classNames.push(`pds-table-head-cell--align-${this.cellAlign}`);\n }\n\n if (this.sortable) {\n classNames.push('is-sortable');\n }\n\n if (this.sortable && this.sortingDirection !== null) {\n classNames.push('sort-' + this.sortingDirection);\n }\n\n if (this.tableRef && this.tableRef.fixedColumn && this.tableScrolling) {\n classNames.push('has-scrolled');\n }\n\n return classNames.join(' ');\n }\n\n render() {\n return (\n <Host\n class={this.classNames()}\n role=\"columnheader\"\n onClick={this.toggleSort}\n part=\"head-cell\"\n style={\n this.tableRef &&\n this.tableRef.fixedColumn &&\n this.tableRef.selectable\n ? { '--fixed-cell-position': '40px' }\n : {}\n }\n >\n <slot></slot>\n {this.sortable && (\n <pds-icon icon={this.sortingDirection === 'asc' ? upSmall : downSmall} part=\"sort-icon\" />\n )}\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pds-table-head-cell.js","sourceRoot":"","sources":["../../../../../src/components/pds-table/pds-table-head-cell/pds-table-head-cell.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAgB,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEtG,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAO1D,MAAM,OAAO,gBAAgB;IAL7B;QAQU,oBAAe,GAAuB,IAAI,CAAC;QAE3C,iBAAY,GAAW,CAAC,CAAC;QAkBjC;;WAEG;QACc,qBAAgB,GAAmB,KAAK,CAAC;QAE1D;;;WAGG;QACc,mBAAc,GAAY,KAAK,CAAC;QAEjD;;;WAGG;QACM,eAAU,GAAY,KAAK,CAAC;QAErC;;;WAGG;QACc,kBAAa,GAAY,KAAK,CAAC;QAEhD;;;WAGG;QACc,sBAAiB,GAAY,KAAK,CAAC;QAuGpD;;;;WAIG;QACK,iBAAY,GAAG,GAAG,EAAE;YAC1B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC1B,OAAO;YACT,CAAC;YAED,IAAI,CAAC;gBACH,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,eAAe,CAAC,UAAU,GAAG,CAAC,CAAC;YAC5D,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;YAC/C,CAAC;QACH,CAAC,CAAC;QAEM,eAAU,GAAG,GAAG,EAAE;YACxB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAClB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;gBACjD,IAAI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AQ,CAAC,WAAW;gBACzB,IAAI,CAAC,QAAQ,CAAC,UAAU;gBACtB,CAAC,CAAC,EAAE,uBAAuB,EAAE,MAAM,EAAE;gBACrC,CAAC,CAAC,EAAE;YAGR,8DAAa;YACZ,IAAI,CAAC,QAAQ,IAAI,CAChB,iEAAU,IAAI,EAAE,IAAI,CAAC,gBAAgB,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAC,WAAW,GAAG,CAC3F,CACI,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, Prop, h, Event, EventEmitter, State, Method } from '@stencil/core';\n\nimport { downSmall, upSmall } from '@pine-ds/icons/icons';\n\n@Component({\n tag: 'pds-table-head-cell',\n styleUrls: ['pds-table-head-cell.scss'],\n shadow: true,\n})\nexport class PdsTableHeadCell {\n @Element() hostElement: HTMLPdsTableHeadCellElement;\n private tableRef: HTMLPdsTableElement;\n private scrollContainer: HTMLElement | null = null;\n private setupTimer: number | undefined;\n private setupRetries: number = 0;\n private headObserver?: MutationObserver;\n\n /**\n * Sets the text alignment within the head cell.\n */\n @Prop() cellAlign?: 'start' | 'center' | 'end' | 'justify';\n\n /**\n * Determines whether the table column is sortable when set to `true`.\n */\n @Prop() sortable: boolean;\n\n /**\n * Event emitted to signal that a table column header has been sorted, providing information about the sorted column's name and sorting direction.\n */\n @Event() pdsTableSort: EventEmitter<{ column: string; direction: string }>;\n\n /**\n * The direction of sorting.\n */\n @State() private sortingDirection: 'asc' | 'desc' = 'asc';\n\n /**\n * Determines if the table is currently scrolling.\n * @defaultValue false\n */\n @State() private tableScrolling: boolean = false;\n\n /**\n * Determines if the table row is currently selected.\n * @defaultValue false\n */\n @State() isSelected: boolean = false;\n\n /**\n * Determines if the parent table-head has the border attribute.\n * @defaultValue false\n */\n @State() private hasHeadBorder: boolean = false;\n\n /**\n * Determines if the parent table-head has the background attribute.\n * @defaultValue false\n */\n @State() private hasHeadBackground: boolean = false;\n\n /**\n * Programmatically sets this column as the active sort column with the specified direction.\n * Used by pds-table to apply a default sort on initial load.\n * @param direction - The sort direction to apply ('asc' or 'desc')\n */\n @Method()\n async setActiveSort(direction: 'asc' | 'desc') {\n if (!this.sortable) return;\n\n this.sortingDirection = direction;\n this.hostElement.classList.add('is-active');\n }\n\n componentWillLoad() {\n // Set initial references and state before first render\n this.tableRef = this.hostElement.closest('pds-table') as HTMLPdsTableElement;\n\n const tableHead = this.hostElement.closest('pds-table-head') as HTMLElement;\n if (tableHead) {\n this.hasHeadBorder = tableHead.hasAttribute('border');\n this.hasHeadBackground = tableHead.hasAttribute('background');\n }\n }\n\n componentDidLoad() {\n if (this.tableRef && this.tableRef.responsive && this.tableRef.fixedColumn) {\n // For responsive tables with fixed columns, set up scroll detection\n // This enables the first column header to show a shadow when the table is scrolled horizontally\n this.setupScrollListener();\n }\n\n // Watch for changes to the parent table-head's border and background attributes\n const tableHead = this.hostElement.closest('pds-table-head') as HTMLElement;\n if (tableHead && typeof MutationObserver !== 'undefined') {\n // Defensive guard: disconnect existing observer before creating a new one\n if (this.headObserver) {\n this.headObserver.disconnect();\n }\n\n this.headObserver = new MutationObserver(() => {\n // Update state when border or background attributes change\n this.hasHeadBorder = tableHead.hasAttribute('border');\n this.hasHeadBackground = tableHead.hasAttribute('background');\n });\n\n this.headObserver.observe(tableHead, {\n attributes: true,\n attributeFilter: ['border', 'background']\n });\n }\n }\n\n disconnectedCallback() {\n this.cleanupScrollListener();\n\n if (this.headObserver) {\n this.headObserver.disconnect();\n }\n }\n\n\n private setupScrollListener() {\n if (!this.tableRef) return;\n\n // Query shadowRoot once and cache the container\n const container = this.tableRef.shadowRoot?.querySelector('.pds-table-responsive-container') as HTMLElement;\n\n if (container) {\n // Container available immediately\n this.scrollContainer = container;\n this.scrollContainer.addEventListener('scroll', this.handleScroll, { passive: true });\n this.handleScroll(); // Initial check\n this.setupRetries = 0; // Reset counter on success\n } else {\n // Container not ready, set up timer for retry with bounds\n this.setupTimer = window.setTimeout(() => {\n if (this.scrollContainer) return; // Already found\n this.setupRetries = (this.setupRetries || 0) + 1;\n if (this.setupRetries <= 50) {\n this.setupScrollListener();\n } else {\n console.warn('Failed to find responsive container after 50 attempts');\n }\n }, 100);\n }\n }\n\n private cleanupScrollListener() {\n if (this.scrollContainer) {\n this.scrollContainer.removeEventListener('scroll', this.handleScroll);\n this.scrollContainer = null;\n }\n\n if (this.setupTimer !== undefined) {\n window.clearTimeout(this.setupTimer);\n this.setupTimer = undefined;\n }\n\n this.setupRetries = 0; // Reset retry counter\n }\n\n /**\n * Handles scroll events to update fixed column shadow state.\n * Updates the tableScrolling state to control CSS classes for fixed column shadows.\n * @private\n */\n private handleScroll = () => {\n if (!this.scrollContainer) {\n return;\n }\n\n try {\n this.tableScrolling = this.scrollContainer.scrollLeft > 0;\n } catch (error) {\n console.warn('Scroll handler error:', error);\n }\n };\n\n private toggleSort = () => {\n if (this.sortable) {\n const column = this.hostElement.innerText.trim();\n this.sortingDirection = this.sortingDirection === 'asc' ? 'desc' : 'asc';\n\n this.tableRef.querySelectorAll('pds-table-head-cell').forEach((headCell) => {\n headCell.classList.remove('is-active');\n });\n\n this.hostElement.classList.toggle('is-active');\n this.pdsTableSort.emit({ column, direction: this.sortingDirection });\n }\n }\n\n private classNames() {\n const classNames = [];\n\n if (this.tableRef && this.tableRef.compact) {\n classNames.push('is-compact');\n }\n\n if (this.cellAlign) {\n classNames.push(`pds-table-head-cell--align-${this.cellAlign}`);\n }\n\n if (this.sortable) {\n classNames.push('is-sortable');\n }\n\n if (this.sortable && this.sortingDirection !== null) {\n classNames.push('sort-' + this.sortingDirection);\n }\n\n if (this.tableRef && this.tableRef.fixedColumn && this.tableScrolling) {\n classNames.push('has-scrolled');\n }\n\n if (this.hasHeadBackground) {\n classNames.push('has-head-background');\n }\n\n if (this.hasHeadBorder) {\n classNames.push('has-head-border');\n }\n\n return classNames.join(' ');\n }\n\n render() {\n return (\n <Host\n class={this.classNames()}\n role=\"columnheader\"\n onClick={this.toggleSort}\n part=\"head-cell\"\n style={\n this.tableRef &&\n this.tableRef.fixedColumn &&\n this.tableRef.selectable\n ? { '--fixed-cell-position': '40px' }\n : {}\n }\n >\n <slot></slot>\n {this.sortable && (\n <pds-icon icon={this.sortingDirection === 'asc' ? upSmall : downSmall} part=\"sort-icon\" />\n )}\n </Host>\n );\n }\n}\n"]}
|
|
@@ -18,4 +18,14 @@
|
|
|
18
18
|
:host(.is-selected)::part(checkbox-cell),
|
|
19
19
|
:host(.is-selected) ::slotted(pds-table-cell) {
|
|
20
20
|
background: var(--color-background-interactive);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:host(.has-divider) ::slotted(pds-table-cell),
|
|
24
|
+
:host(.has-divider) pds-table-cell {
|
|
25
|
+
border-block-end: var(--pine-border-width-thin) solid var(--pine-color-border-subtle);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host(.has-divider.is-last-row) ::slotted(pds-table-cell),
|
|
29
|
+
:host(.has-divider.is-last-row) pds-table-cell {
|
|
30
|
+
border-block-end: 0;
|
|
21
31
|
}
|
|
@@ -2,6 +2,18 @@ import { Host, h } from "@stencil/core";
|
|
|
2
2
|
import { closest } from "../../../utils/closest";
|
|
3
3
|
export class PdsTableRow {
|
|
4
4
|
constructor() {
|
|
5
|
+
this.observer = null;
|
|
6
|
+
this.bodyObserver = null;
|
|
7
|
+
/**
|
|
8
|
+
* Determines if the row should have a divider border.
|
|
9
|
+
* @defaultValue false
|
|
10
|
+
*/
|
|
11
|
+
this.hasDivider = false;
|
|
12
|
+
/**
|
|
13
|
+
* Determines if this is the last row in the table body.
|
|
14
|
+
* @defaultValue false
|
|
15
|
+
*/
|
|
16
|
+
this.isLastRow = false;
|
|
5
17
|
this.handleClick = () => {
|
|
6
18
|
this.isSelected = !this.isSelected; // Toggle the selected state
|
|
7
19
|
this.handleSelect(this.isSelected);
|
|
@@ -28,9 +40,17 @@ export class PdsTableRow {
|
|
|
28
40
|
if (this.isSelected) {
|
|
29
41
|
classNames.push("is-selected");
|
|
30
42
|
}
|
|
31
|
-
|
|
43
|
+
if (this.hasDivider) {
|
|
44
|
+
classNames.push("has-divider");
|
|
45
|
+
}
|
|
46
|
+
if (this.isLastRow) {
|
|
47
|
+
classNames.push("is-last-row");
|
|
48
|
+
}
|
|
49
|
+
return classNames.join(' ');
|
|
32
50
|
}
|
|
33
51
|
componentWillRender() {
|
|
52
|
+
// Always refresh tableRef to get latest prop values
|
|
53
|
+
// This ensures we pick up changes to parent table props
|
|
34
54
|
this.tableRef = this.hostElement.closest('pds-table');
|
|
35
55
|
if (this.tableRef && this.tableRef.fixedColumn) {
|
|
36
56
|
const tableCell = this.hostElement.querySelector('pds-table-cell');
|
|
@@ -38,12 +58,86 @@ export class PdsTableRow {
|
|
|
38
58
|
}
|
|
39
59
|
}
|
|
40
60
|
componentWillLoad() {
|
|
61
|
+
// Handle initial selection state
|
|
41
62
|
if (this.isSelected) {
|
|
42
63
|
this.handleSelect(this.isSelected);
|
|
43
64
|
}
|
|
65
|
+
// Note: tableRef, observers, and divider state are set up in connectedCallback
|
|
66
|
+
// which runs before componentWillLoad and also handles row re-attachment after sorting
|
|
67
|
+
}
|
|
68
|
+
connectedCallback() {
|
|
69
|
+
// When a row is re-attached to the DOM (e.g., after sorting),
|
|
70
|
+
// we need to re-setup the observers since disconnectedCallback cleared them
|
|
71
|
+
// Note: componentDidLoad only fires once, but connectedCallback fires every time
|
|
72
|
+
// the element is attached to the DOM (including after being moved)
|
|
73
|
+
this.tableRef = this.hostElement.closest('pds-table');
|
|
74
|
+
this.setupObservers();
|
|
75
|
+
this.updateDividerState();
|
|
76
|
+
}
|
|
77
|
+
disconnectedCallback() {
|
|
78
|
+
this.cleanupObservers();
|
|
79
|
+
}
|
|
80
|
+
cleanupObservers() {
|
|
81
|
+
if (this.observer) {
|
|
82
|
+
this.observer.disconnect();
|
|
83
|
+
this.observer = null;
|
|
84
|
+
}
|
|
85
|
+
if (this.bodyObserver) {
|
|
86
|
+
this.bodyObserver.disconnect();
|
|
87
|
+
this.bodyObserver = null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
setupObservers() {
|
|
91
|
+
// Clean up any existing observers first
|
|
92
|
+
this.cleanupObservers();
|
|
93
|
+
// Watch for changes to the parent table's row-dividers attribute
|
|
94
|
+
if (this.tableRef && typeof MutationObserver !== 'undefined') {
|
|
95
|
+
this.observer = new MutationObserver(() => {
|
|
96
|
+
this.updateDividerState();
|
|
97
|
+
});
|
|
98
|
+
this.observer.observe(this.tableRef, {
|
|
99
|
+
attributes: true,
|
|
100
|
+
attributeFilter: ['row-dividers']
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
// Watch for child list changes in table body (e.g., when rows are reordered during sorting)
|
|
104
|
+
const tableBody = this.hostElement.closest('pds-table-body');
|
|
105
|
+
if (tableBody && typeof MutationObserver !== 'undefined') {
|
|
106
|
+
this.bodyObserver = new MutationObserver(() => {
|
|
107
|
+
this.updateLastRowState();
|
|
108
|
+
});
|
|
109
|
+
this.bodyObserver.observe(tableBody, {
|
|
110
|
+
childList: true
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
shouldHaveDivider() {
|
|
115
|
+
if (!this.tableRef) {
|
|
116
|
+
this.tableRef = this.hostElement.closest('pds-table');
|
|
117
|
+
}
|
|
118
|
+
// Reads the parent pds-table component's rowDividers property value directly
|
|
119
|
+
return !!(this.tableRef && this.tableRef.rowDividers);
|
|
120
|
+
}
|
|
121
|
+
updateDividerState() {
|
|
122
|
+
this.hasDivider = this.shouldHaveDivider();
|
|
123
|
+
this.updateLastRowState();
|
|
124
|
+
}
|
|
125
|
+
updateLastRowState() {
|
|
126
|
+
if (!this.hasDivider) {
|
|
127
|
+
this.isLastRow = false;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const tableBody = this.hostElement.closest('pds-table-body');
|
|
131
|
+
if (tableBody) {
|
|
132
|
+
const rows = Array.from(tableBody.querySelectorAll('pds-table-row'));
|
|
133
|
+
this.isLastRow = rows[rows.length - 1] === this.hostElement;
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
this.isLastRow = false;
|
|
137
|
+
}
|
|
44
138
|
}
|
|
45
139
|
render() {
|
|
46
|
-
return (h(Host, { key: '
|
|
140
|
+
return (h(Host, { key: 'dedf37f2841e51a325b6c414d3e7ec0072bdf78f', class: this.classNames(), role: "row", part: "row" }, this.tableRef && this.tableRef.selectable && (h("pds-table-cell", { key: '3e9295398c8f48cb7aa78d10daf5201ae8f86e9f', part: this.tableRef.fixedColumn ? 'checkbox-cell' : 'checkbox-cell', class: this.tableRef.selectable ? 'has-checkbox' : '' }, h("pds-checkbox", { key: 'b786f181988110d3e3d47928da9290dfd79f5fbd', componentId: this.generateUniqueId(), onClick: this.handleClick, indeterminate: this.indeterminate, label: "Select Row", hideLabel: true, checked: this.isSelected, part: "row-checkbox" }))), h("slot", { key: 'd37e3d44d34f81553060185d96fb44a55a40edc8' })));
|
|
47
141
|
}
|
|
48
142
|
static get is() { return "pds-table-row"; }
|
|
49
143
|
static get encapsulation() { return "shadow"; }
|
|
@@ -99,6 +193,12 @@ export class PdsTableRow {
|
|
|
99
193
|
}
|
|
100
194
|
};
|
|
101
195
|
}
|
|
196
|
+
static get states() {
|
|
197
|
+
return {
|
|
198
|
+
"hasDivider": {},
|
|
199
|
+
"isLastRow": {}
|
|
200
|
+
};
|
|
201
|
+
}
|
|
102
202
|
static get events() {
|
|
103
203
|
return [{
|
|
104
204
|
"method": "pdsTableRowSelected",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pds-table-row.js","sourceRoot":"","sources":["../../../../../src/components/pds-table/pds-table-row/pds-table-row.tsx"],"names":[],"mappings":"AAAA,OAAO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AY,EACnB,SAAS,EAAE,IAAI,EACf,OAAO,EAAE,IAAI,CAAC,UAAU,EACxB,IAAI,EAAC,cAAc,GACnB,CACa,CAClB;YACD,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Host, h, Event, EventEmitter, Prop } from '@stencil/core';\n\nimport { closest } from '../../../utils/closest';\n\n@Component({\n tag: 'pds-table-row',\n styleUrls: ['pds-table-row.scss'],\n shadow: true,\n})\nexport class PdsTableRow {\n @Element() hostElement: HTMLPdsTableRowElement;\n private tableRef: HTMLPdsTableElement;\n\n /**\n * Determines if the row selected is in an indeterminate state.\n */\n @Prop({ mutable: true }) indeterminate?: boolean;\n\n /**\n * Determines if the table row is currently selected.\n */\n @Prop({ mutable: true }) isSelected?: boolean;\n\n /**\n * Event that is emitted when the checkbox is clicked, carrying the selected value.\n */\n @Event() pdsTableRowSelected: EventEmitter<{ rowIndex: number; isSelected: boolean; }>;\n\n private handleClick = () => {\n this.isSelected = !this.isSelected; // Toggle the selected state\n this.handleSelect(this.isSelected);\n }\n\n private handleSelect = (isSelected: boolean) => {\n this.indeterminate = false;\n\n if (!closest('pds-table-head', this.hostElement)) {\n const rowIndex = Array.from(this.hostElement.parentNode.children).indexOf(this.hostElement)\n this.pdsTableRowSelected.emit({\n rowIndex,\n isSelected,\n })\n }\n }\n\n private classNames() {\n const classNames = [];\n\n if (this.isSelected) {\n classNames.push(\"is-selected\");\n }\n\n return classNames.join(' ');\n }\n\n componentWillRender() {\n this.tableRef = this.hostElement.closest('pds-table') as HTMLPdsTableElement;\n\n if (this.tableRef && this.tableRef.fixedColumn) {\n const tableCell = this.hostElement.querySelector('pds-table-cell');\n tableCell?.classList.add(\"is-fixed\");\n }\n }\n\n componentWillLoad() {\n if (this.isSelected) {\n this.handleSelect(this.isSelected);\n }\n }\n\n private generateUniqueId = () => {\n const randomString = Math.random().toString(36).substring(2, 8);\n const timestamp = new Date().toISOString().replace(/[:.]/g, '-');\n const uniqueId = `${randomString}-${timestamp}`;\n\n return uniqueId;\n }\n\n render() {\n return (\n <Host\n class={this.classNames()}\n role=\"row\"\n part=\"row\"\n >\n {this.tableRef && this.tableRef.selectable && (\n <pds-table-cell part={this.tableRef.fixedColumn ? 'checkbox-cell' : 'checkbox-cell'} class={this.tableRef.selectable ? 'has-checkbox' : ''} >\n <pds-checkbox\n componentId={this.generateUniqueId()}\n onClick={this.handleClick}\n indeterminate={this.indeterminate}\n label={\"Select Row\"}\n hideLabel={true}\n checked={this.isSelected}\n part=\"row-checkbox\"\n />\n </pds-table-cell>\n )}\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pds-table-row.js","sourceRoot":"","sources":["../../../../../src/components/pds-table/pds-table-row/pds-table-row.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAgB,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE9F,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAOjD,MAAM,OAAO,WAAW;IALxB;QAQU,aAAQ,GAA4B,IAAI,CAAC;QACzC,iBAAY,GAA4B,IAAI,CAAC;QAYrD;;;WAGG;QACc,eAAU,GAAY,KAAK,CAAC;QAE7C;;;WAGG;QACc,cAAS,GAAY,KAAK,CAAC;QAOpC,gBAAW,GAAG,GAAG,EAAE;YACzB,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,4BAA4B;YAChE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC,CAAA;QAEO,iBAAY,GAAG,CAAC,UAAmB,EAAE,EAAE;YAC7C,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;YAE3B,IAAI,CAAC,OAAO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sourcesContent":["import { Component, Element, Host, h, Event, EventEmitter, Prop, State } from '@stencil/core';\n\nimport { closest } from '../../../utils/closest';\n\n@Component({\n tag: 'pds-table-row',\n styleUrls: ['pds-table-row.scss'],\n shadow: true,\n})\nexport class PdsTableRow {\n @Element() hostElement: HTMLPdsTableRowElement;\n private tableRef: HTMLPdsTableElement;\n private observer: MutationObserver | null = null;\n private bodyObserver: MutationObserver | null = null;\n\n /**\n * Determines if the row selected is in an indeterminate state.\n */\n @Prop({ mutable: true }) indeterminate?: boolean;\n\n /**\n * Determines if the table row is currently selected.\n */\n @Prop({ mutable: true }) isSelected?: boolean;\n\n /**\n * Determines if the row should have a divider border.\n * @defaultValue false\n */\n @State() private hasDivider: boolean = false;\n\n /**\n * Determines if this is the last row in the table body.\n * @defaultValue false\n */\n @State() private isLastRow: boolean = false;\n\n /**\n * Event that is emitted when the checkbox is clicked, carrying the selected value.\n */\n @Event() pdsTableRowSelected: EventEmitter<{ rowIndex: number; isSelected: boolean; }>;\n\n private handleClick = () => {\n this.isSelected = !this.isSelected; // Toggle the selected state\n this.handleSelect(this.isSelected);\n }\n\n private handleSelect = (isSelected: boolean) => {\n this.indeterminate = false;\n\n if (!closest('pds-table-head', this.hostElement)) {\n const rowIndex = Array.from(this.hostElement.parentNode.children).indexOf(this.hostElement)\n this.pdsTableRowSelected.emit({\n rowIndex,\n isSelected,\n })\n }\n }\n\n private classNames() {\n const classNames = [];\n\n if (this.isSelected) {\n classNames.push(\"is-selected\");\n }\n\n if (this.hasDivider) {\n classNames.push(\"has-divider\");\n }\n\n if (this.isLastRow) {\n classNames.push(\"is-last-row\");\n }\n\n return classNames.join(' ');\n }\n\n componentWillRender() {\n // Always refresh tableRef to get latest prop values\n // This ensures we pick up changes to parent table props\n this.tableRef = this.hostElement.closest('pds-table') as HTMLPdsTableElement;\n\n if (this.tableRef && this.tableRef.fixedColumn) {\n const tableCell = this.hostElement.querySelector('pds-table-cell');\n tableCell?.classList.add(\"is-fixed\");\n }\n }\n\n componentWillLoad() {\n // Handle initial selection state\n if (this.isSelected) {\n this.handleSelect(this.isSelected);\n }\n // Note: tableRef, observers, and divider state are set up in connectedCallback\n // which runs before componentWillLoad and also handles row re-attachment after sorting\n }\n\n connectedCallback() {\n // When a row is re-attached to the DOM (e.g., after sorting),\n // we need to re-setup the observers since disconnectedCallback cleared them\n // Note: componentDidLoad only fires once, but connectedCallback fires every time\n // the element is attached to the DOM (including after being moved)\n this.tableRef = this.hostElement.closest('pds-table') as HTMLPdsTableElement;\n this.setupObservers();\n this.updateDividerState();\n }\n\n disconnectedCallback() {\n this.cleanupObservers();\n }\n\n private cleanupObservers() {\n if (this.observer) {\n this.observer.disconnect();\n this.observer = null;\n }\n if (this.bodyObserver) {\n this.bodyObserver.disconnect();\n this.bodyObserver = null;\n }\n }\n\n private setupObservers() {\n // Clean up any existing observers first\n this.cleanupObservers();\n\n // Watch for changes to the parent table's row-dividers attribute\n if (this.tableRef && typeof MutationObserver !== 'undefined') {\n this.observer = new MutationObserver(() => {\n this.updateDividerState();\n });\n\n this.observer.observe(this.tableRef, {\n attributes: true,\n attributeFilter: ['row-dividers']\n });\n }\n\n // Watch for child list changes in table body (e.g., when rows are reordered during sorting)\n const tableBody = this.hostElement.closest('pds-table-body');\n if (tableBody && typeof MutationObserver !== 'undefined') {\n this.bodyObserver = new MutationObserver(() => {\n this.updateLastRowState();\n });\n\n this.bodyObserver.observe(tableBody, {\n childList: true\n });\n }\n }\n\n private shouldHaveDivider(): boolean {\n if (!this.tableRef) {\n this.tableRef = this.hostElement.closest('pds-table') as HTMLPdsTableElement;\n }\n // Reads the parent pds-table component's rowDividers property value directly\n return !!(this.tableRef && this.tableRef.rowDividers);\n }\n\n private updateDividerState() {\n this.hasDivider = this.shouldHaveDivider();\n this.updateLastRowState();\n }\n\n private updateLastRowState() {\n if (!this.hasDivider) {\n this.isLastRow = false;\n return;\n }\n\n const tableBody = this.hostElement.closest('pds-table-body');\n if (tableBody) {\n const rows = Array.from(tableBody.querySelectorAll('pds-table-row'));\n this.isLastRow = rows[rows.length - 1] === this.hostElement;\n } else {\n this.isLastRow = false;\n }\n }\n\n private generateUniqueId = () => {\n const randomString = Math.random().toString(36).substring(2, 8);\n const timestamp = new Date().toISOString().replace(/[:.]/g, '-');\n const uniqueId = `${randomString}-${timestamp}`;\n\n return uniqueId;\n }\n\n render() {\n return (\n <Host\n class={this.classNames()}\n role=\"row\"\n part=\"row\"\n >\n {this.tableRef && this.tableRef.selectable && (\n <pds-table-cell part={this.tableRef.fixedColumn ? 'checkbox-cell' : 'checkbox-cell'} class={this.tableRef.selectable ? 'has-checkbox' : ''} >\n <pds-checkbox\n componentId={this.generateUniqueId()}\n onClick={this.handleClick}\n indeterminate={this.indeterminate}\n label={\"Select Row\"}\n hideLabel={true}\n checked={this.isSelected}\n part=\"row-checkbox\"\n />\n </pds-table-cell>\n )}\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
.scroll-shadow-left {
|
|
83
|
+
/* stylelint-disable-next-line pine-design-system/no-hardcoded-colors */
|
|
83
84
|
background: linear-gradient(to right, rgba(0, 0, 0, 0.1), transparent);
|
|
84
85
|
border-bottom-left-radius: inherit;
|
|
85
86
|
border-top-left-radius: inherit;
|
|
@@ -87,6 +88,7 @@
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
.scroll-shadow-right {
|
|
91
|
+
/* stylelint-disable-next-line pine-design-system/no-hardcoded-colors */
|
|
90
92
|
background: linear-gradient(to left, rgba(0, 0, 0, 0.1), transparent);
|
|
91
93
|
border-bottom-right-radius: inherit;
|
|
92
94
|
border-top-right-radius: inherit;
|
|
@@ -6,6 +6,17 @@ export class PdsTable {
|
|
|
6
6
|
this._responsiveHandleResize = null;
|
|
7
7
|
this._responsiveResizeObserver = null;
|
|
8
8
|
this._teardownResponsive = null;
|
|
9
|
+
/**
|
|
10
|
+
* Adds divider borders between table rows. The last row will not have a bottom border.
|
|
11
|
+
* @defaultValue false
|
|
12
|
+
*/
|
|
13
|
+
this.rowDividers = false;
|
|
14
|
+
/**
|
|
15
|
+
* The direction to sort the default column on initial load.
|
|
16
|
+
* Only applies if `defaultSortColumn` is set.
|
|
17
|
+
* @defaultValue 'asc'
|
|
18
|
+
*/
|
|
19
|
+
this.defaultSortDirection = 'asc';
|
|
9
20
|
/**
|
|
10
21
|
* The name of the column being sorted.
|
|
11
22
|
* @defaultValue null
|
|
@@ -17,13 +28,41 @@ export class PdsTable {
|
|
|
17
28
|
*/
|
|
18
29
|
this.sortingDirection = 'asc';
|
|
19
30
|
}
|
|
20
|
-
componentWillLoad() {
|
|
21
|
-
this.sortingColumn = null;
|
|
22
|
-
}
|
|
23
31
|
componentDidLoad() {
|
|
24
32
|
if (this.responsive) {
|
|
25
33
|
this.setupResponsiveScrolling();
|
|
26
34
|
}
|
|
35
|
+
// Apply default sort if specified
|
|
36
|
+
if (this.defaultSortColumn) {
|
|
37
|
+
void this.applyDefaultSort().catch((err) => {
|
|
38
|
+
console.warn('Failed to apply default sort.', err);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Applies the default sort configuration on initial load.
|
|
44
|
+
* Finds the matching column header and activates its sort state.
|
|
45
|
+
* @private
|
|
46
|
+
*/
|
|
47
|
+
async applyDefaultSort() {
|
|
48
|
+
var _a;
|
|
49
|
+
// Normalize direction to handle invalid HTML attribute values
|
|
50
|
+
const direction = this.defaultSortDirection === 'desc' ? 'desc' : 'asc';
|
|
51
|
+
// Find the matching sortable header cell
|
|
52
|
+
const columnHeaderCells = Array.from(this.el.querySelectorAll('pds-table-head-cell[sortable]'));
|
|
53
|
+
const matchingCell = columnHeaderCells.find((cell) => { var _a; return ((_a = cell.textContent) !== null && _a !== void 0 ? _a : '').trim() === this.defaultSortColumn; });
|
|
54
|
+
if (matchingCell) {
|
|
55
|
+
const columnName = ((_a = matchingCell.textContent) !== null && _a !== void 0 ? _a : '').trim();
|
|
56
|
+
// Sort the table data
|
|
57
|
+
this.sortTable(columnName, direction);
|
|
58
|
+
this.sortingColumn = columnName;
|
|
59
|
+
this.sortingDirection = direction;
|
|
60
|
+
// Activate the visual state on the header cell
|
|
61
|
+
await matchingCell.setActiveSort(direction);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
console.warn(`Default sort column "${this.defaultSortColumn}" not found.`);
|
|
65
|
+
}
|
|
27
66
|
}
|
|
28
67
|
disconnectedCallback() {
|
|
29
68
|
if (this._teardownResponsive) {
|
|
@@ -126,6 +165,9 @@ export class PdsTable {
|
|
|
126
165
|
}
|
|
127
166
|
sortTable(column, direction) {
|
|
128
167
|
const tableBody = this.el.querySelector('pds-table-body');
|
|
168
|
+
// Return early if no table body exists
|
|
169
|
+
if (!tableBody)
|
|
170
|
+
return;
|
|
129
171
|
// Get the rows in the table body
|
|
130
172
|
const tableRows = Array.from(tableBody.querySelectorAll('pds-table-row'));
|
|
131
173
|
// Find the column index based on the column name
|
|
@@ -154,6 +196,8 @@ export class PdsTable {
|
|
|
154
196
|
});
|
|
155
197
|
}
|
|
156
198
|
handleTableSort(event) {
|
|
199
|
+
if (event.defaultPrevented)
|
|
200
|
+
return;
|
|
157
201
|
const { direction } = event.detail;
|
|
158
202
|
this.sortTable(event.detail.column, direction);
|
|
159
203
|
this.sortingColumn = event.detail.column;
|
|
@@ -295,6 +339,71 @@ export class PdsTable {
|
|
|
295
339
|
"setter": false,
|
|
296
340
|
"reflect": false,
|
|
297
341
|
"attribute": "selectable"
|
|
342
|
+
},
|
|
343
|
+
"rowDividers": {
|
|
344
|
+
"type": "boolean",
|
|
345
|
+
"mutable": false,
|
|
346
|
+
"complexType": {
|
|
347
|
+
"original": "boolean",
|
|
348
|
+
"resolved": "boolean",
|
|
349
|
+
"references": {}
|
|
350
|
+
},
|
|
351
|
+
"required": false,
|
|
352
|
+
"optional": false,
|
|
353
|
+
"docs": {
|
|
354
|
+
"tags": [{
|
|
355
|
+
"name": "defaultValue",
|
|
356
|
+
"text": "false"
|
|
357
|
+
}],
|
|
358
|
+
"text": "Adds divider borders between table rows. The last row will not have a bottom border."
|
|
359
|
+
},
|
|
360
|
+
"getter": false,
|
|
361
|
+
"setter": false,
|
|
362
|
+
"reflect": true,
|
|
363
|
+
"attribute": "row-dividers",
|
|
364
|
+
"defaultValue": "false"
|
|
365
|
+
},
|
|
366
|
+
"defaultSortColumn": {
|
|
367
|
+
"type": "string",
|
|
368
|
+
"mutable": false,
|
|
369
|
+
"complexType": {
|
|
370
|
+
"original": "string",
|
|
371
|
+
"resolved": "string",
|
|
372
|
+
"references": {}
|
|
373
|
+
},
|
|
374
|
+
"required": false,
|
|
375
|
+
"optional": true,
|
|
376
|
+
"docs": {
|
|
377
|
+
"tags": [],
|
|
378
|
+
"text": "The name of the column to sort by on initial load.\nMust match the text content of a sortable column header."
|
|
379
|
+
},
|
|
380
|
+
"getter": false,
|
|
381
|
+
"setter": false,
|
|
382
|
+
"reflect": false,
|
|
383
|
+
"attribute": "default-sort-column"
|
|
384
|
+
},
|
|
385
|
+
"defaultSortDirection": {
|
|
386
|
+
"type": "string",
|
|
387
|
+
"mutable": false,
|
|
388
|
+
"complexType": {
|
|
389
|
+
"original": "'asc' | 'desc'",
|
|
390
|
+
"resolved": "\"asc\" | \"desc\"",
|
|
391
|
+
"references": {}
|
|
392
|
+
},
|
|
393
|
+
"required": false,
|
|
394
|
+
"optional": true,
|
|
395
|
+
"docs": {
|
|
396
|
+
"tags": [{
|
|
397
|
+
"name": "defaultValue",
|
|
398
|
+
"text": "'asc'"
|
|
399
|
+
}],
|
|
400
|
+
"text": "The direction to sort the default column on initial load.\nOnly applies if `defaultSortColumn` is set."
|
|
401
|
+
},
|
|
402
|
+
"getter": false,
|
|
403
|
+
"setter": false,
|
|
404
|
+
"reflect": false,
|
|
405
|
+
"attribute": "default-sort-direction",
|
|
406
|
+
"defaultValue": "'asc'"
|
|
298
407
|
}
|
|
299
408
|
};
|
|
300
409
|
}
|