@duetds/components 4.35.4 → 5.0.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/hydrate/index.js +1708 -1055
- package/lib/cjs/duet-action-button.cjs.entry.js +163 -0
- package/lib/cjs/duet-alert.cjs.entry.js +1 -1
- package/lib/cjs/duet-badge.cjs.entry.js +1 -1
- package/lib/cjs/duet-breadcrumb.cjs.entry.js +1 -1
- package/lib/cjs/duet-breadcrumbs.cjs.entry.js +1 -1
- package/lib/cjs/duet-button_2.cjs.entry.js +14 -5
- package/lib/cjs/duet-caption_4.cjs.entry.js +3 -3
- package/lib/cjs/duet-card.cjs.entry.js +4 -4
- package/lib/cjs/duet-checkbox.cjs.entry.js +1 -1
- package/lib/cjs/duet-choice_2.cjs.entry.js +3 -3
- package/lib/cjs/duet-collapsible.cjs.entry.js +4 -4
- package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
- package/lib/cjs/duet-date-picker.cjs.entry.js +4 -4
- package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
- package/lib/cjs/{duet-editable-table_4.cjs.entry.js → duet-editable-table_3.cjs.entry.js} +382 -346
- package/lib/cjs/duet-empty-state.cjs.entry.js +1 -1
- package/lib/cjs/duet-fieldset.cjs.entry.js +1 -1
- package/lib/cjs/duet-footer.cjs.entry.js +1 -1
- package/lib/cjs/duet-grid_2.cjs.entry.js +2 -2
- package/lib/cjs/duet-header_2.cjs.entry.js +4 -4
- package/lib/cjs/duet-hero.cjs.entry.js +1 -1
- package/lib/cjs/duet-icon.cjs.entry.js +3 -3
- package/lib/cjs/duet-input_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-layout.cjs.entry.js +1 -1
- package/lib/cjs/duet-list_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-modal.cjs.entry.js +3 -3
- package/lib/cjs/duet-notification_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-number-input.cjs.entry.js +2 -2
- package/lib/cjs/duet-pagination_2.cjs.entry.js +458 -0
- package/lib/cjs/duet-progress.cjs.entry.js +1 -1
- package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-range-slider.cjs.entry.js +2 -2
- package/lib/cjs/duet-scrollable_3.cjs.entry.js +3 -3
- package/lib/cjs/duet-select.cjs.entry.js +16 -4
- package/lib/cjs/duet-step_2.cjs.entry.js +2 -2
- package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
- package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
- package/lib/cjs/duet-tooltip.cjs.entry.js +1 -1
- package/lib/cjs/duet-tray.cjs.entry.js +2 -2
- package/lib/cjs/duet-upload-aria-status.cjs.entry.js +1 -1
- package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
- package/lib/cjs/duet.cjs.js +2 -2
- package/lib/cjs/{focus-utils-eb8c5b20.js → focus-utils-7a11c463.js} +1 -1
- package/lib/cjs/{index-6ae8090f.js → index-da5d5aaf.js} +4 -1
- package/lib/cjs/js-utils-be1d29ae.js +39 -0
- package/lib/cjs/{keyboard-utils-b4e3d1d3.js → keyboard-utils-898cfe14.js} +8 -0
- package/lib/cjs/loader.cjs.js +2 -2
- package/lib/cjs/{token-utils-05bd23b4.js → token-utils-ac8432d1.js} +10 -7
- package/lib/cjs/{tokens-8596cece.js → tokens-72efc7fd.js} +0 -0
- package/lib/cjs/{tokens.module-6b2df1c2.js → tokens.module-6afcc9c1.js} +0 -0
- package/lib/collection/collection-manifest.json +22 -11
- package/lib/collection/components/duet-action-button/duet-action-button.css +87 -0
- package/lib/collection/components/duet-action-button/duet-action-button.js +489 -0
- package/lib/collection/components/duet-button/duet-button.css +3 -0
- package/lib/collection/components/duet-button/duet-button.js +50 -1
- package/lib/collection/components/duet-card/duet-card.js +1 -1
- package/lib/collection/components/duet-collapsible/duet-collapsible.js +2 -1
- package/lib/collection/components/duet-date-picker/duet-date-picker.css +2 -57
- package/lib/collection/components/duet-date-picker/duet-date-picker.js +2 -6
- package/lib/collection/components/duet-editable-table/duet-editable-table-tabledata.js +3 -2
- package/lib/collection/components/duet-editable-table/duet-editable-table.css +20 -1
- package/lib/collection/components/duet-editable-table/duet-editable-table.js +331 -205
- package/lib/collection/components/duet-pagination/duet-pagination-utils.js +9 -0
- package/lib/collection/components/duet-pagination/duet-pagination.css +61 -0
- package/lib/collection/components/duet-pagination/duet-pagination.js +541 -0
- package/lib/collection/components/duet-range-stepper/duet-range-stepper.css +49 -0
- package/lib/collection/components/duet-range-stepper/duet-range-stepper.js +340 -0
- package/lib/collection/components/duet-select/duet-select.css +26 -0
- package/lib/collection/components/duet-select/duet-select.js +39 -4
- package/lib/collection/components/duet-tab-group/duet-tab-group.js +5 -1
- package/lib/collection/components/duet-table/duet-table.css +42 -8
- package/lib/collection/components/duet-table/duet-table.js +11 -2
- package/lib/collection/components/duet-upload/duet-upload.css +25 -0
- package/lib/collection/components/duet-upload/duet-upload.js +270 -166
- package/lib/collection/components/duet-upload/upload-validators.js +1 -1
- package/lib/collection/utils/fixture-utils.js +3 -5
- package/lib/collection/utils/js-utils.js +36 -1
- package/lib/collection/utils/keyboard-utils.js +4 -0
- package/lib/collection/utils/test-utils.js +2 -1
- package/lib/collection/utils/token-utils.js +33 -6
- package/lib/custom-elements-bundle/index.d.ts +18 -12
- package/lib/custom-elements-bundle/index.js +1653 -1046
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/{p-503f1286.entry.js → p-00209700.entry.js} +1 -1
- package/lib/duet/{p-76fa8882.entry.js → p-01144f93.entry.js} +1 -1
- package/lib/duet/{p-ec2aea5f.system.entry.js → p-021bf3a2.system.entry.js} +1 -1
- package/lib/duet/{p-0169d57e.entry.js → p-04c6e557.entry.js} +1 -1
- package/lib/duet/{p-03a5fe42.system.entry.js → p-06fd151e.system.entry.js} +1 -1
- package/lib/duet/p-0988f548.entry.js +4 -0
- package/lib/duet/{p-d5a4b17f.system.entry.js → p-0e1130a0.system.entry.js} +1 -1
- package/lib/duet/{p-e4e99da0.entry.js → p-0fedc1c6.entry.js} +1 -1
- package/lib/duet/{p-2c85e001.system.entry.js → p-111b70c5.system.entry.js} +1 -1
- package/lib/duet/p-12825e2c.entry.js +4 -0
- package/lib/duet/p-166c09ce.system.entry.js +4 -0
- package/lib/duet/{p-8367a2d1.entry.js → p-1be45fc6.entry.js} +1 -1
- package/lib/duet/{p-253fd12a.system.entry.js → p-1da57e19.system.entry.js} +1 -1
- package/lib/duet/{p-b72ed5ef.system.entry.js → p-21c9efa8.system.entry.js} +1 -1
- package/lib/duet/{p-01679b51.entry.js → p-2245c56b.entry.js} +1 -1
- package/lib/duet/p-2273fc88.js +4 -0
- package/lib/duet/{p-5630828a.system.entry.js → p-232762b3.system.entry.js} +1 -1
- package/lib/duet/{p-3025a411.system.js → p-251dc733.system.js} +1 -1
- package/lib/duet/{p-ddb6344c.system.js → p-268c0abb.system.js} +0 -0
- package/lib/duet/{p-9077cd24.system.entry.js → p-2b6dac5c.system.entry.js} +1 -1
- package/lib/duet/{p-bba528b5.entry.js → p-35cdec32.entry.js} +1 -1
- package/lib/duet/{p-ee598605.entry.js → p-37bdfcc6.entry.js} +1 -1
- package/lib/duet/{p-c3d552d5.entry.js → p-3c7d81b0.entry.js} +1 -1
- package/lib/duet/{p-824d2360.system.entry.js → p-3f77090f.system.entry.js} +1 -1
- package/lib/duet/{p-7b451394.system.js → p-3fafe82f.system.js} +1 -1
- package/lib/duet/{p-2395f96e.system.entry.js → p-4b221aa3.system.entry.js} +1 -1
- package/lib/duet/{p-4ea864dd.system.entry.js → p-4b7b1d2a.system.entry.js} +1 -1
- package/lib/duet/p-4c282c1a.entry.js +4 -0
- package/lib/duet/p-51a7c020.entry.js +4 -0
- package/lib/duet/{p-e8ce8394.entry.js → p-5298f6fb.entry.js} +1 -1
- package/lib/duet/p-5746d88c.js +4 -0
- package/lib/duet/{p-dfd96467.entry.js → p-589c2f28.entry.js} +1 -1
- package/lib/duet/{p-f98fca13.system.entry.js → p-592315ca.system.entry.js} +1 -1
- package/lib/duet/{p-6cff80cb.system.entry.js → p-59a0ec33.system.entry.js} +1 -1
- package/lib/duet/p-5e1f64cb.entry.js +4 -0
- package/lib/duet/{p-73b5248d.entry.js → p-608645ed.entry.js} +1 -1
- package/lib/duet/{p-8ea92cc5.entry.js → p-683f1962.entry.js} +1 -1
- package/lib/duet/{p-55fff1fe.entry.js → p-6932c6d8.entry.js} +1 -1
- package/lib/duet/{p-731444f6.entry.js → p-6934cb1b.entry.js} +1 -1
- package/lib/duet/{p-caab828f.system.entry.js → p-6d209c01.system.entry.js} +1 -1
- package/lib/duet/{p-61198eee.system.entry.js → p-70e5c803.system.entry.js} +1 -1
- package/lib/duet/p-74780bca.system.js +4 -0
- package/lib/duet/p-74d267d3.system.entry.js +4 -0
- package/lib/duet/{p-2bfe8b50.system.entry.js → p-766daacb.system.entry.js} +1 -1
- package/lib/duet/p-77acbfe4.system.js +4 -0
- package/lib/duet/p-7953cff9.system.entry.js +4 -0
- package/lib/duet/{p-01f3fbd4.system.entry.js → p-7e939e57.system.entry.js} +1 -1
- package/lib/duet/{p-fa99eaa4.system.js → p-812b0905.system.js} +0 -0
- package/lib/duet/{p-c122428f.entry.js → p-814ed07c.entry.js} +1 -1
- package/lib/duet/{p-04304e51.entry.js → p-82a0e535.entry.js} +1 -1
- package/lib/duet/{p-4a60b131.system.entry.js → p-8338702d.system.entry.js} +1 -1
- package/lib/duet/{p-e682d701.system.entry.js → p-85b4b5c0.system.entry.js} +2 -2
- package/lib/duet/{p-e3229d0d.entry.js → p-86538787.entry.js} +1 -1
- package/lib/duet/p-898f30a5.js +4 -0
- package/lib/duet/{p-40a76f20.entry.js → p-8f01f647.entry.js} +1 -1
- package/lib/duet/{p-a39a0a45.entry.js → p-8f6def3f.entry.js} +1 -1
- package/lib/duet/{p-753098ec.entry.js → p-90464434.entry.js} +1 -1
- package/lib/duet/p-92639d0b.system.js +4 -0
- package/lib/duet/{p-873e4c51.system.entry.js → p-97f95c02.system.entry.js} +2 -2
- package/lib/duet/{p-ea30becb.system.entry.js → p-982deb44.system.entry.js} +1 -1
- package/lib/duet/{p-7fd62541.entry.js → p-9dc88c43.entry.js} +1 -1
- package/lib/duet/{p-412f58cf.entry.js → p-a37e57d8.entry.js} +1 -1
- package/lib/duet/{p-da1f6193.system.entry.js → p-a71510b8.system.entry.js} +1 -1
- package/lib/duet/p-a8eec12e.system.entry.js +4 -0
- package/lib/duet/{p-4d8cd455.system.entry.js → p-abcfbb23.system.entry.js} +1 -1
- package/lib/duet/{p-99262d61.entry.js → p-ac2b38e6.entry.js} +1 -1
- package/lib/duet/{p-24b4eefb.system.entry.js → p-ace2cd17.system.entry.js} +1 -1
- package/lib/duet/{p-94a2da86.system.entry.js → p-ad278903.system.entry.js} +1 -1
- package/lib/duet/{p-a0deb526.entry.js → p-aea907ad.entry.js} +1 -1
- package/lib/duet/{p-9690681b.system.entry.js → p-b432d318.system.entry.js} +1 -1
- package/lib/duet/{p-44fe8367.system.entry.js → p-b4e75f80.system.entry.js} +1 -1
- package/lib/duet/{p-c1b34a78.system.entry.js → p-b8c8105c.system.entry.js} +1 -1
- package/lib/duet/{p-efd978ee.entry.js → p-ba7480e9.entry.js} +1 -1
- package/lib/duet/p-bc7dba26.entry.js +4 -0
- package/lib/duet/{p-a926b44b.entry.js → p-bf06f635.entry.js} +1 -1
- package/lib/duet/p-c6ccf366.system.entry.js +4 -0
- package/lib/duet/{p-7cdb8bfa.entry.js → p-cd1a767f.entry.js} +1 -1
- package/lib/duet/p-d6d9b0c6.system.entry.js +4 -0
- package/lib/duet/{p-8143f3de.js → p-d7bc0102.js} +0 -0
- package/lib/duet/{p-fb98ac5a.entry.js → p-d9e329c0.entry.js} +1 -1
- package/lib/duet/p-dbb4a588.js +4 -0
- package/lib/duet/{p-f51f8554.entry.js → p-dc67d989.entry.js} +1 -1
- package/lib/duet/{p-a69667c7.entry.js → p-de9ff67c.entry.js} +1 -1
- package/lib/duet/{p-0f185a8a.system.entry.js → p-deb8ac4d.system.entry.js} +1 -1
- package/lib/duet/p-e2e0bc49.system.js +4 -0
- package/lib/duet/{p-6b24111b.system.entry.js → p-e624799f.system.entry.js} +1 -1
- package/lib/duet/{p-8973aa31.system.entry.js → p-e887d6db.system.entry.js} +1 -1
- package/lib/duet/p-e9c3053b.js +4 -0
- package/lib/duet/{p-a212f672.system.entry.js → p-ebed7c5e.system.entry.js} +1 -1
- package/lib/duet/{p-ad07f399.js → p-ed75c8b3.js} +0 -0
- package/lib/duet/{p-4a931c6c.system.entry.js → p-f020852e.system.entry.js} +1 -1
- package/lib/duet/p-f2abd301.entry.js +4 -0
- package/lib/duet/{p-fc35b926.system.entry.js → p-f54d1487.system.entry.js} +1 -1
- package/lib/duet/{p-17f85b90.entry.js → p-fc44a819.entry.js} +1 -1
- package/lib/duet/{p-bc6794bc.system.entry.js → p-fcdd24f8.system.entry.js} +1 -1
- package/lib/duet/{p-5e895b06.entry.js → p-fed35d92.entry.js} +1 -1
- package/lib/duet/{p-de5c3a36.entry.js → p-ff308f4c.entry.js} +1 -1
- package/lib/esm/duet-action-button.entry.js +159 -0
- package/lib/esm/duet-alert.entry.js +1 -1
- package/lib/esm/duet-badge.entry.js +1 -1
- package/lib/esm/duet-breadcrumb.entry.js +1 -1
- package/lib/esm/duet-breadcrumbs.entry.js +1 -1
- package/lib/esm/duet-button_2.entry.js +14 -5
- package/lib/esm/duet-caption_4.entry.js +3 -3
- package/lib/esm/duet-card.entry.js +4 -4
- package/lib/esm/duet-checkbox.entry.js +1 -1
- package/lib/esm/duet-choice_2.entry.js +3 -3
- package/lib/esm/duet-collapsible.entry.js +4 -4
- package/lib/esm/duet-cookie-consent.entry.js +1 -1
- package/lib/esm/duet-date-picker.entry.js +4 -4
- package/lib/esm/duet-divider_2.entry.js +1 -1
- package/lib/esm/{duet-editable-table_4.entry.js → duet-editable-table_3.entry.js} +384 -347
- package/lib/esm/duet-empty-state.entry.js +1 -1
- package/lib/esm/duet-fieldset.entry.js +1 -1
- package/lib/esm/duet-footer.entry.js +1 -1
- package/lib/esm/duet-grid_2.entry.js +2 -2
- package/lib/esm/duet-header_2.entry.js +4 -4
- package/lib/esm/duet-hero.entry.js +1 -1
- package/lib/esm/duet-icon.entry.js +3 -3
- package/lib/esm/duet-input_2.entry.js +1 -1
- package/lib/esm/duet-layout.entry.js +1 -1
- package/lib/esm/duet-list_2.entry.js +1 -1
- package/lib/esm/duet-modal.entry.js +3 -3
- package/lib/esm/duet-notification_2.entry.js +1 -1
- package/lib/esm/duet-number-input.entry.js +2 -2
- package/lib/esm/duet-pagination_2.entry.js +453 -0
- package/lib/esm/duet-progress.entry.js +1 -1
- package/lib/esm/duet-radio_2.entry.js +1 -1
- package/lib/esm/duet-range-slider.entry.js +2 -2
- package/lib/esm/duet-scrollable_3.entry.js +3 -3
- package/lib/esm/duet-select.entry.js +16 -4
- package/lib/esm/duet-step_2.entry.js +2 -2
- package/lib/esm/duet-textarea.entry.js +1 -1
- package/lib/esm/duet-toggle.entry.js +1 -1
- package/lib/esm/duet-tooltip.entry.js +1 -1
- package/lib/esm/duet-tray.entry.js +2 -2
- package/lib/esm/duet-upload-aria-status.entry.js +1 -1
- package/lib/esm/duet-visually-hidden.entry.js +1 -1
- package/lib/esm/duet.js +2 -2
- package/lib/esm/{focus-utils-6db957a7.js → focus-utils-b0b3361f.js} +1 -1
- package/lib/esm/{index-828dfb4e.js → index-16f4da7f.js} +4 -1
- package/lib/esm/js-utils-52e0944c.js +36 -0
- package/lib/esm/{keyboard-utils-584cedd7.js → keyboard-utils-6eb55cd5.js} +5 -1
- package/lib/esm/loader.js +2 -2
- package/lib/esm/{token-utils-75f78ca4.js → token-utils-e9a0cb88.js} +10 -7
- package/lib/esm/{tokens-e110dc89.js → tokens-57d98824.js} +0 -0
- package/lib/esm/{tokens.module-49cbf963.js → tokens.module-a13e9683.js} +0 -0
- package/lib/esm-es5/duet-action-button.entry.js +4 -0
- package/lib/esm-es5/duet-alert.entry.js +1 -1
- package/lib/esm-es5/duet-badge.entry.js +1 -1
- package/lib/esm-es5/duet-breadcrumb.entry.js +1 -1
- package/lib/esm-es5/duet-breadcrumbs.entry.js +1 -1
- package/lib/esm-es5/duet-button_2.entry.js +1 -1
- package/lib/esm-es5/duet-caption_4.entry.js +1 -1
- package/lib/esm-es5/duet-card.entry.js +1 -1
- package/lib/esm-es5/duet-checkbox.entry.js +1 -1
- package/lib/esm-es5/duet-choice_2.entry.js +1 -1
- package/lib/esm-es5/duet-collapsible.entry.js +1 -1
- package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
- package/lib/esm-es5/duet-date-picker.entry.js +2 -2
- package/lib/esm-es5/duet-divider_2.entry.js +1 -1
- package/lib/esm-es5/duet-editable-table_3.entry.js +4 -0
- package/lib/esm-es5/duet-empty-state.entry.js +1 -1
- package/lib/esm-es5/duet-fieldset.entry.js +1 -1
- package/lib/esm-es5/duet-footer.entry.js +1 -1
- package/lib/esm-es5/duet-grid_2.entry.js +1 -1
- package/lib/esm-es5/duet-header_2.entry.js +1 -1
- package/lib/esm-es5/duet-hero.entry.js +1 -1
- package/lib/esm-es5/duet-icon.entry.js +1 -1
- package/lib/esm-es5/duet-input_2.entry.js +1 -1
- package/lib/esm-es5/duet-layout.entry.js +1 -1
- package/lib/esm-es5/duet-list_2.entry.js +1 -1
- package/lib/esm-es5/duet-modal.entry.js +1 -1
- package/lib/esm-es5/duet-notification_2.entry.js +1 -1
- package/lib/esm-es5/duet-number-input.entry.js +1 -1
- package/lib/esm-es5/duet-pagination_2.entry.js +4 -0
- package/lib/esm-es5/duet-progress.entry.js +1 -1
- package/lib/esm-es5/duet-radio_2.entry.js +1 -1
- package/lib/esm-es5/duet-range-slider.entry.js +1 -1
- package/lib/esm-es5/duet-scrollable_3.entry.js +1 -1
- package/lib/esm-es5/duet-select.entry.js +2 -2
- package/lib/esm-es5/duet-step_2.entry.js +1 -1
- package/lib/esm-es5/duet-textarea.entry.js +1 -1
- package/lib/esm-es5/duet-toggle.entry.js +1 -1
- package/lib/esm-es5/duet-tooltip.entry.js +1 -1
- package/lib/esm-es5/duet-tray.entry.js +1 -1
- package/lib/esm-es5/duet-upload-aria-status.entry.js +1 -1
- package/lib/esm-es5/duet-visually-hidden.entry.js +1 -1
- package/lib/esm-es5/duet.js +1 -1
- package/lib/esm-es5/focus-utils-b0b3361f.js +4 -0
- package/lib/esm-es5/{index-828dfb4e.js → index-16f4da7f.js} +1 -1
- package/lib/esm-es5/js-utils-52e0944c.js +4 -0
- package/lib/esm-es5/keyboard-utils-6eb55cd5.js +4 -0
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/token-utils-e9a0cb88.js +4 -0
- package/lib/esm-es5/{tokens-e110dc89.js → tokens-57d98824.js} +0 -0
- package/lib/esm-es5/{tokens.module-49cbf963.js → tokens.module-a13e9683.js} +0 -0
- package/lib/html.html-data.json +5266 -0
- package/lib/types/components/duet-action-button/duet-action-button.d.ts +112 -0
- package/lib/types/components/duet-button/duet-button.d.ts +9 -0
- package/lib/types/components/duet-card/duet-card.d.ts +1 -1
- package/lib/types/components/duet-collapsible/duet-collapsible.d.ts +1 -0
- package/lib/types/components/duet-editable-table/duet-editable-table-tabledata.d.ts +2 -2
- package/lib/types/components/duet-editable-table/duet-editable-table.d.ts +106 -48
- package/lib/types/components/duet-pagination/duet-pagination-utils.d.ts +1 -0
- package/lib/types/components/duet-pagination/duet-pagination.d.ts +105 -0
- package/lib/types/components/duet-range-stepper/duet-range-stepper.d.ts +70 -0
- package/lib/types/components/duet-select/duet-select.d.ts +5 -0
- package/lib/types/components/duet-tab-group/duet-tab-group.d.ts +4 -0
- package/lib/types/components/duet-table/duet-table.d.ts +16 -0
- package/lib/types/components/duet-upload/duet-upload.d.ts +68 -58
- package/lib/types/components.d.ts +402 -140
- package/lib/types/utils/js-utils.d.ts +2 -0
- package/lib/types/utils/keyboard-utils.d.ts +4 -0
- package/lib/types/utils/token-utils.d.ts +2 -0
- package/package.json +5 -6
- package/lib/cjs/duet-editable-table-button.cjs.entry.js +0 -96
- package/lib/collection/components/duet-editable-table/duet-editable-table-button.css +0 -32
- package/lib/collection/components/duet-editable-table/duet-editable-table-button.js +0 -225
- package/lib/collection/components/duet-editable-table/duet-editable-table-item.css +0 -36
- package/lib/collection/components/duet-editable-table/duet-editable-table-item.js +0 -225
- package/lib/duet/p-0427e1a5.entry.js +0 -4
- package/lib/duet/p-04f9f1bf.js +0 -4
- package/lib/duet/p-0f91d386.system.entry.js +0 -4
- package/lib/duet/p-227e5196.js +0 -4
- package/lib/duet/p-2545734a.entry.js +0 -4
- package/lib/duet/p-2b8316ee.system.entry.js +0 -4
- package/lib/duet/p-477c2e5c.entry.js +0 -4
- package/lib/duet/p-50b4fb2c.js +0 -4
- package/lib/duet/p-66bf27b9.system.entry.js +0 -4
- package/lib/duet/p-68ecdc4f.system.entry.js +0 -4
- package/lib/duet/p-853cd059.js +0 -4
- package/lib/duet/p-a16a58c1.system.js +0 -4
- package/lib/duet/p-b0c16ee5.entry.js +0 -4
- package/lib/duet/p-b3a2a1e8.entry.js +0 -4
- package/lib/duet/p-bb12b972.system.js +0 -4
- package/lib/duet/p-c63e49e2.system.entry.js +0 -4
- package/lib/duet/p-e6349dd2.entry.js +0 -4
- package/lib/duet/p-ef3fc3f3.system.js +0 -4
- package/lib/esm/duet-editable-table-button.entry.js +0 -92
- package/lib/esm-es5/duet-editable-table-button.entry.js +0 -4
- package/lib/esm-es5/duet-editable-table_4.entry.js +0 -4
- package/lib/esm-es5/focus-utils-6db957a7.js +0 -4
- package/lib/esm-es5/keyboard-utils-584cedd7.js +0 -4
- package/lib/esm-es5/token-utils-75f78ca4.js +0 -4
- package/lib/types/components/duet-editable-table/duet-editable-table-button.d.ts +0 -73
- package/lib/types/components/duet-editable-table/duet-editable-table-item.d.ts +0 -76
|
@@ -1,294 +1,228 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance,
|
|
5
|
-
import {
|
|
4
|
+
import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-16f4da7f.js';
|
|
5
|
+
import { f as fieldSorter, d as debounce } from './js-utils-52e0944c.js';
|
|
6
|
+
import { i as isKeyboardClick } from './keyboard-utils-6eb55cd5.js';
|
|
7
|
+
import { g as getLocaleString, s as sanitizeString } from './language-utils-344d894c.js';
|
|
6
8
|
import { i as inheritGlobalTheme } from './themeable-component-572685dd.js';
|
|
7
|
-
import { m as mediaQueryMedium, h as mediaQueryLarge, i as mediaQueryXLarge, j as mediaQueryXxLarge, k as mediaQueryXxxLarge, l as mediaQuerySmall, n as sizeNavigation, s as sizeHeader } from './tokens.module-
|
|
9
|
+
import { m as mediaQueryMedium, h as mediaQueryLarge, i as mediaQueryXLarge, j as mediaQueryXxLarge, k as mediaQueryXxxLarge, l as mediaQuerySmall, n as sizeNavigation, s as sizeHeader } from './tokens.module-a13e9683.js';
|
|
8
10
|
import { c as createID } from './create-id-981107da.js';
|
|
9
11
|
import './string-utils-2f1793b8.js';
|
|
10
12
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Produces a function which uses template strings to do simple interpolation from objects.
|
|
23
|
-
*
|
|
24
|
-
* Usage:
|
|
25
|
-
* var makeMeKing = generateTemplateFn('${name} is now the king of ${country}!');
|
|
26
|
-
*
|
|
27
|
-
* console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'}));
|
|
28
|
-
* // Logs 'Bryan is now the king of Scotland!'
|
|
29
|
-
*/
|
|
30
|
-
const generateTemplateFn = (function () {
|
|
31
|
-
const cache = {};
|
|
32
|
-
function generateTemplate(template) {
|
|
33
|
-
if (typeof template !== "string") {
|
|
34
|
-
template = template.outerHTML;
|
|
35
|
-
}
|
|
36
|
-
let fn = cache[template];
|
|
37
|
-
if (!fn) {
|
|
38
|
-
// Replace ${expressions} (etc) with ${map.expressions}.
|
|
39
|
-
const sanitized = template
|
|
40
|
-
.replace(/\$\{([\s]*[^;\s\{]+[\s]*)\}/g, function (_, match) {
|
|
41
|
-
return `\$\{map.${match.trim()}\}`;
|
|
42
|
-
})
|
|
43
|
-
// Afterwards, replace anything that's not ${map.expressions}' (etc) with a blank string.
|
|
44
|
-
.replace(/(\$\{(?!map\.)[^}]+\})/g, "");
|
|
45
|
-
fn = Function("map", `return \`${sanitized}\``);
|
|
46
|
-
}
|
|
47
|
-
return fn;
|
|
13
|
+
//simple functional component that renders the data in the table
|
|
14
|
+
const TableData = ({ data, groupId, alignment }, _children) => {
|
|
15
|
+
const classNames = `duet-editable-table duet-editable-table-content-${groupId}`;
|
|
16
|
+
if (typeof data === "string") {
|
|
17
|
+
return h("td", { innerHTML: data, class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } });
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return (h("td", { class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } }, data));
|
|
48
21
|
}
|
|
49
|
-
|
|
50
|
-
})();
|
|
22
|
+
};
|
|
51
23
|
|
|
52
|
-
const duetEditableTableCss = "duet-editable-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-editable-table-header tr .duet-editable-table-header-hidden{padding:0 !important;font-size:0;border-bottom:0}";
|
|
24
|
+
const duetEditableTableCss = ".sc-duet-editable-table-h{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-editable-table-actions-menu.sc-duet-editable-table{position:relative;padding:0 !important;margin:0}.duet-editable-table-actions-menu-button.sc-duet-editable-table{position:relative;right:-16px;float:right;padding:0}.duet-editable-table-actions-menu-icon.sc-duet-editable-table .duet-icon.sc-duet-editable-table{max-width:16px;max-height:16px}.duet-editable-table-row.duet-table-action-row.sc-duet-editable-table .duet-text-right.sc-duet-editable-table{text-align:right}.duet-editable-table-header.sc-duet-editable-table tr.sc-duet-editable-table .duet-editable-table-header-hidden.sc-duet-editable-table{padding:0 !important;font-size:0;border-bottom:0}";
|
|
53
25
|
|
|
54
26
|
let DuetEditableTable = class {
|
|
55
27
|
constructor(hostRef) {
|
|
56
28
|
registerInstance(this, hostRef);
|
|
57
|
-
this.
|
|
29
|
+
this.duetTableToggle = createEvent(this, "duetTableToggle", 7);
|
|
30
|
+
this.duetMenuClick = createEvent(this, "duetMenuClick", 7);
|
|
58
31
|
/**
|
|
59
|
-
*
|
|
60
|
-
* @internal
|
|
32
|
+
* Duet-table: margin of the component.
|
|
61
33
|
*/
|
|
62
|
-
this.
|
|
34
|
+
this.margin = "auto";
|
|
63
35
|
/**
|
|
64
|
-
*
|
|
36
|
+
* Duet-table: Style variation of the table.
|
|
65
37
|
*/
|
|
66
|
-
this.
|
|
38
|
+
this.variation = "striped";
|
|
67
39
|
/**
|
|
68
|
-
*
|
|
40
|
+
* Duet-table: Controls whether the table has a sticky header.
|
|
41
|
+
* Sticky headers are not compatible with breakpoint="none-scrollable".
|
|
69
42
|
*/
|
|
70
|
-
this.
|
|
43
|
+
this.sticky = false;
|
|
71
44
|
/**
|
|
72
|
-
*
|
|
45
|
+
* Duet-table: Adjust the distance from top of the viewport (in pixels) when the
|
|
46
|
+
* table header becomes sticky.
|
|
73
47
|
*/
|
|
74
|
-
this.
|
|
75
|
-
fi: "Kaikki",
|
|
76
|
-
en: "All items",
|
|
77
|
-
sv: "Alla objekt",
|
|
78
|
-
};
|
|
48
|
+
this.stickyDistance = "with-links";
|
|
79
49
|
/**
|
|
80
|
-
*
|
|
50
|
+
* Duet-table: By default the table is responsive - it will be flattened at narrow viewport widths.
|
|
51
|
+
* This prop controls the breakpoint at which the table should be rendered as a _regular_ table.
|
|
52
|
+
* Set to "none" to disable the responsive functionality.
|
|
53
|
+
* Set to "none-scrollable" to disable responsive functionality _and_ allow horizontal scrolling -
|
|
54
|
+
* this is useful for comparison tables where it's important to maintain column and row layout.
|
|
81
55
|
*/
|
|
82
|
-
this.
|
|
83
|
-
fi: "Toiminnot",
|
|
84
|
-
en: "Actions",
|
|
85
|
-
sv: "Handlingar",
|
|
86
|
-
};
|
|
56
|
+
this.breakpoint = "small";
|
|
87
57
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
*
|
|
58
|
+
* Define actions for all items in a table
|
|
59
|
+
* An alternative to inline HTML table.
|
|
60
|
+
* required for Sortable tables
|
|
61
|
+
* @default undefined
|
|
91
62
|
*/
|
|
92
|
-
this.
|
|
93
|
-
{ id: "all", label: this.groupsLabelDefaults, actionLabel: this.actionLabelDefaults },
|
|
94
|
-
];
|
|
63
|
+
this.actions = undefined;
|
|
95
64
|
/**
|
|
96
|
-
*
|
|
65
|
+
* Define columns for a table
|
|
66
|
+
* An alternative to inline HTML table.
|
|
67
|
+
* required for Sortable tables
|
|
97
68
|
* @default undefined
|
|
98
|
-
* @example [{
|
|
99
|
-
variation: "default",
|
|
100
|
-
icon: "action-edit-2",
|
|
101
|
-
id: "edit",
|
|
102
|
-
map: ["success"],
|
|
103
|
-
label: {
|
|
104
|
-
fi: " Label",
|
|
105
|
-
en: " Label",
|
|
106
|
-
sv: " Label",
|
|
107
|
-
}
|
|
108
|
-
}]
|
|
109
69
|
*/
|
|
110
|
-
this.
|
|
70
|
+
this.columns = undefined;
|
|
111
71
|
/**
|
|
112
|
-
*
|
|
72
|
+
* Define rows for a table
|
|
73
|
+
* An alternative to inline HTML table.
|
|
74
|
+
* required for Sortable tables
|
|
75
|
+
* @default undefined
|
|
113
76
|
*/
|
|
114
|
-
this.
|
|
77
|
+
this.rows = undefined;
|
|
115
78
|
/**
|
|
116
|
-
*
|
|
79
|
+
* Controls whether the table is sortable by headers
|
|
117
80
|
*/
|
|
118
|
-
this.
|
|
81
|
+
this.sortable = false;
|
|
82
|
+
/**
|
|
83
|
+
* Optional id that get passed to the table and used to setup ::parts
|
|
84
|
+
*/
|
|
85
|
+
this.groupId = "";
|
|
119
86
|
/**
|
|
120
87
|
* Theme of the table.
|
|
121
88
|
*/
|
|
122
89
|
this.theme = "";
|
|
123
90
|
/**
|
|
124
|
-
*
|
|
91
|
+
* Exposes the aria role for optimizing accessibility.
|
|
125
92
|
*/
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
|
|
93
|
+
this.accessibleRole = undefined;
|
|
94
|
+
this.sortableDefaultLabel = {
|
|
95
|
+
fi: "Järjestä",
|
|
96
|
+
en: "Click to sort",
|
|
97
|
+
sv: "Klicka för att sortera",
|
|
98
|
+
};
|
|
99
|
+
this.actionColumnLabel = {
|
|
100
|
+
en: "Actions for rows",
|
|
101
|
+
fi: "Toiminnot rivillä",
|
|
102
|
+
sv: "Åtgärder för rader",
|
|
103
|
+
};
|
|
129
104
|
/**
|
|
130
|
-
*
|
|
105
|
+
* Private methods.
|
|
131
106
|
*/
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const { item, group, uid } = data;
|
|
144
|
-
if (this.template) {
|
|
145
|
-
return {
|
|
146
|
-
group,
|
|
147
|
-
uid,
|
|
148
|
-
item: this.template(item),
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
return { item, group, uid };
|
|
107
|
+
this.toggleColumn = (column, e) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
const { sort_order, direction, index, key } = column;
|
|
110
|
+
this.duetTableToggle.emit({
|
|
111
|
+
sort_order,
|
|
112
|
+
index,
|
|
113
|
+
direction,
|
|
114
|
+
key,
|
|
115
|
+
component: "duet-editable-table",
|
|
116
|
+
originalEvent: e,
|
|
117
|
+
});
|
|
152
118
|
};
|
|
153
|
-
this.
|
|
154
|
-
if (
|
|
155
|
-
|
|
119
|
+
this.handleKeyDown = (column, e) => {
|
|
120
|
+
if (isKeyboardClick(e)) {
|
|
121
|
+
this.toggleColumn(column, e);
|
|
156
122
|
}
|
|
157
|
-
return Array.from(this.items).filter(item => needle === item[1].group);
|
|
158
123
|
};
|
|
159
124
|
}
|
|
160
125
|
/**
|
|
161
126
|
* Component lifecycle events.
|
|
162
127
|
*/
|
|
163
128
|
componentWillLoad() {
|
|
164
|
-
// look for a <template> region in the duet-editable-table
|
|
165
|
-
this.template = this.getTemplate();
|
|
166
|
-
// take care of the case where groups and actions are defined as html properties instead of javascript objects
|
|
167
|
-
if (typeof this.groups === "string") {
|
|
168
|
-
this.internalGroupArray = sanitizeString(this.groups);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
this.internalGroupArray = this.groups;
|
|
172
|
-
}
|
|
173
|
-
if (typeof this.actions === "string") {
|
|
174
|
-
this.internalActionsArray = sanitizeString(this.actions);
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
this.internalActionsArray = this.actions;
|
|
178
|
-
}
|
|
179
129
|
inheritGlobalTheme(this);
|
|
180
130
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
const currentGroup = this.filterMap(group.id);
|
|
194
|
-
if (!currentGroup.length) {
|
|
195
|
-
return;
|
|
131
|
+
createLabel(column) {
|
|
132
|
+
const { sort_order, direction, index, label } = column;
|
|
133
|
+
const i18nLabel = getLocaleString(label);
|
|
134
|
+
if (!this.sortable) {
|
|
135
|
+
return i18nLabel;
|
|
136
|
+
}
|
|
137
|
+
const getButtonIcon = () => {
|
|
138
|
+
// "action-subtract-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-subtract-small.svg
|
|
139
|
+
// "action-arrow-down-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-down-small.svg
|
|
140
|
+
// "action-arrow-up-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-up-small.svg
|
|
141
|
+
if (!!sort_order && direction === 1) {
|
|
142
|
+
return "action-arrow-down-small";
|
|
196
143
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
: getLocaleString(this.actionLabelDefaults))))), h("tbody", null, currentGroup.map(dataAsArray => {
|
|
204
|
-
const [key, value] = dataAsArray;
|
|
205
|
-
return (h("duet-editable-table-item", { theme: this.theme, keyName: key, data: this.getItemData(value), groupId: group.id, part: group.id, alignment: this.alignment, actions: this.internalActionsArray }));
|
|
206
|
-
})))));
|
|
207
|
-
})));
|
|
144
|
+
else if (!!sort_order && direction === -1) {
|
|
145
|
+
return "action-arrow-up-small";
|
|
146
|
+
}
|
|
147
|
+
return "action-subtract-small";
|
|
148
|
+
};
|
|
149
|
+
return (h("span", { class: "duet-table-label", "data-index": index }, h("duet-button", { size: "small", icon: getButtonIcon(), "icon-size": "medium-small", "accessible-label": getLocaleString(this.sortableDefaultLabel), variation: "plain", margin: "none", "icon-right": true, onClick: event => this.toggleColumn(column, event), onKeyDown: event => this.handleKeyDown(column, event) }, i18nLabel)));
|
|
208
150
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
//simple functional component that renders the data in the table
|
|
214
|
-
const TableData = ({ data, groupId, alignment }, _children) => {
|
|
215
|
-
if (typeof data === "string") {
|
|
216
|
-
return (h("td", { innerHTML: data, class: "duet-editable-table-content", part: `${groupId}content`, style: { verticalAlign: alignment } }));
|
|
151
|
+
getSortedColumns() {
|
|
152
|
+
//create a new array from sort instead of mutating original
|
|
153
|
+
return [...this.columns].sort(fieldSorter(["index"]));
|
|
217
154
|
}
|
|
218
|
-
|
|
219
|
-
|
|
155
|
+
getRowSortOrder() {
|
|
156
|
+
//create a new array from sort instead of mutating original
|
|
157
|
+
const fields = [...this.columns].sort(fieldSorter(["sort_order"]));
|
|
158
|
+
//return only key from objects that have sort_order
|
|
159
|
+
return fields
|
|
160
|
+
.filter(column => column.sort_order)
|
|
161
|
+
.map(column => {
|
|
162
|
+
// add - in-front of descending direction (required by field-sorter)
|
|
163
|
+
return column.direction === -1 ? `-${column.key}` : column.key;
|
|
164
|
+
});
|
|
220
165
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
this.theme = "";
|
|
234
|
-
/**
|
|
235
|
-
* Actions that can be performed on the element
|
|
236
|
-
*/
|
|
237
|
-
this.actions = undefined;
|
|
238
|
-
/**
|
|
239
|
-
* GroupId used to pierce the shadowdom - gets concatenated with "content & actions" and used as part="groupIDcontent/actions" to pierce the content/Action item
|
|
240
|
-
* @internal
|
|
241
|
-
*/
|
|
242
|
-
this.groupId = "";
|
|
243
|
-
/**
|
|
244
|
-
* Key used to set vertical alignment of action buttons
|
|
245
|
-
*/
|
|
246
|
-
this.alignment = "middle";
|
|
247
|
-
/**
|
|
248
|
-
* Key used to identify item, when running actions
|
|
249
|
-
*/
|
|
250
|
-
this.keyName = "";
|
|
251
|
-
/**
|
|
252
|
-
* Object of data itemsused to render the entire row
|
|
253
|
-
*/
|
|
254
|
-
this.data = undefined;
|
|
166
|
+
renderTableHeader() {
|
|
167
|
+
if (!this.columns) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const sortedColumns = this.getSortedColumns();
|
|
171
|
+
return (h("tr", { class: {
|
|
172
|
+
"duet-table-action-header": !!this.actions,
|
|
173
|
+
} }, sortedColumns.map(column => {
|
|
174
|
+
if (column.display !== false) {
|
|
175
|
+
return h("th", { scope: "col" }, this.createLabel(column));
|
|
176
|
+
}
|
|
177
|
+
}), this.actions && (h("th", { scope: "col", class: "duet-table-action-header-heading" }, this.actions && h("duet-visually-hidden", null, getLocaleString(this.actionColumnLabel))))));
|
|
255
178
|
}
|
|
256
|
-
|
|
257
|
-
//
|
|
179
|
+
renderActions(rowItem, index) {
|
|
180
|
+
// escape early
|
|
181
|
+
if (!this.actions) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
// iterate through actions and add them in the sidebar
|
|
185
|
+
return (h("td", { class: "duet-text-right" }, this.actions.map(actionItem => {
|
|
186
|
+
return (h("duet-action-button", { actionMeta: Object.assign({}, (rowItem === null || rowItem === void 0 ? void 0 : rowItem.meta) || {}, { index }), actionId: (rowItem === null || rowItem === void 0 ? void 0 : rowItem.uid) || (rowItem === null || rowItem === void 0 ? void 0 : rowItem.id) || null, actionName: actionItem.name, theme: this.theme, iconName: actionItem.icon, iconColor: actionItem.color, iconSize: actionItem.size, background: actionItem.background }));
|
|
187
|
+
})));
|
|
258
188
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
189
|
+
renderTableBody() {
|
|
190
|
+
const columns = this.getSortedColumns();
|
|
191
|
+
const rowSortOrder = this.getRowSortOrder();
|
|
192
|
+
const sortedRows = [...this.rows].sort(fieldSorter(rowSortOrder));
|
|
193
|
+
// return a tbody with rows for each item in sortedRows
|
|
194
|
+
return sortedRows.map((row, index) => (h("tr", { class: {
|
|
195
|
+
"duet-table-action-row": !!this.actions,
|
|
196
|
+
"duet-editable-table-row": true,
|
|
197
|
+
[`duet-editable-table-row-${this.groupId}`]: true,
|
|
198
|
+
}, "data-meta": JSON.stringify(row.meta) }, columns.map(column => {
|
|
199
|
+
//if we don't have any data for this column, try getting an item instead (for backwards compatibility
|
|
200
|
+
const value = row[column.key] ? row[column.key] : row.item;
|
|
201
|
+
if (column.display !== false) {
|
|
202
|
+
return h(TableData, { data: value, groupId: this.groupId });
|
|
203
|
+
}
|
|
204
|
+
}), this.actions && this.renderActions(row, index))));
|
|
265
205
|
}
|
|
266
206
|
/**
|
|
267
|
-
|
|
268
|
-
* private functions
|
|
269
|
-
*/
|
|
270
|
-
/**
|
|
271
|
-
* render() function
|
|
272
|
-
* Always the last one in the class.
|
|
207
|
+
* Render Methods
|
|
273
208
|
*/
|
|
274
209
|
render() {
|
|
275
|
-
return (h(Host, {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
210
|
+
return (h(Host, { class: {
|
|
211
|
+
[`duet-editable-table-${this.variation}`]: true,
|
|
212
|
+
[`duet-editable-table-${this.theme}`]: true,
|
|
213
|
+
// sticky only valid when in regular table layout
|
|
214
|
+
"duet-editable-table-scrollable": this.breakpoint === "none-scrollable",
|
|
215
|
+
"duet-editable-table-sortable": this.sortable,
|
|
216
|
+
"duet-editable-table-actions": !!this.actions,
|
|
217
|
+
"duet-m-0": this.margin === "none",
|
|
218
|
+
"duet-theme-turva": this.theme === "turva",
|
|
219
|
+
} }, h("duet-table", { sticky: this.sticky, stickyDistance: this.stickyDistance, margin: this.margin, theme: this.theme, variation: this.variation, breakpoint: this.breakpoint }, h("table", { role: this.accessibleRole }, h("caption", null, h("slot", { name: "tcaption" })), h("thead", null, h("tr", null, h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, h("slot", { name: "thead-first" }))), this.renderTableHeader(), h("tr", null, h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, h("slot", { name: "thead-last" })))), h("tbody", null, this.renderTableBody()), h("tfoot", null, h("tr", null, h("th", { class: "duet-editable-table-footer-menu", colSpan: 99 }, h("slot", { name: "tfoot" }))))))));
|
|
283
220
|
}
|
|
284
|
-
get
|
|
285
|
-
static get watchers() { return {
|
|
286
|
-
"data": ["watchPropHandler"]
|
|
287
|
-
}; }
|
|
221
|
+
get element() { return getElement(this); }
|
|
288
222
|
};
|
|
289
|
-
|
|
223
|
+
DuetEditableTable.style = duetEditableTableCss;
|
|
290
224
|
|
|
291
|
-
const duetTableCss = "duet-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-bottom:20px !important;display:block;font-variant-numeric:tabular-nums}duet-table table,duet-table thead,duet-table tbody,duet-table tfoot,duet-table th,duet-table td,duet-table tr{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}duet-table.duet-m-0{margin:0 !important}duet-table table{width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;text-align:left;border-spacing:0;border-collapse:separate}duet-table.duet-theme-turva table{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}duet-table td{-webkit-hyphens:auto;hyphens:auto;color:#00294d}duet-table.duet-theme-turva td{color:#171c3a}duet-table th{font-weight:600;line-height:1.25;color:#657787;text-align:left}duet-table.duet-theme-turva th{color:#747475}duet-table tbody th{font-weight:600;color:#00294d}duet-table.duet-theme-turva tbody th{color:#171c3a}
|
|
225
|
+
const duetTableCss = "duet-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-bottom:20px !important;display:block;font-variant-numeric:tabular-nums}duet-table table,duet-table thead,duet-table tbody,duet-table tfoot,duet-table th,duet-table td,duet-table tr{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}duet-table.duet-m-0{margin:0 !important}duet-table table{width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;text-align:left;border-spacing:0;border-collapse:separate}duet-table.duet-theme-turva table{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}duet-table td{-webkit-hyphens:auto;hyphens:auto;color:#00294d}duet-table.duet-theme-turva td{color:#171c3a}duet-table th{font-weight:600;line-height:1.25;color:#657787;text-align:left}duet-table.duet-theme-turva th{color:#747475}duet-table tbody th{font-weight:600;color:#00294d}duet-table.duet-theme-turva tbody th{color:#171c3a}duet-table .duet-table-action-row td:last-child{justify-self:end;padding-right:20px !important;white-space:nowrap}.duet-table-flattened tbody tr{display:grid;grid-template-columns:repeat(2, 1fr);grid-auto-rows:auto;gap:10px}.duet-table-flattened tbody tr.duet-table-action-row td:last-child::before{padding:0;content:\"\"}.duet-table-flattened thead tr{position:absolute !important;top:0;width:1px !important;height:1px !important;padding:0 !important;overflow:hidden !important;clip:rect(1px, 1px, 1px, 1px) !important;border:0 !important}.duet-table-flattened td{grid-column:1/2;line-height:1.25}.duet-table-flattened td:not(:last-child){margin-bottom:16px !important}.duet-table-flattened td:first-child{grid-row:1;grid-column:1}.duet-table-flattened td:last-child{grid-row:1;grid-column:2}.duet-table-flattened tbody td,.duet-table-flattened tbody th,.duet-table-flattened tfoot td{padding:0 !important;text-align:left !important}.duet-table-flattened tbody th{font-weight:600;line-height:1.25;color:#657787;text-align:left}.duet-table-flattened td[data-heading]::before{margin-bottom:4px !important;display:block;font-size:1rem;font-weight:600;color:#00294d;content:attr(data-heading)}.duet-table-flattened.duet-theme-turva td[data-heading]::before{color:#171c3a}.duet-table-sticky thead th{position:sticky;top:0;background:white}.duet-table-striped td,.duet-table-striped th{padding:20px !important}@media (max-width: 35.9375em){.duet-table-striped td,.duet-table-striped th{padding:20px 12px !important}}.duet-table-striped tbody th{background:white}.duet-table-striped.duet-table-sticky thead th{border-bottom:1px solid #e1e3e6}.duet-table-striped.duet-table-sticky.duet-theme-turva thead th{border-bottom-color:#e4e4e6}.duet-table-striped tbody:not(:first-of-type) th{padding-top:40px !important}.duet-table-striped tbody:only-of-type tr:nth-of-type(odd){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:only-of-type tr:nth-of-type(odd){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tfoot td{border-top:1px solid #e1e3e6}.duet-table-striped.duet-theme-turva tfoot td{border-top-color:#e4e4e6}.duet-table-striped.duet-table-flattened tbody:not(:first-of-type) th{padding-top:20px !important}.duet-table-striped.duet-table-flattened tr{padding:20px !important}.duet-table-striped.duet-table-flattened tfoot td{border-top:0}.duet-table-striped.duet-table-flattened tfoot tr{border-top:1px solid #e1e3e6}.duet-table-striped.duet-table-flattened.duet-theme-turva tfoot tr{border-top-color:#e4e4e6}.duet-table-fixed th,.duet-table-minimal th,.duet-table-plain th{padding:16px !important;border-bottom:1px solid #657787}.duet-table-fixed th:first-child,.duet-table-minimal th:first-child,.duet-table-plain th:first-child{padding-left:0 !important}.duet-table-fixed th:last-child,.duet-table-minimal th:last-child,.duet-table-plain th:last-child{padding-right:0 !important}.duet-theme-turva.duet-table-fixed th,.duet-theme-turva.duet-table-minimal th,.duet-theme-turva.duet-table-plain th{border-bottom-color:#444445}.duet-table-fixed tbody th,.duet-table-minimal tbody th,.duet-table-plain tbody th{padding-top:40px !important;border-bottom-color:#e1e3e6}.duet-theme-turva.duet-table-fixed tbody th,.duet-theme-turva.duet-table-minimal tbody th,.duet-theme-turva.duet-table-plain tbody th{border-bottom-color:#e4e4e6}.duet-table-fixed td,.duet-table-minimal td,.duet-table-plain td{padding:16px !important}.duet-table-fixed td:first-child,.duet-table-minimal td:first-child,.duet-table-plain td:first-child{padding-left:0 !important}.duet-table-fixed td:last-child,.duet-table-minimal td:last-child,.duet-table-plain td:last-child{padding-right:0 !important}.duet-table-fixed tbody td,.duet-table-minimal tbody td,.duet-table-plain tbody td{border-bottom:1px solid #e1e3e6}.duet-theme-turva.duet-table-fixed tbody td,.duet-theme-turva.duet-table-minimal tbody td,.duet-theme-turva.duet-table-plain tbody td{border-bottom-color:#e4e4e6}.duet-table-flattened.duet-table-fixed tbody:first-of-type th,.duet-table-flattened.duet-table-minimal tbody:first-of-type th,.duet-table-flattened.duet-table-plain tbody:first-of-type th{padding-top:0 !important}.duet-table-flattened.duet-table-fixed td,.duet-table-flattened.duet-table-minimal td,.duet-table-flattened.duet-table-plain td,.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{border-bottom:0}.duet-table-flattened.duet-table-fixed tr,.duet-table-flattened.duet-table-minimal tr,.duet-table-flattened.duet-table-plain tr{padding:20px 0 !important}.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{padding-top:20px !important}.duet-table-flattened.duet-table-fixed tfoot td,.duet-table-flattened.duet-table-minimal tfoot td,.duet-table-flattened.duet-table-plain tfoot td{margin-bottom:4px !important}.duet-table-flattened.duet-table-fixed tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-minimal tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-plain tbody:not(:only-of-type) tr:first-child{border-bottom:0}.duet-table-plain.duet-table-flattened tbody tr{border-bottom:1px solid #e1e3e6}.duet-table-plain.duet-table-flattened.duet-theme-turva tbody tr{border-bottom-color:#e4e4e6}.duet-table-minimal tbody tr,.duet-table-minimal tbody tr td{vertical-align:top;border-bottom:0 none}.duet-table-minimal tbody tr:last-of-type,.duet-table-minimal tbody tr:last-of-type td{border-bottom:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened tbody tr,.duet-table-minimal.duet-table-flattened tbody tr td{border-bottom:0 none}.duet-table-minimal.duet-table-flattened tbody tr td[data-heading]::before{display:none}.duet-table-minimal.duet-table-flattened tfoot{border-top:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened.duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-fixed table{table-layout:fixed}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td,.duet-table-fixed tbody tr td:first-child{padding:4px !important;vertical-align:text-bottom;border-bottom:0 none}.duet-table-fixed thead{display:none}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td{border-bottom:0 none}.duet-table-fixed:not(.duet-table-flattened) tfoot{border-top:1px solid #e1e3e6}.duet-table-fixed:not(.duet-table-flattened).duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-scrollable{position:relative;width:100%;overflow-x:auto;background:linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0)), linear-gradient(-90deg, #fff 0%, rgba(255, 255, 255, 0)) 100% 0, radial-gradient(farthest-side at 0% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)), radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)) 100% 0%;background-repeat:no-repeat;background-attachment:local, local, scroll, scroll;background-size:100px 100%, 100px 100%, 12px 100%, 12px 100%}.duet-table-selected-column{background:rgba(0, 119, 179, 0.08)}.duet-theme-turva .duet-table-selected-column{background:rgba(68, 68, 69, 0.08)}.duet-table-sortable tbody tr td:first-child,.duet-table-sortable thead tr th:first-child{padding:20px}.duet-table-sortable:not(.duet-table-flattened) tfoot{border-top:1px solid #e1e3e6}.duet-table-sortable:not(.duet-table-flattened).duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-actions table{table-layout:auto}.duet-table-actions thead th:last-child{width:1px;white-space:nowrap}";
|
|
292
226
|
|
|
293
227
|
// remove wrapping speech marks.
|
|
294
228
|
// media query tokens are wrapped in speech marks,
|
|
@@ -348,9 +282,9 @@ let DuetTable = class {
|
|
|
348
282
|
}
|
|
349
283
|
connectedCallback() {
|
|
350
284
|
this.mq = matchMedia(breakpointToToken[this.breakpoint]);
|
|
351
|
-
this.mq.addEventListener("change", this.handleMediaQueryChange);
|
|
285
|
+
this.mq.addEventListener("change", debounce(this.handleMediaQueryChange, 50));
|
|
352
286
|
this.handleMediaQueryChange(this.mq);
|
|
353
|
-
this.observer = new MutationObserver(() => this.copyHeadingsToCells());
|
|
287
|
+
this.observer = new MutationObserver(() => debounce(this.copyHeadingsToCells(), 50));
|
|
354
288
|
this.observer.observe(this.element, {
|
|
355
289
|
childList: true,
|
|
356
290
|
subtree: true,
|
|
@@ -381,6 +315,9 @@ let DuetTable = class {
|
|
|
381
315
|
this.mq = null;
|
|
382
316
|
this.matchesBreakpoint = true;
|
|
383
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Local methods.
|
|
320
|
+
*/
|
|
384
321
|
copyHeadingsToCells() {
|
|
385
322
|
const headingElements = this.element.querySelectorAll("thead th");
|
|
386
323
|
const rowElements = this.element.querySelectorAll("tbody tr");
|
|
@@ -656,7 +593,7 @@ const validateFile = (item, validators) => {
|
|
|
656
593
|
if (item) {
|
|
657
594
|
const { name, type, size } = item;
|
|
658
595
|
const mime = validateFileMime(type, allowedMimetypes);
|
|
659
|
-
const ext = validateFileExtension(name, allowedExtensions);
|
|
596
|
+
const ext = validateFileExtension(name.toLowerCase(), allowedExtensions);
|
|
660
597
|
const bytes = validateFileSize(size, maxBytes);
|
|
661
598
|
if (!mime) {
|
|
662
599
|
errorMessage = getError("duet-upload-101");
|
|
@@ -736,7 +673,7 @@ const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress })
|
|
|
736
673
|
return xhr;
|
|
737
674
|
};
|
|
738
675
|
|
|
739
|
-
const duetUploadCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}::slotted([slot=header]){margin-bottom:16px}::slotted([slot=fileheader]){margin:16px 0 0 0}::slotted([slot=filefooter]){margin-top:16px}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload-item-size{font-size:0.75rem;font-weight:400}.duet-upload-filelist{margin-bottom:25px}.duet-upload-filelist-empty{display:flex;align-items:center;justify-content:center;width:100%;height:75px;margin:0 auto;font-size:1rem;font-weight:400;background-color:#f5f8fa}";
|
|
676
|
+
const duetUploadCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}::slotted([slot=header]){margin-bottom:16px}::slotted([slot=fileheader]){margin:16px 0 0 0}::slotted([slot=filefooter]){margin-top:16px}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload-item-size{font-size:0.75rem;font-weight:400}.duet-upload-filelist{margin-bottom:25px}.duet-upload-filelist-empty{display:flex;align-items:center;justify-content:center;width:100%;height:75px;margin:0 auto;font-size:1rem;font-weight:400;background-color:#f5f8fa}.duet-upload-editable-table-header-hidden{display:none}.duet-upload-editable-table tbody .duet-upload-editable-table-data{padding:0 !important;border:0}.duet-upload-editable-table duet-editable-table tfoot,.duet-upload-editable-table duet-editable-table thead{display:none}.duet-upload-editable-table duet-editable-table .duet-editable-table-content{padding-right:0 !important;padding-left:0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td{padding:0.75rem 0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td:last-child{padding-right:0 !important}.duet-upload-editable-table duet-editable-table .duet-editable-table-row-inprogress duet-action-button::part(button){border:0}";
|
|
740
677
|
|
|
741
678
|
let DuetUpload = class {
|
|
742
679
|
constructor(hostRef) {
|
|
@@ -750,25 +687,6 @@ let DuetUpload = class {
|
|
|
750
687
|
this.duetCancel = createEvent(this, "duetCancel", 3);
|
|
751
688
|
this.duetProgress = createEvent(this, "duetProgress", 3);
|
|
752
689
|
this.duetUpload = createEvent(this, "duetUpload", 3);
|
|
753
|
-
/**
|
|
754
|
-
* Own Properties
|
|
755
|
-
*/
|
|
756
|
-
this.buttonId = createID("DuetButton");
|
|
757
|
-
this.labelId = createID("DuetLabel");
|
|
758
|
-
this.uploadId = createID("DuetUpload");
|
|
759
|
-
this.editableTableId = createID("DuetEditableTable");
|
|
760
|
-
this.filesInProgress = new Map();
|
|
761
|
-
this.fileMaxReached = false;
|
|
762
|
-
this.bytesMaxReached = false;
|
|
763
|
-
this.internalStatusMessageLabel = undefined;
|
|
764
|
-
/**
|
|
765
|
-
* Properties
|
|
766
|
-
*/
|
|
767
|
-
this.DefaultGroups = {
|
|
768
|
-
inprogress: "inprogress",
|
|
769
|
-
success: "success",
|
|
770
|
-
failure: "failure",
|
|
771
|
-
};
|
|
772
690
|
/**
|
|
773
691
|
* State() variables
|
|
774
692
|
*/
|
|
@@ -790,8 +708,9 @@ let DuetUpload = class {
|
|
|
790
708
|
{
|
|
791
709
|
icon: "action-delete",
|
|
792
710
|
color: "color-danger",
|
|
793
|
-
|
|
794
|
-
|
|
711
|
+
size: "x-small",
|
|
712
|
+
background: "gray-lightest",
|
|
713
|
+
name: "delete",
|
|
795
714
|
map: ["success", "failure"],
|
|
796
715
|
label: {
|
|
797
716
|
fi: "Poista tiedosto",
|
|
@@ -802,8 +721,9 @@ let DuetUpload = class {
|
|
|
802
721
|
{
|
|
803
722
|
icon: "navigation-close",
|
|
804
723
|
color: "primary",
|
|
805
|
-
|
|
806
|
-
|
|
724
|
+
size: "x-small",
|
|
725
|
+
background: "gray-lightest",
|
|
726
|
+
name: "cancel",
|
|
807
727
|
map: ["inprogress"],
|
|
808
728
|
label: {
|
|
809
729
|
fi: "Keskeytä lähetys",
|
|
@@ -873,8 +793,8 @@ let DuetUpload = class {
|
|
|
873
793
|
inProgressWithErrors: "Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed",
|
|
874
794
|
done: "All {filesTotal} added successfully",
|
|
875
795
|
doneWithErrors: "Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors",
|
|
876
|
-
files: "
|
|
877
|
-
file: "
|
|
796
|
+
files: "File",
|
|
797
|
+
file: "file",
|
|
878
798
|
},
|
|
879
799
|
};
|
|
880
800
|
/**
|
|
@@ -1029,19 +949,72 @@ let DuetUpload = class {
|
|
|
1029
949
|
* by default this is off, setting this to true will limit the users choices to what has been explicitly set
|
|
1030
950
|
*/
|
|
1031
951
|
this.limitSelection = false;
|
|
952
|
+
/**
|
|
953
|
+
* Own Properties
|
|
954
|
+
*/
|
|
955
|
+
this.buttonId = createID("DuetButton");
|
|
956
|
+
this.labelId = createID("DuetLabel");
|
|
957
|
+
this.uploadId = createID("DuetUpload");
|
|
958
|
+
this.filesInProgress = new Map();
|
|
959
|
+
this.fileMaxReached = false;
|
|
960
|
+
this.bytesMaxReached = false;
|
|
961
|
+
this.internalStatusMessageLabel = undefined;
|
|
962
|
+
/**
|
|
963
|
+
* Properties
|
|
964
|
+
*/
|
|
965
|
+
this.DefaultGroups = {
|
|
966
|
+
inprogress: "inprogress",
|
|
967
|
+
success: "success",
|
|
968
|
+
failure: "failure",
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Array of group names that you want the editable table to use to display files
|
|
972
|
+
* @required
|
|
973
|
+
* @example [{ id: "success", label: {fi: "Onnistunut", en: "Success", sv: "Alt klart", }}]
|
|
974
|
+
*/
|
|
975
|
+
this.groups = [
|
|
976
|
+
{
|
|
977
|
+
id: this.DefaultGroups.inprogress,
|
|
978
|
+
label: {
|
|
979
|
+
fi: "Kesken olevat tiedostot",
|
|
980
|
+
sv: "Filer inprogress",
|
|
981
|
+
en: "Files inprogress",
|
|
982
|
+
},
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
id: this.DefaultGroups.success,
|
|
986
|
+
label: {
|
|
987
|
+
fi: "Valmiit tiedostot",
|
|
988
|
+
sv: "Files success",
|
|
989
|
+
en: "Files success",
|
|
990
|
+
},
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
id: this.DefaultGroups.failure,
|
|
994
|
+
label: {
|
|
995
|
+
fi: "Tiedostot, joissa on virheitä",
|
|
996
|
+
sv: "Filer med fel",
|
|
997
|
+
en: "Files with errors",
|
|
998
|
+
},
|
|
999
|
+
},
|
|
1000
|
+
];
|
|
1001
|
+
this.kick = debounce(() => {
|
|
1002
|
+
this.tick = Date.now();
|
|
1003
|
+
}, 30); // will trigger re-render
|
|
1032
1004
|
/**
|
|
1033
1005
|
* Private functions
|
|
1034
1006
|
*/
|
|
1035
1007
|
this.listenForActionEvents = () => {
|
|
1036
|
-
this.element.addEventListener("
|
|
1008
|
+
this.element.addEventListener("duetActionEvent", (e) => {
|
|
1037
1009
|
const detail = e.detail;
|
|
1038
|
-
const { action,
|
|
1010
|
+
const { action, id, originalEvent } = detail;
|
|
1011
|
+
console.log(e);
|
|
1039
1012
|
switch (action) {
|
|
1040
1013
|
case "delete":
|
|
1041
|
-
this.onDelete(
|
|
1014
|
+
this.onDelete(id, originalEvent);
|
|
1042
1015
|
break;
|
|
1043
1016
|
case "cancel":
|
|
1044
|
-
this.onCancel(
|
|
1017
|
+
this.onCancel(id, originalEvent);
|
|
1045
1018
|
break;
|
|
1046
1019
|
// code block
|
|
1047
1020
|
}
|
|
@@ -1098,24 +1071,6 @@ let DuetUpload = class {
|
|
|
1098
1071
|
return "none";
|
|
1099
1072
|
}
|
|
1100
1073
|
};
|
|
1101
|
-
this.convertToDuetEditableTableItems = () => {
|
|
1102
|
-
// we're always recreating the map - in order to force an update down stream.
|
|
1103
|
-
const itemData = new Map();
|
|
1104
|
-
//walk the files Map and convert to DuetEditableTableItemData
|
|
1105
|
-
this.files.forEach((data, key, _originalMap) => {
|
|
1106
|
-
const group = this.getGroupFromItemData(data);
|
|
1107
|
-
const item = this.getItemHTMLFromItemData(data, group);
|
|
1108
|
-
itemData.set(key, {
|
|
1109
|
-
uid: data.uid,
|
|
1110
|
-
item,
|
|
1111
|
-
group,
|
|
1112
|
-
});
|
|
1113
|
-
});
|
|
1114
|
-
return itemData;
|
|
1115
|
-
};
|
|
1116
|
-
this.kick = debounce(() => {
|
|
1117
|
-
this.tick = Date.now();
|
|
1118
|
-
}, 30); // will trigger re-render
|
|
1119
1074
|
this.genHashName = () => Date.now().toString(36) + Math.random();
|
|
1120
1075
|
this.updateValueInMap = (item, key, value, kick = true) => {
|
|
1121
1076
|
const fileItem = this.files.get(item);
|
|
@@ -1176,7 +1131,6 @@ let DuetUpload = class {
|
|
|
1176
1131
|
this.nativeInput.value = "";
|
|
1177
1132
|
};
|
|
1178
1133
|
this.startUpload = async (ev, metaData = undefined) => {
|
|
1179
|
-
await this.setFocus();
|
|
1180
1134
|
this.metaData = metaData;
|
|
1181
1135
|
this.nativeInput.click();
|
|
1182
1136
|
this.onUpload(ev, metaData);
|
|
@@ -1239,9 +1193,18 @@ let DuetUpload = class {
|
|
|
1239
1193
|
fileMaxReached: isTotalFileAmountAboveMax,
|
|
1240
1194
|
};
|
|
1241
1195
|
};
|
|
1196
|
+
this.getItemFromUID = (uid) => {
|
|
1197
|
+
for (const [key, value] of this.files.entries()) {
|
|
1198
|
+
if (value.uid === uid) {
|
|
1199
|
+
return { value, key };
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
return null;
|
|
1203
|
+
};
|
|
1242
1204
|
this.onDelete = (key, ev) => {
|
|
1243
|
-
const
|
|
1244
|
-
this.files.
|
|
1205
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
1206
|
+
const deletedItem = this.files.get(retrievedKey);
|
|
1207
|
+
this.files.delete(retrievedKey);
|
|
1245
1208
|
this.validateTotals();
|
|
1246
1209
|
this.kick();
|
|
1247
1210
|
this.duetDelete.emit({
|
|
@@ -1255,8 +1218,9 @@ let DuetUpload = class {
|
|
|
1255
1218
|
this.resetFormFields();
|
|
1256
1219
|
};
|
|
1257
1220
|
this.onCancel = (key, ev) => {
|
|
1258
|
-
const
|
|
1259
|
-
this.files.
|
|
1221
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
1222
|
+
const cancelledItem = this.files.get(retrievedKey);
|
|
1223
|
+
this.files.delete(retrievedKey);
|
|
1260
1224
|
if (!this.external) {
|
|
1261
1225
|
const { xhr } = cancelledItem;
|
|
1262
1226
|
xhr.abort();
|
|
@@ -1306,6 +1270,79 @@ let DuetUpload = class {
|
|
|
1306
1270
|
data: { files: this.files },
|
|
1307
1271
|
});
|
|
1308
1272
|
};
|
|
1273
|
+
/**
|
|
1274
|
+
* @description This functions return sorted map items byg condition which are:
|
|
1275
|
+
*/
|
|
1276
|
+
this.filterMap = () => {
|
|
1277
|
+
const all = [...this.files.values()];
|
|
1278
|
+
const inprogress = [];
|
|
1279
|
+
const failure = [];
|
|
1280
|
+
const success = [];
|
|
1281
|
+
all.forEach(data => {
|
|
1282
|
+
const group = this.getGroupFromItemData(data);
|
|
1283
|
+
const item = this.getItemHTMLFromItemData(data, group);
|
|
1284
|
+
if (group === this.DefaultGroups.success) {
|
|
1285
|
+
success.push({
|
|
1286
|
+
uid: data.uid,
|
|
1287
|
+
item,
|
|
1288
|
+
group,
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
else if (group === this.DefaultGroups.inprogress) {
|
|
1292
|
+
inprogress.push({
|
|
1293
|
+
uid: data.uid,
|
|
1294
|
+
item,
|
|
1295
|
+
group,
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
else if (group === this.DefaultGroups.failure) {
|
|
1299
|
+
failure.push({
|
|
1300
|
+
uid: data.uid,
|
|
1301
|
+
item,
|
|
1302
|
+
group,
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
else if (data.group) {
|
|
1306
|
+
inprogress.push({
|
|
1307
|
+
uid: data.uid,
|
|
1308
|
+
item,
|
|
1309
|
+
group: data.group,
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
});
|
|
1313
|
+
return {
|
|
1314
|
+
inprogress,
|
|
1315
|
+
failure,
|
|
1316
|
+
success,
|
|
1317
|
+
};
|
|
1318
|
+
};
|
|
1319
|
+
this.getColumns = (group) => {
|
|
1320
|
+
return [
|
|
1321
|
+
{
|
|
1322
|
+
sort_order: 1,
|
|
1323
|
+
direction: 1,
|
|
1324
|
+
index: 0,
|
|
1325
|
+
key: group.id,
|
|
1326
|
+
label: group.label,
|
|
1327
|
+
},
|
|
1328
|
+
];
|
|
1329
|
+
};
|
|
1330
|
+
this.getActions = (id) => {
|
|
1331
|
+
return this.actions.filter(item => item.map.includes(id));
|
|
1332
|
+
};
|
|
1333
|
+
this.renderEditableTableGroups = () => {
|
|
1334
|
+
const filteredItems = this.filterMap();
|
|
1335
|
+
const EditableTables = this.groups.map(group => {
|
|
1336
|
+
const currentItems = filteredItems[group.id];
|
|
1337
|
+
if (!(currentItems === null || currentItems === void 0 ? void 0 : currentItems.length)) {
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
return (h("duet-table", { variation: "plain", breakpoint: "none", role: "log", margin: this.hideGroups ? "none" : "auto" }, h("table", { class: "duet-upload-editable-table" }, h("thead", { class: "duet-upload-editable-table-header" }, h("tr", null, h("th", { class: {
|
|
1341
|
+
"duet-upload-editable-table-header-hidden": this.hideGroups,
|
|
1342
|
+
} }, !this.hideGroups ? (getLocaleString(group.label)) : (h("duet-visually-hidden", null, getLocaleString(group.label)))))), h("tbody", null, h("tr", null, h("td", { class: "duet-upload-editable-table-data" }, h("duet-editable-table", { breakpoint: "none", variation: "plain", groupId: group.id, columns: this.getColumns(group), actions: this.getActions(group.id), margin: "none", rows: currentItems })))))));
|
|
1343
|
+
});
|
|
1344
|
+
return EditableTables;
|
|
1345
|
+
};
|
|
1309
1346
|
}
|
|
1310
1347
|
watchValidHandler(newValue, oldValue) {
|
|
1311
1348
|
if (newValue !== oldValue) {
|
|
@@ -1329,6 +1366,68 @@ let DuetUpload = class {
|
|
|
1329
1366
|
// listen to the events from the component
|
|
1330
1367
|
this.verifyValidity();
|
|
1331
1368
|
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
1371
|
+
* `input.focus()`.
|
|
1372
|
+
*/
|
|
1373
|
+
async setFocus(options) {
|
|
1374
|
+
if (this.nativeInput) {
|
|
1375
|
+
this.nativeInput.focus(options);
|
|
1376
|
+
}
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Method for invoking the upload sequence
|
|
1381
|
+
*/
|
|
1382
|
+
async upload(metaData = undefined) {
|
|
1383
|
+
await this.setFocus();
|
|
1384
|
+
this.metaData = metaData;
|
|
1385
|
+
this.nativeInput.click();
|
|
1386
|
+
return;
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
1390
|
+
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
1391
|
+
* the tabular data if the automatic re-render is no sufficient
|
|
1392
|
+
*/
|
|
1393
|
+
async refresh() {
|
|
1394
|
+
this.kick();
|
|
1395
|
+
await this.setFocus();
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Get list of files, divided in errors and valid sections
|
|
1399
|
+
*/
|
|
1400
|
+
async getFiles() {
|
|
1401
|
+
if (!this.files || this.files.size === 0) {
|
|
1402
|
+
return false;
|
|
1403
|
+
}
|
|
1404
|
+
return this.getFilesAsArray();
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
1408
|
+
*/
|
|
1409
|
+
async updateValue(item, key, value) {
|
|
1410
|
+
this.updateValueInMap(item, key, value);
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* render() function
|
|
1414
|
+
* Always the last one in the class.
|
|
1415
|
+
*/
|
|
1416
|
+
render() {
|
|
1417
|
+
const identifier = this.identifier || this.uploadId;
|
|
1418
|
+
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
1419
|
+
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
1420
|
+
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
1421
|
+
return (h(Host, { class: { "duet-m-0": this.margin === "none" } }, h("duet-fieldset", { label: this.label, caption: caption }, h("slot", { name: "header" }), !this.files.size && (h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
|
|
1422
|
+
"duet-upload-filelist-empty": !this.files.size,
|
|
1423
|
+
"duet-upload-filelist": true,
|
|
1424
|
+
"duet-upload-filelist-filled": this.files.size,
|
|
1425
|
+
}, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && h("slot", { name: "fileheader" }), !!this.files.size && (h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })), !!this.files.size && this.renderEditableTableGroups(), !!this.files.size && h("slot", { name: "filefooter" }), h("duet-spacer", { size: "large" }), !this.hideButton && (h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle", part: this.identifier ? `${this.identifier}-button-upload` : "duet-upload-button-upload" }, this.buttonLabel)), h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" }, this.fileMaxReached && getI18nError("duet-upload-301"), this.bytesMaxReached && getI18nError("duet-upload-202"))), h("duet-spacer", { size: "medium" }), h("duet-visually-hidden", null, h("input", { ref: input => {
|
|
1426
|
+
this.nativeInput = input;
|
|
1427
|
+
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
1428
|
+
"duet-upload": true,
|
|
1429
|
+
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
1430
|
+
}
|
|
1332
1431
|
/**
|
|
1333
1432
|
* XHR request utilities
|
|
1334
1433
|
*/
|
|
@@ -1450,68 +1549,6 @@ let DuetUpload = class {
|
|
|
1450
1549
|
component: "duet-upload",
|
|
1451
1550
|
});
|
|
1452
1551
|
}
|
|
1453
|
-
/**
|
|
1454
|
-
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
1455
|
-
* `input.focus()`.
|
|
1456
|
-
*/
|
|
1457
|
-
async setFocus(options) {
|
|
1458
|
-
if (this.nativeInput) {
|
|
1459
|
-
this.nativeInput.focus(options);
|
|
1460
|
-
}
|
|
1461
|
-
return;
|
|
1462
|
-
}
|
|
1463
|
-
/**
|
|
1464
|
-
* Method for invoking the upload sequence
|
|
1465
|
-
*/
|
|
1466
|
-
async upload(metaData = undefined) {
|
|
1467
|
-
await this.setFocus();
|
|
1468
|
-
this.metaData = metaData;
|
|
1469
|
-
this.nativeInput.click();
|
|
1470
|
-
return;
|
|
1471
|
-
}
|
|
1472
|
-
/**
|
|
1473
|
-
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
1474
|
-
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
1475
|
-
* the tabular data if the automatic re-render is no sufficient
|
|
1476
|
-
*/
|
|
1477
|
-
async refresh() {
|
|
1478
|
-
this.kick();
|
|
1479
|
-
await this.setFocus();
|
|
1480
|
-
}
|
|
1481
|
-
/**
|
|
1482
|
-
* Get list of files, divided in errors and valid sections
|
|
1483
|
-
*/
|
|
1484
|
-
async getFiles() {
|
|
1485
|
-
if (!this.files || this.files.size === 0) {
|
|
1486
|
-
return false;
|
|
1487
|
-
}
|
|
1488
|
-
return this.getFilesAsArray();
|
|
1489
|
-
}
|
|
1490
|
-
/**
|
|
1491
|
-
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
1492
|
-
*/
|
|
1493
|
-
async updateValue(item, key, value) {
|
|
1494
|
-
this.updateValueInMap(item, key, value);
|
|
1495
|
-
}
|
|
1496
|
-
/**
|
|
1497
|
-
* render() function
|
|
1498
|
-
* Always the last one in the class.
|
|
1499
|
-
*/
|
|
1500
|
-
render() {
|
|
1501
|
-
const identifier = this.identifier || this.uploadId;
|
|
1502
|
-
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
1503
|
-
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
1504
|
-
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
1505
|
-
return (h(Host, { class: { "duet-m-0": this.margin === "none" } }, h("duet-fieldset", { label: this.label, caption: caption }, h("slot", { name: "header" }), !this.files.size && (h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
|
|
1506
|
-
"duet-upload-filelist-empty": !this.files.size,
|
|
1507
|
-
"duet-upload-filelist": true,
|
|
1508
|
-
"duet-upload-filelist-filled": this.files.size,
|
|
1509
|
-
}, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && h("slot", { name: "fileheader" }), !!this.files.size && (h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })), !!this.files.size && (h("duet-editable-table", { part: this.identifier ? `${this.identifier}-editable-table` : "duet-upload-editable-table", "aria-live": "polite", "aria-relevant": "removals", accessibleRole: "log", id: this.editableTableId, groups: this.groups, actions: this.actions, hideGroups: this.hideGroups, alignment: this.alignment, items: this.convertToDuetEditableTableItems() })), !!this.files.size && h("slot", { name: "filefooter" }), h("duet-spacer", { size: "large" }), !this.hideButton && (h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle", part: this.identifier ? `${this.identifier}-button-upload` : "duet-upload-button-upload" }, this.buttonLabel)), h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" }, this.fileMaxReached && getI18nError("duet-upload-301"), this.bytesMaxReached && getI18nError("duet-upload-202"))), h("duet-spacer", { size: "medium" }), h("duet-visually-hidden", null, h("input", { ref: input => {
|
|
1510
|
-
this.nativeInput = input;
|
|
1511
|
-
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
1512
|
-
"duet-upload": true,
|
|
1513
|
-
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
1514
|
-
}
|
|
1515
1552
|
get element() { return getElement(this); }
|
|
1516
1553
|
static get watchers() { return {
|
|
1517
1554
|
"valid": ["watchValidHandler"]
|
|
@@ -1519,4 +1556,4 @@ let DuetUpload = class {
|
|
|
1519
1556
|
};
|
|
1520
1557
|
DuetUpload.style = duetUploadCss;
|
|
1521
1558
|
|
|
1522
|
-
export { DuetEditableTable as duet_editable_table,
|
|
1559
|
+
export { DuetEditableTable as duet_editable_table, DuetTable as duet_table, DuetUpload as duet_upload };
|