@duetds/components 5.1.3 → 5.1.6
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 +225 -36
- package/lib/cjs/action-arrow-right-small-a25eb475.js +8 -0
- package/lib/cjs/duet-action-button.cjs.entry.js +17 -6
- 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 +3 -4
- package/lib/cjs/duet-button_2.cjs.entry.js +5 -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 +2 -2
- package/lib/cjs/duet-collapsible.cjs.entry.js +2 -2
- package/lib/cjs/duet-combobox.cjs.entry.js +1 -1
- package/lib/cjs/duet-cookie-consent.cjs.entry.js +1 -1
- package/lib/cjs/duet-date-picker.cjs.entry.js +2 -2
- package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-editable-table_3.cjs.entry.js +105 -27
- 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 +23 -4
- package/lib/cjs/duet-grid_2.cjs.entry.js +2 -2
- package/lib/cjs/duet-header_2.cjs.entry.js +3 -3
- 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 +56 -4
- 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 +1 -1
- 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 +2 -2
- package/lib/cjs/duet-textarea.cjs.entry.js +1 -1
- package/lib/cjs/duet-toggle.cjs.entry.js +1 -1
- package/lib/cjs/duet-tooltip.cjs.entry.js +1 -1
- package/lib/cjs/duet-tray.cjs.entry.js +2 -2
- package/lib/cjs/duet-upload-aria-status.cjs.entry.js +1 -1
- package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
- package/lib/cjs/duet.cjs.js +2 -2
- package/lib/cjs/{focus-utils-85b1fb81.js → focus-utils-9ccade35.js} +1 -1
- package/lib/cjs/{index-a29ba279.js → index-014f74e2.js} +1 -1
- package/lib/cjs/loader.cjs.js +2 -2
- package/lib/cjs/{token-utils-f402e205.js → token-utils-50a1f7e2.js} +16 -1
- package/lib/cjs/{tokens-8596cece.js → tokens-29450bcb.js} +3 -0
- package/lib/cjs/{tokens.module-6b2df1c2.js → tokens.module-ef598645.js} +2 -0
- package/lib/collection/components/duet-action-button/duet-action-button.css +2 -2
- package/lib/collection/components/duet-action-button/duet-action-button.js +14 -2
- package/lib/collection/components/duet-button/duet-button.css +48 -16
- package/lib/collection/components/duet-button/duet-button.js +2 -1
- package/lib/collection/components/duet-footer/duet-footer.css +154 -0
- package/lib/collection/components/duet-footer/duet-footer.js +135 -5
- package/lib/collection/components/duet-input/duet-input.css +49 -0
- package/lib/collection/components/duet-input/duet-input.js +132 -3
- package/lib/collection/components/duet-step/duet-step.js +1 -1
- package/lib/collection/components/duet-stepper/duet-stepper.js +1 -1
- package/lib/collection/components/duet-table/duet-table.js +1 -1
- package/lib/collection/components/duet-upload/duet-upload.js +136 -27
- package/lib/collection/components/duet-upload/upload-editable-item-pending.js +7 -0
- package/lib/collection/utils/token-utils.js +14 -0
- package/lib/custom-elements-bundle/index.js +216 -41
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/{p-632e25d1.system.entry.js → p-00e6a13d.system.entry.js} +1 -1
- package/lib/duet/{p-ac1e6f4b.system.js → p-0447601c.system.js} +1 -1
- package/lib/duet/{p-bc8c3ace.system.js → p-04b00c25.system.js} +1 -1
- package/lib/duet/{p-c435f7e8.entry.js → p-06fde0d1.entry.js} +1 -1
- package/lib/duet/{p-94dc3e07.system.entry.js → p-13d2c818.system.entry.js} +1 -1
- package/lib/duet/p-13df0560.system.entry.js +4 -0
- package/lib/duet/{p-62cc6d2a.entry.js → p-17c7514e.entry.js} +1 -1
- package/lib/duet/p-18cc5627.system.js +4 -0
- package/lib/duet/{p-ebd9782a.system.entry.js → p-19073b04.system.entry.js} +1 -1
- package/lib/duet/{p-497750f2.entry.js → p-1953f729.entry.js} +1 -1
- package/lib/duet/{p-b9120f45.system.entry.js → p-1faf5cfe.system.entry.js} +1 -1
- package/lib/duet/{p-bd322f8f.js → p-206285a6.js} +1 -1
- package/lib/duet/{p-28b24806.system.entry.js → p-21f33ec5.system.entry.js} +1 -1
- package/lib/duet/{p-c2ad83a9.entry.js → p-23779e01.entry.js} +1 -1
- package/lib/duet/{p-f2ad1371.entry.js → p-23b467cc.entry.js} +1 -1
- package/lib/duet/{p-3bf4c99a.entry.js → p-2999ea4f.entry.js} +1 -1
- package/lib/duet/p-2a9db427.system.entry.js +4 -0
- package/lib/duet/{p-e4d54f1e.system.entry.js → p-2daca660.system.entry.js} +1 -1
- package/lib/duet/{p-18e17e10.entry.js → p-2ed50edc.entry.js} +1 -1
- package/lib/duet/{p-8d4c33ed.system.entry.js → p-322ab135.system.entry.js} +1 -1
- package/lib/duet/{p-e530ae17.entry.js → p-35957177.entry.js} +1 -1
- package/lib/duet/p-377f68c5.system.entry.js +4 -0
- package/lib/duet/{p-ad07f399.js → p-398a79a0.js} +1 -1
- package/lib/duet/p-3cc51ea1.entry.js +4 -0
- package/lib/duet/{p-7dec1cfd.entry.js → p-412a2ce3.entry.js} +1 -1
- package/lib/duet/{p-6910ace8.system.entry.js → p-458c1110.system.entry.js} +1 -1
- package/lib/duet/p-47058313.entry.js +4 -0
- package/lib/duet/{p-aaed5ea2.entry.js → p-4727c5c5.entry.js} +1 -1
- package/lib/duet/{p-3e1145b2.entry.js → p-5104272f.entry.js} +1 -1
- package/lib/duet/{p-7e17fd75.system.entry.js → p-513d8f06.system.entry.js} +1 -1
- package/lib/duet/{p-0e6dd740.entry.js → p-5186bfcf.entry.js} +1 -1
- package/lib/duet/{p-acdd49f6.entry.js → p-520d1c93.entry.js} +1 -1
- package/lib/duet/p-54e3d301.system.entry.js +4 -0
- package/lib/duet/{p-28feed35.system.entry.js → p-56ed6884.system.entry.js} +1 -1
- package/lib/duet/p-5752ff1c.entry.js +4 -0
- package/lib/duet/p-583c5a60.entry.js +4 -0
- package/lib/duet/{p-995ecd9d.system.entry.js → p-5c085a4a.system.entry.js} +1 -1
- package/lib/duet/p-6190e2d6.system.js +4 -0
- package/lib/duet/{p-ca79fa1a.js → p-6194272d.js} +1 -1
- package/lib/duet/{p-f0f60ea3.entry.js → p-62915653.entry.js} +1 -1
- package/lib/duet/{p-c06452b7.system.entry.js → p-7020d5a8.system.entry.js} +1 -1
- package/lib/duet/{p-9318e1c2.system.entry.js → p-71c7fa31.system.entry.js} +1 -1
- package/lib/duet/{p-ffbe9ffc.entry.js → p-7a5bf551.entry.js} +1 -1
- package/lib/duet/p-7cbb6eba.js +4 -0
- package/lib/duet/{p-57f58be7.entry.js → p-7de2b748.entry.js} +1 -1
- package/lib/duet/{p-a6b6a918.system.entry.js → p-7fcbf42e.system.entry.js} +1 -1
- package/lib/duet/{p-5a434b4e.system.entry.js → p-84237fd2.system.entry.js} +1 -1
- package/lib/duet/{p-dea3d7f9.system.entry.js → p-8c8f15ed.system.entry.js} +1 -1
- package/lib/duet/{p-d460ac7d.entry.js → p-8fed1e36.entry.js} +1 -1
- package/lib/duet/{p-a3857cd4.system.entry.js → p-90870281.system.entry.js} +1 -1
- package/lib/duet/{p-b683fec1.system.entry.js → p-914a5315.system.entry.js} +1 -1
- package/lib/duet/{p-8ee6f874.system.entry.js → p-96e42603.system.entry.js} +1 -1
- package/lib/duet/p-97900023.entry.js +4 -0
- package/lib/duet/{p-20814483.entry.js → p-99bbbecd.entry.js} +1 -1
- package/lib/duet/p-9cca0bb4.js +4 -0
- package/lib/duet/p-9e759a4a.system.entry.js +4 -0
- package/lib/duet/{p-bd122a6e.system.entry.js → p-9e8afa21.system.entry.js} +1 -1
- package/lib/duet/{p-f8dd1339.entry.js → p-9ff69b54.entry.js} +1 -1
- package/lib/duet/{p-955b90c3.system.entry.js → p-a2eafa77.system.entry.js} +1 -1
- package/lib/duet/{p-2b250ac6.system.entry.js → p-a53ca782.system.entry.js} +1 -1
- package/lib/duet/{p-3f65158e.entry.js → p-a74ed7f0.entry.js} +1 -1
- package/lib/duet/p-a83aa6f3.entry.js +4 -0
- package/lib/duet/p-a93a04b9.system.js +4 -0
- package/lib/duet/p-a9bd0a4b.entry.js +4 -0
- package/lib/duet/{p-f42c4e0f.system.entry.js → p-abdf47c8.system.entry.js} +1 -1
- package/lib/duet/p-ad196791.system.js +4 -0
- package/lib/duet/{p-5e591b97.entry.js → p-ae7580c4.entry.js} +1 -1
- package/lib/duet/{p-cd07c340.entry.js → p-b04e51be.entry.js} +1 -1
- package/lib/duet/{p-456f44e9.system.entry.js → p-b1f08a11.system.entry.js} +1 -1
- package/lib/duet/{p-7df54c59.entry.js → p-b477f0b1.entry.js} +1 -1
- package/lib/duet/{p-2c31428e.system.entry.js → p-b504bfcc.system.entry.js} +1 -1
- package/lib/duet/{p-3e4a5b9c.entry.js → p-b8a6c198.entry.js} +1 -1
- package/lib/duet/{p-4268681b.entry.js → p-ba2d5d3b.entry.js} +1 -1
- package/lib/duet/p-bb05bcf9.entry.js +4 -0
- package/lib/duet/{p-ff5ddd90.system.entry.js → p-bbdbff69.system.entry.js} +1 -1
- package/lib/duet/{p-b7420414.entry.js → p-c1ec46db.entry.js} +1 -1
- package/lib/duet/{p-28e309f1.entry.js → p-c63e58e3.entry.js} +1 -1
- package/lib/duet/{p-adb092e7.entry.js → p-ce936701.entry.js} +1 -1
- package/lib/duet/{p-48307b31.entry.js → p-ced1983f.entry.js} +1 -1
- package/lib/duet/p-cf67a60b.entry.js +4 -0
- package/lib/duet/{p-28e6da82.system.entry.js → p-d132dde7.system.entry.js} +1 -1
- package/lib/duet/p-d1746325.js +4 -0
- package/lib/duet/p-d312b69e.system.entry.js +4 -0
- package/lib/duet/{p-b6cbe383.entry.js → p-d64b4b43.entry.js} +1 -1
- package/lib/duet/{p-5969399b.system.entry.js → p-dccd1711.system.entry.js} +1 -1
- package/lib/duet/{p-a056cc14.system.entry.js → p-dd58a713.system.entry.js} +1 -1
- package/lib/duet/{p-712c9016.system.entry.js → p-df8c5af0.system.entry.js} +1 -1
- package/lib/duet/{p-83be3810.entry.js → p-e21029cc.entry.js} +1 -1
- package/lib/duet/{p-cfe414d2.system.entry.js → p-e7d9d84b.system.entry.js} +1 -1
- package/lib/duet/{p-1c67e70d.system.entry.js → p-ed5c2f24.system.entry.js} +1 -1
- package/lib/duet/{p-53849160.entry.js → p-ef888954.entry.js} +1 -1
- package/lib/duet/{p-0304408d.system.entry.js → p-f3d0d952.system.entry.js} +1 -1
- package/lib/duet/p-f476cb84.system.js +4 -0
- package/lib/duet/{p-b9d3eeb1.system.entry.js → p-f8927797.system.entry.js} +1 -1
- package/lib/duet/{p-8e0bad03.entry.js → p-fb70b22b.entry.js} +1 -1
- package/lib/duet/{p-f4664942.system.entry.js → p-fb81d343.system.entry.js} +2 -2
- package/lib/duet/{p-21d7cb5d.system.entry.js → p-fece90db.system.entry.js} +1 -1
- package/lib/esm/action-arrow-right-small-f9d2ba83.js +6 -0
- package/lib/esm/duet-action-button.entry.js +17 -6
- 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 +2 -3
- package/lib/esm/duet-button_2.entry.js +5 -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 +2 -2
- package/lib/esm/duet-collapsible.entry.js +2 -2
- package/lib/esm/duet-combobox.entry.js +1 -1
- package/lib/esm/duet-cookie-consent.entry.js +1 -1
- package/lib/esm/duet-date-picker.entry.js +2 -2
- package/lib/esm/duet-divider_2.entry.js +1 -1
- package/lib/esm/duet-editable-table_3.entry.js +105 -27
- 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 +23 -4
- package/lib/esm/duet-grid_2.entry.js +2 -2
- package/lib/esm/duet-header_2.entry.js +3 -3
- 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 +56 -4
- 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 +1 -1
- 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 +2 -2
- package/lib/esm/duet-textarea.entry.js +1 -1
- package/lib/esm/duet-toggle.entry.js +1 -1
- package/lib/esm/duet-tooltip.entry.js +1 -1
- package/lib/esm/duet-tray.entry.js +2 -2
- package/lib/esm/duet-upload-aria-status.entry.js +1 -1
- package/lib/esm/duet-visually-hidden.entry.js +1 -1
- package/lib/esm/duet.js +2 -2
- package/lib/esm/{focus-utils-429ccac4.js → focus-utils-fe498b6c.js} +1 -1
- package/lib/esm/{index-089c3eed.js → index-715101b6.js} +1 -1
- package/lib/esm/loader.js +2 -2
- package/lib/esm/{token-utils-e9a69acf.js → token-utils-1f9435bc.js} +16 -2
- package/lib/esm/{tokens-e110dc89.js → tokens-8ff8c570.js} +3 -0
- package/lib/esm/{tokens.module-49cbf963.js → tokens.module-f4572ed7.js} +2 -0
- package/lib/esm-es5/action-arrow-right-small-f9d2ba83.js +4 -0
- package/lib/esm-es5/duet-action-button.entry.js +1 -1
- 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 +2 -2
- package/lib/esm-es5/duet-button_2.entry.js +2 -2
- 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-combobox.entry.js +1 -1
- package/lib/esm-es5/duet-cookie-consent.entry.js +1 -1
- package/lib/esm-es5/duet-date-picker.entry.js +1 -1
- package/lib/esm-es5/duet-divider_2.entry.js +1 -1
- package/lib/esm-es5/duet-editable-table_3.entry.js +1 -1
- 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 +2 -2
- 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 +2 -2
- 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 +1 -1
- 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 +2 -2
- 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-fe498b6c.js +4 -0
- package/lib/esm-es5/{index-089c3eed.js → index-715101b6.js} +1 -1
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/token-utils-1f9435bc.js +4 -0
- package/lib/esm-es5/tokens-8ff8c570.js +4 -0
- package/lib/esm-es5/{tokens.module-49cbf963.js → tokens.module-f4572ed7.js} +1 -1
- package/lib/types/components/duet-button/duet-button.d.ts +1 -1
- package/lib/types/components/duet-footer/duet-footer.d.ts +30 -1
- package/lib/types/components/duet-input/duet-input.d.ts +23 -0
- package/lib/types/components/duet-upload/duet-upload.d.ts +18 -1
- package/lib/types/components/duet-upload/upload-editable-item-pending.d.ts +6 -0
- package/lib/types/components.d.ts +71 -3
- package/lib/types/utils/token-utils.d.ts +1 -0
- package/package.json +5 -5
- package/lib/duet/p-021f4ce6.entry.js +0 -4
- package/lib/duet/p-165aeec8.system.entry.js +0 -4
- package/lib/duet/p-27189fa0.entry.js +0 -4
- package/lib/duet/p-4cb2c888.entry.js +0 -4
- package/lib/duet/p-4e2532c7.system.js +0 -4
- package/lib/duet/p-52b6d127.entry.js +0 -4
- package/lib/duet/p-694ebf05.entry.js +0 -4
- package/lib/duet/p-7888e2d8.entry.js +0 -4
- package/lib/duet/p-7ce6ba93.system.entry.js +0 -4
- package/lib/duet/p-80e16593.entry.js +0 -4
- package/lib/duet/p-8143f3de.js +0 -4
- package/lib/duet/p-86777eb7.system.js +0 -4
- package/lib/duet/p-93f9ccbc.system.entry.js +0 -4
- package/lib/duet/p-94def463.entry.js +0 -4
- package/lib/duet/p-ad4570bf.system.entry.js +0 -4
- package/lib/duet/p-b2d00c4b.system.entry.js +0 -4
- package/lib/duet/p-b48323e2.system.entry.js +0 -4
- package/lib/duet/p-c5c212fd.entry.js +0 -4
- package/lib/duet/p-cb445018.js +0 -4
- package/lib/duet/p-ddb6344c.system.js +0 -4
- package/lib/duet/p-fa99eaa4.system.js +0 -4
- package/lib/esm-es5/focus-utils-429ccac4.js +0 -4
- package/lib/esm-es5/token-utils-e9a69acf.js +0 -4
- package/lib/esm-es5/tokens-e110dc89.js +0 -4
- package/lib/html.html-data.json +0 -5325
|
@@ -6,6 +6,8 @@ import searchIcon from "@duetds/icons/lib/assets/form-search";
|
|
|
6
6
|
import { Component, Element, Event, h, Host, Method, Prop, Watch } from "@stencil/core";
|
|
7
7
|
import { createID } from "../../utils/create-id";
|
|
8
8
|
import { cleanValue, resetCursor } from "../../utils/input-utils";
|
|
9
|
+
import { isEscapeKey } from "../../utils/keyboard-utils";
|
|
10
|
+
import { getLocaleString } from "../../utils/language-utils";
|
|
9
11
|
import { inheritGlobalTheme } from "../../utils/themeable-component";
|
|
10
12
|
const icons = {
|
|
11
13
|
search: searchIcon,
|
|
@@ -17,11 +19,17 @@ export class DuetInput {
|
|
|
17
19
|
* Own Properties
|
|
18
20
|
*/
|
|
19
21
|
this.inputId = createID("DuetInput");
|
|
22
|
+
this.clearId = createID("DuetInputClear");
|
|
20
23
|
this.labelId = createID("DuetLabel");
|
|
21
24
|
this.topCaptionId = createID("DuetCaptionTop");
|
|
22
25
|
this.topCaptionPlaceholderId = createID("DuetCaptionPlaceholderTop");
|
|
23
26
|
this.errorId = createID("DuetError");
|
|
24
27
|
this.disallowPatternRegex = null;
|
|
28
|
+
this.clearLabel = getLocaleString({
|
|
29
|
+
en: "Clear",
|
|
30
|
+
fi: "Tyhjennä",
|
|
31
|
+
sv: "Rensa",
|
|
32
|
+
});
|
|
25
33
|
/**
|
|
26
34
|
* Indicates the id of a component that describes the input.
|
|
27
35
|
*/
|
|
@@ -35,6 +43,10 @@ export class DuetInput {
|
|
|
35
43
|
* event after each keystroke.
|
|
36
44
|
*/
|
|
37
45
|
this.debounce = 0;
|
|
46
|
+
/**
|
|
47
|
+
* If set, the input field will display a clear button that can be accessed with tabbing.
|
|
48
|
+
*/
|
|
49
|
+
this.clear = false;
|
|
38
50
|
/**
|
|
39
51
|
* If form input field has a placeholder text, and user types anything (causing the placeholder text to disappear),
|
|
40
52
|
* settings this to true will "echo" it into the caption slot - this option will be false by default for the next few versions, but will eventually be true by default (scheduled for 4.30.0)
|
|
@@ -68,6 +80,10 @@ export class DuetInput {
|
|
|
68
80
|
* Type of the input.
|
|
69
81
|
*/
|
|
70
82
|
this.type = "text";
|
|
83
|
+
/**
|
|
84
|
+
* Variation of button.
|
|
85
|
+
*/
|
|
86
|
+
this.variation = "default";
|
|
71
87
|
/**
|
|
72
88
|
* Label for the input.
|
|
73
89
|
*/
|
|
@@ -135,6 +151,13 @@ export class DuetInput {
|
|
|
135
151
|
component: "duet-input",
|
|
136
152
|
});
|
|
137
153
|
};
|
|
154
|
+
this.onClear = (ev) => {
|
|
155
|
+
this.duetFocus.emit({
|
|
156
|
+
originalEvent: ev,
|
|
157
|
+
value: this.value,
|
|
158
|
+
component: "duet-input",
|
|
159
|
+
});
|
|
160
|
+
};
|
|
138
161
|
/** Private functions
|
|
139
162
|
*
|
|
140
163
|
*/
|
|
@@ -154,6 +177,17 @@ export class DuetInput {
|
|
|
154
177
|
}
|
|
155
178
|
return describedBy;
|
|
156
179
|
};
|
|
180
|
+
this.handleClearClick = event => {
|
|
181
|
+
const clearing = this.clearInput();
|
|
182
|
+
this.onClear(event);
|
|
183
|
+
return clearing;
|
|
184
|
+
};
|
|
185
|
+
this.keyHandler = event => {
|
|
186
|
+
if (isEscapeKey(event) && this.clear) {
|
|
187
|
+
this.handleClearClick(event);
|
|
188
|
+
}
|
|
189
|
+
return event;
|
|
190
|
+
};
|
|
157
191
|
}
|
|
158
192
|
disallowedPatternChange() {
|
|
159
193
|
this.disallowPatternRegex = this.disallowPattern ? new RegExp(this.disallowPattern, "g") : null;
|
|
@@ -208,6 +242,16 @@ export class DuetInput {
|
|
|
208
242
|
restoreCursor();
|
|
209
243
|
}
|
|
210
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* Reset the cursor position on the native element
|
|
247
|
+
* `input.resetCursor()`.
|
|
248
|
+
*/
|
|
249
|
+
async clearInput() {
|
|
250
|
+
if (this.nativeInput) {
|
|
251
|
+
this.nativeInput.value = "";
|
|
252
|
+
this.value = "";
|
|
253
|
+
}
|
|
254
|
+
}
|
|
211
255
|
/**
|
|
212
256
|
* render() function
|
|
213
257
|
* Always the last one in the class.
|
|
@@ -225,14 +269,16 @@ export class DuetInput {
|
|
|
225
269
|
else if (!this.pattern && this.type === "tel") {
|
|
226
270
|
inputProps.pattern = "[0-9+ ]+";
|
|
227
271
|
}
|
|
228
|
-
return (h(Host, { class: { "duet-expand": this.expand, "duet-m-0": this.margin === "none" } },
|
|
272
|
+
return (h(Host, { class: { "duet-expand": this.expand, "duet-m-0": this.margin === "none" }, onKeyUp: e => this.keyHandler(e) },
|
|
229
273
|
h("div", { class: {
|
|
230
274
|
"duet-input-container": true,
|
|
231
275
|
"duet-theme-turva": this.theme === "turva",
|
|
276
|
+
[`duet-input-variation-${this.variation}`]: true,
|
|
232
277
|
"duet-label-hidden": this.labelHidden,
|
|
233
278
|
"duet-input-top-caption-shown": this.isCaptionVisible,
|
|
234
279
|
"has-icon": !!this.icon || (this.type !== "text" && this.type !== "tel" && this.type !== "password"),
|
|
235
280
|
"has-error": !!this.error,
|
|
281
|
+
"has-clear": this.clear,
|
|
236
282
|
} },
|
|
237
283
|
h("duet-label", { theme: this.theme === "turva" ? "turva" : "default", class: { "duet-has-tooltip": !!this.tooltip }, margin: this.isCaptionVisible ? "small" : "auto", id: this.labelId, for: identifier }, this.label),
|
|
238
284
|
this.tooltip && (h("duet-tooltip", { direction: this.tooltipDirection, accessibleInputLabel: this.label }, this.tooltip)),
|
|
@@ -245,10 +291,18 @@ export class DuetInput {
|
|
|
245
291
|
"is-number": this.component === "number",
|
|
246
292
|
"is-date": this.component === "date",
|
|
247
293
|
}, value: this.value, disabled: this.disabled, "aria-invalid": this.error ? "true" : "false", "aria-labelledby": `${this.labelId} ${this.errorId}`, "aria-controls": this.accessibleControls, "aria-autocomplete": this.accessibleAutocomplete, "aria-activedescendant": this.accessibleActiveDescendant, "aria-expanded": this.accessibleExpanded, "aria-haspopup": this.accessibleHasPopup, "aria-owns": this.accessibleOwns, "aria-describedby": this.getDescribedBy(), placeholder: this.placeholder, spellcheck: "false", minlength: this.minlength, maxlength: this.maxlength, autocomplete: this.autoComplete, required: this.required, role: this.role, name: this.name, id: identifier }, inputProps)),
|
|
248
|
-
!this.icon &&
|
|
294
|
+
!this.icon &&
|
|
295
|
+
this.type !== "text" &&
|
|
296
|
+
this.type !== "tel" &&
|
|
297
|
+
this.type !== "password" &&
|
|
298
|
+
this.variation !== "button" && (h("div", { class: "duet-input-icon" },
|
|
249
299
|
h("duet-icon", { margin: "none", size: "small", icon: icons[this.type].svg, color: "currentColor" }))),
|
|
250
|
-
this.
|
|
300
|
+
this.clear && this.value && (h("div", { class: "duet-input-clear-icon" },
|
|
301
|
+
h("button", { onClick: this.handleClearClick, id: this.clearId, "aria-label": this.clearLabel, "aria-keyshortcuts": "Escape" },
|
|
302
|
+
h("duet-icon", { margin: "none", size: "xx-small", name: "activity-close", color: "currentColor" })))),
|
|
303
|
+
this.icon && this.variation !== "button" && (h("div", { class: "duet-input-icon" },
|
|
251
304
|
h("duet-icon", { margin: "none", size: "small", name: this.icon, color: "currentColor" }))),
|
|
305
|
+
this.variation === "button" && h("slot", { name: "button" }),
|
|
252
306
|
h("slot", null)),
|
|
253
307
|
h("span", { class: "duet-input-help", id: this.errorId, "aria-live": "assertive", "aria-relevant": "additions removals" }, this.error && h("span", { class: "duet-input-error" }, this.error)))));
|
|
254
308
|
}
|
|
@@ -400,6 +454,24 @@ export class DuetInput {
|
|
|
400
454
|
"reflect": false,
|
|
401
455
|
"defaultValue": "0"
|
|
402
456
|
},
|
|
457
|
+
"clear": {
|
|
458
|
+
"type": "boolean",
|
|
459
|
+
"mutable": false,
|
|
460
|
+
"complexType": {
|
|
461
|
+
"original": "boolean",
|
|
462
|
+
"resolved": "boolean",
|
|
463
|
+
"references": {}
|
|
464
|
+
},
|
|
465
|
+
"required": false,
|
|
466
|
+
"optional": false,
|
|
467
|
+
"docs": {
|
|
468
|
+
"tags": [],
|
|
469
|
+
"text": "If set, the input field will display a clear button that can be accessed with tabbing."
|
|
470
|
+
},
|
|
471
|
+
"attribute": "clear",
|
|
472
|
+
"reflect": false,
|
|
473
|
+
"defaultValue": "false"
|
|
474
|
+
},
|
|
403
475
|
"caption": {
|
|
404
476
|
"type": "string",
|
|
405
477
|
"mutable": false,
|
|
@@ -574,6 +646,28 @@ export class DuetInput {
|
|
|
574
646
|
"reflect": false,
|
|
575
647
|
"defaultValue": "\"text\""
|
|
576
648
|
},
|
|
649
|
+
"variation": {
|
|
650
|
+
"type": "string",
|
|
651
|
+
"mutable": false,
|
|
652
|
+
"complexType": {
|
|
653
|
+
"original": "DuetVariationType",
|
|
654
|
+
"resolved": "\"button\" | \"default\"",
|
|
655
|
+
"references": {
|
|
656
|
+
"DuetVariationType": {
|
|
657
|
+
"location": "local"
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
},
|
|
661
|
+
"required": false,
|
|
662
|
+
"optional": false,
|
|
663
|
+
"docs": {
|
|
664
|
+
"tags": [],
|
|
665
|
+
"text": "Variation of button."
|
|
666
|
+
},
|
|
667
|
+
"attribute": "variation",
|
|
668
|
+
"reflect": false,
|
|
669
|
+
"defaultValue": "\"default\""
|
|
670
|
+
},
|
|
577
671
|
"label": {
|
|
578
672
|
"type": "string",
|
|
579
673
|
"mutable": false,
|
|
@@ -944,6 +1038,25 @@ export class DuetInput {
|
|
|
944
1038
|
}
|
|
945
1039
|
}
|
|
946
1040
|
}
|
|
1041
|
+
}, {
|
|
1042
|
+
"method": "duetClear",
|
|
1043
|
+
"name": "duetClear",
|
|
1044
|
+
"bubbles": true,
|
|
1045
|
+
"cancelable": true,
|
|
1046
|
+
"composed": true,
|
|
1047
|
+
"docs": {
|
|
1048
|
+
"tags": [],
|
|
1049
|
+
"text": "Emitted when the input is cleared."
|
|
1050
|
+
},
|
|
1051
|
+
"complexType": {
|
|
1052
|
+
"original": "DuetInputEvent",
|
|
1053
|
+
"resolved": "{ originalEvent?: Event; value: string; component: \"duet-input\"; }",
|
|
1054
|
+
"references": {
|
|
1055
|
+
"DuetInputEvent": {
|
|
1056
|
+
"location": "local"
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
947
1060
|
}, {
|
|
948
1061
|
"method": "duetFocus",
|
|
949
1062
|
"name": "duetFocus",
|
|
@@ -1002,6 +1115,22 @@ export class DuetInput {
|
|
|
1002
1115
|
"text": "Reset the cursor position on the native element\n`input.resetCursor()`.",
|
|
1003
1116
|
"tags": []
|
|
1004
1117
|
}
|
|
1118
|
+
},
|
|
1119
|
+
"clearInput": {
|
|
1120
|
+
"complexType": {
|
|
1121
|
+
"signature": "() => Promise<void>",
|
|
1122
|
+
"parameters": [],
|
|
1123
|
+
"references": {
|
|
1124
|
+
"Promise": {
|
|
1125
|
+
"location": "global"
|
|
1126
|
+
}
|
|
1127
|
+
},
|
|
1128
|
+
"return": "Promise<void>"
|
|
1129
|
+
},
|
|
1130
|
+
"docs": {
|
|
1131
|
+
"text": "Reset the cursor position on the native element\n`input.resetCursor()`.",
|
|
1132
|
+
"tags": []
|
|
1133
|
+
}
|
|
1005
1134
|
}
|
|
1006
1135
|
}; }
|
|
1007
1136
|
static get elementRef() { return "element"; }
|
|
@@ -96,7 +96,7 @@ export class DuetStep {
|
|
|
96
96
|
"rounded-bottom": this.roundedBottom,
|
|
97
97
|
"duet-theme-turva": this.theme === "turva",
|
|
98
98
|
} },
|
|
99
|
-
h("div", { class: "duet-step-heading", id: this.buttonId, role: "button", tabindex: this.state !== "
|
|
99
|
+
h("div", { class: "duet-step-heading", id: this.buttonId, role: this.state !== "current" ? "button" : "region", "aria-current": this.state === "current" ? "step" : undefined, tabindex: this.state !== "current" ? "0" : undefined, "aria-disabled": this.isClickDisabled().toString(), "aria-expanded": (this.state === "current").toString(), "aria-controls": this.contentId, "aria-selected": (this.state === "current").toString(), onClick: this.handleClick, onKeyDown: this.handleKeyDown, ref: element => (this.buttonElement = element) },
|
|
100
100
|
h("div", { "aria-hidden": "true" },
|
|
101
101
|
h("div", { class: "duet-step-counter" }, this.renderStepCounter())),
|
|
102
102
|
h("duet-spacer", { direction: "horizontal", size: "large", breakpoint: "small" }),
|
|
@@ -97,7 +97,7 @@ export class DuetTable {
|
|
|
97
97
|
// this clears all pending mutations,
|
|
98
98
|
// that way we avoid dealing with any initial changes
|
|
99
99
|
// and only get genuine mutations as rows are added/removed
|
|
100
|
-
this.observer.takeRecords();
|
|
100
|
+
this.observer ? this.observer.takeRecords() : null;
|
|
101
101
|
}
|
|
102
102
|
disconnectedCallback() {
|
|
103
103
|
if (Build.isServer) {
|
|
@@ -9,6 +9,7 @@ import { inheritGlobalTheme } from "../../utils/themeable-component";
|
|
|
9
9
|
import { getError, getI18nError } from "./errorcodes.utils";
|
|
10
10
|
import { ErrorItem } from "./upload-editable-item-error";
|
|
11
11
|
import { ProgressItem } from "./upload-editable-item-inprogres";
|
|
12
|
+
import { PendingItem } from "./upload-editable-item-pending";
|
|
12
13
|
import { SuccessItem } from "./upload-editable-item-success";
|
|
13
14
|
import { validateFile, validateTotalAmountIsAboveMax, validateTotalSizeIsAboveMax } from "./upload-validators";
|
|
14
15
|
import { makeXhrRequest } from "./xhr.helpers";
|
|
@@ -31,9 +32,13 @@ export class DuetUpload {
|
|
|
31
32
|
* it will be up to you to handle the upload and return progress information to the upload-component
|
|
32
33
|
*/
|
|
33
34
|
this.external = false;
|
|
35
|
+
/**
|
|
36
|
+
* If defer-upload is true, duet-upload will not (as recommended) instantly upload files but await a call to uploadPending()
|
|
37
|
+
*/
|
|
38
|
+
this.deferUpload = false;
|
|
34
39
|
/**
|
|
35
40
|
* If set the upload component will not display an upload button, you will have to create one yourself
|
|
36
|
-
* and call the exposed method startUpload
|
|
41
|
+
* and call the exposed method startUpload to open the upload dialog
|
|
37
42
|
*/
|
|
38
43
|
this.hideButton = false;
|
|
39
44
|
/**
|
|
@@ -46,7 +51,7 @@ export class DuetUpload {
|
|
|
46
51
|
size: "x-small",
|
|
47
52
|
background: "gray-lightest",
|
|
48
53
|
name: "delete",
|
|
49
|
-
map: ["success", "failure"],
|
|
54
|
+
map: ["success", "failure", "pending"],
|
|
50
55
|
label: {
|
|
51
56
|
fi: "Poista tiedosto",
|
|
52
57
|
en: "Poista tiedosto",
|
|
@@ -300,6 +305,7 @@ export class DuetUpload {
|
|
|
300
305
|
this.DefaultGroups = {
|
|
301
306
|
inprogress: "inprogress",
|
|
302
307
|
success: "success",
|
|
308
|
+
pending: "pending",
|
|
303
309
|
failure: "failure",
|
|
304
310
|
};
|
|
305
311
|
/**
|
|
@@ -316,6 +322,14 @@ export class DuetUpload {
|
|
|
316
322
|
en: "Files inprogress",
|
|
317
323
|
},
|
|
318
324
|
},
|
|
325
|
+
{
|
|
326
|
+
id: this.DefaultGroups.pending,
|
|
327
|
+
label: {
|
|
328
|
+
en: "Files to upload",
|
|
329
|
+
sv: "Filer att ladda",
|
|
330
|
+
fi: "Tiedostot ladattavat",
|
|
331
|
+
},
|
|
332
|
+
},
|
|
319
333
|
{
|
|
320
334
|
id: this.DefaultGroups.success,
|
|
321
335
|
label: {
|
|
@@ -343,7 +357,6 @@ export class DuetUpload {
|
|
|
343
357
|
this.element.addEventListener("duetActionEvent", (e) => {
|
|
344
358
|
const detail = e.detail;
|
|
345
359
|
const { action, id, originalEvent } = detail;
|
|
346
|
-
console.log(e);
|
|
347
360
|
switch (action) {
|
|
348
361
|
case "delete":
|
|
349
362
|
this.onDelete(id, originalEvent);
|
|
@@ -372,9 +385,6 @@ export class DuetUpload {
|
|
|
372
385
|
if (item.valid && item.progress === 100) {
|
|
373
386
|
// if the item has a group, move the file to that group instead
|
|
374
387
|
// of into the standard success group
|
|
375
|
-
if (item.group) {
|
|
376
|
-
return item.group;
|
|
377
|
-
}
|
|
378
388
|
return this.DefaultGroups.success;
|
|
379
389
|
}
|
|
380
390
|
else if (item.progress > 0 && item.progress !== 100) {
|
|
@@ -383,6 +393,9 @@ export class DuetUpload {
|
|
|
383
393
|
else if (!item.valid) {
|
|
384
394
|
return this.DefaultGroups.failure;
|
|
385
395
|
}
|
|
396
|
+
else if (item.pending) {
|
|
397
|
+
return this.DefaultGroups.pending;
|
|
398
|
+
}
|
|
386
399
|
else if (item.group) {
|
|
387
400
|
return item.group;
|
|
388
401
|
}
|
|
@@ -397,6 +410,9 @@ export class DuetUpload {
|
|
|
397
410
|
else if (group === this.DefaultGroups.inprogress) {
|
|
398
411
|
return h(ProgressItem, { progress: data.progress, name: data.item.name });
|
|
399
412
|
}
|
|
413
|
+
else if (group === this.DefaultGroups.pending) {
|
|
414
|
+
return h(PendingItem, { name: data.item.name });
|
|
415
|
+
}
|
|
400
416
|
else if (group === this.DefaultGroups.failure) {
|
|
401
417
|
return h(ErrorItem, { data: data });
|
|
402
418
|
}
|
|
@@ -409,9 +425,16 @@ export class DuetUpload {
|
|
|
409
425
|
};
|
|
410
426
|
this.genHashName = () => Date.now().toString(36) + Math.random();
|
|
411
427
|
this.updateValueInMap = (item, key, value, kick = true) => {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
428
|
+
try {
|
|
429
|
+
const fileItem = this.files.get(item);
|
|
430
|
+
fileItem[key] = value;
|
|
431
|
+
this.files.set(item, fileItem);
|
|
432
|
+
}
|
|
433
|
+
catch (e) {
|
|
434
|
+
// if a users tries to update entries on a file that doesn't exist,
|
|
435
|
+
// this will blow up - so we're swallowing the errors here on purpose
|
|
436
|
+
// console.warn("operation on missing items")
|
|
437
|
+
}
|
|
415
438
|
if (kick) {
|
|
416
439
|
this.kick();
|
|
417
440
|
}
|
|
@@ -529,6 +552,46 @@ export class DuetUpload {
|
|
|
529
552
|
fileMaxReached: isTotalFileAmountAboveMax,
|
|
530
553
|
};
|
|
531
554
|
};
|
|
555
|
+
this.uploadFile = async (fileListItem, force = false, key) => {
|
|
556
|
+
if (!force && this.deferUpload) {
|
|
557
|
+
this.updateValueInMap(fileListItem.item.name, "pending", true, false);
|
|
558
|
+
this.updateValueInMap(fileListItem.item.name, "group", "pending", true);
|
|
559
|
+
}
|
|
560
|
+
else if (force) {
|
|
561
|
+
this.updateValueInMap(fileListItem.item.name, "pending", false, false);
|
|
562
|
+
this.updateValueInMap(fileListItem.item.name, "group", undefined, true);
|
|
563
|
+
}
|
|
564
|
+
try {
|
|
565
|
+
if (!this.deferUpload || force) {
|
|
566
|
+
// if all is well AND external file upload handling has not been set, start upload
|
|
567
|
+
const data = new FormData();
|
|
568
|
+
data.append("file", fileListItem.item);
|
|
569
|
+
if (key) {
|
|
570
|
+
data.append("key", key);
|
|
571
|
+
}
|
|
572
|
+
data.append("uid", fileListItem.uid);
|
|
573
|
+
data.append("name", fileListItem.item.name);
|
|
574
|
+
data.append("metadata", JSON.stringify({
|
|
575
|
+
uid: fileListItem.uid,
|
|
576
|
+
url: this.uri,
|
|
577
|
+
size: fileListItem.item.size,
|
|
578
|
+
meta: fileListItem.meta,
|
|
579
|
+
}));
|
|
580
|
+
fileListItem.xhr = await this.makeXHRPostRequest(data);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
catch (e) {
|
|
584
|
+
// in case one of the global maxes have been reached, invalidate the file
|
|
585
|
+
this.updateValueInMap(fileListItem.item.name, "valid", false, false);
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
this.uploadPendingFiles = () => {
|
|
589
|
+
for (const [key, value] of this.files.entries()) {
|
|
590
|
+
if (value.group === "pending" && value.pending === true) {
|
|
591
|
+
this.uploadFile(value, true, key);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
};
|
|
532
595
|
this.getItemFromUID = (uid) => {
|
|
533
596
|
for (const [key, value] of this.files.entries()) {
|
|
534
597
|
if (value.uid === uid) {
|
|
@@ -538,7 +601,8 @@ export class DuetUpload {
|
|
|
538
601
|
return null;
|
|
539
602
|
};
|
|
540
603
|
this.onDelete = (key, ev) => {
|
|
541
|
-
const
|
|
604
|
+
const item = this.getItemFromUID(key);
|
|
605
|
+
const retrievedKey = item.key;
|
|
542
606
|
const deletedItem = this.files.get(retrievedKey);
|
|
543
607
|
this.files.delete(retrievedKey);
|
|
544
608
|
this.validateTotals();
|
|
@@ -548,7 +612,8 @@ export class DuetUpload {
|
|
|
548
612
|
data: { deletion: deletedItem },
|
|
549
613
|
component: "duet-upload",
|
|
550
614
|
});
|
|
551
|
-
if
|
|
615
|
+
// don't send a xhr request if the item was pending, just remove it from the list
|
|
616
|
+
if (!this.external && !deletedItem.pending) {
|
|
552
617
|
this.makeXHRDeleteRequest(deletedItem);
|
|
553
618
|
}
|
|
554
619
|
this.resetFormFields();
|
|
@@ -613,6 +678,7 @@ export class DuetUpload {
|
|
|
613
678
|
const all = [...this.files.values()];
|
|
614
679
|
const inprogress = [];
|
|
615
680
|
const failure = [];
|
|
681
|
+
const pending = [];
|
|
616
682
|
const success = [];
|
|
617
683
|
all.forEach(data => {
|
|
618
684
|
const group = this.getGroupFromItemData(data);
|
|
@@ -631,6 +697,13 @@ export class DuetUpload {
|
|
|
631
697
|
group,
|
|
632
698
|
});
|
|
633
699
|
}
|
|
700
|
+
else if (group === this.DefaultGroups.pending) {
|
|
701
|
+
pending.push({
|
|
702
|
+
uid: data.uid,
|
|
703
|
+
item,
|
|
704
|
+
group,
|
|
705
|
+
});
|
|
706
|
+
}
|
|
634
707
|
else if (group === this.DefaultGroups.failure) {
|
|
635
708
|
failure.push({
|
|
636
709
|
uid: data.uid,
|
|
@@ -648,6 +721,7 @@ export class DuetUpload {
|
|
|
648
721
|
});
|
|
649
722
|
return {
|
|
650
723
|
inprogress,
|
|
724
|
+
pending,
|
|
651
725
|
failure,
|
|
652
726
|
success,
|
|
653
727
|
};
|
|
@@ -729,6 +803,12 @@ export class DuetUpload {
|
|
|
729
803
|
this.nativeInput.click();
|
|
730
804
|
return;
|
|
731
805
|
}
|
|
806
|
+
/**
|
|
807
|
+
* Method for uploading pending files
|
|
808
|
+
*/
|
|
809
|
+
async uploadPending() {
|
|
810
|
+
this.uploadPendingFiles();
|
|
811
|
+
}
|
|
732
812
|
/**
|
|
733
813
|
* Method for forcing a render of the upload list, element.files can be changed externally
|
|
734
814
|
* But it will only rerender on a new Map or a top Level change - this can be used to update
|
|
@@ -884,19 +964,14 @@ export class DuetUpload {
|
|
|
884
964
|
this.updateValueInMap(item.name, "valid", false, false);
|
|
885
965
|
}
|
|
886
966
|
else if (valid && !this.external) {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
}
|
|
896
|
-
catch (e) {
|
|
897
|
-
// in case one of the global maxes have been reached, invalidate the file
|
|
898
|
-
this.updateValueInMap(item.name, "valid", false, false);
|
|
899
|
-
}
|
|
967
|
+
await this.uploadFile(fileListItem);
|
|
968
|
+
}
|
|
969
|
+
else if (valid && this.external) {
|
|
970
|
+
this.updateValueInMap(fileListItem.item.name, "pending", true, false);
|
|
971
|
+
this.updateValueInMap(fileListItem.item.name, "group", "pending", true);
|
|
972
|
+
}
|
|
973
|
+
else if (!valid) {
|
|
974
|
+
this.updateValueInMap(item.name, "valid", false, true);
|
|
900
975
|
}
|
|
901
976
|
// kick the stat to force update
|
|
902
977
|
this.kick();
|
|
@@ -1007,6 +1082,24 @@ export class DuetUpload {
|
|
|
1007
1082
|
"reflect": false,
|
|
1008
1083
|
"defaultValue": "false"
|
|
1009
1084
|
},
|
|
1085
|
+
"deferUpload": {
|
|
1086
|
+
"type": "boolean",
|
|
1087
|
+
"mutable": false,
|
|
1088
|
+
"complexType": {
|
|
1089
|
+
"original": "boolean",
|
|
1090
|
+
"resolved": "boolean",
|
|
1091
|
+
"references": {}
|
|
1092
|
+
},
|
|
1093
|
+
"required": false,
|
|
1094
|
+
"optional": false,
|
|
1095
|
+
"docs": {
|
|
1096
|
+
"tags": [],
|
|
1097
|
+
"text": "If defer-upload is true, duet-upload will not (as recommended) instantly upload files but await a call to uploadPending()"
|
|
1098
|
+
},
|
|
1099
|
+
"attribute": "defer-upload",
|
|
1100
|
+
"reflect": false,
|
|
1101
|
+
"defaultValue": "false"
|
|
1102
|
+
},
|
|
1010
1103
|
"hideButton": {
|
|
1011
1104
|
"type": "boolean",
|
|
1012
1105
|
"mutable": false,
|
|
@@ -1019,7 +1112,7 @@ export class DuetUpload {
|
|
|
1019
1112
|
"optional": false,
|
|
1020
1113
|
"docs": {
|
|
1021
1114
|
"tags": [],
|
|
1022
|
-
"text": "If set the upload component will not display an upload button, you will have to create one yourself\nand call the exposed method startUpload"
|
|
1115
|
+
"text": "If set the upload component will not display an upload button, you will have to create one yourself\nand call the exposed method startUpload to open the upload dialog"
|
|
1023
1116
|
},
|
|
1024
1117
|
"attribute": "hide-upload-button",
|
|
1025
1118
|
"reflect": false,
|
|
@@ -1044,7 +1137,7 @@ export class DuetUpload {
|
|
|
1044
1137
|
"tags": [],
|
|
1045
1138
|
"text": "Default actions added to the internally used duet-editable-table"
|
|
1046
1139
|
},
|
|
1047
|
-
"defaultValue": "[\n {\n icon: \"action-delete\",\n color: \"color-danger\",\n size: \"x-small\",\n background: \"gray-lightest\",\n name: \"delete\",\n map: [\"success\", \"failure\"],\n label: {\n fi: \"Poista tiedosto\",\n en: \"Poista tiedosto\",\n sv: \"Ta bort filen\",\n },\n },\n {\n icon: \"navigation-close\",\n color: \"primary\",\n size: \"x-small\",\n background: \"gray-lightest\",\n name: \"cancel\",\n map: [\"inprogress\"],\n label: {\n fi: \"Keskeyt\u00E4 l\u00E4hetys\",\n en: \"Cancel the upload\",\n sv: \"Stop \u00F6verf\u00F6ringen\",\n },\n },\n ]"
|
|
1140
|
+
"defaultValue": "[\n {\n icon: \"action-delete\",\n color: \"color-danger\",\n size: \"x-small\",\n background: \"gray-lightest\",\n name: \"delete\",\n map: [\"success\", \"failure\", \"pending\"],\n label: {\n fi: \"Poista tiedosto\",\n en: \"Poista tiedosto\",\n sv: \"Ta bort filen\",\n },\n },\n {\n icon: \"navigation-close\",\n color: \"primary\",\n size: \"x-small\",\n background: \"gray-lightest\",\n name: \"cancel\",\n map: [\"inprogress\"],\n label: {\n fi: \"Keskeyt\u00E4 l\u00E4hetys\",\n en: \"Cancel the upload\",\n sv: \"Stop \u00F6verf\u00F6ringen\",\n },\n },\n ]"
|
|
1048
1141
|
},
|
|
1049
1142
|
"uri": {
|
|
1050
1143
|
"type": "string",
|
|
@@ -1734,7 +1827,7 @@ export class DuetUpload {
|
|
|
1734
1827
|
}],
|
|
1735
1828
|
"text": "Array of group names that you want the editable table to use to display files"
|
|
1736
1829
|
},
|
|
1737
|
-
"defaultValue": "[\n {\n id: this.DefaultGroups.inprogress,\n label: {\n fi: \"Kesken olevat tiedostot\",\n sv: \"Filer inprogress\",\n en: \"Files inprogress\",\n },\n },\n {\n id: this.DefaultGroups.success,\n label: {\n fi: \"Valmiit tiedostot\",\n sv: \"Files success\",\n en: \"Files success\",\n },\n },\n {\n id: this.DefaultGroups.failure,\n label: {\n fi: \"Tiedostot, joissa on virheit\u00E4\",\n sv: \"Filer med fel\",\n en: \"Files with errors\",\n },\n },\n ]"
|
|
1830
|
+
"defaultValue": "[\n {\n id: this.DefaultGroups.inprogress,\n label: {\n fi: \"Kesken olevat tiedostot\",\n sv: \"Filer inprogress\",\n en: \"Files inprogress\",\n },\n },\n {\n id: this.DefaultGroups.pending,\n label: {\n en: \"Files to upload\",\n sv: \"Filer att ladda\",\n fi: \"Tiedostot ladattavat\",\n },\n },\n {\n id: this.DefaultGroups.success,\n label: {\n fi: \"Valmiit tiedostot\",\n sv: \"Files success\",\n en: \"Files success\",\n },\n },\n {\n id: this.DefaultGroups.failure,\n label: {\n fi: \"Tiedostot, joissa on virheit\u00E4\",\n sv: \"Filer med fel\",\n en: \"Files with errors\",\n },\n },\n ]"
|
|
1738
1831
|
}
|
|
1739
1832
|
}; }
|
|
1740
1833
|
static get states() { return {
|
|
@@ -1954,6 +2047,22 @@ export class DuetUpload {
|
|
|
1954
2047
|
"tags": []
|
|
1955
2048
|
}
|
|
1956
2049
|
},
|
|
2050
|
+
"uploadPending": {
|
|
2051
|
+
"complexType": {
|
|
2052
|
+
"signature": "() => Promise<void>",
|
|
2053
|
+
"parameters": [],
|
|
2054
|
+
"references": {
|
|
2055
|
+
"Promise": {
|
|
2056
|
+
"location": "global"
|
|
2057
|
+
}
|
|
2058
|
+
},
|
|
2059
|
+
"return": "Promise<void>"
|
|
2060
|
+
},
|
|
2061
|
+
"docs": {
|
|
2062
|
+
"text": "Method for uploading pending files",
|
|
2063
|
+
"tags": []
|
|
2064
|
+
}
|
|
2065
|
+
},
|
|
1957
2066
|
"refresh": {
|
|
1958
2067
|
"complexType": {
|
|
1959
2068
|
"signature": "() => Promise<void>",
|
|
@@ -103,3 +103,17 @@ export function getFontSizeByName(name) {
|
|
|
103
103
|
export function getFontWeightByName(name) {
|
|
104
104
|
return getTokenByName("fontWeight", name);
|
|
105
105
|
}
|
|
106
|
+
export function shadeRGBColor(color, percent) {
|
|
107
|
+
const f = color.split(","), t = percent < 0 ? 0 : 255, p = percent < 0 ? percent * -1 : percent;
|
|
108
|
+
let R = parseInt(f[0].slice(4)), G = parseInt(f[1]), B = parseInt(f[2]);
|
|
109
|
+
R = Math.round((t - R) * p) + R;
|
|
110
|
+
G = Math.round((t - G) * p) + G;
|
|
111
|
+
B = Math.round((t - B) * p) + B;
|
|
112
|
+
R = R < 0 ? 0 : R;
|
|
113
|
+
R = R > 255 ? 255 : R;
|
|
114
|
+
G = G < 0 ? 0 : G;
|
|
115
|
+
G = G > 255 ? 255 : G;
|
|
116
|
+
B = B < 0 ? 0 : B;
|
|
117
|
+
B = B > 255 ? 255 : B;
|
|
118
|
+
return `rgb(${R},${G},${B})`;
|
|
119
|
+
}
|