@sellmate/design-system 1.0.61 → 1.0.63
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/dist/cjs/{component.modal-DmQUWbve.js → component.modal-BFelrSMx.js} +14 -0
- package/dist/cjs/constants-DJRV1upE.js +5 -0
- package/dist/cjs/design-system.cjs.js +3 -4
- package/dist/cjs/{index-BQt-JC6r.js → index-nsQP24mV.js} +130 -9
- package/dist/cjs/index.cjs.js +103 -32
- package/dist/cjs/loader.cjs.js +3 -4
- package/dist/cjs/sd-action-modal.cjs.entry.js +3 -3
- package/dist/cjs/sd-badge.cjs.entry.js +2 -2
- package/dist/cjs/sd-barcode-input.cjs.entry.js +3 -3
- package/dist/cjs/sd-button-v2_2.cjs.entry.js +9 -8
- package/dist/cjs/sd-button_4.cjs.entry.js +56 -18
- package/dist/cjs/sd-calendar.cjs.entry.js +1 -1
- package/dist/cjs/sd-card.cjs.entry.js +2 -2
- package/dist/cjs/sd-checkbox.cjs.entry.js +30 -5
- package/dist/cjs/sd-circle-progress.cjs.entry.js +71 -0
- package/dist/cjs/sd-confirm-modal_2.cjs.entry.js +186 -0
- package/dist/cjs/sd-date-box.cjs.entry.js +1 -1
- package/dist/cjs/sd-date-picker-calendar.cjs.entry.js +3 -3
- package/dist/cjs/sd-date-picker-trigger.cjs.entry.js +4 -4
- package/dist/cjs/sd-date-picker.cjs.entry.js +4 -4
- package/dist/cjs/{sd-date-picker.config-DWC_aiD2.js → sd-date-picker.config-D8xSALVj.js} +3 -3
- package/dist/cjs/sd-date-range-picker-calendar.cjs.entry.js +3 -3
- package/dist/cjs/sd-date-range-picker.cjs.entry.js +4 -4
- package/dist/cjs/sd-dropdown-button.cjs.entry.js +10 -5
- package/dist/cjs/sd-file-picker.cjs.entry.js +1 -1
- package/dist/cjs/sd-form.cjs.entry.js +1 -1
- package/dist/cjs/sd-ghost-button.cjs.entry.js +15 -6
- package/dist/cjs/sd-guide.cjs.entry.js +2 -2
- package/dist/cjs/sd-input_2.cjs.entry.js +7 -7
- package/dist/cjs/sd-loading-container.cjs.entry.js +29 -0
- package/dist/cjs/sd-modal-container.cjs.entry.js +45 -2
- package/dist/cjs/sd-number-input.cjs.entry.js +5 -10
- package/dist/cjs/{sd-select-v2.cjs.entry.js → sd-pagination_2.cjs.entry.js} +90 -4
- package/dist/cjs/sd-popover.cjs.entry.js +4 -4
- package/dist/cjs/sd-portal.cjs.entry.js +2 -2
- package/dist/cjs/sd-progress.cjs.entry.js +3 -3
- package/dist/cjs/sd-radio-button.cjs.entry.js +182 -0
- package/dist/cjs/sd-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/sd-radio.cjs.entry.js +6 -6
- package/dist/cjs/sd-select-dropdown_2.cjs.entry.js +4 -4
- package/dist/cjs/sd-select-group.cjs.entry.js +3 -3
- package/dist/cjs/sd-select-multiple-group.cjs.entry.js +2 -2
- package/dist/cjs/sd-select-multiple.cjs.entry.js +3 -3
- package/dist/cjs/sd-select-option-group.cjs.entry.js +4 -4
- package/dist/cjs/sd-select-v2-list-item_4.cjs.entry.js +661 -0
- package/dist/cjs/sd-select.cjs.entry.js +179 -0
- package/dist/cjs/sd-switch.cjs.entry.js +110 -0
- package/dist/cjs/sd-table.cjs.entry.js +424 -651
- package/dist/cjs/sd-tabs.cjs.entry.js +3 -3
- package/dist/cjs/sd-tag.cjs.entry.js +6 -5
- package/dist/cjs/sd-tbody.cjs.entry.js +66 -0
- package/dist/cjs/sd-td.cjs.entry.js +58 -0
- package/dist/cjs/sd-text-link.cjs.entry.js +10 -12
- package/dist/cjs/sd-textarea.cjs.entry.js +2 -2
- package/dist/cjs/sd-thead.cjs.entry.js +179 -0
- package/dist/cjs/sd-toast-container.cjs.entry.js +2 -2
- package/dist/cjs/sd-toast.cjs.entry.js +3 -3
- package/dist/cjs/sd-toggle.cjs.entry.js +96 -13
- package/dist/cjs/sd-tr.cjs.entry.js +171 -0
- package/dist/cjs/table-test.cjs.entry.js +96 -0
- package/dist/cjs/{tooltipArrow-CRCpqOYA.js → tooltipArrow-DhevfDPX.js} +1 -1
- package/dist/collection/__mocks__/nanoid-non-secure.js +13 -0
- package/dist/collection/__mocks__/nanoid.js +1 -0
- package/dist/collection/collection-manifest.json +11 -4
- package/dist/collection/components/sd-action-modal/sd-action-modal.js +1 -1
- package/dist/collection/components/sd-badge/sd-badge.js +1 -1
- package/dist/collection/components/sd-barcode-input/sd-barcode-input.css +3 -0
- package/dist/collection/components/sd-barcode-input/sd-barcode-input.js +1 -1
- package/dist/collection/components/sd-button/sd-button.css +37 -37
- package/dist/collection/components/sd-button-v2/sd-button-v2.css +44 -44
- package/dist/collection/components/sd-button-v2/sd-button-v2.js +31 -6
- package/dist/collection/components/sd-card/sd-card.js +1 -1
- package/dist/collection/components/sd-checkbox/sd-checkbox.config.js +3 -0
- package/dist/collection/components/sd-checkbox/sd-checkbox.css +15 -0
- package/dist/collection/components/sd-checkbox/sd-checkbox.js +36 -2
- package/dist/collection/components/sd-circle-progress/sd-circle-progress.config.js +24 -0
- package/dist/collection/components/sd-circle-progress/sd-circle-progress.css +53 -0
- package/dist/collection/components/sd-circle-progress/sd-circle-progress.js +109 -0
- package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.css +2 -2
- package/dist/collection/components/sd-confirm-modal/sd-confirm-modal.js +2 -2
- package/dist/collection/components/sd-date-picker/sd-date-picker-calendar/sd-date-picker-calendar.js +1 -1
- package/dist/collection/components/sd-date-picker/sd-date-picker-trigger/sd-date-picker-trigger.js +2 -2
- package/dist/collection/components/sd-date-picker/sd-date-picker.config.js +1 -1
- package/dist/collection/components/sd-date-picker/sd-date-picker.js +5 -5
- package/dist/collection/components/sd-date-range-picker/sd-date-range-picker-calendar/sd-date-range-picker-calendar.js +1 -1
- package/dist/collection/components/sd-date-range-picker/sd-date-range-picker.js +5 -5
- package/dist/collection/components/sd-dropdown-button/sd-dropdown-button.config.js +5 -0
- package/dist/collection/components/sd-dropdown-button/sd-dropdown-button.css +46 -36
- package/dist/collection/components/sd-dropdown-button/sd-dropdown-button.js +4 -4
- package/dist/collection/components/sd-field/sd-field.config.js +21 -0
- package/dist/collection/components/sd-field/sd-field.css +19 -16
- package/dist/collection/components/sd-field/sd-field.js +46 -11
- package/dist/collection/components/sd-file-picker/sd-file-picker.js +5 -5
- package/dist/collection/components/sd-ghost-button/sd-ghost-button.config.js +7 -1
- package/dist/collection/components/sd-ghost-button/sd-ghost-button.js +3 -3
- package/dist/collection/components/sd-guide/sd-guide.css +37 -37
- package/dist/collection/components/sd-input/sd-input.css +3 -0
- package/dist/collection/components/sd-input/sd-input.js +2 -2
- package/dist/collection/components/sd-loading-container/sd-loading-container.config.js +1 -0
- package/dist/collection/components/sd-loading-container/sd-loading-container.css +40 -0
- package/dist/collection/components/sd-loading-container/sd-loading-container.js +83 -0
- package/dist/collection/components/sd-loading-modal/sd-loading-modal.config.js +31 -0
- package/dist/collection/components/sd-loading-modal/sd-loading-modal.css +37 -0
- package/dist/collection/components/sd-loading-modal/sd-loading-modal.js +184 -0
- package/dist/collection/components/sd-modal-container/sd-modal-container.js +89 -3
- package/dist/collection/components/sd-number-input/sd-number-input.config.js +0 -2
- package/dist/collection/components/sd-number-input/sd-number-input.css +0 -1
- package/dist/collection/components/sd-number-input/sd-number-input.js +3 -4
- package/dist/collection/components/sd-pagination/sd-pagination.js +3 -3
- package/dist/collection/components/sd-popover/sd-popover.js +2 -2
- package/dist/collection/components/sd-portal/sd-portal.js +1 -1
- package/dist/collection/components/sd-progress/sd-progress.js +2 -2
- package/dist/collection/components/sd-radio/sd-radio.config.js +1 -1
- package/dist/collection/components/sd-radio-button/sd-radio-button.config.js +45 -0
- package/dist/collection/components/sd-radio-button/sd-radio-button.css +71 -0
- package/dist/collection/components/{sd-radio-button-group/sd-radio-button-group.js → sd-radio-button/sd-radio-button.js} +49 -18
- package/dist/collection/components/sd-select/sd-select-dropdown/sd-select-dropdown.js +2 -2
- package/dist/collection/components/sd-select/sd-select-option/sd-select-option.js +1 -1
- package/dist/collection/components/sd-select/sd-select-search-input/sd-select-search-input.js +3 -3
- package/dist/collection/components/sd-select/sd-select.css +4 -0
- package/dist/collection/components/sd-select-group/sd-select-group.css +4 -0
- package/dist/collection/components/sd-select-group/sd-select-group.js +1 -1
- package/dist/collection/components/sd-select-multiple/sd-select-multiple.css +4 -0
- package/dist/collection/components/sd-select-multiple/sd-select-multiple.js +1 -1
- package/dist/collection/components/sd-select-multiple-group/sd-select-multiple-group.css +4 -0
- package/dist/collection/components/sd-select-multiple-group/sd-select-option-group/sd-select-option-group.js +3 -3
- package/dist/collection/components/sd-select-v2/sd-select-v2-list-item/sd-select-v2-list-item.js +2 -2
- package/dist/collection/components/sd-select-v2/sd-select-v2-list-item-search/sd-select-v2-list-item-search.css +4 -0
- package/dist/collection/components/sd-select-v2/sd-select-v2-list-item-search/sd-select-v2-list-item-search.js +6 -3
- package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.css +2 -3
- package/dist/collection/components/sd-select-v2/sd-select-v2-listbox/sd-select-v2-listbox.js +2 -1
- package/dist/collection/components/sd-select-v2/sd-select-v2-trigger/sd-select-v2-trigger.js +2 -2
- package/dist/collection/components/sd-select-v2/sd-select-v2.config.js +1 -0
- package/dist/collection/components/sd-select-v2/sd-select-v2.js +3 -3
- package/dist/collection/components/sd-switch/sd-switch.config.js +23 -0
- package/dist/collection/components/sd-switch/sd-switch.css +54 -0
- package/dist/collection/components/{sd-toggle-button/sd-toggle-button.js → sd-switch/sd-switch.js} +30 -27
- package/dist/collection/components/sd-table/constants.js +1 -0
- package/dist/collection/components/sd-table/sd-table.css +76 -248
- package/dist/collection/components/sd-table/sd-table.js +705 -700
- package/dist/collection/components/sd-table/sd-tbody/sd-tbody.css +18 -0
- package/dist/collection/components/sd-table/sd-tbody/sd-tbody.js +105 -0
- package/dist/collection/components/sd-table/sd-td/sd-td.css +15 -0
- package/dist/collection/components/sd-table/sd-td/sd-td.js +121 -0
- package/dist/collection/components/sd-table/sd-thead/sd-thead.css +147 -0
- package/dist/collection/components/sd-table/sd-thead/sd-thead.js +442 -0
- package/dist/collection/components/sd-table/sd-tr/sd-tr.css +111 -0
- package/dist/collection/components/sd-table/sd-tr/sd-tr.js +376 -0
- package/dist/collection/components/sd-tabs/sd-tabs.css +2 -1
- package/dist/collection/components/sd-tabs/sd-tabs.js +3 -3
- package/dist/collection/components/sd-tag/sd-tag.js +2 -2
- package/dist/collection/components/sd-text-link/sd-text-link.css +1 -0
- package/dist/collection/components/sd-text-link/sd-text-link.js +7 -13
- package/dist/collection/components/sd-textarea/sd-textarea.js +1 -1
- package/dist/collection/components/sd-toast/sd-toast.js +2 -2
- package/dist/collection/components/sd-toast-container/sd-toast-container.js +1 -1
- package/dist/collection/components/sd-toggle/sd-toggle.config.js +33 -0
- package/dist/collection/components/sd-toggle/sd-toggle.css +38 -50
- package/dist/collection/components/sd-toggle/sd-toggle.js +29 -12
- package/dist/collection/components/sd-tooltip/sd-tooltip.js +2 -2
- package/dist/collection/components/table-test/table-test.css +59 -0
- package/dist/collection/components/table-test/table-test.js +316 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/loading.js +43 -0
- package/dist/collection/utils/modal.js +26 -0
- package/dist/components/index.js +1 -1
- package/dist/components/p-6LkBUj0w.js +1 -0
- package/dist/components/{p-DlujHEXS.js → p-6cueWz-l.js} +1 -1
- package/dist/components/{p-D0wZv01W.js → p-AKpbKrkW.js} +1 -1
- package/dist/components/p-B1S4ybd6.js +1 -0
- package/dist/components/{p-D93Cb_Vw.js → p-B6OgnOKC.js} +1 -1
- package/dist/components/{p-lKwhftf9.js → p-B6RvTdqt.js} +1 -1
- package/dist/components/p-BLC3AWW8.js +1 -0
- package/dist/components/{p-BUAwjF_Z.js → p-BZ7V5xV5.js} +1 -1
- package/dist/components/{p-BWgJ9XTj.js → p-BdsI1E5l.js} +1 -1
- package/dist/components/{p-DdBIc8AE.js → p-BgRPWxrz.js} +1 -1
- package/dist/components/{p-DCv5afjJ.js → p-Bh548Ckv.js} +1 -1
- package/dist/components/p-C2r48NLP.js +1 -0
- package/dist/components/{p-BtH5wWA5.js → p-CGXwtYAv.js} +1 -1
- package/dist/components/p-CGssy8eb.js +1 -0
- package/dist/components/{p-BHQirDZt.js → p-CRl8Anfr.js} +1 -1
- package/dist/components/p-CU095QAR.js +1 -0
- package/dist/components/p-CpclstHV.js +1 -0
- package/dist/components/{p-C2Yw3PoX.js → p-Cpu_hXwN.js} +1 -1
- package/dist/components/{p-gTPCqs3t.js → p-Cr_74QR7.js} +1 -1
- package/dist/components/{p-BsJy4pgR.js → p-D9FDutsj.js} +1 -1
- package/dist/components/p-DBnszF5F.js +1 -0
- package/dist/components/p-DOXMJi-V.js +1 -0
- package/dist/components/p-DRY8HJ-T.js +1 -0
- package/dist/components/{p-BVBMsoZP.js → p-DUqX35W_.js} +1 -1
- package/dist/components/{p-Ci3yfjxH.js → p-DgYBr7xb.js} +1 -1
- package/dist/components/{p-98NWgkAU.js → p-DpsDTjcN.js} +1 -1
- package/dist/components/p-DuYi4aqj.js +1 -0
- package/dist/components/{p-AdSqif48.js → p-DxzgCf_d.js} +1 -1
- package/dist/components/p-TMuoVuhE.js +1 -0
- package/dist/components/{p-CE1Hmoij.js → p-VXLJLI30.js} +1 -1
- package/dist/components/p-aC4HJHug.js +1 -0
- package/dist/components/p-bYCOh35g.js +1 -0
- package/dist/components/p-e35Du7-7.js +1 -0
- package/dist/components/p-e8HA30H_.js +1 -0
- package/dist/components/p-kZ5N_lFC.js +1 -0
- package/dist/components/{p-CqU3a1re.js → p-puZ1xlrr.js} +1 -1
- package/dist/components/p-sZMi_32I.js +1 -0
- package/dist/components/sd-action-modal.js +1 -1
- package/dist/components/sd-badge.js +1 -1
- package/dist/components/sd-barcode-input.js +1 -1
- package/dist/components/sd-button-v2.js +1 -1
- package/dist/components/sd-button.js +1 -1
- package/dist/components/sd-calendar.js +1 -1
- package/dist/components/sd-card.js +1 -1
- package/dist/components/sd-checkbox.js +1 -1
- package/dist/components/{sd-loading-spinner.d.ts → sd-circle-progress.d.ts} +4 -4
- package/dist/components/sd-circle-progress.js +1 -0
- package/dist/components/sd-confirm-modal.js +1 -1
- package/dist/components/sd-date-box.js +1 -1
- package/dist/components/sd-date-picker-calendar.js +1 -1
- package/dist/components/sd-date-picker-trigger.js +1 -1
- package/dist/components/sd-date-picker.js +1 -1
- package/dist/components/sd-date-range-picker-calendar.js +1 -1
- package/dist/components/sd-date-range-picker.js +1 -1
- package/dist/components/sd-dropdown-button.js +1 -1
- package/dist/components/sd-field.js +1 -1
- package/dist/components/sd-file-picker.js +1 -1
- package/dist/components/sd-floating-portal.js +1 -1
- package/dist/components/sd-form.js +1 -1
- package/dist/components/sd-ghost-button.js +1 -1
- package/dist/components/sd-guide.js +1 -1
- package/dist/components/sd-icon.js +1 -1
- package/dist/components/sd-input.js +1 -1
- package/dist/components/{sd-radio-button-group.d.ts → sd-loading-container.d.ts} +4 -4
- package/dist/components/sd-loading-container.js +1 -0
- package/dist/components/{sd-toggle-button.d.ts → sd-loading-modal.d.ts} +4 -4
- package/dist/components/sd-loading-modal.js +1 -0
- package/dist/components/sd-modal-container.js +1 -1
- package/dist/components/sd-number-input.js +1 -1
- package/dist/components/sd-pagination.js +1 -1
- package/dist/components/sd-popover.js +1 -1
- package/dist/components/sd-portal.js +1 -1
- package/dist/components/sd-progress.js +1 -1
- package/dist/components/sd-radio-button.d.ts +11 -0
- package/dist/components/sd-radio-button.js +1 -0
- package/dist/components/sd-radio-group.js +1 -1
- package/dist/components/sd-radio.js +1 -1
- package/dist/components/sd-select-dropdown.js +1 -1
- package/dist/components/sd-select-group.js +1 -1
- package/dist/components/sd-select-multiple-group.js +1 -1
- package/dist/components/sd-select-multiple.js +1 -1
- package/dist/components/sd-select-option-group.js +1 -1
- package/dist/components/sd-select-option.js +1 -1
- package/dist/components/sd-select-search-input.js +1 -1
- package/dist/components/sd-select-v2-list-item-search.js +1 -1
- package/dist/components/sd-select-v2-list-item.js +1 -1
- package/dist/components/sd-select-v2-listbox.js +1 -1
- package/dist/components/sd-select-v2-trigger.js +1 -1
- package/dist/components/sd-select-v2.js +1 -1
- package/dist/components/sd-select.js +1 -1
- package/dist/components/sd-switch.d.ts +11 -0
- package/dist/components/sd-switch.js +1 -0
- package/dist/components/sd-table.js +1 -1
- package/dist/components/sd-tabs.js +1 -1
- package/dist/components/sd-tag.js +1 -1
- package/dist/components/sd-tbody.d.ts +11 -0
- package/dist/components/sd-tbody.js +1 -0
- package/dist/components/sd-td.d.ts +11 -0
- package/dist/components/sd-td.js +1 -0
- package/dist/components/sd-text-link.js +1 -1
- package/dist/components/sd-textarea.js +1 -1
- package/dist/components/sd-thead.d.ts +11 -0
- package/dist/components/sd-thead.js +1 -0
- package/dist/components/sd-toast-container.js +1 -1
- package/dist/components/sd-toast.js +1 -1
- package/dist/components/sd-toggle.js +1 -1
- package/dist/components/sd-tooltip.js +1 -1
- package/dist/components/sd-tr.d.ts +11 -0
- package/dist/components/sd-tr.js +1 -0
- package/dist/components/table-test.d.ts +11 -0
- package/dist/components/table-test.js +1 -0
- package/dist/design-system/design-system.css +1 -1
- package/dist/design-system/design-system.esm.js +1 -1
- package/dist/design-system/index.esm.js +1 -1
- package/dist/design-system/p-03099a57.entry.js +1 -0
- package/dist/design-system/p-04be87a4.entry.js +1 -0
- package/dist/design-system/{p-e9c28bdc.entry.js → p-09ba9dbc.entry.js} +1 -1
- package/dist/design-system/p-0ca594a4.entry.js +1 -0
- package/dist/design-system/p-0fbb6d92.entry.js +1 -0
- package/dist/design-system/p-12a03c88.entry.js +1 -0
- package/dist/design-system/p-15cda79c.entry.js +1 -0
- package/dist/design-system/p-1b9e427e.entry.js +1 -0
- package/dist/design-system/p-1cbe4b22.entry.js +1 -0
- package/dist/design-system/{p-a03ad24f.entry.js → p-1d310832.entry.js} +1 -1
- package/dist/design-system/p-2f64dd95.entry.js +1 -0
- package/dist/design-system/p-33e4ce64.entry.js +1 -0
- package/dist/design-system/{p-14b67a6e.entry.js → p-363da5ff.entry.js} +1 -1
- package/dist/design-system/p-3d341993.entry.js +1 -0
- package/dist/design-system/p-3f79f1d1.entry.js +1 -0
- package/dist/design-system/{p-c59191d3.entry.js → p-40495e05.entry.js} +1 -1
- package/dist/design-system/p-4128c17f.entry.js +1 -0
- package/dist/design-system/{p-614c9883.entry.js → p-4a53d7b0.entry.js} +1 -1
- package/dist/design-system/{p-9ae589c4.entry.js → p-4dcadde3.entry.js} +1 -1
- package/dist/design-system/{p-62992b73.entry.js → p-53bc77f8.entry.js} +1 -1
- package/dist/design-system/{p-28058050.entry.js → p-5a63febd.entry.js} +1 -1
- package/dist/design-system/p-656acb07.entry.js +1 -0
- package/dist/design-system/{p-30055371.entry.js → p-6c71d7b7.entry.js} +1 -1
- package/dist/design-system/{p-7a18a52b.entry.js → p-73acee07.entry.js} +1 -1
- package/dist/design-system/p-748ece8e.entry.js +1 -0
- package/dist/design-system/p-7e09fdd5.entry.js +1 -0
- package/dist/design-system/{p-4272b9e6.entry.js → p-84a329fb.entry.js} +1 -1
- package/dist/design-system/p-867ec4ee.entry.js +1 -0
- package/dist/design-system/p-8acf3b67.entry.js +1 -0
- package/dist/design-system/p-8d2328ae.entry.js +1 -0
- package/dist/design-system/{p-dee605b1.entry.js → p-9af7e19a.entry.js} +1 -1
- package/dist/design-system/p-BqHL8W3c.js +2 -0
- package/dist/design-system/{p-DSRYrM1n.js → p-COK6PVLC.js} +1 -1
- package/dist/design-system/p-DOXMJi-V.js +1 -0
- package/dist/design-system/{p-72b564ed.entry.js → p-a129711d.entry.js} +1 -1
- package/dist/design-system/p-a24c3431.entry.js +1 -0
- package/dist/design-system/p-a27718c1.entry.js +1 -0
- package/dist/design-system/{p-3d10be45.entry.js → p-a9a91e69.entry.js} +1 -1
- package/dist/design-system/p-ae1800c0.entry.js +1 -0
- package/dist/design-system/p-b1fe12f8.entry.js +1 -0
- package/dist/design-system/p-b60ae063.entry.js +1 -0
- package/dist/design-system/p-b6e02544.entry.js +1 -0
- package/dist/design-system/p-bYCOh35g.js +1 -0
- package/dist/design-system/{p-fa8b64c2.entry.js → p-c2f3470f.entry.js} +1 -1
- package/dist/design-system/{p-85e22acd.entry.js → p-c4e68815.entry.js} +1 -1
- package/dist/design-system/p-c98ed6ae.entry.js +1 -0
- package/dist/design-system/p-ca80379a.entry.js +1 -0
- package/dist/design-system/{p-5d2e8779.entry.js → p-d04551be.entry.js} +1 -1
- package/dist/design-system/p-e0f9e5b5.entry.js +1 -0
- package/dist/design-system/p-e1fdd540.entry.js +1 -0
- package/dist/design-system/{p-2bd887ca.entry.js → p-e33389b8.entry.js} +1 -1
- package/dist/design-system/p-e78faea6.entry.js +1 -0
- package/dist/design-system/p-e9f24d23.entry.js +1 -0
- package/dist/design-system/{p-00207f08.entry.js → p-ec79fefd.entry.js} +1 -1
- package/dist/design-system/{p-067b0b3c.entry.js → p-f3a60f61.entry.js} +1 -1
- package/dist/design-system/p-f9b9204d.entry.js +1 -0
- package/dist/design-system/{p-13fed1bd.entry.js → p-fd296c73.entry.js} +1 -1
- package/dist/design-system/p-sZMi_32I.js +1 -0
- package/dist/esm/{component.modal-mO5GcwI3.js → component.modal-DOXMJi-V.js} +14 -0
- package/dist/esm/constants-sZMi_32I.js +3 -0
- package/dist/esm/design-system.js +3 -4
- package/dist/esm/{index-DsU722JF.js → index-BqHL8W3c.js} +128 -10
- package/dist/esm/index.js +103 -33
- package/dist/esm/loader.js +3 -4
- package/dist/esm/sd-action-modal.entry.js +3 -3
- package/dist/esm/sd-badge.entry.js +2 -2
- package/dist/esm/sd-barcode-input.entry.js +3 -3
- package/dist/esm/sd-button-v2_2.entry.js +9 -8
- package/dist/esm/sd-button_4.entry.js +56 -18
- package/dist/esm/sd-calendar.entry.js +1 -1
- package/dist/esm/sd-card.entry.js +2 -2
- package/dist/esm/sd-checkbox.entry.js +30 -5
- package/dist/esm/sd-circle-progress.entry.js +69 -0
- package/dist/esm/sd-confirm-modal_2.entry.js +183 -0
- package/dist/esm/sd-date-box.entry.js +1 -1
- package/dist/esm/sd-date-picker-calendar.entry.js +3 -3
- package/dist/esm/sd-date-picker-trigger.entry.js +4 -4
- package/dist/esm/{sd-date-picker.config-C4i826lM.js → sd-date-picker.config-bYCOh35g.js} +3 -3
- package/dist/esm/sd-date-picker.entry.js +4 -4
- package/dist/esm/sd-date-range-picker-calendar.entry.js +3 -3
- package/dist/esm/sd-date-range-picker.entry.js +4 -4
- package/dist/esm/sd-dropdown-button.entry.js +10 -5
- package/dist/esm/sd-file-picker.entry.js +1 -1
- package/dist/esm/sd-form.entry.js +1 -1
- package/dist/esm/sd-ghost-button.entry.js +15 -6
- package/dist/esm/sd-guide.entry.js +2 -2
- package/dist/esm/sd-input_2.entry.js +7 -7
- package/dist/esm/sd-loading-container.entry.js +27 -0
- package/dist/esm/sd-modal-container.entry.js +45 -2
- package/dist/esm/sd-number-input.entry.js +5 -10
- package/dist/esm/{sd-select-v2.entry.js → sd-pagination_2.entry.js} +90 -5
- package/dist/esm/sd-popover.entry.js +4 -4
- package/dist/esm/sd-portal.entry.js +2 -2
- package/dist/esm/sd-progress.entry.js +3 -3
- package/dist/esm/sd-radio-button.entry.js +180 -0
- package/dist/esm/sd-radio-group.entry.js +1 -1
- package/dist/esm/sd-radio.entry.js +6 -6
- package/dist/esm/sd-select-dropdown_2.entry.js +4 -4
- package/dist/esm/sd-select-group.entry.js +3 -3
- package/dist/esm/sd-select-multiple-group.entry.js +2 -2
- package/dist/esm/sd-select-multiple.entry.js +3 -3
- package/dist/esm/sd-select-option-group.entry.js +4 -4
- package/dist/esm/sd-select-v2-list-item_4.entry.js +656 -0
- package/dist/esm/sd-select.entry.js +177 -0
- package/dist/esm/sd-switch.entry.js +108 -0
- package/dist/esm/sd-table.entry.js +424 -651
- package/dist/esm/sd-tabs.entry.js +3 -3
- package/dist/esm/sd-tag.entry.js +6 -5
- package/dist/esm/sd-tbody.entry.js +64 -0
- package/dist/esm/sd-td.entry.js +56 -0
- package/dist/esm/sd-text-link.entry.js +10 -12
- package/dist/esm/sd-textarea.entry.js +2 -2
- package/dist/esm/sd-thead.entry.js +177 -0
- package/dist/esm/sd-toast-container.entry.js +2 -2
- package/dist/esm/sd-toast.entry.js +3 -3
- package/dist/esm/sd-toggle.entry.js +96 -13
- package/dist/esm/sd-tr.entry.js +169 -0
- package/dist/esm/table-test.entry.js +94 -0
- package/dist/esm/{tooltipArrow-CJuzsrdH.js → tooltipArrow-BcsrQx1U.js} +1 -1
- package/dist/types/__mocks__/nanoid-non-secure.d.ts +2 -0
- package/dist/types/__mocks__/nanoid.d.ts +1 -0
- package/dist/types/components/sd-button-v2/sd-button-v2.d.ts +1 -0
- package/dist/types/components/sd-checkbox/sd-checkbox.config.d.ts +3 -0
- package/dist/types/components/sd-checkbox/sd-checkbox.d.ts +2 -0
- package/dist/types/components/sd-circle-progress/sd-circle-progress.config.d.ts +9 -0
- package/dist/types/components/sd-circle-progress/sd-circle-progress.d.ts +8 -0
- package/dist/types/components/sd-dropdown-button/sd-dropdown-button.config.d.ts +1 -0
- package/dist/types/components/sd-field/sd-field.config.d.ts +9 -0
- package/dist/types/components/sd-field/sd-field.d.ts +2 -0
- package/dist/types/components/sd-ghost-button/sd-ghost-button.config.d.ts +1 -1
- package/dist/types/components/sd-loading-container/sd-loading-container.config.d.ts +4 -0
- package/dist/types/components/sd-loading-container/sd-loading-container.d.ts +8 -0
- package/dist/types/components/sd-loading-modal/sd-loading-modal.config.d.ts +25 -0
- package/dist/types/components/sd-loading-modal/sd-loading-modal.d.ts +15 -0
- package/dist/types/components/sd-modal-container/sd-modal-container.config.d.ts +10 -0
- package/dist/types/components/sd-modal-container/sd-modal-container.d.ts +6 -2
- package/dist/types/components/sd-number-input/sd-number-input.config.d.ts +0 -1
- package/dist/types/components/sd-radio-button/sd-radio-button.config.d.ts +44 -0
- package/dist/types/components/{sd-radio-button-group/sd-radio-button-group.d.ts → sd-radio-button/sd-radio-button.d.ts} +4 -3
- package/dist/types/components/sd-select-v2/sd-select-v2.config.d.ts +1 -0
- package/dist/types/components/sd-switch/sd-switch.config.d.ts +22 -0
- package/dist/types/components/{sd-toggle-button/sd-toggle-button.d.ts → sd-switch/sd-switch.d.ts} +2 -6
- package/dist/types/components/sd-table/constants.d.ts +44 -0
- package/dist/types/components/sd-table/sd-table.d.ts +103 -115
- package/dist/types/components/sd-table/sd-tbody/sd-tbody.d.ts +14 -0
- package/dist/types/components/sd-table/sd-td/sd-td.d.ts +12 -0
- package/dist/types/components/sd-table/sd-thead/sd-thead.d.ts +36 -0
- package/dist/types/components/sd-table/sd-tr/sd-tr.d.ts +34 -0
- package/dist/types/components/sd-toggle/sd-toggle.config.d.ts +32 -0
- package/dist/types/components/sd-toggle/sd-toggle.d.ts +0 -3
- package/dist/types/components/table-test/table-test.d.ts +46 -0
- package/dist/types/components.d.ts +532 -141
- package/dist/types/index.d.ts +3 -1
- package/dist/types/utils/loading.d.ts +7 -0
- package/dist/types/utils/modal.d.ts +19 -3
- package/hydrate/index.js +2472 -971
- package/hydrate/index.mjs +2472 -971
- package/package.json +2 -2
- package/readme.md +1 -1
- package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -5
- package/dist/cjs/sd-confirm-modal.cjs.entry.js +0 -106
- package/dist/cjs/sd-loading-spinner_3.cjs.entry.js +0 -283
- package/dist/cjs/sd-radio-button-group.cjs.entry.js +0 -57
- package/dist/cjs/sd-select-v2-list-item_2.cjs.entry.js +0 -150
- package/dist/cjs/sd-select-v2-listbox_2.cjs.entry.js +0 -353
- package/dist/cjs/sd-select-v2.config-7xBJQhvx.js +0 -171
- package/dist/cjs/sd-toggle-button.cjs.entry.js +0 -49
- package/dist/collection/components/sd-loading-spinner/sd-loading-spinner.css +0 -44
- package/dist/collection/components/sd-loading-spinner/sd-loading-spinner.js +0 -46
- package/dist/collection/components/sd-radio-button-group/sd-radio-button-group.css +0 -85
- package/dist/collection/components/sd-toggle-button/sd-toggle-button.css +0 -47
- package/dist/components/p-5OtzmjLh.js +0 -1
- package/dist/components/p-BFaIxm6b.js +0 -1
- package/dist/components/p-BP-QKaKz.js +0 -1
- package/dist/components/p-BSZadK9N.js +0 -1
- package/dist/components/p-BbtO5CEW.js +0 -1
- package/dist/components/p-BxPyZJaz.js +0 -1
- package/dist/components/p-C-qSDgVU.js +0 -1
- package/dist/components/p-C4i826lM.js +0 -1
- package/dist/components/p-CEa1HSpw.js +0 -1
- package/dist/components/p-CYRGa0VL.js +0 -1
- package/dist/components/p-ClgihpRm.js +0 -1
- package/dist/components/p-D-Y0-FQk.js +0 -1
- package/dist/components/p-D-pFdq6g.js +0 -1
- package/dist/components/p-DPipeCRI.js +0 -1
- package/dist/components/p-DSYw-7RA.js +0 -1
- package/dist/components/p-DXAB0k9r.js +0 -1
- package/dist/components/p-mO5GcwI3.js +0 -1
- package/dist/components/sd-loading-spinner.js +0 -1
- package/dist/components/sd-radio-button-group.js +0 -1
- package/dist/components/sd-toggle-button.js +0 -1
- package/dist/design-system/p-0e6f5a99.entry.js +0 -1
- package/dist/design-system/p-22a4972a.entry.js +0 -1
- package/dist/design-system/p-27df33c1.entry.js +0 -1
- package/dist/design-system/p-3ac6a626.entry.js +0 -1
- package/dist/design-system/p-3f04d68a.entry.js +0 -1
- package/dist/design-system/p-6610c16b.entry.js +0 -1
- package/dist/design-system/p-739ac181.entry.js +0 -1
- package/dist/design-system/p-7dce4241.entry.js +0 -1
- package/dist/design-system/p-7e4c0a36.entry.js +0 -1
- package/dist/design-system/p-8b5b2866.entry.js +0 -1
- package/dist/design-system/p-90f51f65.entry.js +0 -1
- package/dist/design-system/p-C3eQSZx-.js +0 -1
- package/dist/design-system/p-C4i826lM.js +0 -1
- package/dist/design-system/p-DQuL1Twl.js +0 -1
- package/dist/design-system/p-DsU722JF.js +0 -2
- package/dist/design-system/p-a6bc8512.entry.js +0 -1
- package/dist/design-system/p-afeb740a.entry.js +0 -1
- package/dist/design-system/p-b3e0e6f4.entry.js +0 -1
- package/dist/design-system/p-ba90dc5f.entry.js +0 -1
- package/dist/design-system/p-bad88292.entry.js +0 -1
- package/dist/design-system/p-cbb5575d.entry.js +0 -1
- package/dist/design-system/p-ce6a0b0f.entry.js +0 -1
- package/dist/design-system/p-d07448fe.entry.js +0 -1
- package/dist/design-system/p-d1a94401.entry.js +0 -1
- package/dist/design-system/p-d5b5cfc7.entry.js +0 -1
- package/dist/design-system/p-d75e0dc0.entry.js +0 -1
- package/dist/design-system/p-e9ed9c00.entry.js +0 -1
- package/dist/design-system/p-f8567970.entry.js +0 -1
- package/dist/design-system/p-fa22f13c.entry.js +0 -1
- package/dist/design-system/p-fbac6160.entry.js +0 -1
- package/dist/design-system/p-mO5GcwI3.js +0 -1
- package/dist/esm/app-globals-DQuL1Twl.js +0 -3
- package/dist/esm/sd-confirm-modal.entry.js +0 -104
- package/dist/esm/sd-loading-spinner_3.entry.js +0 -279
- package/dist/esm/sd-radio-button-group.entry.js +0 -55
- package/dist/esm/sd-select-v2-list-item_2.entry.js +0 -147
- package/dist/esm/sd-select-v2-listbox_2.entry.js +0 -350
- package/dist/esm/sd-select-v2.config-C3eQSZx-.js +0 -158
- package/dist/esm/sd-toggle-button.entry.js +0 -47
- package/dist/types/components/sd-loading-spinner/sd-loading-spinner.d.ts +0 -5
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent,
|
|
1
|
+
import { r as registerInstance, c as createEvent, a as getElement, d as readTask, h, H as Host } from './index-BqHL8W3c.js';
|
|
2
|
+
import { T as TABLE_ID_ATTR } from './constants-sZMi_32I.js';
|
|
2
3
|
|
|
3
|
-
const
|
|
4
|
+
const urlAlphabet =
|
|
5
|
+
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
|
|
6
|
+
|
|
7
|
+
/* @ts-self-types="./index.d.ts" */
|
|
8
|
+
let nanoid = (size = 21) => {
|
|
9
|
+
let id = '';
|
|
10
|
+
let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)));
|
|
11
|
+
while (size--) {
|
|
12
|
+
id += urlAlphabet[bytes[size] & 63];
|
|
13
|
+
}
|
|
14
|
+
return id
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const sdTableCss = () => `sd-table,:host{display:block;width:100%;max-width:100%;min-width:0}sd-table *,:host *{box-sizing:border-box}.sd-table__container{height:var(--table-height, auto);width:var(--table-width, 100%);max-width:100%;min-width:0;color:#222222;display:flex;flex-direction:column}.sd-table__clip{width:100%;min-width:0;height:var(--table-container-height, 400px);border:1px solid #E1E1E1;border-radius:8px;overflow:hidden}.sd-table__clip--has-pagination{border-radius:8px 8px 0 0}.sd-table__wrapper{width:100%;height:100%;display:flex;flex-direction:column;position:relative;font-size:12px;overflow:auto;background:#FFFFFF}.sd-table__wrapper--loading{overflow:hidden !important;pointer-events:none}.sd-table__wrapper--no-data{overflow:hidden;pointer-events:none}.sd-table__no-data{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;font-size:12px;color:#888888;pointer-events:none;z-index:200;background:rgba(255, 255, 255, 0.6)}.sd-table__loading{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(255, 255, 255, 0.6);z-index:200;display:flex;align-items:center;justify-content:center;pointer-events:none}.sd-table{background-color:white;display:table;width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.sd-table--selectable sd-thead,.sd-table--selectable sd-tbody{--selectable:true}.sd-table--sticky-header sd-thead thead{position:sticky;top:0;z-index:120}.sd-table--sticky-column sd-thead,.sd-table--sticky-column sd-tbody{--sticky-column:true}.sd-table--scrolled-left sd-thead,.sd-table--scrolled-left sd-tbody{--scrolled-left:true}.sd-table--scrolled-right sd-thead,.sd-table--scrolled-right sd-tbody{--scrolled-right:true}.sd-table--resizable sd-thead{--resizable:true}.sd-table--no-data sd-thead{opacity:0.4}.sd-table__pagination{position:relative;background:#F9F9F9;height:48px;display:flex;align-items:center;justify-content:center;border:1px solid #E1E1E1;border-top:none;border-radius:0 0 8px 8px}.sd-table__pagination sd-select-v2{position:absolute;right:10px;top:50%;transform:translateY(-50%)}`;
|
|
4
18
|
|
|
5
19
|
const SdTable = class {
|
|
6
20
|
constructor(hostRef) {
|
|
@@ -8,9 +22,14 @@ const SdTable = class {
|
|
|
8
22
|
this.sdSelectChange = createEvent(this, "sdSelectChange", 7);
|
|
9
23
|
this.sdPageChange = createEvent(this, "sdPageChange", 7);
|
|
10
24
|
this.sdRowsPerPageChange = createEvent(this, "sdRowsPerPageChange", 7);
|
|
25
|
+
this.sdVirtualUpdate = createEvent(this, "sdVirtualUpdate", 7);
|
|
26
|
+
this.sdVirtualReachEnd = createEvent(this, "sdVirtualReachEnd", 7);
|
|
11
27
|
}
|
|
28
|
+
static DEFAULT_NO_DATA_LABEL = '데이터가 없습니다.';
|
|
12
29
|
get el() { return getElement(this); }
|
|
13
|
-
|
|
30
|
+
tableId = nanoid(8);
|
|
31
|
+
fallbackTableId = nanoid(8);
|
|
32
|
+
columns = [];
|
|
14
33
|
rows;
|
|
15
34
|
selected = [];
|
|
16
35
|
rowKey = 'id';
|
|
@@ -20,603 +39,391 @@ const SdTable = class {
|
|
|
20
39
|
height;
|
|
21
40
|
stickyHeader = false;
|
|
22
41
|
stickyColumn = { left: 0, right: 0 };
|
|
23
|
-
noDataLabel =
|
|
42
|
+
noDataLabel = SdTable.DEFAULT_NO_DATA_LABEL;
|
|
43
|
+
resolvedNoDataLabel = SdTable.DEFAULT_NO_DATA_LABEL;
|
|
24
44
|
isLoading = false;
|
|
25
45
|
pagination;
|
|
26
46
|
useInternalPagination = false;
|
|
27
47
|
useRowsPerPageSelect = false;
|
|
48
|
+
// ─── Virtual Scroll ───────────────────────────────────────────────
|
|
49
|
+
useVirtualScroll = false;
|
|
50
|
+
rowHeight = 40;
|
|
51
|
+
virtualBuffer = 5;
|
|
52
|
+
virtualEndThreshold = 10;
|
|
53
|
+
// ─────────────────────────────────────────────────────────────────
|
|
28
54
|
rowsPerPageOption = [
|
|
29
55
|
{ label: '10개씩 보기', value: 10 },
|
|
30
56
|
{ label: '25개씩 보기', value: 25 },
|
|
31
57
|
{ label: '50개씩 보기', value: 50 },
|
|
32
58
|
{ label: '100개씩 보기', value: 100 },
|
|
33
59
|
];
|
|
34
|
-
useVirtualScroll = {}; // 가상 스크롤 사용 여부
|
|
35
|
-
virtualRowHeight = 44; // 가상 스크롤 사용시 각 행의 높이 - 세로 가상 스크롤 사용시 필수값
|
|
36
|
-
// 가상 스크롤 사용시 각 열의 너비 - 가로 가상 스크롤 사용시 필수값
|
|
37
|
-
// 가상화하려는 컬럼의 넓이는 무조건 고정(resizable의 경우 넓이가 변동되는데 이때에는 고려 x)
|
|
38
|
-
virtualColumnWidth = 120;
|
|
39
|
-
virtualBufferSize = {
|
|
40
|
-
vertical: 5,
|
|
41
|
-
horizontal: 5,
|
|
42
|
-
}; // 가상 스크롤 위아래 버퍼 크기
|
|
43
60
|
sdSelectChange;
|
|
44
61
|
sdPageChange;
|
|
45
62
|
sdRowsPerPageChange;
|
|
46
|
-
|
|
47
|
-
|
|
63
|
+
sdVirtualUpdate;
|
|
64
|
+
sdVirtualReachEnd;
|
|
65
|
+
currentPage = 1;
|
|
66
|
+
innerRowsPerPage = 10;
|
|
48
67
|
innerSelected = new Set();
|
|
49
68
|
columnWidths = [];
|
|
50
69
|
scrolledLeft = false;
|
|
51
70
|
scrolledRight = false;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
virtualStartColIdx = 0;
|
|
58
|
-
virtualEndColIdx = 0;
|
|
59
|
-
scrollLeftPosition = 0;
|
|
60
|
-
// 가상 스크롤 Raf(Request Animation Frame) 관리
|
|
61
|
-
scrollRequestAnimationFrame = null;
|
|
71
|
+
rowCount = 0;
|
|
72
|
+
loadingScrollTop = 0;
|
|
73
|
+
vsStart = 0;
|
|
74
|
+
vsEnd = 0;
|
|
75
|
+
lastReachEndNotifiedRowCount = -1;
|
|
62
76
|
scrollContainer = null;
|
|
63
|
-
resizeObserver = null;
|
|
64
|
-
rafScheduled = false;
|
|
65
|
-
pendingUpdates = {
|
|
66
|
-
vertical: false,
|
|
67
|
-
horizontal: false,
|
|
68
|
-
};
|
|
69
|
-
// 상태 캐시값
|
|
70
|
-
cachedVirtualRows = null;
|
|
71
|
-
cachedVirtualIndexKey = '';
|
|
72
|
-
cachedColumnOrder = null;
|
|
73
|
-
lastColumnOrderKey = '';
|
|
74
|
-
// DOM 측정 캐시값
|
|
75
|
-
cachedContainerHeight = 0;
|
|
76
|
-
cachedContainerWidth = 0;
|
|
77
|
-
// 스타일 캐시
|
|
78
|
-
stickyStyleCache = new Map();
|
|
79
|
-
// isAllChecked 캐시
|
|
80
|
-
cachedIsAllChecked;
|
|
81
|
-
lastSelectionKey = '';
|
|
82
77
|
onScroll;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
handleUseVirtualScrollChange() {
|
|
88
|
-
this.columnWidths = this.getColumnWidths(this.columns || []);
|
|
89
|
-
this.refreshColumnLayout();
|
|
90
|
-
if (this.useVirtualScroll.vertical) {
|
|
91
|
-
this.scheduleUpdate('vertical');
|
|
92
|
-
}
|
|
78
|
+
toFiniteNumber(value, fallback) {
|
|
79
|
+
const n = typeof value === 'number' ? value : Number(value);
|
|
80
|
+
return Number.isFinite(n) ? n : fallback;
|
|
93
81
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
return;
|
|
97
|
-
this.columnWidths = this.getColumnWidths(this.columns || []);
|
|
98
|
-
this.refreshColumnLayout();
|
|
82
|
+
isRowsPerPageValue(value) {
|
|
83
|
+
return value === null || typeof value === 'string' || typeof value === 'number';
|
|
99
84
|
}
|
|
100
|
-
|
|
101
|
-
|
|
85
|
+
isValidTableId(value) {
|
|
86
|
+
return (typeof value === 'string' &&
|
|
87
|
+
value.trim().length > 0 &&
|
|
88
|
+
value !== 'undefined' &&
|
|
89
|
+
value !== 'null');
|
|
102
90
|
}
|
|
103
|
-
|
|
104
|
-
this.
|
|
91
|
+
getResolvedTableId() {
|
|
92
|
+
if (this.isValidTableId(this.tableId))
|
|
93
|
+
return this.tableId;
|
|
94
|
+
const attrId = this.el?.getAttribute(TABLE_ID_ATTR);
|
|
95
|
+
if (this.isValidTableId(attrId))
|
|
96
|
+
return attrId;
|
|
97
|
+
return this.fallbackTableId;
|
|
105
98
|
}
|
|
106
|
-
|
|
107
|
-
this.
|
|
108
|
-
if (this.
|
|
109
|
-
this.
|
|
99
|
+
syncTableIdAttribute() {
|
|
100
|
+
const resolvedTableId = this.getResolvedTableId();
|
|
101
|
+
if (this.el?.getAttribute(TABLE_ID_ATTR) !== resolvedTableId) {
|
|
102
|
+
this.el.setAttribute(TABLE_ID_ATTR, resolvedTableId);
|
|
110
103
|
}
|
|
111
104
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
if (this.useVirtualScroll.vertical) {
|
|
116
|
-
this.scheduleUpdate('vertical');
|
|
105
|
+
handleIsLoadingChange(newVal) {
|
|
106
|
+
if (newVal) {
|
|
107
|
+
this.loadingScrollTop = this.scrollContainer?.scrollTop ?? 0;
|
|
117
108
|
}
|
|
118
109
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
this.
|
|
127
|
-
this.
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
110
|
+
handleUseVirtualScrollChange(newVal) {
|
|
111
|
+
if (newVal) {
|
|
112
|
+
// DOM이 새 --table-container-height로 업데이트된 후 계산해야 정확함
|
|
113
|
+
readTask(() => this.propagateVirtualUpdate());
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
handleColumnsChange(newCols) {
|
|
117
|
+
this.columnWidths = newCols.map(c => parseInt(c.width || '120', 10));
|
|
118
|
+
this.refreshChildrenConfig();
|
|
119
|
+
}
|
|
120
|
+
handleRowsChange(newRows) {
|
|
121
|
+
if (!Array.isArray(newRows))
|
|
122
|
+
return;
|
|
123
|
+
this.rowCount = newRows.length;
|
|
124
|
+
if (this.useVirtualScroll)
|
|
125
|
+
this.propagateVirtualUpdate(true);
|
|
126
|
+
this.pushRowsToChildren(newRows);
|
|
127
|
+
}
|
|
128
|
+
handleTableIdChange() {
|
|
129
|
+
this.syncTableIdAttribute();
|
|
130
|
+
}
|
|
131
|
+
handleNoDataLabelChange(newLabel) {
|
|
132
|
+
if (typeof newLabel === 'string' &&
|
|
133
|
+
newLabel.trim().length > 0 &&
|
|
134
|
+
newLabel !== 'undefined' &&
|
|
135
|
+
newLabel !== 'null') {
|
|
136
|
+
this.resolvedNoDataLabel = newLabel;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
this.resolvedNoDataLabel = SdTable.DEFAULT_NO_DATA_LABEL;
|
|
134
140
|
}
|
|
135
141
|
}
|
|
136
|
-
|
|
137
|
-
this.
|
|
138
|
-
this.lastSelectionKey = '';
|
|
142
|
+
handleConfigChange() {
|
|
143
|
+
this.refreshChildrenConfig();
|
|
139
144
|
}
|
|
140
|
-
|
|
141
|
-
this.
|
|
142
|
-
this.clearSelectionCache();
|
|
145
|
+
handleSelectedChange(newSelected) {
|
|
146
|
+
this.innerSelected = new Set(newSelected);
|
|
143
147
|
}
|
|
144
148
|
handlePaginationChange(newVal) {
|
|
145
|
-
this.clearRowDerivedCache();
|
|
146
149
|
if (newVal?.page && newVal.page !== this.currentPage) {
|
|
147
150
|
this.currentPage = newVal.page;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this.calculateVisibleRange();
|
|
152
|
-
}
|
|
151
|
+
}
|
|
152
|
+
if (newVal?.rowsPerPage && newVal.rowsPerPage !== this.innerRowsPerPage) {
|
|
153
|
+
this.innerRowsPerPage = newVal.rowsPerPage;
|
|
153
154
|
}
|
|
154
155
|
}
|
|
155
156
|
componentWillLoad() {
|
|
156
|
-
this.
|
|
157
|
-
this.
|
|
158
|
-
this.
|
|
157
|
+
this.syncTableIdAttribute();
|
|
158
|
+
this.handleNoDataLabelChange(this.noDataLabel);
|
|
159
|
+
this.innerSelected = new Set(this.selected || []);
|
|
160
|
+
this.columnWidths = (this.columns || []).map(c => parseInt(c.width || '120', 10));
|
|
159
161
|
if (this.pagination?.page) {
|
|
160
162
|
this.currentPage = this.pagination.page;
|
|
161
163
|
}
|
|
164
|
+
if (this.pagination?.rowsPerPage) {
|
|
165
|
+
this.innerRowsPerPage = this.pagination.rowsPerPage;
|
|
166
|
+
}
|
|
167
|
+
const el = this.el;
|
|
168
|
+
el.isRowSelectedSync = this.isRowSelectedSync.bind(this);
|
|
169
|
+
el.updateRowSelectSync = this.updateRowSelectSync.bind(this);
|
|
170
|
+
el.toggleSelectAllSync = this.toggleSelectAllSync.bind(this);
|
|
171
|
+
el.getIsAllCheckedSync = this.getIsAllCheckedSync.bind(this);
|
|
172
|
+
el.getStickyStyleSync = this.getStickyStyleSync.bind(this);
|
|
173
|
+
el.setRowCountSync = this.setRowCountSync.bind(this);
|
|
174
|
+
el.handleResize = this.handleResize.bind(this);
|
|
175
|
+
el.getPaginationInfoSync = this.getPaginationInfoSync.bind(this);
|
|
176
|
+
el.getVirtualScrollRangeSync = this.getVirtualScrollRangeSync.bind(this);
|
|
177
|
+
el.getConfigSync = this.getConfigSync.bind(this);
|
|
178
|
+
el.getTableIdSync = () => this.getResolvedTableId();
|
|
179
|
+
el.getVirtualScrollConfigSync = this.getVirtualScrollConfigSync.bind(this);
|
|
180
|
+
el.calculateVisibleRange = this.calculateVisibleRange.bind(this);
|
|
181
|
+
if (Array.isArray(this.rows)) {
|
|
182
|
+
this.rowCount = this.rows.length;
|
|
183
|
+
this.pushRowsToChildren(this.rows);
|
|
184
|
+
}
|
|
162
185
|
}
|
|
163
186
|
componentDidLoad() {
|
|
187
|
+
if (Array.isArray(this.rows)) {
|
|
188
|
+
this.pushRowsToChildren(this.rows);
|
|
189
|
+
}
|
|
164
190
|
readTask(() => {
|
|
165
|
-
const
|
|
166
|
-
if (!
|
|
191
|
+
const wrapper = this.el.shadowRoot?.querySelector('.sd-table__wrapper');
|
|
192
|
+
if (!wrapper)
|
|
167
193
|
return;
|
|
194
|
+
let rafPending = false;
|
|
168
195
|
this.onScroll = () => {
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
const
|
|
173
|
-
const verticalChanged = this.useVirtualScroll.vertical && this.scrollTopPosition !== scrollTop;
|
|
174
|
-
const horizontalChanged = this.useVirtualScroll.horizontal && this.scrollLeftPosition !== scrollLeft;
|
|
196
|
+
// 가로 스크롤 그림자
|
|
197
|
+
const scrollLeft = wrapper.scrollLeft;
|
|
198
|
+
const scrollWidth = wrapper.scrollWidth;
|
|
199
|
+
const clientWidth = wrapper.clientWidth;
|
|
175
200
|
const newScrolledLeft = scrollLeft > 0;
|
|
176
201
|
const newScrolledRight = scrollLeft + clientWidth < scrollWidth;
|
|
177
202
|
if (this.scrolledLeft !== newScrolledLeft || this.scrolledRight !== newScrolledRight) {
|
|
178
203
|
this.scrolledLeft = newScrolledLeft;
|
|
179
204
|
this.scrolledRight = newScrolledRight;
|
|
205
|
+
this.refreshChildrenConfig();
|
|
180
206
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
this.scrollTopPosition = scrollTop;
|
|
188
|
-
this.calculateVisibleRange();
|
|
189
|
-
}
|
|
190
|
-
if (horizontalChanged) {
|
|
191
|
-
this.scrollLeftPosition = scrollLeft;
|
|
192
|
-
this.calculateVisibleColumnRange();
|
|
193
|
-
}
|
|
194
|
-
this.scrollRequestAnimationFrame = null;
|
|
207
|
+
// 세로 가상 스크롤 — RAF로 프레임당 1회만 처리
|
|
208
|
+
if (this.useVirtualScroll && !rafPending) {
|
|
209
|
+
rafPending = true;
|
|
210
|
+
requestAnimationFrame(() => {
|
|
211
|
+
rafPending = false;
|
|
212
|
+
this.propagateVirtualUpdate();
|
|
195
213
|
});
|
|
196
214
|
}
|
|
197
215
|
};
|
|
198
|
-
this.scrollContainer =
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
this.startResizeObserver();
|
|
205
|
-
if (this.useVirtualScroll.vertical) {
|
|
206
|
-
this.calculateVisibleRange();
|
|
207
|
-
}
|
|
208
|
-
if (this.useVirtualScroll.horizontal) {
|
|
209
|
-
this.calculateVisibleColumnRange();
|
|
210
|
-
}
|
|
211
|
-
this.onScroll();
|
|
212
|
-
}
|
|
213
|
-
});
|
|
216
|
+
this.scrollContainer = wrapper;
|
|
217
|
+
wrapper.addEventListener('scroll', this.onScroll, { passive: true });
|
|
218
|
+
this.onScroll();
|
|
219
|
+
if (this.useVirtualScroll) {
|
|
220
|
+
this.propagateVirtualUpdate(); // 초기 렌더
|
|
221
|
+
}
|
|
214
222
|
});
|
|
215
223
|
}
|
|
216
|
-
changePage(page) {
|
|
217
|
-
if (!this.useInternalPagination) {
|
|
218
|
-
this.sdPageChange.emit(page);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
this.currentPage = page;
|
|
222
|
-
this.clearRowDerivedCache();
|
|
223
|
-
if (this.useVirtualScroll.vertical && this.scrollContainer) {
|
|
224
|
-
this.scrollContainer.scrollTo({ top: 0, behavior: 'instant' });
|
|
225
|
-
this.scrollTopPosition = 0;
|
|
226
|
-
this.calculateVisibleRange();
|
|
227
|
-
}
|
|
228
|
-
this.sdPageChange.emit(this.currentPage);
|
|
229
|
-
}
|
|
230
|
-
changeRowsPerPage(perPage) {
|
|
231
|
-
const changedRowsPerPage = perPage ? Number(perPage) : 0;
|
|
232
|
-
if (!this.useInternalPagination) {
|
|
233
|
-
this.sdRowsPerPageChange.emit(changedRowsPerPage);
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
const newRowsPerPage = Number(perPage || 0);
|
|
237
|
-
let newLastPage = Math.max(1, Math.ceil(this.innerRows.length / newRowsPerPage));
|
|
238
|
-
let newCurrentPage = this.currentPage;
|
|
239
|
-
if (newCurrentPage > newLastPage) {
|
|
240
|
-
newCurrentPage = newLastPage;
|
|
241
|
-
}
|
|
242
|
-
this.pagination = {
|
|
243
|
-
page: newCurrentPage,
|
|
244
|
-
rowsPerPage: newRowsPerPage,
|
|
245
|
-
lastPage: newLastPage,
|
|
246
|
-
};
|
|
247
|
-
this.currentPage = newCurrentPage;
|
|
248
|
-
this.clearRowDerivedCache();
|
|
249
|
-
if (this.useVirtualScroll.vertical && this.scrollContainer) {
|
|
250
|
-
this.scrollContainer.scrollTo({ top: 0, behavior: 'instant' });
|
|
251
|
-
this.scrollTopPosition = 0;
|
|
252
|
-
this.calculateVisibleRange();
|
|
253
|
-
}
|
|
254
|
-
this.sdRowsPerPageChange.emit(changedRowsPerPage);
|
|
255
|
-
}
|
|
256
224
|
disconnectedCallback() {
|
|
257
225
|
if (this.scrollContainer && this.onScroll) {
|
|
258
226
|
this.scrollContainer.removeEventListener('scroll', this.onScroll);
|
|
259
227
|
}
|
|
260
|
-
this.resizeObserver?.disconnect();
|
|
261
|
-
if (this.scrollRequestAnimationFrame !== null) {
|
|
262
|
-
cancelAnimationFrame(this.scrollRequestAnimationFrame);
|
|
263
|
-
}
|
|
264
228
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
if (
|
|
271
|
-
|
|
272
|
-
const { rowsPerPage = this.rows.length } = this.pagination || {};
|
|
273
|
-
return this.innerRows.slice((this.currentPage - 1) * rowsPerPage, this.currentPage * rowsPerPage);
|
|
274
|
-
}
|
|
275
|
-
get virtualRows() {
|
|
276
|
-
const pageKey = this.useInternalPagination
|
|
277
|
-
? `${this.currentPage}-${this.pagination?.rowsPerPage ?? 'all'}`
|
|
278
|
-
: 'all';
|
|
279
|
-
const newVirtualIndexKey = `${pageKey}-${this.innerRows.length}-${this.virtualStartIndex}-${this.virtualEndIndex}`;
|
|
280
|
-
if (this.cachedVirtualRows && this.cachedVirtualIndexKey === newVirtualIndexKey) {
|
|
281
|
-
return this.cachedVirtualRows;
|
|
282
|
-
}
|
|
283
|
-
this.cachedVirtualIndexKey = newVirtualIndexKey;
|
|
284
|
-
if (!this.useVirtualScroll.vertical) {
|
|
285
|
-
this.cachedVirtualRows = this.paginatedRows.map((row, idx) => ({ row, actualIndex: idx }));
|
|
286
|
-
}
|
|
287
|
-
else {
|
|
288
|
-
this.cachedVirtualRows = this.paginatedRows
|
|
289
|
-
.slice(this.virtualStartIndex, this.virtualEndIndex + 1)
|
|
290
|
-
.map((row, relativeIdx) => ({
|
|
291
|
-
row,
|
|
292
|
-
actualIndex: this.virtualStartIndex + relativeIdx,
|
|
293
|
-
}));
|
|
294
|
-
}
|
|
295
|
-
return this.cachedVirtualRows;
|
|
296
|
-
}
|
|
297
|
-
get topSpacerHeight() {
|
|
298
|
-
if (!this.useVirtualScroll.vertical || this.virtualStartIndex === 0)
|
|
299
|
-
return 0;
|
|
300
|
-
return this.virtualStartIndex * this.virtualRowHeight;
|
|
301
|
-
}
|
|
302
|
-
get bottomSpacerHeight() {
|
|
303
|
-
if (!this.useVirtualScroll.vertical)
|
|
304
|
-
return 0;
|
|
305
|
-
const remainingRows = this.paginatedRows.length - this.virtualEndIndex - 1;
|
|
306
|
-
return remainingRows > 0 ? remainingRows * this.virtualRowHeight : 0;
|
|
307
|
-
}
|
|
308
|
-
getHorizontalSpacerWidth(position) {
|
|
309
|
-
const { stickyLeftCount, stickyRightCount } = this.getNormalizedStickyCounts();
|
|
310
|
-
const virtualColumnWidths = this.columnWidths.slice(stickyLeftCount, this.tableColumns.length - stickyRightCount);
|
|
311
|
-
const remainingCols = virtualColumnWidths.length - this.virtualEndColIdx - 1;
|
|
312
|
-
if (position === 'right' && remainingCols <= 0)
|
|
313
|
-
return 0;
|
|
314
|
-
const targetIndex = position === 'left' ? [0, this.virtualStartColIdx] : [this.virtualEndColIdx + 1];
|
|
315
|
-
return virtualColumnWidths.slice(...targetIndex).reduce((sum, width) => sum + width, 0);
|
|
316
|
-
}
|
|
317
|
-
get leftSpacerWidth() {
|
|
318
|
-
if (!this.useVirtualScroll.horizontal || this.virtualStartColIdx === 0) {
|
|
319
|
-
return 0;
|
|
320
|
-
}
|
|
321
|
-
return this.getHorizontalSpacerWidth('left');
|
|
229
|
+
pushRowsToChildren(rows) {
|
|
230
|
+
const tbody = this.el.querySelector('sd-tbody');
|
|
231
|
+
if (tbody)
|
|
232
|
+
tbody.rows = rows;
|
|
233
|
+
const thead = this.el.querySelector('sd-thead');
|
|
234
|
+
if (thead)
|
|
235
|
+
thead.rows = rows;
|
|
322
236
|
}
|
|
323
|
-
|
|
324
|
-
if (
|
|
325
|
-
|
|
237
|
+
handleStructureSlotChange = () => {
|
|
238
|
+
if (Array.isArray(this.rows)) {
|
|
239
|
+
this.pushRowsToChildren(this.rows);
|
|
326
240
|
}
|
|
327
|
-
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
241
|
+
this.refreshChildrenConfig();
|
|
242
|
+
};
|
|
243
|
+
refreshChildrenSelection() {
|
|
244
|
+
const thead = this.el.querySelector('sd-thead');
|
|
245
|
+
const rows = this.el.querySelectorAll('sd-tr');
|
|
246
|
+
thead?.refreshSelection?.();
|
|
247
|
+
rows.forEach(tr => tr?.refreshSelection?.());
|
|
248
|
+
}
|
|
249
|
+
refreshChildrenConfig() {
|
|
250
|
+
const thead = this.el.querySelector('sd-thead');
|
|
251
|
+
const rows = this.el.querySelectorAll('sd-tr');
|
|
252
|
+
thead?.refreshConfig?.();
|
|
253
|
+
rows.forEach(tr => tr?.refreshConfig?.());
|
|
254
|
+
}
|
|
255
|
+
maybeEmitVirtualReachEnd(start, end) {
|
|
256
|
+
const threshold = Math.max(1, this.virtualEndThreshold);
|
|
257
|
+
const nearEnd = end >= Math.max(0, this.rowCount - threshold);
|
|
258
|
+
if (!nearEnd)
|
|
259
|
+
return;
|
|
260
|
+
if (this.lastReachEndNotifiedRowCount === this.rowCount)
|
|
261
|
+
return;
|
|
262
|
+
this.lastReachEndNotifiedRowCount = this.rowCount;
|
|
263
|
+
this.sdVirtualReachEnd.emit({
|
|
264
|
+
from: start,
|
|
265
|
+
to: end,
|
|
266
|
+
rowCount: this.rowCount,
|
|
267
|
+
threshold,
|
|
268
|
+
});
|
|
333
269
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
270
|
+
propagateVirtualUpdate(forceSpacerUpdate = false) {
|
|
271
|
+
if (!this.scrollContainer || !this.useVirtualScroll)
|
|
272
|
+
return;
|
|
273
|
+
const scrollTop = this.toFiniteNumber(this.scrollContainer.scrollTop, 0);
|
|
274
|
+
const containerHeight = this.toFiniteNumber(this.scrollContainer.clientHeight, 0);
|
|
275
|
+
const { start, end } = this.calculateVisibleRange(scrollTop, containerHeight);
|
|
276
|
+
if (!Number.isFinite(start) || !Number.isFinite(end))
|
|
277
|
+
return;
|
|
278
|
+
const rangeChanged = this.vsStart !== start || this.vsEnd !== end;
|
|
279
|
+
if (!rangeChanged && !forceSpacerUpdate)
|
|
280
|
+
return;
|
|
281
|
+
this.vsStart = start;
|
|
282
|
+
this.vsEnd = end;
|
|
283
|
+
const topHeight = start * this.rowHeight;
|
|
284
|
+
const bottomHeight = Math.max(0, (this.rowCount - end) * this.rowHeight);
|
|
285
|
+
const tbody = this.el.querySelector('sd-tbody');
|
|
286
|
+
tbody?.setSpacersSync?.(topHeight, bottomHeight);
|
|
287
|
+
if (rangeChanged) {
|
|
288
|
+
this.sdVirtualUpdate.emit({
|
|
289
|
+
from: start,
|
|
290
|
+
to: end,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
this.maybeEmitVirtualReachEnd(start, end);
|
|
337
294
|
}
|
|
338
|
-
|
|
339
|
-
return
|
|
340
|
-
|
|
341
|
-
this.
|
|
342
|
-
this.
|
|
343
|
-
this.
|
|
344
|
-
|
|
345
|
-
this.
|
|
346
|
-
|
|
347
|
-
this.scrolledRight && 'sd-table--scrolled-right',
|
|
348
|
-
]
|
|
349
|
-
.filter(Boolean)
|
|
350
|
-
.join(' ');
|
|
295
|
+
getVirtualScrollConfigSync() {
|
|
296
|
+
return {
|
|
297
|
+
useVirtualScroll: this.useVirtualScroll,
|
|
298
|
+
rowHeight: this.rowHeight,
|
|
299
|
+
virtualBuffer: this.virtualBuffer,
|
|
300
|
+
vsStart: this.vsStart,
|
|
301
|
+
vsEnd: this.vsEnd,
|
|
302
|
+
rowCount: this.rowCount,
|
|
303
|
+
};
|
|
351
304
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
305
|
+
getConfigSync() {
|
|
306
|
+
return {
|
|
307
|
+
columns: this.columns,
|
|
308
|
+
selectable: this.selectable,
|
|
309
|
+
resizable: this.resizable,
|
|
310
|
+
stickyColumn: this.stickyColumn,
|
|
311
|
+
stickyHeader: this.stickyHeader,
|
|
312
|
+
scrolledLeft: this.scrolledLeft,
|
|
313
|
+
scrolledRight: this.scrolledRight,
|
|
314
|
+
columnWidths: this.columnWidths,
|
|
315
|
+
};
|
|
355
316
|
}
|
|
356
|
-
|
|
357
|
-
return this.
|
|
317
|
+
isRowSelectedSync(row) {
|
|
318
|
+
return Array.from(this.innerSelected).some(r => r[this.rowKey] === row[this.rowKey]);
|
|
358
319
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
return Array.from(this.innerSelected).some(r => this.getRowKeyValue(r) === this.getRowKeyValue(row));
|
|
320
|
+
async isRowSelected(row) {
|
|
321
|
+
return this.isRowSelectedSync(row);
|
|
362
322
|
}
|
|
363
|
-
|
|
323
|
+
updateRowSelectSync(row) {
|
|
364
324
|
const selectedArray = Array.from(this.innerSelected);
|
|
365
|
-
const exists = this.
|
|
325
|
+
const exists = this.isRowSelectedSync(row);
|
|
366
326
|
const newSelected = exists
|
|
367
|
-
? selectedArray.filter(r => this.
|
|
327
|
+
? selectedArray.filter(r => r[this.rowKey] !== row[this.rowKey])
|
|
368
328
|
: [...selectedArray, row];
|
|
369
|
-
// 동일 상태면 set하지 않음 → 불필요 렌더 방지
|
|
370
329
|
if (newSelected.length === selectedArray.length)
|
|
371
330
|
return;
|
|
372
|
-
this.innerSelected = new Set(
|
|
373
|
-
this.clearSelectionCache();
|
|
331
|
+
this.innerSelected = new Set(newSelected);
|
|
374
332
|
this.selected = Array.from(this.innerSelected);
|
|
375
333
|
this.sdSelectChange.emit(Array.from(this.innerSelected));
|
|
334
|
+
this.refreshChildrenSelection();
|
|
335
|
+
}
|
|
336
|
+
async updateRowSelect(row) {
|
|
337
|
+
this.updateRowSelectSync(row);
|
|
376
338
|
}
|
|
377
|
-
|
|
378
|
-
const selectedRows = Array.from(this.innerSelected);
|
|
339
|
+
toggleSelectAllSync(checked, rows) {
|
|
379
340
|
if (checked) {
|
|
380
|
-
|
|
341
|
+
const pageRows = new Set([...rows]);
|
|
342
|
+
this.innerSelected = new Set([...this.innerSelected, ...pageRows]);
|
|
381
343
|
}
|
|
382
344
|
else {
|
|
383
|
-
const currentPageKeys =
|
|
384
|
-
this.innerSelected = new Set(
|
|
345
|
+
const currentPageKeys = rows.map(r => r[this.rowKey]);
|
|
346
|
+
this.innerSelected = new Set([...this.innerSelected].filter(r => !currentPageKeys.includes(r[this.rowKey])));
|
|
385
347
|
}
|
|
386
|
-
this.clearSelectionCache();
|
|
387
348
|
this.selected = Array.from(this.innerSelected);
|
|
388
349
|
this.sdSelectChange.emit(Array.from(this.innerSelected));
|
|
350
|
+
this.refreshChildrenSelection();
|
|
389
351
|
}
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
const selectedKeys = Array.from(this.innerSelected)
|
|
393
|
-
.map(row => String(this.getRowKeyValue(row)))
|
|
394
|
-
.sort()
|
|
395
|
-
.join('|');
|
|
396
|
-
const selectionKey = `${paginatedKeys}::${selectedKeys}`;
|
|
397
|
-
if (this.cachedIsAllChecked !== undefined && this.lastSelectionKey === selectionKey) {
|
|
398
|
-
return this.cachedIsAllChecked;
|
|
399
|
-
}
|
|
400
|
-
const total = this.paginatedRows.length;
|
|
401
|
-
const selectedCount = this.paginatedRows.filter(row => Array.from(this.innerSelected).some(selectedRow => this.getRowKeyValue(selectedRow) === this.getRowKeyValue(row))).length;
|
|
402
|
-
let result;
|
|
403
|
-
if (selectedCount === 0) {
|
|
404
|
-
result = false; // 아무것도 안 선택됨
|
|
405
|
-
}
|
|
406
|
-
else if (selectedCount === total) {
|
|
407
|
-
result = true; // 전부 선택됨
|
|
408
|
-
}
|
|
409
|
-
else {
|
|
410
|
-
result = null; // 일부만 선택됨
|
|
411
|
-
}
|
|
412
|
-
this.cachedIsAllChecked = result;
|
|
413
|
-
this.lastSelectionKey = selectionKey;
|
|
414
|
-
return result;
|
|
415
|
-
}
|
|
416
|
-
// RAF 통합 관리
|
|
417
|
-
scheduleUpdate(type) {
|
|
418
|
-
this.pendingUpdates[type] = true;
|
|
419
|
-
if (!this.rafScheduled) {
|
|
420
|
-
this.rafScheduled = true;
|
|
421
|
-
this.scrollRequestAnimationFrame = requestAnimationFrame(() => {
|
|
422
|
-
if (this.pendingUpdates.vertical)
|
|
423
|
-
this.calculateVisibleRange();
|
|
424
|
-
if (this.pendingUpdates.horizontal)
|
|
425
|
-
this.calculateVisibleColumnRange();
|
|
426
|
-
this.pendingUpdates = { vertical: false, horizontal: false };
|
|
427
|
-
this.rafScheduled = false;
|
|
428
|
-
this.scrollRequestAnimationFrame = null;
|
|
429
|
-
});
|
|
430
|
-
}
|
|
352
|
+
async toggleSelectAll(checked, rows) {
|
|
353
|
+
this.toggleSelectAllSync(checked, rows);
|
|
431
354
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
let containerHeight = this.cachedContainerHeight;
|
|
441
|
-
if (containerHeight === 0 && this.scrollContainer) {
|
|
442
|
-
containerHeight = this.scrollContainer.clientHeight;
|
|
443
|
-
this.cachedContainerHeight = containerHeight;
|
|
444
|
-
}
|
|
445
|
-
const bufferSize = this.virtualBufferSize.vertical || 5;
|
|
446
|
-
const startIndex = Math.floor(scrollTop / this.virtualRowHeight);
|
|
447
|
-
const visibleCount = Math.ceil(containerHeight / this.virtualRowHeight);
|
|
448
|
-
const endIndex = startIndex + visibleCount - 1;
|
|
449
|
-
const newStartIndex = Math.max(0, startIndex - bufferSize);
|
|
450
|
-
const newEndIndex = Math.min(this.paginatedRows.length - 1, endIndex + bufferSize);
|
|
451
|
-
// 실제로 변경된 경우에만 상태 업데이트
|
|
452
|
-
if (this.virtualStartIndex !== newStartIndex || this.virtualEndIndex !== newEndIndex) {
|
|
453
|
-
this.virtualStartIndex = newStartIndex;
|
|
454
|
-
this.virtualEndIndex = newEndIndex;
|
|
455
|
-
}
|
|
355
|
+
getIsAllCheckedSync(rows) {
|
|
356
|
+
const total = rows.length;
|
|
357
|
+
const selectedCount = rows.filter(row => Array.from(this.innerSelected).some(selectedRow => selectedRow[this.rowKey] === row[this.rowKey])).length;
|
|
358
|
+
if (selectedCount === 0)
|
|
359
|
+
return false;
|
|
360
|
+
if (selectedCount === total)
|
|
361
|
+
return true;
|
|
362
|
+
return null; // indeterminate
|
|
456
363
|
}
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
464
|
-
const scrollLeft = this.scrollLeftPosition;
|
|
465
|
-
// 캐시된 값 사용, 없으면 측정 후 캐시
|
|
466
|
-
let containerWidth = this.cachedContainerWidth;
|
|
467
|
-
if (containerWidth === 0 && this.scrollContainer) {
|
|
468
|
-
containerWidth = this.scrollContainer.clientWidth;
|
|
469
|
-
this.cachedContainerWidth = containerWidth;
|
|
470
|
-
}
|
|
471
|
-
const { stickyLeftCount, stickyRightCount } = this.getNormalizedStickyCounts();
|
|
472
|
-
// 가상 스크롤 컬럼 - sticky column 제외
|
|
473
|
-
const virtualColumns = this.tableColumns.slice(stickyLeftCount, this.tableColumns.length - stickyRightCount);
|
|
474
|
-
if (virtualColumns.length === 0) {
|
|
475
|
-
this.virtualStartColIdx = 0;
|
|
476
|
-
this.virtualEndColIdx = 0;
|
|
364
|
+
async getIsAllChecked(rows) {
|
|
365
|
+
return this.getIsAllCheckedSync(rows);
|
|
366
|
+
}
|
|
367
|
+
changePage(page) {
|
|
368
|
+
if (!this.useInternalPagination) {
|
|
369
|
+
this.sdPageChange.emit(page);
|
|
477
370
|
return;
|
|
478
371
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
.slice(this.tableColumns.length - stickyRightCount)
|
|
483
|
-
.reduce((sum, width) => sum + width, 0);
|
|
484
|
-
// 가상 스크롤 영역의 너비 계산
|
|
485
|
-
const virtualScrollableWidth = containerWidth - stickyLeftWidth - stickyRightWidth;
|
|
486
|
-
const virtualColumnWidths = this.columnWidths.slice(stickyLeftCount, this.tableColumns.length - stickyRightCount);
|
|
487
|
-
const virtualScrollLeft = Math.max(0, scrollLeft - stickyLeftWidth);
|
|
488
|
-
const reducedVirtualWidth = virtualColumnWidths.reduce((acc, width, idx) => {
|
|
489
|
-
acc.push((acc[idx - 1] || 0) + width);
|
|
490
|
-
return acc;
|
|
491
|
-
}, []);
|
|
492
|
-
let startIdx = 0; // 가상 스크롤 시작 인덱스
|
|
493
|
-
let endIdx = virtualColumns.length - 1; // 가상 스크롤 종료 인덱스
|
|
494
|
-
// sticky left 영역 제외한 스크롤 위치
|
|
495
|
-
for (let i = 0; i < reducedVirtualWidth.length; i++) {
|
|
496
|
-
if (reducedVirtualWidth[i] > virtualScrollLeft) {
|
|
497
|
-
startIdx = Math.max(0, i);
|
|
498
|
-
break;
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
const scrollRight = virtualScrollLeft + virtualScrollableWidth;
|
|
502
|
-
for (let i = startIdx; i < reducedVirtualWidth.length; i++) {
|
|
503
|
-
if (reducedVirtualWidth[i] >= scrollRight) {
|
|
504
|
-
endIdx = Math.min(virtualColumns.length - 1, i);
|
|
505
|
-
break;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
const bufferSize = this.virtualBufferSize.horizontal || 5;
|
|
509
|
-
const newStartColIdx = Math.max(0, startIdx - bufferSize);
|
|
510
|
-
const newEndColIdx = Math.min(virtualColumns.length - 1, endIdx + bufferSize);
|
|
511
|
-
// 실제로 변경된 경우에만 상태 업데이트
|
|
512
|
-
if (this.virtualStartColIdx !== newStartColIdx || this.virtualEndColIdx !== newEndColIdx) {
|
|
513
|
-
this.virtualStartColIdx = newStartColIdx;
|
|
514
|
-
this.virtualEndColIdx = newEndColIdx;
|
|
515
|
-
}
|
|
372
|
+
this.currentPage = page;
|
|
373
|
+
this.sdPageChange.emit(this.currentPage);
|
|
374
|
+
this.updateRowsVisibility();
|
|
516
375
|
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
if (this.stickyStyleCache.has(colIdx)) {
|
|
521
|
-
return this.stickyStyleCache.get(colIdx);
|
|
522
|
-
}
|
|
523
|
-
const leftOffset = this.columnWidths.slice(0, colIdx).reduce((a, b) => a + b, 0) + (this.selectable ? 52 : 0);
|
|
524
|
-
const { stickyRightCount } = this.getNormalizedStickyCounts();
|
|
525
|
-
const rightOffset = this.columnWidths
|
|
526
|
-
.filter((_, i) => i >= this.tableColumns.length - stickyRightCount && i > colIdx)
|
|
527
|
-
.reduce((a, b) => a + b, 0);
|
|
528
|
-
const style = {
|
|
529
|
-
'--sticky-left-offset': `${leftOffset}px`,
|
|
530
|
-
'--sticky-right-offset': `${rightOffset}px`,
|
|
531
|
-
'width': `${this.columnWidths[colIdx]}px`,
|
|
532
|
-
'minWidth': `${this.columnWidths[colIdx]}px`,
|
|
533
|
-
'maxWidth': `${this.columnWidths[colIdx]}px`,
|
|
534
|
-
};
|
|
535
|
-
// 스타일 캐시에 저장
|
|
536
|
-
this.stickyStyleCache.set(colIdx, style);
|
|
537
|
-
return style;
|
|
376
|
+
updateRowsVisibility() {
|
|
377
|
+
const rows = this.el.querySelectorAll('sd-tr');
|
|
378
|
+
rows.forEach(tr => tr?.updateVisibility?.());
|
|
538
379
|
}
|
|
539
|
-
|
|
540
|
-
|
|
380
|
+
changeRowsPerPage(perPage) {
|
|
381
|
+
const changedRowsPerPage = perPage ? Number(perPage) : 0;
|
|
382
|
+
if (!this.useInternalPagination) {
|
|
383
|
+
this.sdRowsPerPageChange.emit(changedRowsPerPage);
|
|
541
384
|
return;
|
|
542
|
-
this.resizeObserver?.disconnect();
|
|
543
|
-
this.resizeObserver = new ResizeObserver(() => {
|
|
544
|
-
if (!this.scrollContainer)
|
|
545
|
-
return;
|
|
546
|
-
const nextHeight = this.scrollContainer.clientHeight;
|
|
547
|
-
const nextWidth = this.scrollContainer.clientWidth;
|
|
548
|
-
const heightChanged = this.cachedContainerHeight !== nextHeight;
|
|
549
|
-
const widthChanged = this.cachedContainerWidth !== nextWidth;
|
|
550
|
-
if (!heightChanged && !widthChanged)
|
|
551
|
-
return;
|
|
552
|
-
this.cachedContainerHeight = nextHeight;
|
|
553
|
-
this.cachedContainerWidth = nextWidth;
|
|
554
|
-
if (heightChanged && this.useVirtualScroll.vertical) {
|
|
555
|
-
this.scheduleUpdate('vertical');
|
|
556
|
-
}
|
|
557
|
-
if (widthChanged && this.useVirtualScroll.horizontal) {
|
|
558
|
-
this.scheduleUpdate('horizontal');
|
|
559
|
-
}
|
|
560
|
-
});
|
|
561
|
-
this.resizeObserver.observe(this.scrollContainer);
|
|
562
|
-
}
|
|
563
|
-
parseColumnWidth(width, fallbackWidth) {
|
|
564
|
-
if (typeof width === 'number') {
|
|
565
|
-
return Number.isFinite(width) ? width : fallbackWidth;
|
|
566
385
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
return fallbackWidth;
|
|
572
|
-
if (/^\d+(\.\d+)?px$/.test(normalized)) {
|
|
573
|
-
return Number.parseFloat(normalized);
|
|
386
|
+
this.innerRowsPerPage = changedRowsPerPage;
|
|
387
|
+
const newLastPage = Math.max(1, Math.ceil(this.rowCount / changedRowsPerPage));
|
|
388
|
+
if (this.currentPage > newLastPage) {
|
|
389
|
+
this.currentPage = newLastPage;
|
|
574
390
|
}
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}
|
|
578
|
-
return fallbackWidth;
|
|
579
|
-
}
|
|
580
|
-
getColumnWidths(columns = []) {
|
|
581
|
-
const fallbackWidth = this.useVirtualScroll.horizontal ? this.virtualColumnWidth : 120;
|
|
582
|
-
return columns.map(c => this.parseColumnWidth(c.width, fallbackWidth));
|
|
583
|
-
}
|
|
584
|
-
getNormalizedStickyCounts() {
|
|
585
|
-
const totalColumnCount = this.tableColumns.length;
|
|
586
|
-
const requestedLeft = Number(this.stickyColumn?.left ?? 0) || 0;
|
|
587
|
-
const requestedRight = Number(this.stickyColumn?.right ?? 0) || 0;
|
|
588
|
-
const stickyLeftCount = Math.min(totalColumnCount, Math.max(0, requestedLeft));
|
|
589
|
-
const stickyRightCount = Math.min(Math.max(0, totalColumnCount - stickyLeftCount), Math.max(0, requestedRight));
|
|
590
|
-
return {
|
|
591
|
-
stickyLeftCount,
|
|
592
|
-
stickyRightCount,
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
getRowKeyValue(row) {
|
|
596
|
-
return row?.[this.rowKey];
|
|
391
|
+
this.sdRowsPerPageChange.emit(changedRowsPerPage);
|
|
392
|
+
this.updateRowsVisibility();
|
|
597
393
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
}
|
|
603
|
-
return
|
|
394
|
+
get lastPageNumber() {
|
|
395
|
+
if (this.useInternalPagination) {
|
|
396
|
+
return Math.max(1, Math.ceil(this.rowCount / this.innerRowsPerPage));
|
|
397
|
+
}
|
|
398
|
+
const { lastPage, rowsPerPage = 10 } = this.pagination || {};
|
|
399
|
+
return lastPage ?? Math.max(1, Math.ceil(this.rowCount / rowsPerPage));
|
|
604
400
|
}
|
|
605
|
-
handleResize(index, event) {
|
|
606
|
-
// SSR 환경 체크
|
|
401
|
+
handleResize(index, event, reversed = false) {
|
|
607
402
|
if (typeof document === 'undefined')
|
|
608
403
|
return;
|
|
609
404
|
const startX = event.clientX;
|
|
610
405
|
const startWidth = this.columnWidths[index];
|
|
611
406
|
const handleMouseMove = (moveEvent) => {
|
|
612
|
-
const
|
|
613
|
-
if (!
|
|
407
|
+
const col = this.columns[index];
|
|
408
|
+
if (!col)
|
|
614
409
|
return;
|
|
615
|
-
const
|
|
616
|
-
const
|
|
617
|
-
const
|
|
618
|
-
const newWidth = Math.min(Math.max(startWidth +
|
|
410
|
+
const minWidth = col.minWidth || 50;
|
|
411
|
+
const maxWidth = col.maxWidth || 9999;
|
|
412
|
+
const delta = moveEvent.clientX - startX;
|
|
413
|
+
const newWidth = Math.min(Math.max(startWidth + (reversed ? -delta : delta), minWidth), maxWidth);
|
|
619
414
|
this.columnWidths = this.columnWidths.map((width, idx) => (idx === index ? newWidth : width));
|
|
415
|
+
const thead = this.el.querySelector('sd-thead');
|
|
416
|
+
const rows = this.el.querySelectorAll('sd-tr');
|
|
417
|
+
thead?.setColumnWidths?.(this.columnWidths);
|
|
418
|
+
rows.forEach(tr => tr?.setColumnWidths?.(this.columnWidths));
|
|
419
|
+
const stickyRightCount = this.stickyColumn?.right || 0;
|
|
420
|
+
const visibleColCount = this.columns.filter(c => c.visible !== false).length;
|
|
421
|
+
const isRightStickyEdgeResizer = stickyRightCount > 0 && index === visibleColCount - stickyRightCount;
|
|
422
|
+
if (isRightStickyEdgeResizer) {
|
|
423
|
+
requestAnimationFrame(() => {
|
|
424
|
+
this.onScroll?.();
|
|
425
|
+
});
|
|
426
|
+
}
|
|
620
427
|
};
|
|
621
428
|
const handleMouseUp = () => {
|
|
622
429
|
document.removeEventListener('mousemove', handleMouseMove);
|
|
@@ -625,181 +432,147 @@ const SdTable = class {
|
|
|
625
432
|
document.addEventListener('mousemove', handleMouseMove);
|
|
626
433
|
document.addEventListener('mouseup', handleMouseUp);
|
|
627
434
|
}
|
|
628
|
-
|
|
629
|
-
const
|
|
630
|
-
|
|
631
|
-
|
|
435
|
+
getStickyStyleSync(colIdx) {
|
|
436
|
+
const leftOffset = this.columnWidths
|
|
437
|
+
.slice(0, colIdx)
|
|
438
|
+
.reduce((a, b) => a + b, this.selectable ? 52 : 0);
|
|
439
|
+
const rightOffset = this.columnWidths
|
|
440
|
+
.filter((_, i) => i >=
|
|
441
|
+
this.columns.filter(c => c.visible !== false).length -
|
|
442
|
+
(this.stickyColumn?.right || 0) && i > colIdx)
|
|
443
|
+
.reduce((a, b) => a + b, 0);
|
|
444
|
+
return {
|
|
445
|
+
'--sticky-left-offset': `${leftOffset}px`,
|
|
446
|
+
'--sticky-right-offset': `${rightOffset}px`,
|
|
447
|
+
'width': `${this.columnWidths[colIdx]}px`,
|
|
448
|
+
'minWidth': `${this.columnWidths[colIdx]}px`,
|
|
449
|
+
'maxWidth': `${this.columnWidths[colIdx]}px`,
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
async getStickyStyle(colIdx) {
|
|
453
|
+
return this.getStickyStyleSync(colIdx);
|
|
632
454
|
}
|
|
633
|
-
|
|
634
|
-
const
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
return this.cachedColumnOrder;
|
|
455
|
+
setRowCountSync(count) {
|
|
456
|
+
const safeCount = Math.max(0, Math.floor(this.toFiniteNumber(count, 0)));
|
|
457
|
+
if (safeCount !== this.rowCount) {
|
|
458
|
+
this.lastReachEndNotifiedRowCount = -1;
|
|
638
459
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
'sticky-left-edge': !this.hasStickyLeftDataColumn,
|
|
665
|
-
}, style: {
|
|
666
|
-
'--sticky-left-offset': '0px',
|
|
667
|
-
} }, h("sd-checkbox", { value: this.isAllChecked, disabled: !this.paginatedRows.length, onSdUpdate: (e) => this.toggleSelectAll(e.detail) }))), stickyLeftCols.map((col, idx) => {
|
|
668
|
-
return (h("th", { key: col.name, class: {
|
|
669
|
-
'sd-th': true,
|
|
670
|
-
[`${col.thClass}`]: Boolean(col.thClass),
|
|
671
|
-
'sticky-left': true,
|
|
672
|
-
'sticky-left-edge': idx === stickyLeftCount - 1,
|
|
673
|
-
}, style: { ...col.thStyle, ...this.getStickyStyle(idx) } }, h("div", { class: `sd-th__content sd-th__content--${col.align || 'left'}` }, h("slot", { name: `header-cell-${col.name}` }, h("div", { class: "sd-th__content--label" }, col.label)), col.usePageMoveIcon && h("sd-icon", { name: "pageMove", size: "12", color: "#006AC1" }), col.tooltip && (h("sd-tooltip", { ...col.tooltipOptions }, h("div", { slot: "content" }, col.tooltip.map(text => (h("p", null, text))))))), this.resizable && typeof window !== 'undefined' && (h("div", { class: "sd-th__resizer", onMouseDown: (evt) => this.handleResize(idx, evt) }))));
|
|
674
|
-
}), this.renderSpacerTh('left'), middleCols.map((col, relativeIdx) => {
|
|
675
|
-
const actualColIdx = stickyLeftCount + this.virtualStartColIdx + relativeIdx;
|
|
676
|
-
return (h("th", { key: col.name, class: {
|
|
677
|
-
'sd-th': true,
|
|
678
|
-
[`${col.thClass}`]: Boolean(col.thClass),
|
|
679
|
-
}, style: { ...col.thStyle, ...this.getStickyStyle(actualColIdx) } }, h("div", { class: `sd-th__content sd-th__content--${col.align || 'left'}` }, h("slot", { name: `header-cell-${col.name}` }, h("div", { class: "sd-th__content--label" }, col.label)), col.usePageMoveIcon && h("sd-icon", { name: "pageMove", size: "12", color: "#006AC1" }), col.tooltip && (h("sd-tooltip", { ...col.tooltipOptions }, h("div", { slot: "content" }, col.tooltip.map(text => (h("p", null, text))))))), this.resizable && typeof window !== 'undefined' && (h("div", { class: "sd-th__resizer", onMouseDown: (evt) => this.handleResize(actualColIdx, evt) }))));
|
|
680
|
-
}), this.renderSpacerTh('right'), stickyRightCols.map((col, relativeIdx) => {
|
|
681
|
-
const actualColIdx = this.tableColumns.length - stickyRightCount + relativeIdx;
|
|
682
|
-
return (h("th", { key: col.name, class: {
|
|
683
|
-
'sd-th': true,
|
|
684
|
-
[`${col.thClass}`]: Boolean(col.thClass),
|
|
685
|
-
'sticky-right': true,
|
|
686
|
-
'sticky-right-edge': relativeIdx === 0,
|
|
687
|
-
}, style: { ...col.thStyle, ...this.getStickyStyle(actualColIdx) } }, h("div", { class: `sd-th__content sd-th__content--${col.align || 'left'}` }, h("slot", { name: `header-cell-${col.name}` }, h("div", { class: "sd-th__content--label" }, col.label)), col.usePageMoveIcon && h("sd-icon", { name: "pageMove", size: "12", color: "#006AC1" }), col.tooltip && (h("sd-tooltip", { ...col.tooltipOptions }, h("div", { slot: "content" }, col.tooltip.map(text => (h("p", null, text))))))), this.resizable && typeof window !== 'undefined' && (h("div", { class: "sd-th__resizer", onMouseDown: (evt) => this.handleResize(actualColIdx, evt) }))));
|
|
688
|
-
}))));
|
|
689
|
-
}
|
|
690
|
-
renderBody() {
|
|
691
|
-
return (h("tbody", { ...(!this.paginatedRows.length && { part: 'tbody-empty' }), class: `sd-table-tbody ${this.useVirtualScroll.vertical ? 'sd-table-tbody--virtual-scroll' : ''}`, style: { '--total-virtual-height': `${this.totalVirtualHeight}px` } }, this.useVirtualScroll.vertical && this.topSpacerHeight > 0 && this.renderSpacerRow('top'), this.paginatedRows.length > 0 &&
|
|
692
|
-
this.virtualRows.map(({ row, actualIndex }) => this.renderRow(row, actualIndex)), this.useVirtualScroll.vertical &&
|
|
693
|
-
this.bottomSpacerHeight > 0 &&
|
|
694
|
-
this.renderSpacerRow('bottom')));
|
|
695
|
-
}
|
|
696
|
-
renderRow(row, rowIdx) {
|
|
697
|
-
const { stickyLeftCount, stickyRightCount, stickyLeftCols, middleCols, stickyRightCols } = this.getColumnRenderedInOrder();
|
|
698
|
-
return (h("tr", { key: row[this.rowKey], class: "hover:bg-Grey_Lighten-6", style: this.useVirtualScroll.vertical
|
|
699
|
-
? {
|
|
700
|
-
height: `${this.virtualRowHeight}px`,
|
|
701
|
-
}
|
|
702
|
-
: {} }, this.selectable && (h("td", { class: {
|
|
703
|
-
'sd-td': true,
|
|
704
|
-
'sd-td--selected': true,
|
|
705
|
-
'sticky-left': true,
|
|
706
|
-
'sticky-left-edge': !this.hasStickyLeftDataColumn,
|
|
707
|
-
}, style: {
|
|
708
|
-
'--sticky-left-offset': '0px',
|
|
709
|
-
} }, h("sd-checkbox", { value: this.isRowSelected(row), disabled: !this.paginatedRows.length, onSdUpdate: () => this.updateRowSelect(row) }))), stickyLeftCols.map((column, idx) => {
|
|
710
|
-
return (h("td", { key: column.name, part: `td-${column.name}`, class: {
|
|
711
|
-
'sd-td': true,
|
|
712
|
-
[`sd-td--${column.align || 'left'}`]: true,
|
|
713
|
-
'sticky-left': true,
|
|
714
|
-
'sticky-left-edge': idx === stickyLeftCount - 1,
|
|
715
|
-
[`${column.tdClass}`]: Boolean(column.tdClass),
|
|
716
|
-
}, style: this.getStickyStyle(idx) }, h("slot", { name: `body-cell-${column.name}-${rowIdx}` }, this.getCellValue(column, row))));
|
|
717
|
-
}), this.renderSpacerTd('left', rowIdx), middleCols.map((column, relativeIdx) => {
|
|
718
|
-
const actualColIdx = stickyLeftCount + this.virtualStartColIdx + relativeIdx;
|
|
719
|
-
return (h("td", { key: column.name, part: `td-${column.name}`, class: {
|
|
720
|
-
'sd-td': true,
|
|
721
|
-
[`sd-td--${column.align || 'left'}`]: true,
|
|
722
|
-
[`${column.tdClass}`]: Boolean(column.tdClass),
|
|
723
|
-
}, style: this.getStickyStyle(actualColIdx) }, h("slot", { name: `body-cell-${column.name}-${rowIdx}` }, this.getCellValue(column, row))));
|
|
724
|
-
}), this.renderSpacerTd('right', rowIdx), stickyRightCols.map((column, relativeIdx) => {
|
|
725
|
-
const actualColIdx = this.tableColumns.length - stickyRightCount + relativeIdx;
|
|
726
|
-
return (h("td", { key: column.name, part: `td-${column.name}`, class: {
|
|
727
|
-
'sd-td': true,
|
|
728
|
-
[`sd-td--${column.align || 'left'}`]: true,
|
|
729
|
-
'sticky-right': true,
|
|
730
|
-
'sticky-right-edge': relativeIdx === 0,
|
|
731
|
-
[`${column.tdClass}`]: Boolean(column.tdClass),
|
|
732
|
-
}, style: this.getStickyStyle(actualColIdx) }, h("slot", { name: `body-cell-${column.name}-${rowIdx}` }, this.getCellValue(column, row))));
|
|
733
|
-
})));
|
|
734
|
-
}
|
|
735
|
-
renderSpacerRow(position) {
|
|
736
|
-
const spacerHeight = position === 'top' ? this.topSpacerHeight : this.bottomSpacerHeight;
|
|
737
|
-
return (h("tr", { key: `virtual-${position}-spacer`, class: "sd-table__virtual-row-spacer", style: {
|
|
738
|
-
height: `${spacerHeight}px`,
|
|
739
|
-
}, "aria-hidden": "true" }, h("td", { colSpan: this.tableColumns.length + (this.selectable ? 1 : 0) }, h("div", { class: "sd-table__skeleton", style: {
|
|
740
|
-
'--row-height': `${this.virtualRowHeight}px`,
|
|
741
|
-
} }))));
|
|
742
|
-
}
|
|
743
|
-
getSpacerCellStyle(spacerWidth) {
|
|
460
|
+
this.rowCount = safeCount;
|
|
461
|
+
if (this.useVirtualScroll) {
|
|
462
|
+
this.propagateVirtualUpdate(true);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
async setRowCount(count) {
|
|
466
|
+
this.setRowCountSync(count);
|
|
467
|
+
}
|
|
468
|
+
calculateVisibleRange(scrollTop, containerHeight) {
|
|
469
|
+
const safeRowHeight = Math.max(1, this.toFiniteNumber(this.rowHeight, 40));
|
|
470
|
+
const safeBuffer = Math.max(0, Math.floor(this.toFiniteNumber(this.virtualBuffer, 5)));
|
|
471
|
+
const safeScrollTop = Math.max(0, this.toFiniteNumber(scrollTop, 0));
|
|
472
|
+
const safeContainerHeight = Math.max(0, this.toFiniteNumber(containerHeight, 0));
|
|
473
|
+
const safeRowCount = Math.max(0, Math.floor(this.toFiniteNumber(this.rowCount, 0)));
|
|
474
|
+
const firstVisible = Math.floor(safeScrollTop / safeRowHeight);
|
|
475
|
+
const visibleCount = Math.ceil(safeContainerHeight / safeRowHeight);
|
|
476
|
+
const start = Math.max(0, firstVisible - safeBuffer);
|
|
477
|
+
const end = Math.min(safeRowCount, firstVisible + visibleCount + safeBuffer);
|
|
478
|
+
return { start, end };
|
|
479
|
+
}
|
|
480
|
+
getPaginationInfoSync() {
|
|
481
|
+
if (!this.useInternalPagination || !this.pagination)
|
|
482
|
+
return null;
|
|
483
|
+
const startIndex = (this.currentPage - 1) * this.innerRowsPerPage;
|
|
484
|
+
const endIndex = startIndex + this.innerRowsPerPage;
|
|
744
485
|
return {
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
border: 'none',
|
|
486
|
+
startIndex,
|
|
487
|
+
endIndex,
|
|
488
|
+
currentPage: this.currentPage,
|
|
489
|
+
rowsPerPage: this.innerRowsPerPage,
|
|
750
490
|
};
|
|
751
491
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
if (!showSpacer)
|
|
492
|
+
async getPaginationInfo() {
|
|
493
|
+
return this.getPaginationInfoSync();
|
|
494
|
+
}
|
|
495
|
+
getVirtualScrollRangeSync() {
|
|
496
|
+
if (!this.useVirtualScroll)
|
|
758
497
|
return null;
|
|
759
|
-
|
|
760
|
-
}
|
|
761
|
-
renderSpacerTd(position, rowIdx) {
|
|
762
|
-
const spacerWidth = position === 'left' ? this.leftSpacerWidth : this.rightSpacerWidth;
|
|
763
|
-
const showSpacer = position === 'left'
|
|
764
|
-
? this.useVirtualScroll.horizontal && this.leftSpacerWidth > 0
|
|
765
|
-
: this.useVirtualScroll.horizontal && this.rightSpacerWidth > 0;
|
|
766
|
-
if (!showSpacer)
|
|
498
|
+
if (!(this.vsEnd > 0))
|
|
767
499
|
return null;
|
|
768
|
-
return
|
|
500
|
+
return { from: this.vsStart, to: this.vsEnd };
|
|
501
|
+
}
|
|
502
|
+
get tableClasses() {
|
|
503
|
+
return [
|
|
504
|
+
'sd-table',
|
|
505
|
+
this.stickyHeader && 'sd-table--sticky-header',
|
|
506
|
+
this.selectable && 'sd-table--selectable',
|
|
507
|
+
this.resizable && 'sd-table--resizable',
|
|
508
|
+
(this.selectable ||
|
|
509
|
+
(this.stickyColumn?.left ?? 0) > 0 ||
|
|
510
|
+
(this.stickyColumn?.right ?? 0) > 0) &&
|
|
511
|
+
'sd-table--sticky-column',
|
|
512
|
+
this.scrolledLeft && 'sd-table--scrolled-left',
|
|
513
|
+
this.scrolledRight && 'sd-table--scrolled-right',
|
|
514
|
+
this.rowCount === 0 && !this.isLoading && 'sd-table--no-data',
|
|
515
|
+
]
|
|
516
|
+
.filter(Boolean)
|
|
517
|
+
.join(' ');
|
|
769
518
|
}
|
|
770
519
|
render() {
|
|
771
|
-
|
|
520
|
+
const resolvedTableId = this.getResolvedTableId();
|
|
521
|
+
return (h(Host, { key: 'dd25a84ce29a197a7e853d1812ce0f0fbdf043bd' }, h("div", { key: '8b256e995d55c36ff9622148054911fcbe8aa89b', class: "sd-table__container", style: {
|
|
772
522
|
'--table-width': this.width,
|
|
773
523
|
'--table-height': this.height,
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
'sd-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
524
|
+
'--table-container-height': `calc(${this.height || '100%'} - ${this.pagination && this.rowCount > 0 && !this.useVirtualScroll ? 48 : 0}px)`,
|
|
525
|
+
} }, h("div", { key: 'b4949fed8c50b93bcddace22978aff358ea7c210', class: {
|
|
526
|
+
'sd-table__clip': true,
|
|
527
|
+
'sd-table__clip--has-pagination': !!(this.pagination &&
|
|
528
|
+
this.pagination.rowsPerPage > 0 &&
|
|
529
|
+
this.rowCount > 0 &&
|
|
530
|
+
!this.useVirtualScroll),
|
|
531
|
+
} }, h("div", { key: '5fcceeb27568afdd367e7dbf2886fcbd107089c5', class: {
|
|
532
|
+
'sd-table__wrapper': true,
|
|
533
|
+
'sd-table__wrapper--loading': this.isLoading,
|
|
534
|
+
'sd-table__wrapper--no-data': this.rowCount === 0 && !this.isLoading,
|
|
535
|
+
} }, this.isLoading && (h("div", { key: 'edabfb6b601cfad985e3b8614d603f2df1da8f98', class: "sd-table__loading", style: { top: `${this.loadingScrollTop}px` } }, h("sd-circle-progress", { key: '40de9b2b97407523d1b02b97f208682e4946be66', indeterminate: true }))), this.rowCount === 0 && !this.isLoading && (h("div", { key: 'fe0d54f45a2a0a8ca1cc6552a42c7725ecd84c99', class: "sd-table__no-data" }, h("slot", { key: 'f64d232d1b3bd69d7c43a5170d06e73cbc586226', name: "no-data" }, h("span", { key: '71f5dcf2e5af2403032bdefd19a3cc4793a823e9' }, this.resolvedNoDataLabel)))), h("table", { key: 'e32c9f96523db174a57efffa584237836a67214a', class: this.tableClasses }, h("slot", { key: 'ce5e49454ac9044d6b3fcf3ac51809bb1e5465f8', name: `${resolvedTableId}-head`, onSlotchange: this.handleStructureSlotChange }), h("slot", { key: '800b45ddc05aac02cf8827b31beca5d0f363b55f', name: `${resolvedTableId}-body`, onSlotchange: this.handleStructureSlotChange })))), this.pagination &&
|
|
536
|
+
this.pagination.rowsPerPage > 0 &&
|
|
537
|
+
this.rowCount > 0 &&
|
|
538
|
+
!this.useVirtualScroll && (h("div", { key: 'ea2afbe59f7b249d3f4e9d9763ab402438e47008', class: "sd-table__pagination" }, h("sd-pagination", { key: 'a64223b9d2374142cbf12ec582e580f1b9f8f8dc', currentPage: !this.useInternalPagination ? this.pagination.page : this.currentPage, lastPage: !this.useInternalPagination ? this.pagination.lastPage : this.lastPageNumber, onSdPageChange: (e) => this.changePage(e.detail) }), this.useRowsPerPageSelect && (h("sd-select-v2", { key: '597cd596ac0ce2752ab6fc792887ce447c863eb8', value: this.useInternalPagination
|
|
539
|
+
? this.innerRowsPerPage
|
|
540
|
+
: this.pagination.rowsPerPage, options: this.rowsPerPageOption, width: "128px", emitValue: true, onSdUpdate: e => {
|
|
541
|
+
if (!this.isRowsPerPageValue(e.detail))
|
|
542
|
+
return;
|
|
543
|
+
this.changeRowsPerPage(e.detail);
|
|
544
|
+
} })))))));
|
|
781
545
|
}
|
|
782
546
|
static get watchers() { return {
|
|
783
|
-
"
|
|
784
|
-
"
|
|
547
|
+
"isLoading": [{
|
|
548
|
+
"handleIsLoadingChange": 0
|
|
785
549
|
}],
|
|
786
550
|
"useVirtualScroll": [{
|
|
787
551
|
"handleUseVirtualScrollChange": 0
|
|
788
552
|
}],
|
|
789
|
-
"
|
|
790
|
-
"
|
|
553
|
+
"columns": [{
|
|
554
|
+
"handleColumnsChange": 0
|
|
555
|
+
}],
|
|
556
|
+
"rows": [{
|
|
557
|
+
"handleRowsChange": 0
|
|
558
|
+
}],
|
|
559
|
+
"tableId": [{
|
|
560
|
+
"handleTableIdChange": 0
|
|
561
|
+
}],
|
|
562
|
+
"noDataLabel": [{
|
|
563
|
+
"handleNoDataLabelChange": 0
|
|
791
564
|
}],
|
|
792
565
|
"selectable": [{
|
|
793
|
-
"
|
|
566
|
+
"handleConfigChange": 0
|
|
794
567
|
}],
|
|
795
|
-
"
|
|
796
|
-
"
|
|
568
|
+
"resizable": [{
|
|
569
|
+
"handleConfigChange": 0
|
|
797
570
|
}],
|
|
798
|
-
"
|
|
799
|
-
"
|
|
571
|
+
"stickyColumn": [{
|
|
572
|
+
"handleConfigChange": 0
|
|
800
573
|
}],
|
|
801
|
-
"
|
|
802
|
-
"
|
|
574
|
+
"stickyHeader": [{
|
|
575
|
+
"handleConfigChange": 0
|
|
803
576
|
}],
|
|
804
577
|
"selected": [{
|
|
805
578
|
"handleSelectedChange": 0
|