@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
|
@@ -5,294 +5,228 @@
|
|
|
5
5
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
|
-
const index = require('./index-
|
|
8
|
+
const index = require('./index-da5d5aaf.js');
|
|
9
|
+
const jsUtils = require('./js-utils-be1d29ae.js');
|
|
10
|
+
const keyboardUtils = require('./keyboard-utils-898cfe14.js');
|
|
9
11
|
const languageUtils = require('./language-utils-aa282901.js');
|
|
10
12
|
const themeableComponent = require('./themeable-component-0c1be552.js');
|
|
11
|
-
const tokens_module = require('./tokens.module-
|
|
13
|
+
const tokens_module = require('./tokens.module-6afcc9c1.js');
|
|
12
14
|
const createId = require('./create-id-c3b984b1.js');
|
|
13
15
|
require('./string-utils-267e3dbb.js');
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Produces a function which uses template strings to do simple interpolation from objects.
|
|
27
|
-
*
|
|
28
|
-
* Usage:
|
|
29
|
-
* var makeMeKing = generateTemplateFn('${name} is now the king of ${country}!');
|
|
30
|
-
*
|
|
31
|
-
* console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'}));
|
|
32
|
-
* // Logs 'Bryan is now the king of Scotland!'
|
|
33
|
-
*/
|
|
34
|
-
const generateTemplateFn = (function () {
|
|
35
|
-
const cache = {};
|
|
36
|
-
function generateTemplate(template) {
|
|
37
|
-
if (typeof template !== "string") {
|
|
38
|
-
template = template.outerHTML;
|
|
39
|
-
}
|
|
40
|
-
let fn = cache[template];
|
|
41
|
-
if (!fn) {
|
|
42
|
-
// Replace ${expressions} (etc) with ${map.expressions}.
|
|
43
|
-
const sanitized = template
|
|
44
|
-
.replace(/\$\{([\s]*[^;\s\{]+[\s]*)\}/g, function (_, match) {
|
|
45
|
-
return `\$\{map.${match.trim()}\}`;
|
|
46
|
-
})
|
|
47
|
-
// Afterwards, replace anything that's not ${map.expressions}' (etc) with a blank string.
|
|
48
|
-
.replace(/(\$\{(?!map\.)[^}]+\})/g, "");
|
|
49
|
-
fn = Function("map", `return \`${sanitized}\``);
|
|
50
|
-
}
|
|
51
|
-
return fn;
|
|
17
|
+
//simple functional component that renders the data in the table
|
|
18
|
+
const TableData = ({ data, groupId, alignment }, _children) => {
|
|
19
|
+
const classNames = `duet-editable-table duet-editable-table-content-${groupId}`;
|
|
20
|
+
if (typeof data === "string") {
|
|
21
|
+
return index.h("td", { innerHTML: data, class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } });
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
return (index.h("td", { class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } }, data));
|
|
52
25
|
}
|
|
53
|
-
|
|
54
|
-
})();
|
|
26
|
+
};
|
|
55
27
|
|
|
56
|
-
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}";
|
|
28
|
+
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}";
|
|
57
29
|
|
|
58
30
|
let DuetEditableTable = class {
|
|
59
31
|
constructor(hostRef) {
|
|
60
32
|
index.registerInstance(this, hostRef);
|
|
61
|
-
this.
|
|
33
|
+
this.duetTableToggle = index.createEvent(this, "duetTableToggle", 7);
|
|
34
|
+
this.duetMenuClick = index.createEvent(this, "duetMenuClick", 7);
|
|
62
35
|
/**
|
|
63
|
-
*
|
|
64
|
-
* @internal
|
|
36
|
+
* Duet-table: margin of the component.
|
|
65
37
|
*/
|
|
66
|
-
this.
|
|
38
|
+
this.margin = "auto";
|
|
67
39
|
/**
|
|
68
|
-
*
|
|
40
|
+
* Duet-table: Style variation of the table.
|
|
69
41
|
*/
|
|
70
|
-
this.
|
|
42
|
+
this.variation = "striped";
|
|
71
43
|
/**
|
|
72
|
-
*
|
|
44
|
+
* Duet-table: Controls whether the table has a sticky header.
|
|
45
|
+
* Sticky headers are not compatible with breakpoint="none-scrollable".
|
|
73
46
|
*/
|
|
74
|
-
this.
|
|
47
|
+
this.sticky = false;
|
|
48
|
+
/**
|
|
49
|
+
* Duet-table: Adjust the distance from top of the viewport (in pixels) when the
|
|
50
|
+
* table header becomes sticky.
|
|
51
|
+
*/
|
|
52
|
+
this.stickyDistance = "with-links";
|
|
75
53
|
/**
|
|
76
|
-
*
|
|
54
|
+
* Duet-table: By default the table is responsive - it will be flattened at narrow viewport widths.
|
|
55
|
+
* This prop controls the breakpoint at which the table should be rendered as a _regular_ table.
|
|
56
|
+
* Set to "none" to disable the responsive functionality.
|
|
57
|
+
* Set to "none-scrollable" to disable responsive functionality _and_ allow horizontal scrolling -
|
|
58
|
+
* this is useful for comparison tables where it's important to maintain column and row layout.
|
|
77
59
|
*/
|
|
78
|
-
this.
|
|
79
|
-
fi: "Kaikki",
|
|
80
|
-
en: "All items",
|
|
81
|
-
sv: "Alla objekt",
|
|
82
|
-
};
|
|
60
|
+
this.breakpoint = "small";
|
|
83
61
|
/**
|
|
84
|
-
*
|
|
62
|
+
* Define actions for all items in a table
|
|
63
|
+
* An alternative to inline HTML table.
|
|
64
|
+
* required for Sortable tables
|
|
65
|
+
* @default undefined
|
|
85
66
|
*/
|
|
86
|
-
this.
|
|
87
|
-
fi: "Toiminnot",
|
|
88
|
-
en: "Actions",
|
|
89
|
-
sv: "Handlingar",
|
|
90
|
-
};
|
|
67
|
+
this.actions = undefined;
|
|
91
68
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
69
|
+
* Define columns for a table
|
|
70
|
+
* An alternative to inline HTML table.
|
|
71
|
+
* required for Sortable tables
|
|
72
|
+
* @default undefined
|
|
95
73
|
*/
|
|
96
|
-
this.
|
|
97
|
-
{ id: "all", label: this.groupsLabelDefaults, actionLabel: this.actionLabelDefaults },
|
|
98
|
-
];
|
|
74
|
+
this.columns = undefined;
|
|
99
75
|
/**
|
|
100
|
-
*
|
|
76
|
+
* Define rows for a table
|
|
77
|
+
* An alternative to inline HTML table.
|
|
78
|
+
* required for Sortable tables
|
|
101
79
|
* @default undefined
|
|
102
|
-
* @example [{
|
|
103
|
-
variation: "default",
|
|
104
|
-
icon: "action-edit-2",
|
|
105
|
-
id: "edit",
|
|
106
|
-
map: ["success"],
|
|
107
|
-
label: {
|
|
108
|
-
fi: " Label",
|
|
109
|
-
en: " Label",
|
|
110
|
-
sv: " Label",
|
|
111
|
-
}
|
|
112
|
-
}]
|
|
113
80
|
*/
|
|
114
|
-
this.
|
|
81
|
+
this.rows = undefined;
|
|
115
82
|
/**
|
|
116
|
-
*
|
|
83
|
+
* Controls whether the table is sortable by headers
|
|
117
84
|
*/
|
|
118
|
-
this.
|
|
85
|
+
this.sortable = false;
|
|
119
86
|
/**
|
|
120
|
-
*
|
|
87
|
+
* Optional id that get passed to the table and used to setup ::parts
|
|
121
88
|
*/
|
|
122
|
-
this.
|
|
89
|
+
this.groupId = "";
|
|
123
90
|
/**
|
|
124
91
|
* Theme of the table.
|
|
125
92
|
*/
|
|
126
93
|
this.theme = "";
|
|
127
94
|
/**
|
|
128
|
-
*
|
|
95
|
+
* Exposes the aria role for optimizing accessibility.
|
|
129
96
|
*/
|
|
130
|
-
this.
|
|
131
|
-
|
|
132
|
-
|
|
97
|
+
this.accessibleRole = undefined;
|
|
98
|
+
this.sortableDefaultLabel = {
|
|
99
|
+
fi: "Järjestä",
|
|
100
|
+
en: "Click to sort",
|
|
101
|
+
sv: "Klicka för att sortera",
|
|
102
|
+
};
|
|
103
|
+
this.actionColumnLabel = {
|
|
104
|
+
en: "Actions for rows",
|
|
105
|
+
fi: "Toiminnot rivillä",
|
|
106
|
+
sv: "Åtgärder för rader",
|
|
107
|
+
};
|
|
133
108
|
/**
|
|
134
|
-
*
|
|
109
|
+
* Private methods.
|
|
135
110
|
*/
|
|
136
|
-
this.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
const { item, group, uid } = data;
|
|
148
|
-
if (this.template) {
|
|
149
|
-
return {
|
|
150
|
-
group,
|
|
151
|
-
uid,
|
|
152
|
-
item: this.template(item),
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
return { item, group, uid };
|
|
111
|
+
this.toggleColumn = (column, e) => {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
const { sort_order, direction, index, key } = column;
|
|
114
|
+
this.duetTableToggle.emit({
|
|
115
|
+
sort_order,
|
|
116
|
+
index,
|
|
117
|
+
direction,
|
|
118
|
+
key,
|
|
119
|
+
component: "duet-editable-table",
|
|
120
|
+
originalEvent: e,
|
|
121
|
+
});
|
|
156
122
|
};
|
|
157
|
-
this.
|
|
158
|
-
if (
|
|
159
|
-
|
|
123
|
+
this.handleKeyDown = (column, e) => {
|
|
124
|
+
if (keyboardUtils.isKeyboardClick(e)) {
|
|
125
|
+
this.toggleColumn(column, e);
|
|
160
126
|
}
|
|
161
|
-
return Array.from(this.items).filter(item => needle === item[1].group);
|
|
162
127
|
};
|
|
163
128
|
}
|
|
164
129
|
/**
|
|
165
130
|
* Component lifecycle events.
|
|
166
131
|
*/
|
|
167
132
|
componentWillLoad() {
|
|
168
|
-
// look for a <template> region in the duet-editable-table
|
|
169
|
-
this.template = this.getTemplate();
|
|
170
|
-
// take care of the case where groups and actions are defined as html properties instead of javascript objects
|
|
171
|
-
if (typeof this.groups === "string") {
|
|
172
|
-
this.internalGroupArray = languageUtils.sanitizeString(this.groups);
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
this.internalGroupArray = this.groups;
|
|
176
|
-
}
|
|
177
|
-
if (typeof this.actions === "string") {
|
|
178
|
-
this.internalActionsArray = languageUtils.sanitizeString(this.actions);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
this.internalActionsArray = this.actions;
|
|
182
|
-
}
|
|
183
133
|
themeableComponent.inheritGlobalTheme(this);
|
|
184
134
|
}
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const currentGroup = this.filterMap(group.id);
|
|
198
|
-
if (!currentGroup.length) {
|
|
199
|
-
return;
|
|
135
|
+
createLabel(column) {
|
|
136
|
+
const { sort_order, direction, index: index$1, label } = column;
|
|
137
|
+
const i18nLabel = languageUtils.getLocaleString(label);
|
|
138
|
+
if (!this.sortable) {
|
|
139
|
+
return i18nLabel;
|
|
140
|
+
}
|
|
141
|
+
const getButtonIcon = () => {
|
|
142
|
+
// "action-subtract-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-subtract-small.svg
|
|
143
|
+
// "action-arrow-down-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-down-small.svg
|
|
144
|
+
// "action-arrow-up-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-up-small.svg
|
|
145
|
+
if (!!sort_order && direction === 1) {
|
|
146
|
+
return "action-arrow-down-small";
|
|
200
147
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
: languageUtils.getLocaleString(this.actionLabelDefaults))))), index.h("tbody", null, currentGroup.map(dataAsArray => {
|
|
208
|
-
const [key, value] = dataAsArray;
|
|
209
|
-
return (index.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 }));
|
|
210
|
-
})))));
|
|
211
|
-
})));
|
|
148
|
+
else if (!!sort_order && direction === -1) {
|
|
149
|
+
return "action-arrow-up-small";
|
|
150
|
+
}
|
|
151
|
+
return "action-subtract-small";
|
|
152
|
+
};
|
|
153
|
+
return (index.h("span", { class: "duet-table-label", "data-index": index$1 }, index.h("duet-button", { size: "small", icon: getButtonIcon(), "icon-size": "medium-small", "accessible-label": languageUtils.getLocaleString(this.sortableDefaultLabel), variation: "plain", margin: "none", "icon-right": true, onClick: event => this.toggleColumn(column, event), onKeyDown: event => this.handleKeyDown(column, event) }, i18nLabel)));
|
|
212
154
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
//simple functional component that renders the data in the table
|
|
218
|
-
const TableData = ({ data, groupId, alignment }, _children) => {
|
|
219
|
-
if (typeof data === "string") {
|
|
220
|
-
return (index.h("td", { innerHTML: data, class: "duet-editable-table-content", part: `${groupId}content`, style: { verticalAlign: alignment } }));
|
|
155
|
+
getSortedColumns() {
|
|
156
|
+
//create a new array from sort instead of mutating original
|
|
157
|
+
return [...this.columns].sort(jsUtils.fieldSorter(["index"]));
|
|
221
158
|
}
|
|
222
|
-
|
|
223
|
-
|
|
159
|
+
getRowSortOrder() {
|
|
160
|
+
//create a new array from sort instead of mutating original
|
|
161
|
+
const fields = [...this.columns].sort(jsUtils.fieldSorter(["sort_order"]));
|
|
162
|
+
//return only key from objects that have sort_order
|
|
163
|
+
return fields
|
|
164
|
+
.filter(column => column.sort_order)
|
|
165
|
+
.map(column => {
|
|
166
|
+
// add - in-front of descending direction (required by field-sorter)
|
|
167
|
+
return column.direction === -1 ? `-${column.key}` : column.key;
|
|
168
|
+
});
|
|
224
169
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
this.theme = "";
|
|
238
|
-
/**
|
|
239
|
-
* Actions that can be performed on the element
|
|
240
|
-
*/
|
|
241
|
-
this.actions = undefined;
|
|
242
|
-
/**
|
|
243
|
-
* GroupId used to pierce the shadowdom - gets concatenated with "content & actions" and used as part="groupIDcontent/actions" to pierce the content/Action item
|
|
244
|
-
* @internal
|
|
245
|
-
*/
|
|
246
|
-
this.groupId = "";
|
|
247
|
-
/**
|
|
248
|
-
* Key used to set vertical alignment of action buttons
|
|
249
|
-
*/
|
|
250
|
-
this.alignment = "middle";
|
|
251
|
-
/**
|
|
252
|
-
* Key used to identify item, when running actions
|
|
253
|
-
*/
|
|
254
|
-
this.keyName = "";
|
|
255
|
-
/**
|
|
256
|
-
* Object of data itemsused to render the entire row
|
|
257
|
-
*/
|
|
258
|
-
this.data = undefined;
|
|
170
|
+
renderTableHeader() {
|
|
171
|
+
if (!this.columns) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const sortedColumns = this.getSortedColumns();
|
|
175
|
+
return (index.h("tr", { class: {
|
|
176
|
+
"duet-table-action-header": !!this.actions,
|
|
177
|
+
} }, sortedColumns.map(column => {
|
|
178
|
+
if (column.display !== false) {
|
|
179
|
+
return index.h("th", { scope: "col" }, this.createLabel(column));
|
|
180
|
+
}
|
|
181
|
+
}), this.actions && (index.h("th", { scope: "col", class: "duet-table-action-header-heading" }, this.actions && index.h("duet-visually-hidden", null, languageUtils.getLocaleString(this.actionColumnLabel))))));
|
|
259
182
|
}
|
|
260
|
-
|
|
261
|
-
//
|
|
183
|
+
renderActions(rowItem, index$1) {
|
|
184
|
+
// escape early
|
|
185
|
+
if (!this.actions) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
// iterate through actions and add them in the sidebar
|
|
189
|
+
return (index.h("td", { class: "duet-text-right" }, this.actions.map(actionItem => {
|
|
190
|
+
return (index.h("duet-action-button", { actionMeta: Object.assign({}, (rowItem === null || rowItem === void 0 ? void 0 : rowItem.meta) || {}, { index: index$1 }), 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 }));
|
|
191
|
+
})));
|
|
262
192
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
193
|
+
renderTableBody() {
|
|
194
|
+
const columns = this.getSortedColumns();
|
|
195
|
+
const rowSortOrder = this.getRowSortOrder();
|
|
196
|
+
const sortedRows = [...this.rows].sort(jsUtils.fieldSorter(rowSortOrder));
|
|
197
|
+
// return a tbody with rows for each item in sortedRows
|
|
198
|
+
return sortedRows.map((row, index$1) => (index.h("tr", { class: {
|
|
199
|
+
"duet-table-action-row": !!this.actions,
|
|
200
|
+
"duet-editable-table-row": true,
|
|
201
|
+
[`duet-editable-table-row-${this.groupId}`]: true,
|
|
202
|
+
}, "data-meta": JSON.stringify(row.meta) }, columns.map(column => {
|
|
203
|
+
//if we don't have any data for this column, try getting an item instead (for backwards compatibility
|
|
204
|
+
const value = row[column.key] ? row[column.key] : row.item;
|
|
205
|
+
if (column.display !== false) {
|
|
206
|
+
return index.h(TableData, { data: value, groupId: this.groupId });
|
|
207
|
+
}
|
|
208
|
+
}), this.actions && this.renderActions(row, index$1))));
|
|
269
209
|
}
|
|
270
210
|
/**
|
|
271
|
-
|
|
272
|
-
* private functions
|
|
273
|
-
*/
|
|
274
|
-
/**
|
|
275
|
-
* render() function
|
|
276
|
-
* Always the last one in the class.
|
|
211
|
+
* Render Methods
|
|
277
212
|
*/
|
|
278
213
|
render() {
|
|
279
|
-
return (index.h(index.Host, {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
214
|
+
return (index.h(index.Host, { class: {
|
|
215
|
+
[`duet-editable-table-${this.variation}`]: true,
|
|
216
|
+
[`duet-editable-table-${this.theme}`]: true,
|
|
217
|
+
// sticky only valid when in regular table layout
|
|
218
|
+
"duet-editable-table-scrollable": this.breakpoint === "none-scrollable",
|
|
219
|
+
"duet-editable-table-sortable": this.sortable,
|
|
220
|
+
"duet-editable-table-actions": !!this.actions,
|
|
221
|
+
"duet-m-0": this.margin === "none",
|
|
222
|
+
"duet-theme-turva": this.theme === "turva",
|
|
223
|
+
} }, index.h("duet-table", { sticky: this.sticky, stickyDistance: this.stickyDistance, margin: this.margin, theme: this.theme, variation: this.variation, breakpoint: this.breakpoint }, index.h("table", { role: this.accessibleRole }, index.h("caption", null, index.h("slot", { name: "tcaption" })), index.h("thead", null, index.h("tr", null, index.h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, index.h("slot", { name: "thead-first" }))), this.renderTableHeader(), index.h("tr", null, index.h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, index.h("slot", { name: "thead-last" })))), index.h("tbody", null, this.renderTableBody()), index.h("tfoot", null, index.h("tr", null, index.h("th", { class: "duet-editable-table-footer-menu", colSpan: 99 }, index.h("slot", { name: "tfoot" }))))))));
|
|
287
224
|
}
|
|
288
|
-
get
|
|
289
|
-
static get watchers() { return {
|
|
290
|
-
"data": ["watchPropHandler"]
|
|
291
|
-
}; }
|
|
225
|
+
get element() { return index.getElement(this); }
|
|
292
226
|
};
|
|
293
|
-
|
|
227
|
+
DuetEditableTable.style = duetEditableTableCss;
|
|
294
228
|
|
|
295
|
-
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}
|
|
229
|
+
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}";
|
|
296
230
|
|
|
297
231
|
// remove wrapping speech marks.
|
|
298
232
|
// media query tokens are wrapped in speech marks,
|
|
@@ -352,9 +286,9 @@ let DuetTable = class {
|
|
|
352
286
|
}
|
|
353
287
|
connectedCallback() {
|
|
354
288
|
this.mq = matchMedia(breakpointToToken[this.breakpoint]);
|
|
355
|
-
this.mq.addEventListener("change", this.handleMediaQueryChange);
|
|
289
|
+
this.mq.addEventListener("change", jsUtils.debounce(this.handleMediaQueryChange, 50));
|
|
356
290
|
this.handleMediaQueryChange(this.mq);
|
|
357
|
-
this.observer = new MutationObserver(() => this.copyHeadingsToCells());
|
|
291
|
+
this.observer = new MutationObserver(() => jsUtils.debounce(this.copyHeadingsToCells(), 50));
|
|
358
292
|
this.observer.observe(this.element, {
|
|
359
293
|
childList: true,
|
|
360
294
|
subtree: true,
|
|
@@ -385,6 +319,9 @@ let DuetTable = class {
|
|
|
385
319
|
this.mq = null;
|
|
386
320
|
this.matchesBreakpoint = true;
|
|
387
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Local methods.
|
|
324
|
+
*/
|
|
388
325
|
copyHeadingsToCells() {
|
|
389
326
|
const headingElements = this.element.querySelectorAll("thead th");
|
|
390
327
|
const rowElements = this.element.querySelectorAll("tbody tr");
|
|
@@ -660,7 +597,7 @@ const validateFile = (item, validators) => {
|
|
|
660
597
|
if (item) {
|
|
661
598
|
const { name, type, size } = item;
|
|
662
599
|
const mime = validateFileMime(type, allowedMimetypes);
|
|
663
|
-
const ext = validateFileExtension(name, allowedExtensions);
|
|
600
|
+
const ext = validateFileExtension(name.toLowerCase(), allowedExtensions);
|
|
664
601
|
const bytes = validateFileSize(size, maxBytes);
|
|
665
602
|
if (!mime) {
|
|
666
603
|
errorMessage = getError("duet-upload-101");
|
|
@@ -740,7 +677,7 @@ const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress })
|
|
|
740
677
|
return xhr;
|
|
741
678
|
};
|
|
742
679
|
|
|
743
|
-
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}";
|
|
680
|
+
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}";
|
|
744
681
|
|
|
745
682
|
let DuetUpload = class {
|
|
746
683
|
constructor(hostRef) {
|
|
@@ -754,25 +691,6 @@ let DuetUpload = class {
|
|
|
754
691
|
this.duetCancel = index.createEvent(this, "duetCancel", 3);
|
|
755
692
|
this.duetProgress = index.createEvent(this, "duetProgress", 3);
|
|
756
693
|
this.duetUpload = index.createEvent(this, "duetUpload", 3);
|
|
757
|
-
/**
|
|
758
|
-
* Own Properties
|
|
759
|
-
*/
|
|
760
|
-
this.buttonId = createId.createID("DuetButton");
|
|
761
|
-
this.labelId = createId.createID("DuetLabel");
|
|
762
|
-
this.uploadId = createId.createID("DuetUpload");
|
|
763
|
-
this.editableTableId = createId.createID("DuetEditableTable");
|
|
764
|
-
this.filesInProgress = new Map();
|
|
765
|
-
this.fileMaxReached = false;
|
|
766
|
-
this.bytesMaxReached = false;
|
|
767
|
-
this.internalStatusMessageLabel = undefined;
|
|
768
|
-
/**
|
|
769
|
-
* Properties
|
|
770
|
-
*/
|
|
771
|
-
this.DefaultGroups = {
|
|
772
|
-
inprogress: "inprogress",
|
|
773
|
-
success: "success",
|
|
774
|
-
failure: "failure",
|
|
775
|
-
};
|
|
776
694
|
/**
|
|
777
695
|
* State() variables
|
|
778
696
|
*/
|
|
@@ -794,8 +712,9 @@ let DuetUpload = class {
|
|
|
794
712
|
{
|
|
795
713
|
icon: "action-delete",
|
|
796
714
|
color: "color-danger",
|
|
797
|
-
|
|
798
|
-
|
|
715
|
+
size: "x-small",
|
|
716
|
+
background: "gray-lightest",
|
|
717
|
+
name: "delete",
|
|
799
718
|
map: ["success", "failure"],
|
|
800
719
|
label: {
|
|
801
720
|
fi: "Poista tiedosto",
|
|
@@ -806,8 +725,9 @@ let DuetUpload = class {
|
|
|
806
725
|
{
|
|
807
726
|
icon: "navigation-close",
|
|
808
727
|
color: "primary",
|
|
809
|
-
|
|
810
|
-
|
|
728
|
+
size: "x-small",
|
|
729
|
+
background: "gray-lightest",
|
|
730
|
+
name: "cancel",
|
|
811
731
|
map: ["inprogress"],
|
|
812
732
|
label: {
|
|
813
733
|
fi: "Keskeytä lähetys",
|
|
@@ -877,8 +797,8 @@ let DuetUpload = class {
|
|
|
877
797
|
inProgressWithErrors: "Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed",
|
|
878
798
|
done: "All {filesTotal} added successfully",
|
|
879
799
|
doneWithErrors: "Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors",
|
|
880
|
-
files: "
|
|
881
|
-
file: "
|
|
800
|
+
files: "File",
|
|
801
|
+
file: "file",
|
|
882
802
|
},
|
|
883
803
|
};
|
|
884
804
|
/**
|
|
@@ -1033,19 +953,72 @@ let DuetUpload = class {
|
|
|
1033
953
|
* by default this is off, setting this to true will limit the users choices to what has been explicitly set
|
|
1034
954
|
*/
|
|
1035
955
|
this.limitSelection = false;
|
|
956
|
+
/**
|
|
957
|
+
* Own Properties
|
|
958
|
+
*/
|
|
959
|
+
this.buttonId = createId.createID("DuetButton");
|
|
960
|
+
this.labelId = createId.createID("DuetLabel");
|
|
961
|
+
this.uploadId = createId.createID("DuetUpload");
|
|
962
|
+
this.filesInProgress = new Map();
|
|
963
|
+
this.fileMaxReached = false;
|
|
964
|
+
this.bytesMaxReached = false;
|
|
965
|
+
this.internalStatusMessageLabel = undefined;
|
|
966
|
+
/**
|
|
967
|
+
* Properties
|
|
968
|
+
*/
|
|
969
|
+
this.DefaultGroups = {
|
|
970
|
+
inprogress: "inprogress",
|
|
971
|
+
success: "success",
|
|
972
|
+
failure: "failure",
|
|
973
|
+
};
|
|
974
|
+
/**
|
|
975
|
+
* Array of group names that you want the editable table to use to display files
|
|
976
|
+
* @required
|
|
977
|
+
* @example [{ id: "success", label: {fi: "Onnistunut", en: "Success", sv: "Alt klart", }}]
|
|
978
|
+
*/
|
|
979
|
+
this.groups = [
|
|
980
|
+
{
|
|
981
|
+
id: this.DefaultGroups.inprogress,
|
|
982
|
+
label: {
|
|
983
|
+
fi: "Kesken olevat tiedostot",
|
|
984
|
+
sv: "Filer inprogress",
|
|
985
|
+
en: "Files inprogress",
|
|
986
|
+
},
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
id: this.DefaultGroups.success,
|
|
990
|
+
label: {
|
|
991
|
+
fi: "Valmiit tiedostot",
|
|
992
|
+
sv: "Files success",
|
|
993
|
+
en: "Files success",
|
|
994
|
+
},
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
id: this.DefaultGroups.failure,
|
|
998
|
+
label: {
|
|
999
|
+
fi: "Tiedostot, joissa on virheitä",
|
|
1000
|
+
sv: "Filer med fel",
|
|
1001
|
+
en: "Files with errors",
|
|
1002
|
+
},
|
|
1003
|
+
},
|
|
1004
|
+
];
|
|
1005
|
+
this.kick = jsUtils.debounce(() => {
|
|
1006
|
+
this.tick = Date.now();
|
|
1007
|
+
}, 30); // will trigger re-render
|
|
1036
1008
|
/**
|
|
1037
1009
|
* Private functions
|
|
1038
1010
|
*/
|
|
1039
1011
|
this.listenForActionEvents = () => {
|
|
1040
|
-
this.element.addEventListener("
|
|
1012
|
+
this.element.addEventListener("duetActionEvent", (e) => {
|
|
1041
1013
|
const detail = e.detail;
|
|
1042
|
-
const { action,
|
|
1014
|
+
const { action, id, originalEvent } = detail;
|
|
1015
|
+
console.log(e);
|
|
1043
1016
|
switch (action) {
|
|
1044
1017
|
case "delete":
|
|
1045
|
-
this.onDelete(
|
|
1018
|
+
this.onDelete(id, originalEvent);
|
|
1046
1019
|
break;
|
|
1047
1020
|
case "cancel":
|
|
1048
|
-
this.onCancel(
|
|
1021
|
+
this.onCancel(id, originalEvent);
|
|
1049
1022
|
break;
|
|
1050
1023
|
// code block
|
|
1051
1024
|
}
|
|
@@ -1102,24 +1075,6 @@ let DuetUpload = class {
|
|
|
1102
1075
|
return "none";
|
|
1103
1076
|
}
|
|
1104
1077
|
};
|
|
1105
|
-
this.convertToDuetEditableTableItems = () => {
|
|
1106
|
-
// we're always recreating the map - in order to force an update down stream.
|
|
1107
|
-
const itemData = new Map();
|
|
1108
|
-
//walk the files Map and convert to DuetEditableTableItemData
|
|
1109
|
-
this.files.forEach((data, key, _originalMap) => {
|
|
1110
|
-
const group = this.getGroupFromItemData(data);
|
|
1111
|
-
const item = this.getItemHTMLFromItemData(data, group);
|
|
1112
|
-
itemData.set(key, {
|
|
1113
|
-
uid: data.uid,
|
|
1114
|
-
item,
|
|
1115
|
-
group,
|
|
1116
|
-
});
|
|
1117
|
-
});
|
|
1118
|
-
return itemData;
|
|
1119
|
-
};
|
|
1120
|
-
this.kick = debounce(() => {
|
|
1121
|
-
this.tick = Date.now();
|
|
1122
|
-
}, 30); // will trigger re-render
|
|
1123
1078
|
this.genHashName = () => Date.now().toString(36) + Math.random();
|
|
1124
1079
|
this.updateValueInMap = (item, key, value, kick = true) => {
|
|
1125
1080
|
const fileItem = this.files.get(item);
|
|
@@ -1180,7 +1135,6 @@ let DuetUpload = class {
|
|
|
1180
1135
|
this.nativeInput.value = "";
|
|
1181
1136
|
};
|
|
1182
1137
|
this.startUpload = async (ev, metaData = undefined) => {
|
|
1183
|
-
await this.setFocus();
|
|
1184
1138
|
this.metaData = metaData;
|
|
1185
1139
|
this.nativeInput.click();
|
|
1186
1140
|
this.onUpload(ev, metaData);
|
|
@@ -1243,9 +1197,18 @@ let DuetUpload = class {
|
|
|
1243
1197
|
fileMaxReached: isTotalFileAmountAboveMax,
|
|
1244
1198
|
};
|
|
1245
1199
|
};
|
|
1200
|
+
this.getItemFromUID = (uid) => {
|
|
1201
|
+
for (const [key, value] of this.files.entries()) {
|
|
1202
|
+
if (value.uid === uid) {
|
|
1203
|
+
return { value, key };
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
return null;
|
|
1207
|
+
};
|
|
1246
1208
|
this.onDelete = (key, ev) => {
|
|
1247
|
-
const
|
|
1248
|
-
this.files.
|
|
1209
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
1210
|
+
const deletedItem = this.files.get(retrievedKey);
|
|
1211
|
+
this.files.delete(retrievedKey);
|
|
1249
1212
|
this.validateTotals();
|
|
1250
1213
|
this.kick();
|
|
1251
1214
|
this.duetDelete.emit({
|
|
@@ -1259,8 +1222,9 @@ let DuetUpload = class {
|
|
|
1259
1222
|
this.resetFormFields();
|
|
1260
1223
|
};
|
|
1261
1224
|
this.onCancel = (key, ev) => {
|
|
1262
|
-
const
|
|
1263
|
-
this.files.
|
|
1225
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
1226
|
+
const cancelledItem = this.files.get(retrievedKey);
|
|
1227
|
+
this.files.delete(retrievedKey);
|
|
1264
1228
|
if (!this.external) {
|
|
1265
1229
|
const { xhr } = cancelledItem;
|
|
1266
1230
|
xhr.abort();
|
|
@@ -1310,6 +1274,79 @@ let DuetUpload = class {
|
|
|
1310
1274
|
data: { files: this.files },
|
|
1311
1275
|
});
|
|
1312
1276
|
};
|
|
1277
|
+
/**
|
|
1278
|
+
* @description This functions return sorted map items byg condition which are:
|
|
1279
|
+
*/
|
|
1280
|
+
this.filterMap = () => {
|
|
1281
|
+
const all = [...this.files.values()];
|
|
1282
|
+
const inprogress = [];
|
|
1283
|
+
const failure = [];
|
|
1284
|
+
const success = [];
|
|
1285
|
+
all.forEach(data => {
|
|
1286
|
+
const group = this.getGroupFromItemData(data);
|
|
1287
|
+
const item = this.getItemHTMLFromItemData(data, group);
|
|
1288
|
+
if (group === this.DefaultGroups.success) {
|
|
1289
|
+
success.push({
|
|
1290
|
+
uid: data.uid,
|
|
1291
|
+
item,
|
|
1292
|
+
group,
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
else if (group === this.DefaultGroups.inprogress) {
|
|
1296
|
+
inprogress.push({
|
|
1297
|
+
uid: data.uid,
|
|
1298
|
+
item,
|
|
1299
|
+
group,
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
else if (group === this.DefaultGroups.failure) {
|
|
1303
|
+
failure.push({
|
|
1304
|
+
uid: data.uid,
|
|
1305
|
+
item,
|
|
1306
|
+
group,
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
else if (data.group) {
|
|
1310
|
+
inprogress.push({
|
|
1311
|
+
uid: data.uid,
|
|
1312
|
+
item,
|
|
1313
|
+
group: data.group,
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
return {
|
|
1318
|
+
inprogress,
|
|
1319
|
+
failure,
|
|
1320
|
+
success,
|
|
1321
|
+
};
|
|
1322
|
+
};
|
|
1323
|
+
this.getColumns = (group) => {
|
|
1324
|
+
return [
|
|
1325
|
+
{
|
|
1326
|
+
sort_order: 1,
|
|
1327
|
+
direction: 1,
|
|
1328
|
+
index: 0,
|
|
1329
|
+
key: group.id,
|
|
1330
|
+
label: group.label,
|
|
1331
|
+
},
|
|
1332
|
+
];
|
|
1333
|
+
};
|
|
1334
|
+
this.getActions = (id) => {
|
|
1335
|
+
return this.actions.filter(item => item.map.includes(id));
|
|
1336
|
+
};
|
|
1337
|
+
this.renderEditableTableGroups = () => {
|
|
1338
|
+
const filteredItems = this.filterMap();
|
|
1339
|
+
const EditableTables = this.groups.map(group => {
|
|
1340
|
+
const currentItems = filteredItems[group.id];
|
|
1341
|
+
if (!(currentItems === null || currentItems === void 0 ? void 0 : currentItems.length)) {
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
return (index.h("duet-table", { variation: "plain", breakpoint: "none", role: "log", margin: this.hideGroups ? "none" : "auto" }, index.h("table", { class: "duet-upload-editable-table" }, index.h("thead", { class: "duet-upload-editable-table-header" }, index.h("tr", null, index.h("th", { class: {
|
|
1345
|
+
"duet-upload-editable-table-header-hidden": this.hideGroups,
|
|
1346
|
+
} }, !this.hideGroups ? (languageUtils.getLocaleString(group.label)) : (index.h("duet-visually-hidden", null, languageUtils.getLocaleString(group.label)))))), index.h("tbody", null, index.h("tr", null, index.h("td", { class: "duet-upload-editable-table-data" }, index.h("duet-editable-table", { breakpoint: "none", variation: "plain", groupId: group.id, columns: this.getColumns(group), actions: this.getActions(group.id), margin: "none", rows: currentItems })))))));
|
|
1347
|
+
});
|
|
1348
|
+
return EditableTables;
|
|
1349
|
+
};
|
|
1313
1350
|
}
|
|
1314
1351
|
watchValidHandler(newValue, oldValue) {
|
|
1315
1352
|
if (newValue !== oldValue) {
|
|
@@ -1333,6 +1370,68 @@ let DuetUpload = class {
|
|
|
1333
1370
|
// listen to the events from the component
|
|
1334
1371
|
this.verifyValidity();
|
|
1335
1372
|
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
1375
|
+
* `input.focus()`.
|
|
1376
|
+
*/
|
|
1377
|
+
async setFocus(options) {
|
|
1378
|
+
if (this.nativeInput) {
|
|
1379
|
+
this.nativeInput.focus(options);
|
|
1380
|
+
}
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Method for invoking the upload sequence
|
|
1385
|
+
*/
|
|
1386
|
+
async upload(metaData = undefined) {
|
|
1387
|
+
await this.setFocus();
|
|
1388
|
+
this.metaData = metaData;
|
|
1389
|
+
this.nativeInput.click();
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
1394
|
+
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
1395
|
+
* the tabular data if the automatic re-render is no sufficient
|
|
1396
|
+
*/
|
|
1397
|
+
async refresh() {
|
|
1398
|
+
this.kick();
|
|
1399
|
+
await this.setFocus();
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Get list of files, divided in errors and valid sections
|
|
1403
|
+
*/
|
|
1404
|
+
async getFiles() {
|
|
1405
|
+
if (!this.files || this.files.size === 0) {
|
|
1406
|
+
return false;
|
|
1407
|
+
}
|
|
1408
|
+
return this.getFilesAsArray();
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
1412
|
+
*/
|
|
1413
|
+
async updateValue(item, key, value) {
|
|
1414
|
+
this.updateValueInMap(item, key, value);
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* render() function
|
|
1418
|
+
* Always the last one in the class.
|
|
1419
|
+
*/
|
|
1420
|
+
render() {
|
|
1421
|
+
const identifier = this.identifier || this.uploadId;
|
|
1422
|
+
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
1423
|
+
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
1424
|
+
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
1425
|
+
return (index.h(index.Host, { class: { "duet-m-0": this.margin === "none" } }, index.h("duet-fieldset", { label: this.label, caption: caption }, index.h("slot", { name: "header" }), !this.files.size && (index.h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
|
|
1426
|
+
"duet-upload-filelist-empty": !this.files.size,
|
|
1427
|
+
"duet-upload-filelist": true,
|
|
1428
|
+
"duet-upload-filelist-filled": this.files.size,
|
|
1429
|
+
}, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && index.h("slot", { name: "fileheader" }), !!this.files.size && (index.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 && index.h("slot", { name: "filefooter" }), index.h("duet-spacer", { size: "large" }), !this.hideButton && (index.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)), index.h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (index.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"))), index.h("duet-spacer", { size: "medium" }), index.h("duet-visually-hidden", null, index.h("input", { ref: input => {
|
|
1430
|
+
this.nativeInput = input;
|
|
1431
|
+
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
1432
|
+
"duet-upload": true,
|
|
1433
|
+
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
1434
|
+
}
|
|
1336
1435
|
/**
|
|
1337
1436
|
* XHR request utilities
|
|
1338
1437
|
*/
|
|
@@ -1454,68 +1553,6 @@ let DuetUpload = class {
|
|
|
1454
1553
|
component: "duet-upload",
|
|
1455
1554
|
});
|
|
1456
1555
|
}
|
|
1457
|
-
/**
|
|
1458
|
-
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
1459
|
-
* `input.focus()`.
|
|
1460
|
-
*/
|
|
1461
|
-
async setFocus(options) {
|
|
1462
|
-
if (this.nativeInput) {
|
|
1463
|
-
this.nativeInput.focus(options);
|
|
1464
|
-
}
|
|
1465
|
-
return;
|
|
1466
|
-
}
|
|
1467
|
-
/**
|
|
1468
|
-
* Method for invoking the upload sequence
|
|
1469
|
-
*/
|
|
1470
|
-
async upload(metaData = undefined) {
|
|
1471
|
-
await this.setFocus();
|
|
1472
|
-
this.metaData = metaData;
|
|
1473
|
-
this.nativeInput.click();
|
|
1474
|
-
return;
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
1478
|
-
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
1479
|
-
* the tabular data if the automatic re-render is no sufficient
|
|
1480
|
-
*/
|
|
1481
|
-
async refresh() {
|
|
1482
|
-
this.kick();
|
|
1483
|
-
await this.setFocus();
|
|
1484
|
-
}
|
|
1485
|
-
/**
|
|
1486
|
-
* Get list of files, divided in errors and valid sections
|
|
1487
|
-
*/
|
|
1488
|
-
async getFiles() {
|
|
1489
|
-
if (!this.files || this.files.size === 0) {
|
|
1490
|
-
return false;
|
|
1491
|
-
}
|
|
1492
|
-
return this.getFilesAsArray();
|
|
1493
|
-
}
|
|
1494
|
-
/**
|
|
1495
|
-
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
1496
|
-
*/
|
|
1497
|
-
async updateValue(item, key, value) {
|
|
1498
|
-
this.updateValueInMap(item, key, value);
|
|
1499
|
-
}
|
|
1500
|
-
/**
|
|
1501
|
-
* render() function
|
|
1502
|
-
* Always the last one in the class.
|
|
1503
|
-
*/
|
|
1504
|
-
render() {
|
|
1505
|
-
const identifier = this.identifier || this.uploadId;
|
|
1506
|
-
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
1507
|
-
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
1508
|
-
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
1509
|
-
return (index.h(index.Host, { class: { "duet-m-0": this.margin === "none" } }, index.h("duet-fieldset", { label: this.label, caption: caption }, index.h("slot", { name: "header" }), !this.files.size && (index.h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
|
|
1510
|
-
"duet-upload-filelist-empty": !this.files.size,
|
|
1511
|
-
"duet-upload-filelist": true,
|
|
1512
|
-
"duet-upload-filelist-filled": this.files.size,
|
|
1513
|
-
}, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && index.h("slot", { name: "fileheader" }), !!this.files.size && (index.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 && (index.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 && index.h("slot", { name: "filefooter" }), index.h("duet-spacer", { size: "large" }), !this.hideButton && (index.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)), index.h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (index.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"))), index.h("duet-spacer", { size: "medium" }), index.h("duet-visually-hidden", null, index.h("input", { ref: input => {
|
|
1514
|
-
this.nativeInput = input;
|
|
1515
|
-
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
1516
|
-
"duet-upload": true,
|
|
1517
|
-
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
1518
|
-
}
|
|
1519
1556
|
get element() { return index.getElement(this); }
|
|
1520
1557
|
static get watchers() { return {
|
|
1521
1558
|
"valid": ["watchValidHandler"]
|
|
@@ -1524,6 +1561,5 @@ let DuetUpload = class {
|
|
|
1524
1561
|
DuetUpload.style = duetUploadCss;
|
|
1525
1562
|
|
|
1526
1563
|
exports.duet_editable_table = DuetEditableTable;
|
|
1527
|
-
exports.duet_editable_table_item = DuetEditableTableItem;
|
|
1528
1564
|
exports.duet_table = DuetTable;
|
|
1529
1565
|
exports.duet_upload = DuetUpload;
|