@watermarkinsights/ripple 3.27.0 → 3.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cjs/{chartFunctions-b2e0cb4e.js → chartFunctions-42cfb4d3.js} +596 -596
- package/dist/cjs/{functions-9807717e.js → functions-85c3c557.js} +498 -498
- package/dist/cjs/{global-42a24725.js → global-9982752f.js} +72 -72
- package/dist/cjs/{http-service-9e8c4dd5.js → http-service-494d81de.js} +49 -49
- package/dist/cjs/{interfaces-30a74c1f.js → interfaces-a3338581.js} +29 -29
- package/dist/cjs/{intl-526c75ec.js → intl-1c36fe38.js} +131 -131
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/priv-chart-popover.cjs.entry.js +91 -91
- package/dist/cjs/priv-datepicker.cjs.entry.js +657 -657
- package/dist/cjs/priv-navigator-button.cjs.entry.js +19 -19
- package/dist/cjs/priv-navigator-item.cjs.entry.js +23 -23
- package/dist/cjs/ripple.cjs.js +1 -1
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +334 -334
- package/dist/cjs/wm-button.cjs.entry.js +189 -189
- package/dist/cjs/wm-chart-slice.cjs.entry.js +18 -18
- package/dist/cjs/wm-chart.cjs.entry.js +183 -183
- package/dist/cjs/wm-datepicker.cjs.entry.js +263 -263
- package/dist/cjs/wm-file-list.cjs.entry.js +35 -35
- package/dist/cjs/wm-file.cjs.entry.js +181 -181
- package/dist/cjs/wm-input.cjs.entry.js +136 -136
- package/dist/cjs/wm-modal-footer.cjs.entry.js +33 -33
- package/dist/cjs/wm-modal-header.cjs.entry.js +32 -32
- package/dist/cjs/wm-modal.cjs.entry.js +152 -152
- package/dist/cjs/wm-navigation_3.cjs.entry.js +186 -186
- package/dist/cjs/wm-navigator.cjs.entry.js +264 -264
- package/dist/cjs/wm-network-uploader.cjs.entry.js +465 -465
- package/dist/cjs/wm-option_2.cjs.entry.js +768 -768
- package/dist/cjs/wm-pagination.cjs.entry.js +179 -179
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +155 -155
- package/dist/cjs/wm-search.cjs.entry.js +184 -184
- package/dist/cjs/wm-snackbar.cjs.entry.js +134 -134
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +264 -264
- package/dist/cjs/wm-tag-input-row.cjs.entry.js +14 -14
- package/dist/cjs/wm-tag-input.cjs.entry.js +948 -941
- package/dist/cjs/wm-timepicker.cjs.entry.js +385 -385
- package/dist/cjs/wm-toggletip.cjs.entry.js +120 -120
- package/dist/cjs/wm-uploader.cjs.entry.js +441 -441
- package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
- package/dist/collection/components/charts/chartFunctions.js +562 -562
- package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +267 -267
- package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +125 -125
- package/dist/collection/components/charts/wm-chart/wm-chart.js +450 -450
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +207 -207
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +143 -143
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +121 -121
- package/dist/collection/components/wm-action-menu/wm-action-menu.js +472 -472
- package/dist/collection/components/wm-button/wm-button.js +486 -486
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +983 -983
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +491 -491
- package/dist/collection/components/wm-file/wm-file.js +313 -313
- package/dist/collection/components/wm-file-list/wm-file-list.js +152 -152
- package/dist/collection/components/wm-input/wm-input.js +509 -509
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +454 -454
- package/dist/collection/components/wm-modal/wm-modal-footer.js +138 -138
- package/dist/collection/components/wm-modal/wm-modal-header.js +82 -82
- package/dist/collection/components/wm-modal/wm-modal.js +462 -462
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +119 -119
- package/dist/collection/components/wm-navigation/wm-navigation-item.js +130 -130
- package/dist/collection/components/wm-navigation/wm-navigation.js +217 -217
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +106 -106
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +123 -123
- package/dist/collection/components/wm-navigator/wm-navigator.js +467 -467
- package/dist/collection/components/wm-option/wm-option.js +435 -435
- package/dist/collection/components/wm-pagination/wm-pagination.js +362 -362
- package/dist/collection/components/wm-search/wm-search.js +439 -439
- package/dist/collection/components/wm-select/wm-select.js +1054 -1054
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +267 -267
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +211 -211
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +327 -327
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +108 -108
- package/dist/collection/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.js +122 -122
- package/dist/collection/components/wm-tag-input/wm-tag-input.css +21 -17
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +1302 -1295
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +605 -605
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +243 -243
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +772 -772
- package/dist/collection/components/wm-uploader/wm-uploader.js +964 -964
- package/dist/collection/components/wm-wrapper/wm-wrapper.js +28 -28
- package/dist/collection/dev/scripts.js +20 -20
- package/dist/collection/global/__mocks__/functions.js +6 -6
- package/dist/collection/global/functions.js +541 -541
- package/dist/collection/global/global.js +79 -79
- package/dist/collection/global/interfaces.js +49 -49
- package/dist/collection/global/intl.js +132 -132
- package/dist/collection/global/services/__mocks__/http-service.js +130 -130
- package/dist/collection/global/services/http-service.js +50 -50
- package/dist/collection/lang/lang.js +5 -5
- package/dist/collection/lang/missing.js +43 -43
- package/dist/collection/lang/piglatin.js +93 -93
- package/dist/esm/{chartFunctions-dd9eb9ac.js → chartFunctions-0b53b301.js} +596 -596
- package/dist/esm/{functions-f32b1ca4.js → functions-cbb19d50.js} +498 -498
- package/dist/esm/{global-7ee0d78d.js → global-2c7bbfe6.js} +72 -72
- package/dist/esm/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +49 -49
- package/dist/esm/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +29 -29
- package/dist/esm/{intl-d101e1a9.js → intl-ffbca53d.js} +131 -131
- package/dist/esm/loader.js +1 -1
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/priv-chart-popover.entry.js +91 -91
- package/dist/esm/priv-datepicker.entry.js +657 -657
- package/dist/esm/priv-navigator-button.entry.js +19 -19
- package/dist/esm/priv-navigator-item.entry.js +23 -23
- package/dist/esm/ripple.js +1 -1
- package/dist/esm/wm-action-menu_2.entry.js +334 -334
- package/dist/esm/wm-button.entry.js +189 -189
- package/dist/esm/wm-chart-slice.entry.js +18 -18
- package/dist/esm/wm-chart.entry.js +183 -183
- package/dist/esm/wm-datepicker.entry.js +263 -263
- package/dist/esm/wm-file-list.entry.js +35 -35
- package/dist/esm/wm-file.entry.js +181 -181
- package/dist/esm/wm-input.entry.js +136 -136
- package/dist/esm/wm-modal-footer.entry.js +33 -33
- package/dist/esm/wm-modal-header.entry.js +32 -32
- package/dist/esm/wm-modal.entry.js +152 -152
- package/dist/esm/wm-navigation_3.entry.js +186 -186
- package/dist/esm/wm-navigator.entry.js +264 -264
- package/dist/esm/wm-network-uploader.entry.js +465 -465
- package/dist/esm/wm-option_2.entry.js +768 -768
- package/dist/esm/wm-pagination.entry.js +179 -179
- package/dist/esm/wm-progress-indicator_3.entry.js +155 -155
- package/dist/esm/wm-search.entry.js +184 -184
- package/dist/esm/wm-snackbar.entry.js +134 -134
- package/dist/esm/wm-tab-item_3.entry.js +264 -264
- package/dist/esm/wm-tag-input-row.entry.js +14 -14
- package/dist/esm/wm-tag-input.entry.js +948 -941
- package/dist/esm/wm-timepicker.entry.js +385 -385
- package/dist/esm/wm-toggletip.entry.js +120 -120
- package/dist/esm/wm-uploader.entry.js +441 -441
- package/dist/esm/wm-wrapper.entry.js +12 -12
- package/dist/esm-es5/{chartFunctions-dd9eb9ac.js → chartFunctions-0b53b301.js} +1 -1
- package/dist/esm-es5/{global-7ee0d78d.js → global-2c7bbfe6.js} +1 -1
- package/dist/esm-es5/{intl-d101e1a9.js → intl-ffbca53d.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
- package/dist/esm-es5/priv-datepicker.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-file.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-modal-header.entry.js +1 -1
- package/dist/esm-es5/wm-modal.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-pagination.entry.js +1 -1
- package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
- package/dist/esm-es5/wm-search.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/ripple/{p-725c14b0.system.entry.js → p-00022d17.system.entry.js} +1 -1
- package/dist/ripple/{p-b97de06f.system.entry.js → p-0450cdbe.system.entry.js} +1 -1
- package/dist/ripple/{p-bfe1062d.entry.js → p-05a17658.entry.js} +1 -1
- package/dist/ripple/p-0b6a7b77.system.entry.js +1 -0
- package/dist/ripple/{p-b6bf2866.entry.js → p-0e789be7.entry.js} +1 -1
- package/dist/ripple/{p-b617b64f.system.entry.js → p-15779c22.system.entry.js} +1 -1
- package/dist/ripple/{p-04faca6b.entry.js → p-17487f1b.entry.js} +1 -1
- package/dist/ripple/{p-122da0d1.system.entry.js → p-197c83de.system.entry.js} +1 -1
- package/dist/ripple/{p-11d98b00.system.entry.js → p-1bad4efe.system.entry.js} +1 -1
- package/dist/ripple/{p-252ba295.system.entry.js → p-2ff923ee.system.entry.js} +1 -1
- package/dist/ripple/{p-a6afe65a.entry.js → p-31712996.entry.js} +1 -1
- package/dist/ripple/{p-f69276d5.system.entry.js → p-31c18f5e.system.entry.js} +1 -1
- package/dist/ripple/{p-df28f438.system.js → p-32944b70.system.js} +1 -1
- package/dist/ripple/{p-73d277ba.system.entry.js → p-36effc40.system.entry.js} +1 -1
- package/dist/ripple/{p-0be94e77.entry.js → p-3807bcae.entry.js} +1 -1
- package/dist/ripple/{p-88d17f6b.system.entry.js → p-3aa48fad.system.entry.js} +1 -1
- package/dist/ripple/{p-82a97531.system.entry.js → p-419f133c.system.entry.js} +1 -1
- package/dist/ripple/{p-13ec8ac0.entry.js → p-438a1e8e.entry.js} +1 -1
- package/dist/ripple/{p-19689aac.js → p-4698b365.js} +1 -1
- package/dist/ripple/{p-f8d45250.system.entry.js → p-54086f7b.system.entry.js} +1 -1
- package/dist/ripple/{p-47f53321.entry.js → p-5497694c.entry.js} +1 -1
- package/dist/ripple/{p-fb370a69.entry.js → p-58fbf116.entry.js} +1 -1
- package/dist/ripple/{p-14dfc4e7.entry.js → p-65a741c1.entry.js} +1 -1
- package/dist/ripple/{p-ac63b3aa.entry.js → p-7e74274b.entry.js} +1 -1
- package/dist/ripple/{p-81752607.system.js → p-81ad3fe5.system.js} +1 -1
- package/dist/ripple/{p-f3e42327.system.entry.js → p-89db9c27.system.entry.js} +1 -1
- package/dist/ripple/{p-4753fbfc.system.entry.js → p-947f01e2.system.entry.js} +1 -1
- package/dist/ripple/{p-3aee75e7.entry.js → p-978429f9.entry.js} +1 -1
- package/dist/ripple/{p-2c8fd902.system.entry.js → p-97d5b4bd.system.entry.js} +1 -1
- package/dist/ripple/{p-67c0ad56.system.entry.js → p-9d6a574b.system.entry.js} +1 -1
- package/dist/ripple/{p-c545fe1c.entry.js → p-a3ba2bdd.entry.js} +1 -1
- package/dist/ripple/{p-c7567fd3.entry.js → p-a42f5231.entry.js} +1 -1
- package/dist/ripple/p-a51aec3f.entry.js +1 -0
- package/dist/ripple/{p-b831988d.entry.js → p-a5b86b47.entry.js} +1 -1
- package/dist/ripple/{p-4cadf985.entry.js → p-a90b8a08.entry.js} +1 -1
- package/dist/ripple/{p-d9b66dca.system.entry.js → p-aabe172c.system.entry.js} +1 -1
- package/dist/ripple/{p-69121ad1.entry.js → p-ab2a0aee.entry.js} +1 -1
- package/dist/ripple/{p-5fb0aa58.js → p-aed93a25.js} +1 -1
- package/dist/ripple/{p-f39ee84b.entry.js → p-b2d75e7d.entry.js} +1 -1
- package/dist/ripple/{p-19b897ce.js → p-b410c675.js} +1 -1
- package/dist/ripple/{p-4809e419.system.entry.js → p-b6f558f7.system.entry.js} +1 -1
- package/dist/ripple/p-bb048fe7.entry.js +1 -0
- package/dist/ripple/{p-2805fed6.system.entry.js → p-bced37cf.system.entry.js} +1 -1
- package/dist/ripple/{p-c9a1834d.system.entry.js → p-bd0c1e7c.system.entry.js} +1 -1
- package/dist/ripple/{p-89f1991f.entry.js → p-c0e183f4.entry.js} +1 -1
- package/dist/ripple/{p-7eca18bd.system.entry.js → p-c27eda00.system.entry.js} +1 -1
- package/dist/ripple/{p-894bc6c4.system.entry.js → p-cd3e0b8b.system.entry.js} +1 -1
- package/dist/ripple/{p-f6b2e4ac.system.js → p-d1af63b5.system.js} +1 -1
- package/dist/ripple/{p-30572b71.system.js → p-d41ba263.system.js} +1 -1
- package/dist/ripple/{p-db7e6e89.entry.js → p-d8993992.entry.js} +1 -1
- package/dist/ripple/{p-f13b239c.system.entry.js → p-da525ed1.system.entry.js} +1 -1
- package/dist/ripple/{p-33af1eee.entry.js → p-e6f46289.entry.js} +1 -1
- package/dist/ripple/{p-e928f350.entry.js → p-fc967b2c.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/charts/chartFunctions.d.ts +37 -37
- package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +27 -27
- package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +11 -11
- package/dist/types/components/charts/wm-chart/wm-chart.d.ts +47 -47
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +29 -29
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +20 -20
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +10 -10
- package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +49 -49
- package/dist/types/components/wm-button/wm-button.d.ts +44 -44
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +80 -80
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +42 -42
- package/dist/types/components/wm-file/wm-file.d.ts +40 -40
- package/dist/types/components/wm-file-list/wm-file-list.d.ts +16 -16
- package/dist/types/components/wm-input/wm-input.d.ts +57 -57
- package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
- package/dist/types/components/wm-modal/wm-modal-footer.d.ts +14 -14
- package/dist/types/components/wm-modal/wm-modal-header.d.ts +10 -10
- package/dist/types/components/wm-modal/wm-modal.d.ts +40 -40
- package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +16 -16
- package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +13 -13
- package/dist/types/components/wm-navigation/wm-navigation.d.ts +26 -26
- package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +10 -10
- package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +13 -13
- package/dist/types/components/wm-navigator/wm-navigator.d.ts +61 -61
- package/dist/types/components/wm-option/wm-option.d.ts +34 -34
- package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
- package/dist/types/components/wm-search/wm-search.d.ts +77 -77
- package/dist/types/components/wm-select/wm-select.d.ts +101 -101
- package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +30 -30
- package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +37 -37
- package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +52 -52
- package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +20 -20
- package/dist/types/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.d.ts +11 -11
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +137 -136
- package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +62 -62
- package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +25 -25
- package/dist/types/components/wm-uploader/wm-network-uploader/wm-network-uploader.d.ts +85 -85
- package/dist/types/components/wm-uploader/wm-uploader.d.ts +99 -99
- package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
- package/dist/types/components.d.ts +27 -27
- package/dist/types/global/__mocks__/functions.d.ts +6 -6
- package/dist/types/global/functions.d.ts +40 -40
- package/dist/types/global/global.d.ts +1 -1
- package/dist/types/global/interfaces.d.ts +74 -74
- package/dist/types/global/intl.d.ts +29 -29
- package/dist/types/global/services/__mocks__/http-service.d.ts +6 -6
- package/dist/types/global/services/http-service.d.ts +4 -4
- package/dist/types/lang/lang.d.ts +5 -5
- package/package.json +46 -46
- package/dist/ripple/p-37de8e2f.entry.js +0 -1
- package/dist/ripple/p-b378e064.system.entry.js +0 -1
- package/dist/ripple/p-d2037549.entry.js +0 -1
- /package/dist/esm-es5/{functions-f32b1ca4.js → functions-cbb19d50.js} +0 -0
- /package/dist/esm-es5/{http-service-5d037e16.js → http-service-3dc3b3e7.js} +0 -0
- /package/dist/esm-es5/{interfaces-61c6305b.js → interfaces-2b97fab2.js} +0 -0
- /package/dist/ripple/{p-888bec42.js → p-43f1298b.js} +0 -0
- /package/dist/ripple/{p-cfa80f5b.js → p-91480a89.js} +0 -0
- /package/dist/ripple/{p-313b6073.system.js → p-9d02957d.system.js} +0 -0
- /package/dist/ripple/{p-9eb5a71e.system.js → p-b267e710.system.js} +0 -0
- /package/dist/ripple/{p-08b7ec08.system.js → p-f5df5903.system.js} +0 -0
- /package/dist/ripple/{p-a6d6eae7.js → p-fd8070fb.js} +0 -0
|
@@ -1,772 +1,772 @@
|
|
|
1
|
-
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { forceUpdate } from "@stencil/core";
|
|
3
|
-
import { getRequest, postRequest, putRequest, deleteRequest } from "../../../global/services/http-service";
|
|
4
|
-
import { intl, generateId, hasValidType } from "../../../global/functions";
|
|
5
|
-
import { globalMessages } from "../../../global/intl";
|
|
6
|
-
export class NetworkUploader {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.inputId = generateId();
|
|
9
|
-
this.isTabbing = false;
|
|
10
|
-
this.fileList = [];
|
|
11
|
-
this.inProgressList = [];
|
|
12
|
-
this.errorList = [];
|
|
13
|
-
this.notif = undefined;
|
|
14
|
-
this.snackbar = [];
|
|
15
|
-
this.numFilesInProgress = undefined;
|
|
16
|
-
this.getPath = undefined;
|
|
17
|
-
this.requestUploadPath = undefined;
|
|
18
|
-
this.uploadPath = undefined;
|
|
19
|
-
this.requestDownloadPath = undefined;
|
|
20
|
-
this.deletePath = undefined;
|
|
21
|
-
this.associatedData = undefined;
|
|
22
|
-
this.buttonText = undefined;
|
|
23
|
-
this.emptyStateText = undefined;
|
|
24
|
-
this.icon = undefined;
|
|
25
|
-
this.fileTypes = "pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv";
|
|
26
|
-
this.maxSize = 100;
|
|
27
|
-
this.maxFiles = undefined;
|
|
28
|
-
this.sortBy = "date";
|
|
29
|
-
}
|
|
30
|
-
toggleTabbingOn() {
|
|
31
|
-
this.isTabbing = true;
|
|
32
|
-
}
|
|
33
|
-
toggleTabbingOff() {
|
|
34
|
-
this.isTabbing = false;
|
|
35
|
-
}
|
|
36
|
-
handleUploadProgress(ev) {
|
|
37
|
-
this.inProgressList.map((i) => {
|
|
38
|
-
if (i.name === ev.detail.file_name) {
|
|
39
|
-
i.progress = ev.detail.progress;
|
|
40
|
-
forceUpdate(this.el);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
if (ev.detail.progress === 100) {
|
|
44
|
-
// inProgressList is not a perfect reflection of how many files are uploading
|
|
45
|
-
// because even after progress reached 100% the item should remain in the array
|
|
46
|
-
// (should only be removed once it appears in fileList)
|
|
47
|
-
this.numFilesInProgress -= 1;
|
|
48
|
-
}
|
|
49
|
-
// aggregate the percentages for SR to announce progress
|
|
50
|
-
if (!this.srProgress && this.numFilesInProgress) {
|
|
51
|
-
const total = this.numFilesInProgress; // if we don't reassign this number changes when a file is done and the percentage becomes wrong
|
|
52
|
-
this.srProgress = setInterval(() => {
|
|
53
|
-
const aggregate = this.inProgressList.reduce((avg, item) => (item.progress ? avg + item.progress : avg), 0);
|
|
54
|
-
if (this.liveRegion) {
|
|
55
|
-
this.liveRegion.innerHTML = intl.formatMessage({
|
|
56
|
-
id: "uploader.uploadProgress",
|
|
57
|
-
defaultMessage: "Upload progress: {percentage}%",
|
|
58
|
-
}, { percentage: Math.floor(aggregate / total) });
|
|
59
|
-
}
|
|
60
|
-
}, 5000);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
handleFinishedSnack(ev) {
|
|
64
|
-
this.snackbar = this.snackbar.filter((n) => n.id !== ev.detail.id);
|
|
65
|
-
}
|
|
66
|
-
setMaxSize() {
|
|
67
|
-
// Max size can't be set above 100Mb
|
|
68
|
-
this.maxSize = this.maxSize > 100 ? 100 : this.maxSize;
|
|
69
|
-
}
|
|
70
|
-
uploadNotifications(newNum, oldNum) {
|
|
71
|
-
if (oldNum > 0 && newNum === 0) {
|
|
72
|
-
setTimeout(() => {
|
|
73
|
-
this.notif = null;
|
|
74
|
-
}, 20 * 1000);
|
|
75
|
-
const message = intl.formatMessage({
|
|
76
|
-
id: "uploader.finishedUploading",
|
|
77
|
-
defaultMessage: "Finished uploading",
|
|
78
|
-
});
|
|
79
|
-
this.notif = { id: 5, message };
|
|
80
|
-
if (this.liveRegion) {
|
|
81
|
-
this.liveRegion.innerHTML = message;
|
|
82
|
-
}
|
|
83
|
-
this.numFilesInProgress = null;
|
|
84
|
-
clearInterval(this.srProgress);
|
|
85
|
-
forceUpdate(this.el);
|
|
86
|
-
}
|
|
87
|
-
else if (newNum > 0 && newNum != oldNum) {
|
|
88
|
-
const message = intl.formatMessage({
|
|
89
|
-
id: "uploader.filesUploading",
|
|
90
|
-
defaultMessage: "{num, plural, one {1 file uploading} other {# files uploading}}",
|
|
91
|
-
}, { num: newNum });
|
|
92
|
-
this.notif = { id: 6, message };
|
|
93
|
-
if (this.liveRegion) {
|
|
94
|
-
this.liveRegion.innerHTML = message;
|
|
95
|
-
}
|
|
96
|
-
forceUpdate(this.el);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
emitFileListEvent() {
|
|
100
|
-
this.wmNetworkUploaderFilesChanged.emit(this.fileList);
|
|
101
|
-
}
|
|
102
|
-
formatDate(isoDate, locale, timezone) {
|
|
103
|
-
const timestamp = Date.parse(isoDate);
|
|
104
|
-
if (locale.match(/^[a-zA-Z]*(-[a-zA-Z0-9]*)*$/g)) {
|
|
105
|
-
// make sure locale is valid, otherwise set default locale
|
|
106
|
-
try {
|
|
107
|
-
//@ts-ignore
|
|
108
|
-
Intl.getCanonicalLocales(locale);
|
|
109
|
-
}
|
|
110
|
-
catch (_a) {
|
|
111
|
-
locale = "en-us";
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
return isoDate;
|
|
116
|
-
}
|
|
117
|
-
if (!!timestamp) {
|
|
118
|
-
const date = new Date(timestamp);
|
|
119
|
-
const year = date.getFullYear();
|
|
120
|
-
const month = ("0" + (date.getMonth() + 1)).substr(-2);
|
|
121
|
-
const day = ("0" + date.getDate()).substr(-2);
|
|
122
|
-
const time = date.toLocaleTimeString([locale, "en-us"], {
|
|
123
|
-
timeZone: timezone,
|
|
124
|
-
hour: "numeric",
|
|
125
|
-
minute: "numeric",
|
|
126
|
-
});
|
|
127
|
-
return `${year}/${month}/${day} ${time}`;
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
return isoDate;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
isValidSize(size) {
|
|
134
|
-
// https://stackoverflow.com/questions/2365100/converting-bytes-to-megabytes
|
|
135
|
-
return size / 1024 / 1024 <= this.maxSize;
|
|
136
|
-
}
|
|
137
|
-
isDuplicate(name) {
|
|
138
|
-
return this.fileList.find((f) => f.file_name === name);
|
|
139
|
-
}
|
|
140
|
-
isEmpty() {
|
|
141
|
-
return !this.fileList.length && !this.inProgressList.length && !this.errorList.length;
|
|
142
|
-
}
|
|
143
|
-
get isDisabled() {
|
|
144
|
-
const isMax = !!this.maxFiles && this.fileList.length >= this.maxFiles;
|
|
145
|
-
if (!this.notif) {
|
|
146
|
-
if (isMax) {
|
|
147
|
-
const errMessage = intl.formatMessage({
|
|
148
|
-
id: "uploader.fileUploadLimitExceeded",
|
|
149
|
-
defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
|
|
150
|
-
description: "Message displayed when trying to upload too many files",
|
|
151
|
-
});
|
|
152
|
-
this.notif = { id: 1, message: errMessage };
|
|
153
|
-
if (this.liveRegion) {
|
|
154
|
-
this.liveRegion.innerHTML = errMessage;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
this.notif = null;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
else if (this.notif.id === 1) {
|
|
162
|
-
// to make sure SR don't repeat the error, don't reset it if it already is showing
|
|
163
|
-
// just dismiss it if isMax is not true anymore
|
|
164
|
-
if (!isMax) {
|
|
165
|
-
this.notif = null;
|
|
166
|
-
}
|
|
167
|
-
// finally do nothing if error 2 is showing (special case when user selects too many files)
|
|
168
|
-
}
|
|
169
|
-
// disable if is the uploader is maxed out or if something is uploading
|
|
170
|
-
return isMax || this.numFilesInProgress > 0;
|
|
171
|
-
}
|
|
172
|
-
purgeProgressList(item) {
|
|
173
|
-
// If a file is retrieved from the server because it was just uploaded
|
|
174
|
-
// it should be removed from inProgressList
|
|
175
|
-
this.inProgressList = this.inProgressList.filter((i) => i.progress !== 100 && i.name !== item.file_name);
|
|
176
|
-
}
|
|
177
|
-
getExistingFiles() {
|
|
178
|
-
getRequest(this.getPath)
|
|
179
|
-
.then((reply) => {
|
|
180
|
-
reply.map((item) => this.purgeProgressList(item));
|
|
181
|
-
if (this.sortBy === "name") {
|
|
182
|
-
reply.sort((a, b) => a.file_name.localeCompare(b.file_name));
|
|
183
|
-
}
|
|
184
|
-
this.fileList = reply;
|
|
185
|
-
})
|
|
186
|
-
.catch((errStatus) => {
|
|
187
|
-
console.error(errStatus);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
clearErrors() {
|
|
191
|
-
this.errorList = [];
|
|
192
|
-
this.notif = null;
|
|
193
|
-
}
|
|
194
|
-
handleFiles(ev) {
|
|
195
|
-
const files = Array.from(ev.target.files);
|
|
196
|
-
const validTypes = this.fileTypes.split(" ").join(", ");
|
|
197
|
-
if (!!this.maxFiles && this.fileList.length + files.length > this.maxFiles) {
|
|
198
|
-
const errMessage = intl.formatMessage({
|
|
199
|
-
id: "uploader.fileUploadLimitExceeded",
|
|
200
|
-
defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
|
|
201
|
-
description: "Message displayed when trying to upload too many files",
|
|
202
|
-
});
|
|
203
|
-
this.notif = { id: 2, message: errMessage };
|
|
204
|
-
if (this.liveRegion) {
|
|
205
|
-
this.liveRegion.innerHTML = errMessage;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
// map to create inProgress items so they can be displayed immediately
|
|
210
|
-
files &&
|
|
211
|
-
files.map((file) => {
|
|
212
|
-
if (!hasValidType(file, this.fileTypes)) {
|
|
213
|
-
const error = {
|
|
214
|
-
file_name: file.name,
|
|
215
|
-
message: intl.formatMessage({
|
|
216
|
-
id: "uploader.invalidFileType",
|
|
217
|
-
defaultMessage: "The file type is invalid. Accepted types: {validTypes}",
|
|
218
|
-
}, { validTypes }),
|
|
219
|
-
};
|
|
220
|
-
this.errorList.push(error);
|
|
221
|
-
}
|
|
222
|
-
else if (!this.isValidSize(file.size)) {
|
|
223
|
-
const error = {
|
|
224
|
-
file_name: file.name,
|
|
225
|
-
message: intl.formatMessage({
|
|
226
|
-
id: "uploader.fileTooLarge",
|
|
227
|
-
defaultMessage: "The selected file is too large. Maximum file size is {size}Mb",
|
|
228
|
-
}, { size: this.maxSize }),
|
|
229
|
-
};
|
|
230
|
-
this.errorList.push(error);
|
|
231
|
-
}
|
|
232
|
-
else if (this.isDuplicate(file.name)) {
|
|
233
|
-
const error = {
|
|
234
|
-
file_name: file.name,
|
|
235
|
-
message: intl.formatMessage({
|
|
236
|
-
id: "uploader.duplicateName",
|
|
237
|
-
defaultMessage: "A file with this name already exists.",
|
|
238
|
-
}),
|
|
239
|
-
};
|
|
240
|
-
this.errorList.push(error);
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
this.inProgressList.push(file);
|
|
244
|
-
}
|
|
245
|
-
forceUpdate(this.el);
|
|
246
|
-
});
|
|
247
|
-
if (this.inProgressList.length > 0) {
|
|
248
|
-
this.numFilesInProgress = this.inProgressList.length;
|
|
249
|
-
// map over "uploadable" files for actual upload
|
|
250
|
-
// this happens separately otherwise at each pass we'd have to wait for the requests to complete before displaying things
|
|
251
|
-
this.inProgressList.map((file, i) => {
|
|
252
|
-
this.uploadFile(file, i); // = input.files file
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
ev.target.value = ""; // reset to ensure that onChange is triggered when the same file is selected a second time
|
|
257
|
-
}
|
|
258
|
-
uploadFile(file, i) {
|
|
259
|
-
// get upload link
|
|
260
|
-
getRequest(this.requestUploadPath + i.toString())
|
|
261
|
-
.then(async (reply) => {
|
|
262
|
-
const assData = JSON.parse(this.associatedData);
|
|
263
|
-
const fileInfo = Object.assign(Object.assign({}, assData), { file_name: file.name, mime_type: file.type, file_path: reply.path, document_uuid: reply.guid });
|
|
264
|
-
// onProgress is passed as a callback to the ev listener inside putRequest (http service),
|
|
265
|
-
// so we can't change component things directly => custom event to pass data to uploader component.
|
|
266
|
-
const onProgress = (ev) => {
|
|
267
|
-
const progress = ev.lengthComputable && ev.total !== 0 ? (ev.loaded / ev.total) * 100 : 0;
|
|
268
|
-
const event = new CustomEvent("wmUploadProgress", {
|
|
269
|
-
detail: { file_name: file.name, progress },
|
|
270
|
-
});
|
|
271
|
-
this.el.dispatchEvent(event);
|
|
272
|
-
};
|
|
273
|
-
// upload to AWS s3 to url we just fetched
|
|
274
|
-
await putRequest(reply.url, file, onProgress);
|
|
275
|
-
// create the db entry
|
|
276
|
-
await postRequest(this.uploadPath, fileInfo);
|
|
277
|
-
// get files from server again
|
|
278
|
-
this.getExistingFiles();
|
|
279
|
-
})
|
|
280
|
-
.catch((err) => {
|
|
281
|
-
// do not show toast on error
|
|
282
|
-
this.numFilesInProgress = null;
|
|
283
|
-
// do not show in progress item on error
|
|
284
|
-
this.inProgressList = [];
|
|
285
|
-
this.notif = {
|
|
286
|
-
id: 3,
|
|
287
|
-
message: globalMessages.genericError,
|
|
288
|
-
};
|
|
289
|
-
console.error(err);
|
|
290
|
-
});
|
|
291
|
-
}
|
|
292
|
-
downloadFile(uuid, path) {
|
|
293
|
-
this.clearErrors();
|
|
294
|
-
// POST request to get temporary download link
|
|
295
|
-
const payload = {
|
|
296
|
-
file_path: path,
|
|
297
|
-
file_uuid: uuid,
|
|
298
|
-
};
|
|
299
|
-
postRequest(this.requestDownloadPath, payload)
|
|
300
|
-
.then((reply) => {
|
|
301
|
-
// we got the download link, now download the file
|
|
302
|
-
window.location.assign(reply.url);
|
|
303
|
-
})
|
|
304
|
-
.catch((err) => {
|
|
305
|
-
console.error(err);
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
deleteFile(file) {
|
|
309
|
-
this.clearErrors();
|
|
310
|
-
this.snackbar.push({
|
|
311
|
-
message: intl.formatMessage({
|
|
312
|
-
id: "uploader.fileDeleted",
|
|
313
|
-
defaultMessage: "{fileName} was deleted.",
|
|
314
|
-
}, { fileName: file.file_name }),
|
|
315
|
-
id: file.uuid,
|
|
316
|
-
link: "",
|
|
317
|
-
});
|
|
318
|
-
// rm file from list immediately.
|
|
319
|
-
this.fileList = this.fileList.filter((i) => i.uuid !== file.uuid);
|
|
320
|
-
deleteRequest(`${this.deletePath}/${file.uuid}`).catch((err) => {
|
|
321
|
-
this.notif = {
|
|
322
|
-
id: 4,
|
|
323
|
-
message: intl.formatMessage({
|
|
324
|
-
id: "uploader.fileNotDeleted",
|
|
325
|
-
defaultMessage: "{fileName} could not be deleted.",
|
|
326
|
-
}, { fileName: file.file_name }),
|
|
327
|
-
};
|
|
328
|
-
this.getExistingFiles();
|
|
329
|
-
console.error(err);
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
componentWillLoad() {
|
|
333
|
-
if (!this.getPath) {
|
|
334
|
-
throw new Error("wm-network-uploader: get-path is a required prop");
|
|
335
|
-
}
|
|
336
|
-
if (!this.requestUploadPath) {
|
|
337
|
-
throw new Error("wm-network-uploader: request-upload-path is a required prop");
|
|
338
|
-
}
|
|
339
|
-
if (!this.uploadPath) {
|
|
340
|
-
throw new Error("wm-network-uploader: upload-path is a required prop");
|
|
341
|
-
}
|
|
342
|
-
if (!this.requestDownloadPath) {
|
|
343
|
-
throw new Error("wm-network-uploader: request-download-path is a required prop");
|
|
344
|
-
}
|
|
345
|
-
if (!this.deletePath) {
|
|
346
|
-
throw new Error("wm-network-uploader: delete-path is a required prop");
|
|
347
|
-
}
|
|
348
|
-
if (!this.buttonText) {
|
|
349
|
-
throw new Error("wm-network-uploader: button-text is a required prop");
|
|
350
|
-
}
|
|
351
|
-
if (!this.emptyStateText) {
|
|
352
|
-
throw new Error("wm-network-uploader: empty-state-text is a required prop");
|
|
353
|
-
}
|
|
354
|
-
if (!this.associatedData) {
|
|
355
|
-
throw new Error("wm-network-uploader: associated-data is a required prop");
|
|
356
|
-
}
|
|
357
|
-
this.setMaxSize();
|
|
358
|
-
this.clearErrors();
|
|
359
|
-
}
|
|
360
|
-
componentDidLoad() {
|
|
361
|
-
this.getExistingFiles();
|
|
362
|
-
if (document.body.classList.contains("wmcl-user-is-tabbing")) {
|
|
363
|
-
this.toggleTabbingOn();
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
uploadButtonOnClick(ev) {
|
|
367
|
-
if (this.isDisabled) {
|
|
368
|
-
// this is a temporary fix.
|
|
369
|
-
// we need the disabled button to be programmatically focusable
|
|
370
|
-
// to allow return focus after closing the browser file panel
|
|
371
|
-
// since it's focusable the button should respond when activated
|
|
372
|
-
// it looks disabled, and announces the reason why the action cannot
|
|
373
|
-
// be taken when activated.
|
|
374
|
-
// this is not pretty duplicating a intl message + the logic of isDisabled,
|
|
375
|
-
// but not worth a bigger refactor since this is only until we get the UX for disabled elements and refactor all interactive els.
|
|
376
|
-
ev.preventDefault();
|
|
377
|
-
if (this.liveRegion) {
|
|
378
|
-
const isMax = !!this.maxFiles && this.fileList.length >= this.maxFiles;
|
|
379
|
-
let errMsg = "";
|
|
380
|
-
if (this.numFilesInProgress > 0) {
|
|
381
|
-
errMsg = intl.formatMessage({
|
|
382
|
-
id: "uploader.waitToUpload",
|
|
383
|
-
defaultMessage: "Please wait for current upload to complete before uploading new files.",
|
|
384
|
-
description: "Message for screen reader users",
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
else if (isMax) {
|
|
388
|
-
errMsg = intl.formatMessage({
|
|
389
|
-
id: "uploader.fileUploadLimitExceeded",
|
|
390
|
-
defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
|
|
391
|
-
description: "Message displayed when trying to upload too many files",
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
if (errMsg) {
|
|
395
|
-
// clear and set again to re-announce if button is clicked several times
|
|
396
|
-
// (can't be done inside setTimeout because of scope, hence the promise)
|
|
397
|
-
this.liveRegion.innerHTML = "";
|
|
398
|
-
new Promise((resolve) => {
|
|
399
|
-
setTimeout(() => {
|
|
400
|
-
resolve("");
|
|
401
|
-
}, 500);
|
|
402
|
-
}).then(() => (this.liveRegion.innerHTML = errMsg));
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
this.clearErrors();
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
renderUploadSvg() {
|
|
411
|
-
return (h("svg", { class: "upload-file", width: "91", height: "84", viewBox: "0 0 91 84" }, h("path", { transform: "rotate(-180.000000) translate(-452, -255.5)", fill: "#eae8ec", d: "M361,249.681818 L361,197.318182 C361,194.118182 365.555061,191.5 371.122358,191.5 L391.316463,191.5 L391.286495,200.562515 L369.871211,200.600292 L369.885404,200.622146 L369.886423,246.655947 L443.657038,246.840767 L443.657038,200.622146 L421.683537,200.622146 L421.683537,191.5 L441.978865,191.5 C447.546162,191.5 452,194.118182 452,197.318182 L452,249.681818 C452,252.881818 447.546162,255.5 441.978865,255.5 L371.122358,255.5 C365.504449,255.5 361,252.881818 361,249.681818 Z M391.5,207 L406,221 L420.5,207 L409.625,207 L409.625,172 L402.375,172 L402.375,207 L391.5,207 Z" })));
|
|
412
|
-
}
|
|
413
|
-
renderIcon() {
|
|
414
|
-
// mdi attachment icon (paper clip) is horizontal but we want it vertical
|
|
415
|
-
const rotate = this.icon && this.icon === "f066";
|
|
416
|
-
return (this.icon && (h("span", { class: `mdi ${rotate ? "rotate" : ""}` }, String.fromCodePoint(parseInt(`0x${this.icon}`)))));
|
|
417
|
-
}
|
|
418
|
-
renderNotif() {
|
|
419
|
-
return this.notif ? h("span", { class: "notif" }, this.notif.message) : "";
|
|
420
|
-
}
|
|
421
|
-
renderUploadButton(classes) {
|
|
422
|
-
return (h("div", { class: "notif-wrapper" }, h("input", { name: this.inputId, id: this.inputId, class: "sr-only", type: "file", multiple: true, onClick: (ev) => this.uploadButtonOnClick(ev), onChange: (e) => this.handleFiles(e) }), h("label", { htmlFor: this.inputId, class: `wm-button ${classes}${this.isTabbing ? " user-is-tabbing" : ""}` }, this.renderIcon(), this.buttonText), this.renderNotif()));
|
|
423
|
-
}
|
|
424
|
-
renderWithItems() {
|
|
425
|
-
return (h("div", null, h("div", { class: "header" }, h("div", { class: "descr" }, h("slot", null)), this.renderUploadButton(this.isDisabled ? "disabled" : "")), this.renderErrorList(), this.renderInProgressList(), this.renderFileList()));
|
|
426
|
-
}
|
|
427
|
-
renderEmptyState() {
|
|
428
|
-
return (h("div", null, h("div", { class: "header" }, h("div", { class: "descr" }, h("slot", null))), h("div", { class: "empty-block" }, this.renderUploadSvg(), h("div", { class: "empty-message" }, this.emptyStateText), this.renderUploadButton("-primary empty-button"))));
|
|
429
|
-
}
|
|
430
|
-
renderErrorList() {
|
|
431
|
-
if (!!this.errorList.length) {
|
|
432
|
-
if (this.liveRegion) {
|
|
433
|
-
let srMessage = this.errorList.reduce(function (acc, err) {
|
|
434
|
-
return acc + `${err.file_name}: ${err.message} `;
|
|
435
|
-
}, "");
|
|
436
|
-
this.liveRegion.innerHTML = srMessage;
|
|
437
|
-
}
|
|
438
|
-
return (h("ul", { class: "error-list" }, this.errorList.map((err) => (h("li", null, h("div", { class: "file --error" }, h("div", { class: "file-info" }, h("span", { class: "filename" }, err.file_name))), h("div", { class: "error-message" }, err.message))))));
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
renderInProgressList() {
|
|
442
|
-
return (h("ul", { class: "inprogress-list" }, this.inProgressList.map((item) => {
|
|
443
|
-
return (h("li", null, h("div", { class: "file --progress" }, h("div", { class: "progress", style: {
|
|
444
|
-
background: `linear-gradient(to right, rgba(67, 126, 142, 1) ${item.progress}%, transparent ${item.progress}%)`,
|
|
445
|
-
} }), h("div", { class: "file-info" }, h("span", { class: "filename" }, item.name, " ", h("span", { class: "sr-only" }, "uploading"))))));
|
|
446
|
-
})));
|
|
447
|
-
}
|
|
448
|
-
renderFile(item) {
|
|
449
|
-
return (h("li", null, h("div", { class: "file --saved" }, h("div", { class: "file-info" }, h("span", { class: "filename" }, item.file_name), h("span", { class: "filedate" }, this.formatDate(item.updated_at, intl.locale, Intl.DateTimeFormat().resolvedOptions().timeZone))), h("div", { class: "file-controls" }, h("wm-button", { class: "download-button", "button-type": "icononly", tooltip: "download", "label-for-identical-buttons": `download ${item.file_name}`, icon: "f1da", onClick: () => this.downloadFile(item.uuid, item.file_path) }), h("wm-button", { class: "delete-button", "button-type": "icononly", tooltip: "remove", "label-for-identical-buttons": `remove ${item.file_name}`, icon: "f1c0", onClick: () => this.deleteFile(item) })))));
|
|
450
|
-
}
|
|
451
|
-
renderFileList() {
|
|
452
|
-
return h("ul", { class: "file-list" }, this.fileList.map((item) => this.renderFile(item)));
|
|
453
|
-
}
|
|
454
|
-
render() {
|
|
455
|
-
return (h(Host, null, this.isEmpty() ? this.renderEmptyState() : this.renderWithItems(), h("wm-snackbar", { notifications: JSON.stringify(this.snackbar) }), h("div", { ref: (el) => (this.liveRegion = el), class: "live-region sr-only", "aria-live": "assertive" // since it's directly linked to the action the user took, it should be read in priority. With polite, some messages get dismissed in favor of the page title
|
|
456
|
-
,
|
|
457
|
-
"aria-atomic": "true" })));
|
|
458
|
-
}
|
|
459
|
-
static get is() { return "wm-network-uploader"; }
|
|
460
|
-
static get encapsulation() { return "shadow"; }
|
|
461
|
-
static get originalStyleUrls() {
|
|
462
|
-
return {
|
|
463
|
-
"$": ["wm-network-uploader.scss"]
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
static get styleUrls() {
|
|
467
|
-
return {
|
|
468
|
-
"$": ["wm-network-uploader.css"]
|
|
469
|
-
};
|
|
470
|
-
}
|
|
471
|
-
static get properties() {
|
|
472
|
-
return {
|
|
473
|
-
"getPath": {
|
|
474
|
-
"type": "string",
|
|
475
|
-
"mutable": false,
|
|
476
|
-
"complexType": {
|
|
477
|
-
"original": "string",
|
|
478
|
-
"resolved": "string",
|
|
479
|
-
"references": {}
|
|
480
|
-
},
|
|
481
|
-
"required": true,
|
|
482
|
-
"optional": false,
|
|
483
|
-
"docs": {
|
|
484
|
-
"tags": [],
|
|
485
|
-
"text": ""
|
|
486
|
-
},
|
|
487
|
-
"attribute": "get-path",
|
|
488
|
-
"reflect": false
|
|
489
|
-
},
|
|
490
|
-
"requestUploadPath": {
|
|
491
|
-
"type": "string",
|
|
492
|
-
"mutable": false,
|
|
493
|
-
"complexType": {
|
|
494
|
-
"original": "string",
|
|
495
|
-
"resolved": "string",
|
|
496
|
-
"references": {}
|
|
497
|
-
},
|
|
498
|
-
"required": true,
|
|
499
|
-
"optional": false,
|
|
500
|
-
"docs": {
|
|
501
|
-
"tags": [],
|
|
502
|
-
"text": ""
|
|
503
|
-
},
|
|
504
|
-
"attribute": "request-upload-path",
|
|
505
|
-
"reflect": false
|
|
506
|
-
},
|
|
507
|
-
"uploadPath": {
|
|
508
|
-
"type": "string",
|
|
509
|
-
"mutable": false,
|
|
510
|
-
"complexType": {
|
|
511
|
-
"original": "string",
|
|
512
|
-
"resolved": "string",
|
|
513
|
-
"references": {}
|
|
514
|
-
},
|
|
515
|
-
"required": true,
|
|
516
|
-
"optional": false,
|
|
517
|
-
"docs": {
|
|
518
|
-
"tags": [],
|
|
519
|
-
"text": ""
|
|
520
|
-
},
|
|
521
|
-
"attribute": "upload-path",
|
|
522
|
-
"reflect": false
|
|
523
|
-
},
|
|
524
|
-
"requestDownloadPath": {
|
|
525
|
-
"type": "string",
|
|
526
|
-
"mutable": false,
|
|
527
|
-
"complexType": {
|
|
528
|
-
"original": "string",
|
|
529
|
-
"resolved": "string",
|
|
530
|
-
"references": {}
|
|
531
|
-
},
|
|
532
|
-
"required": true,
|
|
533
|
-
"optional": false,
|
|
534
|
-
"docs": {
|
|
535
|
-
"tags": [],
|
|
536
|
-
"text": ""
|
|
537
|
-
},
|
|
538
|
-
"attribute": "request-download-path",
|
|
539
|
-
"reflect": false
|
|
540
|
-
},
|
|
541
|
-
"deletePath": {
|
|
542
|
-
"type": "string",
|
|
543
|
-
"mutable": false,
|
|
544
|
-
"complexType": {
|
|
545
|
-
"original": "string",
|
|
546
|
-
"resolved": "string",
|
|
547
|
-
"references": {}
|
|
548
|
-
},
|
|
549
|
-
"required": true,
|
|
550
|
-
"optional": false,
|
|
551
|
-
"docs": {
|
|
552
|
-
"tags": [],
|
|
553
|
-
"text": ""
|
|
554
|
-
},
|
|
555
|
-
"attribute": "delete-path",
|
|
556
|
-
"reflect": false
|
|
557
|
-
},
|
|
558
|
-
"associatedData": {
|
|
559
|
-
"type": "string",
|
|
560
|
-
"mutable": false,
|
|
561
|
-
"complexType": {
|
|
562
|
-
"original": "string",
|
|
563
|
-
"resolved": "string | undefined",
|
|
564
|
-
"references": {}
|
|
565
|
-
},
|
|
566
|
-
"required": false,
|
|
567
|
-
"optional": true,
|
|
568
|
-
"docs": {
|
|
569
|
-
"tags": [],
|
|
570
|
-
"text": ""
|
|
571
|
-
},
|
|
572
|
-
"attribute": "associated-data",
|
|
573
|
-
"reflect": false
|
|
574
|
-
},
|
|
575
|
-
"buttonText": {
|
|
576
|
-
"type": "string",
|
|
577
|
-
"mutable": false,
|
|
578
|
-
"complexType": {
|
|
579
|
-
"original": "string",
|
|
580
|
-
"resolved": "string",
|
|
581
|
-
"references": {}
|
|
582
|
-
},
|
|
583
|
-
"required": true,
|
|
584
|
-
"optional": false,
|
|
585
|
-
"docs": {
|
|
586
|
-
"tags": [],
|
|
587
|
-
"text": ""
|
|
588
|
-
},
|
|
589
|
-
"attribute": "button-text",
|
|
590
|
-
"reflect": false
|
|
591
|
-
},
|
|
592
|
-
"emptyStateText": {
|
|
593
|
-
"type": "string",
|
|
594
|
-
"mutable": false,
|
|
595
|
-
"complexType": {
|
|
596
|
-
"original": "string",
|
|
597
|
-
"resolved": "string",
|
|
598
|
-
"references": {}
|
|
599
|
-
},
|
|
600
|
-
"required": true,
|
|
601
|
-
"optional": false,
|
|
602
|
-
"docs": {
|
|
603
|
-
"tags": [],
|
|
604
|
-
"text": ""
|
|
605
|
-
},
|
|
606
|
-
"attribute": "empty-state-text",
|
|
607
|
-
"reflect": false
|
|
608
|
-
},
|
|
609
|
-
"icon": {
|
|
610
|
-
"type": "string",
|
|
611
|
-
"mutable": false,
|
|
612
|
-
"complexType": {
|
|
613
|
-
"original": "string",
|
|
614
|
-
"resolved": "string",
|
|
615
|
-
"references": {}
|
|
616
|
-
},
|
|
617
|
-
"required": true,
|
|
618
|
-
"optional": false,
|
|
619
|
-
"docs": {
|
|
620
|
-
"tags": [],
|
|
621
|
-
"text": ""
|
|
622
|
-
},
|
|
623
|
-
"attribute": "icon",
|
|
624
|
-
"reflect": false
|
|
625
|
-
},
|
|
626
|
-
"fileTypes": {
|
|
627
|
-
"type": "string",
|
|
628
|
-
"mutable": false,
|
|
629
|
-
"complexType": {
|
|
630
|
-
"original": "string",
|
|
631
|
-
"resolved": "string",
|
|
632
|
-
"references": {}
|
|
633
|
-
},
|
|
634
|
-
"required": false,
|
|
635
|
-
"optional": false,
|
|
636
|
-
"docs": {
|
|
637
|
-
"tags": [],
|
|
638
|
-
"text": ""
|
|
639
|
-
},
|
|
640
|
-
"attribute": "file-types",
|
|
641
|
-
"reflect": false,
|
|
642
|
-
"defaultValue": "\"pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv\""
|
|
643
|
-
},
|
|
644
|
-
"maxSize": {
|
|
645
|
-
"type": "number",
|
|
646
|
-
"mutable": true,
|
|
647
|
-
"complexType": {
|
|
648
|
-
"original": "number",
|
|
649
|
-
"resolved": "number",
|
|
650
|
-
"references": {}
|
|
651
|
-
},
|
|
652
|
-
"required": false,
|
|
653
|
-
"optional": false,
|
|
654
|
-
"docs": {
|
|
655
|
-
"tags": [],
|
|
656
|
-
"text": ""
|
|
657
|
-
},
|
|
658
|
-
"attribute": "max-size",
|
|
659
|
-
"reflect": false,
|
|
660
|
-
"defaultValue": "100"
|
|
661
|
-
},
|
|
662
|
-
"maxFiles": {
|
|
663
|
-
"type": "number",
|
|
664
|
-
"mutable": false,
|
|
665
|
-
"complexType": {
|
|
666
|
-
"original": "number",
|
|
667
|
-
"resolved": "number | undefined",
|
|
668
|
-
"references": {}
|
|
669
|
-
},
|
|
670
|
-
"required": false,
|
|
671
|
-
"optional": true,
|
|
672
|
-
"docs": {
|
|
673
|
-
"tags": [],
|
|
674
|
-
"text": ""
|
|
675
|
-
},
|
|
676
|
-
"attribute": "max-files",
|
|
677
|
-
"reflect": false
|
|
678
|
-
},
|
|
679
|
-
"sortBy": {
|
|
680
|
-
"type": "string",
|
|
681
|
-
"mutable": false,
|
|
682
|
-
"complexType": {
|
|
683
|
-
"original": "\"name\" | \"date\"",
|
|
684
|
-
"resolved": "\"date\" | \"name\"",
|
|
685
|
-
"references": {}
|
|
686
|
-
},
|
|
687
|
-
"required": false,
|
|
688
|
-
"optional": false,
|
|
689
|
-
"docs": {
|
|
690
|
-
"tags": [],
|
|
691
|
-
"text": ""
|
|
692
|
-
},
|
|
693
|
-
"attribute": "sort-by",
|
|
694
|
-
"reflect": false,
|
|
695
|
-
"defaultValue": "\"date\""
|
|
696
|
-
}
|
|
697
|
-
};
|
|
698
|
-
}
|
|
699
|
-
static get states() {
|
|
700
|
-
return {
|
|
701
|
-
"isTabbing": {},
|
|
702
|
-
"fileList": {},
|
|
703
|
-
"inProgressList": {},
|
|
704
|
-
"errorList": {},
|
|
705
|
-
"notif": {},
|
|
706
|
-
"snackbar": {},
|
|
707
|
-
"numFilesInProgress": {}
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
|
-
static get events() {
|
|
711
|
-
return [{
|
|
712
|
-
"method": "wmNetworkUploaderFilesChanged",
|
|
713
|
-
"name": "wmNetworkUploaderFilesChanged",
|
|
714
|
-
"bubbles": true,
|
|
715
|
-
"cancelable": true,
|
|
716
|
-
"composed": true,
|
|
717
|
-
"docs": {
|
|
718
|
-
"tags": [],
|
|
719
|
-
"text": ""
|
|
720
|
-
},
|
|
721
|
-
"complexType": {
|
|
722
|
-
"original": "Object[]",
|
|
723
|
-
"resolved": "Object[]",
|
|
724
|
-
"references": {
|
|
725
|
-
"Object": {
|
|
726
|
-
"location": "global"
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
}];
|
|
731
|
-
}
|
|
732
|
-
static get elementRef() { return "el"; }
|
|
733
|
-
static get watchers() {
|
|
734
|
-
return [{
|
|
735
|
-
"propName": "maxSize",
|
|
736
|
-
"methodName": "setMaxSize"
|
|
737
|
-
}, {
|
|
738
|
-
"propName": "numFilesInProgress",
|
|
739
|
-
"methodName": "uploadNotifications"
|
|
740
|
-
}, {
|
|
741
|
-
"propName": "fileList",
|
|
742
|
-
"methodName": "emitFileListEvent"
|
|
743
|
-
}];
|
|
744
|
-
}
|
|
745
|
-
static get listeners() {
|
|
746
|
-
return [{
|
|
747
|
-
"name": "wmUserIsTabbing",
|
|
748
|
-
"method": "toggleTabbingOn",
|
|
749
|
-
"target": "window",
|
|
750
|
-
"capture": false,
|
|
751
|
-
"passive": false
|
|
752
|
-
}, {
|
|
753
|
-
"name": "wmUserIsNotTabbing",
|
|
754
|
-
"method": "toggleTabbingOff",
|
|
755
|
-
"target": "window",
|
|
756
|
-
"capture": false,
|
|
757
|
-
"passive": false
|
|
758
|
-
}, {
|
|
759
|
-
"name": "wmUploadProgress",
|
|
760
|
-
"method": "handleUploadProgress",
|
|
761
|
-
"target": undefined,
|
|
762
|
-
"capture": false,
|
|
763
|
-
"passive": false
|
|
764
|
-
}, {
|
|
765
|
-
"name": "userFinishedSnack",
|
|
766
|
-
"method": "handleFinishedSnack",
|
|
767
|
-
"target": undefined,
|
|
768
|
-
"capture": false,
|
|
769
|
-
"passive": false
|
|
770
|
-
}];
|
|
771
|
-
}
|
|
772
|
-
}
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
import { forceUpdate } from "@stencil/core";
|
|
3
|
+
import { getRequest, postRequest, putRequest, deleteRequest } from "../../../global/services/http-service";
|
|
4
|
+
import { intl, generateId, hasValidType } from "../../../global/functions";
|
|
5
|
+
import { globalMessages } from "../../../global/intl";
|
|
6
|
+
export class NetworkUploader {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.inputId = generateId();
|
|
9
|
+
this.isTabbing = false;
|
|
10
|
+
this.fileList = [];
|
|
11
|
+
this.inProgressList = [];
|
|
12
|
+
this.errorList = [];
|
|
13
|
+
this.notif = undefined;
|
|
14
|
+
this.snackbar = [];
|
|
15
|
+
this.numFilesInProgress = undefined;
|
|
16
|
+
this.getPath = undefined;
|
|
17
|
+
this.requestUploadPath = undefined;
|
|
18
|
+
this.uploadPath = undefined;
|
|
19
|
+
this.requestDownloadPath = undefined;
|
|
20
|
+
this.deletePath = undefined;
|
|
21
|
+
this.associatedData = undefined;
|
|
22
|
+
this.buttonText = undefined;
|
|
23
|
+
this.emptyStateText = undefined;
|
|
24
|
+
this.icon = undefined;
|
|
25
|
+
this.fileTypes = "pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv";
|
|
26
|
+
this.maxSize = 100;
|
|
27
|
+
this.maxFiles = undefined;
|
|
28
|
+
this.sortBy = "date";
|
|
29
|
+
}
|
|
30
|
+
toggleTabbingOn() {
|
|
31
|
+
this.isTabbing = true;
|
|
32
|
+
}
|
|
33
|
+
toggleTabbingOff() {
|
|
34
|
+
this.isTabbing = false;
|
|
35
|
+
}
|
|
36
|
+
handleUploadProgress(ev) {
|
|
37
|
+
this.inProgressList.map((i) => {
|
|
38
|
+
if (i.name === ev.detail.file_name) {
|
|
39
|
+
i.progress = ev.detail.progress;
|
|
40
|
+
forceUpdate(this.el);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
if (ev.detail.progress === 100) {
|
|
44
|
+
// inProgressList is not a perfect reflection of how many files are uploading
|
|
45
|
+
// because even after progress reached 100% the item should remain in the array
|
|
46
|
+
// (should only be removed once it appears in fileList)
|
|
47
|
+
this.numFilesInProgress -= 1;
|
|
48
|
+
}
|
|
49
|
+
// aggregate the percentages for SR to announce progress
|
|
50
|
+
if (!this.srProgress && this.numFilesInProgress) {
|
|
51
|
+
const total = this.numFilesInProgress; // if we don't reassign this number changes when a file is done and the percentage becomes wrong
|
|
52
|
+
this.srProgress = setInterval(() => {
|
|
53
|
+
const aggregate = this.inProgressList.reduce((avg, item) => (item.progress ? avg + item.progress : avg), 0);
|
|
54
|
+
if (this.liveRegion) {
|
|
55
|
+
this.liveRegion.innerHTML = intl.formatMessage({
|
|
56
|
+
id: "uploader.uploadProgress",
|
|
57
|
+
defaultMessage: "Upload progress: {percentage}%",
|
|
58
|
+
}, { percentage: Math.floor(aggregate / total) });
|
|
59
|
+
}
|
|
60
|
+
}, 5000);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
handleFinishedSnack(ev) {
|
|
64
|
+
this.snackbar = this.snackbar.filter((n) => n.id !== ev.detail.id);
|
|
65
|
+
}
|
|
66
|
+
setMaxSize() {
|
|
67
|
+
// Max size can't be set above 100Mb
|
|
68
|
+
this.maxSize = this.maxSize > 100 ? 100 : this.maxSize;
|
|
69
|
+
}
|
|
70
|
+
uploadNotifications(newNum, oldNum) {
|
|
71
|
+
if (oldNum > 0 && newNum === 0) {
|
|
72
|
+
setTimeout(() => {
|
|
73
|
+
this.notif = null;
|
|
74
|
+
}, 20 * 1000);
|
|
75
|
+
const message = intl.formatMessage({
|
|
76
|
+
id: "uploader.finishedUploading",
|
|
77
|
+
defaultMessage: "Finished uploading",
|
|
78
|
+
});
|
|
79
|
+
this.notif = { id: 5, message };
|
|
80
|
+
if (this.liveRegion) {
|
|
81
|
+
this.liveRegion.innerHTML = message;
|
|
82
|
+
}
|
|
83
|
+
this.numFilesInProgress = null;
|
|
84
|
+
clearInterval(this.srProgress);
|
|
85
|
+
forceUpdate(this.el);
|
|
86
|
+
}
|
|
87
|
+
else if (newNum > 0 && newNum != oldNum) {
|
|
88
|
+
const message = intl.formatMessage({
|
|
89
|
+
id: "uploader.filesUploading",
|
|
90
|
+
defaultMessage: "{num, plural, one {1 file uploading} other {# files uploading}}",
|
|
91
|
+
}, { num: newNum });
|
|
92
|
+
this.notif = { id: 6, message };
|
|
93
|
+
if (this.liveRegion) {
|
|
94
|
+
this.liveRegion.innerHTML = message;
|
|
95
|
+
}
|
|
96
|
+
forceUpdate(this.el);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
emitFileListEvent() {
|
|
100
|
+
this.wmNetworkUploaderFilesChanged.emit(this.fileList);
|
|
101
|
+
}
|
|
102
|
+
formatDate(isoDate, locale, timezone) {
|
|
103
|
+
const timestamp = Date.parse(isoDate);
|
|
104
|
+
if (locale.match(/^[a-zA-Z]*(-[a-zA-Z0-9]*)*$/g)) {
|
|
105
|
+
// make sure locale is valid, otherwise set default locale
|
|
106
|
+
try {
|
|
107
|
+
//@ts-ignore
|
|
108
|
+
Intl.getCanonicalLocales(locale);
|
|
109
|
+
}
|
|
110
|
+
catch (_a) {
|
|
111
|
+
locale = "en-us";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
return isoDate;
|
|
116
|
+
}
|
|
117
|
+
if (!!timestamp) {
|
|
118
|
+
const date = new Date(timestamp);
|
|
119
|
+
const year = date.getFullYear();
|
|
120
|
+
const month = ("0" + (date.getMonth() + 1)).substr(-2);
|
|
121
|
+
const day = ("0" + date.getDate()).substr(-2);
|
|
122
|
+
const time = date.toLocaleTimeString([locale, "en-us"], {
|
|
123
|
+
timeZone: timezone,
|
|
124
|
+
hour: "numeric",
|
|
125
|
+
minute: "numeric",
|
|
126
|
+
});
|
|
127
|
+
return `${year}/${month}/${day} ${time}`;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return isoDate;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
isValidSize(size) {
|
|
134
|
+
// https://stackoverflow.com/questions/2365100/converting-bytes-to-megabytes
|
|
135
|
+
return size / 1024 / 1024 <= this.maxSize;
|
|
136
|
+
}
|
|
137
|
+
isDuplicate(name) {
|
|
138
|
+
return this.fileList.find((f) => f.file_name === name);
|
|
139
|
+
}
|
|
140
|
+
isEmpty() {
|
|
141
|
+
return !this.fileList.length && !this.inProgressList.length && !this.errorList.length;
|
|
142
|
+
}
|
|
143
|
+
get isDisabled() {
|
|
144
|
+
const isMax = !!this.maxFiles && this.fileList.length >= this.maxFiles;
|
|
145
|
+
if (!this.notif) {
|
|
146
|
+
if (isMax) {
|
|
147
|
+
const errMessage = intl.formatMessage({
|
|
148
|
+
id: "uploader.fileUploadLimitExceeded",
|
|
149
|
+
defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
|
|
150
|
+
description: "Message displayed when trying to upload too many files",
|
|
151
|
+
});
|
|
152
|
+
this.notif = { id: 1, message: errMessage };
|
|
153
|
+
if (this.liveRegion) {
|
|
154
|
+
this.liveRegion.innerHTML = errMessage;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
this.notif = null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else if (this.notif.id === 1) {
|
|
162
|
+
// to make sure SR don't repeat the error, don't reset it if it already is showing
|
|
163
|
+
// just dismiss it if isMax is not true anymore
|
|
164
|
+
if (!isMax) {
|
|
165
|
+
this.notif = null;
|
|
166
|
+
}
|
|
167
|
+
// finally do nothing if error 2 is showing (special case when user selects too many files)
|
|
168
|
+
}
|
|
169
|
+
// disable if is the uploader is maxed out or if something is uploading
|
|
170
|
+
return isMax || this.numFilesInProgress > 0;
|
|
171
|
+
}
|
|
172
|
+
purgeProgressList(item) {
|
|
173
|
+
// If a file is retrieved from the server because it was just uploaded
|
|
174
|
+
// it should be removed from inProgressList
|
|
175
|
+
this.inProgressList = this.inProgressList.filter((i) => i.progress !== 100 && i.name !== item.file_name);
|
|
176
|
+
}
|
|
177
|
+
getExistingFiles() {
|
|
178
|
+
getRequest(this.getPath)
|
|
179
|
+
.then((reply) => {
|
|
180
|
+
reply.map((item) => this.purgeProgressList(item));
|
|
181
|
+
if (this.sortBy === "name") {
|
|
182
|
+
reply.sort((a, b) => a.file_name.localeCompare(b.file_name));
|
|
183
|
+
}
|
|
184
|
+
this.fileList = reply;
|
|
185
|
+
})
|
|
186
|
+
.catch((errStatus) => {
|
|
187
|
+
console.error(errStatus);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
clearErrors() {
|
|
191
|
+
this.errorList = [];
|
|
192
|
+
this.notif = null;
|
|
193
|
+
}
|
|
194
|
+
handleFiles(ev) {
|
|
195
|
+
const files = Array.from(ev.target.files);
|
|
196
|
+
const validTypes = this.fileTypes.split(" ").join(", ");
|
|
197
|
+
if (!!this.maxFiles && this.fileList.length + files.length > this.maxFiles) {
|
|
198
|
+
const errMessage = intl.formatMessage({
|
|
199
|
+
id: "uploader.fileUploadLimitExceeded",
|
|
200
|
+
defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
|
|
201
|
+
description: "Message displayed when trying to upload too many files",
|
|
202
|
+
});
|
|
203
|
+
this.notif = { id: 2, message: errMessage };
|
|
204
|
+
if (this.liveRegion) {
|
|
205
|
+
this.liveRegion.innerHTML = errMessage;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
// map to create inProgress items so they can be displayed immediately
|
|
210
|
+
files &&
|
|
211
|
+
files.map((file) => {
|
|
212
|
+
if (!hasValidType(file, this.fileTypes)) {
|
|
213
|
+
const error = {
|
|
214
|
+
file_name: file.name,
|
|
215
|
+
message: intl.formatMessage({
|
|
216
|
+
id: "uploader.invalidFileType",
|
|
217
|
+
defaultMessage: "The file type is invalid. Accepted types: {validTypes}",
|
|
218
|
+
}, { validTypes }),
|
|
219
|
+
};
|
|
220
|
+
this.errorList.push(error);
|
|
221
|
+
}
|
|
222
|
+
else if (!this.isValidSize(file.size)) {
|
|
223
|
+
const error = {
|
|
224
|
+
file_name: file.name,
|
|
225
|
+
message: intl.formatMessage({
|
|
226
|
+
id: "uploader.fileTooLarge",
|
|
227
|
+
defaultMessage: "The selected file is too large. Maximum file size is {size}Mb",
|
|
228
|
+
}, { size: this.maxSize }),
|
|
229
|
+
};
|
|
230
|
+
this.errorList.push(error);
|
|
231
|
+
}
|
|
232
|
+
else if (this.isDuplicate(file.name)) {
|
|
233
|
+
const error = {
|
|
234
|
+
file_name: file.name,
|
|
235
|
+
message: intl.formatMessage({
|
|
236
|
+
id: "uploader.duplicateName",
|
|
237
|
+
defaultMessage: "A file with this name already exists.",
|
|
238
|
+
}),
|
|
239
|
+
};
|
|
240
|
+
this.errorList.push(error);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
this.inProgressList.push(file);
|
|
244
|
+
}
|
|
245
|
+
forceUpdate(this.el);
|
|
246
|
+
});
|
|
247
|
+
if (this.inProgressList.length > 0) {
|
|
248
|
+
this.numFilesInProgress = this.inProgressList.length;
|
|
249
|
+
// map over "uploadable" files for actual upload
|
|
250
|
+
// this happens separately otherwise at each pass we'd have to wait for the requests to complete before displaying things
|
|
251
|
+
this.inProgressList.map((file, i) => {
|
|
252
|
+
this.uploadFile(file, i); // = input.files file
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
ev.target.value = ""; // reset to ensure that onChange is triggered when the same file is selected a second time
|
|
257
|
+
}
|
|
258
|
+
uploadFile(file, i) {
|
|
259
|
+
// get upload link
|
|
260
|
+
getRequest(this.requestUploadPath + i.toString())
|
|
261
|
+
.then(async (reply) => {
|
|
262
|
+
const assData = JSON.parse(this.associatedData);
|
|
263
|
+
const fileInfo = Object.assign(Object.assign({}, assData), { file_name: file.name, mime_type: file.type, file_path: reply.path, document_uuid: reply.guid });
|
|
264
|
+
// onProgress is passed as a callback to the ev listener inside putRequest (http service),
|
|
265
|
+
// so we can't change component things directly => custom event to pass data to uploader component.
|
|
266
|
+
const onProgress = (ev) => {
|
|
267
|
+
const progress = ev.lengthComputable && ev.total !== 0 ? (ev.loaded / ev.total) * 100 : 0;
|
|
268
|
+
const event = new CustomEvent("wmUploadProgress", {
|
|
269
|
+
detail: { file_name: file.name, progress },
|
|
270
|
+
});
|
|
271
|
+
this.el.dispatchEvent(event);
|
|
272
|
+
};
|
|
273
|
+
// upload to AWS s3 to url we just fetched
|
|
274
|
+
await putRequest(reply.url, file, onProgress);
|
|
275
|
+
// create the db entry
|
|
276
|
+
await postRequest(this.uploadPath, fileInfo);
|
|
277
|
+
// get files from server again
|
|
278
|
+
this.getExistingFiles();
|
|
279
|
+
})
|
|
280
|
+
.catch((err) => {
|
|
281
|
+
// do not show toast on error
|
|
282
|
+
this.numFilesInProgress = null;
|
|
283
|
+
// do not show in progress item on error
|
|
284
|
+
this.inProgressList = [];
|
|
285
|
+
this.notif = {
|
|
286
|
+
id: 3,
|
|
287
|
+
message: globalMessages.genericError,
|
|
288
|
+
};
|
|
289
|
+
console.error(err);
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
downloadFile(uuid, path) {
|
|
293
|
+
this.clearErrors();
|
|
294
|
+
// POST request to get temporary download link
|
|
295
|
+
const payload = {
|
|
296
|
+
file_path: path,
|
|
297
|
+
file_uuid: uuid,
|
|
298
|
+
};
|
|
299
|
+
postRequest(this.requestDownloadPath, payload)
|
|
300
|
+
.then((reply) => {
|
|
301
|
+
// we got the download link, now download the file
|
|
302
|
+
window.location.assign(reply.url);
|
|
303
|
+
})
|
|
304
|
+
.catch((err) => {
|
|
305
|
+
console.error(err);
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
deleteFile(file) {
|
|
309
|
+
this.clearErrors();
|
|
310
|
+
this.snackbar.push({
|
|
311
|
+
message: intl.formatMessage({
|
|
312
|
+
id: "uploader.fileDeleted",
|
|
313
|
+
defaultMessage: "{fileName} was deleted.",
|
|
314
|
+
}, { fileName: file.file_name }),
|
|
315
|
+
id: file.uuid,
|
|
316
|
+
link: "",
|
|
317
|
+
});
|
|
318
|
+
// rm file from list immediately.
|
|
319
|
+
this.fileList = this.fileList.filter((i) => i.uuid !== file.uuid);
|
|
320
|
+
deleteRequest(`${this.deletePath}/${file.uuid}`).catch((err) => {
|
|
321
|
+
this.notif = {
|
|
322
|
+
id: 4,
|
|
323
|
+
message: intl.formatMessage({
|
|
324
|
+
id: "uploader.fileNotDeleted",
|
|
325
|
+
defaultMessage: "{fileName} could not be deleted.",
|
|
326
|
+
}, { fileName: file.file_name }),
|
|
327
|
+
};
|
|
328
|
+
this.getExistingFiles();
|
|
329
|
+
console.error(err);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
componentWillLoad() {
|
|
333
|
+
if (!this.getPath) {
|
|
334
|
+
throw new Error("wm-network-uploader: get-path is a required prop");
|
|
335
|
+
}
|
|
336
|
+
if (!this.requestUploadPath) {
|
|
337
|
+
throw new Error("wm-network-uploader: request-upload-path is a required prop");
|
|
338
|
+
}
|
|
339
|
+
if (!this.uploadPath) {
|
|
340
|
+
throw new Error("wm-network-uploader: upload-path is a required prop");
|
|
341
|
+
}
|
|
342
|
+
if (!this.requestDownloadPath) {
|
|
343
|
+
throw new Error("wm-network-uploader: request-download-path is a required prop");
|
|
344
|
+
}
|
|
345
|
+
if (!this.deletePath) {
|
|
346
|
+
throw new Error("wm-network-uploader: delete-path is a required prop");
|
|
347
|
+
}
|
|
348
|
+
if (!this.buttonText) {
|
|
349
|
+
throw new Error("wm-network-uploader: button-text is a required prop");
|
|
350
|
+
}
|
|
351
|
+
if (!this.emptyStateText) {
|
|
352
|
+
throw new Error("wm-network-uploader: empty-state-text is a required prop");
|
|
353
|
+
}
|
|
354
|
+
if (!this.associatedData) {
|
|
355
|
+
throw new Error("wm-network-uploader: associated-data is a required prop");
|
|
356
|
+
}
|
|
357
|
+
this.setMaxSize();
|
|
358
|
+
this.clearErrors();
|
|
359
|
+
}
|
|
360
|
+
componentDidLoad() {
|
|
361
|
+
this.getExistingFiles();
|
|
362
|
+
if (document.body.classList.contains("wmcl-user-is-tabbing")) {
|
|
363
|
+
this.toggleTabbingOn();
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
uploadButtonOnClick(ev) {
|
|
367
|
+
if (this.isDisabled) {
|
|
368
|
+
// this is a temporary fix.
|
|
369
|
+
// we need the disabled button to be programmatically focusable
|
|
370
|
+
// to allow return focus after closing the browser file panel
|
|
371
|
+
// since it's focusable the button should respond when activated
|
|
372
|
+
// it looks disabled, and announces the reason why the action cannot
|
|
373
|
+
// be taken when activated.
|
|
374
|
+
// this is not pretty duplicating a intl message + the logic of isDisabled,
|
|
375
|
+
// but not worth a bigger refactor since this is only until we get the UX for disabled elements and refactor all interactive els.
|
|
376
|
+
ev.preventDefault();
|
|
377
|
+
if (this.liveRegion) {
|
|
378
|
+
const isMax = !!this.maxFiles && this.fileList.length >= this.maxFiles;
|
|
379
|
+
let errMsg = "";
|
|
380
|
+
if (this.numFilesInProgress > 0) {
|
|
381
|
+
errMsg = intl.formatMessage({
|
|
382
|
+
id: "uploader.waitToUpload",
|
|
383
|
+
defaultMessage: "Please wait for current upload to complete before uploading new files.",
|
|
384
|
+
description: "Message for screen reader users",
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
else if (isMax) {
|
|
388
|
+
errMsg = intl.formatMessage({
|
|
389
|
+
id: "uploader.fileUploadLimitExceeded",
|
|
390
|
+
defaultMessage: "Upload unsuccessful because file selection would exceed the maximum number of files",
|
|
391
|
+
description: "Message displayed when trying to upload too many files",
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
if (errMsg) {
|
|
395
|
+
// clear and set again to re-announce if button is clicked several times
|
|
396
|
+
// (can't be done inside setTimeout because of scope, hence the promise)
|
|
397
|
+
this.liveRegion.innerHTML = "";
|
|
398
|
+
new Promise((resolve) => {
|
|
399
|
+
setTimeout(() => {
|
|
400
|
+
resolve("");
|
|
401
|
+
}, 500);
|
|
402
|
+
}).then(() => (this.liveRegion.innerHTML = errMsg));
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
this.clearErrors();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
renderUploadSvg() {
|
|
411
|
+
return (h("svg", { class: "upload-file", width: "91", height: "84", viewBox: "0 0 91 84" }, h("path", { transform: "rotate(-180.000000) translate(-452, -255.5)", fill: "#eae8ec", d: "M361,249.681818 L361,197.318182 C361,194.118182 365.555061,191.5 371.122358,191.5 L391.316463,191.5 L391.286495,200.562515 L369.871211,200.600292 L369.885404,200.622146 L369.886423,246.655947 L443.657038,246.840767 L443.657038,200.622146 L421.683537,200.622146 L421.683537,191.5 L441.978865,191.5 C447.546162,191.5 452,194.118182 452,197.318182 L452,249.681818 C452,252.881818 447.546162,255.5 441.978865,255.5 L371.122358,255.5 C365.504449,255.5 361,252.881818 361,249.681818 Z M391.5,207 L406,221 L420.5,207 L409.625,207 L409.625,172 L402.375,172 L402.375,207 L391.5,207 Z" })));
|
|
412
|
+
}
|
|
413
|
+
renderIcon() {
|
|
414
|
+
// mdi attachment icon (paper clip) is horizontal but we want it vertical
|
|
415
|
+
const rotate = this.icon && this.icon === "f066";
|
|
416
|
+
return (this.icon && (h("span", { class: `mdi ${rotate ? "rotate" : ""}` }, String.fromCodePoint(parseInt(`0x${this.icon}`)))));
|
|
417
|
+
}
|
|
418
|
+
renderNotif() {
|
|
419
|
+
return this.notif ? h("span", { class: "notif" }, this.notif.message) : "";
|
|
420
|
+
}
|
|
421
|
+
renderUploadButton(classes) {
|
|
422
|
+
return (h("div", { class: "notif-wrapper" }, h("input", { name: this.inputId, id: this.inputId, class: "sr-only", type: "file", multiple: true, onClick: (ev) => this.uploadButtonOnClick(ev), onChange: (e) => this.handleFiles(e) }), h("label", { htmlFor: this.inputId, class: `wm-button ${classes}${this.isTabbing ? " user-is-tabbing" : ""}` }, this.renderIcon(), this.buttonText), this.renderNotif()));
|
|
423
|
+
}
|
|
424
|
+
renderWithItems() {
|
|
425
|
+
return (h("div", null, h("div", { class: "header" }, h("div", { class: "descr" }, h("slot", null)), this.renderUploadButton(this.isDisabled ? "disabled" : "")), this.renderErrorList(), this.renderInProgressList(), this.renderFileList()));
|
|
426
|
+
}
|
|
427
|
+
renderEmptyState() {
|
|
428
|
+
return (h("div", null, h("div", { class: "header" }, h("div", { class: "descr" }, h("slot", null))), h("div", { class: "empty-block" }, this.renderUploadSvg(), h("div", { class: "empty-message" }, this.emptyStateText), this.renderUploadButton("-primary empty-button"))));
|
|
429
|
+
}
|
|
430
|
+
renderErrorList() {
|
|
431
|
+
if (!!this.errorList.length) {
|
|
432
|
+
if (this.liveRegion) {
|
|
433
|
+
let srMessage = this.errorList.reduce(function (acc, err) {
|
|
434
|
+
return acc + `${err.file_name}: ${err.message} `;
|
|
435
|
+
}, "");
|
|
436
|
+
this.liveRegion.innerHTML = srMessage;
|
|
437
|
+
}
|
|
438
|
+
return (h("ul", { class: "error-list" }, this.errorList.map((err) => (h("li", null, h("div", { class: "file --error" }, h("div", { class: "file-info" }, h("span", { class: "filename" }, err.file_name))), h("div", { class: "error-message" }, err.message))))));
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
renderInProgressList() {
|
|
442
|
+
return (h("ul", { class: "inprogress-list" }, this.inProgressList.map((item) => {
|
|
443
|
+
return (h("li", null, h("div", { class: "file --progress" }, h("div", { class: "progress", style: {
|
|
444
|
+
background: `linear-gradient(to right, rgba(67, 126, 142, 1) ${item.progress}%, transparent ${item.progress}%)`,
|
|
445
|
+
} }), h("div", { class: "file-info" }, h("span", { class: "filename" }, item.name, " ", h("span", { class: "sr-only" }, "uploading"))))));
|
|
446
|
+
})));
|
|
447
|
+
}
|
|
448
|
+
renderFile(item) {
|
|
449
|
+
return (h("li", null, h("div", { class: "file --saved" }, h("div", { class: "file-info" }, h("span", { class: "filename" }, item.file_name), h("span", { class: "filedate" }, this.formatDate(item.updated_at, intl.locale, Intl.DateTimeFormat().resolvedOptions().timeZone))), h("div", { class: "file-controls" }, h("wm-button", { class: "download-button", "button-type": "icononly", tooltip: "download", "label-for-identical-buttons": `download ${item.file_name}`, icon: "f1da", onClick: () => this.downloadFile(item.uuid, item.file_path) }), h("wm-button", { class: "delete-button", "button-type": "icononly", tooltip: "remove", "label-for-identical-buttons": `remove ${item.file_name}`, icon: "f1c0", onClick: () => this.deleteFile(item) })))));
|
|
450
|
+
}
|
|
451
|
+
renderFileList() {
|
|
452
|
+
return h("ul", { class: "file-list" }, this.fileList.map((item) => this.renderFile(item)));
|
|
453
|
+
}
|
|
454
|
+
render() {
|
|
455
|
+
return (h(Host, null, this.isEmpty() ? this.renderEmptyState() : this.renderWithItems(), h("wm-snackbar", { notifications: JSON.stringify(this.snackbar) }), h("div", { ref: (el) => (this.liveRegion = el), class: "live-region sr-only", "aria-live": "assertive" // since it's directly linked to the action the user took, it should be read in priority. With polite, some messages get dismissed in favor of the page title
|
|
456
|
+
,
|
|
457
|
+
"aria-atomic": "true" })));
|
|
458
|
+
}
|
|
459
|
+
static get is() { return "wm-network-uploader"; }
|
|
460
|
+
static get encapsulation() { return "shadow"; }
|
|
461
|
+
static get originalStyleUrls() {
|
|
462
|
+
return {
|
|
463
|
+
"$": ["wm-network-uploader.scss"]
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
static get styleUrls() {
|
|
467
|
+
return {
|
|
468
|
+
"$": ["wm-network-uploader.css"]
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
static get properties() {
|
|
472
|
+
return {
|
|
473
|
+
"getPath": {
|
|
474
|
+
"type": "string",
|
|
475
|
+
"mutable": false,
|
|
476
|
+
"complexType": {
|
|
477
|
+
"original": "string",
|
|
478
|
+
"resolved": "string",
|
|
479
|
+
"references": {}
|
|
480
|
+
},
|
|
481
|
+
"required": true,
|
|
482
|
+
"optional": false,
|
|
483
|
+
"docs": {
|
|
484
|
+
"tags": [],
|
|
485
|
+
"text": ""
|
|
486
|
+
},
|
|
487
|
+
"attribute": "get-path",
|
|
488
|
+
"reflect": false
|
|
489
|
+
},
|
|
490
|
+
"requestUploadPath": {
|
|
491
|
+
"type": "string",
|
|
492
|
+
"mutable": false,
|
|
493
|
+
"complexType": {
|
|
494
|
+
"original": "string",
|
|
495
|
+
"resolved": "string",
|
|
496
|
+
"references": {}
|
|
497
|
+
},
|
|
498
|
+
"required": true,
|
|
499
|
+
"optional": false,
|
|
500
|
+
"docs": {
|
|
501
|
+
"tags": [],
|
|
502
|
+
"text": ""
|
|
503
|
+
},
|
|
504
|
+
"attribute": "request-upload-path",
|
|
505
|
+
"reflect": false
|
|
506
|
+
},
|
|
507
|
+
"uploadPath": {
|
|
508
|
+
"type": "string",
|
|
509
|
+
"mutable": false,
|
|
510
|
+
"complexType": {
|
|
511
|
+
"original": "string",
|
|
512
|
+
"resolved": "string",
|
|
513
|
+
"references": {}
|
|
514
|
+
},
|
|
515
|
+
"required": true,
|
|
516
|
+
"optional": false,
|
|
517
|
+
"docs": {
|
|
518
|
+
"tags": [],
|
|
519
|
+
"text": ""
|
|
520
|
+
},
|
|
521
|
+
"attribute": "upload-path",
|
|
522
|
+
"reflect": false
|
|
523
|
+
},
|
|
524
|
+
"requestDownloadPath": {
|
|
525
|
+
"type": "string",
|
|
526
|
+
"mutable": false,
|
|
527
|
+
"complexType": {
|
|
528
|
+
"original": "string",
|
|
529
|
+
"resolved": "string",
|
|
530
|
+
"references": {}
|
|
531
|
+
},
|
|
532
|
+
"required": true,
|
|
533
|
+
"optional": false,
|
|
534
|
+
"docs": {
|
|
535
|
+
"tags": [],
|
|
536
|
+
"text": ""
|
|
537
|
+
},
|
|
538
|
+
"attribute": "request-download-path",
|
|
539
|
+
"reflect": false
|
|
540
|
+
},
|
|
541
|
+
"deletePath": {
|
|
542
|
+
"type": "string",
|
|
543
|
+
"mutable": false,
|
|
544
|
+
"complexType": {
|
|
545
|
+
"original": "string",
|
|
546
|
+
"resolved": "string",
|
|
547
|
+
"references": {}
|
|
548
|
+
},
|
|
549
|
+
"required": true,
|
|
550
|
+
"optional": false,
|
|
551
|
+
"docs": {
|
|
552
|
+
"tags": [],
|
|
553
|
+
"text": ""
|
|
554
|
+
},
|
|
555
|
+
"attribute": "delete-path",
|
|
556
|
+
"reflect": false
|
|
557
|
+
},
|
|
558
|
+
"associatedData": {
|
|
559
|
+
"type": "string",
|
|
560
|
+
"mutable": false,
|
|
561
|
+
"complexType": {
|
|
562
|
+
"original": "string",
|
|
563
|
+
"resolved": "string | undefined",
|
|
564
|
+
"references": {}
|
|
565
|
+
},
|
|
566
|
+
"required": false,
|
|
567
|
+
"optional": true,
|
|
568
|
+
"docs": {
|
|
569
|
+
"tags": [],
|
|
570
|
+
"text": ""
|
|
571
|
+
},
|
|
572
|
+
"attribute": "associated-data",
|
|
573
|
+
"reflect": false
|
|
574
|
+
},
|
|
575
|
+
"buttonText": {
|
|
576
|
+
"type": "string",
|
|
577
|
+
"mutable": false,
|
|
578
|
+
"complexType": {
|
|
579
|
+
"original": "string",
|
|
580
|
+
"resolved": "string",
|
|
581
|
+
"references": {}
|
|
582
|
+
},
|
|
583
|
+
"required": true,
|
|
584
|
+
"optional": false,
|
|
585
|
+
"docs": {
|
|
586
|
+
"tags": [],
|
|
587
|
+
"text": ""
|
|
588
|
+
},
|
|
589
|
+
"attribute": "button-text",
|
|
590
|
+
"reflect": false
|
|
591
|
+
},
|
|
592
|
+
"emptyStateText": {
|
|
593
|
+
"type": "string",
|
|
594
|
+
"mutable": false,
|
|
595
|
+
"complexType": {
|
|
596
|
+
"original": "string",
|
|
597
|
+
"resolved": "string",
|
|
598
|
+
"references": {}
|
|
599
|
+
},
|
|
600
|
+
"required": true,
|
|
601
|
+
"optional": false,
|
|
602
|
+
"docs": {
|
|
603
|
+
"tags": [],
|
|
604
|
+
"text": ""
|
|
605
|
+
},
|
|
606
|
+
"attribute": "empty-state-text",
|
|
607
|
+
"reflect": false
|
|
608
|
+
},
|
|
609
|
+
"icon": {
|
|
610
|
+
"type": "string",
|
|
611
|
+
"mutable": false,
|
|
612
|
+
"complexType": {
|
|
613
|
+
"original": "string",
|
|
614
|
+
"resolved": "string",
|
|
615
|
+
"references": {}
|
|
616
|
+
},
|
|
617
|
+
"required": true,
|
|
618
|
+
"optional": false,
|
|
619
|
+
"docs": {
|
|
620
|
+
"tags": [],
|
|
621
|
+
"text": ""
|
|
622
|
+
},
|
|
623
|
+
"attribute": "icon",
|
|
624
|
+
"reflect": false
|
|
625
|
+
},
|
|
626
|
+
"fileTypes": {
|
|
627
|
+
"type": "string",
|
|
628
|
+
"mutable": false,
|
|
629
|
+
"complexType": {
|
|
630
|
+
"original": "string",
|
|
631
|
+
"resolved": "string",
|
|
632
|
+
"references": {}
|
|
633
|
+
},
|
|
634
|
+
"required": false,
|
|
635
|
+
"optional": false,
|
|
636
|
+
"docs": {
|
|
637
|
+
"tags": [],
|
|
638
|
+
"text": ""
|
|
639
|
+
},
|
|
640
|
+
"attribute": "file-types",
|
|
641
|
+
"reflect": false,
|
|
642
|
+
"defaultValue": "\"pdf txt log xml doc docx xls xlsx ppt pptx gif jpg jpeg png csv\""
|
|
643
|
+
},
|
|
644
|
+
"maxSize": {
|
|
645
|
+
"type": "number",
|
|
646
|
+
"mutable": true,
|
|
647
|
+
"complexType": {
|
|
648
|
+
"original": "number",
|
|
649
|
+
"resolved": "number",
|
|
650
|
+
"references": {}
|
|
651
|
+
},
|
|
652
|
+
"required": false,
|
|
653
|
+
"optional": false,
|
|
654
|
+
"docs": {
|
|
655
|
+
"tags": [],
|
|
656
|
+
"text": ""
|
|
657
|
+
},
|
|
658
|
+
"attribute": "max-size",
|
|
659
|
+
"reflect": false,
|
|
660
|
+
"defaultValue": "100"
|
|
661
|
+
},
|
|
662
|
+
"maxFiles": {
|
|
663
|
+
"type": "number",
|
|
664
|
+
"mutable": false,
|
|
665
|
+
"complexType": {
|
|
666
|
+
"original": "number",
|
|
667
|
+
"resolved": "number | undefined",
|
|
668
|
+
"references": {}
|
|
669
|
+
},
|
|
670
|
+
"required": false,
|
|
671
|
+
"optional": true,
|
|
672
|
+
"docs": {
|
|
673
|
+
"tags": [],
|
|
674
|
+
"text": ""
|
|
675
|
+
},
|
|
676
|
+
"attribute": "max-files",
|
|
677
|
+
"reflect": false
|
|
678
|
+
},
|
|
679
|
+
"sortBy": {
|
|
680
|
+
"type": "string",
|
|
681
|
+
"mutable": false,
|
|
682
|
+
"complexType": {
|
|
683
|
+
"original": "\"name\" | \"date\"",
|
|
684
|
+
"resolved": "\"date\" | \"name\"",
|
|
685
|
+
"references": {}
|
|
686
|
+
},
|
|
687
|
+
"required": false,
|
|
688
|
+
"optional": false,
|
|
689
|
+
"docs": {
|
|
690
|
+
"tags": [],
|
|
691
|
+
"text": ""
|
|
692
|
+
},
|
|
693
|
+
"attribute": "sort-by",
|
|
694
|
+
"reflect": false,
|
|
695
|
+
"defaultValue": "\"date\""
|
|
696
|
+
}
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
static get states() {
|
|
700
|
+
return {
|
|
701
|
+
"isTabbing": {},
|
|
702
|
+
"fileList": {},
|
|
703
|
+
"inProgressList": {},
|
|
704
|
+
"errorList": {},
|
|
705
|
+
"notif": {},
|
|
706
|
+
"snackbar": {},
|
|
707
|
+
"numFilesInProgress": {}
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
static get events() {
|
|
711
|
+
return [{
|
|
712
|
+
"method": "wmNetworkUploaderFilesChanged",
|
|
713
|
+
"name": "wmNetworkUploaderFilesChanged",
|
|
714
|
+
"bubbles": true,
|
|
715
|
+
"cancelable": true,
|
|
716
|
+
"composed": true,
|
|
717
|
+
"docs": {
|
|
718
|
+
"tags": [],
|
|
719
|
+
"text": ""
|
|
720
|
+
},
|
|
721
|
+
"complexType": {
|
|
722
|
+
"original": "Object[]",
|
|
723
|
+
"resolved": "Object[]",
|
|
724
|
+
"references": {
|
|
725
|
+
"Object": {
|
|
726
|
+
"location": "global"
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}];
|
|
731
|
+
}
|
|
732
|
+
static get elementRef() { return "el"; }
|
|
733
|
+
static get watchers() {
|
|
734
|
+
return [{
|
|
735
|
+
"propName": "maxSize",
|
|
736
|
+
"methodName": "setMaxSize"
|
|
737
|
+
}, {
|
|
738
|
+
"propName": "numFilesInProgress",
|
|
739
|
+
"methodName": "uploadNotifications"
|
|
740
|
+
}, {
|
|
741
|
+
"propName": "fileList",
|
|
742
|
+
"methodName": "emitFileListEvent"
|
|
743
|
+
}];
|
|
744
|
+
}
|
|
745
|
+
static get listeners() {
|
|
746
|
+
return [{
|
|
747
|
+
"name": "wmUserIsTabbing",
|
|
748
|
+
"method": "toggleTabbingOn",
|
|
749
|
+
"target": "window",
|
|
750
|
+
"capture": false,
|
|
751
|
+
"passive": false
|
|
752
|
+
}, {
|
|
753
|
+
"name": "wmUserIsNotTabbing",
|
|
754
|
+
"method": "toggleTabbingOff",
|
|
755
|
+
"target": "window",
|
|
756
|
+
"capture": false,
|
|
757
|
+
"passive": false
|
|
758
|
+
}, {
|
|
759
|
+
"name": "wmUploadProgress",
|
|
760
|
+
"method": "handleUploadProgress",
|
|
761
|
+
"target": undefined,
|
|
762
|
+
"capture": false,
|
|
763
|
+
"passive": false
|
|
764
|
+
}, {
|
|
765
|
+
"name": "userFinishedSnack",
|
|
766
|
+
"method": "handleFinishedSnack",
|
|
767
|
+
"target": undefined,
|
|
768
|
+
"capture": false,
|
|
769
|
+
"passive": false
|
|
770
|
+
}];
|
|
771
|
+
}
|
|
772
|
+
}
|