@duetds/components 4.30.1 → 4.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/hydrate/index.js +230 -1038
- package/lib/cjs/duet-alert.cjs.entry.js +4 -2
- package/lib/cjs/duet-badge.cjs.entry.js +2 -2
- package/lib/cjs/duet-button_2.cjs.entry.js +4 -3
- package/lib/cjs/duet-caption_4.cjs.entry.js +7 -8
- package/lib/cjs/duet-card.cjs.entry.js +4 -4
- package/lib/cjs/duet-checkbox.cjs.entry.js +1 -1
- package/lib/cjs/duet-choice_2.cjs.entry.js +4 -3
- 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 +22 -12
- package/lib/cjs/duet-divider_2.cjs.entry.js +1 -1
- 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 +4 -4
- package/lib/cjs/duet-grid_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-header_2.cjs.entry.js +25 -9
- package/lib/cjs/duet-hero.cjs.entry.js +6 -6
- package/lib/cjs/duet-icon.cjs.entry.js +3 -3
- package/lib/cjs/duet-input_2.cjs.entry.js +2 -2
- 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 +8 -7
- package/lib/cjs/duet-notification_2.cjs.entry.js +6 -5
- package/lib/cjs/duet-number-input.cjs.entry.js +36 -15
- package/lib/cjs/duet-radio_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-range-slider.cjs.entry.js +1 -1
- package/lib/cjs/duet-select.cjs.entry.js +2 -2
- package/lib/cjs/duet-step_2.cjs.entry.js +1 -1
- package/lib/cjs/duet-tab_2.cjs.entry.js +11 -5
- package/lib/cjs/duet-table.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 +21 -10
- package/lib/cjs/duet-tray.cjs.entry.js +20 -9
- package/lib/cjs/duet-visually-hidden.cjs.entry.js +1 -1
- package/lib/cjs/duet.cjs.js +2 -2
- package/lib/cjs/{focus-utils-7605778f.js → focus-utils-bd331feb.js} +1 -1
- package/lib/cjs/{index-0c949193.js → index-113c2add.js} +0 -3
- package/lib/cjs/{language-utils-70d6a9a4.js → language-utils-48b8860b.js} +23 -8
- package/lib/cjs/loader.cjs.js +2 -2
- package/lib/cjs/{string-utils-a6de43d8.js → string-utils-267e3dbb.js} +7 -0
- package/lib/collection/collection-manifest.json +0 -6
- package/lib/collection/components/duet-alert/duet-alert.js +10 -4
- package/lib/collection/components/duet-badge/duet-badge.css +1 -0
- package/lib/collection/components/duet-button/duet-button.js +7 -5
- package/lib/collection/components/duet-card/duet-card.css +10 -7
- package/lib/collection/components/duet-card/duet-card.js +3 -5
- package/lib/collection/components/duet-choice/duet-choice.js +5 -3
- package/lib/collection/components/duet-choice-group/duet-choice-group.css +1 -0
- package/lib/collection/components/duet-date-picker/duet-date-picker.css +1 -1
- package/lib/collection/components/duet-date-picker/duet-date-picker.js +73 -38
- package/lib/collection/components/duet-footer/duet-footer.js +7 -5
- package/lib/collection/components/duet-header/duet-header.js +46 -21
- package/lib/collection/components/duet-heading/duet-heading.css +1 -0
- package/lib/collection/components/duet-hero/duet-hero.js +14 -9
- package/lib/collection/components/duet-icon/icon-utils.js +1 -1
- package/lib/collection/components/duet-label/duet-label.css +2 -0
- package/lib/collection/components/duet-link/duet-link.js +10 -11
- package/lib/collection/components/duet-modal/duet-modal.js +16 -11
- package/lib/collection/components/duet-notification-drawer/duet-notification-drawer.js +14 -9
- package/lib/collection/components/duet-number-input/duet-number-input.js +141 -17
- package/lib/collection/components/duet-tab-group/duet-tab-group.js +35 -4
- package/lib/collection/components/duet-tooltip/duet-tooltip.js +72 -10
- package/lib/collection/components/duet-tray/duet-tray.js +71 -9
- package/lib/collection/utils/fixture-utils.js +7 -5
- package/lib/collection/utils/language-utils.js +22 -8
- package/lib/collection/utils/string-utils.js +6 -0
- package/lib/custom-elements-bundle/index.d.ts +0 -6
- package/lib/custom-elements-bundle/index.js +224 -995
- package/lib/duet/duet.esm.js +1 -1
- package/lib/duet/duet.js +1 -1
- package/lib/duet/p-0058512b.js +4 -0
- package/lib/duet/p-0224db45.entry.js +4 -0
- package/lib/duet/{p-345ea4f2.system.entry.js → p-02ad46a0.system.entry.js} +1 -1
- package/lib/duet/{p-62806bb6.system.entry.js → p-07263910.system.entry.js} +1 -1
- package/lib/duet/{p-f82709ba.entry.js → p-1bfbc988.entry.js} +1 -1
- package/lib/duet/p-1cd7177f.entry.js +4 -0
- package/lib/duet/p-1cec5a70.system.entry.js +4 -0
- package/lib/duet/p-1e7222c2.entry.js +4 -0
- package/lib/duet/{p-c0b95b58.entry.js → p-202bbd70.entry.js} +1 -1
- package/lib/duet/{p-d1817efe.system.entry.js → p-22f56356.system.entry.js} +1 -1
- package/lib/duet/{p-f81d8534.entry.js → p-28b67b94.entry.js} +1 -1
- package/lib/duet/{p-b4374f0e.entry.js → p-33426ddc.entry.js} +1 -1
- package/lib/duet/p-33cf6ed1.entry.js +4 -0
- package/lib/duet/p-3d3f773d.system.entry.js +4 -0
- package/lib/duet/p-3e1ef509.system.entry.js +4 -0
- package/lib/duet/p-3f78a826.system.js +4 -0
- package/lib/duet/{p-2a1a9f9f.entry.js → p-44ffb960.entry.js} +1 -1
- package/lib/duet/{p-dee41056.system.entry.js → p-453955cc.system.entry.js} +1 -1
- package/lib/duet/{p-66dde4d2.entry.js → p-4670a654.entry.js} +1 -1
- package/lib/duet/p-47645ea8.system.entry.js +4 -0
- package/lib/duet/p-504dbf8f.system.entry.js +4 -0
- package/lib/duet/{p-62c294d6.system.entry.js → p-5230ee3c.system.entry.js} +1 -1
- package/lib/duet/{p-bbc229d8.system.entry.js → p-56e172f5.system.entry.js} +1 -1
- package/lib/duet/{p-de2be65b.system.js → p-57ea2576.system.js} +1 -1
- package/lib/duet/p-5aa0d34d.entry.js +4 -0
- package/lib/duet/p-5fc7e1f7.system.entry.js +4 -0
- package/lib/duet/{p-3dc9d15d.system.entry.js → p-605bc214.system.entry.js} +1 -1
- package/lib/duet/{p-4a7911fd.entry.js → p-60ab57d4.entry.js} +1 -1
- package/lib/duet/p-64109493.entry.js +4 -0
- package/lib/duet/{p-7e108b7e.entry.js → p-69a5dc6b.entry.js} +1 -1
- package/lib/duet/{p-8cfce39e.system.entry.js → p-6a230911.system.entry.js} +1 -1
- package/lib/duet/p-6a760b8a.entry.js +4 -0
- package/lib/duet/{p-c9303f9a.entry.js → p-6d2da245.entry.js} +1 -1
- package/lib/duet/{p-ceb75b35.system.entry.js → p-712e7dde.system.entry.js} +1 -1
- package/lib/duet/{p-f71f12ed.entry.js → p-746655ba.entry.js} +1 -1
- package/lib/duet/p-7b6db837.system.entry.js +4 -0
- package/lib/duet/p-7d080785.system.entry.js +4 -0
- package/lib/duet/{p-4095dba5.entry.js → p-82dc2e0b.entry.js} +1 -1
- package/lib/duet/p-8c8e82aa.system.js +4 -0
- package/lib/duet/{p-fc397e03.system.entry.js → p-8c980350.system.entry.js} +1 -1
- package/lib/duet/{p-1cfe38b1.system.entry.js → p-8cb47a70.system.entry.js} +1 -1
- package/lib/duet/{p-7ee52f58.entry.js → p-8f03c3eb.entry.js} +1 -1
- package/lib/duet/p-91fa68a5.js +4 -0
- package/lib/duet/{p-e26116e0.system.entry.js → p-92d38668.system.entry.js} +1 -1
- package/lib/duet/p-95626e7e.system.entry.js +4 -0
- package/lib/duet/p-96808a2e.system.entry.js +4 -0
- package/lib/duet/{p-8ffe1461.system.entry.js → p-96c103b2.system.entry.js} +1 -1
- package/lib/duet/p-986779fb.js +4 -0
- package/lib/duet/{p-35e45c19.system.js → p-9a945278.system.js} +1 -1
- package/lib/duet/{p-2d2c45f9.entry.js → p-9c94be45.entry.js} +1 -1
- package/lib/duet/p-9ce1baab.system.entry.js +4 -0
- package/lib/duet/p-9ff25646.entry.js +4 -0
- package/lib/duet/p-a1d12e94.system.entry.js +4 -0
- package/lib/duet/p-b03a46b6.entry.js +4 -0
- package/lib/duet/{p-a88df408.entry.js → p-b1b8e510.entry.js} +1 -1
- package/lib/duet/p-b694cbf5.system.js +4 -0
- package/lib/duet/p-b7e50cfa.entry.js +4 -0
- package/lib/duet/p-b82927b0.system.entry.js +4 -0
- package/lib/duet/{p-c3688975.entry.js → p-ba205dca.entry.js} +1 -1
- package/lib/duet/{p-f71e337e.system.entry.js → p-bcae23fc.system.entry.js} +1 -1
- package/lib/duet/{p-5c5bdb06.system.entry.js → p-be19c57b.system.entry.js} +1 -1
- package/lib/duet/{p-a321a98c.entry.js → p-c4737f88.entry.js} +1 -1
- package/lib/duet/p-c5beceed.js +4 -0
- package/lib/duet/{p-27d538f7.system.entry.js → p-c5f10483.system.entry.js} +1 -1
- package/lib/duet/{p-a6096b05.system.entry.js → p-d35fd913.system.entry.js} +1 -1
- package/lib/duet/p-d4b4bfa6.entry.js +4 -0
- package/lib/duet/p-d7623eb8.system.entry.js +4 -0
- package/lib/duet/{p-36007600.entry.js → p-dc85d2a4.entry.js} +1 -1
- package/lib/duet/p-de093c16.entry.js +4 -0
- package/lib/duet/p-de842863.entry.js +4 -0
- package/lib/duet/{p-59a07cf9.entry.js → p-e08b8909.entry.js} +1 -1
- package/lib/duet/p-e39471b6.entry.js +4 -0
- package/lib/duet/p-e834c8d5.system.entry.js +4 -0
- package/lib/duet/{p-ce1374a4.system.entry.js → p-ef45cfe9.system.entry.js} +1 -1
- package/lib/duet/{p-031c2cd8.system.entry.js → p-f0b1850a.system.entry.js} +1 -1
- package/lib/duet/p-f53c8019.entry.js +4 -0
- package/lib/duet/{p-4265de16.system.entry.js → p-f96c4093.system.entry.js} +1 -1
- package/lib/duet/p-fbd83d67.entry.js +4 -0
- package/lib/duet/{p-1c41525a.entry.js → p-fdecaf46.entry.js} +1 -1
- package/lib/esm/duet-alert.entry.js +4 -2
- package/lib/esm/duet-badge.entry.js +2 -2
- package/lib/esm/duet-button_2.entry.js +4 -3
- package/lib/esm/duet-caption_4.entry.js +7 -8
- package/lib/esm/duet-card.entry.js +4 -4
- package/lib/esm/duet-checkbox.entry.js +1 -1
- package/lib/esm/duet-choice_2.entry.js +4 -3
- 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 +22 -12
- package/lib/esm/duet-divider_2.entry.js +1 -1
- 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 +4 -4
- package/lib/esm/duet-grid_2.entry.js +1 -1
- package/lib/esm/duet-header_2.entry.js +25 -9
- package/lib/esm/duet-hero.entry.js +6 -6
- package/lib/esm/duet-icon.entry.js +3 -3
- package/lib/esm/duet-input_2.entry.js +2 -2
- 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 +8 -7
- package/lib/esm/duet-notification_2.entry.js +6 -5
- package/lib/esm/duet-number-input.entry.js +36 -15
- package/lib/esm/duet-radio_2.entry.js +1 -1
- package/lib/esm/duet-range-slider.entry.js +1 -1
- package/lib/esm/duet-select.entry.js +2 -2
- package/lib/esm/duet-step_2.entry.js +1 -1
- package/lib/esm/duet-tab_2.entry.js +11 -5
- package/lib/esm/duet-table.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 +21 -10
- package/lib/esm/duet-tray.entry.js +20 -9
- package/lib/esm/duet-visually-hidden.entry.js +1 -1
- package/lib/esm/duet.js +2 -2
- package/lib/esm/{focus-utils-0b12f0df.js → focus-utils-1995e5a9.js} +1 -1
- package/lib/esm/{index-f70ddc7f.js → index-6e246691.js} +0 -3
- package/lib/esm/{language-utils-ab9c3afc.js → language-utils-d5c38f65.js} +23 -8
- package/lib/esm/loader.js +2 -2
- package/lib/esm/{string-utils-69cf0d09.js → string-utils-2f1793b8.js} +7 -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-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 +1 -1
- package/lib/esm-es5/duet-divider_2.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 +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 +2 -2
- 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-select.entry.js +1 -1
- package/lib/esm-es5/duet-step_2.entry.js +1 -1
- package/lib/esm-es5/duet-tab_2.entry.js +1 -1
- package/lib/esm-es5/duet-table.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-visually-hidden.entry.js +1 -1
- package/lib/esm-es5/duet.js +1 -1
- package/lib/esm-es5/focus-utils-1995e5a9.js +4 -0
- package/lib/esm-es5/{index-f70ddc7f.js → index-6e246691.js} +1 -1
- package/lib/esm-es5/language-utils-d5c38f65.js +4 -0
- package/lib/esm-es5/loader.js +1 -1
- package/lib/esm-es5/{string-utils-69cf0d09.js → string-utils-2f1793b8.js} +1 -1
- package/lib/html.html-data.json +4489 -0
- package/lib/types/components/duet-alert/duet-alert.d.ts +2 -1
- package/lib/types/components/duet-button/duet-button.d.ts +1 -1
- package/lib/types/components/duet-choice/duet-choice.d.ts +1 -1
- package/lib/types/components/duet-date-picker/duet-date-picker.d.ts +13 -7
- package/lib/types/components/duet-footer/duet-footer.d.ts +1 -1
- package/lib/types/components/duet-header/duet-header.d.ts +21 -5
- package/lib/types/components/duet-hero/duet-hero.d.ts +3 -3
- package/lib/types/components/duet-link/duet-link.d.ts +2 -3
- package/lib/types/components/duet-modal/duet-modal.d.ts +3 -3
- package/lib/types/components/duet-notification-drawer/duet-notification-drawer.d.ts +3 -3
- package/lib/types/components/duet-number-input/duet-number-input.d.ts +21 -0
- package/lib/types/components/duet-tab-group/duet-tab-group.d.ts +6 -0
- package/lib/types/components/duet-tooltip/duet-tooltip.d.ts +11 -0
- package/lib/types/components/duet-tray/duet-tray.d.ts +11 -0
- package/lib/types/components.d.ts +146 -384
- package/lib/types/utils/language-utils.d.ts +3 -2
- package/lib/types/utils/string-utils.d.ts +1 -0
- package/package.json +18 -14
- package/lib/cjs/duet-upload.cjs.entry.js +0 -866
- package/lib/collection/components/duet-upload/duet-upload-file-list.js +0 -49
- package/lib/collection/components/duet-upload/duet-upload-validators.js +0 -93
- package/lib/collection/components/duet-upload/duet-upload.css +0 -133
- package/lib/collection/components/duet-upload/duet-upload.js +0 -1440
- package/lib/collection/components/duet-upload/errorcodes.utils.js +0 -20
- package/lib/collection/components/duet-upload/mock.helpers.js +0 -91
- package/lib/collection/components/duet-upload/upload.helpers.js +0 -13
- package/lib/collection/components/duet-upload/xhr.helpers.js +0 -34
- package/lib/duet/p-0733c303.system.entry.js +0 -4
- package/lib/duet/p-095060cc.js +0 -4
- package/lib/duet/p-156864a1.system.entry.js +0 -4
- package/lib/duet/p-1911dfe7.system.entry.js +0 -4
- package/lib/duet/p-2834a302.entry.js +0 -4
- package/lib/duet/p-28a3d38f.system.entry.js +0 -4
- package/lib/duet/p-2a4d7c5b.system.entry.js +0 -4
- package/lib/duet/p-4289b543.entry.js +0 -4
- package/lib/duet/p-46a3ae43.system.js +0 -4
- package/lib/duet/p-4a38cf9d.entry.js +0 -4
- package/lib/duet/p-4be8e814.entry.js +0 -4
- package/lib/duet/p-591b2137.entry.js +0 -4
- package/lib/duet/p-5f70e318.entry.js +0 -4
- package/lib/duet/p-6c2729da.js +0 -4
- package/lib/duet/p-6f107847.system.entry.js +0 -4
- package/lib/duet/p-77a5fe4c.system.js +0 -4
- package/lib/duet/p-7809e78b.system.entry.js +0 -4
- package/lib/duet/p-7a36d76f.system.entry.js +0 -4
- package/lib/duet/p-884693f1.entry.js +0 -4
- package/lib/duet/p-8977b722.entry.js +0 -4
- package/lib/duet/p-89db3b94.entry.js +0 -4
- package/lib/duet/p-9381c2d4.entry.js +0 -4
- package/lib/duet/p-9a450c9a.entry.js +0 -4
- package/lib/duet/p-9bbfe606.system.entry.js +0 -4
- package/lib/duet/p-a0a066cb.system.entry.js +0 -4
- package/lib/duet/p-a89d5d7c.entry.js +0 -4
- package/lib/duet/p-b07055fd.system.entry.js +0 -4
- package/lib/duet/p-b456d684.system.entry.js +0 -4
- package/lib/duet/p-bd18c93f.js +0 -4
- package/lib/duet/p-bddb1c15.system.entry.js +0 -4
- package/lib/duet/p-c4d183e6.entry.js +0 -4
- package/lib/duet/p-cd4e8ccf.js +0 -4
- package/lib/duet/p-cf243bcb.system.entry.js +0 -4
- package/lib/duet/p-d37c8a05.system.js +0 -4
- package/lib/duet/p-d989af11.entry.js +0 -4
- package/lib/duet/p-e6128d82.system.entry.js +0 -4
- package/lib/duet/p-e86cdc17.entry.js +0 -4
- package/lib/duet/p-eadb29c7.entry.js +0 -4
- package/lib/duet/p-f30b14d6.system.entry.js +0 -4
- package/lib/duet/p-f79f8da1.entry.js +0 -4
- package/lib/esm/duet-upload.entry.js +0 -862
- package/lib/esm-es5/duet-upload.entry.js +0 -4
- package/lib/esm-es5/focus-utils-0b12f0df.js +0 -4
- package/lib/esm-es5/language-utils-ab9c3afc.js +0 -4
- package/lib/types/components/duet-upload/duet-upload-file-list.d.ts +0 -9
- package/lib/types/components/duet-upload/duet-upload-validators.d.ts +0 -12
- package/lib/types/components/duet-upload/duet-upload.d.ts +0 -311
- package/lib/types/components/duet-upload/errorcodes.utils.d.ts +0 -7
- package/lib/types/components/duet-upload/mock.helpers.d.ts +0 -2
- package/lib/types/components/duet-upload/upload.helpers.d.ts +0 -1
- package/lib/types/components/duet-upload/xhr.helpers.d.ts +0 -12
|
@@ -1,1440 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Built with Duet Design System
|
|
3
|
-
*/
|
|
4
|
-
import { Component, Element, Event, h, Host, Method, Prop, State, Watch } from "@stencil/core";
|
|
5
|
-
import { createID } from "../../utils/create-id";
|
|
6
|
-
import { getLocaleString } from "../../utils/language-utils";
|
|
7
|
-
import { inheritGlobalTheme } from "../../utils/themeable-component";
|
|
8
|
-
import { DuetUploadFileList } from "./duet-upload-file-list";
|
|
9
|
-
import { validateFile, validateTotalAmountIsAboveMax, validateTotalSizeIsAboveMax } from "./duet-upload-validators";
|
|
10
|
-
import { getError } from "./errorcodes.utils";
|
|
11
|
-
import { makeXhrRequest } from "./xhr.helpers";
|
|
12
|
-
/**
|
|
13
|
-
* @slot header - named slot - to place content after description / caption
|
|
14
|
-
* @slot fileheader - named slot - to place content above filelist (only displayed when filelist contains items)
|
|
15
|
-
* @slot filefooter - named slot - to place content below filelist (only displayed when filelist contains items)
|
|
16
|
-
*/
|
|
17
|
-
export class DuetUpload {
|
|
18
|
-
constructor() {
|
|
19
|
-
/**
|
|
20
|
-
* Own Properties
|
|
21
|
-
*/
|
|
22
|
-
this.buttonId = createID("DuetButton");
|
|
23
|
-
this.labelId = createID("DuetLabel");
|
|
24
|
-
this.uploadId = createID("DuetUpload");
|
|
25
|
-
this.filesInProgress = new Map();
|
|
26
|
-
this.fileMaxReached = false;
|
|
27
|
-
this.bytesMaxReached = false;
|
|
28
|
-
/**
|
|
29
|
-
* State() variables
|
|
30
|
-
*/
|
|
31
|
-
this.tick = Date.now();
|
|
32
|
-
/**
|
|
33
|
-
* If external is set to true, the upload component will not actually upload the files, but only keep states
|
|
34
|
-
* it will be up to you to handle the upload and return progress information to the upload-component
|
|
35
|
-
*/
|
|
36
|
-
this.external = false;
|
|
37
|
-
/**
|
|
38
|
-
* Property to change descriptionDefaults defaults on the component.
|
|
39
|
-
* normally you would handle these strings on an application level and override @label when needed
|
|
40
|
-
*/
|
|
41
|
-
this.buttonLabelDefaults = {
|
|
42
|
-
fi: "Lisää liite",
|
|
43
|
-
sv: "Lägg till en bilaga",
|
|
44
|
-
en: "Add an attachment",
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Label of button
|
|
48
|
-
* @default { fi: "Lisää liite", sv: "Lägg till en bilaga", en: "Add an attachment" }
|
|
49
|
-
*/
|
|
50
|
-
this.buttonLabel = getLocaleString(this.buttonLabelDefaults);
|
|
51
|
-
/**
|
|
52
|
-
* accessible Label of button
|
|
53
|
-
*/
|
|
54
|
-
this.accessibleButtonLabel = undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Theme of the input.
|
|
57
|
-
*/
|
|
58
|
-
this.theme = "";
|
|
59
|
-
/**
|
|
60
|
-
* Makes the input component disabled. This prevents users from being able to
|
|
61
|
-
* interact with the upload component, and conveys its inactive state to assistive technologies.
|
|
62
|
-
*/
|
|
63
|
-
this.disabled = false;
|
|
64
|
-
/**
|
|
65
|
-
* Controls the margin of the component.
|
|
66
|
-
*/
|
|
67
|
-
this.margin = "auto";
|
|
68
|
-
/**
|
|
69
|
-
* Set whether the input is required or not. Please note that this is necessary for
|
|
70
|
-
* accessible inputs when the user is required to fill them. When using this property
|
|
71
|
-
* you need to also set “novalidate” attribute to your form element to prevent
|
|
72
|
-
* browser from displaying its own validation errors.
|
|
73
|
-
*/
|
|
74
|
-
this.required = false;
|
|
75
|
-
/**
|
|
76
|
-
* Map of string that contain list of uploaded files.
|
|
77
|
-
*/
|
|
78
|
-
this.files = new Map();
|
|
79
|
-
/**
|
|
80
|
-
* Property to read if filelist contains errors or not
|
|
81
|
-
*/
|
|
82
|
-
this.valid = !this.required;
|
|
83
|
-
/**
|
|
84
|
-
* Property to change labelDefaults defaults on the component.
|
|
85
|
-
* normally you would handle these strings on an application level and override @label when needed
|
|
86
|
-
*/
|
|
87
|
-
this.labelDefaults = {
|
|
88
|
-
fi: "Lisää liite",
|
|
89
|
-
sv: "Lägg till en bilaga",
|
|
90
|
-
en: "Add attachments",
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Label for the input.
|
|
94
|
-
* @default { fi: "Lisää liite",sv: "Lägg till en bilaga",en: "Add attachments"}
|
|
95
|
-
*/
|
|
96
|
-
this.label = getLocaleString(this.labelDefaults);
|
|
97
|
-
/**
|
|
98
|
-
* Property to change descriptionDefaults defaults on the component.
|
|
99
|
-
* normally you would handle these strings on an application level and override @label when needed
|
|
100
|
-
*/
|
|
101
|
-
this.descriptionDefaults = {
|
|
102
|
-
fi: "Voit liittää {filetypes}-muotoisia tiedostoja sekä yleisimpiä videotiedostoja. Voit lähettää {maxbytes} verran tiedostoja yhdellä kertaa, ja lisätä enintään {maxfiles} liitettä kerrallaan.",
|
|
103
|
-
sv: "Du kan bifoga filer i flg. formater {filetypes} samt de vanligaste videofilerna. Du kan ladda upp {maxbytes} filer åt gången och lägga till upp till {maxfiles} bilagor åt gången.",
|
|
104
|
-
en: "You may attach the following filetypes: {filetypes} - as well as the most common video files. You can upload {maxbytes} of files at a time, and add up to {maxfiles} attachments at a time.",
|
|
105
|
-
};
|
|
106
|
-
/**
|
|
107
|
-
* Description for the upload component.
|
|
108
|
-
* @default ...
|
|
109
|
-
*/
|
|
110
|
-
this.description = getLocaleString(this.descriptionDefaults);
|
|
111
|
-
/**
|
|
112
|
-
* Defaults for the filelist's empty state.
|
|
113
|
-
* @default { fi: "Lisää liite",sv: "Lägg till en bilaga",en: "Add attachments"}
|
|
114
|
-
*/
|
|
115
|
-
this.fileListEmptyDefaults = {
|
|
116
|
-
fi: "Ei vielä lisättyjä tiedostoja.",
|
|
117
|
-
sv: "Inga filer har lagts till ännu.",
|
|
118
|
-
en: "No files added yet.",
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Label for the filelist's empty state.
|
|
122
|
-
* @default { fi: "Ei vielä lisättyjä tiedostoja.",sv: "Inga filer har lagts till ännu.",en: "No files added yet."}
|
|
123
|
-
*/
|
|
124
|
-
this.fileListEmpty = getLocaleString(this.fileListEmptyDefaults);
|
|
125
|
-
/**
|
|
126
|
-
* Display the input in error state along with an error message.
|
|
127
|
-
*/
|
|
128
|
-
this.error = "";
|
|
129
|
-
/**
|
|
130
|
-
* Visually hide the label, but still show it to screen readers.
|
|
131
|
-
*/
|
|
132
|
-
this.labelHidden = false;
|
|
133
|
-
/**
|
|
134
|
-
* if set, allows capture of media from user camera / microphone
|
|
135
|
-
* The capture attribute value is a string that specifies which camera to use for capture
|
|
136
|
-
* of image or video data, if the accept attribute indicates that the input should be of
|
|
137
|
-
* one of those types. A value of user indicates that the user-facing camera and/or
|
|
138
|
-
* microphone should be used. A value of environment specifies that the outward-facing
|
|
139
|
-
* camera and/or microphone should be used. If this attribute is missing, the user agent
|
|
140
|
-
* is free to decide on its own what to do. If the requested facing mode isn't available,
|
|
141
|
-
* the user agent may fall back to its preferred default mode.
|
|
142
|
-
*/
|
|
143
|
-
this.capture = undefined;
|
|
144
|
-
/**
|
|
145
|
-
* Use maxBytes to specify the maximum size in Bytes of a file that can be uploaded.
|
|
146
|
-
*/
|
|
147
|
-
this.maxBytes = 200000000;
|
|
148
|
-
/**
|
|
149
|
-
* Use maxBytesTotal to specify the maximum size in Bytes of All files combined that can be uploaded.
|
|
150
|
-
*/
|
|
151
|
-
this.maxBytesTotal = undefined;
|
|
152
|
-
/**
|
|
153
|
-
* Use maxFiles to specify the maximum amount of files that can be uploaded
|
|
154
|
-
*/
|
|
155
|
-
this.maxFiles = 99;
|
|
156
|
-
/**
|
|
157
|
-
* A string of commaseperated file type values that are allowed
|
|
158
|
-
* @example: .pdf,.doc,.docx
|
|
159
|
-
*/
|
|
160
|
-
this.allowedExtensions = "all";
|
|
161
|
-
/**
|
|
162
|
-
* A string of commaseperated mime type values that are allowed
|
|
163
|
-
* @example: image/*,application/msword,
|
|
164
|
-
*/
|
|
165
|
-
this.allowedMimetypes = "*";
|
|
166
|
-
/**
|
|
167
|
-
* Use multiple to allow the user to select multiple files when uploading
|
|
168
|
-
*/
|
|
169
|
-
this.multiple = true;
|
|
170
|
-
/**
|
|
171
|
-
* Use limitSelection to enforce the value in allowedExtension & allowedMimetypes when selecting files,
|
|
172
|
-
* by default this is off, setting this to true will limit the users choices to what has been explicitly set
|
|
173
|
-
*/
|
|
174
|
-
this.limitSelection = false;
|
|
175
|
-
/**
|
|
176
|
-
* Private functions
|
|
177
|
-
*/
|
|
178
|
-
this.kick = () => (this.tick = Date.now()); // will trigger re-render
|
|
179
|
-
this.genHashName = () => Date.now().toString(36) + Math.random();
|
|
180
|
-
this.updateValueInMap = (item, key, value, kick = true) => {
|
|
181
|
-
const fileItem = this.files.get(item);
|
|
182
|
-
fileItem[key] = value;
|
|
183
|
-
this.files.set(item, fileItem);
|
|
184
|
-
if (kick) {
|
|
185
|
-
this.kick();
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
this.updateProgress = (ev, name) => {
|
|
189
|
-
if (ev.lengthComputable) {
|
|
190
|
-
const percentComplete = (ev.loaded / ev.total) * 100;
|
|
191
|
-
this.updateValueInMap(name, "progress", percentComplete);
|
|
192
|
-
this.onProgress(name, percentComplete, ev);
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
console.log("cant read progress");
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
this.trackProgress = (name, remove = false) => {
|
|
199
|
-
if (remove) {
|
|
200
|
-
this.filesInProgress.delete(name);
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
this.filesInProgress.set(name, "inprogress");
|
|
204
|
-
}
|
|
205
|
-
if (this.filesInProgress.size === 0) {
|
|
206
|
-
this.onDone();
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
this.getFilesAsArray = () => {
|
|
210
|
-
const filesInQueue = [];
|
|
211
|
-
const filesInError = [];
|
|
212
|
-
this.files.forEach(value => {
|
|
213
|
-
if (value.valid && !value.deleted) {
|
|
214
|
-
filesInQueue.push(value);
|
|
215
|
-
}
|
|
216
|
-
else if (!value.valid && !value.deleted) {
|
|
217
|
-
filesInError.push(value);
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
return { valid: filesInQueue, invalid: filesInError };
|
|
221
|
-
};
|
|
222
|
-
this.resetFormFields = () => {
|
|
223
|
-
/**
|
|
224
|
-
* You cannot modify a FileList, nor remove single items from it
|
|
225
|
-
* This completely removes all items in the FileList
|
|
226
|
-
* We reset the form fields to always be able to re-upload files
|
|
227
|
-
* and because we handle all uploads and states internally in the component (not relying on native form elements)
|
|
228
|
-
*/
|
|
229
|
-
this.nativeInput.value = "";
|
|
230
|
-
};
|
|
231
|
-
this.getI18nError = (errorCode) => {
|
|
232
|
-
const errorFromJson = getError(errorCode);
|
|
233
|
-
const i18String = getLocaleString(errorFromJson.message);
|
|
234
|
-
if (i18String === "" || !i18String) {
|
|
235
|
-
return errorFromJson.system_message;
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
return i18String;
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
/**
|
|
242
|
-
* Eventlisteners for the XHR requests
|
|
243
|
-
*/
|
|
244
|
-
this.transferComplete = name => {
|
|
245
|
-
this.updateValueInMap(name, "progress", 100, false);
|
|
246
|
-
this.trackProgress(name, true);
|
|
247
|
-
};
|
|
248
|
-
this.transferDone = (xhr, name, status) => {
|
|
249
|
-
this.updateValueInMap(name, "status", status, false);
|
|
250
|
-
try {
|
|
251
|
-
const response = JSON.parse(xhr.response);
|
|
252
|
-
this.updateValueInMap(name, "url", response.url);
|
|
253
|
-
}
|
|
254
|
-
catch (e) {
|
|
255
|
-
this.updateValueInMap(name, "url", null);
|
|
256
|
-
console.error("Server did not respond with expected response {url: string}");
|
|
257
|
-
}
|
|
258
|
-
return;
|
|
259
|
-
};
|
|
260
|
-
this.transferDoneWithFailure = (xhr, name, status) => {
|
|
261
|
-
try {
|
|
262
|
-
const { error } = JSON.parse(xhr.response);
|
|
263
|
-
this.updateValueInMap(name, "error", { message: error.message, type: error.type });
|
|
264
|
-
}
|
|
265
|
-
catch (e) {
|
|
266
|
-
console.error("Server did not respond with expected response error:{message: string, type: int}");
|
|
267
|
-
this.updateValueInMap(name, "error", { type: status });
|
|
268
|
-
}
|
|
269
|
-
};
|
|
270
|
-
this.transferFailed = name => {
|
|
271
|
-
this.updateValueInMap(name, "error", getError("duet-upload-001"));
|
|
272
|
-
};
|
|
273
|
-
this.transferCanceled = name => {
|
|
274
|
-
this.files.delete(name);
|
|
275
|
-
this.validateTotals(name);
|
|
276
|
-
this.kick();
|
|
277
|
-
};
|
|
278
|
-
this.validateTotals = (name) => {
|
|
279
|
-
const isTotalSizeOverMaxSize = validateTotalSizeIsAboveMax(this.files, this.maxBytesTotal);
|
|
280
|
-
const isTotalFileAmountAboveMax = validateTotalAmountIsAboveMax(this.files, this.maxFiles);
|
|
281
|
-
if (isTotalSizeOverMaxSize && name) {
|
|
282
|
-
this.updateValueInMap(name, "error", getError("duet-upload-202"), false);
|
|
283
|
-
}
|
|
284
|
-
if (isTotalFileAmountAboveMax && name) {
|
|
285
|
-
this.updateValueInMap(name, "error", getError("duet-upload-301"), false);
|
|
286
|
-
}
|
|
287
|
-
this.bytesMaxReached = isTotalSizeOverMaxSize;
|
|
288
|
-
this.fileMaxReached = isTotalFileAmountAboveMax;
|
|
289
|
-
return {
|
|
290
|
-
bytesMaxReached: isTotalSizeOverMaxSize,
|
|
291
|
-
fileMaxReached: isTotalFileAmountAboveMax,
|
|
292
|
-
};
|
|
293
|
-
};
|
|
294
|
-
this.onDelete = (key, ev) => {
|
|
295
|
-
const deletedItem = this.files.get(key);
|
|
296
|
-
this.files.delete(key);
|
|
297
|
-
this.validateTotals();
|
|
298
|
-
this.kick();
|
|
299
|
-
if (!this.external) {
|
|
300
|
-
this.makeXHRDeleteRequest(deletedItem);
|
|
301
|
-
}
|
|
302
|
-
this.resetFormFields();
|
|
303
|
-
this.duetDelete.emit({
|
|
304
|
-
originalEvent: ev,
|
|
305
|
-
data: { deletion: deletedItem },
|
|
306
|
-
component: "duet-upload",
|
|
307
|
-
});
|
|
308
|
-
};
|
|
309
|
-
this.onCancel = (key, ev) => {
|
|
310
|
-
const cancelledItem = this.files.get(key);
|
|
311
|
-
this.files.delete(key);
|
|
312
|
-
if (!this.external) {
|
|
313
|
-
const { xhr } = cancelledItem;
|
|
314
|
-
xhr.abort();
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
this.kick();
|
|
318
|
-
}
|
|
319
|
-
this.resetFormFields();
|
|
320
|
-
this.duetCancel.emit({
|
|
321
|
-
originalEvent: ev,
|
|
322
|
-
data: { cancelled: cancelledItem },
|
|
323
|
-
component: "duet-upload",
|
|
324
|
-
});
|
|
325
|
-
};
|
|
326
|
-
this.onUpload = (ev) => {
|
|
327
|
-
this.duetUpload.emit({
|
|
328
|
-
originalEvent: ev,
|
|
329
|
-
component: "duet-upload",
|
|
330
|
-
});
|
|
331
|
-
};
|
|
332
|
-
this.onBlur = (ev) => {
|
|
333
|
-
this.duetBlur.emit({
|
|
334
|
-
originalEvent: ev,
|
|
335
|
-
component: "duet-upload",
|
|
336
|
-
});
|
|
337
|
-
};
|
|
338
|
-
this.onProgress = (key, percentComplete, ev) => {
|
|
339
|
-
this.duetChange.emit({
|
|
340
|
-
originalEvent: ev,
|
|
341
|
-
data: {
|
|
342
|
-
key,
|
|
343
|
-
percentComplete,
|
|
344
|
-
},
|
|
345
|
-
component: "duet-upload",
|
|
346
|
-
});
|
|
347
|
-
};
|
|
348
|
-
this.onFocus = (ev) => {
|
|
349
|
-
this.duetFocus.emit({
|
|
350
|
-
originalEvent: ev,
|
|
351
|
-
component: "duet-upload",
|
|
352
|
-
});
|
|
353
|
-
};
|
|
354
|
-
this.onDone = () => {
|
|
355
|
-
this.duetDone.emit({
|
|
356
|
-
component: "duet-upload",
|
|
357
|
-
data: { files: this.files },
|
|
358
|
-
});
|
|
359
|
-
};
|
|
360
|
-
this.startUpload = async (ev) => {
|
|
361
|
-
await this.setFocus();
|
|
362
|
-
this.nativeInput.click();
|
|
363
|
-
this.onUpload(ev);
|
|
364
|
-
ev.stopPropagation();
|
|
365
|
-
ev.preventDefault();
|
|
366
|
-
};
|
|
367
|
-
}
|
|
368
|
-
watchValidHandler(newValue, oldValue) {
|
|
369
|
-
if (newValue !== oldValue) {
|
|
370
|
-
this.kick();
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Component lifecycle events.
|
|
375
|
-
*/
|
|
376
|
-
componentWillLoad() {
|
|
377
|
-
inheritGlobalTheme(this);
|
|
378
|
-
}
|
|
379
|
-
componentWillRender() {
|
|
380
|
-
const { invalid, valid } = this.getFilesAsArray();
|
|
381
|
-
const oldValid = this.valid;
|
|
382
|
-
this.valid = invalid.length === 0 && valid.length !== 0;
|
|
383
|
-
if (this.valid !== oldValid) {
|
|
384
|
-
this.duetState.emit({
|
|
385
|
-
originalEvent: undefined,
|
|
386
|
-
data: { valid: this.valid, from: "componentWillRender" },
|
|
387
|
-
component: "duet-upload",
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* XHR request utilities
|
|
393
|
-
*/
|
|
394
|
-
makeXHRPostRequest(data) {
|
|
395
|
-
const xhr = new XMLHttpRequest();
|
|
396
|
-
const name = data.get("name");
|
|
397
|
-
xhr.upload.addEventListener("progress", ev => {
|
|
398
|
-
this.updateProgress(ev, name);
|
|
399
|
-
});
|
|
400
|
-
xhr.upload.addEventListener("load", () => {
|
|
401
|
-
this.transferComplete(name);
|
|
402
|
-
});
|
|
403
|
-
xhr.upload.addEventListener("error", () => {
|
|
404
|
-
this.transferFailed(name);
|
|
405
|
-
});
|
|
406
|
-
xhr.upload.addEventListener("abort", () => {
|
|
407
|
-
this.transferCanceled(name);
|
|
408
|
-
});
|
|
409
|
-
return makeXhrRequest({ data, name }, { type: "POST", uri: this.uri, xhr, argument: null, headers: null }, this.transferDoneWithFailure, this.transferDone, this.trackProgress);
|
|
410
|
-
}
|
|
411
|
-
makeXHRDeleteRequest(data) {
|
|
412
|
-
const { uid, item } = data;
|
|
413
|
-
const xhr = new XMLHttpRequest();
|
|
414
|
-
// don't present server issues to user on deletes, just remove them from the visible list
|
|
415
|
-
return makeXhrRequest({ data: null, name }, {
|
|
416
|
-
type: "DELETE",
|
|
417
|
-
xhr,
|
|
418
|
-
uri: this.uri,
|
|
419
|
-
arguments: `?key=${uid}&name=${item.name}`,
|
|
420
|
-
headers: {
|
|
421
|
-
"x-fileuid": uid,
|
|
422
|
-
"x-filename": item.name,
|
|
423
|
-
},
|
|
424
|
-
}, this.transferDoneWithFailure, this.transferDone, this.trackProgress);
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Component event handling.
|
|
428
|
-
*/
|
|
429
|
-
async onChange(ev) {
|
|
430
|
-
var _a;
|
|
431
|
-
const selectedFiles = Array.from((_a = this.nativeInput) === null || _a === void 0 ? void 0 : _a.files);
|
|
432
|
-
// FileList is a nice array like structure but
|
|
433
|
-
// to ensure uniqueness of files we use a mapping structure and
|
|
434
|
-
// key to the name (makes it easier to delete)
|
|
435
|
-
if (selectedFiles) {
|
|
436
|
-
for (const item of selectedFiles) {
|
|
437
|
-
const { valid, errorMessage, errorType, errorSystem } = validateFile(item, {
|
|
438
|
-
maxBytes: this.maxBytes,
|
|
439
|
-
allowedExtensions: this.allowedExtensions,
|
|
440
|
-
allowedMimetypes: this.allowedMimetypes,
|
|
441
|
-
});
|
|
442
|
-
const uid = this.genHashName();
|
|
443
|
-
const fileListItem = {
|
|
444
|
-
uid,
|
|
445
|
-
item: item,
|
|
446
|
-
size: item.size,
|
|
447
|
-
valid,
|
|
448
|
-
error: {
|
|
449
|
-
type: valid ? undefined : errorType,
|
|
450
|
-
message: valid ? undefined : errorMessage,
|
|
451
|
-
system_message: valid ? undefined : errorSystem,
|
|
452
|
-
},
|
|
453
|
-
progress: 0,
|
|
454
|
-
deleted: false,
|
|
455
|
-
xhr: false,
|
|
456
|
-
url: false,
|
|
457
|
-
};
|
|
458
|
-
this.files.set(item.name, fileListItem);
|
|
459
|
-
// validate that we haven't hit any maxfiles or maxbytes limits before we upload
|
|
460
|
-
const { bytesMaxReached, fileMaxReached } = this.validateTotals(item.name);
|
|
461
|
-
if (bytesMaxReached) {
|
|
462
|
-
// in case one of the global maxes have been reached, invalidate the file
|
|
463
|
-
this.updateValueInMap(item.name, "valid", false, false);
|
|
464
|
-
}
|
|
465
|
-
else if (fileMaxReached) {
|
|
466
|
-
// in case one of the global maxes have been reached, invalidate the file
|
|
467
|
-
this.updateValueInMap(item.name, "valid", false, false);
|
|
468
|
-
}
|
|
469
|
-
else if (valid && !this.external) {
|
|
470
|
-
// if all is well AND external file upload handling has not been set, start upload
|
|
471
|
-
const data = new FormData();
|
|
472
|
-
data.append("file", item);
|
|
473
|
-
data.append("uid", uid);
|
|
474
|
-
data.append("name", item.name);
|
|
475
|
-
data.append("metadata", JSON.stringify({ uid, url: this.uri, size: item.size }));
|
|
476
|
-
fileListItem.xhr = await this.makeXHRPostRequest(data);
|
|
477
|
-
}
|
|
478
|
-
// kick the stat to force update
|
|
479
|
-
this.kick();
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
// reset the form, so that a user may upload a file again (with the same name)
|
|
483
|
-
this.resetFormFields();
|
|
484
|
-
this.duetChange.emit({
|
|
485
|
-
originalEvent: ev,
|
|
486
|
-
data: { files: this.files },
|
|
487
|
-
component: "duet-upload",
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Sets focus on the specified `duet-input`. Use this method instead of the global
|
|
492
|
-
* `input.focus()`.
|
|
493
|
-
*/
|
|
494
|
-
async setFocus(options) {
|
|
495
|
-
if (this.nativeInput) {
|
|
496
|
-
this.nativeInput.focus(options);
|
|
497
|
-
}
|
|
498
|
-
return;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* Get list of files, divided in errors and valid sections
|
|
502
|
-
*/
|
|
503
|
-
async getFiles() {
|
|
504
|
-
if (!this.files || this.files.size === 0) {
|
|
505
|
-
return false;
|
|
506
|
-
}
|
|
507
|
-
return this.getFilesAsArray();
|
|
508
|
-
}
|
|
509
|
-
/**
|
|
510
|
-
* render() function
|
|
511
|
-
* Always the last one in the class.
|
|
512
|
-
*/
|
|
513
|
-
render() {
|
|
514
|
-
const identifier = this.identifier || this.uploadId;
|
|
515
|
-
let caption = this.description.replace(/{maxfiles}/g, this.maxFiles.toString());
|
|
516
|
-
caption = caption.replace(/{maxbytes}/g, `${Math.floor(this.maxBytes / 1024 / 1024)} MB`);
|
|
517
|
-
caption = caption.replace(/{filetypes}/g, this.allowedExtensions.split(",").join(", "));
|
|
518
|
-
return (h(Host, { class: { "duet-m-0": this.margin === "none" } },
|
|
519
|
-
h("duet-fieldset", { label: this.label, caption: caption },
|
|
520
|
-
h("slot", { name: "header" }),
|
|
521
|
-
h("duet-label", { theme: this.theme === "turva" ? "turva" : "default", size: "small", class: {
|
|
522
|
-
"duet-upload-filelist-empty": !this.files.size,
|
|
523
|
-
"duet-upload-filelist": true,
|
|
524
|
-
"duet-upload-filelist-filled": this.files.size,
|
|
525
|
-
}, id: this.labelId, for: identifier }, !this.files.size && this.fileListEmpty),
|
|
526
|
-
!!this.files.size && h("slot", { name: "fileheader" }),
|
|
527
|
-
h(DuetUploadFileList, { data: this.getFilesAsArray(), onDelete: this.onDelete, onCancel: this.onCancel, getError: this.getI18nError },
|
|
528
|
-
h("li", null, "testing something")),
|
|
529
|
-
!!this.files.size && h("slot", { name: "filefooter" }),
|
|
530
|
-
h("duet-spacer", { size: "large" }),
|
|
531
|
-
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" }, this.buttonLabel),
|
|
532
|
-
h("duet-spacer", { size: "medium" }),
|
|
533
|
-
(this.fileMaxReached || this.bytesMaxReached) && (h("duet-alert", null,
|
|
534
|
-
this.fileMaxReached && this.getI18nError("duet-upload-301"),
|
|
535
|
-
this.bytesMaxReached && this.getI18nError("duet-upload-202"))),
|
|
536
|
-
h("duet-spacer", { size: "medium" }),
|
|
537
|
-
h("duet-visually-hidden", null,
|
|
538
|
-
h("input", { ref: input => {
|
|
539
|
-
this.nativeInput = input;
|
|
540
|
-
}, accept: this.limitSelection ? undefined : `${this.allowedMimetypes},${this.allowedExtensions}`, onBlur: this.onBlur, onFocus: this.onFocus, onChange: e => this.onChange(e), type: "file", class: {
|
|
541
|
-
"duet-upload": true,
|
|
542
|
-
}, disabled: this.disabled, "aria-hidden": "true", required: this.required, name: this.name, id: this.identifier, multiple: this.multiple, capture: "user" })))));
|
|
543
|
-
}
|
|
544
|
-
static get is() { return "duet-upload"; }
|
|
545
|
-
static get encapsulation() { return "shadow"; }
|
|
546
|
-
static get originalStyleUrls() { return {
|
|
547
|
-
"$": ["duet-upload.scss"]
|
|
548
|
-
}; }
|
|
549
|
-
static get styleUrls() { return {
|
|
550
|
-
"$": ["duet-upload.css"]
|
|
551
|
-
}; }
|
|
552
|
-
static get properties() { return {
|
|
553
|
-
"accessibleActiveDescendant": {
|
|
554
|
-
"type": "string",
|
|
555
|
-
"mutable": false,
|
|
556
|
-
"complexType": {
|
|
557
|
-
"original": "string",
|
|
558
|
-
"resolved": "string",
|
|
559
|
-
"references": {}
|
|
560
|
-
},
|
|
561
|
-
"required": false,
|
|
562
|
-
"optional": false,
|
|
563
|
-
"docs": {
|
|
564
|
-
"tags": [],
|
|
565
|
-
"text": "Indicates the id of a related component\u2019s visually focused element."
|
|
566
|
-
},
|
|
567
|
-
"attribute": "accessible-active-descendant",
|
|
568
|
-
"reflect": false
|
|
569
|
-
},
|
|
570
|
-
"accessibleDescribedBy": {
|
|
571
|
-
"type": "string",
|
|
572
|
-
"mutable": false,
|
|
573
|
-
"complexType": {
|
|
574
|
-
"original": "string",
|
|
575
|
-
"resolved": "string",
|
|
576
|
-
"references": {}
|
|
577
|
-
},
|
|
578
|
-
"required": false,
|
|
579
|
-
"optional": false,
|
|
580
|
-
"docs": {
|
|
581
|
-
"tags": [],
|
|
582
|
-
"text": "Indicates the id of a component that describes the upload component."
|
|
583
|
-
},
|
|
584
|
-
"attribute": "accessible-described-by",
|
|
585
|
-
"reflect": false
|
|
586
|
-
},
|
|
587
|
-
"accessibleControls": {
|
|
588
|
-
"type": "string",
|
|
589
|
-
"mutable": false,
|
|
590
|
-
"complexType": {
|
|
591
|
-
"original": "string",
|
|
592
|
-
"resolved": "string",
|
|
593
|
-
"references": {}
|
|
594
|
-
},
|
|
595
|
-
"required": false,
|
|
596
|
-
"optional": false,
|
|
597
|
-
"docs": {
|
|
598
|
-
"tags": [],
|
|
599
|
-
"text": "Use this prop to add an aria-controls attribute. Use the attribute to\nindicate the id of a component controlled by this component."
|
|
600
|
-
},
|
|
601
|
-
"attribute": "accessible-controls",
|
|
602
|
-
"reflect": false
|
|
603
|
-
},
|
|
604
|
-
"accessibleOwns": {
|
|
605
|
-
"type": "string",
|
|
606
|
-
"mutable": false,
|
|
607
|
-
"complexType": {
|
|
608
|
-
"original": "string",
|
|
609
|
-
"resolved": "string",
|
|
610
|
-
"references": {}
|
|
611
|
-
},
|
|
612
|
-
"required": false,
|
|
613
|
-
"optional": false,
|
|
614
|
-
"docs": {
|
|
615
|
-
"tags": [],
|
|
616
|
-
"text": "Indicates the id of a component owned by the input."
|
|
617
|
-
},
|
|
618
|
-
"attribute": "accessible-owns",
|
|
619
|
-
"reflect": false
|
|
620
|
-
},
|
|
621
|
-
"external": {
|
|
622
|
-
"type": "boolean",
|
|
623
|
-
"mutable": false,
|
|
624
|
-
"complexType": {
|
|
625
|
-
"original": "boolean",
|
|
626
|
-
"resolved": "boolean",
|
|
627
|
-
"references": {}
|
|
628
|
-
},
|
|
629
|
-
"required": false,
|
|
630
|
-
"optional": false,
|
|
631
|
-
"docs": {
|
|
632
|
-
"tags": [],
|
|
633
|
-
"text": "If external is set to true, the upload component will not actually upload the files, but only keep states\nit will be up to you to handle the upload and return progress information to the upload-component"
|
|
634
|
-
},
|
|
635
|
-
"attribute": "external",
|
|
636
|
-
"reflect": false,
|
|
637
|
-
"defaultValue": "false"
|
|
638
|
-
},
|
|
639
|
-
"uri": {
|
|
640
|
-
"type": "string",
|
|
641
|
-
"mutable": false,
|
|
642
|
-
"complexType": {
|
|
643
|
-
"original": "string",
|
|
644
|
-
"resolved": "string",
|
|
645
|
-
"references": {}
|
|
646
|
-
},
|
|
647
|
-
"required": false,
|
|
648
|
-
"optional": false,
|
|
649
|
-
"docs": {
|
|
650
|
-
"tags": [],
|
|
651
|
-
"text": "Endpoint URI that is capable of receiving the files"
|
|
652
|
-
},
|
|
653
|
-
"attribute": "uri",
|
|
654
|
-
"reflect": false
|
|
655
|
-
},
|
|
656
|
-
"caption": {
|
|
657
|
-
"type": "string",
|
|
658
|
-
"mutable": false,
|
|
659
|
-
"complexType": {
|
|
660
|
-
"original": "string",
|
|
661
|
-
"resolved": "string",
|
|
662
|
-
"references": {}
|
|
663
|
-
},
|
|
664
|
-
"required": false,
|
|
665
|
-
"optional": false,
|
|
666
|
-
"docs": {
|
|
667
|
-
"tags": [],
|
|
668
|
-
"text": "Caption (underneath label) that can be set as a way of adding extra information"
|
|
669
|
-
},
|
|
670
|
-
"attribute": "caption",
|
|
671
|
-
"reflect": false
|
|
672
|
-
},
|
|
673
|
-
"buttonLabelDefaults": {
|
|
674
|
-
"type": "unknown",
|
|
675
|
-
"mutable": false,
|
|
676
|
-
"complexType": {
|
|
677
|
-
"original": "DuetLangObject",
|
|
678
|
-
"resolved": "DuetLangObject",
|
|
679
|
-
"references": {
|
|
680
|
-
"DuetLangObject": {
|
|
681
|
-
"location": "import",
|
|
682
|
-
"path": "../../utils/language-utils"
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
},
|
|
686
|
-
"required": false,
|
|
687
|
-
"optional": false,
|
|
688
|
-
"docs": {
|
|
689
|
-
"tags": [],
|
|
690
|
-
"text": "Property to change descriptionDefaults defaults on the component.\nnormally you would handle these strings on an application level and override @label when needed"
|
|
691
|
-
},
|
|
692
|
-
"defaultValue": "{\n fi: \"Lis\u00E4\u00E4 liite\",\n sv: \"L\u00E4gg till en bilaga\",\n en: \"Add an attachment\",\n }"
|
|
693
|
-
},
|
|
694
|
-
"buttonLabel": {
|
|
695
|
-
"type": "string",
|
|
696
|
-
"mutable": false,
|
|
697
|
-
"complexType": {
|
|
698
|
-
"original": "string",
|
|
699
|
-
"resolved": "string",
|
|
700
|
-
"references": {}
|
|
701
|
-
},
|
|
702
|
-
"required": false,
|
|
703
|
-
"optional": false,
|
|
704
|
-
"docs": {
|
|
705
|
-
"tags": [{
|
|
706
|
-
"text": "{ fi: \"Lis\u00E4\u00E4 liite\", sv: \"L\u00E4gg till en bilaga\", en: \"Add an attachment\" }",
|
|
707
|
-
"name": "default"
|
|
708
|
-
}],
|
|
709
|
-
"text": "Label of button"
|
|
710
|
-
},
|
|
711
|
-
"attribute": "button-label",
|
|
712
|
-
"reflect": false,
|
|
713
|
-
"defaultValue": "getLocaleString(this.buttonLabelDefaults)"
|
|
714
|
-
},
|
|
715
|
-
"accessibleButtonLabel": {
|
|
716
|
-
"type": "string",
|
|
717
|
-
"mutable": false,
|
|
718
|
-
"complexType": {
|
|
719
|
-
"original": "string",
|
|
720
|
-
"resolved": "string",
|
|
721
|
-
"references": {}
|
|
722
|
-
},
|
|
723
|
-
"required": false,
|
|
724
|
-
"optional": false,
|
|
725
|
-
"docs": {
|
|
726
|
-
"tags": [],
|
|
727
|
-
"text": "accessible Label of button"
|
|
728
|
-
},
|
|
729
|
-
"attribute": "accessible-button-label",
|
|
730
|
-
"reflect": false,
|
|
731
|
-
"defaultValue": "undefined"
|
|
732
|
-
},
|
|
733
|
-
"theme": {
|
|
734
|
-
"type": "string",
|
|
735
|
-
"mutable": true,
|
|
736
|
-
"complexType": {
|
|
737
|
-
"original": "DuetTheme",
|
|
738
|
-
"resolved": "\"\" | \"default\" | \"turva\"",
|
|
739
|
-
"references": {
|
|
740
|
-
"DuetTheme": {
|
|
741
|
-
"location": "import",
|
|
742
|
-
"path": "../../common-types"
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
},
|
|
746
|
-
"required": false,
|
|
747
|
-
"optional": false,
|
|
748
|
-
"docs": {
|
|
749
|
-
"tags": [],
|
|
750
|
-
"text": "Theme of the input."
|
|
751
|
-
},
|
|
752
|
-
"attribute": "theme",
|
|
753
|
-
"reflect": false,
|
|
754
|
-
"defaultValue": "\"\""
|
|
755
|
-
},
|
|
756
|
-
"disabled": {
|
|
757
|
-
"type": "boolean",
|
|
758
|
-
"mutable": false,
|
|
759
|
-
"complexType": {
|
|
760
|
-
"original": "boolean",
|
|
761
|
-
"resolved": "boolean",
|
|
762
|
-
"references": {}
|
|
763
|
-
},
|
|
764
|
-
"required": false,
|
|
765
|
-
"optional": false,
|
|
766
|
-
"docs": {
|
|
767
|
-
"tags": [],
|
|
768
|
-
"text": "Makes the input component disabled. This prevents users from being able to\ninteract with the upload component, and conveys its inactive state to assistive technologies."
|
|
769
|
-
},
|
|
770
|
-
"attribute": "disabled",
|
|
771
|
-
"reflect": true,
|
|
772
|
-
"defaultValue": "false"
|
|
773
|
-
},
|
|
774
|
-
"identifier": {
|
|
775
|
-
"type": "string",
|
|
776
|
-
"mutable": false,
|
|
777
|
-
"complexType": {
|
|
778
|
-
"original": "string",
|
|
779
|
-
"resolved": "string",
|
|
780
|
-
"references": {}
|
|
781
|
-
},
|
|
782
|
-
"required": false,
|
|
783
|
-
"optional": false,
|
|
784
|
-
"docs": {
|
|
785
|
-
"tags": [],
|
|
786
|
-
"text": "Adds a unique identifier for the upload component."
|
|
787
|
-
},
|
|
788
|
-
"attribute": "identifier",
|
|
789
|
-
"reflect": false
|
|
790
|
-
},
|
|
791
|
-
"margin": {
|
|
792
|
-
"type": "string",
|
|
793
|
-
"mutable": false,
|
|
794
|
-
"complexType": {
|
|
795
|
-
"original": "DuetMargin",
|
|
796
|
-
"resolved": "\"auto\" | \"none\"",
|
|
797
|
-
"references": {
|
|
798
|
-
"DuetMargin": {
|
|
799
|
-
"location": "import",
|
|
800
|
-
"path": "../../common-types"
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
},
|
|
804
|
-
"required": false,
|
|
805
|
-
"optional": false,
|
|
806
|
-
"docs": {
|
|
807
|
-
"tags": [],
|
|
808
|
-
"text": "Controls the margin of the component."
|
|
809
|
-
},
|
|
810
|
-
"attribute": "margin",
|
|
811
|
-
"reflect": false,
|
|
812
|
-
"defaultValue": "\"auto\""
|
|
813
|
-
},
|
|
814
|
-
"required": {
|
|
815
|
-
"type": "boolean",
|
|
816
|
-
"mutable": false,
|
|
817
|
-
"complexType": {
|
|
818
|
-
"original": "boolean",
|
|
819
|
-
"resolved": "boolean",
|
|
820
|
-
"references": {}
|
|
821
|
-
},
|
|
822
|
-
"required": false,
|
|
823
|
-
"optional": false,
|
|
824
|
-
"docs": {
|
|
825
|
-
"tags": [],
|
|
826
|
-
"text": "Set whether the input is required or not. Please note that this is necessary for\naccessible inputs when the user is required to fill them. When using this property\nyou need to also set \u201Cnovalidate\u201D attribute to your form element to prevent\nbrowser from displaying its own validation errors."
|
|
827
|
-
},
|
|
828
|
-
"attribute": "required",
|
|
829
|
-
"reflect": false,
|
|
830
|
-
"defaultValue": "false"
|
|
831
|
-
},
|
|
832
|
-
"files": {
|
|
833
|
-
"type": "unknown",
|
|
834
|
-
"mutable": true,
|
|
835
|
-
"complexType": {
|
|
836
|
-
"original": "StringMap",
|
|
837
|
-
"resolved": "StringMap",
|
|
838
|
-
"references": {
|
|
839
|
-
"StringMap": {
|
|
840
|
-
"location": "local"
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
},
|
|
844
|
-
"required": false,
|
|
845
|
-
"optional": false,
|
|
846
|
-
"docs": {
|
|
847
|
-
"tags": [],
|
|
848
|
-
"text": "Map of string that contain list of uploaded files."
|
|
849
|
-
},
|
|
850
|
-
"defaultValue": "new Map()"
|
|
851
|
-
},
|
|
852
|
-
"valid": {
|
|
853
|
-
"type": "boolean",
|
|
854
|
-
"mutable": true,
|
|
855
|
-
"complexType": {
|
|
856
|
-
"original": "boolean",
|
|
857
|
-
"resolved": "boolean",
|
|
858
|
-
"references": {}
|
|
859
|
-
},
|
|
860
|
-
"required": false,
|
|
861
|
-
"optional": false,
|
|
862
|
-
"docs": {
|
|
863
|
-
"tags": [],
|
|
864
|
-
"text": "Property to read if filelist contains errors or not"
|
|
865
|
-
},
|
|
866
|
-
"attribute": "valid",
|
|
867
|
-
"reflect": true,
|
|
868
|
-
"defaultValue": "!this.required"
|
|
869
|
-
},
|
|
870
|
-
"labelDefaults": {
|
|
871
|
-
"type": "unknown",
|
|
872
|
-
"mutable": false,
|
|
873
|
-
"complexType": {
|
|
874
|
-
"original": "DuetLangObject",
|
|
875
|
-
"resolved": "DuetLangObject",
|
|
876
|
-
"references": {
|
|
877
|
-
"DuetLangObject": {
|
|
878
|
-
"location": "import",
|
|
879
|
-
"path": "../../utils/language-utils"
|
|
880
|
-
}
|
|
881
|
-
}
|
|
882
|
-
},
|
|
883
|
-
"required": false,
|
|
884
|
-
"optional": false,
|
|
885
|
-
"docs": {
|
|
886
|
-
"tags": [],
|
|
887
|
-
"text": "Property to change labelDefaults defaults on the component.\nnormally you would handle these strings on an application level and override @label when needed"
|
|
888
|
-
},
|
|
889
|
-
"defaultValue": "{\n fi: \"Lis\u00E4\u00E4 liite\",\n sv: \"L\u00E4gg till en bilaga\",\n en: \"Add attachments\",\n }"
|
|
890
|
-
},
|
|
891
|
-
"label": {
|
|
892
|
-
"type": "string",
|
|
893
|
-
"mutable": false,
|
|
894
|
-
"complexType": {
|
|
895
|
-
"original": "string",
|
|
896
|
-
"resolved": "string",
|
|
897
|
-
"references": {}
|
|
898
|
-
},
|
|
899
|
-
"required": false,
|
|
900
|
-
"optional": false,
|
|
901
|
-
"docs": {
|
|
902
|
-
"tags": [{
|
|
903
|
-
"text": "{ fi: \"Lis\u00E4\u00E4 liite\",sv: \"L\u00E4gg till en bilaga\",en: \"Add attachments\"}",
|
|
904
|
-
"name": "default"
|
|
905
|
-
}],
|
|
906
|
-
"text": "Label for the input."
|
|
907
|
-
},
|
|
908
|
-
"attribute": "label",
|
|
909
|
-
"reflect": false,
|
|
910
|
-
"defaultValue": "getLocaleString(this.labelDefaults)"
|
|
911
|
-
},
|
|
912
|
-
"descriptionDefaults": {
|
|
913
|
-
"type": "unknown",
|
|
914
|
-
"mutable": false,
|
|
915
|
-
"complexType": {
|
|
916
|
-
"original": "DuetLangObject",
|
|
917
|
-
"resolved": "DuetLangObject",
|
|
918
|
-
"references": {
|
|
919
|
-
"DuetLangObject": {
|
|
920
|
-
"location": "import",
|
|
921
|
-
"path": "../../utils/language-utils"
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
},
|
|
925
|
-
"required": false,
|
|
926
|
-
"optional": false,
|
|
927
|
-
"docs": {
|
|
928
|
-
"tags": [],
|
|
929
|
-
"text": "Property to change descriptionDefaults defaults on the component.\nnormally you would handle these strings on an application level and override @label when needed"
|
|
930
|
-
},
|
|
931
|
-
"defaultValue": "{\n fi: \"Voit liitt\u00E4\u00E4 {filetypes}-muotoisia tiedostoja sek\u00E4 yleisimpi\u00E4 videotiedostoja. Voit l\u00E4hett\u00E4\u00E4 {maxbytes} verran tiedostoja yhdell\u00E4 kertaa, ja lis\u00E4t\u00E4 enint\u00E4\u00E4n {maxfiles} liitett\u00E4 kerrallaan.\",\n sv: \"Du kan bifoga filer i flg. formater {filetypes} samt de vanligaste videofilerna. Du kan ladda upp {maxbytes} filer \u00E5t g\u00E5ngen och l\u00E4gga till upp till {maxfiles} bilagor \u00E5t g\u00E5ngen.\",\n en: \"You may attach the following filetypes: {filetypes} - as well as the most common video files. You can upload {maxbytes} of files at a time, and add up to {maxfiles} attachments at a time.\",\n }"
|
|
932
|
-
},
|
|
933
|
-
"description": {
|
|
934
|
-
"type": "string",
|
|
935
|
-
"mutable": false,
|
|
936
|
-
"complexType": {
|
|
937
|
-
"original": "string",
|
|
938
|
-
"resolved": "string",
|
|
939
|
-
"references": {}
|
|
940
|
-
},
|
|
941
|
-
"required": false,
|
|
942
|
-
"optional": false,
|
|
943
|
-
"docs": {
|
|
944
|
-
"tags": [{
|
|
945
|
-
"text": "...",
|
|
946
|
-
"name": "default"
|
|
947
|
-
}],
|
|
948
|
-
"text": "Description for the upload component."
|
|
949
|
-
},
|
|
950
|
-
"attribute": "description",
|
|
951
|
-
"reflect": false,
|
|
952
|
-
"defaultValue": "getLocaleString(this.descriptionDefaults)"
|
|
953
|
-
},
|
|
954
|
-
"fileListEmptyDefaults": {
|
|
955
|
-
"type": "unknown",
|
|
956
|
-
"mutable": false,
|
|
957
|
-
"complexType": {
|
|
958
|
-
"original": "DuetLangObject",
|
|
959
|
-
"resolved": "DuetLangObject",
|
|
960
|
-
"references": {
|
|
961
|
-
"DuetLangObject": {
|
|
962
|
-
"location": "import",
|
|
963
|
-
"path": "../../utils/language-utils"
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
},
|
|
967
|
-
"required": false,
|
|
968
|
-
"optional": false,
|
|
969
|
-
"docs": {
|
|
970
|
-
"tags": [{
|
|
971
|
-
"text": "{ fi: \"Lis\u00E4\u00E4 liite\",sv: \"L\u00E4gg till en bilaga\",en: \"Add attachments\"}",
|
|
972
|
-
"name": "default"
|
|
973
|
-
}],
|
|
974
|
-
"text": "Defaults for the filelist's empty state."
|
|
975
|
-
},
|
|
976
|
-
"defaultValue": "{\n fi: \"Ei viel\u00E4 lis\u00E4ttyj\u00E4 tiedostoja.\",\n sv: \"Inga filer har lagts till \u00E4nnu.\",\n en: \"No files added yet.\",\n }"
|
|
977
|
-
},
|
|
978
|
-
"fileListEmpty": {
|
|
979
|
-
"type": "string",
|
|
980
|
-
"mutable": false,
|
|
981
|
-
"complexType": {
|
|
982
|
-
"original": "string",
|
|
983
|
-
"resolved": "string",
|
|
984
|
-
"references": {}
|
|
985
|
-
},
|
|
986
|
-
"required": false,
|
|
987
|
-
"optional": false,
|
|
988
|
-
"docs": {
|
|
989
|
-
"tags": [{
|
|
990
|
-
"text": "{ fi: \"Ei viel\u00E4 lis\u00E4ttyj\u00E4 tiedostoja.\",sv: \"Inga filer har lagts till \u00E4nnu.\",en: \"No files added yet.\"}",
|
|
991
|
-
"name": "default"
|
|
992
|
-
}],
|
|
993
|
-
"text": "Label for the filelist's empty state."
|
|
994
|
-
},
|
|
995
|
-
"attribute": "file-list-empty",
|
|
996
|
-
"reflect": false,
|
|
997
|
-
"defaultValue": "getLocaleString(this.fileListEmptyDefaults)"
|
|
998
|
-
},
|
|
999
|
-
"error": {
|
|
1000
|
-
"type": "string",
|
|
1001
|
-
"mutable": false,
|
|
1002
|
-
"complexType": {
|
|
1003
|
-
"original": "string",
|
|
1004
|
-
"resolved": "string",
|
|
1005
|
-
"references": {}
|
|
1006
|
-
},
|
|
1007
|
-
"required": false,
|
|
1008
|
-
"optional": false,
|
|
1009
|
-
"docs": {
|
|
1010
|
-
"tags": [],
|
|
1011
|
-
"text": "Display the input in error state along with an error message."
|
|
1012
|
-
},
|
|
1013
|
-
"attribute": "error",
|
|
1014
|
-
"reflect": false,
|
|
1015
|
-
"defaultValue": "\"\""
|
|
1016
|
-
},
|
|
1017
|
-
"labelHidden": {
|
|
1018
|
-
"type": "boolean",
|
|
1019
|
-
"mutable": false,
|
|
1020
|
-
"complexType": {
|
|
1021
|
-
"original": "boolean",
|
|
1022
|
-
"resolved": "boolean",
|
|
1023
|
-
"references": {}
|
|
1024
|
-
},
|
|
1025
|
-
"required": false,
|
|
1026
|
-
"optional": false,
|
|
1027
|
-
"docs": {
|
|
1028
|
-
"tags": [],
|
|
1029
|
-
"text": "Visually hide the label, but still show it to screen readers."
|
|
1030
|
-
},
|
|
1031
|
-
"attribute": "label-hidden",
|
|
1032
|
-
"reflect": false,
|
|
1033
|
-
"defaultValue": "false"
|
|
1034
|
-
},
|
|
1035
|
-
"name": {
|
|
1036
|
-
"type": "string",
|
|
1037
|
-
"mutable": false,
|
|
1038
|
-
"complexType": {
|
|
1039
|
-
"original": "string",
|
|
1040
|
-
"resolved": "string",
|
|
1041
|
-
"references": {}
|
|
1042
|
-
},
|
|
1043
|
-
"required": false,
|
|
1044
|
-
"optional": false,
|
|
1045
|
-
"docs": {
|
|
1046
|
-
"tags": [],
|
|
1047
|
-
"text": "Name of the upload component."
|
|
1048
|
-
},
|
|
1049
|
-
"attribute": "name",
|
|
1050
|
-
"reflect": false
|
|
1051
|
-
},
|
|
1052
|
-
"capture": {
|
|
1053
|
-
"type": "any",
|
|
1054
|
-
"mutable": false,
|
|
1055
|
-
"complexType": {
|
|
1056
|
-
"original": "string | boolean",
|
|
1057
|
-
"resolved": "boolean | string",
|
|
1058
|
-
"references": {}
|
|
1059
|
-
},
|
|
1060
|
-
"required": false,
|
|
1061
|
-
"optional": false,
|
|
1062
|
-
"docs": {
|
|
1063
|
-
"tags": [],
|
|
1064
|
-
"text": "if set, allows capture of media from user camera / microphone\nThe capture attribute value is a string that specifies which camera to use for capture\nof image or video data, if the accept attribute indicates that the input should be of\none of those types. A value of user indicates that the user-facing camera and/or\nmicrophone should be used. A value of environment specifies that the outward-facing\ncamera and/or microphone should be used. If this attribute is missing, the user agent\nis free to decide on its own what to do. If the requested facing mode isn't available,\nthe user agent may fall back to its preferred default mode."
|
|
1065
|
-
},
|
|
1066
|
-
"attribute": "capture",
|
|
1067
|
-
"reflect": false,
|
|
1068
|
-
"defaultValue": "undefined"
|
|
1069
|
-
},
|
|
1070
|
-
"maxBytes": {
|
|
1071
|
-
"type": "number",
|
|
1072
|
-
"mutable": false,
|
|
1073
|
-
"complexType": {
|
|
1074
|
-
"original": "number",
|
|
1075
|
-
"resolved": "number",
|
|
1076
|
-
"references": {}
|
|
1077
|
-
},
|
|
1078
|
-
"required": false,
|
|
1079
|
-
"optional": false,
|
|
1080
|
-
"docs": {
|
|
1081
|
-
"tags": [],
|
|
1082
|
-
"text": "Use maxBytes to specify the maximum size in Bytes of a file that can be uploaded."
|
|
1083
|
-
},
|
|
1084
|
-
"attribute": "max-bytes",
|
|
1085
|
-
"reflect": false,
|
|
1086
|
-
"defaultValue": "200000000"
|
|
1087
|
-
},
|
|
1088
|
-
"maxBytesTotal": {
|
|
1089
|
-
"type": "number",
|
|
1090
|
-
"mutable": false,
|
|
1091
|
-
"complexType": {
|
|
1092
|
-
"original": "number",
|
|
1093
|
-
"resolved": "number",
|
|
1094
|
-
"references": {}
|
|
1095
|
-
},
|
|
1096
|
-
"required": false,
|
|
1097
|
-
"optional": false,
|
|
1098
|
-
"docs": {
|
|
1099
|
-
"tags": [],
|
|
1100
|
-
"text": "Use maxBytesTotal to specify the maximum size in Bytes of All files combined that can be uploaded."
|
|
1101
|
-
},
|
|
1102
|
-
"attribute": "max-bytes-total",
|
|
1103
|
-
"reflect": false,
|
|
1104
|
-
"defaultValue": "undefined"
|
|
1105
|
-
},
|
|
1106
|
-
"maxFiles": {
|
|
1107
|
-
"type": "number",
|
|
1108
|
-
"mutable": false,
|
|
1109
|
-
"complexType": {
|
|
1110
|
-
"original": "number",
|
|
1111
|
-
"resolved": "number",
|
|
1112
|
-
"references": {}
|
|
1113
|
-
},
|
|
1114
|
-
"required": false,
|
|
1115
|
-
"optional": false,
|
|
1116
|
-
"docs": {
|
|
1117
|
-
"tags": [],
|
|
1118
|
-
"text": "Use maxFiles to specify the maximum amount of files that can be uploaded"
|
|
1119
|
-
},
|
|
1120
|
-
"attribute": "max-files",
|
|
1121
|
-
"reflect": false,
|
|
1122
|
-
"defaultValue": "99"
|
|
1123
|
-
},
|
|
1124
|
-
"allowedExtensions": {
|
|
1125
|
-
"type": "string",
|
|
1126
|
-
"mutable": false,
|
|
1127
|
-
"complexType": {
|
|
1128
|
-
"original": "string",
|
|
1129
|
-
"resolved": "string",
|
|
1130
|
-
"references": {}
|
|
1131
|
-
},
|
|
1132
|
-
"required": false,
|
|
1133
|
-
"optional": false,
|
|
1134
|
-
"docs": {
|
|
1135
|
-
"tags": [{
|
|
1136
|
-
"text": ": .pdf,.doc,.docx",
|
|
1137
|
-
"name": "example"
|
|
1138
|
-
}],
|
|
1139
|
-
"text": "A string of commaseperated file type values that are allowed"
|
|
1140
|
-
},
|
|
1141
|
-
"attribute": "allowed-extensions",
|
|
1142
|
-
"reflect": false,
|
|
1143
|
-
"defaultValue": "\"all\""
|
|
1144
|
-
},
|
|
1145
|
-
"allowedMimetypes": {
|
|
1146
|
-
"type": "string",
|
|
1147
|
-
"mutable": false,
|
|
1148
|
-
"complexType": {
|
|
1149
|
-
"original": "string",
|
|
1150
|
-
"resolved": "string",
|
|
1151
|
-
"references": {}
|
|
1152
|
-
},
|
|
1153
|
-
"required": false,
|
|
1154
|
-
"optional": false,
|
|
1155
|
-
"docs": {
|
|
1156
|
-
"tags": [{
|
|
1157
|
-
"text": ": image/*,application/msword,",
|
|
1158
|
-
"name": "example"
|
|
1159
|
-
}],
|
|
1160
|
-
"text": "A string of commaseperated mime type values that are allowed"
|
|
1161
|
-
},
|
|
1162
|
-
"attribute": "allowed-mimetypes",
|
|
1163
|
-
"reflect": false,
|
|
1164
|
-
"defaultValue": "\"*\""
|
|
1165
|
-
},
|
|
1166
|
-
"multiple": {
|
|
1167
|
-
"type": "boolean",
|
|
1168
|
-
"mutable": false,
|
|
1169
|
-
"complexType": {
|
|
1170
|
-
"original": "boolean",
|
|
1171
|
-
"resolved": "boolean",
|
|
1172
|
-
"references": {}
|
|
1173
|
-
},
|
|
1174
|
-
"required": false,
|
|
1175
|
-
"optional": false,
|
|
1176
|
-
"docs": {
|
|
1177
|
-
"tags": [],
|
|
1178
|
-
"text": "Use multiple to allow the user to select multiple files when uploading"
|
|
1179
|
-
},
|
|
1180
|
-
"attribute": "multiple",
|
|
1181
|
-
"reflect": false,
|
|
1182
|
-
"defaultValue": "true"
|
|
1183
|
-
},
|
|
1184
|
-
"limitSelection": {
|
|
1185
|
-
"type": "boolean",
|
|
1186
|
-
"mutable": false,
|
|
1187
|
-
"complexType": {
|
|
1188
|
-
"original": "boolean",
|
|
1189
|
-
"resolved": "boolean",
|
|
1190
|
-
"references": {}
|
|
1191
|
-
},
|
|
1192
|
-
"required": false,
|
|
1193
|
-
"optional": false,
|
|
1194
|
-
"docs": {
|
|
1195
|
-
"tags": [],
|
|
1196
|
-
"text": "Use limitSelection to enforce the value in allowedExtension & allowedMimetypes when selecting files,\nby default this is off, setting this to true will limit the users choices to what has been explicitly set"
|
|
1197
|
-
},
|
|
1198
|
-
"attribute": "limit-selection",
|
|
1199
|
-
"reflect": false,
|
|
1200
|
-
"defaultValue": "false"
|
|
1201
|
-
},
|
|
1202
|
-
"value": {
|
|
1203
|
-
"type": "string",
|
|
1204
|
-
"mutable": true,
|
|
1205
|
-
"complexType": {
|
|
1206
|
-
"original": "string",
|
|
1207
|
-
"resolved": "string",
|
|
1208
|
-
"references": {}
|
|
1209
|
-
},
|
|
1210
|
-
"required": false,
|
|
1211
|
-
"optional": false,
|
|
1212
|
-
"docs": {
|
|
1213
|
-
"tags": [],
|
|
1214
|
-
"text": "Value of the input."
|
|
1215
|
-
},
|
|
1216
|
-
"attribute": "value",
|
|
1217
|
-
"reflect": false
|
|
1218
|
-
}
|
|
1219
|
-
}; }
|
|
1220
|
-
static get states() { return {
|
|
1221
|
-
"tick": {}
|
|
1222
|
-
}; }
|
|
1223
|
-
static get events() { return [{
|
|
1224
|
-
"method": "duetChange",
|
|
1225
|
-
"name": "duetChange",
|
|
1226
|
-
"bubbles": false,
|
|
1227
|
-
"cancelable": true,
|
|
1228
|
-
"composed": true,
|
|
1229
|
-
"docs": {
|
|
1230
|
-
"tags": [],
|
|
1231
|
-
"text": "Emitted when the value has changed."
|
|
1232
|
-
},
|
|
1233
|
-
"complexType": {
|
|
1234
|
-
"original": "DuetUploadEvent",
|
|
1235
|
-
"resolved": "{ originalEvent?: Event; data?: Record<string, any>; component: \"duet-upload\"; }",
|
|
1236
|
-
"references": {
|
|
1237
|
-
"DuetUploadEvent": {
|
|
1238
|
-
"location": "local"
|
|
1239
|
-
}
|
|
1240
|
-
}
|
|
1241
|
-
}
|
|
1242
|
-
}, {
|
|
1243
|
-
"method": "duetBlur",
|
|
1244
|
-
"name": "duetBlur",
|
|
1245
|
-
"bubbles": true,
|
|
1246
|
-
"cancelable": true,
|
|
1247
|
-
"composed": true,
|
|
1248
|
-
"docs": {
|
|
1249
|
-
"tags": [],
|
|
1250
|
-
"text": "Emitted when the input loses focus."
|
|
1251
|
-
},
|
|
1252
|
-
"complexType": {
|
|
1253
|
-
"original": "DuetUploadEvent",
|
|
1254
|
-
"resolved": "{ originalEvent?: Event; data?: Record<string, any>; component: \"duet-upload\"; }",
|
|
1255
|
-
"references": {
|
|
1256
|
-
"DuetUploadEvent": {
|
|
1257
|
-
"location": "local"
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1261
|
-
}, {
|
|
1262
|
-
"method": "duetFocus",
|
|
1263
|
-
"name": "duetFocus",
|
|
1264
|
-
"bubbles": true,
|
|
1265
|
-
"cancelable": true,
|
|
1266
|
-
"composed": true,
|
|
1267
|
-
"docs": {
|
|
1268
|
-
"tags": [],
|
|
1269
|
-
"text": "Emitted when the input has focus."
|
|
1270
|
-
},
|
|
1271
|
-
"complexType": {
|
|
1272
|
-
"original": "DuetUploadEvent",
|
|
1273
|
-
"resolved": "{ originalEvent?: Event; data?: Record<string, any>; component: \"duet-upload\"; }",
|
|
1274
|
-
"references": {
|
|
1275
|
-
"DuetUploadEvent": {
|
|
1276
|
-
"location": "local"
|
|
1277
|
-
}
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
}, {
|
|
1281
|
-
"method": "duetDone",
|
|
1282
|
-
"name": "duetDone",
|
|
1283
|
-
"bubbles": false,
|
|
1284
|
-
"cancelable": true,
|
|
1285
|
-
"composed": true,
|
|
1286
|
-
"docs": {
|
|
1287
|
-
"tags": [],
|
|
1288
|
-
"text": "Emitted when the current upload batch finishes"
|
|
1289
|
-
},
|
|
1290
|
-
"complexType": {
|
|
1291
|
-
"original": "DuetUploadEvent",
|
|
1292
|
-
"resolved": "{ originalEvent?: Event; data?: Record<string, any>; component: \"duet-upload\"; }",
|
|
1293
|
-
"references": {
|
|
1294
|
-
"DuetUploadEvent": {
|
|
1295
|
-
"location": "local"
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
}
|
|
1299
|
-
}, {
|
|
1300
|
-
"method": "duetState",
|
|
1301
|
-
"name": "duetState",
|
|
1302
|
-
"bubbles": false,
|
|
1303
|
-
"cancelable": true,
|
|
1304
|
-
"composed": true,
|
|
1305
|
-
"docs": {
|
|
1306
|
-
"tags": [],
|
|
1307
|
-
"text": "Emitted when the current validation state changes internally"
|
|
1308
|
-
},
|
|
1309
|
-
"complexType": {
|
|
1310
|
-
"original": "DuetUploadEvent",
|
|
1311
|
-
"resolved": "{ originalEvent?: Event; data?: Record<string, any>; component: \"duet-upload\"; }",
|
|
1312
|
-
"references": {
|
|
1313
|
-
"DuetUploadEvent": {
|
|
1314
|
-
"location": "local"
|
|
1315
|
-
}
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
}, {
|
|
1319
|
-
"method": "duetDelete",
|
|
1320
|
-
"name": "duetDelete",
|
|
1321
|
-
"bubbles": false,
|
|
1322
|
-
"cancelable": true,
|
|
1323
|
-
"composed": true,
|
|
1324
|
-
"docs": {
|
|
1325
|
-
"tags": [],
|
|
1326
|
-
"text": "Emitted when a user clicks delete to delete an uploaded file, or a file entry with error"
|
|
1327
|
-
},
|
|
1328
|
-
"complexType": {
|
|
1329
|
-
"original": "DuetUploadEvent",
|
|
1330
|
-
"resolved": "{ originalEvent?: Event; data?: Record<string, any>; component: \"duet-upload\"; }",
|
|
1331
|
-
"references": {
|
|
1332
|
-
"DuetUploadEvent": {
|
|
1333
|
-
"location": "local"
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
}
|
|
1337
|
-
}, {
|
|
1338
|
-
"method": "duetCancel",
|
|
1339
|
-
"name": "duetCancel",
|
|
1340
|
-
"bubbles": false,
|
|
1341
|
-
"cancelable": true,
|
|
1342
|
-
"composed": true,
|
|
1343
|
-
"docs": {
|
|
1344
|
-
"tags": [],
|
|
1345
|
-
"text": "Emitted when a user clicks cancel on an upload in progress"
|
|
1346
|
-
},
|
|
1347
|
-
"complexType": {
|
|
1348
|
-
"original": "DuetUploadEvent",
|
|
1349
|
-
"resolved": "{ originalEvent?: Event; data?: Record<string, any>; component: \"duet-upload\"; }",
|
|
1350
|
-
"references": {
|
|
1351
|
-
"DuetUploadEvent": {
|
|
1352
|
-
"location": "local"
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
}, {
|
|
1357
|
-
"method": "duetProgress",
|
|
1358
|
-
"name": "duetProgress",
|
|
1359
|
-
"bubbles": false,
|
|
1360
|
-
"cancelable": true,
|
|
1361
|
-
"composed": true,
|
|
1362
|
-
"docs": {
|
|
1363
|
-
"tags": [],
|
|
1364
|
-
"text": "Emitted when the file progress is updated."
|
|
1365
|
-
},
|
|
1366
|
-
"complexType": {
|
|
1367
|
-
"original": "DuetUploadEvent",
|
|
1368
|
-
"resolved": "{ originalEvent?: Event; data?: Record<string, any>; component: \"duet-upload\"; }",
|
|
1369
|
-
"references": {
|
|
1370
|
-
"DuetUploadEvent": {
|
|
1371
|
-
"location": "local"
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
}, {
|
|
1376
|
-
"method": "duetUpload",
|
|
1377
|
-
"name": "duetUpload",
|
|
1378
|
-
"bubbles": false,
|
|
1379
|
-
"cancelable": true,
|
|
1380
|
-
"composed": true,
|
|
1381
|
-
"docs": {
|
|
1382
|
-
"tags": [],
|
|
1383
|
-
"text": "Emitted when the user clicks the upload button"
|
|
1384
|
-
},
|
|
1385
|
-
"complexType": {
|
|
1386
|
-
"original": "DuetUploadEvent",
|
|
1387
|
-
"resolved": "{ originalEvent?: Event; data?: Record<string, any>; component: \"duet-upload\"; }",
|
|
1388
|
-
"references": {
|
|
1389
|
-
"DuetUploadEvent": {
|
|
1390
|
-
"location": "local"
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
}
|
|
1394
|
-
}]; }
|
|
1395
|
-
static get methods() { return {
|
|
1396
|
-
"setFocus": {
|
|
1397
|
-
"complexType": {
|
|
1398
|
-
"signature": "(options?: FocusOptions) => Promise<void>",
|
|
1399
|
-
"parameters": [{
|
|
1400
|
-
"tags": [],
|
|
1401
|
-
"text": ""
|
|
1402
|
-
}],
|
|
1403
|
-
"references": {
|
|
1404
|
-
"Promise": {
|
|
1405
|
-
"location": "global"
|
|
1406
|
-
},
|
|
1407
|
-
"FocusOptions": {
|
|
1408
|
-
"location": "global"
|
|
1409
|
-
}
|
|
1410
|
-
},
|
|
1411
|
-
"return": "Promise<void>"
|
|
1412
|
-
},
|
|
1413
|
-
"docs": {
|
|
1414
|
-
"text": "Sets focus on the specified `duet-input`. Use this method instead of the global\n`input.focus()`.",
|
|
1415
|
-
"tags": []
|
|
1416
|
-
}
|
|
1417
|
-
},
|
|
1418
|
-
"getFiles": {
|
|
1419
|
-
"complexType": {
|
|
1420
|
-
"signature": "() => Promise<false | { valid: any[]; invalid: any[]; }>",
|
|
1421
|
-
"parameters": [],
|
|
1422
|
-
"references": {
|
|
1423
|
-
"Promise": {
|
|
1424
|
-
"location": "global"
|
|
1425
|
-
}
|
|
1426
|
-
},
|
|
1427
|
-
"return": "Promise<false | { valid: any[]; invalid: any[]; }>"
|
|
1428
|
-
},
|
|
1429
|
-
"docs": {
|
|
1430
|
-
"text": "Get list of files, divided in errors and valid sections",
|
|
1431
|
-
"tags": []
|
|
1432
|
-
}
|
|
1433
|
-
}
|
|
1434
|
-
}; }
|
|
1435
|
-
static get elementRef() { return "element"; }
|
|
1436
|
-
static get watchers() { return [{
|
|
1437
|
-
"propName": "valid",
|
|
1438
|
-
"methodName": "watchValidHandler"
|
|
1439
|
-
}]; }
|
|
1440
|
-
}
|