@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,1295 +1,1302 @@
|
|
|
1
|
-
import { h, Host, forceUpdate, } from "@stencil/core";
|
|
2
|
-
import { csvToArray, debounce, generateId, hideTooltip, intl, measureText, safeParseJSON, shouldOpenUp, showTooltip, truncateText, } from "../../global/functions";
|
|
3
|
-
import { globalMessages } from "../../global/intl";
|
|
4
|
-
export class TagInput {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.uid = this.el.id ? this.el.id : generateId();
|
|
7
|
-
this.openUp = false;
|
|
8
|
-
this.debouncedUpdate = debounce(() => forceUpdate(this.el), 30);
|
|
9
|
-
this.label = undefined;
|
|
10
|
-
this.labelPosition = "top";
|
|
11
|
-
this.options = "";
|
|
12
|
-
this.selectedTags = "";
|
|
13
|
-
this.info = undefined;
|
|
14
|
-
this.errorMessage = undefined;
|
|
15
|
-
this.addNew = true;
|
|
16
|
-
this.placeholder = undefined;
|
|
17
|
-
this.requiredField = false;
|
|
18
|
-
this.characterLimit = 50;
|
|
19
|
-
this.maxTags = undefined;
|
|
20
|
-
this.tagInputType = "dropdown";
|
|
21
|
-
this.colHeaders = undefined;
|
|
22
|
-
this.colWidths = undefined;
|
|
23
|
-
this.colWrap = undefined;
|
|
24
|
-
this.messageConfig = "";
|
|
25
|
-
this.focusedListItem = undefined;
|
|
26
|
-
this.focusedTag = null;
|
|
27
|
-
this.tablePosition = { row: 0, column: 1 };
|
|
28
|
-
this.isExpanded = false;
|
|
29
|
-
this.tagsList = csvToArray(this.selectedTags);
|
|
30
|
-
this.optionsList = csvToArray(this.options);
|
|
31
|
-
this.charCount = 0;
|
|
32
|
-
this.liveRegionMessage = "";
|
|
33
|
-
}
|
|
34
|
-
get tooltipVisible() {
|
|
35
|
-
return document.getElementById("wm-tooltip").classList.contains("open");
|
|
36
|
-
}
|
|
37
|
-
get focusedElement() {
|
|
38
|
-
return this.el.shadowRoot.activeElement;
|
|
39
|
-
}
|
|
40
|
-
get listItemEls() {
|
|
41
|
-
return Array.from(this.dropdownEl.querySelectorAll("li"));
|
|
42
|
-
}
|
|
43
|
-
get tagEls() {
|
|
44
|
-
return this.tagAreaEl ? Array.from(this.tagAreaEl.querySelectorAll(".tag")) : [];
|
|
45
|
-
}
|
|
46
|
-
get nonLockedTagEls() {
|
|
47
|
-
return this.tagEls.filter((tag) => !tag.classList.contains("locked"));
|
|
48
|
-
}
|
|
49
|
-
get optionEls() {
|
|
50
|
-
return Array.from(this.dropdownEl.querySelectorAll(".option"));
|
|
51
|
-
}
|
|
52
|
-
get wmRowEls() {
|
|
53
|
-
return Array.from(this.el.querySelectorAll("wm-tag-input-row"));
|
|
54
|
-
}
|
|
55
|
-
get localRowEls() {
|
|
56
|
-
return Array.from(this.el.shadowRoot.querySelectorAll("tr"));
|
|
57
|
-
}
|
|
58
|
-
get filteredRows() {
|
|
59
|
-
return this.wmRowEls.filter((row) => {
|
|
60
|
-
const query = this.inputEl ? this.inputEl.value.toLowerCase() : "";
|
|
61
|
-
const colValues = [row.col1, row.col2, row.col3, row.col4].join("").toLowerCase();
|
|
62
|
-
return colValues.includes(query);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
get nonLockedTagsList() {
|
|
66
|
-
let list = [];
|
|
67
|
-
if (this.tagInputType === "table") {
|
|
68
|
-
this.tagsList.forEach((id) => {
|
|
69
|
-
const correspondingRowEl = this.wmRowEls.filter((row) => id === row.id)[0];
|
|
70
|
-
if (!correspondingRowEl.locked) {
|
|
71
|
-
list.push(id);
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
else if (this.tagInputType === "dropdown") {
|
|
76
|
-
list = this.tagsList;
|
|
77
|
-
}
|
|
78
|
-
return list;
|
|
79
|
-
}
|
|
80
|
-
get tagLimitReached() {
|
|
81
|
-
return !!(this.maxTags && this.tagsList.length >= this.maxTags);
|
|
82
|
-
}
|
|
83
|
-
get noResultsMessage() {
|
|
84
|
-
return intl.formatMessage({
|
|
85
|
-
id: "tagInput.noResults",
|
|
86
|
-
defaultMessage: "No results match your search.",
|
|
87
|
-
description: "Message displayed when a user's search returns empty.",
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
get componentMessages() {
|
|
91
|
-
const addNewHelpText = intl.formatMessage({
|
|
92
|
-
id: "tagInput.addNewHelpText",
|
|
93
|
-
defaultMessage: "Press the Enter or Comma key to add a new tag.",
|
|
94
|
-
description: "Help text appearing in a dropdown. Use imperative",
|
|
95
|
-
});
|
|
96
|
-
const selectionHelpText = intl.formatMessage({
|
|
97
|
-
id: "tagInput.selectionHelpText",
|
|
98
|
-
defaultMessage: "Search and select a tag.",
|
|
99
|
-
description: "Help text appearing in a dropdown. Use imperative",
|
|
100
|
-
});
|
|
101
|
-
const maxTagsReachedMessage = intl.formatMessage({
|
|
102
|
-
id: "tagInput.maxTagsReached",
|
|
103
|
-
defaultMessage: "No more tags can be added because the limit has been reached.",
|
|
104
|
-
});
|
|
105
|
-
const tagAreaInstructions = intl.formatMessage({
|
|
106
|
-
id: "tagInput.tagAreaInstructions",
|
|
107
|
-
defaultMessage: "tag selection. Press Backspace or Delete to remove a tag.",
|
|
108
|
-
});
|
|
109
|
-
const tagsAddedMessage = intl.formatMessage({
|
|
110
|
-
id: "tagInput.tagsAdded",
|
|
111
|
-
defaultMessage: "Tags added",
|
|
112
|
-
description: "For the user to understand how close they are to the tag limit, followed by x/y count",
|
|
113
|
-
});
|
|
114
|
-
const defaultConfig = {
|
|
115
|
-
addNewHelpText: addNewHelpText,
|
|
116
|
-
selectionHelpText: selectionHelpText,
|
|
117
|
-
maxTagsReached: maxTagsReachedMessage,
|
|
118
|
-
tagAreaInstructions: tagAreaInstructions,
|
|
119
|
-
tagsAdded: tagsAddedMessage,
|
|
120
|
-
};
|
|
121
|
-
const userProvidedConfig = safeParseJSON(this.messageConfig);
|
|
122
|
-
return userProvidedConfig ? Object.assign(Object.assign({}, defaultConfig), userProvidedConfig) : defaultConfig;
|
|
123
|
-
}
|
|
124
|
-
get inputMinimumWidth() {
|
|
125
|
-
// 150px is the minimum width of the input field, or the length of the placeholder text
|
|
126
|
-
const inputElStyles = getComputedStyle(this.inputEl);
|
|
127
|
-
const tagElStyles = getComputedStyle(this.tagEls[this.tagEls.length - 1]);
|
|
128
|
-
const inputElBuffer = [
|
|
129
|
-
inputElStyles.paddingLeft,
|
|
130
|
-
inputElStyles.paddingRight,
|
|
131
|
-
inputElStyles.marginLeft,
|
|
132
|
-
inputElStyles.marginRight,
|
|
133
|
-
tagElStyles.marginRight,
|
|
134
|
-
].reduce((prev, curr) => prev + parseInt(curr.replace("px", "")), 0);
|
|
135
|
-
const minimumWidth = Math.max(150, measureText(this.inputEl, this.placeholder).width + inputElBuffer);
|
|
136
|
-
return minimumWidth;
|
|
137
|
-
}
|
|
138
|
-
generateTagAddedMessage(tag) {
|
|
139
|
-
return intl.formatMessage({
|
|
140
|
-
id: "tagInput.tagAdded",
|
|
141
|
-
defaultMessage: "{tagName} added.",
|
|
142
|
-
description: "A confirmation for adding a tag.",
|
|
143
|
-
}, { tagName: tag });
|
|
144
|
-
}
|
|
145
|
-
generateTagAlreadyAddedMessage(tag) {
|
|
146
|
-
return intl.formatMessage({
|
|
147
|
-
id: "tagInput.tagAlreadyAdded",
|
|
148
|
-
defaultMessage: "{tagName} has already been added.",
|
|
149
|
-
description: "An alert for adding a tag that is already present.",
|
|
150
|
-
}, { tagName: tag });
|
|
151
|
-
}
|
|
152
|
-
componentWillLoad() {
|
|
153
|
-
if (!this.placeholder) {
|
|
154
|
-
this.placeholder = this.createPlaceholderDefault(this.addNew, !!this.options);
|
|
155
|
-
}
|
|
156
|
-
if (!this.label) {
|
|
157
|
-
console.error("wm-tag-input must have a label property");
|
|
158
|
-
}
|
|
159
|
-
this.consolidateSelectedTags();
|
|
160
|
-
this.el.focus = () => {
|
|
161
|
-
const firstFocusableTag = this.nonLockedTagEls[0];
|
|
162
|
-
if (firstFocusableTag) {
|
|
163
|
-
this.tagAreaEl.focus();
|
|
164
|
-
this.focusTag(firstFocusableTag);
|
|
165
|
-
}
|
|
166
|
-
else {
|
|
167
|
-
this.inputEl.focus();
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
// on resize of component, trigger componentDidRender -> positionInput
|
|
171
|
-
const resizeObserver = new ResizeObserver(() => this.debouncedUpdate());
|
|
172
|
-
resizeObserver.observe(this.el);
|
|
173
|
-
}
|
|
174
|
-
componentDidLoad() {
|
|
175
|
-
// prevent highlighting of pre-selected tags
|
|
176
|
-
this.tagEls.forEach((el) => el.classList.remove("highlight"));
|
|
177
|
-
}
|
|
178
|
-
componentDidRender() {
|
|
179
|
-
this.positionInput();
|
|
180
|
-
// check each tag if truncation is needed
|
|
181
|
-
this.tagEls.forEach((tag) => {
|
|
182
|
-
const textEl = tag.querySelector(".tag-text");
|
|
183
|
-
const wrapper = this.el.shadowRoot.querySelector(".tags-and-input-wrapper");
|
|
184
|
-
const leftBound = textEl.getBoundingClientRect().left;
|
|
185
|
-
// the numbers represent spacing values for padding, margin, and delete icon
|
|
186
|
-
const rightBound = wrapper.getBoundingClientRect().right - 10 - 8 - 28;
|
|
187
|
-
let displayText = tag.dataset.tag;
|
|
188
|
-
if (this.tagInputType === "table") {
|
|
189
|
-
// table variant doesn't display the tag id, but the contents of the first column
|
|
190
|
-
const referencedRow = this.el.querySelector(`#${displayText}`);
|
|
191
|
-
displayText = referencedRow ? referencedRow.col1 : "";
|
|
192
|
-
}
|
|
193
|
-
textEl.textContent = truncateText(textEl, displayText, rightBound - leftBound, 5);
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
consolidateSelectedTags() {
|
|
197
|
-
this.tagsList.forEach((tag) => {
|
|
198
|
-
if (!this.includesCaseInsensitive(this.optionsList, tag)) {
|
|
199
|
-
this.options += `${this.options.length > 0 ? "," : ""}${tag}`;
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
this.optionsList = csvToArray(this.options);
|
|
203
|
-
}
|
|
204
|
-
createPlaceholderDefault(addNew, hasOptions) {
|
|
205
|
-
const addAndSearchPlaceholder = intl.formatMessage({
|
|
206
|
-
id: "tagInput.placeholderAddAndSearch",
|
|
207
|
-
defaultMessage: "Add or search for a tag",
|
|
208
|
-
description: "Placeholder text. Use imperative",
|
|
209
|
-
});
|
|
210
|
-
const searchPlaceholder = intl.formatMessage({
|
|
211
|
-
id: "tagInput.placeholderSearch",
|
|
212
|
-
defaultMessage: "Search and select a tag",
|
|
213
|
-
description: "Placeholder text. Use imperative",
|
|
214
|
-
});
|
|
215
|
-
const addPlaceholder = intl.formatMessage({
|
|
216
|
-
id: "tagInput.placeholderAdd",
|
|
217
|
-
defaultMessage: "Add a new tag",
|
|
218
|
-
description: "Placeholder text. Use imperative",
|
|
219
|
-
});
|
|
220
|
-
let placeholder = "";
|
|
221
|
-
if (addNew && hasOptions) {
|
|
222
|
-
placeholder = addAndSearchPlaceholder;
|
|
223
|
-
}
|
|
224
|
-
else if (!addNew && hasOptions) {
|
|
225
|
-
placeholder = searchPlaceholder;
|
|
226
|
-
}
|
|
227
|
-
else if (addNew) {
|
|
228
|
-
placeholder = addPlaceholder;
|
|
229
|
-
}
|
|
230
|
-
return placeholder;
|
|
231
|
-
}
|
|
232
|
-
reflectSelectedTags(newValue, oldValue) {
|
|
233
|
-
const isAddition = newValue.length > oldValue.length;
|
|
234
|
-
let changedTag = "";
|
|
235
|
-
let selectedTags = this.tagsList;
|
|
236
|
-
if (isAddition) {
|
|
237
|
-
changedTag = newValue.filter((val) => !oldValue.includes(val))[0];
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
changedTag = oldValue.filter((val) => !newValue.includes(val))[0];
|
|
241
|
-
}
|
|
242
|
-
// event emitted by type table uses element references instead of strings
|
|
243
|
-
if (this.tagInputType === "table") {
|
|
244
|
-
changedTag = this.wmRowEls.filter((row) => row.id === changedTag)[0];
|
|
245
|
-
selectedTags = this.tagsList.map((id) => this.el.querySelector(`#${id}`));
|
|
246
|
-
}
|
|
247
|
-
this.selectedTags = this.listToCSV(this.tagsList);
|
|
248
|
-
let detail = { value: selectedTags, tagChanged: changedTag };
|
|
249
|
-
this.wmTagInputChanged.emit(detail);
|
|
250
|
-
}
|
|
251
|
-
handleErrorMessageChange() {
|
|
252
|
-
if (this.errorMessage) {
|
|
253
|
-
this.announce(this.errorMessage);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
handleRowUpdate() {
|
|
257
|
-
forceUpdate(this.el);
|
|
258
|
-
}
|
|
259
|
-
closeIfNotElOrChild(ev) {
|
|
260
|
-
const isntElOrChild = ev.target !== this.el && !this.el.shadowRoot.contains(ev.target);
|
|
261
|
-
if (this.tagInputType === "dropdown" && isntElOrChild && this.isExpanded) {
|
|
262
|
-
this.closeDropdown();
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
// From wm-button
|
|
266
|
-
// we need to listen for scroll events during the capture phase because they do not bubble up
|
|
267
|
-
// there can be layouts where the main content has 100vh and overflows
|
|
268
|
-
// in these cases window will register no scroll events unless we catch on they way down
|
|
269
|
-
dismissTooltip() {
|
|
270
|
-
if (this.tooltipVisible) {
|
|
271
|
-
hideTooltip();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
handleInputKeyDown(ev) {
|
|
275
|
-
if (/^.$/.test(ev.key) && this.inputEl.value.length >= this.characterLimit) {
|
|
276
|
-
this.announce(this.generateCharacterLimitWarning(this.inputEl.value.length, this.characterLimit));
|
|
277
|
-
}
|
|
278
|
-
// prevent keydown triggering on tag area
|
|
279
|
-
ev.stopPropagation();
|
|
280
|
-
switch (ev.key) {
|
|
281
|
-
case "Enter":
|
|
282
|
-
case ",":
|
|
283
|
-
ev.preventDefault();
|
|
284
|
-
this.handleInputEnter();
|
|
285
|
-
break;
|
|
286
|
-
case "ArrowDown":
|
|
287
|
-
ev.preventDefault();
|
|
288
|
-
this.handleInputArrowDown();
|
|
289
|
-
break;
|
|
290
|
-
case "ArrowUp":
|
|
291
|
-
ev.preventDefault();
|
|
292
|
-
this.handleInputArrowUp();
|
|
293
|
-
break;
|
|
294
|
-
case "ArrowLeft":
|
|
295
|
-
if (this.tagInputType === "table" && this.tablePosition.row) {
|
|
296
|
-
ev.preventDefault();
|
|
297
|
-
this.moveLeftCell();
|
|
298
|
-
}
|
|
299
|
-
break;
|
|
300
|
-
case "ArrowRight":
|
|
301
|
-
if (this.tagInputType === "table" && this.tablePosition.row) {
|
|
302
|
-
ev.preventDefault();
|
|
303
|
-
this.moveRightCell();
|
|
304
|
-
}
|
|
305
|
-
break;
|
|
306
|
-
case "Escape":
|
|
307
|
-
if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
308
|
-
this.closeDropdown();
|
|
309
|
-
}
|
|
310
|
-
break;
|
|
311
|
-
case "ArrowLeft":
|
|
312
|
-
case "Backspace":
|
|
313
|
-
this.handleInputBackspace();
|
|
314
|
-
break;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
handleInputFocus() {
|
|
318
|
-
if (this.tagInputType === "dropdown") {
|
|
319
|
-
this.openDropdown();
|
|
320
|
-
this.clearListItemFocus();
|
|
321
|
-
}
|
|
322
|
-
// force update needed to apply styled state of field-wrapper el
|
|
323
|
-
forceUpdate(this.el);
|
|
324
|
-
}
|
|
325
|
-
handleInputChanged(value) {
|
|
326
|
-
this.charCount = value.length;
|
|
327
|
-
if (this.tagInputType === "dropdown") {
|
|
328
|
-
this.clearListItemFocus();
|
|
329
|
-
if (this.charCount >= this.characterLimit - 5) {
|
|
330
|
-
this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
|
|
331
|
-
}
|
|
332
|
-
if (!this.isExpanded) {
|
|
333
|
-
this.openDropdown();
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
else if (this.tagInputType === "table") {
|
|
337
|
-
this.clearCellFocus();
|
|
338
|
-
}
|
|
339
|
-
this.announceExistingOptions();
|
|
340
|
-
}
|
|
341
|
-
handleInputEnter() {
|
|
342
|
-
if (this.tagInputType === "dropdown") {
|
|
343
|
-
if (this.focusedListItem) {
|
|
344
|
-
this.handleListItemClick(this.focusedListItem);
|
|
345
|
-
}
|
|
346
|
-
else {
|
|
347
|
-
this.submitInput(this.addNew, this.inputEl.value.trim());
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
else if (this.tagInputType === "table" && this.tablePosition.row > 0) {
|
|
351
|
-
this.handleTableRowClick(this.localRowEls[this.tablePosition.row].id);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
submitInput(canAddNew, value) {
|
|
355
|
-
const hasNonWhiteSpaceCharacters = value.match(/\S/);
|
|
356
|
-
if (canAddNew && hasNonWhiteSpaceCharacters) {
|
|
357
|
-
this.addTag(value);
|
|
358
|
-
this.optionsList = this.addOption(value);
|
|
359
|
-
this.resetInput();
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
handleInputArrowDown() {
|
|
363
|
-
if (this.tagInputType === "table") {
|
|
364
|
-
this.moveDownRow();
|
|
365
|
-
}
|
|
366
|
-
else if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
367
|
-
this.moveDownListItem();
|
|
368
|
-
}
|
|
369
|
-
else if (this.tagInputType === "dropdown") {
|
|
370
|
-
this.openDropdown();
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
handleInputArrowUp() {
|
|
374
|
-
if (this.tagInputType === "table") {
|
|
375
|
-
this.moveUpRow();
|
|
376
|
-
}
|
|
377
|
-
else if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
378
|
-
this.moveUpListItem();
|
|
379
|
-
}
|
|
380
|
-
else if (this.tagInputType === "dropdown") {
|
|
381
|
-
this.openDropdown();
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
handleInputBackspace() {
|
|
385
|
-
if (this.inputEl.value === "" && this.tagsList.length > 0) {
|
|
386
|
-
// wait for events to finish firing before redirecting focus
|
|
387
|
-
// prevents double input in input area and tag area
|
|
388
|
-
window.requestAnimationFrame(() => {
|
|
389
|
-
if (this.nonLockedTagsList.length > 0) {
|
|
390
|
-
this.tagAreaEl.focus();
|
|
391
|
-
this.focusTag(this.tagEls[this.tagEls.length - 1]);
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
handleListItemKeyDown(ev) {
|
|
397
|
-
const typedEvTarget = ev.target;
|
|
398
|
-
switch (ev.key) {
|
|
399
|
-
case "Enter":
|
|
400
|
-
case " ":
|
|
401
|
-
ev.preventDefault();
|
|
402
|
-
typedEvTarget.click();
|
|
403
|
-
break;
|
|
404
|
-
case "ArrowDown":
|
|
405
|
-
ev.preventDefault();
|
|
406
|
-
this.moveDownListItem();
|
|
407
|
-
break;
|
|
408
|
-
case "ArrowUp":
|
|
409
|
-
ev.preventDefault();
|
|
410
|
-
this.moveUpListItem();
|
|
411
|
-
break;
|
|
412
|
-
case "Escape":
|
|
413
|
-
if (this.focusedElement !== this.inputEl) {
|
|
414
|
-
this.inputEl.focus();
|
|
415
|
-
}
|
|
416
|
-
else if (this.tagInputType === "dropdown") {
|
|
417
|
-
this.closeDropdown();
|
|
418
|
-
}
|
|
419
|
-
break;
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
handleListItemClick(item) {
|
|
423
|
-
const tag = item.dataset.option.trim() || "";
|
|
424
|
-
if (this.includesCaseInsensitive(this.tagsList, tag)) {
|
|
425
|
-
this.announce(this.generateTagAlreadyAddedMessage(tag));
|
|
426
|
-
}
|
|
427
|
-
else {
|
|
428
|
-
this.resetInput();
|
|
429
|
-
this.addTag(tag);
|
|
430
|
-
this.optionsList = this.addOption(tag);
|
|
431
|
-
this.focusedListItem = null;
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
handleTableRowClick(rowId) {
|
|
435
|
-
const referencedRow = this.el.querySelector(`#${rowId}`);
|
|
436
|
-
const isLocked = referencedRow.locked;
|
|
437
|
-
if (!isLocked) {
|
|
438
|
-
if (this.includesCaseInsensitive(this.tagsList, rowId)) {
|
|
439
|
-
this.removeTag(rowId);
|
|
440
|
-
}
|
|
441
|
-
else if (!this.tagLimitReached) {
|
|
442
|
-
this.addTag(rowId);
|
|
443
|
-
this.resetInput();
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
handleTagAreaKeyDown(ev) {
|
|
448
|
-
switch (ev.key) {
|
|
449
|
-
case "ArrowLeft":
|
|
450
|
-
case "ArrowUp":
|
|
451
|
-
ev.preventDefault();
|
|
452
|
-
this.moveLeftTag();
|
|
453
|
-
break;
|
|
454
|
-
case "ArrowRight":
|
|
455
|
-
case "ArrowDown":
|
|
456
|
-
ev.preventDefault();
|
|
457
|
-
this.moveRightTag();
|
|
458
|
-
break;
|
|
459
|
-
case "Backspace":
|
|
460
|
-
case "Delete":
|
|
461
|
-
this.handleTagAreaDelete();
|
|
462
|
-
break;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
handleTagAreaDelete() {
|
|
466
|
-
const isLocked = this.focusedTag && this.focusedTag.classList.contains("locked");
|
|
467
|
-
if (this.focusedTag && !isLocked) {
|
|
468
|
-
this.removeTag(this.focusedTag.dataset.tag);
|
|
469
|
-
if (this.nonLockedTagsList.length === 0) {
|
|
470
|
-
// focus input if no tags are left
|
|
471
|
-
this.inputEl.focus();
|
|
472
|
-
}
|
|
473
|
-
else {
|
|
474
|
-
const removingLastTag = this.focusedTag === this.tagEls[this.tagEls.length - 1];
|
|
475
|
-
// if removing the last tag, reassign focused tag to previous task
|
|
476
|
-
this.focusedTag = removingLastTag ? this.tagEls[this.tagEls.length - 2] : this.focusedTag;
|
|
477
|
-
this.focusTag(this.focusedTag);
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
handleBlur(ev, component) {
|
|
482
|
-
const isntElOrChild = ev.relatedTarget !== component && !this.el.shadowRoot.contains(ev.relatedTarget);
|
|
483
|
-
this.dismissTooltip();
|
|
484
|
-
this.clearCellFocus();
|
|
485
|
-
if (isntElOrChild) {
|
|
486
|
-
this.fieldWrapperEl.classList.remove("focused");
|
|
487
|
-
if (this.tagInputType === "dropdown") {
|
|
488
|
-
this.closeDropdown();
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|
|
492
|
-
handleCellMouseEnter(ev) {
|
|
493
|
-
const cell = ev.target;
|
|
494
|
-
const contentWrapper = cell.querySelector(".cell-content-wrapper");
|
|
495
|
-
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
496
|
-
if (isTruncated) {
|
|
497
|
-
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
498
|
-
showTooltip("bottom", cell, cell.innerText);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
handleTagAreaFocus() {
|
|
502
|
-
if (this.tagInputType === "dropdown") {
|
|
503
|
-
this.closeDropdown();
|
|
504
|
-
}
|
|
505
|
-
const firstFocusableTag = this.nonLockedTagEls[0];
|
|
506
|
-
firstFocusableTag && this.focusTag(firstFocusableTag);
|
|
507
|
-
}
|
|
508
|
-
handleRemoveButtonClick(tag) {
|
|
509
|
-
this.moveLeftTag();
|
|
510
|
-
this.removeTag(tag);
|
|
511
|
-
}
|
|
512
|
-
moveDownListItem() {
|
|
513
|
-
if (this.listItemEls.length > 0) {
|
|
514
|
-
const firstListItem = this.listItemEls[0];
|
|
515
|
-
if (!this.focusedListItem) {
|
|
516
|
-
this.focusListItem(firstListItem);
|
|
517
|
-
}
|
|
518
|
-
else if (this.focusedListItem.nextElementSibling) {
|
|
519
|
-
this.focusListItem(this.focusedListItem.nextElementSibling);
|
|
520
|
-
}
|
|
521
|
-
else {
|
|
522
|
-
this.focusListItem(firstListItem);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
moveUpListItem() {
|
|
527
|
-
if (this.listItemEls.length > 0) {
|
|
528
|
-
const lastListItem = this.listItemEls[this.listItemEls.length - 1];
|
|
529
|
-
if (!this.focusedListItem) {
|
|
530
|
-
this.focusListItem(lastListItem);
|
|
531
|
-
}
|
|
532
|
-
else if (this.focusedListItem.previousElementSibling) {
|
|
533
|
-
this.focusListItem(this.focusedListItem.previousElementSibling);
|
|
534
|
-
}
|
|
535
|
-
else {
|
|
536
|
-
this.clearListItemFocus();
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
moveDownRow() {
|
|
541
|
-
if (this.filteredRows.length > 0) {
|
|
542
|
-
if (this.tablePosition.row === 0) {
|
|
543
|
-
this.tablePosition.row = 1;
|
|
544
|
-
}
|
|
545
|
-
else if (this.tablePosition.row === this.filteredRows.length) {
|
|
546
|
-
this.tablePosition.row = 1;
|
|
547
|
-
}
|
|
548
|
-
else {
|
|
549
|
-
this.tablePosition.row++;
|
|
550
|
-
}
|
|
551
|
-
// skip locked rows
|
|
552
|
-
const rowToFocus = this.filteredRows[this.tablePosition.row - 1];
|
|
553
|
-
if (rowToFocus.locked) {
|
|
554
|
-
this.moveDownRow();
|
|
555
|
-
}
|
|
556
|
-
else {
|
|
557
|
-
this.focusCell(this.tablePosition);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
moveUpRow() {
|
|
562
|
-
if (this.filteredRows.length > 0) {
|
|
563
|
-
if (this.tablePosition.row === 0) {
|
|
564
|
-
this.tablePosition.row = this.filteredRows.length;
|
|
565
|
-
}
|
|
566
|
-
else if (this.tablePosition.row === 1) {
|
|
567
|
-
this.tablePosition.row = 0;
|
|
568
|
-
}
|
|
569
|
-
else {
|
|
570
|
-
this.tablePosition.row--;
|
|
571
|
-
}
|
|
572
|
-
// skip locked rows
|
|
573
|
-
const rowToFocus = this.filteredRows[this.tablePosition.row - 1];
|
|
574
|
-
if (rowToFocus && rowToFocus.locked) {
|
|
575
|
-
this.moveUpRow();
|
|
576
|
-
}
|
|
577
|
-
else if (rowToFocus) {
|
|
578
|
-
this.focusCell(this.tablePosition);
|
|
579
|
-
}
|
|
580
|
-
else {
|
|
581
|
-
this.clearCellFocus();
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
moveLeftCell() {
|
|
586
|
-
if (this.tablePosition.column != 1) {
|
|
587
|
-
this.tablePosition.column--;
|
|
588
|
-
this.focusCell(this.tablePosition);
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
|
-
moveRightCell() {
|
|
592
|
-
const numCols = csvToArray(this.colHeaders).length;
|
|
593
|
-
if (this.tablePosition.column < numCols) {
|
|
594
|
-
this.tablePosition.column++;
|
|
595
|
-
this.focusCell(this.tablePosition);
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
moveLeftTag() {
|
|
599
|
-
const lastTag = this.tagEls[this.tagEls.length - 1];
|
|
600
|
-
if (this.focusedTag && this.tagEls.includes(this.focusedTag.previousElementSibling)) {
|
|
601
|
-
this.focusedTag = this.focusedTag.previousElementSibling;
|
|
602
|
-
}
|
|
603
|
-
else {
|
|
604
|
-
this.focusedTag = lastTag;
|
|
605
|
-
}
|
|
606
|
-
// skip locked tags
|
|
607
|
-
if (this.focusedTag.classList.contains("locked") && this.nonLockedTagEls.length > 0) {
|
|
608
|
-
this.moveLeftTag();
|
|
609
|
-
}
|
|
610
|
-
else {
|
|
611
|
-
this.focusTag(this.focusedTag);
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
moveRightTag() {
|
|
615
|
-
const firstTag = this.tagEls[0];
|
|
616
|
-
if (this.focusedTag && this.tagEls.includes(this.focusedTag.nextElementSibling)) {
|
|
617
|
-
this.focusedTag = this.focusedTag.nextElementSibling;
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
this.focusedTag = firstTag;
|
|
621
|
-
}
|
|
622
|
-
// skip locked tags
|
|
623
|
-
if (this.focusedTag.classList.contains("locked")) {
|
|
624
|
-
this.moveRightTag();
|
|
625
|
-
}
|
|
626
|
-
else {
|
|
627
|
-
this.focusTag(this.focusedTag);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
addOption(option) {
|
|
631
|
-
let newOptionsList = this.optionsList;
|
|
632
|
-
const optionAlreadyExists = this.includesCaseInsensitive(this.optionsList, option);
|
|
633
|
-
if (!optionAlreadyExists) {
|
|
634
|
-
newOptionsList = newOptionsList.concat(option);
|
|
635
|
-
}
|
|
636
|
-
return newOptionsList;
|
|
637
|
-
}
|
|
638
|
-
removeOption(option) {
|
|
639
|
-
this.optionsList = this.filterCaseInsensitive(this.optionsList, option);
|
|
640
|
-
}
|
|
641
|
-
addTag(tag) {
|
|
642
|
-
let newTagsList = this.tagsList;
|
|
643
|
-
const tagAlreadyAdded = this.includesCaseInsensitive(this.tagsList, tag);
|
|
644
|
-
const tagExistsAsOption = this.optionsList.filter((x) => x.toLowerCase() === tag.toLowerCase())[0];
|
|
645
|
-
if (!tagAlreadyAdded) {
|
|
646
|
-
let textToAnnounce = tag;
|
|
647
|
-
if (this.tagInputType === "table") {
|
|
648
|
-
const referencedRow = this.el.querySelector(`#${tag}`);
|
|
649
|
-
textToAnnounce = referencedRow.col1;
|
|
650
|
-
}
|
|
651
|
-
this.announce(this.generateTagAddedMessage(textToAnnounce));
|
|
652
|
-
this.tagsList = newTagsList.concat(tagExistsAsOption || tag);
|
|
653
|
-
// if maxTags has been reached, focus should go to the tagArea
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
this.
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
this.
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
this.
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
this.
|
|
751
|
-
this.
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
return list.
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
this.
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
"
|
|
939
|
-
|
|
940
|
-
}
|
|
941
|
-
static get
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
"
|
|
957
|
-
"
|
|
958
|
-
"
|
|
959
|
-
"
|
|
960
|
-
"
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
"
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
"
|
|
974
|
-
"
|
|
975
|
-
"
|
|
976
|
-
"
|
|
977
|
-
"
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
"
|
|
981
|
-
"
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
"
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
"
|
|
992
|
-
"
|
|
993
|
-
"
|
|
994
|
-
"
|
|
995
|
-
"
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
"
|
|
999
|
-
"
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
"
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
"
|
|
1010
|
-
"
|
|
1011
|
-
"
|
|
1012
|
-
"
|
|
1013
|
-
"
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
"
|
|
1017
|
-
"
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
"
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
"
|
|
1028
|
-
"
|
|
1029
|
-
"
|
|
1030
|
-
"
|
|
1031
|
-
"
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
"
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
"
|
|
1045
|
-
"
|
|
1046
|
-
"
|
|
1047
|
-
"
|
|
1048
|
-
"
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
"
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
"
|
|
1062
|
-
"
|
|
1063
|
-
"
|
|
1064
|
-
"
|
|
1065
|
-
"
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
"
|
|
1069
|
-
"
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
"
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
"
|
|
1080
|
-
"
|
|
1081
|
-
"
|
|
1082
|
-
"
|
|
1083
|
-
"
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
"
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
"
|
|
1097
|
-
"
|
|
1098
|
-
"
|
|
1099
|
-
"
|
|
1100
|
-
"
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
"
|
|
1104
|
-
"
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
"
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
"
|
|
1115
|
-
"
|
|
1116
|
-
"
|
|
1117
|
-
"
|
|
1118
|
-
"
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
"
|
|
1122
|
-
"
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
"
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
"
|
|
1133
|
-
"
|
|
1134
|
-
"
|
|
1135
|
-
"
|
|
1136
|
-
"
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
"
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
"
|
|
1150
|
-
"
|
|
1151
|
-
"
|
|
1152
|
-
"
|
|
1153
|
-
"
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
"
|
|
1157
|
-
"
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
"
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
"
|
|
1168
|
-
"
|
|
1169
|
-
"
|
|
1170
|
-
"
|
|
1171
|
-
"
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
"
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
"
|
|
1185
|
-
"
|
|
1186
|
-
"
|
|
1187
|
-
"
|
|
1188
|
-
"
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
"
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
"
|
|
1202
|
-
"
|
|
1203
|
-
"
|
|
1204
|
-
"
|
|
1205
|
-
"
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
"
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
"
|
|
1219
|
-
"
|
|
1220
|
-
"
|
|
1221
|
-
"
|
|
1222
|
-
"
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
"
|
|
1226
|
-
"
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
"
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
"
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
"
|
|
1278
|
-
"
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
"
|
|
1284
|
-
"
|
|
1285
|
-
"
|
|
1286
|
-
"
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
"
|
|
1290
|
-
"
|
|
1291
|
-
"
|
|
1292
|
-
"
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1
|
+
import { h, Host, forceUpdate, } from "@stencil/core";
|
|
2
|
+
import { csvToArray, debounce, generateId, hideTooltip, intl, measureText, safeParseJSON, shouldOpenUp, showTooltip, truncateText, } from "../../global/functions";
|
|
3
|
+
import { globalMessages } from "../../global/intl";
|
|
4
|
+
export class TagInput {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.uid = this.el.id ? this.el.id : generateId();
|
|
7
|
+
this.openUp = false;
|
|
8
|
+
this.debouncedUpdate = debounce(() => forceUpdate(this.el), 30);
|
|
9
|
+
this.label = undefined;
|
|
10
|
+
this.labelPosition = "top";
|
|
11
|
+
this.options = "";
|
|
12
|
+
this.selectedTags = "";
|
|
13
|
+
this.info = undefined;
|
|
14
|
+
this.errorMessage = undefined;
|
|
15
|
+
this.addNew = true;
|
|
16
|
+
this.placeholder = undefined;
|
|
17
|
+
this.requiredField = false;
|
|
18
|
+
this.characterLimit = 50;
|
|
19
|
+
this.maxTags = undefined;
|
|
20
|
+
this.tagInputType = "dropdown";
|
|
21
|
+
this.colHeaders = undefined;
|
|
22
|
+
this.colWidths = undefined;
|
|
23
|
+
this.colWrap = undefined;
|
|
24
|
+
this.messageConfig = "";
|
|
25
|
+
this.focusedListItem = undefined;
|
|
26
|
+
this.focusedTag = null;
|
|
27
|
+
this.tablePosition = { row: 0, column: 1 };
|
|
28
|
+
this.isExpanded = false;
|
|
29
|
+
this.tagsList = csvToArray(this.selectedTags);
|
|
30
|
+
this.optionsList = csvToArray(this.options);
|
|
31
|
+
this.charCount = 0;
|
|
32
|
+
this.liveRegionMessage = "";
|
|
33
|
+
}
|
|
34
|
+
get tooltipVisible() {
|
|
35
|
+
return document.getElementById("wm-tooltip").classList.contains("open");
|
|
36
|
+
}
|
|
37
|
+
get focusedElement() {
|
|
38
|
+
return this.el.shadowRoot.activeElement;
|
|
39
|
+
}
|
|
40
|
+
get listItemEls() {
|
|
41
|
+
return Array.from(this.dropdownEl.querySelectorAll("li"));
|
|
42
|
+
}
|
|
43
|
+
get tagEls() {
|
|
44
|
+
return this.tagAreaEl ? Array.from(this.tagAreaEl.querySelectorAll(".tag")) : [];
|
|
45
|
+
}
|
|
46
|
+
get nonLockedTagEls() {
|
|
47
|
+
return this.tagEls.filter((tag) => !tag.classList.contains("locked"));
|
|
48
|
+
}
|
|
49
|
+
get optionEls() {
|
|
50
|
+
return Array.from(this.dropdownEl.querySelectorAll(".option"));
|
|
51
|
+
}
|
|
52
|
+
get wmRowEls() {
|
|
53
|
+
return Array.from(this.el.querySelectorAll("wm-tag-input-row"));
|
|
54
|
+
}
|
|
55
|
+
get localRowEls() {
|
|
56
|
+
return Array.from(this.el.shadowRoot.querySelectorAll("tr"));
|
|
57
|
+
}
|
|
58
|
+
get filteredRows() {
|
|
59
|
+
return this.wmRowEls.filter((row) => {
|
|
60
|
+
const query = this.inputEl ? this.inputEl.value.toLowerCase() : "";
|
|
61
|
+
const colValues = [row.col1, row.col2, row.col3, row.col4].join("").toLowerCase();
|
|
62
|
+
return colValues.includes(query);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
get nonLockedTagsList() {
|
|
66
|
+
let list = [];
|
|
67
|
+
if (this.tagInputType === "table") {
|
|
68
|
+
this.tagsList.forEach((id) => {
|
|
69
|
+
const correspondingRowEl = this.wmRowEls.filter((row) => id === row.id)[0];
|
|
70
|
+
if (!correspondingRowEl.locked) {
|
|
71
|
+
list.push(id);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
else if (this.tagInputType === "dropdown") {
|
|
76
|
+
list = this.tagsList;
|
|
77
|
+
}
|
|
78
|
+
return list;
|
|
79
|
+
}
|
|
80
|
+
get tagLimitReached() {
|
|
81
|
+
return !!(this.maxTags && this.tagsList.length >= this.maxTags);
|
|
82
|
+
}
|
|
83
|
+
get noResultsMessage() {
|
|
84
|
+
return intl.formatMessage({
|
|
85
|
+
id: "tagInput.noResults",
|
|
86
|
+
defaultMessage: "No results match your search.",
|
|
87
|
+
description: "Message displayed when a user's search returns empty.",
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
get componentMessages() {
|
|
91
|
+
const addNewHelpText = intl.formatMessage({
|
|
92
|
+
id: "tagInput.addNewHelpText",
|
|
93
|
+
defaultMessage: "Press the Enter or Comma key to add a new tag.",
|
|
94
|
+
description: "Help text appearing in a dropdown. Use imperative",
|
|
95
|
+
});
|
|
96
|
+
const selectionHelpText = intl.formatMessage({
|
|
97
|
+
id: "tagInput.selectionHelpText",
|
|
98
|
+
defaultMessage: "Search and select a tag.",
|
|
99
|
+
description: "Help text appearing in a dropdown. Use imperative",
|
|
100
|
+
});
|
|
101
|
+
const maxTagsReachedMessage = intl.formatMessage({
|
|
102
|
+
id: "tagInput.maxTagsReached",
|
|
103
|
+
defaultMessage: "No more tags can be added because the limit has been reached.",
|
|
104
|
+
});
|
|
105
|
+
const tagAreaInstructions = intl.formatMessage({
|
|
106
|
+
id: "tagInput.tagAreaInstructions",
|
|
107
|
+
defaultMessage: "tag selection. Press Backspace or Delete to remove a tag.",
|
|
108
|
+
});
|
|
109
|
+
const tagsAddedMessage = intl.formatMessage({
|
|
110
|
+
id: "tagInput.tagsAdded",
|
|
111
|
+
defaultMessage: "Tags added",
|
|
112
|
+
description: "For the user to understand how close they are to the tag limit, followed by x/y count",
|
|
113
|
+
});
|
|
114
|
+
const defaultConfig = {
|
|
115
|
+
addNewHelpText: addNewHelpText,
|
|
116
|
+
selectionHelpText: selectionHelpText,
|
|
117
|
+
maxTagsReached: maxTagsReachedMessage,
|
|
118
|
+
tagAreaInstructions: tagAreaInstructions,
|
|
119
|
+
tagsAdded: tagsAddedMessage,
|
|
120
|
+
};
|
|
121
|
+
const userProvidedConfig = safeParseJSON(this.messageConfig);
|
|
122
|
+
return userProvidedConfig ? Object.assign(Object.assign({}, defaultConfig), userProvidedConfig) : defaultConfig;
|
|
123
|
+
}
|
|
124
|
+
get inputMinimumWidth() {
|
|
125
|
+
// 150px is the minimum width of the input field, or the length of the placeholder text
|
|
126
|
+
const inputElStyles = getComputedStyle(this.inputEl);
|
|
127
|
+
const tagElStyles = getComputedStyle(this.tagEls[this.tagEls.length - 1]);
|
|
128
|
+
const inputElBuffer = [
|
|
129
|
+
inputElStyles.paddingLeft,
|
|
130
|
+
inputElStyles.paddingRight,
|
|
131
|
+
inputElStyles.marginLeft,
|
|
132
|
+
inputElStyles.marginRight,
|
|
133
|
+
tagElStyles.marginRight,
|
|
134
|
+
].reduce((prev, curr) => prev + parseInt(curr.replace("px", "")), 0);
|
|
135
|
+
const minimumWidth = Math.max(150, measureText(this.inputEl, this.placeholder).width + inputElBuffer);
|
|
136
|
+
return minimumWidth;
|
|
137
|
+
}
|
|
138
|
+
generateTagAddedMessage(tag) {
|
|
139
|
+
return intl.formatMessage({
|
|
140
|
+
id: "tagInput.tagAdded",
|
|
141
|
+
defaultMessage: "{tagName} added.",
|
|
142
|
+
description: "A confirmation for adding a tag.",
|
|
143
|
+
}, { tagName: tag });
|
|
144
|
+
}
|
|
145
|
+
generateTagAlreadyAddedMessage(tag) {
|
|
146
|
+
return intl.formatMessage({
|
|
147
|
+
id: "tagInput.tagAlreadyAdded",
|
|
148
|
+
defaultMessage: "{tagName} has already been added.",
|
|
149
|
+
description: "An alert for adding a tag that is already present.",
|
|
150
|
+
}, { tagName: tag });
|
|
151
|
+
}
|
|
152
|
+
componentWillLoad() {
|
|
153
|
+
if (!this.placeholder) {
|
|
154
|
+
this.placeholder = this.createPlaceholderDefault(this.addNew, !!this.options);
|
|
155
|
+
}
|
|
156
|
+
if (!this.label) {
|
|
157
|
+
console.error("wm-tag-input must have a label property");
|
|
158
|
+
}
|
|
159
|
+
this.consolidateSelectedTags();
|
|
160
|
+
this.el.focus = () => {
|
|
161
|
+
const firstFocusableTag = this.nonLockedTagEls[0];
|
|
162
|
+
if (firstFocusableTag) {
|
|
163
|
+
this.tagAreaEl.focus();
|
|
164
|
+
this.focusTag(firstFocusableTag);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
this.inputEl.focus();
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
// on resize of component, trigger componentDidRender -> positionInput
|
|
171
|
+
const resizeObserver = new ResizeObserver(() => this.debouncedUpdate());
|
|
172
|
+
resizeObserver.observe(this.el);
|
|
173
|
+
}
|
|
174
|
+
componentDidLoad() {
|
|
175
|
+
// prevent highlighting of pre-selected tags
|
|
176
|
+
this.tagEls.forEach((el) => el.classList.remove("highlight"));
|
|
177
|
+
}
|
|
178
|
+
componentDidRender() {
|
|
179
|
+
this.positionInput();
|
|
180
|
+
// check each tag if truncation is needed
|
|
181
|
+
this.tagEls.forEach((tag) => {
|
|
182
|
+
const textEl = tag.querySelector(".tag-text");
|
|
183
|
+
const wrapper = this.el.shadowRoot.querySelector(".tags-and-input-wrapper");
|
|
184
|
+
const leftBound = textEl.getBoundingClientRect().left;
|
|
185
|
+
// the numbers represent spacing values for padding, margin, and delete icon
|
|
186
|
+
const rightBound = wrapper.getBoundingClientRect().right - 10 - 8 - 28;
|
|
187
|
+
let displayText = tag.dataset.tag;
|
|
188
|
+
if (this.tagInputType === "table") {
|
|
189
|
+
// table variant doesn't display the tag id, but the contents of the first column
|
|
190
|
+
const referencedRow = this.el.querySelector(`#${displayText}`);
|
|
191
|
+
displayText = referencedRow ? referencedRow.col1 : "";
|
|
192
|
+
}
|
|
193
|
+
textEl.textContent = truncateText(textEl, displayText, rightBound - leftBound, 5);
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
consolidateSelectedTags() {
|
|
197
|
+
this.tagsList.forEach((tag) => {
|
|
198
|
+
if (!this.includesCaseInsensitive(this.optionsList, tag)) {
|
|
199
|
+
this.options += `${this.options.length > 0 ? "," : ""}${tag}`;
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
this.optionsList = csvToArray(this.options);
|
|
203
|
+
}
|
|
204
|
+
createPlaceholderDefault(addNew, hasOptions) {
|
|
205
|
+
const addAndSearchPlaceholder = intl.formatMessage({
|
|
206
|
+
id: "tagInput.placeholderAddAndSearch",
|
|
207
|
+
defaultMessage: "Add or search for a tag",
|
|
208
|
+
description: "Placeholder text. Use imperative",
|
|
209
|
+
});
|
|
210
|
+
const searchPlaceholder = intl.formatMessage({
|
|
211
|
+
id: "tagInput.placeholderSearch",
|
|
212
|
+
defaultMessage: "Search and select a tag",
|
|
213
|
+
description: "Placeholder text. Use imperative",
|
|
214
|
+
});
|
|
215
|
+
const addPlaceholder = intl.formatMessage({
|
|
216
|
+
id: "tagInput.placeholderAdd",
|
|
217
|
+
defaultMessage: "Add a new tag",
|
|
218
|
+
description: "Placeholder text. Use imperative",
|
|
219
|
+
});
|
|
220
|
+
let placeholder = "";
|
|
221
|
+
if (addNew && hasOptions) {
|
|
222
|
+
placeholder = addAndSearchPlaceholder;
|
|
223
|
+
}
|
|
224
|
+
else if (!addNew && hasOptions) {
|
|
225
|
+
placeholder = searchPlaceholder;
|
|
226
|
+
}
|
|
227
|
+
else if (addNew) {
|
|
228
|
+
placeholder = addPlaceholder;
|
|
229
|
+
}
|
|
230
|
+
return placeholder;
|
|
231
|
+
}
|
|
232
|
+
reflectSelectedTags(newValue, oldValue) {
|
|
233
|
+
const isAddition = newValue.length > oldValue.length;
|
|
234
|
+
let changedTag = "";
|
|
235
|
+
let selectedTags = this.tagsList;
|
|
236
|
+
if (isAddition) {
|
|
237
|
+
changedTag = newValue.filter((val) => !oldValue.includes(val))[0];
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
changedTag = oldValue.filter((val) => !newValue.includes(val))[0];
|
|
241
|
+
}
|
|
242
|
+
// event emitted by type table uses element references instead of strings
|
|
243
|
+
if (this.tagInputType === "table") {
|
|
244
|
+
changedTag = this.wmRowEls.filter((row) => row.id === changedTag)[0];
|
|
245
|
+
selectedTags = this.tagsList.map((id) => this.el.querySelector(`#${id}`));
|
|
246
|
+
}
|
|
247
|
+
this.selectedTags = this.listToCSV(this.tagsList);
|
|
248
|
+
let detail = { value: selectedTags, tagChanged: changedTag };
|
|
249
|
+
this.wmTagInputChanged.emit(detail);
|
|
250
|
+
}
|
|
251
|
+
handleErrorMessageChange() {
|
|
252
|
+
if (this.errorMessage) {
|
|
253
|
+
this.announce(this.errorMessage);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
handleRowUpdate() {
|
|
257
|
+
forceUpdate(this.el);
|
|
258
|
+
}
|
|
259
|
+
closeIfNotElOrChild(ev) {
|
|
260
|
+
const isntElOrChild = ev.target !== this.el && !this.el.shadowRoot.contains(ev.target);
|
|
261
|
+
if (this.tagInputType === "dropdown" && isntElOrChild && this.isExpanded) {
|
|
262
|
+
this.closeDropdown();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// From wm-button
|
|
266
|
+
// we need to listen for scroll events during the capture phase because they do not bubble up
|
|
267
|
+
// there can be layouts where the main content has 100vh and overflows
|
|
268
|
+
// in these cases window will register no scroll events unless we catch on they way down
|
|
269
|
+
dismissTooltip() {
|
|
270
|
+
if (this.tooltipVisible) {
|
|
271
|
+
hideTooltip();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
handleInputKeyDown(ev) {
|
|
275
|
+
if (/^.$/.test(ev.key) && this.inputEl.value.length >= this.characterLimit) {
|
|
276
|
+
this.announce(this.generateCharacterLimitWarning(this.inputEl.value.length, this.characterLimit));
|
|
277
|
+
}
|
|
278
|
+
// prevent keydown triggering on tag area
|
|
279
|
+
ev.stopPropagation();
|
|
280
|
+
switch (ev.key) {
|
|
281
|
+
case "Enter":
|
|
282
|
+
case ",":
|
|
283
|
+
ev.preventDefault();
|
|
284
|
+
this.handleInputEnter();
|
|
285
|
+
break;
|
|
286
|
+
case "ArrowDown":
|
|
287
|
+
ev.preventDefault();
|
|
288
|
+
this.handleInputArrowDown();
|
|
289
|
+
break;
|
|
290
|
+
case "ArrowUp":
|
|
291
|
+
ev.preventDefault();
|
|
292
|
+
this.handleInputArrowUp();
|
|
293
|
+
break;
|
|
294
|
+
case "ArrowLeft":
|
|
295
|
+
if (this.tagInputType === "table" && this.tablePosition.row) {
|
|
296
|
+
ev.preventDefault();
|
|
297
|
+
this.moveLeftCell();
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
case "ArrowRight":
|
|
301
|
+
if (this.tagInputType === "table" && this.tablePosition.row) {
|
|
302
|
+
ev.preventDefault();
|
|
303
|
+
this.moveRightCell();
|
|
304
|
+
}
|
|
305
|
+
break;
|
|
306
|
+
case "Escape":
|
|
307
|
+
if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
308
|
+
this.closeDropdown();
|
|
309
|
+
}
|
|
310
|
+
break;
|
|
311
|
+
case "ArrowLeft":
|
|
312
|
+
case "Backspace":
|
|
313
|
+
this.handleInputBackspace();
|
|
314
|
+
break;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
handleInputFocus() {
|
|
318
|
+
if (this.tagInputType === "dropdown") {
|
|
319
|
+
this.openDropdown();
|
|
320
|
+
this.clearListItemFocus();
|
|
321
|
+
}
|
|
322
|
+
// force update needed to apply styled state of field-wrapper el
|
|
323
|
+
forceUpdate(this.el);
|
|
324
|
+
}
|
|
325
|
+
handleInputChanged(value) {
|
|
326
|
+
this.charCount = value.length;
|
|
327
|
+
if (this.tagInputType === "dropdown") {
|
|
328
|
+
this.clearListItemFocus();
|
|
329
|
+
if (this.charCount >= this.characterLimit - 5) {
|
|
330
|
+
this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
|
|
331
|
+
}
|
|
332
|
+
if (!this.isExpanded) {
|
|
333
|
+
this.openDropdown();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
else if (this.tagInputType === "table") {
|
|
337
|
+
this.clearCellFocus();
|
|
338
|
+
}
|
|
339
|
+
this.announceExistingOptions();
|
|
340
|
+
}
|
|
341
|
+
handleInputEnter() {
|
|
342
|
+
if (this.tagInputType === "dropdown") {
|
|
343
|
+
if (this.focusedListItem) {
|
|
344
|
+
this.handleListItemClick(this.focusedListItem);
|
|
345
|
+
}
|
|
346
|
+
else {
|
|
347
|
+
this.submitInput(this.addNew, this.inputEl.value.trim());
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
else if (this.tagInputType === "table" && this.tablePosition.row > 0) {
|
|
351
|
+
this.handleTableRowClick(this.localRowEls[this.tablePosition.row].id);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
submitInput(canAddNew, value) {
|
|
355
|
+
const hasNonWhiteSpaceCharacters = value.match(/\S/);
|
|
356
|
+
if (canAddNew && hasNonWhiteSpaceCharacters) {
|
|
357
|
+
this.addTag(value);
|
|
358
|
+
this.optionsList = this.addOption(value);
|
|
359
|
+
this.resetInput();
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
handleInputArrowDown() {
|
|
363
|
+
if (this.tagInputType === "table") {
|
|
364
|
+
this.moveDownRow();
|
|
365
|
+
}
|
|
366
|
+
else if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
367
|
+
this.moveDownListItem();
|
|
368
|
+
}
|
|
369
|
+
else if (this.tagInputType === "dropdown") {
|
|
370
|
+
this.openDropdown();
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
handleInputArrowUp() {
|
|
374
|
+
if (this.tagInputType === "table") {
|
|
375
|
+
this.moveUpRow();
|
|
376
|
+
}
|
|
377
|
+
else if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
378
|
+
this.moveUpListItem();
|
|
379
|
+
}
|
|
380
|
+
else if (this.tagInputType === "dropdown") {
|
|
381
|
+
this.openDropdown();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
handleInputBackspace() {
|
|
385
|
+
if (this.inputEl.value === "" && this.tagsList.length > 0) {
|
|
386
|
+
// wait for events to finish firing before redirecting focus
|
|
387
|
+
// prevents double input in input area and tag area
|
|
388
|
+
window.requestAnimationFrame(() => {
|
|
389
|
+
if (this.nonLockedTagsList.length > 0) {
|
|
390
|
+
this.tagAreaEl.focus();
|
|
391
|
+
this.focusTag(this.tagEls[this.tagEls.length - 1]);
|
|
392
|
+
}
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
handleListItemKeyDown(ev) {
|
|
397
|
+
const typedEvTarget = ev.target;
|
|
398
|
+
switch (ev.key) {
|
|
399
|
+
case "Enter":
|
|
400
|
+
case " ":
|
|
401
|
+
ev.preventDefault();
|
|
402
|
+
typedEvTarget.click();
|
|
403
|
+
break;
|
|
404
|
+
case "ArrowDown":
|
|
405
|
+
ev.preventDefault();
|
|
406
|
+
this.moveDownListItem();
|
|
407
|
+
break;
|
|
408
|
+
case "ArrowUp":
|
|
409
|
+
ev.preventDefault();
|
|
410
|
+
this.moveUpListItem();
|
|
411
|
+
break;
|
|
412
|
+
case "Escape":
|
|
413
|
+
if (this.focusedElement !== this.inputEl) {
|
|
414
|
+
this.inputEl.focus();
|
|
415
|
+
}
|
|
416
|
+
else if (this.tagInputType === "dropdown") {
|
|
417
|
+
this.closeDropdown();
|
|
418
|
+
}
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
handleListItemClick(item) {
|
|
423
|
+
const tag = item.dataset.option.trim() || "";
|
|
424
|
+
if (this.includesCaseInsensitive(this.tagsList, tag)) {
|
|
425
|
+
this.announce(this.generateTagAlreadyAddedMessage(tag));
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
this.resetInput();
|
|
429
|
+
this.addTag(tag);
|
|
430
|
+
this.optionsList = this.addOption(tag);
|
|
431
|
+
this.focusedListItem = null;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
handleTableRowClick(rowId) {
|
|
435
|
+
const referencedRow = this.el.querySelector(`#${rowId}`);
|
|
436
|
+
const isLocked = referencedRow.locked;
|
|
437
|
+
if (!isLocked) {
|
|
438
|
+
if (this.includesCaseInsensitive(this.tagsList, rowId)) {
|
|
439
|
+
this.removeTag(rowId);
|
|
440
|
+
}
|
|
441
|
+
else if (!this.tagLimitReached) {
|
|
442
|
+
this.addTag(rowId);
|
|
443
|
+
this.resetInput();
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
handleTagAreaKeyDown(ev) {
|
|
448
|
+
switch (ev.key) {
|
|
449
|
+
case "ArrowLeft":
|
|
450
|
+
case "ArrowUp":
|
|
451
|
+
ev.preventDefault();
|
|
452
|
+
this.moveLeftTag();
|
|
453
|
+
break;
|
|
454
|
+
case "ArrowRight":
|
|
455
|
+
case "ArrowDown":
|
|
456
|
+
ev.preventDefault();
|
|
457
|
+
this.moveRightTag();
|
|
458
|
+
break;
|
|
459
|
+
case "Backspace":
|
|
460
|
+
case "Delete":
|
|
461
|
+
this.handleTagAreaDelete();
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
handleTagAreaDelete() {
|
|
466
|
+
const isLocked = this.focusedTag && this.focusedTag.classList.contains("locked");
|
|
467
|
+
if (this.focusedTag && !isLocked) {
|
|
468
|
+
this.removeTag(this.focusedTag.dataset.tag);
|
|
469
|
+
if (this.nonLockedTagsList.length === 0) {
|
|
470
|
+
// focus input if no tags are left
|
|
471
|
+
this.inputEl.focus();
|
|
472
|
+
}
|
|
473
|
+
else {
|
|
474
|
+
const removingLastTag = this.focusedTag === this.tagEls[this.tagEls.length - 1];
|
|
475
|
+
// if removing the last tag, reassign focused tag to previous task
|
|
476
|
+
this.focusedTag = removingLastTag ? this.tagEls[this.tagEls.length - 2] : this.focusedTag;
|
|
477
|
+
this.focusTag(this.focusedTag);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
handleBlur(ev, component) {
|
|
482
|
+
const isntElOrChild = ev.relatedTarget !== component && !this.el.shadowRoot.contains(ev.relatedTarget);
|
|
483
|
+
this.dismissTooltip();
|
|
484
|
+
this.clearCellFocus();
|
|
485
|
+
if (isntElOrChild) {
|
|
486
|
+
this.fieldWrapperEl.classList.remove("focused");
|
|
487
|
+
if (this.tagInputType === "dropdown") {
|
|
488
|
+
this.closeDropdown();
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
handleCellMouseEnter(ev) {
|
|
493
|
+
const cell = ev.target;
|
|
494
|
+
const contentWrapper = cell.querySelector(".cell-content-wrapper");
|
|
495
|
+
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
496
|
+
if (isTruncated) {
|
|
497
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
498
|
+
showTooltip("bottom", cell, cell.innerText);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
handleTagAreaFocus() {
|
|
502
|
+
if (this.tagInputType === "dropdown") {
|
|
503
|
+
this.closeDropdown();
|
|
504
|
+
}
|
|
505
|
+
const firstFocusableTag = this.nonLockedTagEls[0];
|
|
506
|
+
firstFocusableTag && this.focusTag(firstFocusableTag);
|
|
507
|
+
}
|
|
508
|
+
handleRemoveButtonClick(tag) {
|
|
509
|
+
this.moveLeftTag();
|
|
510
|
+
this.removeTag(tag);
|
|
511
|
+
}
|
|
512
|
+
moveDownListItem() {
|
|
513
|
+
if (this.listItemEls.length > 0) {
|
|
514
|
+
const firstListItem = this.listItemEls[0];
|
|
515
|
+
if (!this.focusedListItem) {
|
|
516
|
+
this.focusListItem(firstListItem);
|
|
517
|
+
}
|
|
518
|
+
else if (this.focusedListItem.nextElementSibling) {
|
|
519
|
+
this.focusListItem(this.focusedListItem.nextElementSibling);
|
|
520
|
+
}
|
|
521
|
+
else {
|
|
522
|
+
this.focusListItem(firstListItem);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
moveUpListItem() {
|
|
527
|
+
if (this.listItemEls.length > 0) {
|
|
528
|
+
const lastListItem = this.listItemEls[this.listItemEls.length - 1];
|
|
529
|
+
if (!this.focusedListItem) {
|
|
530
|
+
this.focusListItem(lastListItem);
|
|
531
|
+
}
|
|
532
|
+
else if (this.focusedListItem.previousElementSibling) {
|
|
533
|
+
this.focusListItem(this.focusedListItem.previousElementSibling);
|
|
534
|
+
}
|
|
535
|
+
else {
|
|
536
|
+
this.clearListItemFocus();
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
moveDownRow() {
|
|
541
|
+
if (this.filteredRows.length > 0) {
|
|
542
|
+
if (this.tablePosition.row === 0) {
|
|
543
|
+
this.tablePosition.row = 1;
|
|
544
|
+
}
|
|
545
|
+
else if (this.tablePosition.row === this.filteredRows.length) {
|
|
546
|
+
this.tablePosition.row = 1;
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
this.tablePosition.row++;
|
|
550
|
+
}
|
|
551
|
+
// skip locked rows
|
|
552
|
+
const rowToFocus = this.filteredRows[this.tablePosition.row - 1];
|
|
553
|
+
if (rowToFocus.locked) {
|
|
554
|
+
this.moveDownRow();
|
|
555
|
+
}
|
|
556
|
+
else {
|
|
557
|
+
this.focusCell(this.tablePosition);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
moveUpRow() {
|
|
562
|
+
if (this.filteredRows.length > 0) {
|
|
563
|
+
if (this.tablePosition.row === 0) {
|
|
564
|
+
this.tablePosition.row = this.filteredRows.length;
|
|
565
|
+
}
|
|
566
|
+
else if (this.tablePosition.row === 1) {
|
|
567
|
+
this.tablePosition.row = 0;
|
|
568
|
+
}
|
|
569
|
+
else {
|
|
570
|
+
this.tablePosition.row--;
|
|
571
|
+
}
|
|
572
|
+
// skip locked rows
|
|
573
|
+
const rowToFocus = this.filteredRows[this.tablePosition.row - 1];
|
|
574
|
+
if (rowToFocus && rowToFocus.locked) {
|
|
575
|
+
this.moveUpRow();
|
|
576
|
+
}
|
|
577
|
+
else if (rowToFocus) {
|
|
578
|
+
this.focusCell(this.tablePosition);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
this.clearCellFocus();
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
moveLeftCell() {
|
|
586
|
+
if (this.tablePosition.column != 1) {
|
|
587
|
+
this.tablePosition.column--;
|
|
588
|
+
this.focusCell(this.tablePosition);
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
moveRightCell() {
|
|
592
|
+
const numCols = csvToArray(this.colHeaders).length;
|
|
593
|
+
if (this.tablePosition.column < numCols) {
|
|
594
|
+
this.tablePosition.column++;
|
|
595
|
+
this.focusCell(this.tablePosition);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
moveLeftTag() {
|
|
599
|
+
const lastTag = this.tagEls[this.tagEls.length - 1];
|
|
600
|
+
if (this.focusedTag && this.tagEls.includes(this.focusedTag.previousElementSibling)) {
|
|
601
|
+
this.focusedTag = this.focusedTag.previousElementSibling;
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
this.focusedTag = lastTag;
|
|
605
|
+
}
|
|
606
|
+
// skip locked tags
|
|
607
|
+
if (this.focusedTag.classList.contains("locked") && this.nonLockedTagEls.length > 0) {
|
|
608
|
+
this.moveLeftTag();
|
|
609
|
+
}
|
|
610
|
+
else {
|
|
611
|
+
this.focusTag(this.focusedTag);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
moveRightTag() {
|
|
615
|
+
const firstTag = this.tagEls[0];
|
|
616
|
+
if (this.focusedTag && this.tagEls.includes(this.focusedTag.nextElementSibling)) {
|
|
617
|
+
this.focusedTag = this.focusedTag.nextElementSibling;
|
|
618
|
+
}
|
|
619
|
+
else {
|
|
620
|
+
this.focusedTag = firstTag;
|
|
621
|
+
}
|
|
622
|
+
// skip locked tags
|
|
623
|
+
if (this.focusedTag.classList.contains("locked")) {
|
|
624
|
+
this.moveRightTag();
|
|
625
|
+
}
|
|
626
|
+
else {
|
|
627
|
+
this.focusTag(this.focusedTag);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
addOption(option) {
|
|
631
|
+
let newOptionsList = this.optionsList;
|
|
632
|
+
const optionAlreadyExists = this.includesCaseInsensitive(this.optionsList, option);
|
|
633
|
+
if (!optionAlreadyExists) {
|
|
634
|
+
newOptionsList = newOptionsList.concat(option);
|
|
635
|
+
}
|
|
636
|
+
return newOptionsList;
|
|
637
|
+
}
|
|
638
|
+
removeOption(option) {
|
|
639
|
+
this.optionsList = this.filterCaseInsensitive(this.optionsList, option);
|
|
640
|
+
}
|
|
641
|
+
addTag(tag) {
|
|
642
|
+
let newTagsList = this.tagsList;
|
|
643
|
+
const tagAlreadyAdded = this.includesCaseInsensitive(this.tagsList, tag);
|
|
644
|
+
const tagExistsAsOption = this.optionsList.filter((x) => x.toLowerCase() === tag.toLowerCase())[0];
|
|
645
|
+
if (!tagAlreadyAdded) {
|
|
646
|
+
let textToAnnounce = tag;
|
|
647
|
+
if (this.tagInputType === "table") {
|
|
648
|
+
const referencedRow = this.el.querySelector(`#${tag}`);
|
|
649
|
+
textToAnnounce = referencedRow.col1;
|
|
650
|
+
}
|
|
651
|
+
this.announce(this.generateTagAddedMessage(textToAnnounce));
|
|
652
|
+
this.tagsList = newTagsList.concat(tagExistsAsOption || tag);
|
|
653
|
+
// if maxTags has been reached, focus should go to the tagArea
|
|
654
|
+
// otherwise, input field should be focused and in view
|
|
655
|
+
if (this.tagLimitReached) {
|
|
656
|
+
this.tagAreaEl.focus();
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
// wait for component to render new selected tag before bringing bottom of wrapper in view
|
|
660
|
+
window.requestAnimationFrame(() => (this.tagsAndInputWrapperEl.scrollTop = this.tagsAndInputWrapperEl.scrollHeight));
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
removeTag(tag) {
|
|
665
|
+
let textToAnnounce = tag;
|
|
666
|
+
if (this.tagInputType === "table") {
|
|
667
|
+
const referencedRow = this.el.querySelector(`#${tag}`);
|
|
668
|
+
textToAnnounce = referencedRow.col1;
|
|
669
|
+
}
|
|
670
|
+
const tagRemovedMessage = intl.formatMessage({ id: "tagInput.tagRemoved", defaultMessage: "{tag} removed" }, { tag: textToAnnounce });
|
|
671
|
+
this.announce(tagRemovedMessage);
|
|
672
|
+
this.tagsList = this.filterCaseInsensitive(this.tagsList, tag);
|
|
673
|
+
if (this.tagInputType === "dropdown") {
|
|
674
|
+
// if a tag was introduced by the user, also remove it from the dropdown options
|
|
675
|
+
const devOptionsList = csvToArray(this.options);
|
|
676
|
+
if (this.includesCaseInsensitive(this.optionsList, tag) && !this.includesCaseInsensitive(devOptionsList, tag)) {
|
|
677
|
+
this.removeOption(tag);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
focusListItem(item) {
|
|
682
|
+
this.focusedListItem = item;
|
|
683
|
+
this.inputEl.setAttribute("aria-activedescendant", this.focusedListItem.id);
|
|
684
|
+
item.scrollIntoView({ block: "nearest" });
|
|
685
|
+
}
|
|
686
|
+
focusTag(element) {
|
|
687
|
+
if (element.classList.contains("locked")) {
|
|
688
|
+
this.focusedTag = null;
|
|
689
|
+
this.tagAreaEl.setAttribute("aria-activedescendant", "");
|
|
690
|
+
}
|
|
691
|
+
else {
|
|
692
|
+
this.focusedTag = element;
|
|
693
|
+
this.tagAreaEl.setAttribute("aria-activedescendant", this.focusedTag.id);
|
|
694
|
+
this.focusedTag.scrollIntoView({ block: "nearest" });
|
|
695
|
+
}
|
|
696
|
+
window.requestAnimationFrame(() => {
|
|
697
|
+
hideTooltip();
|
|
698
|
+
const textEl = element.querySelector(".tag-text");
|
|
699
|
+
const fullText = element.dataset.tag;
|
|
700
|
+
const isTruncated = fullText !== textEl.textContent && textEl.textContent.includes("...");
|
|
701
|
+
isTruncated && showTooltip("bottom", element, fullText);
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
focusCell(position) {
|
|
705
|
+
this.clearCellFocus(false);
|
|
706
|
+
if (position.row) {
|
|
707
|
+
const rowToFocus = this.localRowEls[position.row];
|
|
708
|
+
const rowCells = rowToFocus.querySelectorAll("td");
|
|
709
|
+
const cellToFocus = rowCells[position.column - 1];
|
|
710
|
+
const contentWrapper = cellToFocus.querySelector(".cell-content-wrapper");
|
|
711
|
+
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
712
|
+
rowToFocus.classList.add("focused");
|
|
713
|
+
cellToFocus.classList.add("focused");
|
|
714
|
+
cellToFocus.scrollIntoView({ block: "nearest" });
|
|
715
|
+
this.inputEl.setAttribute("aria-activedescendant", cellToFocus.id);
|
|
716
|
+
this.dismissTooltip();
|
|
717
|
+
if (isTruncated) {
|
|
718
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
719
|
+
showTooltip("bottom", cellToFocus, cellToFocus.innerText);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
clearTagFocus() {
|
|
724
|
+
this.tagAreaEl.setAttribute("aria-activedescendant", "");
|
|
725
|
+
this.focusedTag = null;
|
|
726
|
+
}
|
|
727
|
+
clearCellFocus(resetPosition = true) {
|
|
728
|
+
this.inputEl.setAttribute("aria-activedescendant", "");
|
|
729
|
+
if (resetPosition) {
|
|
730
|
+
this.tablePosition = { row: 0, column: 1 };
|
|
731
|
+
}
|
|
732
|
+
this.localRowEls.forEach((row) => {
|
|
733
|
+
row.classList.remove("focused");
|
|
734
|
+
row.querySelectorAll("td").forEach((cell) => {
|
|
735
|
+
cell.classList.remove("focused");
|
|
736
|
+
});
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
openDropdown() {
|
|
740
|
+
// offset of -2px to avoid overlapping the focus border
|
|
741
|
+
this.openUp = shouldOpenUp(this.el, this.dropdownEl.clientHeight, this.el.clientHeight, -2);
|
|
742
|
+
this.isExpanded = true;
|
|
743
|
+
}
|
|
744
|
+
closeDropdown() {
|
|
745
|
+
this.clearListItemFocus();
|
|
746
|
+
this.isExpanded = false;
|
|
747
|
+
}
|
|
748
|
+
clearListItemFocus() {
|
|
749
|
+
this.focusedListItem = null;
|
|
750
|
+
this.inputEl.setAttribute("aria-activedescendant", "");
|
|
751
|
+
this.listItemEls.forEach((el) => {
|
|
752
|
+
el.classList.remove("focused");
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
resetInput() {
|
|
756
|
+
this.charCount = 0;
|
|
757
|
+
this.inputEl.value = "";
|
|
758
|
+
}
|
|
759
|
+
announce(message) {
|
|
760
|
+
// \u00A0 is a non-breaking space character, which causes the message to be read as a new one
|
|
761
|
+
if (this.liveRegionEl.textContent === message) {
|
|
762
|
+
message += "\u00A0";
|
|
763
|
+
}
|
|
764
|
+
this.liveRegionMessage = message;
|
|
765
|
+
}
|
|
766
|
+
announceExistingOptions() {
|
|
767
|
+
// request animation frame to wait for re-rendering of filtered options
|
|
768
|
+
window.requestAnimationFrame(() => {
|
|
769
|
+
let numResults = 0;
|
|
770
|
+
if (this.tagInputType === "dropdown") {
|
|
771
|
+
numResults = this.optionEls.length;
|
|
772
|
+
}
|
|
773
|
+
else if (this.tagInputType === "table") {
|
|
774
|
+
numResults = this.filteredRows.length;
|
|
775
|
+
}
|
|
776
|
+
const existingOptionsMessage = intl.formatMessage({
|
|
777
|
+
id: "tagInput.existingOptions",
|
|
778
|
+
defaultMessage: "{num, plural, one {1 existing option.} other {# existing options.}}",
|
|
779
|
+
}, { num: numResults });
|
|
780
|
+
this.announce(existingOptionsMessage);
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
generateCharacterLimitWarning(charCount, charLimit) {
|
|
784
|
+
let message = globalMessages.getCharactersEntered(charCount, charLimit);
|
|
785
|
+
if (charCount >= charLimit) {
|
|
786
|
+
message += ` ${globalMessages.characterLimitReached}`;
|
|
787
|
+
}
|
|
788
|
+
return message;
|
|
789
|
+
}
|
|
790
|
+
positionInput() {
|
|
791
|
+
const lastTag = this.tagEls[this.tagEls.length - 1];
|
|
792
|
+
// default placement to fall back to when no tags are present, or not enough space is available
|
|
793
|
+
this.inputEl.style.position = "static";
|
|
794
|
+
this.inputEl.style.width = "100%";
|
|
795
|
+
this.inputEl.classList.add("extended");
|
|
796
|
+
if (lastTag) {
|
|
797
|
+
const spaceAvailable = this.tagAreaEl.getBoundingClientRect().right - lastTag.getBoundingClientRect().right;
|
|
798
|
+
if (spaceAvailable >= this.inputMinimumWidth) {
|
|
799
|
+
// because the input has right: 0px
|
|
800
|
+
// all thats needed to properly place it is setting position: absolute, top, and width
|
|
801
|
+
this.inputEl.style.position = "absolute";
|
|
802
|
+
this.inputEl.style.top = lastTag.offsetTop.toString() + "px";
|
|
803
|
+
this.inputEl.style.width = (spaceAvailable - 8).toString() + "px";
|
|
804
|
+
this.inputEl.classList.remove("extended");
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
handleTagMouseEnter(ev) {
|
|
809
|
+
const displayedText = ev.target.querySelector(".tag-text").textContent;
|
|
810
|
+
const fullText = ev.target.dataset.tag;
|
|
811
|
+
const isTruncated = displayedText !== fullText && displayedText.includes("...");
|
|
812
|
+
isTruncated && showTooltip("bottom", ev.target, fullText);
|
|
813
|
+
}
|
|
814
|
+
/// Helpers
|
|
815
|
+
listToCSV(list) {
|
|
816
|
+
return list.join(",");
|
|
817
|
+
}
|
|
818
|
+
includesCaseInsensitive(list, element) {
|
|
819
|
+
const lowercaseList = list.map((str) => str.toLowerCase());
|
|
820
|
+
return lowercaseList.includes(element.toLowerCase());
|
|
821
|
+
}
|
|
822
|
+
filterCaseInsensitive(list, element) {
|
|
823
|
+
return list.filter((x) => x.toLowerCase() !== element.toLowerCase());
|
|
824
|
+
}
|
|
825
|
+
sortCaseInsensitive(list) {
|
|
826
|
+
// The vanilla .sort method places words that start with capital letters above others (ASCII order)
|
|
827
|
+
// so we need to pass in our own compare function to sort case-insensitive
|
|
828
|
+
return list.sort((a, b) => {
|
|
829
|
+
a = a.toLowerCase();
|
|
830
|
+
b = b.toLowerCase();
|
|
831
|
+
return a > b ? 1 : a < b ? -1 : 0;
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
/// Renders
|
|
835
|
+
renderTags() {
|
|
836
|
+
let lockedTags = [];
|
|
837
|
+
let unlockedTags = [];
|
|
838
|
+
this.tagsList.forEach((tag, idx) => {
|
|
839
|
+
const id = `tag${idx + 1}`;
|
|
840
|
+
let tagText = "";
|
|
841
|
+
let isLocked = false;
|
|
842
|
+
if (this.tagInputType === "dropdown") {
|
|
843
|
+
tagText = tag;
|
|
844
|
+
}
|
|
845
|
+
else if (this.tagInputType === "table") {
|
|
846
|
+
// display table tags using col1 of the row with the same id
|
|
847
|
+
// if one can't be found, display as empty
|
|
848
|
+
const referencedRow = this.el.querySelector(`#${tag}`);
|
|
849
|
+
tagText = referencedRow ? referencedRow.col1 : "";
|
|
850
|
+
isLocked = referencedRow ? referencedRow.locked : false;
|
|
851
|
+
}
|
|
852
|
+
// make sure locked tags always appear in front of list
|
|
853
|
+
const targetList = isLocked ? lockedTags : unlockedTags;
|
|
854
|
+
targetList.push(h("li", { id: id, class: `tag highlight ${this.focusedTag && this.focusedTag.id === id ? "focused" : ""} ${isLocked ? "locked" : ""}`, "data-tag": tag, role: "option", onMouseEnter: (ev) => this.handleTagMouseEnter(ev), onMouseLeave: hideTooltip }, h("span", { class: "sr-only" }, tag), h("span", { class: "tag-text", "aria-hidden": "true" }, tagText), isLocked ? (h("div", { class: "icon lock" })) : (h("button", { class: "icon remove-btn", tabIndex: -1, onClick: () => this.handleRemoveButtonClick(tag) }))));
|
|
855
|
+
});
|
|
856
|
+
return [...lockedTags, ...unlockedTags];
|
|
857
|
+
}
|
|
858
|
+
renderDropdown() {
|
|
859
|
+
return (h("div", { class: `dropdown-wrapper ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, ref: (el) => (this.dropdownEl = el) }, h("div", { id: "help-text", class: "help-text" }, this.renderHelpText()), h("ul", { class: "dropdown", id: "dropdown", role: "listbox", "aria-multiselectable": "true", "aria-expanded": this.isExpanded ? "true" : false, "aria-label": this.label, tabindex: -1 }, this.inputEl && this.renderAddNewButton(), this.renderListItems(this.optionsList))));
|
|
860
|
+
}
|
|
861
|
+
renderListItems(optionsList) {
|
|
862
|
+
optionsList = this.sortCaseInsensitive(optionsList);
|
|
863
|
+
// filter by input
|
|
864
|
+
if (this.inputEl && this.inputEl.value) {
|
|
865
|
+
optionsList = this.optionsList.filter((option) => option.toLowerCase().includes(this.inputEl.value.toLowerCase()));
|
|
866
|
+
}
|
|
867
|
+
return optionsList.map((option, idx) => {
|
|
868
|
+
const id = `option${idx + 1}`;
|
|
869
|
+
const isFocused = this.focusedListItem && this.focusedListItem.id === id;
|
|
870
|
+
const isSelected = this.includesCaseInsensitive(this.tagsList, option);
|
|
871
|
+
return (h("li", { class: `option ${isFocused ? "focused" : ""}`, role: "option", id: id, "data-option": option, "aria-selected": isSelected ? "true" : "false", "aria-disabled": isSelected ? "true" : "false", onKeyDown: (ev) => this.handleListItemKeyDown(ev), onBlur: (ev) => this.handleBlur(ev, this.el), onClick: (ev) => this.handleListItemClick(ev.target) }, option));
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
renderAddNewButton() {
|
|
875
|
+
const hasNonWhiteSpaceCharacters = this.inputEl.value.match(/\S/);
|
|
876
|
+
const optionAlreadyExists = this.includesCaseInsensitive(this.optionsList, this.inputEl.value.trim());
|
|
877
|
+
if (this.addNew && hasNonWhiteSpaceCharacters && !optionAlreadyExists) {
|
|
878
|
+
const id = `add-new-btn`;
|
|
879
|
+
const isFocused = this.focusedListItem && this.focusedListItem.id === id;
|
|
880
|
+
return (h("li", { role: "option", class: `add-new-btn ${isFocused ? "focused" : ""}`, id: id, "data-option": this.inputEl.value, onKeyDown: (ev) => this.handleListItemKeyDown(ev), onBlur: (ev) => this.handleBlur(ev, this.el), onClick: (ev) => this.handleListItemClick(ev.target), tabIndex: isFocused ? 0 : -1 }, `Add "${this.inputEl.value.trim()}"`));
|
|
881
|
+
}
|
|
882
|
+
else
|
|
883
|
+
return "";
|
|
884
|
+
}
|
|
885
|
+
renderHelpText() {
|
|
886
|
+
let helpText = "";
|
|
887
|
+
if (this.optionsList.length > 0) {
|
|
888
|
+
helpText += this.componentMessages.selectionHelpText;
|
|
889
|
+
}
|
|
890
|
+
if (this.addNew) {
|
|
891
|
+
helpText += " " + this.componentMessages.addNewHelpText;
|
|
892
|
+
}
|
|
893
|
+
return helpText;
|
|
894
|
+
}
|
|
895
|
+
renderTagCounter() {
|
|
896
|
+
if (this.maxTags) {
|
|
897
|
+
return (h("div", { class: "lower-row" }, h("div", { id: "max-tags" }, `${this.componentMessages.tagsAdded}: ${this.tagsList.length}/${this.maxTags}`, this.tagLimitReached && ` - ${this.componentMessages.maxTagsReached}`)));
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
renderTable() {
|
|
901
|
+
return (h("div", { class: "table-wrapper", onScroll: () => this.dismissTooltip() }, h("table", { id: "table", role: "grid", class: `${this.colWidths ? "fixed-widths" : ""}`, "aria-label": this.label, "aria-multiselectable": "true" }, this.renderTableHeaders(), this.filteredRows.length ? this.renderTableRows() : h("div", { class: "no-results" }, this.noResultsMessage))));
|
|
902
|
+
}
|
|
903
|
+
renderTableHeaders() {
|
|
904
|
+
return (h("tr", { class: "headers", role: "row" }, csvToArray(this.colHeaders).map((header, idx) => {
|
|
905
|
+
let overflowRule = "wrap";
|
|
906
|
+
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
907
|
+
overflowRule = csvToArray(this.colWrap)[idx];
|
|
908
|
+
}
|
|
909
|
+
return (h("th", { class: `header-cell ${overflowRule}`, role: "columnheader",
|
|
910
|
+
// @ts-ignore
|
|
911
|
+
width: this.colWidths ? csvToArray(this.colWidths)[idx] : "" }, header));
|
|
912
|
+
})));
|
|
913
|
+
}
|
|
914
|
+
renderTableRows() {
|
|
915
|
+
return this.filteredRows.map((row) => {
|
|
916
|
+
const isSelected = this.includesCaseInsensitive(this.tagsList, row.id);
|
|
917
|
+
return (h("tr", { id: row.id, class: `${row.locked ? "locked" : ""} ${isSelected ? "selected" : ""}`, role: "row", onClick: () => this.handleTableRowClick(row.id) }, this.renderTableCells(row)));
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
renderTableCells(row) {
|
|
921
|
+
const colValues = [row.col1, row.col2, row.col3, row.col4].filter((val) => !!val);
|
|
922
|
+
const isSelected = this.includesCaseInsensitive(this.tagsList, row.id);
|
|
923
|
+
return colValues.map((val, idx) => {
|
|
924
|
+
const localId = `${row.id}-col${idx + 1}`;
|
|
925
|
+
let overflowRule = "wrap";
|
|
926
|
+
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
927
|
+
overflowRule = csvToArray(this.colWrap)[idx];
|
|
928
|
+
}
|
|
929
|
+
return (h("td", { id: localId, role: "gridcell", "aria-describedby": `${localId}-description`, "aria-selected": isSelected.toString(), onMouseEnter: (ev) => this.handleCellMouseEnter(ev), onMouseLeave: () => this.dismissTooltip() }, h("div", { class: `cell-content-wrapper ${overflowRule}` }, val), h("div", { class: "description", id: `${localId}-description` }, row.locked ? "locked" : "")));
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
render() {
|
|
933
|
+
return (h(Host, { id: this.uid }, h("div", { class: `wrapper label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { class: "label-wrapper" }, h("label", { class: "label", htmlFor: `input${this.uid}` }, this.label, this.requiredField && (h("span", { class: "required", "aria-hidden": "true" }, "*")))), h("div", { class: `field-wrapper ${this.focusedElement ? "focused" : ""} ${this.errorMessage ? "invalid" : ""}`, ref: (el) => (this.fieldWrapperEl = el) }, h("div", { class: "upper-row" }, h("div", { class: "tags-and-input-wrapper", ref: (el) => (this.tagsAndInputWrapperEl = el) }, this.tagsList.length > 0 && (h("ul", { ref: (el) => (this.tagAreaEl = el), class: "tag-area", role: "listbox", "aria-activedescendant": "", "aria-orientation": "horizontal", "aria-label": `${this.label} ${this.tagsList.length > 0 ? this.componentMessages.tagAreaInstructions : ""}`, tabindex: this.nonLockedTagsList.length > 0 ? 0 : -1, "aria-describedby": `info max-tags`, onFocus: () => this.handleTagAreaFocus(), onBlur: (ev) => {
|
|
934
|
+
this.clearTagFocus();
|
|
935
|
+
this.handleBlur(ev, this.el);
|
|
936
|
+
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags())), h("input", { id: `input${this.uid}`, class: `input ${this.tagLimitReached ? "hidden" : ""}`, role: "combobox", ref: (el) => (this.inputEl = el), autocomplete: "off", "aria-required": this.requiredField ? "true" : null, "aria-controls": this.tagInputType, "aria-describedby": `help-text${this.errorMessage ? " error " : ""}`, "aria-label": `${this.label} ${this.tagInputType === "dropdown" ? globalMessages.getCharacterLimit(this.characterLimit) : ""}`, "aria-expanded": this.tagInputType === "dropdown" ? this.isExpanded.toString() : null, placeholder: this.placeholder, maxLength: this.tagInputType === "dropdown" ? this.characterLimit : undefined, onInput: () => this.handleInputChanged(this.inputEl.value), onBlur: (ev) => {
|
|
937
|
+
this.handleBlur(ev, this.el);
|
|
938
|
+
}, onFocus: () => this.handleInputFocus(), onKeyDown: (ev) => this.handleInputKeyDown(ev) })), this.tagInputType === "dropdown" && (h("div", { class: "character-count" }, this.charCount, "/", this.characterLimit))), this.renderTagCounter(), this.tagInputType === "dropdown" && this.renderDropdown()), this.info && (h("div", { id: "info", class: "info-text" }, this.info)), this.errorMessage && h("div", { id: "error" }, this.errorMessage), h("div", { class: "sr-only", "aria-live": "assertive", ref: (el) => (this.liveRegionEl = el), "aria-atomic": "true" }, this.liveRegionMessage), this.tagInputType === "table" && this.renderTable())));
|
|
939
|
+
}
|
|
940
|
+
static get is() { return "wm-tag-input"; }
|
|
941
|
+
static get encapsulation() { return "shadow"; }
|
|
942
|
+
static get delegatesFocus() { return true; }
|
|
943
|
+
static get originalStyleUrls() {
|
|
944
|
+
return {
|
|
945
|
+
"$": ["wm-tag-input.scss"]
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
static get styleUrls() {
|
|
949
|
+
return {
|
|
950
|
+
"$": ["wm-tag-input.css"]
|
|
951
|
+
};
|
|
952
|
+
}
|
|
953
|
+
static get properties() {
|
|
954
|
+
return {
|
|
955
|
+
"label": {
|
|
956
|
+
"type": "string",
|
|
957
|
+
"mutable": false,
|
|
958
|
+
"complexType": {
|
|
959
|
+
"original": "string",
|
|
960
|
+
"resolved": "string",
|
|
961
|
+
"references": {}
|
|
962
|
+
},
|
|
963
|
+
"required": true,
|
|
964
|
+
"optional": false,
|
|
965
|
+
"docs": {
|
|
966
|
+
"tags": [],
|
|
967
|
+
"text": ""
|
|
968
|
+
},
|
|
969
|
+
"attribute": "label",
|
|
970
|
+
"reflect": false
|
|
971
|
+
},
|
|
972
|
+
"labelPosition": {
|
|
973
|
+
"type": "string",
|
|
974
|
+
"mutable": false,
|
|
975
|
+
"complexType": {
|
|
976
|
+
"original": "\"top\" | \"left\" | \"none\"",
|
|
977
|
+
"resolved": "\"left\" | \"none\" | \"top\"",
|
|
978
|
+
"references": {}
|
|
979
|
+
},
|
|
980
|
+
"required": false,
|
|
981
|
+
"optional": false,
|
|
982
|
+
"docs": {
|
|
983
|
+
"tags": [],
|
|
984
|
+
"text": ""
|
|
985
|
+
},
|
|
986
|
+
"attribute": "label-position",
|
|
987
|
+
"reflect": false,
|
|
988
|
+
"defaultValue": "\"top\""
|
|
989
|
+
},
|
|
990
|
+
"options": {
|
|
991
|
+
"type": "string",
|
|
992
|
+
"mutable": true,
|
|
993
|
+
"complexType": {
|
|
994
|
+
"original": "string",
|
|
995
|
+
"resolved": "string",
|
|
996
|
+
"references": {}
|
|
997
|
+
},
|
|
998
|
+
"required": false,
|
|
999
|
+
"optional": false,
|
|
1000
|
+
"docs": {
|
|
1001
|
+
"tags": [],
|
|
1002
|
+
"text": ""
|
|
1003
|
+
},
|
|
1004
|
+
"attribute": "options",
|
|
1005
|
+
"reflect": false,
|
|
1006
|
+
"defaultValue": "\"\""
|
|
1007
|
+
},
|
|
1008
|
+
"selectedTags": {
|
|
1009
|
+
"type": "string",
|
|
1010
|
+
"mutable": true,
|
|
1011
|
+
"complexType": {
|
|
1012
|
+
"original": "string",
|
|
1013
|
+
"resolved": "string",
|
|
1014
|
+
"references": {}
|
|
1015
|
+
},
|
|
1016
|
+
"required": false,
|
|
1017
|
+
"optional": false,
|
|
1018
|
+
"docs": {
|
|
1019
|
+
"tags": [],
|
|
1020
|
+
"text": ""
|
|
1021
|
+
},
|
|
1022
|
+
"attribute": "selected-tags",
|
|
1023
|
+
"reflect": true,
|
|
1024
|
+
"defaultValue": "\"\""
|
|
1025
|
+
},
|
|
1026
|
+
"info": {
|
|
1027
|
+
"type": "string",
|
|
1028
|
+
"mutable": false,
|
|
1029
|
+
"complexType": {
|
|
1030
|
+
"original": "string",
|
|
1031
|
+
"resolved": "string | undefined",
|
|
1032
|
+
"references": {}
|
|
1033
|
+
},
|
|
1034
|
+
"required": false,
|
|
1035
|
+
"optional": true,
|
|
1036
|
+
"docs": {
|
|
1037
|
+
"tags": [],
|
|
1038
|
+
"text": ""
|
|
1039
|
+
},
|
|
1040
|
+
"attribute": "info",
|
|
1041
|
+
"reflect": false
|
|
1042
|
+
},
|
|
1043
|
+
"errorMessage": {
|
|
1044
|
+
"type": "string",
|
|
1045
|
+
"mutable": false,
|
|
1046
|
+
"complexType": {
|
|
1047
|
+
"original": "string",
|
|
1048
|
+
"resolved": "string | undefined",
|
|
1049
|
+
"references": {}
|
|
1050
|
+
},
|
|
1051
|
+
"required": false,
|
|
1052
|
+
"optional": true,
|
|
1053
|
+
"docs": {
|
|
1054
|
+
"tags": [],
|
|
1055
|
+
"text": ""
|
|
1056
|
+
},
|
|
1057
|
+
"attribute": "error-message",
|
|
1058
|
+
"reflect": false
|
|
1059
|
+
},
|
|
1060
|
+
"addNew": {
|
|
1061
|
+
"type": "boolean",
|
|
1062
|
+
"mutable": false,
|
|
1063
|
+
"complexType": {
|
|
1064
|
+
"original": "boolean",
|
|
1065
|
+
"resolved": "boolean",
|
|
1066
|
+
"references": {}
|
|
1067
|
+
},
|
|
1068
|
+
"required": false,
|
|
1069
|
+
"optional": false,
|
|
1070
|
+
"docs": {
|
|
1071
|
+
"tags": [],
|
|
1072
|
+
"text": ""
|
|
1073
|
+
},
|
|
1074
|
+
"attribute": "add-new",
|
|
1075
|
+
"reflect": false,
|
|
1076
|
+
"defaultValue": "true"
|
|
1077
|
+
},
|
|
1078
|
+
"placeholder": {
|
|
1079
|
+
"type": "string",
|
|
1080
|
+
"mutable": true,
|
|
1081
|
+
"complexType": {
|
|
1082
|
+
"original": "string",
|
|
1083
|
+
"resolved": "string | undefined",
|
|
1084
|
+
"references": {}
|
|
1085
|
+
},
|
|
1086
|
+
"required": false,
|
|
1087
|
+
"optional": true,
|
|
1088
|
+
"docs": {
|
|
1089
|
+
"tags": [],
|
|
1090
|
+
"text": ""
|
|
1091
|
+
},
|
|
1092
|
+
"attribute": "placeholder",
|
|
1093
|
+
"reflect": false
|
|
1094
|
+
},
|
|
1095
|
+
"requiredField": {
|
|
1096
|
+
"type": "boolean",
|
|
1097
|
+
"mutable": false,
|
|
1098
|
+
"complexType": {
|
|
1099
|
+
"original": "boolean",
|
|
1100
|
+
"resolved": "boolean",
|
|
1101
|
+
"references": {}
|
|
1102
|
+
},
|
|
1103
|
+
"required": false,
|
|
1104
|
+
"optional": false,
|
|
1105
|
+
"docs": {
|
|
1106
|
+
"tags": [],
|
|
1107
|
+
"text": ""
|
|
1108
|
+
},
|
|
1109
|
+
"attribute": "required-field",
|
|
1110
|
+
"reflect": false,
|
|
1111
|
+
"defaultValue": "false"
|
|
1112
|
+
},
|
|
1113
|
+
"characterLimit": {
|
|
1114
|
+
"type": "number",
|
|
1115
|
+
"mutable": false,
|
|
1116
|
+
"complexType": {
|
|
1117
|
+
"original": "number",
|
|
1118
|
+
"resolved": "number",
|
|
1119
|
+
"references": {}
|
|
1120
|
+
},
|
|
1121
|
+
"required": false,
|
|
1122
|
+
"optional": false,
|
|
1123
|
+
"docs": {
|
|
1124
|
+
"tags": [],
|
|
1125
|
+
"text": ""
|
|
1126
|
+
},
|
|
1127
|
+
"attribute": "character-limit",
|
|
1128
|
+
"reflect": false,
|
|
1129
|
+
"defaultValue": "50"
|
|
1130
|
+
},
|
|
1131
|
+
"maxTags": {
|
|
1132
|
+
"type": "number",
|
|
1133
|
+
"mutable": false,
|
|
1134
|
+
"complexType": {
|
|
1135
|
+
"original": "number",
|
|
1136
|
+
"resolved": "number | undefined",
|
|
1137
|
+
"references": {}
|
|
1138
|
+
},
|
|
1139
|
+
"required": false,
|
|
1140
|
+
"optional": true,
|
|
1141
|
+
"docs": {
|
|
1142
|
+
"tags": [],
|
|
1143
|
+
"text": ""
|
|
1144
|
+
},
|
|
1145
|
+
"attribute": "max-tags",
|
|
1146
|
+
"reflect": false
|
|
1147
|
+
},
|
|
1148
|
+
"tagInputType": {
|
|
1149
|
+
"type": "string",
|
|
1150
|
+
"mutable": false,
|
|
1151
|
+
"complexType": {
|
|
1152
|
+
"original": "\"dropdown\" | \"table\"",
|
|
1153
|
+
"resolved": "\"dropdown\" | \"table\"",
|
|
1154
|
+
"references": {}
|
|
1155
|
+
},
|
|
1156
|
+
"required": false,
|
|
1157
|
+
"optional": false,
|
|
1158
|
+
"docs": {
|
|
1159
|
+
"tags": [],
|
|
1160
|
+
"text": ""
|
|
1161
|
+
},
|
|
1162
|
+
"attribute": "tag-input-type",
|
|
1163
|
+
"reflect": false,
|
|
1164
|
+
"defaultValue": "\"dropdown\""
|
|
1165
|
+
},
|
|
1166
|
+
"colHeaders": {
|
|
1167
|
+
"type": "string",
|
|
1168
|
+
"mutable": false,
|
|
1169
|
+
"complexType": {
|
|
1170
|
+
"original": "string",
|
|
1171
|
+
"resolved": "string",
|
|
1172
|
+
"references": {}
|
|
1173
|
+
},
|
|
1174
|
+
"required": true,
|
|
1175
|
+
"optional": false,
|
|
1176
|
+
"docs": {
|
|
1177
|
+
"tags": [],
|
|
1178
|
+
"text": ""
|
|
1179
|
+
},
|
|
1180
|
+
"attribute": "col-headers",
|
|
1181
|
+
"reflect": false
|
|
1182
|
+
},
|
|
1183
|
+
"colWidths": {
|
|
1184
|
+
"type": "string",
|
|
1185
|
+
"mutable": false,
|
|
1186
|
+
"complexType": {
|
|
1187
|
+
"original": "string",
|
|
1188
|
+
"resolved": "string | undefined",
|
|
1189
|
+
"references": {}
|
|
1190
|
+
},
|
|
1191
|
+
"required": false,
|
|
1192
|
+
"optional": true,
|
|
1193
|
+
"docs": {
|
|
1194
|
+
"tags": [],
|
|
1195
|
+
"text": ""
|
|
1196
|
+
},
|
|
1197
|
+
"attribute": "col-widths",
|
|
1198
|
+
"reflect": false
|
|
1199
|
+
},
|
|
1200
|
+
"colWrap": {
|
|
1201
|
+
"type": "string",
|
|
1202
|
+
"mutable": false,
|
|
1203
|
+
"complexType": {
|
|
1204
|
+
"original": "string",
|
|
1205
|
+
"resolved": "string | undefined",
|
|
1206
|
+
"references": {}
|
|
1207
|
+
},
|
|
1208
|
+
"required": false,
|
|
1209
|
+
"optional": true,
|
|
1210
|
+
"docs": {
|
|
1211
|
+
"tags": [],
|
|
1212
|
+
"text": ""
|
|
1213
|
+
},
|
|
1214
|
+
"attribute": "col-wrap",
|
|
1215
|
+
"reflect": false
|
|
1216
|
+
},
|
|
1217
|
+
"messageConfig": {
|
|
1218
|
+
"type": "string",
|
|
1219
|
+
"mutable": false,
|
|
1220
|
+
"complexType": {
|
|
1221
|
+
"original": "string",
|
|
1222
|
+
"resolved": "string",
|
|
1223
|
+
"references": {}
|
|
1224
|
+
},
|
|
1225
|
+
"required": false,
|
|
1226
|
+
"optional": false,
|
|
1227
|
+
"docs": {
|
|
1228
|
+
"tags": [],
|
|
1229
|
+
"text": ""
|
|
1230
|
+
},
|
|
1231
|
+
"attribute": "message-config",
|
|
1232
|
+
"reflect": false,
|
|
1233
|
+
"defaultValue": "\"\""
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1236
|
+
}
|
|
1237
|
+
static get states() {
|
|
1238
|
+
return {
|
|
1239
|
+
"focusedListItem": {},
|
|
1240
|
+
"focusedTag": {},
|
|
1241
|
+
"tablePosition": {},
|
|
1242
|
+
"isExpanded": {},
|
|
1243
|
+
"tagsList": {},
|
|
1244
|
+
"optionsList": {},
|
|
1245
|
+
"charCount": {},
|
|
1246
|
+
"liveRegionMessage": {}
|
|
1247
|
+
};
|
|
1248
|
+
}
|
|
1249
|
+
static get events() {
|
|
1250
|
+
return [{
|
|
1251
|
+
"method": "wmTagInputChanged",
|
|
1252
|
+
"name": "wmTagInputChanged",
|
|
1253
|
+
"bubbles": true,
|
|
1254
|
+
"cancelable": true,
|
|
1255
|
+
"composed": true,
|
|
1256
|
+
"docs": {
|
|
1257
|
+
"tags": [],
|
|
1258
|
+
"text": ""
|
|
1259
|
+
},
|
|
1260
|
+
"complexType": {
|
|
1261
|
+
"original": "{\r\n value: string[] | HTMLWmTagInputRowElement[];\r\n tagChanged: string | HTMLWmTagInputRowElement;\r\n }",
|
|
1262
|
+
"resolved": "{ value: string[] | HTMLWmTagInputRowElement[]; tagChanged: string | HTMLWmTagInputRowElement; }",
|
|
1263
|
+
"references": {
|
|
1264
|
+
"HTMLWmTagInputRowElement": {
|
|
1265
|
+
"location": "global"
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
}];
|
|
1270
|
+
}
|
|
1271
|
+
static get elementRef() { return "el"; }
|
|
1272
|
+
static get watchers() {
|
|
1273
|
+
return [{
|
|
1274
|
+
"propName": "tagsList",
|
|
1275
|
+
"methodName": "reflectSelectedTags"
|
|
1276
|
+
}, {
|
|
1277
|
+
"propName": "errorMessage",
|
|
1278
|
+
"methodName": "handleErrorMessageChange"
|
|
1279
|
+
}];
|
|
1280
|
+
}
|
|
1281
|
+
static get listeners() {
|
|
1282
|
+
return [{
|
|
1283
|
+
"name": "wmTagInputRowUpdated",
|
|
1284
|
+
"method": "handleRowUpdate",
|
|
1285
|
+
"target": undefined,
|
|
1286
|
+
"capture": false,
|
|
1287
|
+
"passive": false
|
|
1288
|
+
}, {
|
|
1289
|
+
"name": "click",
|
|
1290
|
+
"method": "closeIfNotElOrChild",
|
|
1291
|
+
"target": "document",
|
|
1292
|
+
"capture": false,
|
|
1293
|
+
"passive": false
|
|
1294
|
+
}, {
|
|
1295
|
+
"name": "scroll",
|
|
1296
|
+
"method": "dismissTooltip",
|
|
1297
|
+
"target": "window",
|
|
1298
|
+
"capture": true,
|
|
1299
|
+
"passive": true
|
|
1300
|
+
}];
|
|
1301
|
+
}
|
|
1302
|
+
}
|