@watermarkinsights/ripple 3.8.0-5 → 3.8.0-8
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/{functions-83193a8d.js → functions-f40cb19b.js} +568 -506
- package/dist/cjs/{global-2f521eb7.js → global-619e76b2.js} +65 -65
- package/dist/cjs/{http-service-494d81de.js → http-service-9e8c4dd5.js} +49 -49
- package/dist/cjs/{index-cd179539.js → index-0e7e3668.js} +96 -64
- package/dist/cjs/{interfaces-a3338581.js → interfaces-30a74c1f.js} +29 -29
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/priv-chart-popover.cjs.entry.js +79 -79
- package/dist/cjs/priv-datepicker.cjs.entry.js +674 -674
- package/dist/cjs/priv-navigator-button.cjs.entry.js +19 -19
- package/dist/cjs/priv-navigator-item.cjs.entry.js +24 -24
- package/dist/cjs/ripple.cjs.js +4 -4
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +342 -342
- package/dist/cjs/wm-button.cjs.entry.js +228 -228
- package/dist/cjs/wm-chart-slice.cjs.entry.js +14 -14
- package/dist/cjs/wm-chart.cjs.entry.js +475 -475
- package/dist/cjs/wm-datepicker.cjs.entry.js +273 -273
- package/dist/cjs/wm-input.cjs.entry.js +136 -136
- package/dist/cjs/wm-modal-footer.cjs.entry.js +32 -32
- package/dist/cjs/wm-modal-header.cjs.entry.js +35 -35
- package/dist/cjs/wm-modal.cjs.entry.js +164 -164
- package/dist/cjs/wm-navigation_3.cjs.entry.js +219 -221
- package/dist/cjs/wm-navigator.cjs.entry.js +269 -269
- package/dist/cjs/wm-network-uploader.cjs.entry.js +422 -422
- package/dist/cjs/wm-option_2.cjs.entry.js +497 -497
- package/dist/cjs/wm-pagination.cjs.entry.js +168 -168
- package/dist/cjs/wm-search.cjs.entry.js +233 -233
- package/dist/cjs/wm-snackbar.cjs.entry.js +172 -172
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +298 -298
- package/dist/cjs/wm-tag-input.cjs.entry.js +581 -581
- package/dist/cjs/wm-timepicker.cjs.entry.js +385 -385
- package/dist/cjs/wm-toggletip.cjs.entry.js +126 -126
- package/dist/cjs/wm-uploader.cjs.entry.js +348 -348
- package/dist/cjs/wm-wrapper.cjs.entry.js +13 -13
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/wm-action-menu/wm-action-menu.js +460 -460
- package/dist/collection/components/wm-button/wm-button.css +1 -2
- package/dist/collection/components/wm-button/wm-button.js +491 -491
- package/dist/collection/components/wm-chart/priv-chart-popover/priv-chart-popover.js +232 -232
- package/dist/collection/components/wm-chart/wm-chart-slice.js +115 -115
- package/dist/collection/components/wm-chart/wm-chart.js +718 -718
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.css +3 -4
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +1039 -1039
- package/dist/collection/components/wm-datepicker/wm-datepicker.css +1 -2
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +483 -483
- package/dist/collection/components/wm-input/wm-input.css +1 -2
- package/dist/collection/components/wm-input/wm-input.js +423 -423
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +444 -444
- package/dist/collection/components/wm-modal/wm-modal-footer.js +141 -141
- package/dist/collection/components/wm-modal/wm-modal-header.js +92 -92
- package/dist/collection/components/wm-modal/wm-modal.js +461 -461
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.css +1 -2
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +162 -152
- package/dist/collection/components/wm-navigation/wm-navigation-item.js +105 -105
- package/dist/collection/components/wm-navigation/wm-navigation.css +12 -11
- package/dist/collection/components/wm-navigation/wm-navigation.js +202 -193
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +97 -97
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +114 -114
- package/dist/collection/components/wm-navigator/wm-navigator.js +468 -468
- package/dist/collection/components/wm-option/wm-option.css +2 -3
- package/dist/collection/components/wm-option/wm-option.js +422 -422
- package/dist/collection/components/wm-pagination/wm-pagination.js +368 -368
- package/dist/collection/components/wm-search/wm-search.js +480 -480
- package/dist/collection/components/wm-select/wm-select.css +2 -3
- package/dist/collection/components/wm-select/wm-select.js +720 -720
- package/dist/collection/components/wm-snackbar/wm-snackbar.css +2 -3
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +297 -297
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.css +2 -2
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +216 -216
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +330 -330
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -104
- package/dist/collection/components/wm-tag-input/wm-tag-input.css +2 -3
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +810 -810
- package/dist/collection/components/wm-timepicker/wm-timepicker.css +2 -3
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +583 -583
- package/dist/collection/components/wm-toggletip/wm-toggletip.css +1 -2
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +241 -241
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.css +1 -2
- package/dist/collection/components/wm-uploader/wm-network-uploader/wm-network-uploader.js +753 -753
- package/dist/collection/components/wm-uploader/wm-uploader.css +1 -2
- package/dist/collection/components/wm-uploader/wm-uploader.js +748 -748
- package/dist/collection/components/wm-wrapper/wm-wrapper.js +27 -27
- package/dist/collection/dev/scripts.js +20 -20
- package/dist/collection/global/__mocks__/functions.js +6 -6
- package/dist/collection/global/functions.js +468 -468
- package/dist/collection/global/global.js +72 -72
- package/dist/collection/global/interfaces.js +49 -49
- 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 +39 -39
- package/dist/collection/lang/piglatin.js +93 -93
- package/dist/esm/{functions-7eebdc16.js → functions-bab72507.js} +568 -506
- package/dist/esm/{global-0dc2eb57.js → global-8bbc13f5.js} +65 -65
- package/dist/esm/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +49 -49
- package/dist/esm/{index-66f8130e.js → index-cd8f9ae2.js} +96 -64
- package/dist/esm/{interfaces-2b97fab2.js → interfaces-61c6305b.js} +29 -29
- package/dist/esm/loader.js +4 -4
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- 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 +79 -79
- package/dist/esm/priv-datepicker.entry.js +674 -674
- package/dist/esm/priv-navigator-button.entry.js +19 -19
- package/dist/esm/priv-navigator-item.entry.js +24 -24
- package/dist/esm/ripple.js +4 -4
- package/dist/esm/wm-action-menu_2.entry.js +342 -342
- package/dist/esm/wm-button.entry.js +228 -228
- package/dist/esm/wm-chart-slice.entry.js +14 -14
- package/dist/esm/wm-chart.entry.js +475 -475
- package/dist/esm/wm-datepicker.entry.js +273 -273
- package/dist/esm/wm-input.entry.js +136 -136
- package/dist/esm/wm-modal-footer.entry.js +32 -32
- package/dist/esm/wm-modal-header.entry.js +35 -35
- package/dist/esm/wm-modal.entry.js +164 -164
- package/dist/esm/wm-navigation_3.entry.js +219 -221
- package/dist/esm/wm-navigator.entry.js +269 -269
- package/dist/esm/wm-network-uploader.entry.js +422 -422
- package/dist/esm/wm-option_2.entry.js +497 -497
- package/dist/esm/wm-pagination.entry.js +168 -168
- package/dist/esm/wm-search.entry.js +233 -233
- package/dist/esm/wm-snackbar.entry.js +172 -172
- package/dist/esm/wm-tab-item_3.entry.js +298 -298
- package/dist/esm/wm-tag-input.entry.js +581 -581
- package/dist/esm/wm-timepicker.entry.js +385 -385
- package/dist/esm/wm-toggletip.entry.js +126 -126
- package/dist/esm/wm-uploader.entry.js +348 -348
- package/dist/esm/wm-wrapper.entry.js +13 -13
- package/dist/esm-es5/functions-bab72507.js +15 -0
- package/dist/esm-es5/{global-0dc2eb57.js → global-8bbc13f5.js} +1 -1
- package/dist/esm-es5/{http-service-3dc3b3e7.js → http-service-5d037e16.js} +1 -1
- package/dist/esm-es5/index-cd8f9ae2.js +1 -0
- package/dist/esm-es5/{interfaces-2b97fab2.js → interfaces-61c6305b.js} +0 -0
- 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/priv-navigator-button.entry.js +1 -1
- package/dist/esm-es5/priv-navigator-item.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-slice.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-input.entry.js +1 -1
- package/dist/esm-es5/wm-modal-footer.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-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/esm-es5/wm-wrapper.entry.js +1 -1
- package/dist/loader/index.d.ts +0 -1
- package/dist/ripple/p-0829f91e.system.entry.js +1 -0
- package/dist/ripple/{p-f5df5903.system.js → p-08b7ec08.system.js} +0 -0
- package/dist/ripple/p-0e69fab1.entry.js +1 -0
- package/dist/ripple/p-1a1a5bfe.system.entry.js +1 -0
- package/dist/ripple/p-1bdaf8f4.entry.js +1 -0
- package/dist/ripple/{p-c652f945.system.entry.js → p-1c680aef.system.entry.js} +1 -1
- package/dist/ripple/p-1cf84785.entry.js +1 -0
- package/dist/ripple/p-1ea471c2.system.entry.js +1 -0
- package/dist/ripple/{p-bb31d263.system.entry.js → p-1eeccf23.system.entry.js} +1 -1
- package/dist/ripple/p-20856a2d.system.js +1 -0
- package/dist/ripple/p-213fde22.system.entry.js +1 -0
- package/dist/ripple/{p-f781014a.system.entry.js → p-23d007e1.system.entry.js} +1 -1
- package/dist/ripple/p-244877c8.entry.js +1 -0
- package/dist/ripple/p-27e06d30.entry.js +1 -0
- package/dist/ripple/p-2e5c991e.entry.js +1 -0
- package/dist/ripple/p-313b6073.system.js +1 -0
- package/dist/ripple/p-31b2238d.system.entry.js +1 -0
- package/dist/ripple/{p-6b6643f9.js → p-35fe1e16.js} +1 -1
- package/dist/ripple/p-38062c39.js +1 -0
- package/dist/ripple/p-3a9e5917.system.entry.js +1 -0
- package/dist/ripple/p-3ba3afca.entry.js +1 -0
- package/dist/ripple/p-4027ec1c.entry.js +1 -0
- package/dist/ripple/p-4209831e.entry.js +1 -0
- package/dist/ripple/p-4eca954a.system.js +15 -0
- package/dist/ripple/p-4fdd9f45.entry.js +1 -0
- package/dist/ripple/{p-7bc744bf.system.entry.js → p-504579c2.system.entry.js} +1 -1
- package/dist/ripple/p-6ae89155.entry.js +1 -0
- package/dist/ripple/{p-dea73ebd.system.entry.js → p-6b918dc6.system.entry.js} +1 -1
- package/dist/ripple/{p-149db379.system.js → p-6f0779a0.system.js} +1 -1
- package/dist/ripple/p-705daf9c.system.entry.js +1 -0
- package/dist/ripple/p-764fa608.entry.js +1 -0
- package/dist/ripple/p-806d1f78.entry.js +1 -0
- package/dist/ripple/{p-43f1298b.js → p-888bec42.js} +0 -0
- package/dist/ripple/p-8a0450fd.entry.js +1 -0
- package/dist/ripple/p-8c09409a.system.entry.js +1 -0
- package/dist/ripple/p-8f536b53.entry.js +1 -0
- package/dist/ripple/p-937ad4f8.entry.js +1 -0
- package/dist/ripple/p-96c4dc9e.entry.js +1 -0
- package/dist/ripple/{p-2d49a016.system.entry.js → p-9a9743f5.system.entry.js} +1 -1
- package/dist/ripple/p-9cda12ea.entry.js +1 -0
- package/dist/ripple/p-9ebb877f.entry.js +1 -0
- package/dist/ripple/{p-b3ce2033.system.entry.js → p-a5177480.system.entry.js} +1 -1
- package/dist/ripple/{p-fd8070fb.js → p-a6d6eae7.js} +0 -0
- package/dist/ripple/p-a71df582.system.entry.js +1 -0
- package/dist/ripple/p-a8c489cb.system.entry.js +1 -0
- package/dist/ripple/p-abbfcf28.entry.js +1 -0
- package/dist/ripple/p-bae0a8a9.entry.js +1 -0
- package/dist/ripple/p-bbaab9b6.entry.js +1 -0
- package/dist/ripple/p-bf63bb07.js +16 -0
- package/dist/ripple/p-c07ead2a.system.entry.js +1 -0
- package/dist/ripple/{p-261ea633.system.entry.js → p-c19298a5.system.entry.js} +1 -1
- package/dist/ripple/p-cc49e5a7.system.js +1 -0
- package/dist/ripple/p-cc4fa5ac.entry.js +1 -0
- package/dist/ripple/{p-71bb4f49.system.entry.js → p-cf04a67d.system.entry.js} +1 -1
- package/dist/ripple/p-d0478903.entry.js +1 -0
- package/dist/ripple/p-d0674295.system.entry.js +1 -0
- package/dist/ripple/{p-18af6ca6.system.entry.js → p-e218688f.system.entry.js} +1 -1
- package/dist/ripple/{p-7a9aac92.system.entry.js → p-e758db14.system.entry.js} +1 -1
- package/dist/ripple/{p-1ec7130b.system.entry.js → p-e961c483.system.entry.js} +1 -1
- package/dist/ripple/p-e9770d99.system.entry.js +1 -0
- package/dist/ripple/p-eaa9cebd.entry.js +1 -0
- package/dist/ripple/p-ef344252.entry.js +1 -0
- package/dist/ripple/p-f97f1a13.system.entry.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +48 -48
- package/dist/types/components/wm-button/wm-button.d.ts +43 -43
- package/dist/types/components/wm-chart/priv-chart-popover/priv-chart-popover.d.ts +23 -23
- package/dist/types/components/wm-chart/wm-chart-slice.d.ts +11 -11
- package/dist/types/components/wm-chart/wm-chart.d.ts +82 -82
- 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-input/wm-input.d.ts +46 -46
- package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +34 -34
- package/dist/types/components/wm-modal/wm-modal-footer.d.ts +15 -15
- package/dist/types/components/wm-modal/wm-modal-header.d.ts +12 -12
- package/dist/types/components/wm-modal/wm-modal.d.ts +41 -41
- package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +21 -20
- package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +11 -11
- package/dist/types/components/wm-navigation/wm-navigation.d.ts +29 -28
- 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 +32 -32
- package/dist/types/components/wm-pagination/wm-pagination.d.ts +32 -32
- package/dist/types/components/wm-search/wm-search.d.ts +86 -86
- package/dist/types/components/wm-select/wm-select.d.ts +66 -66
- package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +35 -35
- package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +38 -38
- package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +53 -53
- 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.d.ts +92 -92
- package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +61 -61
- package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +27 -27
- 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 +80 -80
- package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +7 -7
- package/dist/types/components.d.ts +25 -24
- package/dist/types/global/__mocks__/functions.d.ts +6 -6
- package/dist/types/global/functions.d.ts +42 -42
- package/dist/types/global/global.d.ts +1 -1
- package/dist/types/global/interfaces.d.ts +34 -34
- 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/dist/types/stencil-public-runtime.d.ts +6 -4
- package/package.json +47 -47
- package/dist/esm-es5/functions-7eebdc16.js +0 -15
- package/dist/esm-es5/index-66f8130e.js +0 -1
- package/dist/ripple/p-00e0bf57.system.js +0 -1
- package/dist/ripple/p-061a0f47.entry.js +0 -1
- package/dist/ripple/p-0b345e33.system.entry.js +0 -1
- package/dist/ripple/p-0b746618.entry.js +0 -1
- package/dist/ripple/p-0c58f50d.entry.js +0 -1
- package/dist/ripple/p-0d8bd4ee.entry.js +0 -1
- package/dist/ripple/p-0f8d7b58.system.entry.js +0 -1
- package/dist/ripple/p-119a14c1.entry.js +0 -1
- package/dist/ripple/p-312f22ca.entry.js +0 -1
- package/dist/ripple/p-37907055.entry.js +0 -1
- package/dist/ripple/p-3c592c3b.entry.js +0 -1
- package/dist/ripple/p-48b385e6.entry.js +0 -1
- package/dist/ripple/p-501404ff.entry.js +0 -1
- package/dist/ripple/p-593e891e.entry.js +0 -1
- package/dist/ripple/p-5a08d74b.entry.js +0 -1
- package/dist/ripple/p-5a87e7d6.entry.js +0 -1
- package/dist/ripple/p-62a0f6a4.system.entry.js +0 -1
- package/dist/ripple/p-7093d32b.entry.js +0 -1
- package/dist/ripple/p-716fd2fa.system.entry.js +0 -1
- package/dist/ripple/p-7fc8d607.system.entry.js +0 -1
- package/dist/ripple/p-820a1198.entry.js +0 -1
- package/dist/ripple/p-8b0eb05e.entry.js +0 -1
- package/dist/ripple/p-8bc0b663.system.entry.js +0 -1
- package/dist/ripple/p-99548d58.system.js +0 -1
- package/dist/ripple/p-99db8501.entry.js +0 -1
- package/dist/ripple/p-9b8f993d.entry.js +0 -1
- package/dist/ripple/p-9baa3039.js +0 -1
- package/dist/ripple/p-9d02957d.system.js +0 -1
- package/dist/ripple/p-a59094c9.system.entry.js +0 -1
- package/dist/ripple/p-a59713ca.entry.js +0 -1
- package/dist/ripple/p-a7e0ab85.entry.js +0 -1
- package/dist/ripple/p-c34de6f3.system.entry.js +0 -1
- package/dist/ripple/p-c3615fa0.system.entry.js +0 -1
- package/dist/ripple/p-c45caf33.system.entry.js +0 -1
- package/dist/ripple/p-c68975d3.entry.js +0 -1
- package/dist/ripple/p-ca21ca3a.js +0 -16
- package/dist/ripple/p-cb283dba.system.entry.js +0 -1
- package/dist/ripple/p-ceabb993.entry.js +0 -1
- package/dist/ripple/p-d044fcf4.system.js +0 -15
- package/dist/ripple/p-d0643c9b.entry.js +0 -1
- package/dist/ripple/p-de09f545.system.entry.js +0 -1
- package/dist/ripple/p-e639b06c.system.entry.js +0 -1
- package/dist/ripple/p-eb0c2d8f.system.entry.js +0 -1
- package/dist/ripple/p-f4fcd826.entry.js +0 -1
- package/dist/ripple/p-f927e5da.entry.js +0 -1
- package/dist/ripple/p-ffc746cb.entry.js +0 -1
|
@@ -397,6 +397,12 @@ const en = {
|
|
|
397
397
|
type: 0,
|
|
398
398
|
value: "next"
|
|
399
399
|
}
|
|
400
|
+
],
|
|
401
|
+
"global.openVerb": [
|
|
402
|
+
{
|
|
403
|
+
type: 0,
|
|
404
|
+
value: "Open"
|
|
405
|
+
}
|
|
400
406
|
],
|
|
401
407
|
"global.previous": [
|
|
402
408
|
{
|
|
@@ -421,6 +427,18 @@ const en = {
|
|
|
421
427
|
type: 0,
|
|
422
428
|
value: "Please enter a valid number."
|
|
423
429
|
}
|
|
430
|
+
],
|
|
431
|
+
"navigation.mainNavigation": [
|
|
432
|
+
{
|
|
433
|
+
type: 0,
|
|
434
|
+
value: "Main navigation"
|
|
435
|
+
}
|
|
436
|
+
],
|
|
437
|
+
"navigation.showNavigation": [
|
|
438
|
+
{
|
|
439
|
+
type: 0,
|
|
440
|
+
value: "Show navigation"
|
|
441
|
+
}
|
|
424
442
|
],
|
|
425
443
|
"navigator.WatermarkAppNavigation": [
|
|
426
444
|
{
|
|
@@ -3035,6 +3053,12 @@ const pig = {
|
|
|
3035
3053
|
type: 0,
|
|
3036
3054
|
value: "extnay"
|
|
3037
3055
|
}
|
|
3056
|
+
],
|
|
3057
|
+
"global.openVerb": [
|
|
3058
|
+
{
|
|
3059
|
+
type: 0,
|
|
3060
|
+
value: "Openyay"
|
|
3061
|
+
}
|
|
3038
3062
|
],
|
|
3039
3063
|
"global.previous": [
|
|
3040
3064
|
{
|
|
@@ -3059,6 +3083,18 @@ const pig = {
|
|
|
3059
3083
|
type: 0,
|
|
3060
3084
|
value: "Easeplay enteryay ayay alidvay umbernay."
|
|
3061
3085
|
}
|
|
3086
|
+
],
|
|
3087
|
+
"navigation.mainNavigation": [
|
|
3088
|
+
{
|
|
3089
|
+
type: 0,
|
|
3090
|
+
value: "Ainmay avigationnay"
|
|
3091
|
+
}
|
|
3092
|
+
],
|
|
3093
|
+
"navigation.showNavigation": [
|
|
3094
|
+
{
|
|
3095
|
+
type: 0,
|
|
3096
|
+
value: "Owshay avigationnay"
|
|
3097
|
+
}
|
|
3062
3098
|
],
|
|
3063
3099
|
"navigator.WatermarkAppNavigation": [
|
|
3064
3100
|
{
|
|
@@ -3880,11 +3916,17 @@ function icuUnitToEcma(unit) {
|
|
|
3880
3916
|
return unit.replace(/^(.*?)-/, '');
|
|
3881
3917
|
}
|
|
3882
3918
|
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
3883
|
-
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g;
|
|
3919
|
+
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
3884
3920
|
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
3885
3921
|
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
3886
3922
|
function parseSignificantPrecision(str) {
|
|
3887
3923
|
var result = {};
|
|
3924
|
+
if (str[str.length - 1] === 'r') {
|
|
3925
|
+
result.roundingPriority = 'morePrecision';
|
|
3926
|
+
}
|
|
3927
|
+
else if (str[str.length - 1] === 's') {
|
|
3928
|
+
result.roundingPriority = 'lessPrecision';
|
|
3929
|
+
}
|
|
3888
3930
|
str.replace(SIGNIFICANT_PRECISION_REGEX, function (_, g1, g2) {
|
|
3889
3931
|
// @@@ case
|
|
3890
3932
|
if (typeof g2 !== 'string') {
|
|
@@ -4111,8 +4153,13 @@ function parseNumberSkeleton(tokens) {
|
|
|
4111
4153
|
}
|
|
4112
4154
|
return '';
|
|
4113
4155
|
});
|
|
4114
|
-
|
|
4115
|
-
|
|
4156
|
+
var opt = token.options[0];
|
|
4157
|
+
// https://unicode-org.github.io/icu/userguide/format_parse/numbers/skeletons.html#trailing-zero-display
|
|
4158
|
+
if (opt === 'w') {
|
|
4159
|
+
result = __assign(__assign({}, result), { trailingZeroDisplay: 'stripIfInteger' });
|
|
4160
|
+
}
|
|
4161
|
+
else if (opt) {
|
|
4162
|
+
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
|
|
4116
4163
|
}
|
|
4117
4164
|
continue;
|
|
4118
4165
|
}
|
|
@@ -4134,8 +4181,8 @@ function parseNumberSkeleton(tokens) {
|
|
|
4134
4181
|
}
|
|
4135
4182
|
|
|
4136
4183
|
var _a;
|
|
4137
|
-
var SPACE_SEPARATOR_START_REGEX = new RegExp("^"
|
|
4138
|
-
var SPACE_SEPARATOR_END_REGEX = new RegExp(SPACE_SEPARATOR_REGEX.source
|
|
4184
|
+
var SPACE_SEPARATOR_START_REGEX = new RegExp("^".concat(SPACE_SEPARATOR_REGEX.source, "*"));
|
|
4185
|
+
var SPACE_SEPARATOR_END_REGEX = new RegExp("".concat(SPACE_SEPARATOR_REGEX.source, "*$"));
|
|
4139
4186
|
function createLocation(start, end) {
|
|
4140
4187
|
return { start: start, end: end };
|
|
4141
4188
|
}
|
|
@@ -4382,7 +4429,7 @@ var Parser = /** @class */ (function () {
|
|
|
4382
4429
|
return {
|
|
4383
4430
|
val: {
|
|
4384
4431
|
type: TYPE.literal,
|
|
4385
|
-
value: "<"
|
|
4432
|
+
value: "<".concat(tagName, "/>"),
|
|
4386
4433
|
location: createLocation(startPosition, this.clonePosition()),
|
|
4387
4434
|
},
|
|
4388
4435
|
err: null,
|
|
@@ -4987,7 +5034,7 @@ var Parser = /** @class */ (function () {
|
|
|
4987
5034
|
}
|
|
4988
5035
|
var code = codePointAt(this.message, offset);
|
|
4989
5036
|
if (code === undefined) {
|
|
4990
|
-
throw Error("Offset "
|
|
5037
|
+
throw Error("Offset ".concat(offset, " is at invalid UTF-16 code unit boundary"));
|
|
4991
5038
|
}
|
|
4992
5039
|
return code;
|
|
4993
5040
|
};
|
|
@@ -5055,7 +5102,7 @@ var Parser = /** @class */ (function () {
|
|
|
5055
5102
|
*/
|
|
5056
5103
|
Parser.prototype.bumpTo = function (targetOffset) {
|
|
5057
5104
|
if (this.offset() > targetOffset) {
|
|
5058
|
-
throw Error("targetOffset "
|
|
5105
|
+
throw Error("targetOffset ".concat(targetOffset, " must be greater than or equal to the current offset ").concat(this.offset()));
|
|
5059
5106
|
}
|
|
5060
5107
|
targetOffset = Math.min(targetOffset, this.message.length);
|
|
5061
5108
|
while (true) {
|
|
@@ -5064,7 +5111,7 @@ var Parser = /** @class */ (function () {
|
|
|
5064
5111
|
break;
|
|
5065
5112
|
}
|
|
5066
5113
|
if (offset > targetOffset) {
|
|
5067
|
-
throw Error("targetOffset "
|
|
5114
|
+
throw Error("targetOffset ".concat(targetOffset, " is at invalid UTF-16 code unit boundary"));
|
|
5068
5115
|
}
|
|
5069
5116
|
this.bump();
|
|
5070
5117
|
if (this.isEOF()) {
|
|
@@ -5530,28 +5577,28 @@ var FormatError = /** @class */ (function (_super) {
|
|
|
5530
5577
|
return _this;
|
|
5531
5578
|
}
|
|
5532
5579
|
FormatError.prototype.toString = function () {
|
|
5533
|
-
return "[formatjs Error: "
|
|
5580
|
+
return "[formatjs Error: ".concat(this.code, "] ").concat(this.message);
|
|
5534
5581
|
};
|
|
5535
5582
|
return FormatError;
|
|
5536
5583
|
}(Error));
|
|
5537
5584
|
var InvalidValueError = /** @class */ (function (_super) {
|
|
5538
5585
|
__extends(InvalidValueError, _super);
|
|
5539
5586
|
function InvalidValueError(variableId, value, options, originalMessage) {
|
|
5540
|
-
return _super.call(this, "Invalid values for \""
|
|
5587
|
+
return _super.call(this, "Invalid values for \"".concat(variableId, "\": \"").concat(value, "\". Options are \"").concat(Object.keys(options).join('", "'), "\""), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
5541
5588
|
}
|
|
5542
5589
|
return InvalidValueError;
|
|
5543
5590
|
}(FormatError));
|
|
5544
5591
|
var InvalidValueTypeError = /** @class */ (function (_super) {
|
|
5545
5592
|
__extends(InvalidValueTypeError, _super);
|
|
5546
5593
|
function InvalidValueTypeError(value, type, originalMessage) {
|
|
5547
|
-
return _super.call(this, "Value for \""
|
|
5594
|
+
return _super.call(this, "Value for \"".concat(value, "\" must be of type ").concat(type), ErrorCode.INVALID_VALUE, originalMessage) || this;
|
|
5548
5595
|
}
|
|
5549
5596
|
return InvalidValueTypeError;
|
|
5550
5597
|
}(FormatError));
|
|
5551
5598
|
var MissingValueError = /** @class */ (function (_super) {
|
|
5552
5599
|
__extends(MissingValueError, _super);
|
|
5553
5600
|
function MissingValueError(variableId, originalMessage) {
|
|
5554
|
-
return _super.call(this, "The intl string context variable \""
|
|
5601
|
+
return _super.call(this, "The intl string context variable \"".concat(variableId, "\" was not provided to the string \"").concat(originalMessage, "\""), ErrorCode.MISSING_VALUE, originalMessage) || this;
|
|
5555
5602
|
}
|
|
5556
5603
|
return MissingValueError;
|
|
5557
5604
|
}(FormatError));
|
|
@@ -5712,7 +5759,7 @@ originalMessage) {
|
|
|
5712
5759
|
continue;
|
|
5713
5760
|
}
|
|
5714
5761
|
if (isPluralElement(el)) {
|
|
5715
|
-
var opt = el.options["="
|
|
5762
|
+
var opt = el.options["=".concat(value)];
|
|
5716
5763
|
if (!opt) {
|
|
5717
5764
|
if (!Intl.PluralRules) {
|
|
5718
5765
|
throw new FormatError("Intl.PluralRules is not available in this environment.\nTry polyfilling it using \"@formatjs/intl-pluralrules\"\n", ErrorCode.MISSING_INTL_API, originalMessage);
|
|
@@ -5783,7 +5830,7 @@ function createDefaultFormatters(cache) {
|
|
|
5783
5830
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5784
5831
|
args[_i] = arguments[_i];
|
|
5785
5832
|
}
|
|
5786
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5833
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5787
5834
|
}, {
|
|
5788
5835
|
cache: createFastMemoizeCache$1(cache.number),
|
|
5789
5836
|
strategy: strategies.variadic,
|
|
@@ -5794,7 +5841,7 @@ function createDefaultFormatters(cache) {
|
|
|
5794
5841
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5795
5842
|
args[_i] = arguments[_i];
|
|
5796
5843
|
}
|
|
5797
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5844
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5798
5845
|
}, {
|
|
5799
5846
|
cache: createFastMemoizeCache$1(cache.dateTime),
|
|
5800
5847
|
strategy: strategies.variadic,
|
|
@@ -5805,7 +5852,7 @@ function createDefaultFormatters(cache) {
|
|
|
5805
5852
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
5806
5853
|
args[_i] = arguments[_i];
|
|
5807
5854
|
}
|
|
5808
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
5855
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
5809
5856
|
}, {
|
|
5810
5857
|
cache: createFastMemoizeCache$1(cache.pluralRules),
|
|
5811
5858
|
strategy: strategies.variadic,
|
|
@@ -5963,7 +6010,13 @@ var IntlErrorCode;
|
|
|
5963
6010
|
var IntlError = /** @class */ (function (_super) {
|
|
5964
6011
|
__extends(IntlError, _super);
|
|
5965
6012
|
function IntlError(code, message, exception) {
|
|
5966
|
-
var _this =
|
|
6013
|
+
var _this = this;
|
|
6014
|
+
var err = exception
|
|
6015
|
+
? exception instanceof Error
|
|
6016
|
+
? exception
|
|
6017
|
+
: new Error(String(exception))
|
|
6018
|
+
: undefined;
|
|
6019
|
+
_this = _super.call(this, "[@formatjs/intl Error ".concat(code, "] ").concat(message, " \n").concat(err ? "\n".concat(err.message, "\n").concat(err.stack) : '')) || this;
|
|
5967
6020
|
_this.code = code;
|
|
5968
6021
|
// @ts-ignore just so we don't need to declare dep on @types/node
|
|
5969
6022
|
if (typeof Error.captureStackTrace === 'function') {
|
|
@@ -5995,19 +6048,26 @@ var MissingDataError = /** @class */ (function (_super) {
|
|
|
5995
6048
|
}
|
|
5996
6049
|
return MissingDataError;
|
|
5997
6050
|
}(IntlError));
|
|
6051
|
+
var IntlFormatError = /** @class */ (function (_super) {
|
|
6052
|
+
__extends(IntlFormatError, _super);
|
|
6053
|
+
function IntlFormatError(message, locale, exception) {
|
|
6054
|
+
return _super.call(this, IntlErrorCode.FORMAT_ERROR, "".concat(message, " \nLocale: ").concat(locale, "\n"), exception) || this;
|
|
6055
|
+
}
|
|
6056
|
+
return IntlFormatError;
|
|
6057
|
+
}(IntlError));
|
|
5998
6058
|
var MessageFormatError = /** @class */ (function (_super) {
|
|
5999
6059
|
__extends(MessageFormatError, _super);
|
|
6000
6060
|
function MessageFormatError(message, locale, descriptor, exception) {
|
|
6001
|
-
var _this = _super.call(this,
|
|
6061
|
+
var _this = _super.call(this, "".concat(message, " \nMessageID: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.id, "\nDefault Message: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage, "\nDescription: ").concat(descriptor === null || descriptor === void 0 ? void 0 : descriptor.description, " \n"), locale, exception) || this;
|
|
6002
6062
|
_this.descriptor = descriptor;
|
|
6003
6063
|
return _this;
|
|
6004
6064
|
}
|
|
6005
6065
|
return MessageFormatError;
|
|
6006
|
-
}(
|
|
6066
|
+
}(IntlFormatError));
|
|
6007
6067
|
var MissingTranslationError = /** @class */ (function (_super) {
|
|
6008
6068
|
__extends(MissingTranslationError, _super);
|
|
6009
6069
|
function MissingTranslationError(descriptor, locale) {
|
|
6010
|
-
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \""
|
|
6070
|
+
var _this = _super.call(this, IntlErrorCode.MISSING_TRANSLATION, "Missing message: \"".concat(descriptor.id, "\" for locale \"").concat(locale, "\", using ").concat(descriptor.defaultMessage ? 'default message' : 'id', " as fallback.")) || this;
|
|
6011
6071
|
_this.descriptor = descriptor;
|
|
6012
6072
|
return _this;
|
|
6013
6073
|
}
|
|
@@ -6034,6 +6094,7 @@ var DEFAULT_INTL_CONFIG = {
|
|
|
6034
6094
|
timeZone: undefined,
|
|
6035
6095
|
defaultLocale: 'en',
|
|
6036
6096
|
defaultFormats: {},
|
|
6097
|
+
fallbackOnEmptyString: true,
|
|
6037
6098
|
onError: defaultErrorHandler,
|
|
6038
6099
|
};
|
|
6039
6100
|
function createIntlCache() {
|
|
@@ -6076,7 +6137,7 @@ function createFormatters(cache) {
|
|
|
6076
6137
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6077
6138
|
args[_i] = arguments[_i];
|
|
6078
6139
|
}
|
|
6079
|
-
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6140
|
+
return new ((_a = Intl.DateTimeFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6080
6141
|
}, {
|
|
6081
6142
|
cache: createFastMemoizeCache(cache.dateTime),
|
|
6082
6143
|
strategy: strategies.variadic,
|
|
@@ -6087,7 +6148,7 @@ function createFormatters(cache) {
|
|
|
6087
6148
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6088
6149
|
args[_i] = arguments[_i];
|
|
6089
6150
|
}
|
|
6090
|
-
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6151
|
+
return new ((_a = Intl.NumberFormat).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6091
6152
|
}, {
|
|
6092
6153
|
cache: createFastMemoizeCache(cache.number),
|
|
6093
6154
|
strategy: strategies.variadic,
|
|
@@ -6098,7 +6159,7 @@ function createFormatters(cache) {
|
|
|
6098
6159
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6099
6160
|
args[_i] = arguments[_i];
|
|
6100
6161
|
}
|
|
6101
|
-
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args)))();
|
|
6162
|
+
return new ((_a = Intl.PluralRules).bind.apply(_a, __spreadArray([void 0], args, false)))();
|
|
6102
6163
|
}, {
|
|
6103
6164
|
cache: createFastMemoizeCache(cache.pluralRules),
|
|
6104
6165
|
strategy: strategies.variadic,
|
|
@@ -6121,7 +6182,7 @@ function createFormatters(cache) {
|
|
|
6121
6182
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6122
6183
|
args[_i] = arguments[_i];
|
|
6123
6184
|
}
|
|
6124
|
-
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args)))();
|
|
6185
|
+
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args, false)))();
|
|
6125
6186
|
}, {
|
|
6126
6187
|
cache: createFastMemoizeCache(cache.relativeTime),
|
|
6127
6188
|
strategy: strategies.variadic,
|
|
@@ -6132,7 +6193,7 @@ function createFormatters(cache) {
|
|
|
6132
6193
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6133
6194
|
args[_i] = arguments[_i];
|
|
6134
6195
|
}
|
|
6135
|
-
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args)))();
|
|
6196
|
+
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args, false)))();
|
|
6136
6197
|
}, {
|
|
6137
6198
|
cache: createFastMemoizeCache(cache.list),
|
|
6138
6199
|
strategy: strategies.variadic,
|
|
@@ -6142,7 +6203,7 @@ function createFormatters(cache) {
|
|
|
6142
6203
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
6143
6204
|
args[_i] = arguments[_i];
|
|
6144
6205
|
}
|
|
6145
|
-
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args)))();
|
|
6206
|
+
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args, false)))();
|
|
6146
6207
|
}, {
|
|
6147
6208
|
cache: createFastMemoizeCache(cache.displayNames),
|
|
6148
6209
|
strategy: strategies.variadic,
|
|
@@ -6158,7 +6219,7 @@ function getNamedFormat(formats, type, name, onError) {
|
|
|
6158
6219
|
if (format) {
|
|
6159
6220
|
return format;
|
|
6160
6221
|
}
|
|
6161
|
-
onError(new UnsupportedFormatterError("No "
|
|
6222
|
+
onError(new UnsupportedFormatterError("No ".concat(type, " format named: ").concat(name)));
|
|
6162
6223
|
}
|
|
6163
6224
|
|
|
6164
6225
|
/**
|
|
@@ -6193,7 +6254,7 @@ function deepMergeFormatsAndSetTimeZone(f1, timeZone) {
|
|
|
6193
6254
|
return __assign(__assign(__assign({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });
|
|
6194
6255
|
}
|
|
6195
6256
|
function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
6196
|
-
var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
|
|
6257
|
+
var locale = _a.locale, formats = _a.formats, messages = _a.messages, defaultLocale = _a.defaultLocale, defaultFormats = _a.defaultFormats, fallbackOnEmptyString = _a.fallbackOnEmptyString, onError = _a.onError, timeZone = _a.timeZone, defaultRichTextElements = _a.defaultRichTextElements;
|
|
6197
6258
|
if (messageDescriptor === void 0) { messageDescriptor = { id: '' }; }
|
|
6198
6259
|
var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;
|
|
6199
6260
|
// `id` is a required field of a Message Descriptor.
|
|
@@ -6223,6 +6284,9 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6223
6284
|
formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);
|
|
6224
6285
|
defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);
|
|
6225
6286
|
if (!message) {
|
|
6287
|
+
if (fallbackOnEmptyString === false && message === '') {
|
|
6288
|
+
return message;
|
|
6289
|
+
}
|
|
6226
6290
|
if (!defaultMessage ||
|
|
6227
6291
|
(locale && locale.toLowerCase() !== defaultLocale.toLowerCase())) {
|
|
6228
6292
|
// This prevents warnings from littering the console in development
|
|
@@ -6236,7 +6300,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6236
6300
|
return formatter.format(values);
|
|
6237
6301
|
}
|
|
6238
6302
|
catch (e) {
|
|
6239
|
-
onError(new MessageFormatError("Error formatting default message for: \""
|
|
6303
|
+
onError(new MessageFormatError("Error formatting default message for: \"".concat(id, "\", rendering default message verbatim"), locale, messageDescriptor, e));
|
|
6240
6304
|
return typeof defaultMessage === 'string' ? defaultMessage : id;
|
|
6241
6305
|
}
|
|
6242
6306
|
}
|
|
@@ -6248,7 +6312,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6248
6312
|
return formatter.format(values);
|
|
6249
6313
|
}
|
|
6250
6314
|
catch (e) {
|
|
6251
|
-
onError(new MessageFormatError("Error formatting message: \""
|
|
6315
|
+
onError(new MessageFormatError("Error formatting message: \"".concat(id, "\", using ").concat(defaultMessage ? 'default message' : 'id', " as fallback."), locale, messageDescriptor, e));
|
|
6252
6316
|
}
|
|
6253
6317
|
if (defaultMessage) {
|
|
6254
6318
|
try {
|
|
@@ -6256,7 +6320,7 @@ function formatMessage(_a, state, messageDescriptor, values, opts) {
|
|
|
6256
6320
|
return formatter.format(values);
|
|
6257
6321
|
}
|
|
6258
6322
|
catch (e) {
|
|
6259
|
-
onError(new MessageFormatError("Error formatting the default message for: \""
|
|
6323
|
+
onError(new MessageFormatError("Error formatting the default message for: \"".concat(id, "\", rendering message verbatim"), locale, messageDescriptor, e));
|
|
6260
6324
|
}
|
|
6261
6325
|
}
|
|
6262
6326
|
if (typeof message === 'string') {
|
|
@@ -6294,9 +6358,7 @@ function getFormatter$2(_a, type, getDateTimeFormat, options) {
|
|
|
6294
6358
|
if (options === void 0) { options = {}; }
|
|
6295
6359
|
var format = options.format;
|
|
6296
6360
|
var defaults = __assign(__assign({}, (timeZone && { timeZone: timeZone })), (format && getNamedFormat(formats, type, format, onError)));
|
|
6297
|
-
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS,
|
|
6298
|
-
// @ts-expect-error es2020 has a lot stuff from es2021 bleed in
|
|
6299
|
-
defaults);
|
|
6361
|
+
var filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults);
|
|
6300
6362
|
if (type === 'time' &&
|
|
6301
6363
|
!filteredOptions.hour &&
|
|
6302
6364
|
!filteredOptions.minute &&
|
|
@@ -6413,7 +6475,7 @@ var LIST_FORMAT_OPTIONS = [
|
|
|
6413
6475
|
];
|
|
6414
6476
|
var now = Date.now();
|
|
6415
6477
|
function generateToken(i) {
|
|
6416
|
-
return now
|
|
6478
|
+
return "".concat(now, "_").concat(i, "_").concat(now);
|
|
6417
6479
|
}
|
|
6418
6480
|
function formatList(opts, getListFormat, values, options) {
|
|
6419
6481
|
if (options === void 0) { options = {}; }
|
|
@@ -6480,7 +6542,7 @@ function formatPlural(_a, getPluralRules, value, options) {
|
|
|
6480
6542
|
return getPluralRules(locale, filteredOptions).select(value);
|
|
6481
6543
|
}
|
|
6482
6544
|
catch (e) {
|
|
6483
|
-
onError(new
|
|
6545
|
+
onError(new IntlFormatError('Error formatting plural.', locale, e));
|
|
6484
6546
|
}
|
|
6485
6547
|
return 'other';
|
|
6486
6548
|
}
|
|
@@ -6507,7 +6569,7 @@ function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options)
|
|
|
6507
6569
|
return getFormatter$1(config, getRelativeTimeFormat, options).format(value, unit);
|
|
6508
6570
|
}
|
|
6509
6571
|
catch (e) {
|
|
6510
|
-
config.onError(new
|
|
6572
|
+
config.onError(new IntlFormatError('Error formatting relative time.', config.locale, e));
|
|
6511
6573
|
}
|
|
6512
6574
|
return String(value);
|
|
6513
6575
|
}
|
|
@@ -6587,7 +6649,7 @@ function createIntl(config, cache) {
|
|
|
6587
6649
|
var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
|
|
6588
6650
|
if (!locale) {
|
|
6589
6651
|
if (onError) {
|
|
6590
|
-
onError(new InvalidConfigError("\"locale\" was not configured, using \""
|
|
6652
|
+
onError(new InvalidConfigError("\"locale\" was not configured, using \"".concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details")));
|
|
6591
6653
|
}
|
|
6592
6654
|
// Since there's no registered locale data for `locale`, this will
|
|
6593
6655
|
// fallback to the `defaultLocale` to make sure things can render.
|
|
@@ -6597,481 +6659,481 @@ function createIntl(config, cache) {
|
|
|
6597
6659
|
resolvedConfig.locale = resolvedConfig.defaultLocale || 'en';
|
|
6598
6660
|
}
|
|
6599
6661
|
else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {
|
|
6600
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
6662
|
+
onError(new MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.NumberFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
6601
6663
|
}
|
|
6602
6664
|
else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length &&
|
|
6603
6665
|
onError) {
|
|
6604
|
-
onError(new MissingDataError("Missing locale data for locale: \""
|
|
6666
|
+
onError(new MissingDataError("Missing locale data for locale: \"".concat(locale, "\" in Intl.DateTimeFormat. Using default locale: \"").concat(defaultLocale, "\" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details")));
|
|
6605
6667
|
}
|
|
6606
6668
|
verifyConfigMessages(resolvedConfig);
|
|
6607
6669
|
return __assign(__assign({}, resolvedConfig), { formatters: formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
|
|
6608
6670
|
}
|
|
6609
6671
|
|
|
6610
|
-
const DEFAULT_LANGUAGE = "en";
|
|
6611
|
-
function getBrowserLang() {
|
|
6612
|
-
const langAttr = document.documentElement.getAttribute("lang");
|
|
6613
|
-
if (!!langAttr) {
|
|
6614
|
-
return langAttr;
|
|
6615
|
-
}
|
|
6616
|
-
else if (window.navigator && window.navigator.language) {
|
|
6617
|
-
const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
|
|
6618
|
-
return lang.slice(0, 2);
|
|
6619
|
-
}
|
|
6620
|
-
else {
|
|
6621
|
-
return DEFAULT_LANGUAGE;
|
|
6622
|
-
}
|
|
6623
|
-
}
|
|
6624
|
-
// prevents memory leak
|
|
6625
|
-
const cache = createIntlCache();
|
|
6626
|
-
const locale = getBrowserLang();
|
|
6627
|
-
const intl = createIntl({
|
|
6628
|
-
locale: locale,
|
|
6629
|
-
defaultLocale: "en",
|
|
6630
|
-
messages: lang[locale] || en,
|
|
6631
|
-
}, cache);
|
|
6632
|
-
function generateId() {
|
|
6633
|
-
return "wmcl-" + Math.random().toString(36).substr(2, 10);
|
|
6634
|
-
}
|
|
6635
|
-
// limits how many times a function fires
|
|
6636
|
-
// use when the function should run periodically, but not too often (e.g. window resize)
|
|
6637
|
-
function throttle(fn, wait) {
|
|
6638
|
-
let timeout;
|
|
6639
|
-
let shouldWait = false;
|
|
6640
|
-
return function () {
|
|
6641
|
-
const context = this;
|
|
6642
|
-
if (!shouldWait) {
|
|
6643
|
-
fn.apply(context, arguments);
|
|
6644
|
-
shouldWait = true;
|
|
6645
|
-
clearTimeout(timeout);
|
|
6646
|
-
timeout = setTimeout(function () {
|
|
6647
|
-
shouldWait = false;
|
|
6648
|
-
}, wait);
|
|
6649
|
-
}
|
|
6650
|
-
};
|
|
6651
|
-
}
|
|
6652
|
-
// waits until it hasn't been called for [timeout] ms.
|
|
6653
|
-
// use when the function should run only after something (event) is done firing
|
|
6654
|
-
function debounce(fn, wait) {
|
|
6655
|
-
let timeout;
|
|
6656
|
-
return function () {
|
|
6657
|
-
const context = this;
|
|
6658
|
-
const functionCall = () => fn.apply(context, arguments);
|
|
6659
|
-
clearTimeout(timeout);
|
|
6660
|
-
timeout = setTimeout(functionCall, wait);
|
|
6661
|
-
};
|
|
6662
|
-
}
|
|
6663
|
-
function getTextDir() {
|
|
6664
|
-
const dir = document.querySelector("html").getAttribute("dir");
|
|
6665
|
-
return dir ? dir.toLowerCase() : "";
|
|
6666
|
-
}
|
|
6667
|
-
function getPosition(el) {
|
|
6668
|
-
const coords = el.getBoundingClientRect();
|
|
6669
|
-
let x = coords.x;
|
|
6670
|
-
let y = coords.y;
|
|
6671
|
-
// Edge doesn't have x and y
|
|
6672
|
-
if (!x) {
|
|
6673
|
-
if (getTextDir() === "rtl") {
|
|
6674
|
-
x = coords.right;
|
|
6675
|
-
}
|
|
6676
|
-
else {
|
|
6677
|
-
x = coords.left;
|
|
6678
|
-
}
|
|
6679
|
-
y = coords.top;
|
|
6680
|
-
}
|
|
6681
|
-
return { x, y };
|
|
6682
|
-
}
|
|
6683
|
-
function findParentWithScrollbar(el) {
|
|
6684
|
-
while (!!el) {
|
|
6685
|
-
if (el.scrollHeight > el.clientHeight && ["scroll", "auto"].includes(window.getComputedStyle(el).overflowY)) {
|
|
6686
|
-
return el;
|
|
6687
|
-
}
|
|
6688
|
-
el = el.parentElement;
|
|
6689
|
-
}
|
|
6690
|
-
}
|
|
6691
|
-
function findParentWithHiddenOverflow(el) {
|
|
6692
|
-
while (!!el) {
|
|
6693
|
-
if (window.getComputedStyle(el).overflowY !== "visible") {
|
|
6694
|
-
return el;
|
|
6695
|
-
}
|
|
6696
|
-
el = el.parentElement;
|
|
6697
|
-
}
|
|
6698
|
-
}
|
|
6699
|
-
function getClosableElementMeasurements(fixedEl, closableEl) {
|
|
6700
|
-
const parent = findParentWithHiddenOverflow(fixedEl);
|
|
6701
|
-
// if parent is not found, measurements are checked against the viewport
|
|
6702
|
-
return {
|
|
6703
|
-
closableElHeight: closableEl.clientHeight,
|
|
6704
|
-
closableElWidth: closableEl.clientWidth,
|
|
6705
|
-
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6706
|
-
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6707
|
-
spaceAbove: parent
|
|
6708
|
-
? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
|
|
6709
|
-
: fixedEl.getBoundingClientRect().top,
|
|
6710
|
-
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6711
|
-
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6712
|
-
spaceBelow: parent
|
|
6713
|
-
? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
|
|
6714
|
-
: document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom,
|
|
6715
|
-
spaceLeft: parent
|
|
6716
|
-
? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
|
|
6717
|
-
: fixedEl.getBoundingClientRect().left,
|
|
6718
|
-
spaceRight: parent
|
|
6719
|
-
? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
|
|
6720
|
-
: document.documentElement.clientWidth - fixedEl.getBoundingClientRect().right,
|
|
6721
|
-
};
|
|
6722
|
-
}
|
|
6723
|
-
function shouldOpenUp(fixedEl, //the element visible on the page when the component is closed
|
|
6724
|
-
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6725
|
-
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6726
|
-
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6727
|
-
) {
|
|
6728
|
-
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6729
|
-
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6730
|
-
const openUp = closableElHeight > spaceBelow + offsetBelow && closableElHeight <= spaceAbove + offsetAbove;
|
|
6731
|
-
return openUp;
|
|
6732
|
-
}
|
|
6733
|
-
function shouldOpenDown(fixedEl, //the element visible on the page when the component is closed
|
|
6734
|
-
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6735
|
-
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6736
|
-
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6737
|
-
) {
|
|
6738
|
-
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6739
|
-
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6740
|
-
const openDown = closableElHeight > spaceAbove + offsetAbove && closableElHeight <= spaceBelow + offsetBelow;
|
|
6741
|
-
return openDown;
|
|
6742
|
-
}
|
|
6743
|
-
function shouldShiftRight(fixedEl, closableEl) {
|
|
6744
|
-
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6745
|
-
const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
|
|
6746
|
-
return needsSpaceLeft;
|
|
6747
|
-
}
|
|
6748
|
-
function shouldShiftLeft(fixedEl, closableEl) {
|
|
6749
|
-
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6750
|
-
const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
|
|
6751
|
-
return needsSpaceRight;
|
|
6752
|
-
}
|
|
6753
|
-
function adjustTooltipPosition(tPos, el, tooltipEl) {
|
|
6754
|
-
// position must be reset before measurements are taken in adjustTooltipPosition
|
|
6755
|
-
// otherwise text-wrapping from previous position makes width measurement inconsistent
|
|
6756
|
-
tooltipEl.style.top = "";
|
|
6757
|
-
tooltipEl.style.left = "";
|
|
6758
|
-
const { spaceLeft, spaceRight, spaceBelow, spaceAbove } = getClosableElementMeasurements(el, tooltipEl);
|
|
6759
|
-
const tooltipWidth = tooltipEl.getBoundingClientRect().width;
|
|
6760
|
-
const tooltipHeight = tooltipEl.getBoundingClientRect().height;
|
|
6761
|
-
const enoughSpaceAbove = spaceAbove > tooltipHeight;
|
|
6762
|
-
const enoughSpaceBelow = spaceBelow > tooltipHeight;
|
|
6763
|
-
// a tooltip should never be closer than 24px to the edge of a screen
|
|
6764
|
-
const enoughSpaceLeft = spaceLeft - 24 > tooltipWidth;
|
|
6765
|
-
const enoughSpaceRight = spaceRight - 24 > tooltipWidth;
|
|
6766
|
-
const swapAbove = (position) => {
|
|
6767
|
-
return !enoughSpaceAbove ? position.replace("top", "bottom") : position;
|
|
6768
|
-
};
|
|
6769
|
-
const swapBelow = (position) => {
|
|
6770
|
-
return !enoughSpaceBelow && enoughSpaceAbove ? position.replace("bottom", "top") : position;
|
|
6771
|
-
};
|
|
6772
|
-
const swapLeft = (position, centeredPosition) => {
|
|
6773
|
-
if (!enoughSpaceLeft && enoughSpaceRight) {
|
|
6774
|
-
position = position.replace("left", "right");
|
|
6775
|
-
}
|
|
6776
|
-
else if (!enoughSpaceLeft && !enoughSpaceRight) {
|
|
6777
|
-
position = centeredPosition;
|
|
6778
|
-
}
|
|
6779
|
-
return position;
|
|
6780
|
-
};
|
|
6781
|
-
const swapRight = (position, centeredPosition) => {
|
|
6782
|
-
if (!enoughSpaceRight && enoughSpaceLeft) {
|
|
6783
|
-
position = position.replace("right", "left");
|
|
6784
|
-
}
|
|
6785
|
-
else if (!enoughSpaceRight && !enoughSpaceLeft) {
|
|
6786
|
-
position = centeredPosition;
|
|
6787
|
-
}
|
|
6788
|
-
return position;
|
|
6789
|
-
};
|
|
6790
|
-
// horizontal checks must occur before vertical checks, because horizontal can affect vertical positioning but not vice versa
|
|
6791
|
-
switch (tPos) {
|
|
6792
|
-
case "left":
|
|
6793
|
-
tPos = swapLeft(tPos, "bottom");
|
|
6794
|
-
case "right":
|
|
6795
|
-
tPos = swapRight(tPos, "bottom");
|
|
6796
|
-
case "top-left":
|
|
6797
|
-
tPos = swapLeft(tPos, "top");
|
|
6798
|
-
tPos = swapAbove(tPos);
|
|
6799
|
-
case "top-right":
|
|
6800
|
-
tPos = swapRight(tPos, "top");
|
|
6801
|
-
tPos = swapAbove(tPos);
|
|
6802
|
-
case "bottom-left":
|
|
6803
|
-
tPos = swapLeft(tPos, "bottom");
|
|
6804
|
-
tPos = swapBelow(tPos);
|
|
6805
|
-
case "bottom-right":
|
|
6806
|
-
tPos = swapRight(tPos, "bottom");
|
|
6807
|
-
tPos = swapBelow(tPos);
|
|
6808
|
-
case "top":
|
|
6809
|
-
tPos = swapAbove(tPos);
|
|
6810
|
-
case "bottom":
|
|
6811
|
-
tPos = swapBelow(tPos);
|
|
6812
|
-
}
|
|
6813
|
-
return tPos;
|
|
6814
|
-
}
|
|
6815
|
-
function hasRoomRight(x, spaceNeeded) {
|
|
6816
|
-
let horizOffset = 0;
|
|
6817
|
-
// if (getTextDir() === "ltr") {
|
|
6818
|
-
if (x.type === "click") {
|
|
6819
|
-
// if it's a mouse event, deal with mouse coords
|
|
6820
|
-
horizOffset = x.clientX;
|
|
6821
|
-
// if it's a focus event, the offset is 0
|
|
6822
|
-
}
|
|
6823
|
-
else if (x.type === "focus") {
|
|
6824
|
-
horizOffset = 0;
|
|
6825
|
-
}
|
|
6826
|
-
else {
|
|
6827
|
-
// otherwise an element was passed, calculate how far it is from the edge of the window
|
|
6828
|
-
let el = x; // re-assignment is for clarity
|
|
6829
|
-
while (el) {
|
|
6830
|
-
if (el.tagName == "BODY") {
|
|
6831
|
-
// deal with browser quirks with body/window/document and page scroll
|
|
6832
|
-
var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
|
|
6833
|
-
horizOffset += el.offsetLeft - xScroll + el.clientLeft;
|
|
6834
|
-
}
|
|
6835
|
-
else {
|
|
6836
|
-
// for all other non-BODY elements
|
|
6837
|
-
horizOffset += el.offsetLeft - el.scrollLeft + el.clientLeft;
|
|
6838
|
-
}
|
|
6839
|
-
el = el.offsetParent;
|
|
6840
|
-
}
|
|
6841
|
-
// }
|
|
6842
|
-
}
|
|
6843
|
-
return window.innerWidth - horizOffset >= spaceNeeded;
|
|
6844
|
-
}
|
|
6845
|
-
function checkForActiveElInShadow(element) {
|
|
6846
|
-
while (element && element.shadowRoot) {
|
|
6847
|
-
element = element.shadowRoot.activeElement;
|
|
6848
|
-
}
|
|
6849
|
-
return element;
|
|
6850
|
-
}
|
|
6851
|
-
function checkForFocusableElInShadow(element) {
|
|
6852
|
-
const selectors = [
|
|
6853
|
-
"button",
|
|
6854
|
-
"a",
|
|
6855
|
-
"input",
|
|
6856
|
-
"select",
|
|
6857
|
-
"textarea",
|
|
6858
|
-
"wm-button",
|
|
6859
|
-
"wm-search",
|
|
6860
|
-
"wm-select",
|
|
6861
|
-
"wm-action-menu",
|
|
6862
|
-
"wm-tab-item",
|
|
6863
|
-
"wm-datepicker",
|
|
6864
|
-
];
|
|
6865
|
-
let focusableEl = element;
|
|
6866
|
-
selectors.forEach((selector) => {
|
|
6867
|
-
if (focusableEl && focusableEl.shadowRoot) {
|
|
6868
|
-
let elInShadow = focusableEl.shadowRoot.querySelector(selector);
|
|
6869
|
-
if (elInShadow) {
|
|
6870
|
-
if (selector.startsWith("wm-")) {
|
|
6871
|
-
focusableEl = checkForFocusableElInShadow(elInShadow);
|
|
6872
|
-
}
|
|
6873
|
-
else {
|
|
6874
|
-
focusableEl = elInShadow;
|
|
6875
|
-
}
|
|
6876
|
-
}
|
|
6877
|
-
}
|
|
6878
|
-
});
|
|
6879
|
-
return focusableEl;
|
|
6880
|
-
}
|
|
6881
|
-
function isFocusable(element) {
|
|
6882
|
-
if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
|
|
6883
|
-
return true;
|
|
6884
|
-
}
|
|
6885
|
-
if (element.disabled) {
|
|
6886
|
-
return false;
|
|
6887
|
-
}
|
|
6888
|
-
switch (element.nodeName) {
|
|
6889
|
-
case "A":
|
|
6890
|
-
return !!element.href && element.rel != "ignore";
|
|
6891
|
-
case "INPUT":
|
|
6892
|
-
return element.type != "hidden" && element.type != "file";
|
|
6893
|
-
case "BUTTON":
|
|
6894
|
-
case "SELECT":
|
|
6895
|
-
case "TEXTAREA":
|
|
6896
|
-
case "WM-BUTTON":
|
|
6897
|
-
case "WM-SELECT":
|
|
6898
|
-
case "WM-ACTION-MENU":
|
|
6899
|
-
case "WM-DATEPICKER":
|
|
6900
|
-
case "WM-TIMEPICKER":
|
|
6901
|
-
case "WM-INPUT":
|
|
6902
|
-
case "WM-TAG-INPUT":
|
|
6903
|
-
case "WM-TAB-ITEM":
|
|
6904
|
-
case "WM-SEARCH":
|
|
6905
|
-
return true;
|
|
6906
|
-
default:
|
|
6907
|
-
return false;
|
|
6908
|
-
}
|
|
6909
|
-
}
|
|
6910
|
-
function getFirstFocusableDescendant(element) {
|
|
6911
|
-
if (isFocusable(element)) {
|
|
6912
|
-
return checkForFocusableElInShadow(element);
|
|
6913
|
-
}
|
|
6914
|
-
else if (element.childNodes.length > 0) {
|
|
6915
|
-
element.childNodes.forEach((i) => {
|
|
6916
|
-
const childEl = getFirstFocusableDescendant(i);
|
|
6917
|
-
return childEl && checkForFocusableElInShadow(childEl);
|
|
6918
|
-
});
|
|
6919
|
-
}
|
|
6920
|
-
}
|
|
6921
|
-
function hasValidType(file, types) {
|
|
6922
|
-
const acceptedExtensions = types.split(" ");
|
|
6923
|
-
const parts = file.name && file.name.split(".");
|
|
6924
|
-
const ext = parts && parts.length > 1 && parts[parts.length - 1];
|
|
6925
|
-
return ext
|
|
6926
|
-
? acceptedExtensions.includes(ext.toLowerCase())
|
|
6927
|
-
: // fallback: if we couldn't obtain an extension,
|
|
6928
|
-
// validate based on MIME type...
|
|
6929
|
-
!!file.type
|
|
6930
|
-
? getAcceptedMimeTypesList(acceptedExtensions).includes(file.type)
|
|
6931
|
-
: // ...and if that failed too, accept the file
|
|
6932
|
-
// as it's preferable to accept an invalid file
|
|
6933
|
-
// than refusing a valid one (back-end will take care of what slips through)
|
|
6934
|
-
true;
|
|
6935
|
-
}
|
|
6936
|
-
// takes a string (space separated list of extensions), returns an array of strings (corresponding MIME types)
|
|
6937
|
-
function getAcceptedMimeTypesList(acceptedExtensions) {
|
|
6938
|
-
// this is just a list of common file types (regardless of whether they are/can be valid or not)
|
|
6939
|
-
// front end checks are just a convenience to users, independent of security.
|
|
6940
|
-
// it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
|
|
6941
|
-
const lookupTable = {
|
|
6942
|
-
aac: ["audio/aac"],
|
|
6943
|
-
abw: ["application/x-abiword"],
|
|
6944
|
-
arc: ["application/x-freearc"],
|
|
6945
|
-
avi: ["video/x-msvideo"],
|
|
6946
|
-
azw: ["application/vnd.amazon.ebook"],
|
|
6947
|
-
bin: ["application/octet-stream"],
|
|
6948
|
-
bmp: ["image/bmp"],
|
|
6949
|
-
bz: ["application/x-bzip"],
|
|
6950
|
-
bz2: ["application/x-bzip2"],
|
|
6951
|
-
csh: ["application/x-csh"],
|
|
6952
|
-
css: ["text/css"],
|
|
6953
|
-
csv: ["text/csv"],
|
|
6954
|
-
doc: ["application/msword"],
|
|
6955
|
-
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
6956
|
-
eot: ["application/vnd.ms-fontobject"],
|
|
6957
|
-
epub: ["application/epub+zip"],
|
|
6958
|
-
gz: ["application/gzip"],
|
|
6959
|
-
gif: ["image/gif"],
|
|
6960
|
-
htm: ["text/html"],
|
|
6961
|
-
html: ["text/html"],
|
|
6962
|
-
ico: ["image/vnd.microsoft.icon"],
|
|
6963
|
-
ics: ["text/calendar"],
|
|
6964
|
-
jar: ["application/java-archive"],
|
|
6965
|
-
jpeg: ["image/jpeg"],
|
|
6966
|
-
jpg: ["image/jpeg"],
|
|
6967
|
-
js: ["text/javascript"],
|
|
6968
|
-
json: ["application/json"],
|
|
6969
|
-
jsonld: ["application/ld+json"],
|
|
6970
|
-
log: ["text/plain"],
|
|
6971
|
-
mid: ["audio/x-midi"],
|
|
6972
|
-
midi: ["audio/x-midi"],
|
|
6973
|
-
mjs: ["text/javascript"],
|
|
6974
|
-
mp3: ["audio/mpeg"],
|
|
6975
|
-
mpeg: ["video/mpeg"],
|
|
6976
|
-
mpkg: ["application/vnd.apple.installer+xml"],
|
|
6977
|
-
odp: ["application/vnd.oasis.opendocument.presentation"],
|
|
6978
|
-
ods: ["application/vnd.oasis.opendocument.spreadsheet"],
|
|
6979
|
-
odt: ["application/vnd.oasis.opendocument.text"],
|
|
6980
|
-
oga: ["audio/ogg"],
|
|
6981
|
-
ogv: ["video/ogg"],
|
|
6982
|
-
ogx: ["application/ogg"],
|
|
6983
|
-
opus: ["audio/opus"],
|
|
6984
|
-
otf: ["font/otf"],
|
|
6985
|
-
png: ["image/png"],
|
|
6986
|
-
pdf: ["application/pdf"],
|
|
6987
|
-
php: ["application/php"],
|
|
6988
|
-
ppt: ["application/vnd.ms-powerpoint"],
|
|
6989
|
-
pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
6990
|
-
rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
|
|
6991
|
-
rtf: ["application/rtf"],
|
|
6992
|
-
sh: ["application/x-sh"],
|
|
6993
|
-
svg: ["image/svg+xml"],
|
|
6994
|
-
swf: ["application/x-shockwave-flash"],
|
|
6995
|
-
tar: ["application/x-tar"],
|
|
6996
|
-
tif: ["image/tiff"],
|
|
6997
|
-
tiff: ["image/tiff"],
|
|
6998
|
-
ts: ["video/mp2t"],
|
|
6999
|
-
ttf: ["font/ttf"],
|
|
7000
|
-
txt: ["text/plain"],
|
|
7001
|
-
vsd: ["application/vnd.visio"],
|
|
7002
|
-
wav: ["audio/wav"],
|
|
7003
|
-
weba: ["audio/webm"],
|
|
7004
|
-
webm: ["video/webm"],
|
|
7005
|
-
webp: ["image/webp"],
|
|
7006
|
-
woff: ["font/woff"],
|
|
7007
|
-
woff2: ["font/woff2"],
|
|
7008
|
-
xhtml: ["application/xhtml+xml"],
|
|
7009
|
-
xls: ["application/vnd.ms-excel"],
|
|
7010
|
-
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
7011
|
-
xml: ["application/xml", "text/xml"],
|
|
7012
|
-
xul: ["application/vnd.mozilla.xul+xml"],
|
|
7013
|
-
zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
|
|
7014
|
-
"3gp": ["video/3gpp", "audio/3gpp"],
|
|
7015
|
-
"3g2": ["video/3gpp2", "audio/3gpp2"],
|
|
7016
|
-
"7z": ["application/x-7z-compressed"],
|
|
7017
|
-
};
|
|
7018
|
-
return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
|
|
7019
|
-
}
|
|
7020
|
-
function snakeCaseToCamelCase(str) {
|
|
7021
|
-
const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
|
|
7022
|
-
if (snakeCaseRegexp.test(str)) {
|
|
7023
|
-
let camelCase = "";
|
|
7024
|
-
let arr = str.split("_");
|
|
7025
|
-
arr.forEach((word, idx) => {
|
|
7026
|
-
camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
|
|
7027
|
-
});
|
|
7028
|
-
return camelCase;
|
|
7029
|
-
}
|
|
7030
|
-
else {
|
|
7031
|
-
return str;
|
|
7032
|
-
}
|
|
7033
|
-
}
|
|
7034
|
-
function getNewIndexToFocus(currentIndex, direction, listLength) {
|
|
7035
|
-
let newIndex = currentIndex;
|
|
7036
|
-
if (direction === "ArrowDown") {
|
|
7037
|
-
newIndex = (currentIndex + 1) % listLength;
|
|
7038
|
-
}
|
|
7039
|
-
if (direction === "ArrowUp") {
|
|
7040
|
-
newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
|
|
7041
|
-
}
|
|
7042
|
-
return newIndex;
|
|
7043
|
-
}
|
|
7044
|
-
function isRelatedTarget(ev, id) {
|
|
7045
|
-
// used for onBlur events to check the element that has been clicked
|
|
7046
|
-
const ids = id.split(" ");
|
|
7047
|
-
return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
|
|
7048
|
-
}
|
|
7049
|
-
function toBool(val) {
|
|
7050
|
-
// string "false" needs to be treated as bool False because react wrappers convert bool to string.
|
|
7051
|
-
return val == "false" ? false : !!val;
|
|
7052
|
-
}
|
|
7053
|
-
/*
|
|
7054
|
-
* this is going to be needed to solve the extra tabbing on navigator
|
|
7055
|
-
* and for programmatic focus of tabs
|
|
7056
|
-
* Here's a draft, not bug proof, see:
|
|
7057
|
-
* https://stackoverflow.com/a/10730308/3741713
|
|
7058
|
-
|
|
7059
|
-
function getKeyboardFocusableElements(element = document) {
|
|
7060
|
-
const els = Array.from(element.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), wm-search, wm-timepicker, wm-tab-list, wm-tab-item, wm-button, wm-action-menu'));
|
|
7061
|
-
return els.filter((el: Element) => !el.hasAttribute("disabled")) as HTMLElement[];
|
|
7062
|
-
}
|
|
7063
|
-
|
|
7064
|
-
export function getPreviousKeyboardFocusableElement(element: HTMLElement) {
|
|
7065
|
-
const els = getKeyboardFocusableElements();
|
|
7066
|
-
const current = els.indexOf(element);
|
|
7067
|
-
return els[current - 1] as HTMLElement;
|
|
7068
|
-
}
|
|
7069
|
-
|
|
7070
|
-
export function getNextKeyboardFocusableElement(element: HTMLElement) {
|
|
7071
|
-
const els = getKeyboardFocusableElements();
|
|
7072
|
-
const current = els.indexOf(element);
|
|
7073
|
-
return els[current + 1] as HTMLElement;
|
|
7074
|
-
}
|
|
6672
|
+
const DEFAULT_LANGUAGE = "en";
|
|
6673
|
+
function getBrowserLang() {
|
|
6674
|
+
const langAttr = document.documentElement.getAttribute("lang");
|
|
6675
|
+
if (!!langAttr) {
|
|
6676
|
+
return langAttr;
|
|
6677
|
+
}
|
|
6678
|
+
else if (window.navigator && window.navigator.language) {
|
|
6679
|
+
const lang = window.navigator.languages ? window.navigator.languages[0] : window.navigator.language;
|
|
6680
|
+
return lang.slice(0, 2);
|
|
6681
|
+
}
|
|
6682
|
+
else {
|
|
6683
|
+
return DEFAULT_LANGUAGE;
|
|
6684
|
+
}
|
|
6685
|
+
}
|
|
6686
|
+
// prevents memory leak
|
|
6687
|
+
const cache = createIntlCache();
|
|
6688
|
+
const locale = getBrowserLang();
|
|
6689
|
+
const intl = createIntl({
|
|
6690
|
+
locale: locale,
|
|
6691
|
+
defaultLocale: "en",
|
|
6692
|
+
messages: lang[locale] || en,
|
|
6693
|
+
}, cache);
|
|
6694
|
+
function generateId() {
|
|
6695
|
+
return "wmcl-" + Math.random().toString(36).substr(2, 10);
|
|
6696
|
+
}
|
|
6697
|
+
// limits how many times a function fires
|
|
6698
|
+
// use when the function should run periodically, but not too often (e.g. window resize)
|
|
6699
|
+
function throttle(fn, wait) {
|
|
6700
|
+
let timeout;
|
|
6701
|
+
let shouldWait = false;
|
|
6702
|
+
return function () {
|
|
6703
|
+
const context = this;
|
|
6704
|
+
if (!shouldWait) {
|
|
6705
|
+
fn.apply(context, arguments);
|
|
6706
|
+
shouldWait = true;
|
|
6707
|
+
clearTimeout(timeout);
|
|
6708
|
+
timeout = setTimeout(function () {
|
|
6709
|
+
shouldWait = false;
|
|
6710
|
+
}, wait);
|
|
6711
|
+
}
|
|
6712
|
+
};
|
|
6713
|
+
}
|
|
6714
|
+
// waits until it hasn't been called for [timeout] ms.
|
|
6715
|
+
// use when the function should run only after something (event) is done firing
|
|
6716
|
+
function debounce(fn, wait) {
|
|
6717
|
+
let timeout;
|
|
6718
|
+
return function () {
|
|
6719
|
+
const context = this;
|
|
6720
|
+
const functionCall = () => fn.apply(context, arguments);
|
|
6721
|
+
clearTimeout(timeout);
|
|
6722
|
+
timeout = setTimeout(functionCall, wait);
|
|
6723
|
+
};
|
|
6724
|
+
}
|
|
6725
|
+
function getTextDir() {
|
|
6726
|
+
const dir = document.querySelector("html").getAttribute("dir");
|
|
6727
|
+
return dir ? dir.toLowerCase() : "";
|
|
6728
|
+
}
|
|
6729
|
+
function getPosition(el) {
|
|
6730
|
+
const coords = el.getBoundingClientRect();
|
|
6731
|
+
let x = coords.x;
|
|
6732
|
+
let y = coords.y;
|
|
6733
|
+
// Edge doesn't have x and y
|
|
6734
|
+
if (!x) {
|
|
6735
|
+
if (getTextDir() === "rtl") {
|
|
6736
|
+
x = coords.right;
|
|
6737
|
+
}
|
|
6738
|
+
else {
|
|
6739
|
+
x = coords.left;
|
|
6740
|
+
}
|
|
6741
|
+
y = coords.top;
|
|
6742
|
+
}
|
|
6743
|
+
return { x, y };
|
|
6744
|
+
}
|
|
6745
|
+
function findParentWithScrollbar(el) {
|
|
6746
|
+
while (!!el) {
|
|
6747
|
+
if (el.scrollHeight > el.clientHeight && ["scroll", "auto"].includes(window.getComputedStyle(el).overflowY)) {
|
|
6748
|
+
return el;
|
|
6749
|
+
}
|
|
6750
|
+
el = el.parentElement;
|
|
6751
|
+
}
|
|
6752
|
+
}
|
|
6753
|
+
function findParentWithHiddenOverflow(el) {
|
|
6754
|
+
while (!!el) {
|
|
6755
|
+
if (window.getComputedStyle(el).overflowY !== "visible") {
|
|
6756
|
+
return el;
|
|
6757
|
+
}
|
|
6758
|
+
el = el.parentElement;
|
|
6759
|
+
}
|
|
6760
|
+
}
|
|
6761
|
+
function getClosableElementMeasurements(fixedEl, closableEl) {
|
|
6762
|
+
const parent = findParentWithHiddenOverflow(fixedEl);
|
|
6763
|
+
// if parent is not found, measurements are checked against the viewport
|
|
6764
|
+
return {
|
|
6765
|
+
closableElHeight: closableEl.clientHeight,
|
|
6766
|
+
closableElWidth: closableEl.clientWidth,
|
|
6767
|
+
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6768
|
+
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6769
|
+
spaceAbove: parent
|
|
6770
|
+
? fixedEl.getBoundingClientRect().top - parent.getBoundingClientRect().top
|
|
6771
|
+
: fixedEl.getBoundingClientRect().top,
|
|
6772
|
+
// NB boundingClientRect.bottom is space from top of viewport to bottom of el
|
|
6773
|
+
// to get space below the el -> height of viewport minus boundingClientRect.bottom
|
|
6774
|
+
spaceBelow: parent
|
|
6775
|
+
? parent.getBoundingClientRect().bottom - fixedEl.getBoundingClientRect().bottom
|
|
6776
|
+
: document.documentElement.clientHeight - fixedEl.getBoundingClientRect().bottom,
|
|
6777
|
+
spaceLeft: parent
|
|
6778
|
+
? fixedEl.getBoundingClientRect().left - parent.getBoundingClientRect().left
|
|
6779
|
+
: fixedEl.getBoundingClientRect().left,
|
|
6780
|
+
spaceRight: parent
|
|
6781
|
+
? parent.getBoundingClientRect().right - fixedEl.getBoundingClientRect().right
|
|
6782
|
+
: document.documentElement.clientWidth - fixedEl.getBoundingClientRect().right,
|
|
6783
|
+
};
|
|
6784
|
+
}
|
|
6785
|
+
function shouldOpenUp(fixedEl, //the element visible on the page when the component is closed
|
|
6786
|
+
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6787
|
+
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6788
|
+
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6789
|
+
) {
|
|
6790
|
+
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6791
|
+
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6792
|
+
const openUp = closableElHeight > spaceBelow + offsetBelow && closableElHeight <= spaceAbove + offsetAbove;
|
|
6793
|
+
return openUp;
|
|
6794
|
+
}
|
|
6795
|
+
function shouldOpenDown(fixedEl, //the element visible on the page when the component is closed
|
|
6796
|
+
closableEl, //the dropdown/popup/etc that becomes visible when the component is open
|
|
6797
|
+
offsetAbove = 0, // if closableEl covers a part of fixedEl, that part should be offset
|
|
6798
|
+
offsetBelow = 0 // if closableEl covers a part of fixedEl, that part should be offset
|
|
6799
|
+
) {
|
|
6800
|
+
const { closableElHeight, spaceAbove, spaceBelow } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6801
|
+
//we want to open up only if there's not enough space below AND there is enough space above
|
|
6802
|
+
const openDown = closableElHeight > spaceAbove + offsetAbove && closableElHeight <= spaceBelow + offsetBelow;
|
|
6803
|
+
return openDown;
|
|
6804
|
+
}
|
|
6805
|
+
function shouldShiftRight(fixedEl, closableEl) {
|
|
6806
|
+
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6807
|
+
const needsSpaceLeft = closableElWidth > spaceLeft && spaceRight > spaceLeft;
|
|
6808
|
+
return needsSpaceLeft;
|
|
6809
|
+
}
|
|
6810
|
+
function shouldShiftLeft(fixedEl, closableEl) {
|
|
6811
|
+
const { closableElWidth, spaceLeft, spaceRight } = getClosableElementMeasurements(fixedEl, closableEl);
|
|
6812
|
+
const needsSpaceRight = closableElWidth > spaceRight && spaceLeft > spaceRight;
|
|
6813
|
+
return needsSpaceRight;
|
|
6814
|
+
}
|
|
6815
|
+
function adjustTooltipPosition(tPos, el, tooltipEl) {
|
|
6816
|
+
// position must be reset before measurements are taken in adjustTooltipPosition
|
|
6817
|
+
// otherwise text-wrapping from previous position makes width measurement inconsistent
|
|
6818
|
+
tooltipEl.style.top = "";
|
|
6819
|
+
tooltipEl.style.left = "";
|
|
6820
|
+
const { spaceLeft, spaceRight, spaceBelow, spaceAbove } = getClosableElementMeasurements(el, tooltipEl);
|
|
6821
|
+
const tooltipWidth = tooltipEl.getBoundingClientRect().width;
|
|
6822
|
+
const tooltipHeight = tooltipEl.getBoundingClientRect().height;
|
|
6823
|
+
const enoughSpaceAbove = spaceAbove > tooltipHeight;
|
|
6824
|
+
const enoughSpaceBelow = spaceBelow > tooltipHeight;
|
|
6825
|
+
// a tooltip should never be closer than 24px to the edge of a screen
|
|
6826
|
+
const enoughSpaceLeft = spaceLeft - 24 > tooltipWidth;
|
|
6827
|
+
const enoughSpaceRight = spaceRight - 24 > tooltipWidth;
|
|
6828
|
+
const swapAbove = (position) => {
|
|
6829
|
+
return !enoughSpaceAbove ? position.replace("top", "bottom") : position;
|
|
6830
|
+
};
|
|
6831
|
+
const swapBelow = (position) => {
|
|
6832
|
+
return !enoughSpaceBelow && enoughSpaceAbove ? position.replace("bottom", "top") : position;
|
|
6833
|
+
};
|
|
6834
|
+
const swapLeft = (position, centeredPosition) => {
|
|
6835
|
+
if (!enoughSpaceLeft && enoughSpaceRight) {
|
|
6836
|
+
position = position.replace("left", "right");
|
|
6837
|
+
}
|
|
6838
|
+
else if (!enoughSpaceLeft && !enoughSpaceRight) {
|
|
6839
|
+
position = centeredPosition;
|
|
6840
|
+
}
|
|
6841
|
+
return position;
|
|
6842
|
+
};
|
|
6843
|
+
const swapRight = (position, centeredPosition) => {
|
|
6844
|
+
if (!enoughSpaceRight && enoughSpaceLeft) {
|
|
6845
|
+
position = position.replace("right", "left");
|
|
6846
|
+
}
|
|
6847
|
+
else if (!enoughSpaceRight && !enoughSpaceLeft) {
|
|
6848
|
+
position = centeredPosition;
|
|
6849
|
+
}
|
|
6850
|
+
return position;
|
|
6851
|
+
};
|
|
6852
|
+
// horizontal checks must occur before vertical checks, because horizontal can affect vertical positioning but not vice versa
|
|
6853
|
+
switch (tPos) {
|
|
6854
|
+
case "left":
|
|
6855
|
+
tPos = swapLeft(tPos, "bottom");
|
|
6856
|
+
case "right":
|
|
6857
|
+
tPos = swapRight(tPos, "bottom");
|
|
6858
|
+
case "top-left":
|
|
6859
|
+
tPos = swapLeft(tPos, "top");
|
|
6860
|
+
tPos = swapAbove(tPos);
|
|
6861
|
+
case "top-right":
|
|
6862
|
+
tPos = swapRight(tPos, "top");
|
|
6863
|
+
tPos = swapAbove(tPos);
|
|
6864
|
+
case "bottom-left":
|
|
6865
|
+
tPos = swapLeft(tPos, "bottom");
|
|
6866
|
+
tPos = swapBelow(tPos);
|
|
6867
|
+
case "bottom-right":
|
|
6868
|
+
tPos = swapRight(tPos, "bottom");
|
|
6869
|
+
tPos = swapBelow(tPos);
|
|
6870
|
+
case "top":
|
|
6871
|
+
tPos = swapAbove(tPos);
|
|
6872
|
+
case "bottom":
|
|
6873
|
+
tPos = swapBelow(tPos);
|
|
6874
|
+
}
|
|
6875
|
+
return tPos;
|
|
6876
|
+
}
|
|
6877
|
+
function hasRoomRight(x, spaceNeeded) {
|
|
6878
|
+
let horizOffset = 0;
|
|
6879
|
+
// if (getTextDir() === "ltr") {
|
|
6880
|
+
if (x.type === "click") {
|
|
6881
|
+
// if it's a mouse event, deal with mouse coords
|
|
6882
|
+
horizOffset = x.clientX;
|
|
6883
|
+
// if it's a focus event, the offset is 0
|
|
6884
|
+
}
|
|
6885
|
+
else if (x.type === "focus") {
|
|
6886
|
+
horizOffset = 0;
|
|
6887
|
+
}
|
|
6888
|
+
else {
|
|
6889
|
+
// otherwise an element was passed, calculate how far it is from the edge of the window
|
|
6890
|
+
let el = x; // re-assignment is for clarity
|
|
6891
|
+
while (el) {
|
|
6892
|
+
if (el.tagName == "BODY") {
|
|
6893
|
+
// deal with browser quirks with body/window/document and page scroll
|
|
6894
|
+
var xScroll = el.scrollLeft || document.documentElement.scrollLeft;
|
|
6895
|
+
horizOffset += el.offsetLeft - xScroll + el.clientLeft;
|
|
6896
|
+
}
|
|
6897
|
+
else {
|
|
6898
|
+
// for all other non-BODY elements
|
|
6899
|
+
horizOffset += el.offsetLeft - el.scrollLeft + el.clientLeft;
|
|
6900
|
+
}
|
|
6901
|
+
el = el.offsetParent;
|
|
6902
|
+
}
|
|
6903
|
+
// }
|
|
6904
|
+
}
|
|
6905
|
+
return window.innerWidth - horizOffset >= spaceNeeded;
|
|
6906
|
+
}
|
|
6907
|
+
function checkForActiveElInShadow(element) {
|
|
6908
|
+
while (element && element.shadowRoot) {
|
|
6909
|
+
element = element.shadowRoot.activeElement;
|
|
6910
|
+
}
|
|
6911
|
+
return element;
|
|
6912
|
+
}
|
|
6913
|
+
function checkForFocusableElInShadow(element) {
|
|
6914
|
+
const selectors = [
|
|
6915
|
+
"button",
|
|
6916
|
+
"a",
|
|
6917
|
+
"input",
|
|
6918
|
+
"select",
|
|
6919
|
+
"textarea",
|
|
6920
|
+
"wm-button",
|
|
6921
|
+
"wm-search",
|
|
6922
|
+
"wm-select",
|
|
6923
|
+
"wm-action-menu",
|
|
6924
|
+
"wm-tab-item",
|
|
6925
|
+
"wm-datepicker",
|
|
6926
|
+
];
|
|
6927
|
+
let focusableEl = element;
|
|
6928
|
+
selectors.forEach((selector) => {
|
|
6929
|
+
if (focusableEl && focusableEl.shadowRoot) {
|
|
6930
|
+
let elInShadow = focusableEl.shadowRoot.querySelector(selector);
|
|
6931
|
+
if (elInShadow) {
|
|
6932
|
+
if (selector.startsWith("wm-")) {
|
|
6933
|
+
focusableEl = checkForFocusableElInShadow(elInShadow);
|
|
6934
|
+
}
|
|
6935
|
+
else {
|
|
6936
|
+
focusableEl = elInShadow;
|
|
6937
|
+
}
|
|
6938
|
+
}
|
|
6939
|
+
}
|
|
6940
|
+
});
|
|
6941
|
+
return focusableEl;
|
|
6942
|
+
}
|
|
6943
|
+
function isFocusable(element) {
|
|
6944
|
+
if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)) {
|
|
6945
|
+
return true;
|
|
6946
|
+
}
|
|
6947
|
+
if (element.disabled) {
|
|
6948
|
+
return false;
|
|
6949
|
+
}
|
|
6950
|
+
switch (element.nodeName) {
|
|
6951
|
+
case "A":
|
|
6952
|
+
return !!element.href && element.rel != "ignore";
|
|
6953
|
+
case "INPUT":
|
|
6954
|
+
return element.type != "hidden" && element.type != "file";
|
|
6955
|
+
case "BUTTON":
|
|
6956
|
+
case "SELECT":
|
|
6957
|
+
case "TEXTAREA":
|
|
6958
|
+
case "WM-BUTTON":
|
|
6959
|
+
case "WM-SELECT":
|
|
6960
|
+
case "WM-ACTION-MENU":
|
|
6961
|
+
case "WM-DATEPICKER":
|
|
6962
|
+
case "WM-TIMEPICKER":
|
|
6963
|
+
case "WM-INPUT":
|
|
6964
|
+
case "WM-TAG-INPUT":
|
|
6965
|
+
case "WM-TAB-ITEM":
|
|
6966
|
+
case "WM-SEARCH":
|
|
6967
|
+
return true;
|
|
6968
|
+
default:
|
|
6969
|
+
return false;
|
|
6970
|
+
}
|
|
6971
|
+
}
|
|
6972
|
+
function getFirstFocusableDescendant(element) {
|
|
6973
|
+
if (isFocusable(element)) {
|
|
6974
|
+
return checkForFocusableElInShadow(element);
|
|
6975
|
+
}
|
|
6976
|
+
else if (element.childNodes.length > 0) {
|
|
6977
|
+
element.childNodes.forEach((i) => {
|
|
6978
|
+
const childEl = getFirstFocusableDescendant(i);
|
|
6979
|
+
return childEl && checkForFocusableElInShadow(childEl);
|
|
6980
|
+
});
|
|
6981
|
+
}
|
|
6982
|
+
}
|
|
6983
|
+
function hasValidType(file, types) {
|
|
6984
|
+
const acceptedExtensions = types.split(" ");
|
|
6985
|
+
const parts = file.name && file.name.split(".");
|
|
6986
|
+
const ext = parts && parts.length > 1 && parts[parts.length - 1];
|
|
6987
|
+
return ext
|
|
6988
|
+
? acceptedExtensions.includes(ext.toLowerCase())
|
|
6989
|
+
: // fallback: if we couldn't obtain an extension,
|
|
6990
|
+
// validate based on MIME type...
|
|
6991
|
+
!!file.type
|
|
6992
|
+
? getAcceptedMimeTypesList(acceptedExtensions).includes(file.type)
|
|
6993
|
+
: // ...and if that failed too, accept the file
|
|
6994
|
+
// as it's preferable to accept an invalid file
|
|
6995
|
+
// than refusing a valid one (back-end will take care of what slips through)
|
|
6996
|
+
true;
|
|
6997
|
+
}
|
|
6998
|
+
// takes a string (space separated list of extensions), returns an array of strings (corresponding MIME types)
|
|
6999
|
+
function getAcceptedMimeTypesList(acceptedExtensions) {
|
|
7000
|
+
// this is just a list of common file types (regardless of whether they are/can be valid or not)
|
|
7001
|
+
// front end checks are just a convenience to users, independent of security.
|
|
7002
|
+
// it allows users to be notified of an invalid type as soon as they select the file, rather than when it gets uploaded
|
|
7003
|
+
const lookupTable = {
|
|
7004
|
+
aac: ["audio/aac"],
|
|
7005
|
+
abw: ["application/x-abiword"],
|
|
7006
|
+
arc: ["application/x-freearc"],
|
|
7007
|
+
avi: ["video/x-msvideo"],
|
|
7008
|
+
azw: ["application/vnd.amazon.ebook"],
|
|
7009
|
+
bin: ["application/octet-stream"],
|
|
7010
|
+
bmp: ["image/bmp"],
|
|
7011
|
+
bz: ["application/x-bzip"],
|
|
7012
|
+
bz2: ["application/x-bzip2"],
|
|
7013
|
+
csh: ["application/x-csh"],
|
|
7014
|
+
css: ["text/css"],
|
|
7015
|
+
csv: ["text/csv"],
|
|
7016
|
+
doc: ["application/msword"],
|
|
7017
|
+
docx: ["application/vnd.openxmlformats-officedocument.wordprocessingml.document"],
|
|
7018
|
+
eot: ["application/vnd.ms-fontobject"],
|
|
7019
|
+
epub: ["application/epub+zip"],
|
|
7020
|
+
gz: ["application/gzip"],
|
|
7021
|
+
gif: ["image/gif"],
|
|
7022
|
+
htm: ["text/html"],
|
|
7023
|
+
html: ["text/html"],
|
|
7024
|
+
ico: ["image/vnd.microsoft.icon"],
|
|
7025
|
+
ics: ["text/calendar"],
|
|
7026
|
+
jar: ["application/java-archive"],
|
|
7027
|
+
jpeg: ["image/jpeg"],
|
|
7028
|
+
jpg: ["image/jpeg"],
|
|
7029
|
+
js: ["text/javascript"],
|
|
7030
|
+
json: ["application/json"],
|
|
7031
|
+
jsonld: ["application/ld+json"],
|
|
7032
|
+
log: ["text/plain"],
|
|
7033
|
+
mid: ["audio/x-midi"],
|
|
7034
|
+
midi: ["audio/x-midi"],
|
|
7035
|
+
mjs: ["text/javascript"],
|
|
7036
|
+
mp3: ["audio/mpeg"],
|
|
7037
|
+
mpeg: ["video/mpeg"],
|
|
7038
|
+
mpkg: ["application/vnd.apple.installer+xml"],
|
|
7039
|
+
odp: ["application/vnd.oasis.opendocument.presentation"],
|
|
7040
|
+
ods: ["application/vnd.oasis.opendocument.spreadsheet"],
|
|
7041
|
+
odt: ["application/vnd.oasis.opendocument.text"],
|
|
7042
|
+
oga: ["audio/ogg"],
|
|
7043
|
+
ogv: ["video/ogg"],
|
|
7044
|
+
ogx: ["application/ogg"],
|
|
7045
|
+
opus: ["audio/opus"],
|
|
7046
|
+
otf: ["font/otf"],
|
|
7047
|
+
png: ["image/png"],
|
|
7048
|
+
pdf: ["application/pdf"],
|
|
7049
|
+
php: ["application/php"],
|
|
7050
|
+
ppt: ["application/vnd.ms-powerpoint"],
|
|
7051
|
+
pptx: ["application/vnd.openxmlformats-officedocument.presentationml.presentation"],
|
|
7052
|
+
rar: ["application/vnd.rar", "application/x-rar", "application/x-rar-compressed"],
|
|
7053
|
+
rtf: ["application/rtf"],
|
|
7054
|
+
sh: ["application/x-sh"],
|
|
7055
|
+
svg: ["image/svg+xml"],
|
|
7056
|
+
swf: ["application/x-shockwave-flash"],
|
|
7057
|
+
tar: ["application/x-tar"],
|
|
7058
|
+
tif: ["image/tiff"],
|
|
7059
|
+
tiff: ["image/tiff"],
|
|
7060
|
+
ts: ["video/mp2t"],
|
|
7061
|
+
ttf: ["font/ttf"],
|
|
7062
|
+
txt: ["text/plain"],
|
|
7063
|
+
vsd: ["application/vnd.visio"],
|
|
7064
|
+
wav: ["audio/wav"],
|
|
7065
|
+
weba: ["audio/webm"],
|
|
7066
|
+
webm: ["video/webm"],
|
|
7067
|
+
webp: ["image/webp"],
|
|
7068
|
+
woff: ["font/woff"],
|
|
7069
|
+
woff2: ["font/woff2"],
|
|
7070
|
+
xhtml: ["application/xhtml+xml"],
|
|
7071
|
+
xls: ["application/vnd.ms-excel"],
|
|
7072
|
+
xlsx: ["application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
7073
|
+
xml: ["application/xml", "text/xml"],
|
|
7074
|
+
xul: ["application/vnd.mozilla.xul+xml"],
|
|
7075
|
+
zip: ["application/zip", "application/x-zip-compressed", "multipart/x-zip"],
|
|
7076
|
+
"3gp": ["video/3gpp", "audio/3gpp"],
|
|
7077
|
+
"3g2": ["video/3gpp2", "audio/3gpp2"],
|
|
7078
|
+
"7z": ["application/x-7z-compressed"],
|
|
7079
|
+
};
|
|
7080
|
+
return acceptedExtensions.reduce((acc, ext) => acc.concat(lookupTable[ext]), []);
|
|
7081
|
+
}
|
|
7082
|
+
function snakeCaseToCamelCase(str) {
|
|
7083
|
+
const snakeCaseRegexp = /^([a-z0-9]*)(_[a-z0-9]*)*$/g;
|
|
7084
|
+
if (snakeCaseRegexp.test(str)) {
|
|
7085
|
+
let camelCase = "";
|
|
7086
|
+
let arr = str.split("_");
|
|
7087
|
+
arr.forEach((word, idx) => {
|
|
7088
|
+
camelCase += idx === 0 ? word.toLowerCase() : word.charAt(0).toUpperCase() + word.slice(1);
|
|
7089
|
+
});
|
|
7090
|
+
return camelCase;
|
|
7091
|
+
}
|
|
7092
|
+
else {
|
|
7093
|
+
return str;
|
|
7094
|
+
}
|
|
7095
|
+
}
|
|
7096
|
+
function getNewIndexToFocus(currentIndex, direction, listLength) {
|
|
7097
|
+
let newIndex = currentIndex;
|
|
7098
|
+
if (direction === "ArrowDown") {
|
|
7099
|
+
newIndex = (currentIndex + 1) % listLength;
|
|
7100
|
+
}
|
|
7101
|
+
if (direction === "ArrowUp") {
|
|
7102
|
+
newIndex = currentIndex === 0 ? listLength - 1 : currentIndex - 1;
|
|
7103
|
+
}
|
|
7104
|
+
return newIndex;
|
|
7105
|
+
}
|
|
7106
|
+
function isRelatedTarget(ev, id) {
|
|
7107
|
+
// used for onBlur events to check the element that has been clicked
|
|
7108
|
+
const ids = id.split(" ");
|
|
7109
|
+
return ev.relatedTarget && ids.includes(ev.relatedTarget.id);
|
|
7110
|
+
}
|
|
7111
|
+
function toBool(val) {
|
|
7112
|
+
// string "false" needs to be treated as bool False because react wrappers convert bool to string.
|
|
7113
|
+
return val == "false" ? false : !!val;
|
|
7114
|
+
}
|
|
7115
|
+
/*
|
|
7116
|
+
* this is going to be needed to solve the extra tabbing on navigator
|
|
7117
|
+
* and for programmatic focus of tabs
|
|
7118
|
+
* Here's a draft, not bug proof, see:
|
|
7119
|
+
* https://stackoverflow.com/a/10730308/3741713
|
|
7120
|
+
|
|
7121
|
+
function getKeyboardFocusableElements(element = document) {
|
|
7122
|
+
const els = Array.from(element.querySelectorAll('a, button, input, textarea, select, details, [tabindex]:not([tabindex="-1"]), wm-search, wm-timepicker, wm-tab-list, wm-tab-item, wm-button, wm-action-menu'));
|
|
7123
|
+
return els.filter((el: Element) => !el.hasAttribute("disabled")) as HTMLElement[];
|
|
7124
|
+
}
|
|
7125
|
+
|
|
7126
|
+
export function getPreviousKeyboardFocusableElement(element: HTMLElement) {
|
|
7127
|
+
const els = getKeyboardFocusableElements();
|
|
7128
|
+
const current = els.indexOf(element);
|
|
7129
|
+
return els[current - 1] as HTMLElement;
|
|
7130
|
+
}
|
|
7131
|
+
|
|
7132
|
+
export function getNextKeyboardFocusableElement(element: HTMLElement) {
|
|
7133
|
+
const els = getKeyboardFocusableElements();
|
|
7134
|
+
const current = els.indexOf(element);
|
|
7135
|
+
return els[current + 1] as HTMLElement;
|
|
7136
|
+
}
|
|
7075
7137
|
*/
|
|
7076
7138
|
|
|
7077
7139
|
exports.adjustTooltipPosition = adjustTooltipPosition;
|