@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
|
@@ -22,25 +22,6 @@ import { makeXhrRequest } from "./xhr.helpers";
|
|
|
22
22
|
*/
|
|
23
23
|
export class DuetUpload {
|
|
24
24
|
constructor() {
|
|
25
|
-
/**
|
|
26
|
-
* Own Properties
|
|
27
|
-
*/
|
|
28
|
-
this.buttonId = createID("DuetButton");
|
|
29
|
-
this.labelId = createID("DuetLabel");
|
|
30
|
-
this.uploadId = createID("DuetUpload");
|
|
31
|
-
this.editableTableId = createID("DuetEditableTable");
|
|
32
|
-
this.filesInProgress = new Map();
|
|
33
|
-
this.fileMaxReached = false;
|
|
34
|
-
this.bytesMaxReached = false;
|
|
35
|
-
this.internalStatusMessageLabel = undefined;
|
|
36
|
-
/**
|
|
37
|
-
* Properties
|
|
38
|
-
*/
|
|
39
|
-
this.DefaultGroups = {
|
|
40
|
-
inprogress: "inprogress",
|
|
41
|
-
success: "success",
|
|
42
|
-
failure: "failure",
|
|
43
|
-
};
|
|
44
25
|
/**
|
|
45
26
|
* State() variables
|
|
46
27
|
*/
|
|
@@ -62,8 +43,9 @@ export class DuetUpload {
|
|
|
62
43
|
{
|
|
63
44
|
icon: "action-delete",
|
|
64
45
|
color: "color-danger",
|
|
65
|
-
|
|
66
|
-
|
|
46
|
+
size: "x-small",
|
|
47
|
+
background: "gray-lightest",
|
|
48
|
+
name: "delete",
|
|
67
49
|
map: ["success", "failure"],
|
|
68
50
|
label: {
|
|
69
51
|
fi: "Poista tiedosto",
|
|
@@ -74,8 +56,9 @@ export class DuetUpload {
|
|
|
74
56
|
{
|
|
75
57
|
icon: "navigation-close",
|
|
76
58
|
color: "primary",
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
size: "x-small",
|
|
60
|
+
background: "gray-lightest",
|
|
61
|
+
name: "cancel",
|
|
79
62
|
map: ["inprogress"],
|
|
80
63
|
label: {
|
|
81
64
|
fi: "Keskeytä lähetys",
|
|
@@ -145,8 +128,8 @@ export class DuetUpload {
|
|
|
145
128
|
inProgressWithErrors: "Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed",
|
|
146
129
|
done: "All {filesTotal} added successfully",
|
|
147
130
|
doneWithErrors: "Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors",
|
|
148
|
-
files: "
|
|
149
|
-
file: "
|
|
131
|
+
files: "File",
|
|
132
|
+
file: "file",
|
|
150
133
|
},
|
|
151
134
|
};
|
|
152
135
|
/**
|
|
@@ -301,19 +284,72 @@ export class DuetUpload {
|
|
|
301
284
|
* by default this is off, setting this to true will limit the users choices to what has been explicitly set
|
|
302
285
|
*/
|
|
303
286
|
this.limitSelection = false;
|
|
287
|
+
/**
|
|
288
|
+
* Own Properties
|
|
289
|
+
*/
|
|
290
|
+
this.buttonId = createID("DuetButton");
|
|
291
|
+
this.labelId = createID("DuetLabel");
|
|
292
|
+
this.uploadId = createID("DuetUpload");
|
|
293
|
+
this.filesInProgress = new Map();
|
|
294
|
+
this.fileMaxReached = false;
|
|
295
|
+
this.bytesMaxReached = false;
|
|
296
|
+
this.internalStatusMessageLabel = undefined;
|
|
297
|
+
/**
|
|
298
|
+
* Properties
|
|
299
|
+
*/
|
|
300
|
+
this.DefaultGroups = {
|
|
301
|
+
inprogress: "inprogress",
|
|
302
|
+
success: "success",
|
|
303
|
+
failure: "failure",
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* Array of group names that you want the editable table to use to display files
|
|
307
|
+
* @required
|
|
308
|
+
* @example [{ id: "success", label: {fi: "Onnistunut", en: "Success", sv: "Alt klart", }}]
|
|
309
|
+
*/
|
|
310
|
+
this.groups = [
|
|
311
|
+
{
|
|
312
|
+
id: this.DefaultGroups.inprogress,
|
|
313
|
+
label: {
|
|
314
|
+
fi: "Kesken olevat tiedostot",
|
|
315
|
+
sv: "Filer inprogress",
|
|
316
|
+
en: "Files inprogress",
|
|
317
|
+
},
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
id: this.DefaultGroups.success,
|
|
321
|
+
label: {
|
|
322
|
+
fi: "Valmiit tiedostot",
|
|
323
|
+
sv: "Files success",
|
|
324
|
+
en: "Files success",
|
|
325
|
+
},
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
id: this.DefaultGroups.failure,
|
|
329
|
+
label: {
|
|
330
|
+
fi: "Tiedostot, joissa on virheitä",
|
|
331
|
+
sv: "Filer med fel",
|
|
332
|
+
en: "Files with errors",
|
|
333
|
+
},
|
|
334
|
+
},
|
|
335
|
+
];
|
|
336
|
+
this.kick = debounce(() => {
|
|
337
|
+
this.tick = Date.now();
|
|
338
|
+
}, 30); // will trigger re-render
|
|
304
339
|
/**
|
|
305
340
|
* Private functions
|
|
306
341
|
*/
|
|
307
342
|
this.listenForActionEvents = () => {
|
|
308
|
-
this.element.addEventListener("
|
|
343
|
+
this.element.addEventListener("duetActionEvent", (e) => {
|
|
309
344
|
const detail = e.detail;
|
|
310
|
-
const { action,
|
|
345
|
+
const { action, id, originalEvent } = detail;
|
|
346
|
+
console.log(e);
|
|
311
347
|
switch (action) {
|
|
312
348
|
case "delete":
|
|
313
|
-
this.onDelete(
|
|
349
|
+
this.onDelete(id, originalEvent);
|
|
314
350
|
break;
|
|
315
351
|
case "cancel":
|
|
316
|
-
this.onCancel(
|
|
352
|
+
this.onCancel(id, originalEvent);
|
|
317
353
|
break;
|
|
318
354
|
default:
|
|
319
355
|
// code block
|
|
@@ -371,24 +407,6 @@ export class DuetUpload {
|
|
|
371
407
|
return "none";
|
|
372
408
|
}
|
|
373
409
|
};
|
|
374
|
-
this.convertToDuetEditableTableItems = () => {
|
|
375
|
-
// we're always recreating the map - in order to force an update down stream.
|
|
376
|
-
const itemData = new Map();
|
|
377
|
-
//walk the files Map and convert to DuetEditableTableItemData
|
|
378
|
-
this.files.forEach((data, key, _originalMap) => {
|
|
379
|
-
const group = this.getGroupFromItemData(data);
|
|
380
|
-
const item = this.getItemHTMLFromItemData(data, group);
|
|
381
|
-
itemData.set(key, {
|
|
382
|
-
uid: data.uid,
|
|
383
|
-
item,
|
|
384
|
-
group,
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
return itemData;
|
|
388
|
-
};
|
|
389
|
-
this.kick = debounce(() => {
|
|
390
|
-
this.tick = Date.now();
|
|
391
|
-
}, 30); // will trigger re-render
|
|
392
410
|
this.genHashName = () => Date.now().toString(36) + Math.random();
|
|
393
411
|
this.updateValueInMap = (item, key, value, kick = true) => {
|
|
394
412
|
const fileItem = this.files.get(item);
|
|
@@ -449,7 +467,6 @@ export class DuetUpload {
|
|
|
449
467
|
this.nativeInput.value = "";
|
|
450
468
|
};
|
|
451
469
|
this.startUpload = async (ev, metaData = undefined) => {
|
|
452
|
-
await this.setFocus();
|
|
453
470
|
this.metaData = metaData;
|
|
454
471
|
this.nativeInput.click();
|
|
455
472
|
this.onUpload(ev, metaData);
|
|
@@ -512,9 +529,18 @@ export class DuetUpload {
|
|
|
512
529
|
fileMaxReached: isTotalFileAmountAboveMax,
|
|
513
530
|
};
|
|
514
531
|
};
|
|
532
|
+
this.getItemFromUID = (uid) => {
|
|
533
|
+
for (const [key, value] of this.files.entries()) {
|
|
534
|
+
if (value.uid === uid) {
|
|
535
|
+
return { value, key };
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return null;
|
|
539
|
+
};
|
|
515
540
|
this.onDelete = (key, ev) => {
|
|
516
|
-
const
|
|
517
|
-
this.files.
|
|
541
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
542
|
+
const deletedItem = this.files.get(retrievedKey);
|
|
543
|
+
this.files.delete(retrievedKey);
|
|
518
544
|
this.validateTotals();
|
|
519
545
|
this.kick();
|
|
520
546
|
this.duetDelete.emit({
|
|
@@ -528,8 +554,9 @@ export class DuetUpload {
|
|
|
528
554
|
this.resetFormFields();
|
|
529
555
|
};
|
|
530
556
|
this.onCancel = (key, ev) => {
|
|
531
|
-
const
|
|
532
|
-
this.files.
|
|
557
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
558
|
+
const cancelledItem = this.files.get(retrievedKey);
|
|
559
|
+
this.files.delete(retrievedKey);
|
|
533
560
|
if (!this.external) {
|
|
534
561
|
const { xhr } = cancelledItem;
|
|
535
562
|
xhr.abort();
|
|
@@ -579,6 +606,87 @@ export class DuetUpload {
|
|
|
579
606
|
data: { files: this.files },
|
|
580
607
|
});
|
|
581
608
|
};
|
|
609
|
+
/**
|
|
610
|
+
* @description This functions return sorted map items byg condition which are:
|
|
611
|
+
*/
|
|
612
|
+
this.filterMap = () => {
|
|
613
|
+
const all = [...this.files.values()];
|
|
614
|
+
const inprogress = [];
|
|
615
|
+
const failure = [];
|
|
616
|
+
const success = [];
|
|
617
|
+
all.forEach(data => {
|
|
618
|
+
const group = this.getGroupFromItemData(data);
|
|
619
|
+
const item = this.getItemHTMLFromItemData(data, group);
|
|
620
|
+
if (group === this.DefaultGroups.success) {
|
|
621
|
+
success.push({
|
|
622
|
+
uid: data.uid,
|
|
623
|
+
item,
|
|
624
|
+
group,
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
else if (group === this.DefaultGroups.inprogress) {
|
|
628
|
+
inprogress.push({
|
|
629
|
+
uid: data.uid,
|
|
630
|
+
item,
|
|
631
|
+
group,
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
else if (group === this.DefaultGroups.failure) {
|
|
635
|
+
failure.push({
|
|
636
|
+
uid: data.uid,
|
|
637
|
+
item,
|
|
638
|
+
group,
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
else if (data.group) {
|
|
642
|
+
inprogress.push({
|
|
643
|
+
uid: data.uid,
|
|
644
|
+
item,
|
|
645
|
+
group: data.group,
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
});
|
|
649
|
+
return {
|
|
650
|
+
inprogress,
|
|
651
|
+
failure,
|
|
652
|
+
success,
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
this.getColumns = (group) => {
|
|
656
|
+
return [
|
|
657
|
+
{
|
|
658
|
+
sort_order: 1,
|
|
659
|
+
direction: 1,
|
|
660
|
+
index: 0,
|
|
661
|
+
key: group.id,
|
|
662
|
+
label: group.label,
|
|
663
|
+
},
|
|
664
|
+
];
|
|
665
|
+
};
|
|
666
|
+
this.getActions = (id) => {
|
|
667
|
+
return this.actions.filter(item => item.map.includes(id));
|
|
668
|
+
};
|
|
669
|
+
this.renderEditableTableGroups = () => {
|
|
670
|
+
const filteredItems = this.filterMap();
|
|
671
|
+
const EditableTables = this.groups.map(group => {
|
|
672
|
+
const currentItems = filteredItems[group.id];
|
|
673
|
+
if (!(currentItems === null || currentItems === void 0 ? void 0 : currentItems.length)) {
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
return (h("duet-table", { variation: "plain", breakpoint: "none", role: "log", margin: this.hideGroups ? "none" : "auto" },
|
|
677
|
+
h("table", { class: "duet-upload-editable-table" },
|
|
678
|
+
h("thead", { class: "duet-upload-editable-table-header" },
|
|
679
|
+
h("tr", null,
|
|
680
|
+
h("th", { class: {
|
|
681
|
+
"duet-upload-editable-table-header-hidden": this.hideGroups,
|
|
682
|
+
} }, !this.hideGroups ? (getLocaleString(group.label)) : (h("duet-visually-hidden", null, getLocaleString(group.label)))))),
|
|
683
|
+
h("tbody", null,
|
|
684
|
+
h("tr", null,
|
|
685
|
+
h("td", { class: "duet-upload-editable-table-data" },
|
|
686
|
+
h("duet-editable-table", { breakpoint: "none", variation: "plain", groupId: group.id, columns: this.getColumns(group), actions: this.getActions(group.id), margin: "none", rows: currentItems })))))));
|
|
687
|
+
});
|
|
688
|
+
return EditableTables;
|
|
689
|
+
};
|
|
582
690
|
}
|
|
583
691
|
watchValidHandler(newValue, oldValue) {
|
|
584
692
|
if (newValue !== oldValue) {
|
|
@@ -602,6 +710,84 @@ export class DuetUpload {
|
|
|
602
710
|
// listen to the events from the component
|
|
603
711
|
this.verifyValidity();
|
|
604
712
|
}
|
|
713
|
+
/**
|
|
714
|
+
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
715
|
+
* `input.focus()`.
|
|
716
|
+
*/
|
|
717
|
+
async setFocus(options) {
|
|
718
|
+
if (this.nativeInput) {
|
|
719
|
+
this.nativeInput.focus(options);
|
|
720
|
+
}
|
|
721
|
+
return;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Method for invoking the upload sequence
|
|
725
|
+
*/
|
|
726
|
+
async upload(metaData = undefined) {
|
|
727
|
+
await this.setFocus();
|
|
728
|
+
this.metaData = metaData;
|
|
729
|
+
this.nativeInput.click();
|
|
730
|
+
return;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
734
|
+
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
735
|
+
* the tabular data if the automatic re-render is no sufficient
|
|
736
|
+
*/
|
|
737
|
+
async refresh() {
|
|
738
|
+
this.kick();
|
|
739
|
+
await this.setFocus();
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Get list of files, divided in errors and valid sections
|
|
743
|
+
*/
|
|
744
|
+
async getFiles() {
|
|
745
|
+
if (!this.files || this.files.size === 0) {
|
|
746
|
+
return false;
|
|
747
|
+
}
|
|
748
|
+
return this.getFilesAsArray();
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
752
|
+
*/
|
|
753
|
+
async updateValue(item, key, value) {
|
|
754
|
+
this.updateValueInMap(item, key, value);
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* render() function
|
|
758
|
+
* Always the last one in the class.
|
|
759
|
+
*/
|
|
760
|
+
render() {
|
|
761
|
+
const identifier = this.identifier || this.uploadId;
|
|
762
|
+
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
763
|
+
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
764
|
+
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
765
|
+
return (h(Host, { class: { "duet-m-0": this.margin === "none" } },
|
|
766
|
+
h("duet-fieldset", { label: this.label, caption: caption },
|
|
767
|
+
h("slot", { name: "header" }),
|
|
768
|
+
!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: {
|
|
769
|
+
"duet-upload-filelist-empty": !this.files.size,
|
|
770
|
+
"duet-upload-filelist": true,
|
|
771
|
+
"duet-upload-filelist-filled": this.files.size,
|
|
772
|
+
}, id: this.labelId, for: identifier }, this.fileListEmpty)),
|
|
773
|
+
!!this.files.size && h("slot", { name: "fileheader" }),
|
|
774
|
+
!!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 })),
|
|
775
|
+
!!this.files.size && this.renderEditableTableGroups(),
|
|
776
|
+
!!this.files.size && h("slot", { name: "filefooter" }),
|
|
777
|
+
h("duet-spacer", { size: "large" }),
|
|
778
|
+
!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)),
|
|
779
|
+
h("duet-spacer", { size: "medium" }),
|
|
780
|
+
(this.fileMaxReached || this.bytesMaxReached) && (h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" },
|
|
781
|
+
this.fileMaxReached && getI18nError("duet-upload-301"),
|
|
782
|
+
this.bytesMaxReached && getI18nError("duet-upload-202"))),
|
|
783
|
+
h("duet-spacer", { size: "medium" }),
|
|
784
|
+
h("duet-visually-hidden", null,
|
|
785
|
+
h("input", { ref: input => {
|
|
786
|
+
this.nativeInput = input;
|
|
787
|
+
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
788
|
+
"duet-upload": true,
|
|
789
|
+
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
790
|
+
}
|
|
605
791
|
/**
|
|
606
792
|
* XHR request utilities
|
|
607
793
|
*/
|
|
@@ -723,84 +909,6 @@ export class DuetUpload {
|
|
|
723
909
|
component: "duet-upload",
|
|
724
910
|
});
|
|
725
911
|
}
|
|
726
|
-
/**
|
|
727
|
-
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
728
|
-
* `input.focus()`.
|
|
729
|
-
*/
|
|
730
|
-
async setFocus(options) {
|
|
731
|
-
if (this.nativeInput) {
|
|
732
|
-
this.nativeInput.focus(options);
|
|
733
|
-
}
|
|
734
|
-
return;
|
|
735
|
-
}
|
|
736
|
-
/**
|
|
737
|
-
* Method for invoking the upload sequence
|
|
738
|
-
*/
|
|
739
|
-
async upload(metaData = undefined) {
|
|
740
|
-
await this.setFocus();
|
|
741
|
-
this.metaData = metaData;
|
|
742
|
-
this.nativeInput.click();
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
/**
|
|
746
|
-
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
747
|
-
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
748
|
-
* the tabular data if the automatic re-render is no sufficient
|
|
749
|
-
*/
|
|
750
|
-
async refresh() {
|
|
751
|
-
this.kick();
|
|
752
|
-
await this.setFocus();
|
|
753
|
-
}
|
|
754
|
-
/**
|
|
755
|
-
* Get list of files, divided in errors and valid sections
|
|
756
|
-
*/
|
|
757
|
-
async getFiles() {
|
|
758
|
-
if (!this.files || this.files.size === 0) {
|
|
759
|
-
return false;
|
|
760
|
-
}
|
|
761
|
-
return this.getFilesAsArray();
|
|
762
|
-
}
|
|
763
|
-
/**
|
|
764
|
-
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
765
|
-
*/
|
|
766
|
-
async updateValue(item, key, value) {
|
|
767
|
-
this.updateValueInMap(item, key, value);
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* render() function
|
|
771
|
-
* Always the last one in the class.
|
|
772
|
-
*/
|
|
773
|
-
render() {
|
|
774
|
-
const identifier = this.identifier || this.uploadId;
|
|
775
|
-
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
776
|
-
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
777
|
-
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
778
|
-
return (h(Host, { class: { "duet-m-0": this.margin === "none" } },
|
|
779
|
-
h("duet-fieldset", { label: this.label, caption: caption },
|
|
780
|
-
h("slot", { name: "header" }),
|
|
781
|
-
!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: {
|
|
782
|
-
"duet-upload-filelist-empty": !this.files.size,
|
|
783
|
-
"duet-upload-filelist": true,
|
|
784
|
-
"duet-upload-filelist-filled": this.files.size,
|
|
785
|
-
}, id: this.labelId, for: identifier }, this.fileListEmpty)),
|
|
786
|
-
!!this.files.size && h("slot", { name: "fileheader" }),
|
|
787
|
-
!!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 })),
|
|
788
|
-
!!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() })),
|
|
789
|
-
!!this.files.size && h("slot", { name: "filefooter" }),
|
|
790
|
-
h("duet-spacer", { size: "large" }),
|
|
791
|
-
!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)),
|
|
792
|
-
h("duet-spacer", { size: "medium" }),
|
|
793
|
-
(this.fileMaxReached || this.bytesMaxReached) && (h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" },
|
|
794
|
-
this.fileMaxReached && getI18nError("duet-upload-301"),
|
|
795
|
-
this.bytesMaxReached && getI18nError("duet-upload-202"))),
|
|
796
|
-
h("duet-spacer", { size: "medium" }),
|
|
797
|
-
h("duet-visually-hidden", null,
|
|
798
|
-
h("input", { ref: input => {
|
|
799
|
-
this.nativeInput = input;
|
|
800
|
-
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
801
|
-
"duet-upload": true,
|
|
802
|
-
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
803
|
-
}
|
|
804
912
|
static get is() { return "duet-upload"; }
|
|
805
913
|
static get encapsulation() { return "shadow"; }
|
|
806
914
|
static get originalStyleUrls() { return {
|
|
@@ -915,15 +1023,15 @@ export class DuetUpload {
|
|
|
915
1023
|
"defaultValue": "false"
|
|
916
1024
|
},
|
|
917
1025
|
"actions": {
|
|
918
|
-
"type": "
|
|
1026
|
+
"type": "unknown",
|
|
919
1027
|
"mutable": false,
|
|
920
1028
|
"complexType": {
|
|
921
|
-
"original": "DuetEditableTableActions
|
|
922
|
-
"resolved": "
|
|
1029
|
+
"original": "DuetEditableTableActions",
|
|
1030
|
+
"resolved": "{ icon: string; color: string; background: string; size: DuetActionButtonIconSize; name: string; map?: string[]; label?: DuetLangObject; }[]",
|
|
923
1031
|
"references": {
|
|
924
1032
|
"DuetEditableTableActions": {
|
|
925
1033
|
"location": "import",
|
|
926
|
-
"path": "../duet-editable-table/duet-editable-table
|
|
1034
|
+
"path": "../duet-editable-table/duet-editable-table"
|
|
927
1035
|
}
|
|
928
1036
|
}
|
|
929
1037
|
},
|
|
@@ -933,9 +1041,7 @@ export class DuetUpload {
|
|
|
933
1041
|
"tags": [],
|
|
934
1042
|
"text": "Default actions added to the internally used duet-editable-table"
|
|
935
1043
|
},
|
|
936
|
-
"
|
|
937
|
-
"reflect": false,
|
|
938
|
-
"defaultValue": "[\n {\n icon: \"action-delete\",\n color: \"color-danger\",\n color_hover: \"primary-dark\",\n id: \"delete\",\n map: [\"success\", \"failure\"],\n label: {\n fi: \"Poista tiedosto\",\n en: \"Poista tiedosto\",\n sv: \"Ta bort filen\",\n },\n },\n {\n icon: \"navigation-close\",\n color: \"primary\",\n color_hover: \"primary-dark\",\n id: \"cancel\",\n map: [\"inprogress\"],\n label: {\n fi: \"Keskeyt\u00E4 l\u00E4hetys\",\n en: \"Cancel the upload\",\n sv: \"Stop \u00F6verf\u00F6ringen\",\n },\n },\n ]"
|
|
1044
|
+
"defaultValue": "[\n {\n icon: \"action-delete\",\n color: \"color-danger\",\n size: \"x-small\",\n background: \"gray-lightest\",\n name: \"delete\",\n map: [\"success\", \"failure\"],\n label: {\n fi: \"Poista tiedosto\",\n en: \"Poista tiedosto\",\n sv: \"Ta bort filen\",\n },\n },\n {\n icon: \"navigation-close\",\n color: \"primary\",\n size: \"x-small\",\n background: \"gray-lightest\",\n name: \"cancel\",\n map: [\"inprogress\"],\n label: {\n fi: \"Keskeyt\u00E4 l\u00E4hetys\",\n en: \"Cancel the upload\",\n sv: \"Stop \u00F6verf\u00F6ringen\",\n },\n },\n ]"
|
|
939
1045
|
},
|
|
940
1046
|
"uri": {
|
|
941
1047
|
"type": "string",
|
|
@@ -1013,7 +1119,7 @@ export class DuetUpload {
|
|
|
1013
1119
|
},
|
|
1014
1120
|
"attribute": "status-label-default",
|
|
1015
1121
|
"reflect": false,
|
|
1016
|
-
"defaultValue": "{\n fi: {\n inProgress: \"L\u00E4hetet\u00E4\u00E4n {filesUploaded} l\u00E4hetett\u00E4v\u00E4st\u00E4 {filesTotal} tiedostosta\",\n inProgressWithErrors:\n \"L\u00E4hetet\u00E4\u00E4n {filesInProgress} tiedostoa, l\u00E4hetetty {filesUploaded} l\u00E4hetett\u00E4v\u00E4st\u00E4 {filesTotal} tiedostosta, {filesWithErrors} tiedostossa on virheit\u00E4\",\n done: \"Kaikki {filesTotal} tiedostoa l\u00E4hetetty onnistuneesti\",\n doneWithErrors:\n \"L\u00E4hetys valmis, {filesUploaded} tiedostoa on l\u00E4hetetty onnistuneesti, {filesWithErrors} tiedostossa oli virheit\u00E4\",\n files: \"tiedostot\",\n file: \"tiedosto\",\n },\n sv: {\n inProgress: \"Adding {filesUploaded} of {filesTotal}\",\n inProgressWithErrors:\n \"Laddar upp {filesInProgress}, {filesUploaded} uppladdad av {filesTotal}, {filesWithErrors} misslyckades\",\n done: \"Alla {filesTotal} har lagts till\",\n doneWithErrors: \"Handling slutf\u00F6rd, {filesUploaded} har lagts till, {filesWithErrors} misslyckades\",\n files: \"filer\",\n file: \"fil\",\n },\n en: {\n inProgress: \"Adding {filesUploaded} of {filesTotal}\",\n inProgressWithErrors:\n \"Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed\",\n done: \"All {filesTotal} added successfully\",\n doneWithErrors: \"Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors\",\n files: \"
|
|
1122
|
+
"defaultValue": "{\n fi: {\n inProgress: \"L\u00E4hetet\u00E4\u00E4n {filesUploaded} l\u00E4hetett\u00E4v\u00E4st\u00E4 {filesTotal} tiedostosta\",\n inProgressWithErrors:\n \"L\u00E4hetet\u00E4\u00E4n {filesInProgress} tiedostoa, l\u00E4hetetty {filesUploaded} l\u00E4hetett\u00E4v\u00E4st\u00E4 {filesTotal} tiedostosta, {filesWithErrors} tiedostossa on virheit\u00E4\",\n done: \"Kaikki {filesTotal} tiedostoa l\u00E4hetetty onnistuneesti\",\n doneWithErrors:\n \"L\u00E4hetys valmis, {filesUploaded} tiedostoa on l\u00E4hetetty onnistuneesti, {filesWithErrors} tiedostossa oli virheit\u00E4\",\n files: \"tiedostot\",\n file: \"tiedosto\",\n },\n sv: {\n inProgress: \"Adding {filesUploaded} of {filesTotal}\",\n inProgressWithErrors:\n \"Laddar upp {filesInProgress}, {filesUploaded} uppladdad av {filesTotal}, {filesWithErrors} misslyckades\",\n done: \"Alla {filesTotal} har lagts till\",\n doneWithErrors: \"Handling slutf\u00F6rd, {filesUploaded} har lagts till, {filesWithErrors} misslyckades\",\n files: \"filer\",\n file: \"fil\",\n },\n en: {\n inProgress: \"Adding {filesUploaded} of {filesTotal}\",\n inProgressWithErrors:\n \"Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed\",\n done: \"All {filesTotal} added successfully\",\n doneWithErrors: \"Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors\",\n files: \"File\",\n file: \"file\",\n },\n }"
|
|
1017
1123
|
},
|
|
1018
1124
|
"statusMessageLabel": {
|
|
1019
1125
|
"type": "string",
|
|
@@ -1202,34 +1308,6 @@ export class DuetUpload {
|
|
|
1202
1308
|
"reflect": false,
|
|
1203
1309
|
"defaultValue": "false"
|
|
1204
1310
|
},
|
|
1205
|
-
"groups": {
|
|
1206
|
-
"type": "string",
|
|
1207
|
-
"mutable": false,
|
|
1208
|
-
"complexType": {
|
|
1209
|
-
"original": "DuetEditableTableGroupNames | string",
|
|
1210
|
-
"resolved": "string | { id: string; label: DuetLangObject; actionLabel?: DuetLangObject; }[]",
|
|
1211
|
-
"references": {
|
|
1212
|
-
"DuetEditableTableGroupNames": {
|
|
1213
|
-
"location": "import",
|
|
1214
|
-
"path": "../duet-editable-table/duet-editable-table"
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
},
|
|
1218
|
-
"required": false,
|
|
1219
|
-
"optional": false,
|
|
1220
|
-
"docs": {
|
|
1221
|
-
"tags": [{
|
|
1222
|
-
"name": "required",
|
|
1223
|
-
"text": undefined
|
|
1224
|
-
}, {
|
|
1225
|
-
"name": "example",
|
|
1226
|
-
"text": "[{ id: \"success\", label: {fi: \"Onnistunut\", en: \"Success\", sv: \"Alt klart\", }}]"
|
|
1227
|
-
}],
|
|
1228
|
-
"text": "Array of group names that you want the editable table to use to display files"
|
|
1229
|
-
},
|
|
1230
|
-
"attribute": "groups",
|
|
1231
|
-
"reflect": false
|
|
1232
|
-
},
|
|
1233
1311
|
"alignment": {
|
|
1234
1312
|
"type": "string",
|
|
1235
1313
|
"mutable": false,
|
|
@@ -1628,6 +1706,32 @@ export class DuetUpload {
|
|
|
1628
1706
|
},
|
|
1629
1707
|
"attribute": "value",
|
|
1630
1708
|
"reflect": false
|
|
1709
|
+
},
|
|
1710
|
+
"groups": {
|
|
1711
|
+
"type": "unknown",
|
|
1712
|
+
"mutable": false,
|
|
1713
|
+
"complexType": {
|
|
1714
|
+
"original": "DuetUploadTableGroupName[]",
|
|
1715
|
+
"resolved": "DuetUploadTableGroupName[]",
|
|
1716
|
+
"references": {
|
|
1717
|
+
"DuetUploadTableGroupName": {
|
|
1718
|
+
"location": "local"
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
},
|
|
1722
|
+
"required": false,
|
|
1723
|
+
"optional": false,
|
|
1724
|
+
"docs": {
|
|
1725
|
+
"tags": [{
|
|
1726
|
+
"name": "required",
|
|
1727
|
+
"text": undefined
|
|
1728
|
+
}, {
|
|
1729
|
+
"name": "example",
|
|
1730
|
+
"text": "[{ id: \"success\", label: {fi: \"Onnistunut\", en: \"Success\", sv: \"Alt klart\", }}]"
|
|
1731
|
+
}],
|
|
1732
|
+
"text": "Array of group names that you want the editable table to use to display files"
|
|
1733
|
+
},
|
|
1734
|
+
"defaultValue": "[\n {\n id: this.DefaultGroups.inprogress,\n label: {\n fi: \"Kesken olevat tiedostot\",\n sv: \"Filer inprogress\",\n en: \"Files inprogress\",\n },\n },\n {\n id: this.DefaultGroups.success,\n label: {\n fi: \"Valmiit tiedostot\",\n sv: \"Files success\",\n en: \"Files success\",\n },\n },\n {\n id: this.DefaultGroups.failure,\n label: {\n fi: \"Tiedostot, joissa on virheit\u00E4\",\n sv: \"Filer med fel\",\n en: \"Files with errors\",\n },\n },\n ]"
|
|
1631
1735
|
}
|
|
1632
1736
|
}; }
|
|
1633
1737
|
static get states() { return {
|
|
@@ -40,7 +40,7 @@ export const validateFile = (item, validators) => {
|
|
|
40
40
|
if (item) {
|
|
41
41
|
const { name, type, size } = item;
|
|
42
42
|
const mime = validateFileMime(type, allowedMimetypes);
|
|
43
|
-
const ext = validateFileExtension(name, allowedExtensions);
|
|
43
|
+
const ext = validateFileExtension(name.toLowerCase(), allowedExtensions);
|
|
44
44
|
const bytes = validateFileSize(size, maxBytes);
|
|
45
45
|
if (!mime) {
|
|
46
46
|
errorMessage = getError("duet-upload-101");
|
|
@@ -28,7 +28,7 @@ function getAllFixturesFiles(dirPath, fixPath = "fixtures", skipFixture = []) {
|
|
|
28
28
|
})
|
|
29
29
|
.forEach(parsed => {
|
|
30
30
|
const fixtureName = parsed.name.replace(`${component}_`, "");
|
|
31
|
-
const fixtureHtml = fs.readFileSync(path.join(parsed.dir, parsed.base), "utf8")
|
|
31
|
+
const fixtureHtml = `<span id="fixture">${fs.readFileSync(path.join(parsed.dir, parsed.base), "utf8")}</fixture>`;
|
|
32
32
|
fixtures[fixtureName] = fixtureHtml;
|
|
33
33
|
});
|
|
34
34
|
return {
|
|
@@ -99,14 +99,12 @@ export const fixtureTests = (componentFixtures, minHeight) => {
|
|
|
99
99
|
const html = componentFixtures.fixtures[fixtureName];
|
|
100
100
|
it(`${fixtureName} renders correctly with Turva theme`, async () => {
|
|
101
101
|
const page = await createPage(htmlFragment(html, "turva", minHeight));
|
|
102
|
-
|
|
103
|
-
await page.setDefaultNavigationTimeout(0);
|
|
102
|
+
await page.find("#fixture");
|
|
104
103
|
expect(await page.screenshot()).toMatchImageSnapshot();
|
|
105
104
|
});
|
|
106
105
|
it(`${fixtureName} renders correctly with Lahitapiola theme`, async () => {
|
|
107
106
|
const page = await createPage(htmlFragment(html, "default", minHeight));
|
|
108
|
-
|
|
109
|
-
await page.setDefaultNavigationTimeout(0);
|
|
107
|
+
await page.find("#fixture");
|
|
110
108
|
expect(await page.screenshot()).toMatchImageSnapshot();
|
|
111
109
|
});
|
|
112
110
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
-
export const debounce = (func, timeout =
|
|
4
|
+
export const debounce = (func, timeout = 250) => {
|
|
5
5
|
let timer;
|
|
6
6
|
return (...args) => {
|
|
7
7
|
clearTimeout(timer);
|
|
@@ -10,3 +10,38 @@ export const debounce = (func, timeout = 50) => {
|
|
|
10
10
|
}, timeout);
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
|
+
export function fieldSorter(fields) {
|
|
14
|
+
return function (a, b) {
|
|
15
|
+
return fields
|
|
16
|
+
.map(function (o) {
|
|
17
|
+
let dir = 1;
|
|
18
|
+
if (o[0] === "-") {
|
|
19
|
+
dir = -1;
|
|
20
|
+
o = o.substring(1);
|
|
21
|
+
}
|
|
22
|
+
if (a[o] > b[o]) {
|
|
23
|
+
return dir;
|
|
24
|
+
}
|
|
25
|
+
if (a[o] < b[o]) {
|
|
26
|
+
return -dir;
|
|
27
|
+
}
|
|
28
|
+
return 0;
|
|
29
|
+
})
|
|
30
|
+
.reduce(function firstNonZeroValue(p, n) {
|
|
31
|
+
return p ? p : n;
|
|
32
|
+
}, 0);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export const memoize = fn => {
|
|
36
|
+
const cache = {};
|
|
37
|
+
return value => {
|
|
38
|
+
if (value in cache) {
|
|
39
|
+
return cache[value];
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const result = fn(value);
|
|
43
|
+
cache[value] = result;
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
};
|
|
@@ -5,10 +5,14 @@ export const isArrowLeftKey = (e) => e.keyCode === 37;
|
|
|
5
5
|
export const isArrowUpKey = (e) => e.keyCode === 38;
|
|
6
6
|
export const isArrowRightKey = (e) => e.keyCode === 39;
|
|
7
7
|
export const isArrowDownKey = (e) => e.keyCode === 40;
|
|
8
|
+
export const isArrowKey = (e) => isArrowDownKey(e) || isArrowRightKey(e) || isArrowUpKey(e) || isArrowLeftKey(e);
|
|
8
9
|
export const isEscapeKey = (e) => e.key === "Escape" || e.key === "Esc" || e.keyCode === 27;
|
|
9
10
|
export const isTabKey = (e) => e.key === "Tab" || e.keyCode === 9;
|
|
10
11
|
export const isBackspaceKey = (e) => e.keyCode === 8;
|
|
11
12
|
export const isSpaceKey = (e) => e.key === "Space" || e.keyCode === 32;
|
|
13
|
+
export const isPlusKey = (e) => e.key === "+" || e.keyCode === 43;
|
|
14
|
+
export const isMinusKey = (e) => e.key === "-" || e.keyCode === 45;
|
|
12
15
|
export const isQuestionKey = (e) => e.key === "?";
|
|
13
16
|
export const isEnterKey = (e) => e.key === "Enter" || e.keyCode === 13;
|
|
14
17
|
export const isKeyboardClick = (e) => isEnterKey(e) || isSpaceKey(e);
|
|
18
|
+
export const isNumber = (e) => (e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105);
|