@duetds/components 4.36.0 → 5.0.1
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 +1143 -983
- 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 +8 -4
- package/lib/cjs/duet-caption_4.cjs.entry.js +3 -3
- package/lib/cjs/duet-card.cjs.entry.js +3 -3
- package/lib/cjs/duet-checkbox.cjs.entry.js +1 -1
- package/lib/cjs/duet-choice_2.cjs.entry.js +4 -4
- package/lib/cjs/duet-collapsible.cjs.entry.js +3 -3
- 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 -337
- 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 +7 -7
- 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 +2 -2
- package/lib/cjs/duet-notification_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-number-input.cjs.entry.js +1 -1
- package/lib/cjs/duet-pagination_2.cjs.entry.js +24 -14
- 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 +2 -2
- package/lib/cjs/duet-select.cjs.entry.js +1 -1
- package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
- 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-675b1aa3.js → focus-utils-1051dbe3.js} +1 -1
- package/lib/cjs/{index-58eb8f67.js → index-db0781a3.js} +1 -1
- package/lib/cjs/js-utils-be1d29ae.js +39 -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 +14 -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.js +23 -1
- package/lib/collection/components/duet-choice/duet-choice.css +20 -15
- package/lib/collection/components/duet-choice/duet-choice.js +10 -8
- 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-header/duet-header.css +5 -1
- package/lib/collection/components/duet-header/duet-header.js +4 -3
- package/lib/collection/components/duet-pagination/duet-pagination.css +3 -62
- package/lib/collection/components/duet-pagination/duet-pagination.js +49 -19
- package/lib/collection/components/duet-range-stepper/duet-range-stepper.css +4 -55
- package/lib/collection/components/duet-range-stepper/duet-range-stepper.js +2 -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 -1
- package/lib/collection/utils/js-utils.js +36 -1
- package/lib/collection/utils/token-utils.js +33 -6
- package/lib/custom-elements-bundle/index.d.ts +6 -12
- package/lib/custom-elements-bundle/index.js +1159 -1015
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/p-038f5a76.js +4 -0
- package/lib/duet/{p-aa5abb52.system.entry.js → p-077e9821.system.entry.js} +1 -1
- package/lib/duet/{p-9358e24b.entry.js → p-08f1713b.entry.js} +1 -1
- package/lib/duet/{p-6aa8d848.entry.js → p-0cf96c98.entry.js} +1 -1
- package/lib/duet/p-0ff56acb.system.entry.js +4 -0
- package/lib/duet/p-13302cc8.entry.js +4 -0
- package/lib/duet/{p-a0f979a4.entry.js → p-1630296b.entry.js} +1 -1
- package/lib/duet/{p-818cd527.entry.js → p-1acbc962.entry.js} +1 -1
- package/lib/duet/{p-1afe9641.system.entry.js → p-20dd2c3c.system.entry.js} +1 -1
- package/lib/duet/{p-85d9b1b0.system.js → p-21ab96c0.system.js} +1 -1
- package/lib/duet/{p-e67fc1ed.system.entry.js → p-222c74a9.system.entry.js} +1 -1
- package/lib/duet/{p-5e410fa9.system.entry.js → p-242ba82c.system.entry.js} +1 -1
- package/lib/duet/{p-40360b4a.system.entry.js → p-25fdd6d2.system.entry.js} +1 -1
- package/lib/duet/{p-ddb6344c.system.js → p-268c0abb.system.js} +0 -0
- package/lib/duet/{p-a2db8ff2.system.entry.js → p-26c5cc5a.system.entry.js} +1 -1
- package/lib/duet/{p-4b688aea.entry.js → p-2772bbb1.entry.js} +1 -1
- package/lib/duet/{p-bf25e52a.entry.js → p-28e4253c.entry.js} +1 -1
- package/lib/duet/{p-6df7b78c.entry.js → p-3018d431.entry.js} +1 -1
- package/lib/duet/{p-ad8a49a3.system.entry.js → p-347ffc22.system.entry.js} +1 -1
- package/lib/duet/{p-e9ca7e01.entry.js → p-3651b695.entry.js} +1 -1
- package/lib/duet/{p-4f32cc18.system.entry.js → p-3946058c.system.entry.js} +1 -1
- package/lib/duet/p-3d5a497d.system.entry.js +4 -0
- package/lib/duet/{p-8c0fd5de.js → p-3eed1432.js} +1 -1
- package/lib/duet/{p-44a3794d.system.entry.js → p-41246296.system.entry.js} +1 -1
- package/lib/duet/{p-314b64b4.system.entry.js → p-43204695.system.entry.js} +1 -1
- package/lib/duet/{p-daede773.entry.js → p-440a9c95.entry.js} +1 -1
- package/lib/duet/{p-8b8c2ef4.entry.js → p-44bb7ac8.entry.js} +1 -1
- package/lib/duet/{p-b42066e0.entry.js → p-489d1777.entry.js} +1 -1
- package/lib/duet/{p-2a9345a7.entry.js → p-48cdb48a.entry.js} +1 -1
- package/lib/duet/{p-e584ce1d.entry.js → p-4b72d87e.entry.js} +1 -1
- package/lib/duet/{p-99a112e4.entry.js → p-4be7b036.entry.js} +1 -1
- package/lib/duet/{p-ac44ab7a.entry.js → p-4d300ede.entry.js} +1 -1
- package/lib/duet/{p-8a768d0b.entry.js → p-569ee410.entry.js} +1 -1
- package/lib/duet/{p-84940fc4.system.entry.js → p-56f472b3.system.entry.js} +1 -1
- package/lib/duet/p-5746d88c.js +4 -0
- package/lib/duet/{p-90799d0a.entry.js → p-5a69aed5.entry.js} +1 -1
- package/lib/duet/{p-8db453bf.system.js → p-5cc4b13d.system.js} +1 -1
- package/lib/duet/{p-8706664b.system.entry.js → p-63b70e9d.system.entry.js} +1 -1
- package/lib/duet/p-63c8a2cd.system.entry.js +4 -0
- package/lib/duet/p-6abdc336.entry.js +4 -0
- package/lib/duet/p-6ba556ad.entry.js +4 -0
- package/lib/duet/{p-f993e4c3.system.entry.js → p-6c27e55c.system.entry.js} +1 -1
- package/lib/duet/{p-7730d2b8.entry.js → p-6d3485e0.entry.js} +1 -1
- package/lib/duet/{p-a75776f5.entry.js → p-6f2aec60.entry.js} +1 -1
- package/lib/duet/p-75640b15.entry.js +4 -0
- package/lib/duet/{p-21cd146b.system.entry.js → p-7769f3af.system.entry.js} +1 -1
- package/lib/duet/p-77acbfe4.system.js +4 -0
- package/lib/duet/{p-ad06c91d.system.entry.js → p-7a8cea36.system.entry.js} +1 -1
- package/lib/duet/{p-fa99eaa4.system.js → p-812b0905.system.js} +0 -0
- package/lib/duet/{p-ae82d8e7.entry.js → p-815e5588.entry.js} +1 -1
- package/lib/duet/p-823501e1.system.entry.js +4 -0
- package/lib/duet/p-8e83c0ea.system.entry.js +4 -0
- package/lib/duet/p-92639d0b.system.js +4 -0
- package/lib/duet/{p-22e6615d.system.entry.js → p-93302e3a.system.entry.js} +1 -1
- package/lib/duet/{p-6e6e1b77.system.entry.js → p-94bc746c.system.entry.js} +1 -1
- package/lib/duet/{p-09920da9.entry.js → p-9716f92a.entry.js} +1 -1
- package/lib/duet/{p-9ead1c59.entry.js → p-9a535dd9.entry.js} +1 -1
- package/lib/duet/{p-78779ba1.system.entry.js → p-9cf9c233.system.entry.js} +1 -1
- package/lib/duet/{p-c0a24b5e.system.entry.js → p-a853c03b.system.entry.js} +2 -2
- package/lib/duet/{p-ea124391.system.entry.js → p-ab651bab.system.entry.js} +1 -1
- package/lib/duet/{p-fb55e381.system.entry.js → p-b1d3ee06.system.entry.js} +1 -1
- package/lib/duet/p-b4a3ee75.entry.js +4 -0
- package/lib/duet/{p-b5aaf161.entry.js → p-b4eb216b.entry.js} +1 -1
- package/lib/duet/p-baf1b7ec.system.entry.js +4 -0
- package/lib/duet/{p-7f1cbb7d.entry.js → p-bfd81bd7.entry.js} +1 -1
- package/lib/duet/{p-80aa512a.system.entry.js → p-c0f57d75.system.entry.js} +1 -1
- package/lib/duet/{p-dda7f098.entry.js → p-c3342f8e.entry.js} +1 -1
- package/lib/duet/{p-aebf6700.entry.js → p-ca7fd033.entry.js} +1 -1
- package/lib/duet/{p-0769de2b.system.entry.js → p-cac113fe.system.entry.js} +1 -1
- package/lib/duet/p-cb701a9c.entry.js +4 -0
- package/lib/duet/{p-0349b691.system.entry.js → p-d214b9b2.system.entry.js} +1 -1
- package/lib/duet/{p-b11f2fcd.system.entry.js → p-d2b946cd.system.entry.js} +1 -1
- package/lib/duet/{p-5f4362b4.entry.js → p-d3169bff.entry.js} +1 -1
- package/lib/duet/{p-b6b58d31.entry.js → p-d57ac853.entry.js} +1 -1
- package/lib/duet/{p-59480299.system.entry.js → p-d7263055.system.entry.js} +1 -1
- package/lib/duet/{p-c167a5aa.system.entry.js → p-d7ad9b74.system.entry.js} +1 -1
- package/lib/duet/{p-8143f3de.js → p-d7bc0102.js} +0 -0
- package/lib/duet/{p-d444e178.system.entry.js → p-d81e9ca0.system.entry.js} +1 -1
- package/lib/duet/{p-878c1c83.system.entry.js → p-d8f83ac5.system.entry.js} +1 -1
- package/lib/duet/{p-84a9fbf4.system.entry.js → p-da76095f.system.entry.js} +1 -1
- package/lib/duet/p-dbb4a588.js +4 -0
- package/lib/duet/{p-a8f707d4.system.entry.js → p-e1920232.system.entry.js} +2 -2
- package/lib/duet/{p-1c1c9705.entry.js → p-e4c6b105.entry.js} +1 -1
- package/lib/duet/{p-663aec3a.entry.js → p-e5531f4f.entry.js} +1 -1
- package/lib/duet/p-ea293f60.entry.js +4 -0
- package/lib/duet/{p-95f71b43.system.entry.js → p-eb39b494.system.entry.js} +1 -1
- package/lib/duet/{p-ad07f399.js → p-ed75c8b3.js} +0 -0
- package/lib/duet/{p-fd561872.system.entry.js → p-f20b487a.system.entry.js} +1 -1
- package/lib/duet/{p-1aeb418c.entry.js → p-f7d7ec47.entry.js} +1 -1
- package/lib/duet/p-fa02e479.entry.js +4 -0
- package/lib/duet/p-faf60d2a.entry.js +4 -0
- package/lib/duet/{p-28a22555.system.entry.js → p-fb8ed18e.system.entry.js} +1 -1
- package/lib/duet/p-fea2cbc5.system.js +4 -0
- package/lib/duet/{p-c61ace58.system.entry.js → p-ff3d551a.system.entry.js} +1 -1
- package/lib/duet/{p-bd602c98.entry.js → p-ff7ab8cb.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 +8 -4
- package/lib/esm/duet-caption_4.entry.js +3 -3
- package/lib/esm/duet-card.entry.js +3 -3
- package/lib/esm/duet-checkbox.entry.js +1 -1
- package/lib/esm/duet-choice_2.entry.js +4 -4
- package/lib/esm/duet-collapsible.entry.js +3 -3
- 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 -338
- 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 +7 -7
- 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 +2 -2
- package/lib/esm/duet-notification_2.entry.js +1 -1
- package/lib/esm/duet-number-input.entry.js +1 -1
- package/lib/esm/duet-pagination_2.entry.js +24 -14
- 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 +2 -2
- package/lib/esm/duet-select.entry.js +1 -1
- package/lib/esm/duet-step_2.entry.js +1 -1
- 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-bd3c1702.js → focus-utils-f49312fd.js} +1 -1
- package/lib/esm/{index-49b2d31a.js → index-9526901a.js} +1 -1
- package/lib/esm/js-utils-52e0944c.js +36 -0
- 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 +2 -2
- 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 +1 -1
- 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-bd3c1702.js → focus-utils-f49312fd.js} +1 -1
- package/lib/esm-es5/{index-49b2d31a.js → index-9526901a.js} +1 -1
- package/lib/esm-es5/js-utils-52e0944c.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 +4 -0
- 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-header/duet-header.d.ts +1 -0
- package/lib/types/components/duet-pagination/duet-pagination.d.ts +7 -2
- 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 +225 -149
- package/lib/types/utils/js-utils.d.ts +2 -0
- package/lib/types/utils/token-utils.d.ts +2 -0
- package/package.json +4 -5
- package/lib/cjs/duet-editable-table-button.cjs.entry.js +0 -96
- package/lib/cjs/js-utils-33a9dbe3.js +0 -16
- 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-1b56e483.system.entry.js +0 -4
- package/lib/duet/p-298a9ffc.system.js +0 -4
- package/lib/duet/p-363abf26.system.entry.js +0 -4
- package/lib/duet/p-3c13a041.entry.js +0 -4
- package/lib/duet/p-50b4fb2c.js +0 -4
- package/lib/duet/p-6da8743f.system.entry.js +0 -4
- package/lib/duet/p-72ce134a.entry.js +0 -4
- package/lib/duet/p-78aa974b.system.entry.js +0 -4
- package/lib/duet/p-7e2c06d0.js +0 -4
- package/lib/duet/p-81867417.system.js +0 -4
- package/lib/duet/p-8f56fd3f.entry.js +0 -4
- package/lib/duet/p-8fa952df.entry.js +0 -4
- package/lib/duet/p-9782946f.entry.js +0 -4
- package/lib/duet/p-995f20fc.entry.js +0 -4
- package/lib/duet/p-a154a0c0.entry.js +0 -4
- package/lib/duet/p-a16a58c1.system.js +0 -4
- package/lib/duet/p-abcbdef5.entry.js +0 -4
- package/lib/duet/p-b25d3769.js +0 -4
- package/lib/duet/p-c5db93a7.system.entry.js +0 -4
- package/lib/duet/p-d32b240d.system.entry.js +0 -4
- package/lib/duet/p-fc02d8e9.entry.js +0 -4
- package/lib/esm/duet-editable-table-button.entry.js +0 -92
- package/lib/esm/js-utils-b69f17df.js +0 -14
- 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/js-utils-b69f17df.js +0 -4
- package/lib/esm-es5/token-utils-75f78ca4.js +0 -4
- package/lib/types/components/duet-editable-table/duet-editable-table-button.d.ts +0 -73
- package/lib/types/components/duet-editable-table/duet-editable-table-item.d.ts +0 -76
|
@@ -1,285 +1,228 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Built with Duet Design System
|
|
3
3
|
*/
|
|
4
|
-
import { r as registerInstance,
|
|
5
|
-
import { d as debounce } from './js-utils-
|
|
6
|
-
import {
|
|
4
|
+
import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-9526901a.js';
|
|
5
|
+
import { f as fieldSorter, d as debounce } from './js-utils-52e0944c.js';
|
|
6
|
+
import { i as isKeyboardClick } from './keyboard-utils-6eb55cd5.js';
|
|
7
|
+
import { g as getLocaleString, s as sanitizeString } from './language-utils-344d894c.js';
|
|
7
8
|
import { i as inheritGlobalTheme } from './themeable-component-572685dd.js';
|
|
8
|
-
import { m as mediaQueryMedium, h as mediaQueryLarge, i as mediaQueryXLarge, j as mediaQueryXxLarge, k as mediaQueryXxxLarge, l as mediaQuerySmall, n as sizeNavigation, s as sizeHeader } from './tokens.module-
|
|
9
|
+
import { m as mediaQueryMedium, h as mediaQueryLarge, i as mediaQueryXLarge, j as mediaQueryXxLarge, k as mediaQueryXxxLarge, l as mediaQuerySmall, n as sizeNavigation, s as sizeHeader } from './tokens.module-a13e9683.js';
|
|
9
10
|
import { c as createID } from './create-id-981107da.js';
|
|
10
11
|
import './string-utils-2f1793b8.js';
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*
|
|
18
|
-
* console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'}));
|
|
19
|
-
* // Logs 'Bryan is now the king of Scotland!'
|
|
20
|
-
*/
|
|
21
|
-
const generateTemplateFn = (function () {
|
|
22
|
-
const cache = {};
|
|
23
|
-
function generateTemplate(template) {
|
|
24
|
-
if (typeof template !== "string") {
|
|
25
|
-
template = template.outerHTML;
|
|
26
|
-
}
|
|
27
|
-
let fn = cache[template];
|
|
28
|
-
if (!fn) {
|
|
29
|
-
// Replace ${expressions} (etc) with ${map.expressions}.
|
|
30
|
-
const sanitized = template
|
|
31
|
-
.replace(/\$\{([\s]*[^;\s\{]+[\s]*)\}/g, function (_, match) {
|
|
32
|
-
return `\$\{map.${match.trim()}\}`;
|
|
33
|
-
})
|
|
34
|
-
// Afterwards, replace anything that's not ${map.expressions}' (etc) with a blank string.
|
|
35
|
-
.replace(/(\$\{(?!map\.)[^}]+\})/g, "");
|
|
36
|
-
fn = Function("map", `return \`${sanitized}\``);
|
|
37
|
-
}
|
|
38
|
-
return fn;
|
|
13
|
+
//simple functional component that renders the data in the table
|
|
14
|
+
const TableData = ({ data, groupId, alignment }, _children) => {
|
|
15
|
+
const classNames = `duet-editable-table duet-editable-table-content-${groupId}`;
|
|
16
|
+
if (typeof data === "string") {
|
|
17
|
+
return h("td", { innerHTML: data, class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } });
|
|
39
18
|
}
|
|
40
|
-
|
|
41
|
-
})
|
|
19
|
+
else {
|
|
20
|
+
return (h("td", { class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } }, data));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
42
23
|
|
|
43
|
-
const duetEditableTableCss = "duet-editable-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-editable-table-header tr .duet-editable-table-header-hidden{padding:0 !important;font-size:0;border-bottom:0}";
|
|
24
|
+
const duetEditableTableCss = ".sc-duet-editable-table-h{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-editable-table-actions-menu.sc-duet-editable-table{position:relative;padding:0 !important;margin:0}.duet-editable-table-actions-menu-button.sc-duet-editable-table{position:relative;right:-16px;float:right;padding:0}.duet-editable-table-actions-menu-icon.sc-duet-editable-table .duet-icon.sc-duet-editable-table{max-width:16px;max-height:16px}.duet-editable-table-row.duet-table-action-row.sc-duet-editable-table .duet-text-right.sc-duet-editable-table{text-align:right}.duet-editable-table-header.sc-duet-editable-table tr.sc-duet-editable-table .duet-editable-table-header-hidden.sc-duet-editable-table{padding:0 !important;font-size:0;border-bottom:0}";
|
|
44
25
|
|
|
45
26
|
let DuetEditableTable = class {
|
|
46
27
|
constructor(hostRef) {
|
|
47
28
|
registerInstance(this, hostRef);
|
|
48
|
-
this.
|
|
29
|
+
this.duetTableToggle = createEvent(this, "duetTableToggle", 7);
|
|
30
|
+
this.duetMenuClick = createEvent(this, "duetMenuClick", 7);
|
|
49
31
|
/**
|
|
50
|
-
*
|
|
51
|
-
* @internal
|
|
32
|
+
* Duet-table: margin of the component.
|
|
52
33
|
*/
|
|
53
|
-
this.
|
|
34
|
+
this.margin = "auto";
|
|
54
35
|
/**
|
|
55
|
-
*
|
|
36
|
+
* Duet-table: Style variation of the table.
|
|
56
37
|
*/
|
|
57
|
-
this.
|
|
38
|
+
this.variation = "striped";
|
|
58
39
|
/**
|
|
59
|
-
*
|
|
40
|
+
* Duet-table: Controls whether the table has a sticky header.
|
|
41
|
+
* Sticky headers are not compatible with breakpoint="none-scrollable".
|
|
60
42
|
*/
|
|
61
|
-
this.
|
|
43
|
+
this.sticky = false;
|
|
62
44
|
/**
|
|
63
|
-
*
|
|
45
|
+
* Duet-table: Adjust the distance from top of the viewport (in pixels) when the
|
|
46
|
+
* table header becomes sticky.
|
|
64
47
|
*/
|
|
65
|
-
this.
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
48
|
+
this.stickyDistance = "with-links";
|
|
49
|
+
/**
|
|
50
|
+
* Duet-table: By default the table is responsive - it will be flattened at narrow viewport widths.
|
|
51
|
+
* This prop controls the breakpoint at which the table should be rendered as a _regular_ table.
|
|
52
|
+
* Set to "none" to disable the responsive functionality.
|
|
53
|
+
* Set to "none-scrollable" to disable responsive functionality _and_ allow horizontal scrolling -
|
|
54
|
+
* this is useful for comparison tables where it's important to maintain column and row layout.
|
|
55
|
+
*/
|
|
56
|
+
this.breakpoint = "small";
|
|
70
57
|
/**
|
|
71
|
-
*
|
|
58
|
+
* Define actions for all items in a table
|
|
59
|
+
* An alternative to inline HTML table.
|
|
60
|
+
* required for Sortable tables
|
|
61
|
+
* @default undefined
|
|
72
62
|
*/
|
|
73
|
-
this.
|
|
74
|
-
fi: "Toiminnot",
|
|
75
|
-
en: "Actions",
|
|
76
|
-
sv: "Handlingar",
|
|
77
|
-
};
|
|
63
|
+
this.actions = undefined;
|
|
78
64
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
65
|
+
* Define columns for a table
|
|
66
|
+
* An alternative to inline HTML table.
|
|
67
|
+
* required for Sortable tables
|
|
68
|
+
* @default undefined
|
|
82
69
|
*/
|
|
83
|
-
this.
|
|
84
|
-
{ id: "all", label: this.groupsLabelDefaults, actionLabel: this.actionLabelDefaults },
|
|
85
|
-
];
|
|
70
|
+
this.columns = undefined;
|
|
86
71
|
/**
|
|
87
|
-
*
|
|
72
|
+
* Define rows for a table
|
|
73
|
+
* An alternative to inline HTML table.
|
|
74
|
+
* required for Sortable tables
|
|
88
75
|
* @default undefined
|
|
89
|
-
* @example [{
|
|
90
|
-
variation: "default",
|
|
91
|
-
icon: "action-edit-2",
|
|
92
|
-
id: "edit",
|
|
93
|
-
map: ["success"],
|
|
94
|
-
label: {
|
|
95
|
-
fi: " Label",
|
|
96
|
-
en: " Label",
|
|
97
|
-
sv: " Label",
|
|
98
|
-
}
|
|
99
|
-
}]
|
|
100
76
|
*/
|
|
101
|
-
this.
|
|
77
|
+
this.rows = undefined;
|
|
102
78
|
/**
|
|
103
|
-
*
|
|
79
|
+
* Controls whether the table is sortable by headers
|
|
104
80
|
*/
|
|
105
|
-
this.
|
|
81
|
+
this.sortable = false;
|
|
106
82
|
/**
|
|
107
|
-
*
|
|
83
|
+
* Optional id that get passed to the table and used to setup ::parts
|
|
108
84
|
*/
|
|
109
|
-
this.
|
|
85
|
+
this.groupId = "";
|
|
110
86
|
/**
|
|
111
87
|
* Theme of the table.
|
|
112
88
|
*/
|
|
113
89
|
this.theme = "";
|
|
114
90
|
/**
|
|
115
|
-
*
|
|
91
|
+
* Exposes the aria role for optimizing accessibility.
|
|
116
92
|
*/
|
|
117
|
-
this.
|
|
118
|
-
|
|
119
|
-
|
|
93
|
+
this.accessibleRole = undefined;
|
|
94
|
+
this.sortableDefaultLabel = {
|
|
95
|
+
fi: "Järjestä",
|
|
96
|
+
en: "Click to sort",
|
|
97
|
+
sv: "Klicka för att sortera",
|
|
98
|
+
};
|
|
99
|
+
this.actionColumnLabel = {
|
|
100
|
+
en: "Actions for rows",
|
|
101
|
+
fi: "Toiminnot rivillä",
|
|
102
|
+
sv: "Åtgärder för rader",
|
|
103
|
+
};
|
|
120
104
|
/**
|
|
121
|
-
*
|
|
105
|
+
* Private methods.
|
|
122
106
|
*/
|
|
123
|
-
this.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
const { item, group, uid } = data;
|
|
135
|
-
if (this.template) {
|
|
136
|
-
return {
|
|
137
|
-
group,
|
|
138
|
-
uid,
|
|
139
|
-
item: this.template(item),
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
return { item, group, uid };
|
|
107
|
+
this.toggleColumn = (column, e) => {
|
|
108
|
+
e.preventDefault();
|
|
109
|
+
const { sort_order, direction, index, key } = column;
|
|
110
|
+
this.duetTableToggle.emit({
|
|
111
|
+
sort_order,
|
|
112
|
+
index,
|
|
113
|
+
direction,
|
|
114
|
+
key,
|
|
115
|
+
component: "duet-editable-table",
|
|
116
|
+
originalEvent: e,
|
|
117
|
+
});
|
|
143
118
|
};
|
|
144
|
-
this.
|
|
145
|
-
if (
|
|
146
|
-
|
|
119
|
+
this.handleKeyDown = (column, e) => {
|
|
120
|
+
if (isKeyboardClick(e)) {
|
|
121
|
+
this.toggleColumn(column, e);
|
|
147
122
|
}
|
|
148
|
-
return Array.from(this.items).filter(item => needle === item[1].group);
|
|
149
123
|
};
|
|
150
124
|
}
|
|
151
125
|
/**
|
|
152
126
|
* Component lifecycle events.
|
|
153
127
|
*/
|
|
154
128
|
componentWillLoad() {
|
|
155
|
-
// look for a <template> region in the duet-editable-table
|
|
156
|
-
this.template = this.getTemplate();
|
|
157
|
-
// take care of the case where groups and actions are defined as html properties instead of javascript objects
|
|
158
|
-
if (typeof this.groups === "string") {
|
|
159
|
-
this.internalGroupArray = sanitizeString(this.groups);
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
this.internalGroupArray = this.groups;
|
|
163
|
-
}
|
|
164
|
-
if (typeof this.actions === "string") {
|
|
165
|
-
this.internalActionsArray = sanitizeString(this.actions);
|
|
166
|
-
}
|
|
167
|
-
else {
|
|
168
|
-
this.internalActionsArray = this.actions;
|
|
169
|
-
}
|
|
170
129
|
inheritGlobalTheme(this);
|
|
171
130
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const currentGroup = this.filterMap(group.id);
|
|
185
|
-
if (!currentGroup.length) {
|
|
186
|
-
return;
|
|
131
|
+
createLabel(column) {
|
|
132
|
+
const { sort_order, direction, index, label } = column;
|
|
133
|
+
const i18nLabel = getLocaleString(label);
|
|
134
|
+
if (!this.sortable) {
|
|
135
|
+
return i18nLabel;
|
|
136
|
+
}
|
|
137
|
+
const getButtonIcon = () => {
|
|
138
|
+
// "action-subtract-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-subtract-small.svg
|
|
139
|
+
// "action-arrow-down-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-down-small.svg
|
|
140
|
+
// "action-arrow-up-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-up-small.svg
|
|
141
|
+
if (!!sort_order && direction === 1) {
|
|
142
|
+
return "action-arrow-down-small";
|
|
187
143
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
: getLocaleString(this.actionLabelDefaults))))), h("tbody", null, currentGroup.map(dataAsArray => {
|
|
195
|
-
const [key, value] = dataAsArray;
|
|
196
|
-
return (h("duet-editable-table-item", { theme: this.theme, keyName: key, data: this.getItemData(value), groupId: group.id, part: group.id, alignment: this.alignment, actions: this.internalActionsArray }));
|
|
197
|
-
})))));
|
|
198
|
-
})));
|
|
144
|
+
else if (!!sort_order && direction === -1) {
|
|
145
|
+
return "action-arrow-up-small";
|
|
146
|
+
}
|
|
147
|
+
return "action-subtract-small";
|
|
148
|
+
};
|
|
149
|
+
return (h("span", { class: "duet-table-label", "data-index": index }, h("duet-button", { size: "small", icon: getButtonIcon(), "icon-size": "medium-small", "accessible-label": getLocaleString(this.sortableDefaultLabel), variation: "plain", margin: "none", "icon-right": true, onClick: event => this.toggleColumn(column, event), onKeyDown: event => this.handleKeyDown(column, event) }, i18nLabel)));
|
|
199
150
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
//simple functional component that renders the data in the table
|
|
205
|
-
const TableData = ({ data, groupId, alignment }, _children) => {
|
|
206
|
-
if (typeof data === "string") {
|
|
207
|
-
return (h("td", { innerHTML: data, class: "duet-editable-table-content", part: `${groupId}content`, style: { verticalAlign: alignment } }));
|
|
151
|
+
getSortedColumns() {
|
|
152
|
+
//create a new array from sort instead of mutating original
|
|
153
|
+
return [...this.columns].sort(fieldSorter(["index"]));
|
|
208
154
|
}
|
|
209
|
-
|
|
210
|
-
|
|
155
|
+
getRowSortOrder() {
|
|
156
|
+
//create a new array from sort instead of mutating original
|
|
157
|
+
const fields = [...this.columns].sort(fieldSorter(["sort_order"]));
|
|
158
|
+
//return only key from objects that have sort_order
|
|
159
|
+
return fields
|
|
160
|
+
.filter(column => column.sort_order)
|
|
161
|
+
.map(column => {
|
|
162
|
+
// add - in-front of descending direction (required by field-sorter)
|
|
163
|
+
return column.direction === -1 ? `-${column.key}` : column.key;
|
|
164
|
+
});
|
|
211
165
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
this.theme = "";
|
|
225
|
-
/**
|
|
226
|
-
* Actions that can be performed on the element
|
|
227
|
-
*/
|
|
228
|
-
this.actions = undefined;
|
|
229
|
-
/**
|
|
230
|
-
* GroupId used to pierce the shadowdom - gets concatenated with "content & actions" and used as part="groupIDcontent/actions" to pierce the content/Action item
|
|
231
|
-
* @internal
|
|
232
|
-
*/
|
|
233
|
-
this.groupId = "";
|
|
234
|
-
/**
|
|
235
|
-
* Key used to set vertical alignment of action buttons
|
|
236
|
-
*/
|
|
237
|
-
this.alignment = "middle";
|
|
238
|
-
/**
|
|
239
|
-
* Key used to identify item, when running actions
|
|
240
|
-
*/
|
|
241
|
-
this.keyName = "";
|
|
242
|
-
/**
|
|
243
|
-
* Object of data itemsused to render the entire row
|
|
244
|
-
*/
|
|
245
|
-
this.data = undefined;
|
|
166
|
+
renderTableHeader() {
|
|
167
|
+
if (!this.columns) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const sortedColumns = this.getSortedColumns();
|
|
171
|
+
return (h("tr", { class: {
|
|
172
|
+
"duet-table-action-header": !!this.actions,
|
|
173
|
+
} }, sortedColumns.map(column => {
|
|
174
|
+
if (column.display !== false) {
|
|
175
|
+
return h("th", { scope: "col" }, this.createLabel(column));
|
|
176
|
+
}
|
|
177
|
+
}), this.actions && (h("th", { scope: "col", class: "duet-table-action-header-heading" }, this.actions && h("duet-visually-hidden", null, getLocaleString(this.actionColumnLabel))))));
|
|
246
178
|
}
|
|
247
|
-
|
|
248
|
-
//
|
|
179
|
+
renderActions(rowItem, index) {
|
|
180
|
+
// escape early
|
|
181
|
+
if (!this.actions) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
// iterate through actions and add them in the sidebar
|
|
185
|
+
return (h("td", { class: "duet-text-right" }, this.actions.map(actionItem => {
|
|
186
|
+
return (h("duet-action-button", { actionMeta: Object.assign({}, (rowItem === null || rowItem === void 0 ? void 0 : rowItem.meta) || {}, { index }), actionId: (rowItem === null || rowItem === void 0 ? void 0 : rowItem.uid) || (rowItem === null || rowItem === void 0 ? void 0 : rowItem.id) || null, actionName: actionItem.name, theme: this.theme, iconName: actionItem.icon, iconColor: actionItem.color, iconSize: actionItem.size, background: actionItem.background }));
|
|
187
|
+
})));
|
|
249
188
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
189
|
+
renderTableBody() {
|
|
190
|
+
const columns = this.getSortedColumns();
|
|
191
|
+
const rowSortOrder = this.getRowSortOrder();
|
|
192
|
+
const sortedRows = [...this.rows].sort(fieldSorter(rowSortOrder));
|
|
193
|
+
// return a tbody with rows for each item in sortedRows
|
|
194
|
+
return sortedRows.map((row, index) => (h("tr", { class: {
|
|
195
|
+
"duet-table-action-row": !!this.actions,
|
|
196
|
+
"duet-editable-table-row": true,
|
|
197
|
+
[`duet-editable-table-row-${this.groupId}`]: true,
|
|
198
|
+
}, "data-meta": JSON.stringify(row.meta) }, columns.map(column => {
|
|
199
|
+
//if we don't have any data for this column, try getting an item instead (for backwards compatibility
|
|
200
|
+
const value = row[column.key] ? row[column.key] : row.item;
|
|
201
|
+
if (column.display !== false) {
|
|
202
|
+
return h(TableData, { data: value, groupId: this.groupId });
|
|
203
|
+
}
|
|
204
|
+
}), this.actions && this.renderActions(row, index))));
|
|
256
205
|
}
|
|
257
206
|
/**
|
|
258
|
-
|
|
259
|
-
* private functions
|
|
260
|
-
*/
|
|
261
|
-
/**
|
|
262
|
-
* render() function
|
|
263
|
-
* Always the last one in the class.
|
|
207
|
+
* Render Methods
|
|
264
208
|
*/
|
|
265
209
|
render() {
|
|
266
|
-
return (h(Host, {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
210
|
+
return (h(Host, { class: {
|
|
211
|
+
[`duet-editable-table-${this.variation}`]: true,
|
|
212
|
+
[`duet-editable-table-${this.theme}`]: true,
|
|
213
|
+
// sticky only valid when in regular table layout
|
|
214
|
+
"duet-editable-table-scrollable": this.breakpoint === "none-scrollable",
|
|
215
|
+
"duet-editable-table-sortable": this.sortable,
|
|
216
|
+
"duet-editable-table-actions": !!this.actions,
|
|
217
|
+
"duet-m-0": this.margin === "none",
|
|
218
|
+
"duet-theme-turva": this.theme === "turva",
|
|
219
|
+
} }, h("duet-table", { sticky: this.sticky, stickyDistance: this.stickyDistance, margin: this.margin, theme: this.theme, variation: this.variation, breakpoint: this.breakpoint }, h("table", { role: this.accessibleRole }, h("caption", null, h("slot", { name: "tcaption" })), h("thead", null, h("tr", null, h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, h("slot", { name: "thead-first" }))), this.renderTableHeader(), h("tr", null, h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, h("slot", { name: "thead-last" })))), h("tbody", null, this.renderTableBody()), h("tfoot", null, h("tr", null, h("th", { class: "duet-editable-table-footer-menu", colSpan: 99 }, h("slot", { name: "tfoot" }))))))));
|
|
274
220
|
}
|
|
275
|
-
get
|
|
276
|
-
static get watchers() { return {
|
|
277
|
-
"data": ["watchPropHandler"]
|
|
278
|
-
}; }
|
|
221
|
+
get element() { return getElement(this); }
|
|
279
222
|
};
|
|
280
|
-
|
|
223
|
+
DuetEditableTable.style = duetEditableTableCss;
|
|
281
224
|
|
|
282
|
-
const duetTableCss = "duet-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-bottom:20px !important;display:block;font-variant-numeric:tabular-nums}duet-table table,duet-table thead,duet-table tbody,duet-table tfoot,duet-table th,duet-table td,duet-table tr{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}duet-table.duet-m-0{margin:0 !important}duet-table table{width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;text-align:left;border-spacing:0;border-collapse:separate}duet-table.duet-theme-turva table{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}duet-table td{-webkit-hyphens:auto;hyphens:auto;color:#00294d}duet-table.duet-theme-turva td{color:#171c3a}duet-table th{font-weight:600;line-height:1.25;color:#657787;text-align:left}duet-table.duet-theme-turva th{color:#747475}duet-table tbody th{font-weight:600;color:#00294d}duet-table.duet-theme-turva tbody th{color:#171c3a}
|
|
225
|
+
const duetTableCss = "duet-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-bottom:20px !important;display:block;font-variant-numeric:tabular-nums}duet-table table,duet-table thead,duet-table tbody,duet-table tfoot,duet-table th,duet-table td,duet-table tr{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}duet-table.duet-m-0{margin:0 !important}duet-table table{width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;text-align:left;border-spacing:0;border-collapse:separate}duet-table.duet-theme-turva table{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}duet-table td{-webkit-hyphens:auto;hyphens:auto;color:#00294d}duet-table.duet-theme-turva td{color:#171c3a}duet-table th{font-weight:600;line-height:1.25;color:#657787;text-align:left}duet-table.duet-theme-turva th{color:#747475}duet-table tbody th{font-weight:600;color:#00294d}duet-table.duet-theme-turva tbody th{color:#171c3a}duet-table .duet-table-action-row td:last-child{justify-self:end;padding-right:20px !important;white-space:nowrap}.duet-table-flattened tbody tr{display:grid;grid-template-columns:repeat(2, 1fr);grid-auto-rows:auto;gap:10px}.duet-table-flattened tbody tr.duet-table-action-row td:last-child::before{padding:0;content:\"\"}.duet-table-flattened thead tr{position:absolute !important;top:0;width:1px !important;height:1px !important;padding:0 !important;overflow:hidden !important;clip:rect(1px, 1px, 1px, 1px) !important;border:0 !important}.duet-table-flattened td{grid-column:1/2;line-height:1.25}.duet-table-flattened td:not(:last-child){margin-bottom:16px !important}.duet-table-flattened td:first-child{grid-row:1;grid-column:1}.duet-table-flattened td:last-child{grid-row:1;grid-column:2}.duet-table-flattened tbody td,.duet-table-flattened tbody th,.duet-table-flattened tfoot td{padding:0 !important;text-align:left !important}.duet-table-flattened tbody th{font-weight:600;line-height:1.25;color:#657787;text-align:left}.duet-table-flattened td[data-heading]::before{margin-bottom:4px !important;display:block;font-size:1rem;font-weight:600;color:#00294d;content:attr(data-heading)}.duet-table-flattened.duet-theme-turva td[data-heading]::before{color:#171c3a}.duet-table-sticky thead th{position:sticky;top:0;background:white}.duet-table-striped td,.duet-table-striped th{padding:20px !important}@media (max-width: 35.9375em){.duet-table-striped td,.duet-table-striped th{padding:20px 12px !important}}.duet-table-striped tbody th{background:white}.duet-table-striped.duet-table-sticky thead th{border-bottom:1px solid #e1e3e6}.duet-table-striped.duet-table-sticky.duet-theme-turva thead th{border-bottom-color:#e4e4e6}.duet-table-striped tbody:not(:first-of-type) th{padding-top:40px !important}.duet-table-striped tbody:only-of-type tr:nth-of-type(odd){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:only-of-type tr:nth-of-type(odd){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tfoot td{border-top:1px solid #e1e3e6}.duet-table-striped.duet-theme-turva tfoot td{border-top-color:#e4e4e6}.duet-table-striped.duet-table-flattened tbody:not(:first-of-type) th{padding-top:20px !important}.duet-table-striped.duet-table-flattened tr{padding:20px !important}.duet-table-striped.duet-table-flattened tfoot td{border-top:0}.duet-table-striped.duet-table-flattened tfoot tr{border-top:1px solid #e1e3e6}.duet-table-striped.duet-table-flattened.duet-theme-turva tfoot tr{border-top-color:#e4e4e6}.duet-table-fixed th,.duet-table-minimal th,.duet-table-plain th{padding:16px !important;border-bottom:1px solid #657787}.duet-table-fixed th:first-child,.duet-table-minimal th:first-child,.duet-table-plain th:first-child{padding-left:0 !important}.duet-table-fixed th:last-child,.duet-table-minimal th:last-child,.duet-table-plain th:last-child{padding-right:0 !important}.duet-theme-turva.duet-table-fixed th,.duet-theme-turva.duet-table-minimal th,.duet-theme-turva.duet-table-plain th{border-bottom-color:#444445}.duet-table-fixed tbody th,.duet-table-minimal tbody th,.duet-table-plain tbody th{padding-top:40px !important;border-bottom-color:#e1e3e6}.duet-theme-turva.duet-table-fixed tbody th,.duet-theme-turva.duet-table-minimal tbody th,.duet-theme-turva.duet-table-plain tbody th{border-bottom-color:#e4e4e6}.duet-table-fixed td,.duet-table-minimal td,.duet-table-plain td{padding:16px !important}.duet-table-fixed td:first-child,.duet-table-minimal td:first-child,.duet-table-plain td:first-child{padding-left:0 !important}.duet-table-fixed td:last-child,.duet-table-minimal td:last-child,.duet-table-plain td:last-child{padding-right:0 !important}.duet-table-fixed tbody td,.duet-table-minimal tbody td,.duet-table-plain tbody td{border-bottom:1px solid #e1e3e6}.duet-theme-turva.duet-table-fixed tbody td,.duet-theme-turva.duet-table-minimal tbody td,.duet-theme-turva.duet-table-plain tbody td{border-bottom-color:#e4e4e6}.duet-table-flattened.duet-table-fixed tbody:first-of-type th,.duet-table-flattened.duet-table-minimal tbody:first-of-type th,.duet-table-flattened.duet-table-plain tbody:first-of-type th{padding-top:0 !important}.duet-table-flattened.duet-table-fixed td,.duet-table-flattened.duet-table-minimal td,.duet-table-flattened.duet-table-plain td,.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{border-bottom:0}.duet-table-flattened.duet-table-fixed tr,.duet-table-flattened.duet-table-minimal tr,.duet-table-flattened.duet-table-plain tr{padding:20px 0 !important}.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{padding-top:20px !important}.duet-table-flattened.duet-table-fixed tfoot td,.duet-table-flattened.duet-table-minimal tfoot td,.duet-table-flattened.duet-table-plain tfoot td{margin-bottom:4px !important}.duet-table-flattened.duet-table-fixed tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-minimal tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-plain tbody:not(:only-of-type) tr:first-child{border-bottom:0}.duet-table-plain.duet-table-flattened tbody tr{border-bottom:1px solid #e1e3e6}.duet-table-plain.duet-table-flattened.duet-theme-turva tbody tr{border-bottom-color:#e4e4e6}.duet-table-minimal tbody tr,.duet-table-minimal tbody tr td{vertical-align:top;border-bottom:0 none}.duet-table-minimal tbody tr:last-of-type,.duet-table-minimal tbody tr:last-of-type td{border-bottom:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened tbody tr,.duet-table-minimal.duet-table-flattened tbody tr td{border-bottom:0 none}.duet-table-minimal.duet-table-flattened tbody tr td[data-heading]::before{display:none}.duet-table-minimal.duet-table-flattened tfoot{border-top:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened.duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-fixed table{table-layout:fixed}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td,.duet-table-fixed tbody tr td:first-child{padding:4px !important;vertical-align:text-bottom;border-bottom:0 none}.duet-table-fixed thead{display:none}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td{border-bottom:0 none}.duet-table-fixed:not(.duet-table-flattened) tfoot{border-top:1px solid #e1e3e6}.duet-table-fixed:not(.duet-table-flattened).duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-scrollable{position:relative;width:100%;overflow-x:auto;background:linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0)), linear-gradient(-90deg, #fff 0%, rgba(255, 255, 255, 0)) 100% 0, radial-gradient(farthest-side at 0% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)), radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)) 100% 0%;background-repeat:no-repeat;background-attachment:local, local, scroll, scroll;background-size:100px 100%, 100px 100%, 12px 100%, 12px 100%}.duet-table-selected-column{background:rgba(0, 119, 179, 0.08)}.duet-theme-turva .duet-table-selected-column{background:rgba(68, 68, 69, 0.08)}.duet-table-sortable tbody tr td:first-child,.duet-table-sortable thead tr th:first-child{padding:20px}.duet-table-sortable:not(.duet-table-flattened) tfoot{border-top:1px solid #e1e3e6}.duet-table-sortable:not(.duet-table-flattened).duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-actions table{table-layout:auto}.duet-table-actions thead th:last-child{width:1px;white-space:nowrap}";
|
|
283
226
|
|
|
284
227
|
// remove wrapping speech marks.
|
|
285
228
|
// media query tokens are wrapped in speech marks,
|
|
@@ -339,9 +282,9 @@ let DuetTable = class {
|
|
|
339
282
|
}
|
|
340
283
|
connectedCallback() {
|
|
341
284
|
this.mq = matchMedia(breakpointToToken[this.breakpoint]);
|
|
342
|
-
this.mq.addEventListener("change", this.handleMediaQueryChange);
|
|
285
|
+
this.mq.addEventListener("change", debounce(this.handleMediaQueryChange, 50));
|
|
343
286
|
this.handleMediaQueryChange(this.mq);
|
|
344
|
-
this.observer = new MutationObserver(() => this.copyHeadingsToCells());
|
|
287
|
+
this.observer = new MutationObserver(() => debounce(this.copyHeadingsToCells(), 50));
|
|
345
288
|
this.observer.observe(this.element, {
|
|
346
289
|
childList: true,
|
|
347
290
|
subtree: true,
|
|
@@ -372,6 +315,9 @@ let DuetTable = class {
|
|
|
372
315
|
this.mq = null;
|
|
373
316
|
this.matchesBreakpoint = true;
|
|
374
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Local methods.
|
|
320
|
+
*/
|
|
375
321
|
copyHeadingsToCells() {
|
|
376
322
|
const headingElements = this.element.querySelectorAll("thead th");
|
|
377
323
|
const rowElements = this.element.querySelectorAll("tbody tr");
|
|
@@ -647,7 +593,7 @@ const validateFile = (item, validators) => {
|
|
|
647
593
|
if (item) {
|
|
648
594
|
const { name, type, size } = item;
|
|
649
595
|
const mime = validateFileMime(type, allowedMimetypes);
|
|
650
|
-
const ext = validateFileExtension(name, allowedExtensions);
|
|
596
|
+
const ext = validateFileExtension(name.toLowerCase(), allowedExtensions);
|
|
651
597
|
const bytes = validateFileSize(size, maxBytes);
|
|
652
598
|
if (!mime) {
|
|
653
599
|
errorMessage = getError("duet-upload-101");
|
|
@@ -727,7 +673,7 @@ const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress })
|
|
|
727
673
|
return xhr;
|
|
728
674
|
};
|
|
729
675
|
|
|
730
|
-
const duetUploadCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}::slotted([slot=header]){margin-bottom:16px}::slotted([slot=fileheader]){margin:16px 0 0 0}::slotted([slot=filefooter]){margin-top:16px}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload-item-size{font-size:0.75rem;font-weight:400}.duet-upload-filelist{margin-bottom:25px}.duet-upload-filelist-empty{display:flex;align-items:center;justify-content:center;width:100%;height:75px;margin:0 auto;font-size:1rem;font-weight:400;background-color:#f5f8fa}";
|
|
676
|
+
const duetUploadCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}::slotted([slot=header]){margin-bottom:16px}::slotted([slot=fileheader]){margin:16px 0 0 0}::slotted([slot=filefooter]){margin-top:16px}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload-item-size{font-size:0.75rem;font-weight:400}.duet-upload-filelist{margin-bottom:25px}.duet-upload-filelist-empty{display:flex;align-items:center;justify-content:center;width:100%;height:75px;margin:0 auto;font-size:1rem;font-weight:400;background-color:#f5f8fa}.duet-upload-editable-table-header-hidden{display:none}.duet-upload-editable-table tbody .duet-upload-editable-table-data{padding:0 !important;border:0}.duet-upload-editable-table duet-editable-table tfoot,.duet-upload-editable-table duet-editable-table thead{display:none}.duet-upload-editable-table duet-editable-table .duet-editable-table-content{padding-right:0 !important;padding-left:0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td{padding:0.75rem 0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td:last-child{padding-right:0 !important}.duet-upload-editable-table duet-editable-table .duet-editable-table-row-inprogress duet-action-button::part(button){border:0}";
|
|
731
677
|
|
|
732
678
|
let DuetUpload = class {
|
|
733
679
|
constructor(hostRef) {
|
|
@@ -741,25 +687,6 @@ let DuetUpload = class {
|
|
|
741
687
|
this.duetCancel = createEvent(this, "duetCancel", 3);
|
|
742
688
|
this.duetProgress = createEvent(this, "duetProgress", 3);
|
|
743
689
|
this.duetUpload = createEvent(this, "duetUpload", 3);
|
|
744
|
-
/**
|
|
745
|
-
* Own Properties
|
|
746
|
-
*/
|
|
747
|
-
this.buttonId = createID("DuetButton");
|
|
748
|
-
this.labelId = createID("DuetLabel");
|
|
749
|
-
this.uploadId = createID("DuetUpload");
|
|
750
|
-
this.editableTableId = createID("DuetEditableTable");
|
|
751
|
-
this.filesInProgress = new Map();
|
|
752
|
-
this.fileMaxReached = false;
|
|
753
|
-
this.bytesMaxReached = false;
|
|
754
|
-
this.internalStatusMessageLabel = undefined;
|
|
755
|
-
/**
|
|
756
|
-
* Properties
|
|
757
|
-
*/
|
|
758
|
-
this.DefaultGroups = {
|
|
759
|
-
inprogress: "inprogress",
|
|
760
|
-
success: "success",
|
|
761
|
-
failure: "failure",
|
|
762
|
-
};
|
|
763
690
|
/**
|
|
764
691
|
* State() variables
|
|
765
692
|
*/
|
|
@@ -781,8 +708,9 @@ let DuetUpload = class {
|
|
|
781
708
|
{
|
|
782
709
|
icon: "action-delete",
|
|
783
710
|
color: "color-danger",
|
|
784
|
-
|
|
785
|
-
|
|
711
|
+
size: "x-small",
|
|
712
|
+
background: "gray-lightest",
|
|
713
|
+
name: "delete",
|
|
786
714
|
map: ["success", "failure"],
|
|
787
715
|
label: {
|
|
788
716
|
fi: "Poista tiedosto",
|
|
@@ -793,8 +721,9 @@ let DuetUpload = class {
|
|
|
793
721
|
{
|
|
794
722
|
icon: "navigation-close",
|
|
795
723
|
color: "primary",
|
|
796
|
-
|
|
797
|
-
|
|
724
|
+
size: "x-small",
|
|
725
|
+
background: "gray-lightest",
|
|
726
|
+
name: "cancel",
|
|
798
727
|
map: ["inprogress"],
|
|
799
728
|
label: {
|
|
800
729
|
fi: "Keskeytä lähetys",
|
|
@@ -864,8 +793,8 @@ let DuetUpload = class {
|
|
|
864
793
|
inProgressWithErrors: "Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed",
|
|
865
794
|
done: "All {filesTotal} added successfully",
|
|
866
795
|
doneWithErrors: "Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors",
|
|
867
|
-
files: "
|
|
868
|
-
file: "
|
|
796
|
+
files: "File",
|
|
797
|
+
file: "file",
|
|
869
798
|
},
|
|
870
799
|
};
|
|
871
800
|
/**
|
|
@@ -1020,19 +949,72 @@ let DuetUpload = class {
|
|
|
1020
949
|
* by default this is off, setting this to true will limit the users choices to what has been explicitly set
|
|
1021
950
|
*/
|
|
1022
951
|
this.limitSelection = false;
|
|
952
|
+
/**
|
|
953
|
+
* Own Properties
|
|
954
|
+
*/
|
|
955
|
+
this.buttonId = createID("DuetButton");
|
|
956
|
+
this.labelId = createID("DuetLabel");
|
|
957
|
+
this.uploadId = createID("DuetUpload");
|
|
958
|
+
this.filesInProgress = new Map();
|
|
959
|
+
this.fileMaxReached = false;
|
|
960
|
+
this.bytesMaxReached = false;
|
|
961
|
+
this.internalStatusMessageLabel = undefined;
|
|
962
|
+
/**
|
|
963
|
+
* Properties
|
|
964
|
+
*/
|
|
965
|
+
this.DefaultGroups = {
|
|
966
|
+
inprogress: "inprogress",
|
|
967
|
+
success: "success",
|
|
968
|
+
failure: "failure",
|
|
969
|
+
};
|
|
970
|
+
/**
|
|
971
|
+
* Array of group names that you want the editable table to use to display files
|
|
972
|
+
* @required
|
|
973
|
+
* @example [{ id: "success", label: {fi: "Onnistunut", en: "Success", sv: "Alt klart", }}]
|
|
974
|
+
*/
|
|
975
|
+
this.groups = [
|
|
976
|
+
{
|
|
977
|
+
id: this.DefaultGroups.inprogress,
|
|
978
|
+
label: {
|
|
979
|
+
fi: "Kesken olevat tiedostot",
|
|
980
|
+
sv: "Filer inprogress",
|
|
981
|
+
en: "Files inprogress",
|
|
982
|
+
},
|
|
983
|
+
},
|
|
984
|
+
{
|
|
985
|
+
id: this.DefaultGroups.success,
|
|
986
|
+
label: {
|
|
987
|
+
fi: "Valmiit tiedostot",
|
|
988
|
+
sv: "Files success",
|
|
989
|
+
en: "Files success",
|
|
990
|
+
},
|
|
991
|
+
},
|
|
992
|
+
{
|
|
993
|
+
id: this.DefaultGroups.failure,
|
|
994
|
+
label: {
|
|
995
|
+
fi: "Tiedostot, joissa on virheitä",
|
|
996
|
+
sv: "Filer med fel",
|
|
997
|
+
en: "Files with errors",
|
|
998
|
+
},
|
|
999
|
+
},
|
|
1000
|
+
];
|
|
1001
|
+
this.kick = debounce(() => {
|
|
1002
|
+
this.tick = Date.now();
|
|
1003
|
+
}, 30); // will trigger re-render
|
|
1023
1004
|
/**
|
|
1024
1005
|
* Private functions
|
|
1025
1006
|
*/
|
|
1026
1007
|
this.listenForActionEvents = () => {
|
|
1027
|
-
this.element.addEventListener("
|
|
1008
|
+
this.element.addEventListener("duetActionEvent", (e) => {
|
|
1028
1009
|
const detail = e.detail;
|
|
1029
|
-
const { action,
|
|
1010
|
+
const { action, id, originalEvent } = detail;
|
|
1011
|
+
console.log(e);
|
|
1030
1012
|
switch (action) {
|
|
1031
1013
|
case "delete":
|
|
1032
|
-
this.onDelete(
|
|
1014
|
+
this.onDelete(id, originalEvent);
|
|
1033
1015
|
break;
|
|
1034
1016
|
case "cancel":
|
|
1035
|
-
this.onCancel(
|
|
1017
|
+
this.onCancel(id, originalEvent);
|
|
1036
1018
|
break;
|
|
1037
1019
|
// code block
|
|
1038
1020
|
}
|
|
@@ -1089,24 +1071,6 @@ let DuetUpload = class {
|
|
|
1089
1071
|
return "none";
|
|
1090
1072
|
}
|
|
1091
1073
|
};
|
|
1092
|
-
this.convertToDuetEditableTableItems = () => {
|
|
1093
|
-
// we're always recreating the map - in order to force an update down stream.
|
|
1094
|
-
const itemData = new Map();
|
|
1095
|
-
//walk the files Map and convert to DuetEditableTableItemData
|
|
1096
|
-
this.files.forEach((data, key, _originalMap) => {
|
|
1097
|
-
const group = this.getGroupFromItemData(data);
|
|
1098
|
-
const item = this.getItemHTMLFromItemData(data, group);
|
|
1099
|
-
itemData.set(key, {
|
|
1100
|
-
uid: data.uid,
|
|
1101
|
-
item,
|
|
1102
|
-
group,
|
|
1103
|
-
});
|
|
1104
|
-
});
|
|
1105
|
-
return itemData;
|
|
1106
|
-
};
|
|
1107
|
-
this.kick = debounce(() => {
|
|
1108
|
-
this.tick = Date.now();
|
|
1109
|
-
}, 30); // will trigger re-render
|
|
1110
1074
|
this.genHashName = () => Date.now().toString(36) + Math.random();
|
|
1111
1075
|
this.updateValueInMap = (item, key, value, kick = true) => {
|
|
1112
1076
|
const fileItem = this.files.get(item);
|
|
@@ -1167,7 +1131,6 @@ let DuetUpload = class {
|
|
|
1167
1131
|
this.nativeInput.value = "";
|
|
1168
1132
|
};
|
|
1169
1133
|
this.startUpload = async (ev, metaData = undefined) => {
|
|
1170
|
-
await this.setFocus();
|
|
1171
1134
|
this.metaData = metaData;
|
|
1172
1135
|
this.nativeInput.click();
|
|
1173
1136
|
this.onUpload(ev, metaData);
|
|
@@ -1230,9 +1193,18 @@ let DuetUpload = class {
|
|
|
1230
1193
|
fileMaxReached: isTotalFileAmountAboveMax,
|
|
1231
1194
|
};
|
|
1232
1195
|
};
|
|
1196
|
+
this.getItemFromUID = (uid) => {
|
|
1197
|
+
for (const [key, value] of this.files.entries()) {
|
|
1198
|
+
if (value.uid === uid) {
|
|
1199
|
+
return { value, key };
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1202
|
+
return null;
|
|
1203
|
+
};
|
|
1233
1204
|
this.onDelete = (key, ev) => {
|
|
1234
|
-
const
|
|
1235
|
-
this.files.
|
|
1205
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
1206
|
+
const deletedItem = this.files.get(retrievedKey);
|
|
1207
|
+
this.files.delete(retrievedKey);
|
|
1236
1208
|
this.validateTotals();
|
|
1237
1209
|
this.kick();
|
|
1238
1210
|
this.duetDelete.emit({
|
|
@@ -1246,8 +1218,9 @@ let DuetUpload = class {
|
|
|
1246
1218
|
this.resetFormFields();
|
|
1247
1219
|
};
|
|
1248
1220
|
this.onCancel = (key, ev) => {
|
|
1249
|
-
const
|
|
1250
|
-
this.files.
|
|
1221
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
1222
|
+
const cancelledItem = this.files.get(retrievedKey);
|
|
1223
|
+
this.files.delete(retrievedKey);
|
|
1251
1224
|
if (!this.external) {
|
|
1252
1225
|
const { xhr } = cancelledItem;
|
|
1253
1226
|
xhr.abort();
|
|
@@ -1297,6 +1270,79 @@ let DuetUpload = class {
|
|
|
1297
1270
|
data: { files: this.files },
|
|
1298
1271
|
});
|
|
1299
1272
|
};
|
|
1273
|
+
/**
|
|
1274
|
+
* @description This functions return sorted map items byg condition which are:
|
|
1275
|
+
*/
|
|
1276
|
+
this.filterMap = () => {
|
|
1277
|
+
const all = [...this.files.values()];
|
|
1278
|
+
const inprogress = [];
|
|
1279
|
+
const failure = [];
|
|
1280
|
+
const success = [];
|
|
1281
|
+
all.forEach(data => {
|
|
1282
|
+
const group = this.getGroupFromItemData(data);
|
|
1283
|
+
const item = this.getItemHTMLFromItemData(data, group);
|
|
1284
|
+
if (group === this.DefaultGroups.success) {
|
|
1285
|
+
success.push({
|
|
1286
|
+
uid: data.uid,
|
|
1287
|
+
item,
|
|
1288
|
+
group,
|
|
1289
|
+
});
|
|
1290
|
+
}
|
|
1291
|
+
else if (group === this.DefaultGroups.inprogress) {
|
|
1292
|
+
inprogress.push({
|
|
1293
|
+
uid: data.uid,
|
|
1294
|
+
item,
|
|
1295
|
+
group,
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
else if (group === this.DefaultGroups.failure) {
|
|
1299
|
+
failure.push({
|
|
1300
|
+
uid: data.uid,
|
|
1301
|
+
item,
|
|
1302
|
+
group,
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
else if (data.group) {
|
|
1306
|
+
inprogress.push({
|
|
1307
|
+
uid: data.uid,
|
|
1308
|
+
item,
|
|
1309
|
+
group: data.group,
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
});
|
|
1313
|
+
return {
|
|
1314
|
+
inprogress,
|
|
1315
|
+
failure,
|
|
1316
|
+
success,
|
|
1317
|
+
};
|
|
1318
|
+
};
|
|
1319
|
+
this.getColumns = (group) => {
|
|
1320
|
+
return [
|
|
1321
|
+
{
|
|
1322
|
+
sort_order: 1,
|
|
1323
|
+
direction: 1,
|
|
1324
|
+
index: 0,
|
|
1325
|
+
key: group.id,
|
|
1326
|
+
label: group.label,
|
|
1327
|
+
},
|
|
1328
|
+
];
|
|
1329
|
+
};
|
|
1330
|
+
this.getActions = (id) => {
|
|
1331
|
+
return this.actions.filter(item => item.map.includes(id));
|
|
1332
|
+
};
|
|
1333
|
+
this.renderEditableTableGroups = () => {
|
|
1334
|
+
const filteredItems = this.filterMap();
|
|
1335
|
+
const EditableTables = this.groups.map(group => {
|
|
1336
|
+
const currentItems = filteredItems[group.id];
|
|
1337
|
+
if (!(currentItems === null || currentItems === void 0 ? void 0 : currentItems.length)) {
|
|
1338
|
+
return;
|
|
1339
|
+
}
|
|
1340
|
+
return (h("duet-table", { variation: "plain", breakpoint: "none", role: "log", margin: this.hideGroups ? "none" : "auto" }, h("table", { class: "duet-upload-editable-table" }, h("thead", { class: "duet-upload-editable-table-header" }, h("tr", null, h("th", { class: {
|
|
1341
|
+
"duet-upload-editable-table-header-hidden": this.hideGroups,
|
|
1342
|
+
} }, !this.hideGroups ? (getLocaleString(group.label)) : (h("duet-visually-hidden", null, getLocaleString(group.label)))))), h("tbody", null, h("tr", null, h("td", { class: "duet-upload-editable-table-data" }, h("duet-editable-table", { breakpoint: "none", variation: "plain", groupId: group.id, columns: this.getColumns(group), actions: this.getActions(group.id), margin: "none", rows: currentItems })))))));
|
|
1343
|
+
});
|
|
1344
|
+
return EditableTables;
|
|
1345
|
+
};
|
|
1300
1346
|
}
|
|
1301
1347
|
watchValidHandler(newValue, oldValue) {
|
|
1302
1348
|
if (newValue !== oldValue) {
|
|
@@ -1320,6 +1366,68 @@ let DuetUpload = class {
|
|
|
1320
1366
|
// listen to the events from the component
|
|
1321
1367
|
this.verifyValidity();
|
|
1322
1368
|
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
1371
|
+
* `input.focus()`.
|
|
1372
|
+
*/
|
|
1373
|
+
async setFocus(options) {
|
|
1374
|
+
if (this.nativeInput) {
|
|
1375
|
+
this.nativeInput.focus(options);
|
|
1376
|
+
}
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
/**
|
|
1380
|
+
* Method for invoking the upload sequence
|
|
1381
|
+
*/
|
|
1382
|
+
async upload(metaData = undefined) {
|
|
1383
|
+
await this.setFocus();
|
|
1384
|
+
this.metaData = metaData;
|
|
1385
|
+
this.nativeInput.click();
|
|
1386
|
+
return;
|
|
1387
|
+
}
|
|
1388
|
+
/**
|
|
1389
|
+
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
1390
|
+
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
1391
|
+
* the tabular data if the automatic re-render is no sufficient
|
|
1392
|
+
*/
|
|
1393
|
+
async refresh() {
|
|
1394
|
+
this.kick();
|
|
1395
|
+
await this.setFocus();
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Get list of files, divided in errors and valid sections
|
|
1399
|
+
*/
|
|
1400
|
+
async getFiles() {
|
|
1401
|
+
if (!this.files || this.files.size === 0) {
|
|
1402
|
+
return false;
|
|
1403
|
+
}
|
|
1404
|
+
return this.getFilesAsArray();
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
1408
|
+
*/
|
|
1409
|
+
async updateValue(item, key, value) {
|
|
1410
|
+
this.updateValueInMap(item, key, value);
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* render() function
|
|
1414
|
+
* Always the last one in the class.
|
|
1415
|
+
*/
|
|
1416
|
+
render() {
|
|
1417
|
+
const identifier = this.identifier || this.uploadId;
|
|
1418
|
+
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
1419
|
+
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
1420
|
+
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
1421
|
+
return (h(Host, { class: { "duet-m-0": this.margin === "none" } }, h("duet-fieldset", { label: this.label, caption: caption }, h("slot", { name: "header" }), !this.files.size && (h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
|
|
1422
|
+
"duet-upload-filelist-empty": !this.files.size,
|
|
1423
|
+
"duet-upload-filelist": true,
|
|
1424
|
+
"duet-upload-filelist-filled": this.files.size,
|
|
1425
|
+
}, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && h("slot", { name: "fileheader" }), !!this.files.size && (h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })), !!this.files.size && this.renderEditableTableGroups(), !!this.files.size && h("slot", { name: "filefooter" }), h("duet-spacer", { size: "large" }), !this.hideButton && (h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle", part: this.identifier ? `${this.identifier}-button-upload` : "duet-upload-button-upload" }, this.buttonLabel)), h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" }, this.fileMaxReached && getI18nError("duet-upload-301"), this.bytesMaxReached && getI18nError("duet-upload-202"))), h("duet-spacer", { size: "medium" }), h("duet-visually-hidden", null, h("input", { ref: input => {
|
|
1426
|
+
this.nativeInput = input;
|
|
1427
|
+
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
1428
|
+
"duet-upload": true,
|
|
1429
|
+
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
1430
|
+
}
|
|
1323
1431
|
/**
|
|
1324
1432
|
* XHR request utilities
|
|
1325
1433
|
*/
|
|
@@ -1441,68 +1549,6 @@ let DuetUpload = class {
|
|
|
1441
1549
|
component: "duet-upload",
|
|
1442
1550
|
});
|
|
1443
1551
|
}
|
|
1444
|
-
/**
|
|
1445
|
-
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
1446
|
-
* `input.focus()`.
|
|
1447
|
-
*/
|
|
1448
|
-
async setFocus(options) {
|
|
1449
|
-
if (this.nativeInput) {
|
|
1450
|
-
this.nativeInput.focus(options);
|
|
1451
|
-
}
|
|
1452
|
-
return;
|
|
1453
|
-
}
|
|
1454
|
-
/**
|
|
1455
|
-
* Method for invoking the upload sequence
|
|
1456
|
-
*/
|
|
1457
|
-
async upload(metaData = undefined) {
|
|
1458
|
-
await this.setFocus();
|
|
1459
|
-
this.metaData = metaData;
|
|
1460
|
-
this.nativeInput.click();
|
|
1461
|
-
return;
|
|
1462
|
-
}
|
|
1463
|
-
/**
|
|
1464
|
-
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
1465
|
-
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
1466
|
-
* the tabular data if the automatic re-render is no sufficient
|
|
1467
|
-
*/
|
|
1468
|
-
async refresh() {
|
|
1469
|
-
this.kick();
|
|
1470
|
-
await this.setFocus();
|
|
1471
|
-
}
|
|
1472
|
-
/**
|
|
1473
|
-
* Get list of files, divided in errors and valid sections
|
|
1474
|
-
*/
|
|
1475
|
-
async getFiles() {
|
|
1476
|
-
if (!this.files || this.files.size === 0) {
|
|
1477
|
-
return false;
|
|
1478
|
-
}
|
|
1479
|
-
return this.getFilesAsArray();
|
|
1480
|
-
}
|
|
1481
|
-
/**
|
|
1482
|
-
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
1483
|
-
*/
|
|
1484
|
-
async updateValue(item, key, value) {
|
|
1485
|
-
this.updateValueInMap(item, key, value);
|
|
1486
|
-
}
|
|
1487
|
-
/**
|
|
1488
|
-
* render() function
|
|
1489
|
-
* Always the last one in the class.
|
|
1490
|
-
*/
|
|
1491
|
-
render() {
|
|
1492
|
-
const identifier = this.identifier || this.uploadId;
|
|
1493
|
-
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
1494
|
-
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
1495
|
-
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
1496
|
-
return (h(Host, { class: { "duet-m-0": this.margin === "none" } }, h("duet-fieldset", { label: this.label, caption: caption }, h("slot", { name: "header" }), !this.files.size && (h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
|
|
1497
|
-
"duet-upload-filelist-empty": !this.files.size,
|
|
1498
|
-
"duet-upload-filelist": true,
|
|
1499
|
-
"duet-upload-filelist-filled": this.files.size,
|
|
1500
|
-
}, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && h("slot", { name: "fileheader" }), !!this.files.size && (h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })), !!this.files.size && (h("duet-editable-table", { part: this.identifier ? `${this.identifier}-editable-table` : "duet-upload-editable-table", "aria-live": "polite", "aria-relevant": "removals", accessibleRole: "log", id: this.editableTableId, groups: this.groups, actions: this.actions, hideGroups: this.hideGroups, alignment: this.alignment, items: this.convertToDuetEditableTableItems() })), !!this.files.size && h("slot", { name: "filefooter" }), h("duet-spacer", { size: "large" }), !this.hideButton && (h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle", part: this.identifier ? `${this.identifier}-button-upload` : "duet-upload-button-upload" }, this.buttonLabel)), h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" }, this.fileMaxReached && getI18nError("duet-upload-301"), this.bytesMaxReached && getI18nError("duet-upload-202"))), h("duet-spacer", { size: "medium" }), h("duet-visually-hidden", null, h("input", { ref: input => {
|
|
1501
|
-
this.nativeInput = input;
|
|
1502
|
-
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
1503
|
-
"duet-upload": true,
|
|
1504
|
-
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
1505
|
-
}
|
|
1506
1552
|
get element() { return getElement(this); }
|
|
1507
1553
|
static get watchers() { return {
|
|
1508
1554
|
"valid": ["watchValidHandler"]
|
|
@@ -1510,4 +1556,4 @@ let DuetUpload = class {
|
|
|
1510
1556
|
};
|
|
1511
1557
|
DuetUpload.style = duetUploadCss;
|
|
1512
1558
|
|
|
1513
|
-
export { DuetEditableTable as duet_editable_table,
|
|
1559
|
+
export { DuetEditableTable as duet_editable_table, DuetTable as duet_table, DuetUpload as duet_upload };
|