@duetds/components 4.36.1 → 5.0.2
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 +1135 -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 +2 -2
- 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 +1 -1
- 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-dfd718e8.js → focus-utils-2404e669.js} +1 -1
- package/lib/cjs/{index-4f342f1c.js → index-91b9281f.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-f402e205.js → token-utils-ac8432d1.js} +1 -1
- 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-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-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/custom-elements-bundle/index.d.ts +6 -12
- package/lib/custom-elements-bundle/index.js +1148 -1007
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/{p-061835f3.system.entry.js → p-09bdb2b4.system.entry.js} +1 -1
- package/lib/duet/{p-1a95aeb6.entry.js → p-0e4b29a3.entry.js} +1 -1
- package/lib/duet/{p-65c418f7.system.entry.js → p-16477cd0.system.entry.js} +1 -1
- package/lib/duet/p-1c993c62.system.entry.js +4 -0
- package/lib/duet/{p-8c53bc24.system.entry.js → p-1f78f660.system.entry.js} +1 -1
- package/lib/duet/{p-ef275410.entry.js → p-24442312.entry.js} +1 -1
- package/lib/duet/{p-ddb6344c.system.js → p-268c0abb.system.js} +0 -0
- package/lib/duet/p-2d602c49.system.entry.js +4 -0
- package/lib/duet/{p-946f34b4.system.entry.js → p-305a8332.system.entry.js} +1 -1
- package/lib/duet/{p-4fdbc6ff.system.entry.js → p-3724e8bf.system.entry.js} +1 -1
- package/lib/duet/{p-5d9affcd.entry.js → p-40deceee.entry.js} +1 -1
- package/lib/duet/{p-211b4485.system.entry.js → p-4169371b.system.entry.js} +1 -1
- package/lib/duet/{p-9ce0e625.entry.js → p-4306e41d.entry.js} +1 -1
- package/lib/duet/{p-5376a9db.entry.js → p-43a310bd.entry.js} +1 -1
- package/lib/duet/{p-29255af8.entry.js → p-45c0bd39.entry.js} +1 -1
- package/lib/duet/{p-fd2211ab.entry.js → p-47885d97.entry.js} +1 -1
- package/lib/duet/{p-615bfc61.system.entry.js → p-4b9af907.system.entry.js} +1 -1
- package/lib/duet/{p-1c4721a1.entry.js → p-4f9d6d43.entry.js} +1 -1
- package/lib/duet/{p-85100e09.entry.js → p-52f07766.entry.js} +1 -1
- package/lib/duet/{p-e8e35258.entry.js → p-567321c9.entry.js} +1 -1
- package/lib/duet/p-572ee1f5.entry.js +4 -0
- package/lib/duet/{p-cb445018.js → p-5746d88c.js} +1 -1
- package/lib/duet/{p-286d2ad2.system.entry.js → p-57f6b52e.system.entry.js} +1 -1
- package/lib/duet/p-5a4e576c.entry.js +4 -0
- package/lib/duet/{p-fae71c1f.entry.js → p-5ad66dfd.entry.js} +1 -1
- package/lib/duet/{p-f6da56c8.entry.js → p-5cc97dae.entry.js} +1 -1
- package/lib/duet/{p-03cf3ebf.entry.js → p-5ce39b6b.entry.js} +1 -1
- package/lib/duet/{p-46ae601a.entry.js → p-615f0b6f.entry.js} +1 -1
- package/lib/duet/{p-83452e8f.entry.js → p-63f6099b.entry.js} +1 -1
- package/lib/duet/p-681e93cd.entry.js +4 -0
- package/lib/duet/p-6a455a78.system.entry.js +4 -0
- package/lib/duet/{p-c52f4de0.system.entry.js → p-6d142621.system.entry.js} +1 -1
- package/lib/duet/{p-ca0ee655.system.entry.js → p-6fc73186.system.entry.js} +1 -1
- package/lib/duet/{p-e5ce7aad.system.entry.js → p-72469869.system.entry.js} +1 -1
- package/lib/duet/{p-20cdb787.entry.js → p-73d3d1bf.entry.js} +1 -1
- package/lib/duet/{p-164a7037.system.entry.js → p-763d700b.system.entry.js} +1 -1
- package/lib/duet/{p-d9716aec.system.entry.js → p-770fdb8f.system.entry.js} +1 -1
- package/lib/duet/{p-4e2532c7.system.js → p-77acbfe4.system.js} +1 -1
- package/lib/duet/{p-d21f19cc.system.js → p-7d65b8fc.system.js} +1 -1
- package/lib/duet/{p-ffb5fb75.system.entry.js → p-7e1d6ac6.system.entry.js} +1 -1
- package/lib/duet/{p-c7fa7dcc.system.entry.js → p-7f58aced.system.entry.js} +1 -1
- package/lib/duet/{p-22baf1f8.system.entry.js → p-806dc8b7.system.entry.js} +1 -1
- package/lib/duet/{p-fa99eaa4.system.js → p-812b0905.system.js} +0 -0
- package/lib/duet/{p-e7b53f4f.system.entry.js → p-854558fd.system.entry.js} +1 -1
- package/lib/duet/{p-c514010b.system.entry.js → p-85507ac3.system.entry.js} +1 -1
- package/lib/duet/p-8a241b0d.system.js +4 -0
- package/lib/duet/p-8ab8531d.entry.js +4 -0
- package/lib/duet/{p-eb892975.system.entry.js → p-8ff7380a.system.entry.js} +1 -1
- package/lib/duet/p-92639d0b.system.js +4 -0
- package/lib/duet/{p-3d1b0105.entry.js → p-97b9a61f.entry.js} +1 -1
- package/lib/duet/{p-3bb702e3.system.entry.js → p-97f24160.system.entry.js} +2 -2
- package/lib/duet/{p-740b5609.entry.js → p-9816d0ab.entry.js} +1 -1
- package/lib/duet/{p-ae14591e.entry.js → p-9c37e704.entry.js} +1 -1
- package/lib/duet/p-9c57b94d.system.entry.js +4 -0
- package/lib/duet/{p-635dacce.system.entry.js → p-9fa719d0.system.entry.js} +1 -1
- package/lib/duet/p-a4c7bb27.system.entry.js +4 -0
- package/lib/duet/{p-3c3536be.entry.js → p-a9158499.entry.js} +1 -1
- package/lib/duet/{p-e7dd8a15.system.entry.js → p-a934db65.system.entry.js} +1 -1
- package/lib/duet/{p-e35d8543.entry.js → p-acb043aa.entry.js} +1 -1
- package/lib/duet/{p-7f0e360d.entry.js → p-b2811c51.entry.js} +1 -1
- package/lib/duet/{p-d24c6bc1.entry.js → p-b53afa7a.entry.js} +1 -1
- package/lib/duet/{p-0366552b.system.entry.js → p-b686f39d.system.entry.js} +1 -1
- package/lib/duet/{p-ebc56043.entry.js → p-b6d5be13.entry.js} +1 -1
- package/lib/duet/{p-e8303364.system.entry.js → p-bb61f7d8.system.entry.js} +1 -1
- package/lib/duet/{p-12941aef.system.entry.js → p-bc895d5f.system.entry.js} +1 -1
- package/lib/duet/{p-e47daca7.system.entry.js → p-beca945d.system.entry.js} +1 -1
- package/lib/duet/{p-dcaecb5e.js → p-c420e1ab.js} +1 -1
- package/lib/duet/{p-5b546064.entry.js → p-c801c899.entry.js} +1 -1
- package/lib/duet/{p-3547d108.entry.js → p-c8f1cc9c.entry.js} +1 -1
- package/lib/duet/{p-c8ec3b99.entry.js → p-cd8c4a50.entry.js} +1 -1
- package/lib/duet/{p-b6dd0933.entry.js → p-ce487a35.entry.js} +1 -1
- package/lib/duet/{p-c6df2ea8.system.entry.js → p-ce6e5918.system.entry.js} +1 -1
- package/lib/duet/{p-c2d32103.entry.js → p-d03cb5c3.entry.js} +1 -1
- package/lib/duet/p-d173c966.entry.js +4 -0
- package/lib/duet/{p-79b9e7ef.system.entry.js → p-d414e0f6.system.entry.js} +1 -1
- package/lib/duet/{p-8143f3de.js → p-d7bc0102.js} +0 -0
- package/lib/duet/{p-24b9e806.entry.js → p-d7d80b8e.entry.js} +1 -1
- package/lib/duet/p-d8ed6905.entry.js +4 -0
- package/lib/duet/{p-562ae946.entry.js → p-da61c503.entry.js} +1 -1
- package/lib/duet/p-dbb4a588.js +4 -0
- package/lib/duet/p-dd8fade8.entry.js +4 -0
- package/lib/duet/{p-1db7a35b.entry.js → p-de67de41.entry.js} +1 -1
- package/lib/duet/{p-9df321b3.system.entry.js → p-def972d1.system.entry.js} +1 -1
- package/lib/duet/p-df2d8ec4.entry.js +4 -0
- package/lib/duet/{p-05e2c680.system.entry.js → p-e35ea4b9.system.entry.js} +1 -1
- package/lib/duet/{p-ad3dad04.system.js → p-e9ab7f0a.system.js} +1 -1
- package/lib/duet/{p-7a32ceb3.system.entry.js → p-eb383537.system.entry.js} +1 -1
- package/lib/duet/{p-ad07f399.js → p-ed75c8b3.js} +0 -0
- package/lib/duet/{p-c18080ad.entry.js → p-ee8682fc.entry.js} +1 -1
- package/lib/duet/p-f155c84d.system.entry.js +4 -0
- package/lib/duet/{p-d945a4b0.system.entry.js → p-f1b895c8.system.entry.js} +1 -1
- package/lib/duet/{p-89e42127.system.entry.js → p-f5af2560.system.entry.js} +1 -1
- package/lib/duet/{p-3900577d.system.entry.js → p-f7475d5a.system.entry.js} +1 -1
- package/lib/duet/p-f7c7f37d.js +4 -0
- package/lib/duet/{p-210d739c.system.entry.js → p-feca1c50.system.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 +2 -2
- 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 +1 -1
- 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-d4e80e1e.js → focus-utils-46b28332.js} +1 -1
- package/lib/esm/{index-4a5e7664.js → index-8743db3b.js} +1 -1
- package/lib/esm/js-utils-52e0944c.js +36 -0
- package/lib/esm/loader.js +2 -2
- package/lib/esm/{token-utils-e9a69acf.js → token-utils-e9a0cb88.js} +1 -1
- 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-46b28332.js +4 -0
- package/lib/esm-es5/{index-4a5e7664.js → index-8743db3b.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-e9a69acf.js → token-utils-e9a0cb88.js} +1 -1
- 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 +169 -69
- 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-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-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/package.json +8 -16
- 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-063fe96d.entry.js +0 -4
- package/lib/duet/p-2361986e.entry.js +0 -4
- package/lib/duet/p-2eeacf1a.entry.js +0 -4
- package/lib/duet/p-396f1bdc.entry.js +0 -4
- package/lib/duet/p-493c6d2f.system.entry.js +0 -4
- package/lib/duet/p-7b55f33e.entry.js +0 -4
- package/lib/duet/p-7e0e2209.system.entry.js +0 -4
- package/lib/duet/p-81867417.system.js +0 -4
- package/lib/duet/p-a3d7951c.system.entry.js +0 -4
- package/lib/duet/p-a619dff3.system.js +0 -4
- package/lib/duet/p-b25d3769.js +0 -4
- package/lib/duet/p-bf192d9f.entry.js +0 -4
- package/lib/duet/p-c76a68aa.system.entry.js +0 -4
- package/lib/duet/p-d12b3d21.system.entry.js +0 -4
- package/lib/duet/p-ded33218.system.entry.js +0 -4
- package/lib/duet/p-e6a69eb8.js +0 -4
- package/lib/duet/p-ef4962e8.entry.js +0 -4
- package/lib/duet/p-ff21f3c2.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/focus-utils-d4e80e1e.js +0 -4
- package/lib/esm-es5/js-utils-b69f17df.js +0 -4
- package/lib/types/components/duet-editable-table/duet-editable-table-button.d.ts +0 -73
- package/lib/types/components/duet-editable-table/duet-editable-table-item.d.ts +0 -76
|
@@ -5,285 +5,228 @@
|
|
|
5
5
|
|
|
6
6
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
7
7
|
|
|
8
|
-
const index = require('./index-
|
|
9
|
-
const jsUtils = require('./js-utils-
|
|
8
|
+
const index = require('./index-91b9281f.js');
|
|
9
|
+
const jsUtils = require('./js-utils-be1d29ae.js');
|
|
10
|
+
const keyboardUtils = require('./keyboard-utils-898cfe14.js');
|
|
10
11
|
const languageUtils = require('./language-utils-aa282901.js');
|
|
11
12
|
const themeableComponent = require('./themeable-component-0c1be552.js');
|
|
12
|
-
const tokens_module = require('./tokens.module-
|
|
13
|
+
const tokens_module = require('./tokens.module-6afcc9c1.js');
|
|
13
14
|
const createId = require('./create-id-c3b984b1.js');
|
|
14
15
|
require('./string-utils-267e3dbb.js');
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* console.log(makeMeKing({ name: 'Bryan', country: 'Scotland'}));
|
|
23
|
-
* // Logs 'Bryan is now the king of Scotland!'
|
|
24
|
-
*/
|
|
25
|
-
const generateTemplateFn = (function () {
|
|
26
|
-
const cache = {};
|
|
27
|
-
function generateTemplate(template) {
|
|
28
|
-
if (typeof template !== "string") {
|
|
29
|
-
template = template.outerHTML;
|
|
30
|
-
}
|
|
31
|
-
let fn = cache[template];
|
|
32
|
-
if (!fn) {
|
|
33
|
-
// Replace ${expressions} (etc) with ${map.expressions}.
|
|
34
|
-
const sanitized = template
|
|
35
|
-
.replace(/\$\{([\s]*[^;\s\{]+[\s]*)\}/g, function (_, match) {
|
|
36
|
-
return `\$\{map.${match.trim()}\}`;
|
|
37
|
-
})
|
|
38
|
-
// Afterwards, replace anything that's not ${map.expressions}' (etc) with a blank string.
|
|
39
|
-
.replace(/(\$\{(?!map\.)[^}]+\})/g, "");
|
|
40
|
-
fn = Function("map", `return \`${sanitized}\``);
|
|
41
|
-
}
|
|
42
|
-
return fn;
|
|
17
|
+
//simple functional component that renders the data in the table
|
|
18
|
+
const TableData = ({ data, groupId, alignment }, _children) => {
|
|
19
|
+
const classNames = `duet-editable-table duet-editable-table-content-${groupId}`;
|
|
20
|
+
if (typeof data === "string") {
|
|
21
|
+
return index.h("td", { innerHTML: data, class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } });
|
|
43
22
|
}
|
|
44
|
-
|
|
45
|
-
})
|
|
23
|
+
else {
|
|
24
|
+
return (index.h("td", { class: classNames, part: `${groupId}content`, style: { verticalAlign: alignment } }, data));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
46
27
|
|
|
47
|
-
const duetEditableTableCss = "duet-editable-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-editable-table-header tr .duet-editable-table-header-hidden{padding:0 !important;font-size:0;border-bottom:0}";
|
|
28
|
+
const duetEditableTableCss = ".sc-duet-editable-table-h{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-editable-table-actions-menu.sc-duet-editable-table{position:relative;padding:0 !important;margin:0}.duet-editable-table-actions-menu-button.sc-duet-editable-table{position:relative;right:-16px;float:right;padding:0}.duet-editable-table-actions-menu-icon.sc-duet-editable-table .duet-icon.sc-duet-editable-table{max-width:16px;max-height:16px}.duet-editable-table-row.duet-table-action-row.sc-duet-editable-table .duet-text-right.sc-duet-editable-table{text-align:right}.duet-editable-table-header.sc-duet-editable-table tr.sc-duet-editable-table .duet-editable-table-header-hidden.sc-duet-editable-table{padding:0 !important;font-size:0;border-bottom:0}";
|
|
48
29
|
|
|
49
30
|
let DuetEditableTable = class {
|
|
50
31
|
constructor(hostRef) {
|
|
51
32
|
index.registerInstance(this, hostRef);
|
|
52
|
-
this.
|
|
33
|
+
this.duetTableToggle = index.createEvent(this, "duetTableToggle", 7);
|
|
34
|
+
this.duetMenuClick = index.createEvent(this, "duetMenuClick", 7);
|
|
53
35
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @internal
|
|
36
|
+
* Duet-table: margin of the component.
|
|
56
37
|
*/
|
|
57
|
-
this.
|
|
38
|
+
this.margin = "auto";
|
|
58
39
|
/**
|
|
59
|
-
*
|
|
40
|
+
* Duet-table: Style variation of the table.
|
|
60
41
|
*/
|
|
61
|
-
this.
|
|
42
|
+
this.variation = "striped";
|
|
62
43
|
/**
|
|
63
|
-
*
|
|
44
|
+
* Duet-table: Controls whether the table has a sticky header.
|
|
45
|
+
* Sticky headers are not compatible with breakpoint="none-scrollable".
|
|
64
46
|
*/
|
|
65
|
-
this.
|
|
47
|
+
this.sticky = false;
|
|
66
48
|
/**
|
|
67
|
-
*
|
|
49
|
+
* Duet-table: Adjust the distance from top of the viewport (in pixels) when the
|
|
50
|
+
* table header becomes sticky.
|
|
68
51
|
*/
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
52
|
+
this.stickyDistance = "with-links";
|
|
53
|
+
/**
|
|
54
|
+
* Duet-table: By default the table is responsive - it will be flattened at narrow viewport widths.
|
|
55
|
+
* This prop controls the breakpoint at which the table should be rendered as a _regular_ table.
|
|
56
|
+
* Set to "none" to disable the responsive functionality.
|
|
57
|
+
* Set to "none-scrollable" to disable responsive functionality _and_ allow horizontal scrolling -
|
|
58
|
+
* this is useful for comparison tables where it's important to maintain column and row layout.
|
|
59
|
+
*/
|
|
60
|
+
this.breakpoint = "small";
|
|
74
61
|
/**
|
|
75
|
-
*
|
|
62
|
+
* Define actions for all items in a table
|
|
63
|
+
* An alternative to inline HTML table.
|
|
64
|
+
* required for Sortable tables
|
|
65
|
+
* @default undefined
|
|
76
66
|
*/
|
|
77
|
-
this.
|
|
78
|
-
fi: "Toiminnot",
|
|
79
|
-
en: "Actions",
|
|
80
|
-
sv: "Handlingar",
|
|
81
|
-
};
|
|
67
|
+
this.actions = undefined;
|
|
82
68
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
69
|
+
* Define columns for a table
|
|
70
|
+
* An alternative to inline HTML table.
|
|
71
|
+
* required for Sortable tables
|
|
72
|
+
* @default undefined
|
|
86
73
|
*/
|
|
87
|
-
this.
|
|
88
|
-
{ id: "all", label: this.groupsLabelDefaults, actionLabel: this.actionLabelDefaults },
|
|
89
|
-
];
|
|
74
|
+
this.columns = undefined;
|
|
90
75
|
/**
|
|
91
|
-
*
|
|
76
|
+
* Define rows for a table
|
|
77
|
+
* An alternative to inline HTML table.
|
|
78
|
+
* required for Sortable tables
|
|
92
79
|
* @default undefined
|
|
93
|
-
* @example [{
|
|
94
|
-
variation: "default",
|
|
95
|
-
icon: "action-edit-2",
|
|
96
|
-
id: "edit",
|
|
97
|
-
map: ["success"],
|
|
98
|
-
label: {
|
|
99
|
-
fi: " Label",
|
|
100
|
-
en: " Label",
|
|
101
|
-
sv: " Label",
|
|
102
|
-
}
|
|
103
|
-
}]
|
|
104
80
|
*/
|
|
105
|
-
this.
|
|
81
|
+
this.rows = undefined;
|
|
106
82
|
/**
|
|
107
|
-
*
|
|
83
|
+
* Controls whether the table is sortable by headers
|
|
108
84
|
*/
|
|
109
|
-
this.
|
|
85
|
+
this.sortable = false;
|
|
110
86
|
/**
|
|
111
|
-
*
|
|
87
|
+
* Optional id that get passed to the table and used to setup ::parts
|
|
112
88
|
*/
|
|
113
|
-
this.
|
|
89
|
+
this.groupId = "";
|
|
114
90
|
/**
|
|
115
91
|
* Theme of the table.
|
|
116
92
|
*/
|
|
117
93
|
this.theme = "";
|
|
118
94
|
/**
|
|
119
|
-
*
|
|
95
|
+
* Exposes the aria role for optimizing accessibility.
|
|
120
96
|
*/
|
|
121
|
-
this.
|
|
122
|
-
|
|
123
|
-
|
|
97
|
+
this.accessibleRole = undefined;
|
|
98
|
+
this.sortableDefaultLabel = {
|
|
99
|
+
fi: "Järjestä",
|
|
100
|
+
en: "Click to sort",
|
|
101
|
+
sv: "Klicka för att sortera",
|
|
102
|
+
};
|
|
103
|
+
this.actionColumnLabel = {
|
|
104
|
+
en: "Actions for rows",
|
|
105
|
+
fi: "Toiminnot rivillä",
|
|
106
|
+
sv: "Åtgärder för rader",
|
|
107
|
+
};
|
|
124
108
|
/**
|
|
125
|
-
*
|
|
109
|
+
* Private methods.
|
|
126
110
|
*/
|
|
127
|
-
this.
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const { item, group, uid } = data;
|
|
139
|
-
if (this.template) {
|
|
140
|
-
return {
|
|
141
|
-
group,
|
|
142
|
-
uid,
|
|
143
|
-
item: this.template(item),
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
return { item, group, uid };
|
|
111
|
+
this.toggleColumn = (column, e) => {
|
|
112
|
+
e.preventDefault();
|
|
113
|
+
const { sort_order, direction, index, key } = column;
|
|
114
|
+
this.duetTableToggle.emit({
|
|
115
|
+
sort_order,
|
|
116
|
+
index,
|
|
117
|
+
direction,
|
|
118
|
+
key,
|
|
119
|
+
component: "duet-editable-table",
|
|
120
|
+
originalEvent: e,
|
|
121
|
+
});
|
|
147
122
|
};
|
|
148
|
-
this.
|
|
149
|
-
if (
|
|
150
|
-
|
|
123
|
+
this.handleKeyDown = (column, e) => {
|
|
124
|
+
if (keyboardUtils.isKeyboardClick(e)) {
|
|
125
|
+
this.toggleColumn(column, e);
|
|
151
126
|
}
|
|
152
|
-
return Array.from(this.items).filter(item => needle === item[1].group);
|
|
153
127
|
};
|
|
154
128
|
}
|
|
155
129
|
/**
|
|
156
130
|
* Component lifecycle events.
|
|
157
131
|
*/
|
|
158
132
|
componentWillLoad() {
|
|
159
|
-
// look for a <template> region in the duet-editable-table
|
|
160
|
-
this.template = this.getTemplate();
|
|
161
|
-
// take care of the case where groups and actions are defined as html properties instead of javascript objects
|
|
162
|
-
if (typeof this.groups === "string") {
|
|
163
|
-
this.internalGroupArray = languageUtils.sanitizeString(this.groups);
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
this.internalGroupArray = this.groups;
|
|
167
|
-
}
|
|
168
|
-
if (typeof this.actions === "string") {
|
|
169
|
-
this.internalActionsArray = languageUtils.sanitizeString(this.actions);
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
this.internalActionsArray = this.actions;
|
|
173
|
-
}
|
|
174
133
|
themeableComponent.inheritGlobalTheme(this);
|
|
175
134
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const currentGroup = this.filterMap(group.id);
|
|
189
|
-
if (!currentGroup.length) {
|
|
190
|
-
return;
|
|
135
|
+
createLabel(column) {
|
|
136
|
+
const { sort_order, direction, index: index$1, label } = column;
|
|
137
|
+
const i18nLabel = languageUtils.getLocaleString(label);
|
|
138
|
+
if (!this.sortable) {
|
|
139
|
+
return i18nLabel;
|
|
140
|
+
}
|
|
141
|
+
const getButtonIcon = () => {
|
|
142
|
+
// "action-subtract-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-subtract-small.svg
|
|
143
|
+
// "action-arrow-down-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-down-small.svg
|
|
144
|
+
// "action-arrow-up-small" https://cdn.duetds.com/api/icons/2.2.12/lib/assets/action-arrow-up-small.svg
|
|
145
|
+
if (!!sort_order && direction === 1) {
|
|
146
|
+
return "action-arrow-down-small";
|
|
191
147
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
: languageUtils.getLocaleString(this.actionLabelDefaults))))), index.h("tbody", null, currentGroup.map(dataAsArray => {
|
|
199
|
-
const [key, value] = dataAsArray;
|
|
200
|
-
return (index.h("duet-editable-table-item", { theme: this.theme, keyName: key, data: this.getItemData(value), groupId: group.id, part: group.id, alignment: this.alignment, actions: this.internalActionsArray }));
|
|
201
|
-
})))));
|
|
202
|
-
})));
|
|
148
|
+
else if (!!sort_order && direction === -1) {
|
|
149
|
+
return "action-arrow-up-small";
|
|
150
|
+
}
|
|
151
|
+
return "action-subtract-small";
|
|
152
|
+
};
|
|
153
|
+
return (index.h("span", { class: "duet-table-label", "data-index": index$1 }, index.h("duet-button", { size: "small", icon: getButtonIcon(), "icon-size": "medium-small", "accessible-label": languageUtils.getLocaleString(this.sortableDefaultLabel), variation: "plain", margin: "none", "icon-right": true, onClick: event => this.toggleColumn(column, event), onKeyDown: event => this.handleKeyDown(column, event) }, i18nLabel)));
|
|
203
154
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
//simple functional component that renders the data in the table
|
|
209
|
-
const TableData = ({ data, groupId, alignment }, _children) => {
|
|
210
|
-
if (typeof data === "string") {
|
|
211
|
-
return (index.h("td", { innerHTML: data, class: "duet-editable-table-content", part: `${groupId}content`, style: { verticalAlign: alignment } }));
|
|
155
|
+
getSortedColumns() {
|
|
156
|
+
//create a new array from sort instead of mutating original
|
|
157
|
+
return [...this.columns].sort(jsUtils.fieldSorter(["index"]));
|
|
212
158
|
}
|
|
213
|
-
|
|
214
|
-
|
|
159
|
+
getRowSortOrder() {
|
|
160
|
+
//create a new array from sort instead of mutating original
|
|
161
|
+
const fields = [...this.columns].sort(jsUtils.fieldSorter(["sort_order"]));
|
|
162
|
+
//return only key from objects that have sort_order
|
|
163
|
+
return fields
|
|
164
|
+
.filter(column => column.sort_order)
|
|
165
|
+
.map(column => {
|
|
166
|
+
// add - in-front of descending direction (required by field-sorter)
|
|
167
|
+
return column.direction === -1 ? `-${column.key}` : column.key;
|
|
168
|
+
});
|
|
215
169
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
this.theme = "";
|
|
229
|
-
/**
|
|
230
|
-
* Actions that can be performed on the element
|
|
231
|
-
*/
|
|
232
|
-
this.actions = undefined;
|
|
233
|
-
/**
|
|
234
|
-
* GroupId used to pierce the shadowdom - gets concatenated with "content & actions" and used as part="groupIDcontent/actions" to pierce the content/Action item
|
|
235
|
-
* @internal
|
|
236
|
-
*/
|
|
237
|
-
this.groupId = "";
|
|
238
|
-
/**
|
|
239
|
-
* Key used to set vertical alignment of action buttons
|
|
240
|
-
*/
|
|
241
|
-
this.alignment = "middle";
|
|
242
|
-
/**
|
|
243
|
-
* Key used to identify item, when running actions
|
|
244
|
-
*/
|
|
245
|
-
this.keyName = "";
|
|
246
|
-
/**
|
|
247
|
-
* Object of data itemsused to render the entire row
|
|
248
|
-
*/
|
|
249
|
-
this.data = undefined;
|
|
170
|
+
renderTableHeader() {
|
|
171
|
+
if (!this.columns) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const sortedColumns = this.getSortedColumns();
|
|
175
|
+
return (index.h("tr", { class: {
|
|
176
|
+
"duet-table-action-header": !!this.actions,
|
|
177
|
+
} }, sortedColumns.map(column => {
|
|
178
|
+
if (column.display !== false) {
|
|
179
|
+
return index.h("th", { scope: "col" }, this.createLabel(column));
|
|
180
|
+
}
|
|
181
|
+
}), this.actions && (index.h("th", { scope: "col", class: "duet-table-action-header-heading" }, this.actions && index.h("duet-visually-hidden", null, languageUtils.getLocaleString(this.actionColumnLabel))))));
|
|
250
182
|
}
|
|
251
|
-
|
|
252
|
-
//
|
|
183
|
+
renderActions(rowItem, index$1) {
|
|
184
|
+
// escape early
|
|
185
|
+
if (!this.actions) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
// iterate through actions and add them in the sidebar
|
|
189
|
+
return (index.h("td", { class: "duet-text-right" }, this.actions.map(actionItem => {
|
|
190
|
+
return (index.h("duet-action-button", { actionMeta: Object.assign({}, (rowItem === null || rowItem === void 0 ? void 0 : rowItem.meta) || {}, { index: index$1 }), actionId: (rowItem === null || rowItem === void 0 ? void 0 : rowItem.uid) || (rowItem === null || rowItem === void 0 ? void 0 : rowItem.id) || null, actionName: actionItem.name, theme: this.theme, iconName: actionItem.icon, iconColor: actionItem.color, iconSize: actionItem.size, background: actionItem.background }));
|
|
191
|
+
})));
|
|
253
192
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
193
|
+
renderTableBody() {
|
|
194
|
+
const columns = this.getSortedColumns();
|
|
195
|
+
const rowSortOrder = this.getRowSortOrder();
|
|
196
|
+
const sortedRows = [...this.rows].sort(jsUtils.fieldSorter(rowSortOrder));
|
|
197
|
+
// return a tbody with rows for each item in sortedRows
|
|
198
|
+
return sortedRows.map((row, index$1) => (index.h("tr", { class: {
|
|
199
|
+
"duet-table-action-row": !!this.actions,
|
|
200
|
+
"duet-editable-table-row": true,
|
|
201
|
+
[`duet-editable-table-row-${this.groupId}`]: true,
|
|
202
|
+
}, "data-meta": JSON.stringify(row.meta) }, columns.map(column => {
|
|
203
|
+
//if we don't have any data for this column, try getting an item instead (for backwards compatibility
|
|
204
|
+
const value = row[column.key] ? row[column.key] : row.item;
|
|
205
|
+
if (column.display !== false) {
|
|
206
|
+
return index.h(TableData, { data: value, groupId: this.groupId });
|
|
207
|
+
}
|
|
208
|
+
}), this.actions && this.renderActions(row, index$1))));
|
|
260
209
|
}
|
|
261
210
|
/**
|
|
262
|
-
|
|
263
|
-
* private functions
|
|
264
|
-
*/
|
|
265
|
-
/**
|
|
266
|
-
* render() function
|
|
267
|
-
* Always the last one in the class.
|
|
211
|
+
* Render Methods
|
|
268
212
|
*/
|
|
269
213
|
render() {
|
|
270
|
-
return (index.h(index.Host, {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
214
|
+
return (index.h(index.Host, { class: {
|
|
215
|
+
[`duet-editable-table-${this.variation}`]: true,
|
|
216
|
+
[`duet-editable-table-${this.theme}`]: true,
|
|
217
|
+
// sticky only valid when in regular table layout
|
|
218
|
+
"duet-editable-table-scrollable": this.breakpoint === "none-scrollable",
|
|
219
|
+
"duet-editable-table-sortable": this.sortable,
|
|
220
|
+
"duet-editable-table-actions": !!this.actions,
|
|
221
|
+
"duet-m-0": this.margin === "none",
|
|
222
|
+
"duet-theme-turva": this.theme === "turva",
|
|
223
|
+
} }, index.h("duet-table", { sticky: this.sticky, stickyDistance: this.stickyDistance, margin: this.margin, theme: this.theme, variation: this.variation, breakpoint: this.breakpoint }, index.h("table", { role: this.accessibleRole }, index.h("caption", null, index.h("slot", { name: "tcaption" })), index.h("thead", null, index.h("tr", null, index.h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, index.h("slot", { name: "thead-first" }))), this.renderTableHeader(), index.h("tr", null, index.h("td", { class: "duet-editable-table-actions-menu", colSpan: 99 }, index.h("slot", { name: "thead-last" })))), index.h("tbody", null, this.renderTableBody()), index.h("tfoot", null, index.h("tr", null, index.h("th", { class: "duet-editable-table-footer-menu", colSpan: 99 }, index.h("slot", { name: "tfoot" }))))))));
|
|
278
224
|
}
|
|
279
|
-
get
|
|
280
|
-
static get watchers() { return {
|
|
281
|
-
"data": ["watchPropHandler"]
|
|
282
|
-
}; }
|
|
225
|
+
get element() { return index.getElement(this); }
|
|
283
226
|
};
|
|
284
|
-
|
|
227
|
+
DuetEditableTable.style = duetEditableTableCss;
|
|
285
228
|
|
|
286
|
-
const duetTableCss = "duet-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-bottom:20px !important;display:block;font-variant-numeric:tabular-nums}duet-table table,duet-table thead,duet-table tbody,duet-table tfoot,duet-table th,duet-table td,duet-table tr{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}duet-table.duet-m-0{margin:0 !important}duet-table table{width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;text-align:left;border-spacing:0;border-collapse:separate}duet-table.duet-theme-turva table{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}duet-table td{-webkit-hyphens:auto;hyphens:auto;color:#00294d}duet-table.duet-theme-turva td{color:#171c3a}duet-table th{font-weight:600;line-height:1.25;color:#657787;text-align:left}duet-table.duet-theme-turva th{color:#747475}duet-table tbody th{font-weight:600;color:#00294d}duet-table.duet-theme-turva tbody th{color:#171c3a}
|
|
229
|
+
const duetTableCss = "duet-table{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none;margin-bottom:20px !important;display:block;font-variant-numeric:tabular-nums}duet-table table,duet-table thead,duet-table tbody,duet-table tfoot,duet-table th,duet-table td,duet-table tr{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}duet-table.duet-m-0{margin:0 !important}duet-table table{width:100%;font-family:\"localtapiola-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\";font-size:1rem;text-align:left;border-spacing:0;border-collapse:separate}duet-table.duet-theme-turva table{font-family:\"turva-sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"}duet-table td{-webkit-hyphens:auto;hyphens:auto;color:#00294d}duet-table.duet-theme-turva td{color:#171c3a}duet-table th{font-weight:600;line-height:1.25;color:#657787;text-align:left}duet-table.duet-theme-turva th{color:#747475}duet-table tbody th{font-weight:600;color:#00294d}duet-table.duet-theme-turva tbody th{color:#171c3a}duet-table .duet-table-action-row td:last-child{justify-self:end;padding-right:20px !important;white-space:nowrap}.duet-table-flattened tbody tr{display:grid;grid-template-columns:repeat(2, 1fr);grid-auto-rows:auto;gap:10px}.duet-table-flattened tbody tr.duet-table-action-row td:last-child::before{padding:0;content:\"\"}.duet-table-flattened thead tr{position:absolute !important;top:0;width:1px !important;height:1px !important;padding:0 !important;overflow:hidden !important;clip:rect(1px, 1px, 1px, 1px) !important;border:0 !important}.duet-table-flattened td{grid-column:1/2;line-height:1.25}.duet-table-flattened td:not(:last-child){margin-bottom:16px !important}.duet-table-flattened td:first-child{grid-row:1;grid-column:1}.duet-table-flattened td:last-child{grid-row:1;grid-column:2}.duet-table-flattened tbody td,.duet-table-flattened tbody th,.duet-table-flattened tfoot td{padding:0 !important;text-align:left !important}.duet-table-flattened tbody th{font-weight:600;line-height:1.25;color:#657787;text-align:left}.duet-table-flattened td[data-heading]::before{margin-bottom:4px !important;display:block;font-size:1rem;font-weight:600;color:#00294d;content:attr(data-heading)}.duet-table-flattened.duet-theme-turva td[data-heading]::before{color:#171c3a}.duet-table-sticky thead th{position:sticky;top:0;background:white}.duet-table-striped td,.duet-table-striped th{padding:20px !important}@media (max-width: 35.9375em){.duet-table-striped td,.duet-table-striped th{padding:20px 12px !important}}.duet-table-striped tbody th{background:white}.duet-table-striped.duet-table-sticky thead th{border-bottom:1px solid #e1e3e6}.duet-table-striped.duet-table-sticky.duet-theme-turva thead th{border-bottom-color:#e4e4e6}.duet-table-striped tbody:not(:first-of-type) th{padding-top:40px !important}.duet-table-striped tbody:only-of-type tr:nth-of-type(odd){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:only-of-type tr:nth-of-type(odd){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(0, 80, 128, 0.04)}.duet-table-striped.duet-theme-turva tbody:not(:only-of-type) tr:nth-of-type(even){background:rgba(23, 28, 58, 0.04)}.duet-table-striped tfoot td{border-top:1px solid #e1e3e6}.duet-table-striped.duet-theme-turva tfoot td{border-top-color:#e4e4e6}.duet-table-striped.duet-table-flattened tbody:not(:first-of-type) th{padding-top:20px !important}.duet-table-striped.duet-table-flattened tr{padding:20px !important}.duet-table-striped.duet-table-flattened tfoot td{border-top:0}.duet-table-striped.duet-table-flattened tfoot tr{border-top:1px solid #e1e3e6}.duet-table-striped.duet-table-flattened.duet-theme-turva tfoot tr{border-top-color:#e4e4e6}.duet-table-fixed th,.duet-table-minimal th,.duet-table-plain th{padding:16px !important;border-bottom:1px solid #657787}.duet-table-fixed th:first-child,.duet-table-minimal th:first-child,.duet-table-plain th:first-child{padding-left:0 !important}.duet-table-fixed th:last-child,.duet-table-minimal th:last-child,.duet-table-plain th:last-child{padding-right:0 !important}.duet-theme-turva.duet-table-fixed th,.duet-theme-turva.duet-table-minimal th,.duet-theme-turva.duet-table-plain th{border-bottom-color:#444445}.duet-table-fixed tbody th,.duet-table-minimal tbody th,.duet-table-plain tbody th{padding-top:40px !important;border-bottom-color:#e1e3e6}.duet-theme-turva.duet-table-fixed tbody th,.duet-theme-turva.duet-table-minimal tbody th,.duet-theme-turva.duet-table-plain tbody th{border-bottom-color:#e4e4e6}.duet-table-fixed td,.duet-table-minimal td,.duet-table-plain td{padding:16px !important}.duet-table-fixed td:first-child,.duet-table-minimal td:first-child,.duet-table-plain td:first-child{padding-left:0 !important}.duet-table-fixed td:last-child,.duet-table-minimal td:last-child,.duet-table-plain td:last-child{padding-right:0 !important}.duet-table-fixed tbody td,.duet-table-minimal tbody td,.duet-table-plain tbody td{border-bottom:1px solid #e1e3e6}.duet-theme-turva.duet-table-fixed tbody td,.duet-theme-turva.duet-table-minimal tbody td,.duet-theme-turva.duet-table-plain tbody td{border-bottom-color:#e4e4e6}.duet-table-flattened.duet-table-fixed tbody:first-of-type th,.duet-table-flattened.duet-table-minimal tbody:first-of-type th,.duet-table-flattened.duet-table-plain tbody:first-of-type th{padding-top:0 !important}.duet-table-flattened.duet-table-fixed td,.duet-table-flattened.duet-table-minimal td,.duet-table-flattened.duet-table-plain td,.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{border-bottom:0}.duet-table-flattened.duet-table-fixed tr,.duet-table-flattened.duet-table-minimal tr,.duet-table-flattened.duet-table-plain tr{padding:20px 0 !important}.duet-table-flattened.duet-table-fixed tbody th,.duet-table-flattened.duet-table-minimal tbody th,.duet-table-flattened.duet-table-plain tbody th{padding-top:20px !important}.duet-table-flattened.duet-table-fixed tfoot td,.duet-table-flattened.duet-table-minimal tfoot td,.duet-table-flattened.duet-table-plain tfoot td{margin-bottom:4px !important}.duet-table-flattened.duet-table-fixed tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-minimal tbody:not(:only-of-type) tr:first-child,.duet-table-flattened.duet-table-plain tbody:not(:only-of-type) tr:first-child{border-bottom:0}.duet-table-plain.duet-table-flattened tbody tr{border-bottom:1px solid #e1e3e6}.duet-table-plain.duet-table-flattened.duet-theme-turva tbody tr{border-bottom-color:#e4e4e6}.duet-table-minimal tbody tr,.duet-table-minimal tbody tr td{vertical-align:top;border-bottom:0 none}.duet-table-minimal tbody tr:last-of-type,.duet-table-minimal tbody tr:last-of-type td{border-bottom:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened tbody tr,.duet-table-minimal.duet-table-flattened tbody tr td{border-bottom:0 none}.duet-table-minimal.duet-table-flattened tbody tr td[data-heading]::before{display:none}.duet-table-minimal.duet-table-flattened tfoot{border-top:1px solid #e1e3e6}.duet-table-minimal.duet-table-flattened.duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-fixed table{table-layout:fixed}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td,.duet-table-fixed tbody tr td:first-child{padding:4px !important;vertical-align:text-bottom;border-bottom:0 none}.duet-table-fixed thead{display:none}.duet-table-fixed tbody tr,.duet-table-fixed tbody tr td{border-bottom:0 none}.duet-table-fixed:not(.duet-table-flattened) tfoot{border-top:1px solid #e1e3e6}.duet-table-fixed:not(.duet-table-flattened).duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-scrollable{position:relative;width:100%;overflow-x:auto;background:linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0)), linear-gradient(-90deg, #fff 0%, rgba(255, 255, 255, 0)) 100% 0, radial-gradient(farthest-side at 0% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)), radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)) 100% 0%;background-repeat:no-repeat;background-attachment:local, local, scroll, scroll;background-size:100px 100%, 100px 100%, 12px 100%, 12px 100%}.duet-table-selected-column{background:rgba(0, 119, 179, 0.08)}.duet-theme-turva .duet-table-selected-column{background:rgba(68, 68, 69, 0.08)}.duet-table-sortable tbody tr td:first-child,.duet-table-sortable thead tr th:first-child{padding:20px}.duet-table-sortable:not(.duet-table-flattened) tfoot{border-top:1px solid #e1e3e6}.duet-table-sortable:not(.duet-table-flattened).duet-theme-turva tfoot{border-top-color:#e4e4e6}.duet-table-actions table{table-layout:auto}.duet-table-actions thead th:last-child{width:1px;white-space:nowrap}";
|
|
287
230
|
|
|
288
231
|
// remove wrapping speech marks.
|
|
289
232
|
// media query tokens are wrapped in speech marks,
|
|
@@ -343,9 +286,9 @@ let DuetTable = class {
|
|
|
343
286
|
}
|
|
344
287
|
connectedCallback() {
|
|
345
288
|
this.mq = matchMedia(breakpointToToken[this.breakpoint]);
|
|
346
|
-
this.mq.addEventListener("change", this.handleMediaQueryChange);
|
|
289
|
+
this.mq.addEventListener("change", jsUtils.debounce(this.handleMediaQueryChange, 50));
|
|
347
290
|
this.handleMediaQueryChange(this.mq);
|
|
348
|
-
this.observer = new MutationObserver(() => this.copyHeadingsToCells());
|
|
291
|
+
this.observer = new MutationObserver(() => jsUtils.debounce(this.copyHeadingsToCells(), 50));
|
|
349
292
|
this.observer.observe(this.element, {
|
|
350
293
|
childList: true,
|
|
351
294
|
subtree: true,
|
|
@@ -376,6 +319,9 @@ let DuetTable = class {
|
|
|
376
319
|
this.mq = null;
|
|
377
320
|
this.matchesBreakpoint = true;
|
|
378
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Local methods.
|
|
324
|
+
*/
|
|
379
325
|
copyHeadingsToCells() {
|
|
380
326
|
const headingElements = this.element.querySelectorAll("thead th");
|
|
381
327
|
const rowElements = this.element.querySelectorAll("tbody tr");
|
|
@@ -651,7 +597,7 @@ const validateFile = (item, validators) => {
|
|
|
651
597
|
if (item) {
|
|
652
598
|
const { name, type, size } = item;
|
|
653
599
|
const mime = validateFileMime(type, allowedMimetypes);
|
|
654
|
-
const ext = validateFileExtension(name, allowedExtensions);
|
|
600
|
+
const ext = validateFileExtension(name.toLowerCase(), allowedExtensions);
|
|
655
601
|
const bytes = validateFileSize(size, maxBytes);
|
|
656
602
|
if (!mime) {
|
|
657
603
|
errorMessage = getError("duet-upload-101");
|
|
@@ -731,7 +677,7 @@ const makeXhrRequest = ({ payload, options, onFailure, onSuccess, onProgress })
|
|
|
731
677
|
return xhr;
|
|
732
678
|
};
|
|
733
679
|
|
|
734
|
-
const duetUploadCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}::slotted([slot=header]){margin-bottom:16px}::slotted([slot=fileheader]){margin:16px 0 0 0}::slotted([slot=filefooter]){margin-top:16px}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload-item-size{font-size:0.75rem;font-weight:400}.duet-upload-filelist{margin-bottom:25px}.duet-upload-filelist-empty{display:flex;align-items:center;justify-content:center;width:100%;height:75px;margin:0 auto;font-size:1rem;font-weight:400;background-color:#f5f8fa}";
|
|
680
|
+
const duetUploadCss = "*,*::after,*::before{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}:host{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}::slotted([slot=header]){margin-bottom:16px}::slotted([slot=fileheader]){margin:16px 0 0 0}::slotted([slot=filefooter]){margin-top:16px}.duet-upload{box-sizing:border-box;padding:0;margin:0;background:transparent;border:0;-moz-appearance:none;-webkit-appearance:none;appearance:none}.duet-upload-item-size{font-size:0.75rem;font-weight:400}.duet-upload-filelist{margin-bottom:25px}.duet-upload-filelist-empty{display:flex;align-items:center;justify-content:center;width:100%;height:75px;margin:0 auto;font-size:1rem;font-weight:400;background-color:#f5f8fa}.duet-upload-editable-table-header-hidden{display:none}.duet-upload-editable-table tbody .duet-upload-editable-table-data{padding:0 !important;border:0}.duet-upload-editable-table duet-editable-table tfoot,.duet-upload-editable-table duet-editable-table thead{display:none}.duet-upload-editable-table duet-editable-table .duet-editable-table-content{padding-right:0 !important;padding-left:0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td{padding:0.75rem 0 !important}.duet-upload-editable-table duet-editable-table duet-table .duet-table-action-row td:last-child{padding-right:0 !important}.duet-upload-editable-table duet-editable-table .duet-editable-table-row-inprogress duet-action-button::part(button){border:0}";
|
|
735
681
|
|
|
736
682
|
let DuetUpload = class {
|
|
737
683
|
constructor(hostRef) {
|
|
@@ -745,25 +691,6 @@ let DuetUpload = class {
|
|
|
745
691
|
this.duetCancel = index.createEvent(this, "duetCancel", 3);
|
|
746
692
|
this.duetProgress = index.createEvent(this, "duetProgress", 3);
|
|
747
693
|
this.duetUpload = index.createEvent(this, "duetUpload", 3);
|
|
748
|
-
/**
|
|
749
|
-
* Own Properties
|
|
750
|
-
*/
|
|
751
|
-
this.buttonId = createId.createID("DuetButton");
|
|
752
|
-
this.labelId = createId.createID("DuetLabel");
|
|
753
|
-
this.uploadId = createId.createID("DuetUpload");
|
|
754
|
-
this.editableTableId = createId.createID("DuetEditableTable");
|
|
755
|
-
this.filesInProgress = new Map();
|
|
756
|
-
this.fileMaxReached = false;
|
|
757
|
-
this.bytesMaxReached = false;
|
|
758
|
-
this.internalStatusMessageLabel = undefined;
|
|
759
|
-
/**
|
|
760
|
-
* Properties
|
|
761
|
-
*/
|
|
762
|
-
this.DefaultGroups = {
|
|
763
|
-
inprogress: "inprogress",
|
|
764
|
-
success: "success",
|
|
765
|
-
failure: "failure",
|
|
766
|
-
};
|
|
767
694
|
/**
|
|
768
695
|
* State() variables
|
|
769
696
|
*/
|
|
@@ -785,8 +712,9 @@ let DuetUpload = class {
|
|
|
785
712
|
{
|
|
786
713
|
icon: "action-delete",
|
|
787
714
|
color: "color-danger",
|
|
788
|
-
|
|
789
|
-
|
|
715
|
+
size: "x-small",
|
|
716
|
+
background: "gray-lightest",
|
|
717
|
+
name: "delete",
|
|
790
718
|
map: ["success", "failure"],
|
|
791
719
|
label: {
|
|
792
720
|
fi: "Poista tiedosto",
|
|
@@ -797,8 +725,9 @@ let DuetUpload = class {
|
|
|
797
725
|
{
|
|
798
726
|
icon: "navigation-close",
|
|
799
727
|
color: "primary",
|
|
800
|
-
|
|
801
|
-
|
|
728
|
+
size: "x-small",
|
|
729
|
+
background: "gray-lightest",
|
|
730
|
+
name: "cancel",
|
|
802
731
|
map: ["inprogress"],
|
|
803
732
|
label: {
|
|
804
733
|
fi: "Keskeytä lähetys",
|
|
@@ -868,8 +797,8 @@ let DuetUpload = class {
|
|
|
868
797
|
inProgressWithErrors: "Uploading {filesInProgress}, {filesUploaded} uploaded of {filesTotal}, {filesWithErrors} failed",
|
|
869
798
|
done: "All {filesTotal} added successfully",
|
|
870
799
|
doneWithErrors: "Action completed, {filesUploaded} has been added successfully, {filesWithErrors} had errors",
|
|
871
|
-
files: "
|
|
872
|
-
file: "
|
|
800
|
+
files: "File",
|
|
801
|
+
file: "file",
|
|
873
802
|
},
|
|
874
803
|
};
|
|
875
804
|
/**
|
|
@@ -1024,19 +953,72 @@ let DuetUpload = class {
|
|
|
1024
953
|
* by default this is off, setting this to true will limit the users choices to what has been explicitly set
|
|
1025
954
|
*/
|
|
1026
955
|
this.limitSelection = false;
|
|
956
|
+
/**
|
|
957
|
+
* Own Properties
|
|
958
|
+
*/
|
|
959
|
+
this.buttonId = createId.createID("DuetButton");
|
|
960
|
+
this.labelId = createId.createID("DuetLabel");
|
|
961
|
+
this.uploadId = createId.createID("DuetUpload");
|
|
962
|
+
this.filesInProgress = new Map();
|
|
963
|
+
this.fileMaxReached = false;
|
|
964
|
+
this.bytesMaxReached = false;
|
|
965
|
+
this.internalStatusMessageLabel = undefined;
|
|
966
|
+
/**
|
|
967
|
+
* Properties
|
|
968
|
+
*/
|
|
969
|
+
this.DefaultGroups = {
|
|
970
|
+
inprogress: "inprogress",
|
|
971
|
+
success: "success",
|
|
972
|
+
failure: "failure",
|
|
973
|
+
};
|
|
974
|
+
/**
|
|
975
|
+
* Array of group names that you want the editable table to use to display files
|
|
976
|
+
* @required
|
|
977
|
+
* @example [{ id: "success", label: {fi: "Onnistunut", en: "Success", sv: "Alt klart", }}]
|
|
978
|
+
*/
|
|
979
|
+
this.groups = [
|
|
980
|
+
{
|
|
981
|
+
id: this.DefaultGroups.inprogress,
|
|
982
|
+
label: {
|
|
983
|
+
fi: "Kesken olevat tiedostot",
|
|
984
|
+
sv: "Filer inprogress",
|
|
985
|
+
en: "Files inprogress",
|
|
986
|
+
},
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
id: this.DefaultGroups.success,
|
|
990
|
+
label: {
|
|
991
|
+
fi: "Valmiit tiedostot",
|
|
992
|
+
sv: "Files success",
|
|
993
|
+
en: "Files success",
|
|
994
|
+
},
|
|
995
|
+
},
|
|
996
|
+
{
|
|
997
|
+
id: this.DefaultGroups.failure,
|
|
998
|
+
label: {
|
|
999
|
+
fi: "Tiedostot, joissa on virheitä",
|
|
1000
|
+
sv: "Filer med fel",
|
|
1001
|
+
en: "Files with errors",
|
|
1002
|
+
},
|
|
1003
|
+
},
|
|
1004
|
+
];
|
|
1005
|
+
this.kick = jsUtils.debounce(() => {
|
|
1006
|
+
this.tick = Date.now();
|
|
1007
|
+
}, 30); // will trigger re-render
|
|
1027
1008
|
/**
|
|
1028
1009
|
* Private functions
|
|
1029
1010
|
*/
|
|
1030
1011
|
this.listenForActionEvents = () => {
|
|
1031
|
-
this.element.addEventListener("
|
|
1012
|
+
this.element.addEventListener("duetActionEvent", (e) => {
|
|
1032
1013
|
const detail = e.detail;
|
|
1033
|
-
const { action,
|
|
1014
|
+
const { action, id, originalEvent } = detail;
|
|
1015
|
+
console.log(e);
|
|
1034
1016
|
switch (action) {
|
|
1035
1017
|
case "delete":
|
|
1036
|
-
this.onDelete(
|
|
1018
|
+
this.onDelete(id, originalEvent);
|
|
1037
1019
|
break;
|
|
1038
1020
|
case "cancel":
|
|
1039
|
-
this.onCancel(
|
|
1021
|
+
this.onCancel(id, originalEvent);
|
|
1040
1022
|
break;
|
|
1041
1023
|
// code block
|
|
1042
1024
|
}
|
|
@@ -1093,24 +1075,6 @@ let DuetUpload = class {
|
|
|
1093
1075
|
return "none";
|
|
1094
1076
|
}
|
|
1095
1077
|
};
|
|
1096
|
-
this.convertToDuetEditableTableItems = () => {
|
|
1097
|
-
// we're always recreating the map - in order to force an update down stream.
|
|
1098
|
-
const itemData = new Map();
|
|
1099
|
-
//walk the files Map and convert to DuetEditableTableItemData
|
|
1100
|
-
this.files.forEach((data, key, _originalMap) => {
|
|
1101
|
-
const group = this.getGroupFromItemData(data);
|
|
1102
|
-
const item = this.getItemHTMLFromItemData(data, group);
|
|
1103
|
-
itemData.set(key, {
|
|
1104
|
-
uid: data.uid,
|
|
1105
|
-
item,
|
|
1106
|
-
group,
|
|
1107
|
-
});
|
|
1108
|
-
});
|
|
1109
|
-
return itemData;
|
|
1110
|
-
};
|
|
1111
|
-
this.kick = jsUtils.debounce(() => {
|
|
1112
|
-
this.tick = Date.now();
|
|
1113
|
-
}, 30); // will trigger re-render
|
|
1114
1078
|
this.genHashName = () => Date.now().toString(36) + Math.random();
|
|
1115
1079
|
this.updateValueInMap = (item, key, value, kick = true) => {
|
|
1116
1080
|
const fileItem = this.files.get(item);
|
|
@@ -1171,7 +1135,6 @@ let DuetUpload = class {
|
|
|
1171
1135
|
this.nativeInput.value = "";
|
|
1172
1136
|
};
|
|
1173
1137
|
this.startUpload = async (ev, metaData = undefined) => {
|
|
1174
|
-
await this.setFocus();
|
|
1175
1138
|
this.metaData = metaData;
|
|
1176
1139
|
this.nativeInput.click();
|
|
1177
1140
|
this.onUpload(ev, metaData);
|
|
@@ -1234,9 +1197,18 @@ let DuetUpload = class {
|
|
|
1234
1197
|
fileMaxReached: isTotalFileAmountAboveMax,
|
|
1235
1198
|
};
|
|
1236
1199
|
};
|
|
1200
|
+
this.getItemFromUID = (uid) => {
|
|
1201
|
+
for (const [key, value] of this.files.entries()) {
|
|
1202
|
+
if (value.uid === uid) {
|
|
1203
|
+
return { value, key };
|
|
1204
|
+
}
|
|
1205
|
+
}
|
|
1206
|
+
return null;
|
|
1207
|
+
};
|
|
1237
1208
|
this.onDelete = (key, ev) => {
|
|
1238
|
-
const
|
|
1239
|
-
this.files.
|
|
1209
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
1210
|
+
const deletedItem = this.files.get(retrievedKey);
|
|
1211
|
+
this.files.delete(retrievedKey);
|
|
1240
1212
|
this.validateTotals();
|
|
1241
1213
|
this.kick();
|
|
1242
1214
|
this.duetDelete.emit({
|
|
@@ -1250,8 +1222,9 @@ let DuetUpload = class {
|
|
|
1250
1222
|
this.resetFormFields();
|
|
1251
1223
|
};
|
|
1252
1224
|
this.onCancel = (key, ev) => {
|
|
1253
|
-
const
|
|
1254
|
-
this.files.
|
|
1225
|
+
const retrievedKey = this.getItemFromUID(key).key;
|
|
1226
|
+
const cancelledItem = this.files.get(retrievedKey);
|
|
1227
|
+
this.files.delete(retrievedKey);
|
|
1255
1228
|
if (!this.external) {
|
|
1256
1229
|
const { xhr } = cancelledItem;
|
|
1257
1230
|
xhr.abort();
|
|
@@ -1301,6 +1274,79 @@ let DuetUpload = class {
|
|
|
1301
1274
|
data: { files: this.files },
|
|
1302
1275
|
});
|
|
1303
1276
|
};
|
|
1277
|
+
/**
|
|
1278
|
+
* @description This functions return sorted map items byg condition which are:
|
|
1279
|
+
*/
|
|
1280
|
+
this.filterMap = () => {
|
|
1281
|
+
const all = [...this.files.values()];
|
|
1282
|
+
const inprogress = [];
|
|
1283
|
+
const failure = [];
|
|
1284
|
+
const success = [];
|
|
1285
|
+
all.forEach(data => {
|
|
1286
|
+
const group = this.getGroupFromItemData(data);
|
|
1287
|
+
const item = this.getItemHTMLFromItemData(data, group);
|
|
1288
|
+
if (group === this.DefaultGroups.success) {
|
|
1289
|
+
success.push({
|
|
1290
|
+
uid: data.uid,
|
|
1291
|
+
item,
|
|
1292
|
+
group,
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
else if (group === this.DefaultGroups.inprogress) {
|
|
1296
|
+
inprogress.push({
|
|
1297
|
+
uid: data.uid,
|
|
1298
|
+
item,
|
|
1299
|
+
group,
|
|
1300
|
+
});
|
|
1301
|
+
}
|
|
1302
|
+
else if (group === this.DefaultGroups.failure) {
|
|
1303
|
+
failure.push({
|
|
1304
|
+
uid: data.uid,
|
|
1305
|
+
item,
|
|
1306
|
+
group,
|
|
1307
|
+
});
|
|
1308
|
+
}
|
|
1309
|
+
else if (data.group) {
|
|
1310
|
+
inprogress.push({
|
|
1311
|
+
uid: data.uid,
|
|
1312
|
+
item,
|
|
1313
|
+
group: data.group,
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
return {
|
|
1318
|
+
inprogress,
|
|
1319
|
+
failure,
|
|
1320
|
+
success,
|
|
1321
|
+
};
|
|
1322
|
+
};
|
|
1323
|
+
this.getColumns = (group) => {
|
|
1324
|
+
return [
|
|
1325
|
+
{
|
|
1326
|
+
sort_order: 1,
|
|
1327
|
+
direction: 1,
|
|
1328
|
+
index: 0,
|
|
1329
|
+
key: group.id,
|
|
1330
|
+
label: group.label,
|
|
1331
|
+
},
|
|
1332
|
+
];
|
|
1333
|
+
};
|
|
1334
|
+
this.getActions = (id) => {
|
|
1335
|
+
return this.actions.filter(item => item.map.includes(id));
|
|
1336
|
+
};
|
|
1337
|
+
this.renderEditableTableGroups = () => {
|
|
1338
|
+
const filteredItems = this.filterMap();
|
|
1339
|
+
const EditableTables = this.groups.map(group => {
|
|
1340
|
+
const currentItems = filteredItems[group.id];
|
|
1341
|
+
if (!(currentItems === null || currentItems === void 0 ? void 0 : currentItems.length)) {
|
|
1342
|
+
return;
|
|
1343
|
+
}
|
|
1344
|
+
return (index.h("duet-table", { variation: "plain", breakpoint: "none", role: "log", margin: this.hideGroups ? "none" : "auto" }, index.h("table", { class: "duet-upload-editable-table" }, index.h("thead", { class: "duet-upload-editable-table-header" }, index.h("tr", null, index.h("th", { class: {
|
|
1345
|
+
"duet-upload-editable-table-header-hidden": this.hideGroups,
|
|
1346
|
+
} }, !this.hideGroups ? (languageUtils.getLocaleString(group.label)) : (index.h("duet-visually-hidden", null, languageUtils.getLocaleString(group.label)))))), index.h("tbody", null, index.h("tr", null, index.h("td", { class: "duet-upload-editable-table-data" }, index.h("duet-editable-table", { breakpoint: "none", variation: "plain", groupId: group.id, columns: this.getColumns(group), actions: this.getActions(group.id), margin: "none", rows: currentItems })))))));
|
|
1347
|
+
});
|
|
1348
|
+
return EditableTables;
|
|
1349
|
+
};
|
|
1304
1350
|
}
|
|
1305
1351
|
watchValidHandler(newValue, oldValue) {
|
|
1306
1352
|
if (newValue !== oldValue) {
|
|
@@ -1324,6 +1370,68 @@ let DuetUpload = class {
|
|
|
1324
1370
|
// listen to the events from the component
|
|
1325
1371
|
this.verifyValidity();
|
|
1326
1372
|
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
1375
|
+
* `input.focus()`.
|
|
1376
|
+
*/
|
|
1377
|
+
async setFocus(options) {
|
|
1378
|
+
if (this.nativeInput) {
|
|
1379
|
+
this.nativeInput.focus(options);
|
|
1380
|
+
}
|
|
1381
|
+
return;
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Method for invoking the upload sequence
|
|
1385
|
+
*/
|
|
1386
|
+
async upload(metaData = undefined) {
|
|
1387
|
+
await this.setFocus();
|
|
1388
|
+
this.metaData = metaData;
|
|
1389
|
+
this.nativeInput.click();
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
/**
|
|
1393
|
+
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
1394
|
+
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
1395
|
+
* the tabular data if the automatic re-render is no sufficient
|
|
1396
|
+
*/
|
|
1397
|
+
async refresh() {
|
|
1398
|
+
this.kick();
|
|
1399
|
+
await this.setFocus();
|
|
1400
|
+
}
|
|
1401
|
+
/**
|
|
1402
|
+
* Get list of files, divided in errors and valid sections
|
|
1403
|
+
*/
|
|
1404
|
+
async getFiles() {
|
|
1405
|
+
if (!this.files || this.files.size === 0) {
|
|
1406
|
+
return false;
|
|
1407
|
+
}
|
|
1408
|
+
return this.getFilesAsArray();
|
|
1409
|
+
}
|
|
1410
|
+
/**
|
|
1411
|
+
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
1412
|
+
*/
|
|
1413
|
+
async updateValue(item, key, value) {
|
|
1414
|
+
this.updateValueInMap(item, key, value);
|
|
1415
|
+
}
|
|
1416
|
+
/**
|
|
1417
|
+
* render() function
|
|
1418
|
+
* Always the last one in the class.
|
|
1419
|
+
*/
|
|
1420
|
+
render() {
|
|
1421
|
+
const identifier = this.identifier || this.uploadId;
|
|
1422
|
+
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
1423
|
+
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
1424
|
+
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
1425
|
+
return (index.h(index.Host, { class: { "duet-m-0": this.margin === "none" } }, index.h("duet-fieldset", { label: this.label, caption: caption }, index.h("slot", { name: "header" }), !this.files.size && (index.h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
|
|
1426
|
+
"duet-upload-filelist-empty": !this.files.size,
|
|
1427
|
+
"duet-upload-filelist": true,
|
|
1428
|
+
"duet-upload-filelist-filled": this.files.size,
|
|
1429
|
+
}, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && index.h("slot", { name: "fileheader" }), !!this.files.size && (index.h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })), !!this.files.size && this.renderEditableTableGroups(), !!this.files.size && index.h("slot", { name: "filefooter" }), index.h("duet-spacer", { size: "large" }), !this.hideButton && (index.h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle", part: this.identifier ? `${this.identifier}-button-upload` : "duet-upload-button-upload" }, this.buttonLabel)), index.h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (index.h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" }, this.fileMaxReached && getI18nError("duet-upload-301"), this.bytesMaxReached && getI18nError("duet-upload-202"))), index.h("duet-spacer", { size: "medium" }), index.h("duet-visually-hidden", null, index.h("input", { ref: input => {
|
|
1430
|
+
this.nativeInput = input;
|
|
1431
|
+
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
1432
|
+
"duet-upload": true,
|
|
1433
|
+
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
1434
|
+
}
|
|
1327
1435
|
/**
|
|
1328
1436
|
* XHR request utilities
|
|
1329
1437
|
*/
|
|
@@ -1445,68 +1553,6 @@ let DuetUpload = class {
|
|
|
1445
1553
|
component: "duet-upload",
|
|
1446
1554
|
});
|
|
1447
1555
|
}
|
|
1448
|
-
/**
|
|
1449
|
-
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
1450
|
-
* `input.focus()`.
|
|
1451
|
-
*/
|
|
1452
|
-
async setFocus(options) {
|
|
1453
|
-
if (this.nativeInput) {
|
|
1454
|
-
this.nativeInput.focus(options);
|
|
1455
|
-
}
|
|
1456
|
-
return;
|
|
1457
|
-
}
|
|
1458
|
-
/**
|
|
1459
|
-
* Method for invoking the upload sequence
|
|
1460
|
-
*/
|
|
1461
|
-
async upload(metaData = undefined) {
|
|
1462
|
-
await this.setFocus();
|
|
1463
|
-
this.metaData = metaData;
|
|
1464
|
-
this.nativeInput.click();
|
|
1465
|
-
return;
|
|
1466
|
-
}
|
|
1467
|
-
/**
|
|
1468
|
-
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
1469
|
-
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
1470
|
-
* the tabular data if the automatic re-render is no sufficient
|
|
1471
|
-
*/
|
|
1472
|
-
async refresh() {
|
|
1473
|
-
this.kick();
|
|
1474
|
-
await this.setFocus();
|
|
1475
|
-
}
|
|
1476
|
-
/**
|
|
1477
|
-
* Get list of files, divided in errors and valid sections
|
|
1478
|
-
*/
|
|
1479
|
-
async getFiles() {
|
|
1480
|
-
if (!this.files || this.files.size === 0) {
|
|
1481
|
-
return false;
|
|
1482
|
-
}
|
|
1483
|
-
return this.getFilesAsArray();
|
|
1484
|
-
}
|
|
1485
|
-
/**
|
|
1486
|
-
* Convenience method for updating the value of a key:value inside an item in the files attribute
|
|
1487
|
-
*/
|
|
1488
|
-
async updateValue(item, key, value) {
|
|
1489
|
-
this.updateValueInMap(item, key, value);
|
|
1490
|
-
}
|
|
1491
|
-
/**
|
|
1492
|
-
* render() function
|
|
1493
|
-
* Always the last one in the class.
|
|
1494
|
-
*/
|
|
1495
|
-
render() {
|
|
1496
|
-
const identifier = this.identifier || this.uploadId;
|
|
1497
|
-
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
1498
|
-
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
1499
|
-
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
1500
|
-
return (index.h(index.Host, { class: { "duet-m-0": this.margin === "none" } }, index.h("duet-fieldset", { label: this.label, caption: caption }, index.h("slot", { name: "header" }), !this.files.size && (index.h("duet-label", { part: this.identifier ? `${this.identifier}-empty-state` : "duet-upload-empty-state", theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
|
|
1501
|
-
"duet-upload-filelist-empty": !this.files.size,
|
|
1502
|
-
"duet-upload-filelist": true,
|
|
1503
|
-
"duet-upload-filelist-filled": this.files.size,
|
|
1504
|
-
}, id: this.labelId, for: identifier }, this.fileListEmpty)), !!this.files.size && index.h("slot", { name: "fileheader" }), !!this.files.size && (index.h("duet-upload-aria-status", { invalid: this.getFilesAsArray().invalid.length, valid: this.getFilesAsArray().valid.length, inprogress: this.filesInProgress.size, total: this.files.size, statusMessageLabel: this.internalStatusMessageLabel })), !!this.files.size && (index.h("duet-editable-table", { part: this.identifier ? `${this.identifier}-editable-table` : "duet-upload-editable-table", "aria-live": "polite", "aria-relevant": "removals", accessibleRole: "log", id: this.editableTableId, groups: this.groups, actions: this.actions, hideGroups: this.hideGroups, alignment: this.alignment, items: this.convertToDuetEditableTableItems() })), !!this.files.size && index.h("slot", { name: "filefooter" }), index.h("duet-spacer", { size: "large" }), !this.hideButton && (index.h("duet-button", { id: this.buttonId, onClick: this.startUpload, "accessible-controls": identifier, disabled: this.fileMaxReached, "accessible-label": this.accessibleButtonLabel, "accessible-owns": identifier, size: "small", variation: "secondary", fixed: true, icon: "action-add-circle", part: this.identifier ? `${this.identifier}-button-upload` : "duet-upload-button-upload" }, this.buttonLabel)), index.h("duet-spacer", { size: "medium" }), (this.fileMaxReached || this.bytesMaxReached) && (index.h("duet-alert", { part: this.identifier ? `${this.identifier}-error-notification` : "duet-upload-error-notification" }, this.fileMaxReached && getI18nError("duet-upload-301"), this.bytesMaxReached && getI18nError("duet-upload-202"))), index.h("duet-spacer", { size: "medium" }), index.h("duet-visually-hidden", null, index.h("input", { ref: input => {
|
|
1505
|
-
this.nativeInput = input;
|
|
1506
|
-
}, accept: !this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
1507
|
-
"duet-upload": true,
|
|
1508
|
-
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
1509
|
-
}
|
|
1510
1556
|
get element() { return index.getElement(this); }
|
|
1511
1557
|
static get watchers() { return {
|
|
1512
1558
|
"valid": ["watchValidHandler"]
|
|
@@ -1515,6 +1561,5 @@ let DuetUpload = class {
|
|
|
1515
1561
|
DuetUpload.style = duetUploadCss;
|
|
1516
1562
|
|
|
1517
1563
|
exports.duet_editable_table = DuetEditableTable;
|
|
1518
|
-
exports.duet_editable_table_item = DuetEditableTableItem;
|
|
1519
1564
|
exports.duet_table = DuetTable;
|
|
1520
1565
|
exports.duet_upload = DuetUpload;
|