@watermarkinsights/ripple 4.3.0 → 4.4.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/chartFunctions-cecf8134.js +600 -0
- package/dist/cjs/{functions-91da05e9.js → functions-4208c444.js} +362 -362
- package/dist/cjs/{global-20d48c6c.js → global-bd289a67.js} +24 -24
- package/dist/cjs/{index-fae02cd7.js → index-f8ef86de.js} +436 -150
- package/dist/cjs/interfaces-ad9e80a6.js +38 -0
- package/dist/cjs/intl-3fafc6d1.js +179 -0
- package/dist/cjs/loader.cjs.js +4 -13
- package/dist/cjs/priv-chart-popover.cjs.entry.js +85 -85
- package/dist/cjs/priv-datepicker.cjs.entry.js +637 -637
- package/dist/cjs/priv-navigator-button.cjs.entry.js +18 -18
- package/dist/cjs/priv-navigator-item.cjs.entry.js +21 -21
- package/dist/cjs/ripple.cjs.js +4 -7
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +314 -314
- package/dist/cjs/wm-button.cjs.entry.js +174 -174
- package/dist/cjs/wm-chart-slice.cjs.entry.js +17 -17
- package/dist/cjs/wm-chart.cjs.entry.js +164 -164
- package/dist/cjs/wm-datepicker.cjs.entry.js +160 -160
- package/dist/cjs/wm-file-list.cjs.entry.js +10 -10
- package/dist/cjs/wm-file.cjs.entry.js +178 -178
- package/dist/cjs/wm-input.cjs.entry.js +102 -102
- package/dist/cjs/wm-line-chart.cjs.entry.js +462 -462
- package/dist/cjs/wm-modal-footer.cjs.entry.js +27 -27
- package/dist/cjs/wm-modal-header.cjs.entry.js +21 -21
- package/dist/cjs/wm-modal.cjs.entry.js +92 -92
- package/dist/cjs/wm-navigation_3.cjs.entry.js +179 -179
- package/dist/cjs/wm-navigator.cjs.entry.js +255 -251
- package/dist/cjs/wm-option_2.cjs.entry.js +710 -710
- package/dist/cjs/wm-pagination.cjs.entry.js +169 -169
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +151 -151
- package/dist/cjs/wm-search.cjs.entry.js +192 -192
- package/dist/cjs/wm-snackbar.cjs.entry.js +114 -114
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +247 -247
- package/dist/cjs/wm-tag-input.cjs.entry.js +849 -849
- package/dist/cjs/wm-tag-option.cjs.entry.js +33 -33
- package/dist/cjs/wm-timepicker.cjs.entry.js +270 -270
- package/dist/cjs/wm-toggletip.cjs.entry.js +99 -99
- package/dist/cjs/wm-uploader.cjs.entry.js +198 -198
- package/dist/cjs/wm-wrapper.cjs.entry.js +12 -12
- package/dist/collection/collection-manifest.json +41 -41
- package/dist/collection/components/charts/chartFunctions.js +456 -456
- package/dist/collection/components/charts/chartFunctions.spec.js +13 -13
- package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.e2e.js +73 -73
- package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +257 -254
- package/dist/collection/components/charts/screenshots.e2e.js +30 -30
- package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +121 -121
- package/dist/collection/components/charts/wm-chart/wm-chart.e2e.js +160 -160
- package/dist/collection/components/charts/wm-chart/wm-chart.js +382 -381
- package/dist/collection/components/charts/wm-chart/wm-chart.spec.js +26 -26
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.css +1 -2
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.e2e.js +138 -138
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.js +731 -731
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.spec.js +106 -106
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +202 -202
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.e2e.js +54 -54
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +136 -136
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.spec.js +31 -31
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +119 -119
- package/dist/collection/components/wm-action-menu/wm-action-menu.e2e.js +187 -187
- package/dist/collection/components/wm-action-menu/wm-action-menu.js +435 -435
- package/dist/collection/components/wm-action-menu/wm-action-menu.spec.js +35 -35
- package/dist/collection/components/wm-button/wm-button.e2e.js +58 -58
- package/dist/collection/components/wm-button/wm-button.js +454 -452
- package/dist/collection/components/wm-button/wm-button.spec.js +63 -63
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.js +943 -939
- package/dist/collection/components/wm-datepicker/priv-datepicker/priv-datepicker.spec.js +71 -71
- package/dist/collection/components/wm-datepicker/wm-datepicker.css +1 -2
- package/dist/collection/components/wm-datepicker/wm-datepicker.e2e.js +359 -359
- package/dist/collection/components/wm-datepicker/wm-datepicker.js +415 -413
- package/dist/collection/components/wm-datepicker/wm-datepicker.spec.js +13 -13
- package/dist/collection/components/wm-file/wm-file.js +380 -380
- package/dist/collection/components/wm-file/wm-file.spec.js +107 -107
- package/dist/collection/components/wm-file-list/wm-file-list.js +42 -42
- package/dist/collection/components/wm-file-list/wm-file-list.spec.js +47 -47
- package/dist/collection/components/wm-input/wm-input.e2e.js +26 -26
- package/dist/collection/components/wm-input/wm-input.js +453 -453
- package/dist/collection/components/wm-input/wm-input.spec.js +168 -168
- package/dist/collection/components/wm-menuitem/wm-menuitem.e2e.js +18 -18
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +446 -436
- package/dist/collection/components/wm-menuitem/wm-menuitem.spec.js +46 -46
- package/dist/collection/components/wm-modal/wm-modal-footer.js +130 -130
- package/dist/collection/components/wm-modal/wm-modal-footer.spec.js +8 -8
- package/dist/collection/components/wm-modal/wm-modal-header.js +68 -68
- package/dist/collection/components/wm-modal/wm-modal-header.spec.js +5 -5
- package/dist/collection/components/wm-modal/wm-modal.e2e.js +65 -65
- package/dist/collection/components/wm-modal/wm-modal.js +299 -296
- package/dist/collection/components/wm-modal/wm-modal.spec.js +22 -22
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.css +0 -1
- package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +112 -112
- package/dist/collection/components/wm-navigation/wm-navigation-item.js +125 -125
- package/dist/collection/components/wm-navigation/wm-navigation.css +0 -2
- package/dist/collection/components/wm-navigation/wm-navigation.e2e.js +86 -86
- package/dist/collection/components/wm-navigation/wm-navigation.js +209 -209
- package/dist/collection/components/wm-navigation/wm-navigation.spec.js +79 -79
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.e2e.js +30 -30
- package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +103 -103
- package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +119 -118
- package/dist/collection/components/wm-navigator/wm-navigator.e2e.js +180 -180
- package/dist/collection/components/wm-navigator/wm-navigator.js +458 -454
- package/dist/collection/components/wm-navigator/wm-navigator.spec.js +153 -153
- package/dist/collection/components/wm-option/wm-option.e2e.js +19 -19
- package/dist/collection/components/wm-option/wm-option.js +474 -463
- package/dist/collection/components/wm-option/wm-option.spec.js +39 -39
- package/dist/collection/components/wm-pagination/wm-pagination.e2e.js +301 -301
- package/dist/collection/components/wm-pagination/wm-pagination.js +327 -327
- package/dist/collection/components/wm-search/wm-search.e2e.js +69 -69
- package/dist/collection/components/wm-search/wm-search.js +415 -414
- package/dist/collection/components/wm-search/wm-search.spec.js +64 -64
- package/dist/collection/components/wm-select/wm-select.e2e.js +443 -443
- package/dist/collection/components/wm-select/wm-select.js +967 -966
- package/dist/collection/components/wm-select/wm-select.spec.js +250 -250
- package/dist/collection/components/wm-snackbar/wm-snackbar.e2e.js +114 -114
- package/dist/collection/components/wm-snackbar/wm-snackbar.js +209 -207
- package/dist/collection/components/wm-snackbar/wm-snackbar.spec.js +4 -4
- package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +190 -188
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +261 -261
- package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +104 -104
- package/dist/collection/components/wm-tabs/wm-tabs.e2e.js +79 -79
- package/dist/collection/components/wm-tabs/wm-tabs.spec.js +6 -6
- package/dist/collection/components/wm-tag-input/wm-tag-input.css +2 -4
- package/dist/collection/components/wm-tag-input/wm-tag-input.e2e.js +168 -168
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +1159 -1159
- package/dist/collection/components/wm-tag-input/wm-tag-input.spec.js +147 -147
- package/dist/collection/components/wm-tag-input/wm-tag-option/wm-tag-option.js +236 -234
- package/dist/collection/components/wm-timepicker/wm-timepicker.css +1 -2
- package/dist/collection/components/wm-timepicker/wm-timepicker.e2e.js +147 -147
- package/dist/collection/components/wm-timepicker/wm-timepicker.js +531 -527
- package/dist/collection/components/wm-timepicker/wm-timepicker.spec.js +151 -151
- package/dist/collection/components/wm-toggletip/wm-toggletip.e2e.js +61 -61
- package/dist/collection/components/wm-toggletip/wm-toggletip.js +209 -208
- package/dist/collection/components/wm-toggletip/wm-toggletip.spec.js +16 -16
- package/dist/collection/components/wm-uploader/wm-uploader.e2e.js +56 -56
- package/dist/collection/components/wm-uploader/wm-uploader.js +423 -422
- package/dist/collection/components/wm-uploader/wm-uploader.spec.js +149 -149
- package/dist/collection/components/wm-wrapper/wm-wrapper.js +26 -26
- package/dist/collection/global/__mocks__/functions.js +1 -1
- package/dist/collection/global/functions.js +510 -510
- package/dist/collection/global/functions.spec.js +123 -123
- package/dist/collection/global/global.js +16 -16
- package/dist/collection/global/interfaces.js +39 -39
- package/dist/collection/global/intl.js +162 -162
- package/dist/collection/global/services/__mocks__/http-service.js +112 -112
- package/dist/collection/global/services/http-service.js +41 -41
- package/dist/collection/global/themes/default.js +4 -4
- package/dist/collection/global/themes/neutral.js +4 -4
- package/dist/collection/lang/lang.spec.js +13 -13
- package/dist/esm/chartFunctions-23173fce.js +584 -0
- package/dist/esm/{functions-5afd09f4.js → functions-d0e70094.js} +362 -362
- package/dist/esm/{global-d4a9e80e.js → global-4569c7b8.js} +24 -24
- package/dist/esm/{index-7e11ea42.js → index-f164fbca.js} +436 -150
- package/dist/esm/interfaces-9b75fb61.js +35 -0
- package/dist/esm/intl-05c9e0c9.js +174 -0
- package/dist/esm/loader.js +5 -14
- package/dist/esm/priv-chart-popover.entry.js +85 -85
- package/dist/esm/priv-datepicker.entry.js +637 -637
- package/dist/esm/priv-navigator-button.entry.js +18 -18
- package/dist/esm/priv-navigator-item.entry.js +21 -21
- package/dist/esm/ripple.js +5 -8
- package/dist/esm/wm-action-menu_2.entry.js +314 -314
- package/dist/esm/wm-button.entry.js +174 -174
- package/dist/esm/wm-chart-slice.entry.js +17 -17
- package/dist/esm/wm-chart.entry.js +164 -164
- package/dist/esm/wm-datepicker.entry.js +160 -160
- package/dist/esm/wm-file-list.entry.js +10 -10
- package/dist/esm/wm-file.entry.js +178 -178
- package/dist/esm/wm-input.entry.js +102 -102
- package/dist/esm/wm-line-chart.entry.js +462 -462
- package/dist/esm/wm-modal-footer.entry.js +27 -27
- package/dist/esm/wm-modal-header.entry.js +21 -21
- package/dist/esm/wm-modal.entry.js +92 -92
- package/dist/esm/wm-navigation_3.entry.js +179 -179
- package/dist/esm/wm-navigator.entry.js +255 -251
- package/dist/esm/wm-option_2.entry.js +710 -710
- package/dist/esm/wm-pagination.entry.js +169 -169
- package/dist/esm/wm-progress-indicator_3.entry.js +151 -151
- package/dist/esm/wm-search.entry.js +192 -192
- package/dist/esm/wm-snackbar.entry.js +114 -114
- package/dist/esm/wm-tab-item_3.entry.js +247 -247
- package/dist/esm/wm-tag-input.entry.js +849 -849
- package/dist/esm/wm-tag-option.entry.js +33 -33
- package/dist/esm/wm-timepicker.entry.js +270 -270
- package/dist/esm/wm-toggletip.entry.js +99 -99
- package/dist/esm/wm-uploader.entry.js +198 -198
- package/dist/esm/wm-wrapper.entry.js +12 -12
- package/dist/esm-es5/chartFunctions-23173fce.js +1 -0
- package/dist/esm-es5/functions-d0e70094.js +1 -0
- package/dist/esm-es5/global-4569c7b8.js +1 -0
- package/dist/esm-es5/index-f164fbca.js +2 -0
- package/dist/esm-es5/{intl-e2da750a.js → intl-05c9e0c9.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/priv-navigator-button.entry.js +1 -1
- package/dist/esm-es5/priv-navigator-item.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart-slice.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-file-list.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-line-chart.entry.js +1 -1
- package/dist/esm-es5/wm-modal-footer.entry.js +1 -1
- package/dist/esm-es5/wm-modal-header.entry.js +1 -1
- package/dist/esm-es5/wm-modal.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-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-tag-option.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-wrapper.entry.js +1 -1
- package/dist/loader/index.d.ts +1 -1
- package/dist/ripple/p-028ef6db.system.entry.js +1 -0
- package/dist/ripple/{p-863e737a.js → p-05d4e49b.js} +1 -1
- package/dist/ripple/{p-a1e95b05.system.entry.js → p-06776596.system.entry.js} +1 -1
- package/dist/ripple/{p-622a7791.system.entry.js → p-067d7922.system.entry.js} +1 -1
- package/dist/ripple/p-09d62ddd.entry.js +1 -0
- package/dist/ripple/{p-f30839a1.system.entry.js → p-0ecbf569.system.entry.js} +1 -1
- package/dist/ripple/p-0fe97e85.system.js +2 -0
- package/dist/ripple/{p-24b08e1f.js → p-13ca30d8.js} +1 -1
- package/dist/ripple/{p-8f3f903f.system.js → p-1402cfa2.system.js} +1 -1
- package/dist/ripple/p-1453ea51.system.entry.js +1 -0
- package/dist/ripple/{p-6abb903c.entry.js → p-153701f9.entry.js} +1 -1
- package/dist/ripple/p-1cc91907.system.js +1 -0
- package/dist/ripple/{p-ad37cdfd.entry.js → p-1d8b0039.entry.js} +1 -1
- package/dist/ripple/{p-d0f1b8c4.system.entry.js → p-1fa2a756.system.entry.js} +1 -1
- package/dist/ripple/{p-a52c5a1c.entry.js → p-25446670.entry.js} +1 -1
- package/dist/ripple/{p-1283e85d.entry.js → p-27f47edc.entry.js} +1 -1
- package/dist/ripple/{p-32b1126c.system.entry.js → p-28e4583c.system.entry.js} +1 -1
- package/dist/ripple/{p-a5b23781.system.entry.js → p-2c4f312d.system.entry.js} +1 -1
- package/dist/ripple/p-30b17818.system.entry.js +1 -0
- package/dist/ripple/{p-0631be01.system.entry.js → p-3446852f.system.entry.js} +1 -1
- package/dist/ripple/{p-ae674a54.entry.js → p-350fe5da.entry.js} +1 -1
- package/dist/ripple/{p-d04ba5f8.system.entry.js → p-3583d113.system.entry.js} +1 -1
- package/dist/ripple/{p-cbd8a60b.system.entry.js → p-361cc8fc.system.entry.js} +1 -1
- package/dist/ripple/{p-7529706d.entry.js → p-372faf33.entry.js} +1 -1
- package/dist/ripple/{p-19773c40.entry.js → p-3a070f35.entry.js} +1 -1
- package/dist/ripple/{p-c7b5ac39.js → p-3af72848.js} +1 -1
- package/dist/ripple/{p-c41603e6.entry.js → p-42ebfcfa.entry.js} +1 -1
- package/dist/ripple/{p-13594c2e.entry.js → p-43e2a49a.entry.js} +1 -1
- package/dist/ripple/{p-ed942b42.entry.js → p-49118468.entry.js} +1 -1
- package/dist/ripple/p-49c85d1a.system.js +1 -0
- package/dist/ripple/p-4de51706.js +2 -0
- package/dist/ripple/{p-3c80bf67.entry.js → p-58174f4e.entry.js} +1 -1
- package/dist/ripple/{p-c5e8f8a5.system.entry.js → p-5a4d9897.system.entry.js} +1 -1
- package/dist/ripple/{p-e3f0b57f.system.entry.js → p-5ac980e2.system.entry.js} +1 -1
- package/dist/ripple/{p-3becce62.system.entry.js → p-633cd89a.system.entry.js} +1 -1
- package/dist/ripple/{p-1205fdc1.entry.js → p-63f75d43.entry.js} +1 -1
- package/dist/ripple/{p-90ea7e3a.system.entry.js → p-67d48c33.system.entry.js} +1 -1
- package/dist/ripple/{p-8ef87907.entry.js → p-6caaf85f.entry.js} +1 -1
- package/dist/ripple/{p-935513f8.entry.js → p-6cf7a34a.entry.js} +1 -1
- package/dist/ripple/p-73289c2c.system.js +1 -0
- package/dist/ripple/{p-c76bbedf.system.entry.js → p-7a8816d9.system.entry.js} +1 -1
- package/dist/ripple/{p-8ea68cb3.system.entry.js → p-7e56da2e.system.entry.js} +1 -1
- package/dist/ripple/{p-deb4f5a2.entry.js → p-7e8daaac.entry.js} +1 -1
- package/dist/ripple/p-88406560.system.entry.js +1 -0
- package/dist/ripple/{p-84a7e757.entry.js → p-8cace32f.entry.js} +1 -1
- package/dist/ripple/{p-80aef387.entry.js → p-8d4734ad.entry.js} +1 -1
- package/dist/ripple/p-8f76a838.system.entry.js +1 -0
- package/dist/ripple/p-934c1b6b.js +1 -0
- package/dist/ripple/{p-85f744ed.system.js → p-9fecbc8a.system.js} +1 -1
- package/dist/ripple/{p-b71a83e3.entry.js → p-a69c37e0.entry.js} +1 -1
- package/dist/ripple/{p-9288659b.entry.js → p-a82a8931.entry.js} +1 -1
- package/dist/ripple/p-a99b05de.system.entry.js +1 -0
- package/dist/ripple/{p-36049d2f.entry.js → p-aadf8c59.entry.js} +1 -1
- package/dist/ripple/{p-676c1089.system.entry.js → p-aba5a00e.system.entry.js} +1 -1
- package/dist/ripple/{p-0aecac86.entry.js → p-ad6dc751.entry.js} +1 -1
- package/dist/ripple/{p-0f1ff645.entry.js → p-b253d2fc.entry.js} +1 -1
- package/dist/ripple/p-b2ff4723.system.entry.js +1 -0
- package/dist/ripple/{p-a0bf5eef.entry.js → p-b452d1d7.entry.js} +1 -1
- package/dist/ripple/{p-1cde16a7.system.entry.js → p-b4d862e1.system.entry.js} +1 -1
- package/dist/ripple/{p-d496bc44.system.entry.js → p-bdd4f919.system.entry.js} +1 -1
- package/dist/ripple/p-c18b398c.system.js +1 -0
- package/dist/ripple/{p-8f8c3705.entry.js → p-c249063c.entry.js} +1 -1
- package/dist/ripple/p-c344a69c.entry.js +1 -0
- package/dist/ripple/{p-0d9f70ab.entry.js → p-c717d895.entry.js} +1 -1
- package/dist/ripple/{p-2e773564.system.entry.js → p-c96a5c94.system.entry.js} +1 -1
- package/dist/ripple/{p-15497721.system.entry.js → p-ceced3d9.system.entry.js} +1 -1
- package/dist/ripple/{p-d428e9bb.system.entry.js → p-d16f91e9.system.entry.js} +1 -1
- package/dist/ripple/{p-ff14e4ec.system.entry.js → p-d3f9d028.system.entry.js} +1 -1
- package/dist/ripple/{p-7962f562.entry.js → p-de349bee.entry.js} +1 -1
- package/dist/ripple/{p-b3c73bc9.entry.js → p-e24ddae1.entry.js} +1 -1
- package/dist/ripple/{p-b3e08b14.system.entry.js → p-e8b58666.system.entry.js} +1 -1
- package/dist/ripple/{p-a9c096b5.entry.js → p-fa87bce3.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +16 -20
- package/dist/types/components/charts/chartFunctions.d.ts +13 -13
- package/dist/types/components/charts/priv-chart-popover/priv-chart-popover.d.ts +24 -24
- package/dist/types/components/charts/wm-chart/wm-chart-slice.d.ts +8 -8
- package/dist/types/components/charts/wm-chart/wm-chart.d.ts +39 -39
- package/dist/types/components/charts/wm-line-chart/wm-line-chart.d.ts +74 -74
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-indicator.d.ts +26 -26
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-monitor.d.ts +17 -17
- package/dist/types/components/charts/wm-progress-monitor/wm-progress-slice.d.ts +7 -7
- package/dist/types/components/wm-action-menu/wm-action-menu.d.ts +43 -43
- package/dist/types/components/wm-button/wm-button.d.ts +40 -40
- package/dist/types/components/wm-datepicker/priv-datepicker/priv-datepicker.d.ts +76 -76
- package/dist/types/components/wm-datepicker/wm-datepicker.d.ts +31 -31
- package/dist/types/components/wm-file/wm-file.d.ts +40 -40
- package/dist/types/components/wm-file-list/wm-file-list.d.ts +3 -3
- package/dist/types/components/wm-input/wm-input.d.ts +46 -46
- package/dist/types/components/wm-menuitem/wm-menuitem.d.ts +31 -31
- package/dist/types/components/wm-modal/wm-modal-footer.d.ts +11 -11
- package/dist/types/components/wm-modal/wm-modal-header.d.ts +7 -7
- package/dist/types/components/wm-modal/wm-modal.d.ts +24 -24
- package/dist/types/components/wm-navigation/wm-navigation-hamburger.d.ts +13 -13
- package/dist/types/components/wm-navigation/wm-navigation-item.d.ts +10 -10
- package/dist/types/components/wm-navigation/wm-navigation.d.ts +23 -23
- package/dist/types/components/wm-navigator/priv-navigator-button/priv-navigator-button.d.ts +7 -7
- package/dist/types/components/wm-navigator/priv-navigator-item/priv-navigator-item.d.ts +10 -10
- package/dist/types/components/wm-navigator/wm-navigator.d.ts +57 -57
- package/dist/types/components/wm-option/wm-option.d.ts +36 -36
- package/dist/types/components/wm-pagination/wm-pagination.d.ts +27 -27
- package/dist/types/components/wm-search/wm-search.d.ts +73 -73
- package/dist/types/components/wm-select/wm-select.d.ts +99 -99
- package/dist/types/components/wm-snackbar/wm-snackbar.d.ts +24 -24
- package/dist/types/components/wm-tabs/wm-tab-item/wm-tab-item.d.ts +30 -30
- package/dist/types/components/wm-tabs/wm-tab-list/wm-tab-list.d.ts +41 -41
- package/dist/types/components/wm-tabs/wm-tab-panel/wm-tab-panel.d.ts +16 -16
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +114 -114
- package/dist/types/components/wm-tag-input/wm-tag-option/wm-tag-option.d.ts +15 -15
- package/dist/types/components/wm-timepicker/wm-timepicker.d.ts +48 -48
- package/dist/types/components/wm-toggletip/wm-toggletip.d.ts +20 -20
- package/dist/types/components/wm-uploader/wm-uploader.d.ts +47 -47
- package/dist/types/components/wm-wrapper/wm-wrapper.d.ts +4 -4
- package/dist/types/components.d.ts +382 -0
- package/dist/types/global/__mocks__/functions.d.ts +1 -1
- package/dist/types/global/functions.d.ts +4 -4
- package/dist/types/global/interfaces.d.ts +49 -49
- package/dist/types/global/intl.d.ts +31 -31
- package/dist/types/global/services/__mocks__/http-service.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +46 -5
- package/package.json +1 -1
- package/dist/cjs/chartFunctions-2c3e010e.js +0 -600
- package/dist/cjs/interfaces-245d7bff.js +0 -38
- package/dist/cjs/intl-fa3bb4ae.js +0 -179
- package/dist/esm/chartFunctions-36634c04.js +0 -584
- package/dist/esm/interfaces-89cad2fc.js +0 -35
- package/dist/esm/intl-e2da750a.js +0 -174
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm-es5/chartFunctions-36634c04.js +0 -1
- package/dist/esm-es5/functions-5afd09f4.js +0 -1
- package/dist/esm-es5/global-d4a9e80e.js +0 -1
- package/dist/esm-es5/index-7e11ea42.js +0 -2
- package/dist/ripple/p-00acacbe.system.entry.js +0 -1
- package/dist/ripple/p-0f889b84.system.js +0 -1
- package/dist/ripple/p-13af8346.entry.js +0 -1
- package/dist/ripple/p-16363e1c.system.entry.js +0 -1
- package/dist/ripple/p-2a95b63f.system.entry.js +0 -1
- package/dist/ripple/p-30bf24f8.system.js +0 -2
- package/dist/ripple/p-3248c0fa.system.entry.js +0 -1
- package/dist/ripple/p-47c20b05.entry.js +0 -1
- package/dist/ripple/p-56d64283.system.entry.js +0 -1
- package/dist/ripple/p-5e85967a.system.js +0 -1
- package/dist/ripple/p-9b2034f6.js +0 -1
- package/dist/ripple/p-a3d07be5.system.js +0 -1
- package/dist/ripple/p-a6be3cca.system.entry.js +0 -1
- package/dist/ripple/p-aafa111a.system.js +0 -1
- package/dist/ripple/p-b5bedd63.js +0 -2
- package/dist/ripple/p-bd537299.system.entry.js +0 -1
- /package/dist/esm-es5/{interfaces-89cad2fc.js → interfaces-9b75fb61.js} +0 -0
- /package/dist/ripple/{p-c0c111fd.js → p-196eb2f3.js} +0 -0
|
@@ -2,1179 +2,1179 @@ import { h, forceUpdate } from "@stencil/core";
|
|
|
2
2
|
import { csvToArray, debounce, hideTooltip, intl, measureText, shouldOpenUp, showTooltip, truncateText, findPrev, findNext, } from "../../global/functions";
|
|
3
3
|
import { globalMessages } from "../../global/intl";
|
|
4
4
|
export class TagInput {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
ev.preventDefault();
|
|
381
|
-
this.resetInput();
|
|
382
|
-
let option;
|
|
383
|
-
if (this.isTable) {
|
|
384
|
-
option = ev.target;
|
|
385
|
-
option = this.tagOptionFromEl(option.closest("tr"));
|
|
386
|
-
}
|
|
387
|
-
else {
|
|
388
|
-
option = this.tagOptionFromEl(ev.target);
|
|
389
|
-
}
|
|
390
|
-
// if someone wants to attach a click event listener on wm-tag-option
|
|
391
|
-
option.click();
|
|
392
|
-
if (!option.locked) {
|
|
393
|
-
option.selected
|
|
394
|
-
? this.isTable && option.emitDeselectedEvent() // dropdown doesn't deselect on option click
|
|
395
|
-
: option.emitSelectedEvent();
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
// From wm-button
|
|
399
|
-
// we need to listen for scroll events during the capture phase because they do not bubble up
|
|
400
|
-
// there can be layouts where the main content has 100vh and overflows
|
|
401
|
-
// in these cases window will register no scroll events unless we catch on they way down
|
|
402
|
-
dismissTooltip() {
|
|
403
|
-
if (this.tooltipVisible) {
|
|
404
|
-
hideTooltip();
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
handleInputKeyDown(ev) {
|
|
408
|
-
if (/^.$/.test(ev.key) && this.charCount >= this.characterLimit) {
|
|
409
|
-
this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
|
|
410
|
-
}
|
|
411
|
-
// prevent keydown triggering on tag area
|
|
412
|
-
ev.stopPropagation();
|
|
413
|
-
switch (ev.key) {
|
|
414
|
-
case "Enter":
|
|
415
|
-
ev.preventDefault();
|
|
416
|
-
this.handleInputEnter();
|
|
417
|
-
break;
|
|
418
|
-
case "ArrowDown":
|
|
419
|
-
ev.preventDefault();
|
|
420
|
-
this.handleInputArrowDown();
|
|
421
|
-
break;
|
|
422
|
-
case "ArrowUp":
|
|
5
|
+
constructor() {
|
|
6
|
+
this.addNewHelpText = intl.formatMessage({
|
|
7
|
+
id: "tagInput.addNewHelpText",
|
|
8
|
+
defaultMessage: "Press the Enter or Comma key to add a new tag.",
|
|
9
|
+
description: "Help text appearing in a dropdown. Use imperative",
|
|
10
|
+
});
|
|
11
|
+
this.selectionHelpText = intl.formatMessage({
|
|
12
|
+
id: "tagInput.selectionHelpText",
|
|
13
|
+
defaultMessage: "Search and select a tag.",
|
|
14
|
+
description: "Help text appearing in a dropdown. Use imperative",
|
|
15
|
+
});
|
|
16
|
+
this.maxTagsReachedMessage = intl.formatMessage({
|
|
17
|
+
id: "tagInput.maxTagsReached",
|
|
18
|
+
defaultMessage: "No more tags can be added because the limit has been reached.",
|
|
19
|
+
});
|
|
20
|
+
this.tagAreaInstructions = intl.formatMessage({
|
|
21
|
+
id: "tagInput.tagAreaInstructions",
|
|
22
|
+
defaultMessage: "tag selection. Press Backspace or Delete to remove a tag.",
|
|
23
|
+
});
|
|
24
|
+
this.tagsAddedMessage = intl.formatMessage({
|
|
25
|
+
id: "tagInput.tagsAdded",
|
|
26
|
+
defaultMessage: "Tags added",
|
|
27
|
+
description: "Full message for context: 'Tags added: x/y",
|
|
28
|
+
});
|
|
29
|
+
this.openUp = false;
|
|
30
|
+
this.inModal = false;
|
|
31
|
+
this.lastAddedTags = []; // the tag(s) added by the user on their last action (for highlighting)
|
|
32
|
+
this.debouncedUpdate = debounce(() => forceUpdate(this.el), 30);
|
|
33
|
+
this.label = undefined;
|
|
34
|
+
this.errorMessage = undefined;
|
|
35
|
+
this.info = undefined;
|
|
36
|
+
this.labelPosition = "top";
|
|
37
|
+
this.maxTags = undefined;
|
|
38
|
+
this.placeholder = undefined;
|
|
39
|
+
this.requiredField = false;
|
|
40
|
+
this.tagInputType = "dropdown";
|
|
41
|
+
this.helpText = undefined;
|
|
42
|
+
this.addNew = true;
|
|
43
|
+
this.characterLimit = 50;
|
|
44
|
+
this.colHeaders = undefined;
|
|
45
|
+
this.colWidths = undefined;
|
|
46
|
+
this.colWrap = undefined;
|
|
47
|
+
this.isExpanded = false;
|
|
48
|
+
this.liveRegionMessage = "";
|
|
49
|
+
this.focusedOption = undefined;
|
|
50
|
+
this.focusedColumn = 0;
|
|
51
|
+
this.focusedTagIndex = undefined;
|
|
52
|
+
this.tagsList = [];
|
|
53
|
+
}
|
|
54
|
+
get isDropdown() {
|
|
55
|
+
return this.tagInputType === "dropdown";
|
|
56
|
+
}
|
|
57
|
+
get isTable() {
|
|
58
|
+
return this.tagInputType === "table";
|
|
59
|
+
}
|
|
60
|
+
get charCount() {
|
|
61
|
+
return this.inputEl ? this.inputEl.value.length : 0;
|
|
62
|
+
}
|
|
63
|
+
get tooltipVisible() {
|
|
64
|
+
return document.getElementById("wm-tooltip").classList.contains("show");
|
|
65
|
+
}
|
|
66
|
+
get optionEls() {
|
|
67
|
+
return Array.from(this.el.querySelectorAll("wm-tag-option"));
|
|
68
|
+
}
|
|
69
|
+
// list of options matching user query
|
|
70
|
+
get filteredOptionEls() {
|
|
71
|
+
const query = this.inputEl ? this.inputEl.value.toLowerCase() : "";
|
|
72
|
+
const list = Array.from(this.optionEls).filter((o) => {
|
|
73
|
+
let values = "";
|
|
74
|
+
if (this.isDropdown) {
|
|
75
|
+
values = o.textContent.toLowerCase();
|
|
76
|
+
}
|
|
77
|
+
else if (this.isTable) {
|
|
78
|
+
values = [o.col1, o.col2, o.col3, o.col4].join("").toLowerCase();
|
|
79
|
+
}
|
|
80
|
+
return values.includes(query);
|
|
81
|
+
});
|
|
82
|
+
return list;
|
|
83
|
+
}
|
|
84
|
+
// the ones that should be rendered as tags
|
|
85
|
+
get taggedOptions() {
|
|
86
|
+
return this.optionEls.filter((o) => o.selected || o.locked);
|
|
87
|
+
}
|
|
88
|
+
// for visual stuff (measuring, truncating...)
|
|
89
|
+
get _tagEls() {
|
|
90
|
+
return this.tagAreaEl ? Array.from(this.tagAreaEl.querySelectorAll(".tag")) : [];
|
|
91
|
+
}
|
|
92
|
+
// unlocked and selected tags, i.e. the ones that the user can interact with.
|
|
93
|
+
// (as opposed to locked tags who can't be focused / deleted)
|
|
94
|
+
// used for focus logic
|
|
95
|
+
get focusableTags() {
|
|
96
|
+
return this._tagEls.filter((t) => !t.classList.contains("locked"));
|
|
97
|
+
}
|
|
98
|
+
get focusedTag() {
|
|
99
|
+
if (this.focusedTagIndex !== undefined && this.focusedTagIndex >= 0)
|
|
100
|
+
return this.focusableTags[this.focusedTagIndex];
|
|
101
|
+
}
|
|
102
|
+
// get the wm-tag-option, given the internal representation (dropdown li or table tr)
|
|
103
|
+
tagOptionFromEl(el) {
|
|
104
|
+
return el.id === "add-new-btn" ? undefined : this.el.querySelector("#" + el.id);
|
|
105
|
+
}
|
|
106
|
+
// get the wm-tag-option, given the internal representation of a tag
|
|
107
|
+
tagOptionFromTag(el) {
|
|
108
|
+
const id = el.id.replace("tag-", "");
|
|
109
|
+
return this.el.querySelector("#" + id);
|
|
110
|
+
}
|
|
111
|
+
// get the internal representation of a wm-tag-option
|
|
112
|
+
elFromTagOption(el) {
|
|
113
|
+
return this.el.shadowRoot.querySelector("#" + el.id);
|
|
114
|
+
}
|
|
115
|
+
// focusedOption state refers to the wm-tag-option. This gets the corresponding element in the shadow DOM, or the "Add New" button.
|
|
116
|
+
get _focusedOption() {
|
|
117
|
+
if (!!this.focusedOption) {
|
|
118
|
+
return this.elFromTagOption(this.focusedOption);
|
|
119
|
+
}
|
|
120
|
+
else if (this.addNewButton && this.addNewButton.classList.contains("focused")) {
|
|
121
|
+
return this.addNewButton;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
get _focusedCell() {
|
|
125
|
+
if (!!this._focusedOption) {
|
|
126
|
+
const allCells = Array.from(this._focusedOption.querySelectorAll("td"));
|
|
127
|
+
const index = this.focusedColumn || 0;
|
|
128
|
+
return allCells[index];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
get inputActiveDescendantId() {
|
|
132
|
+
if (this._focusedOption) {
|
|
133
|
+
if (this.isTable) {
|
|
134
|
+
const cells = Array.from(this._focusedOption.querySelectorAll("td"));
|
|
135
|
+
return cells[this.focusedColumn].id;
|
|
136
|
+
}
|
|
137
|
+
return this._focusedOption.id;
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
get tagLimitReached() {
|
|
142
|
+
return !!(this.maxTags && this.taggedOptions.length >= this.maxTags);
|
|
143
|
+
}
|
|
144
|
+
get noResultsMessage() {
|
|
145
|
+
return intl.formatMessage({
|
|
146
|
+
id: "tagInput.noResults",
|
|
147
|
+
defaultMessage: "No results match your search.",
|
|
148
|
+
description: "Message displayed when a user's search returns empty.",
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
get inputMinimumWidth() {
|
|
152
|
+
if (this._tagEls) {
|
|
153
|
+
// 150px is the minimum width of the input field, or the length of the placeholder text
|
|
154
|
+
const inputElStyles = getComputedStyle(this.inputEl);
|
|
155
|
+
const tagElStyles = getComputedStyle(this._tagEls[this._tagEls.length - 1]);
|
|
156
|
+
const inputElBuffer = [
|
|
157
|
+
inputElStyles.paddingLeft,
|
|
158
|
+
inputElStyles.paddingRight,
|
|
159
|
+
inputElStyles.marginLeft,
|
|
160
|
+
inputElStyles.marginRight,
|
|
161
|
+
tagElStyles.marginRight,
|
|
162
|
+
].reduce((prev, curr) => prev + parseInt(curr.replace("px", "")), 0);
|
|
163
|
+
const minimumWidth = Math.max(150, measureText(this.inputEl, this.placeholder).width + inputElBuffer);
|
|
164
|
+
return minimumWidth;
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
return 150;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
getTagName(o) {
|
|
171
|
+
// when the user is typing and adding a new option, all we can pass is the text typed. so for the dropdown type the tag name is the identifier. It also takes care of duplicates. Table variant requires an id as the tag name is the first column but we want to allow duplicates here (e.g. people with the same name)
|
|
172
|
+
return this.isDropdown ? o.textContent : o.col1;
|
|
173
|
+
}
|
|
174
|
+
isExistingTag(tag) {
|
|
175
|
+
const list = this.optionEls.map((o) => this.getTagName(o).toLowerCase());
|
|
176
|
+
return list.includes(tag.toLowerCase());
|
|
177
|
+
}
|
|
178
|
+
tagAddedMessage(tag) {
|
|
179
|
+
return intl.formatMessage({
|
|
180
|
+
id: "tagInput.tagAdded",
|
|
181
|
+
defaultMessage: "{tagName} added.",
|
|
182
|
+
description: "A confirmation for adding a tag.",
|
|
183
|
+
}, { tagName: tag });
|
|
184
|
+
}
|
|
185
|
+
tagRemovedMessage(tag) {
|
|
186
|
+
return intl.formatMessage({
|
|
187
|
+
id: "tagInput.tagRemoved",
|
|
188
|
+
defaultMessage: "{tagName} removed.",
|
|
189
|
+
description: "A confirmation for removing a tag.",
|
|
190
|
+
}, { tagName: tag });
|
|
191
|
+
}
|
|
192
|
+
tagAlreadyAddedMessage(tag) {
|
|
193
|
+
return intl.formatMessage({
|
|
194
|
+
id: "tagInput.tagAlreadyAdded",
|
|
195
|
+
defaultMessage: "{tagName} has already been added.",
|
|
196
|
+
description: "An alert for adding a tag that is already present.",
|
|
197
|
+
}, { tagName: tag });
|
|
198
|
+
}
|
|
199
|
+
isElOrChild(el) {
|
|
200
|
+
return el === this.el || this.el.shadowRoot.contains(el) || this.el.contains(el);
|
|
201
|
+
}
|
|
202
|
+
componentWillLoad() {
|
|
203
|
+
if (!this.placeholder) {
|
|
204
|
+
this.placeholder = this.createPlaceholderDefault(this.addNew, this.optionEls.length > 0);
|
|
205
|
+
}
|
|
206
|
+
if (!this.label) {
|
|
207
|
+
console.error("wm-tag-input must have a label property");
|
|
208
|
+
}
|
|
209
|
+
this.el.focus = () => {
|
|
210
|
+
const firstFocusableTag = this.focusableTags[0];
|
|
211
|
+
if (firstFocusableTag) {
|
|
212
|
+
this.tagAreaEl.focus();
|
|
213
|
+
this.focusTag(firstFocusableTag);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
this.inputEl.focus();
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
// on resize of component, trigger componentDidRender -> positionInput
|
|
220
|
+
const resizeObserver = new ResizeObserver(() => this.debouncedUpdate());
|
|
221
|
+
resizeObserver.observe(this.el);
|
|
222
|
+
// if within wm-modal, change max-height to vh unit
|
|
223
|
+
if (this.el.closest("wm-modal")) {
|
|
224
|
+
this.inModal = true;
|
|
225
|
+
}
|
|
226
|
+
const lockedTags = [];
|
|
227
|
+
const regularTags = [];
|
|
228
|
+
this.optionEls.forEach((o) => {
|
|
229
|
+
if (o.locked) {
|
|
230
|
+
lockedTags.push(o);
|
|
231
|
+
}
|
|
232
|
+
else if (o.selected) {
|
|
233
|
+
regularTags.push(o);
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
this.tagsList = [...lockedTags, ...regularTags];
|
|
237
|
+
}
|
|
238
|
+
componentDidLoad() {
|
|
239
|
+
// Set up observer to announce changes in selected tags, or removed user-added tags
|
|
240
|
+
const observerAnnouncer = new MutationObserver((optionListMutations) => optionListMutations.forEach((mutationRecord) => this.handleChangeAnnouncement(mutationRecord)));
|
|
241
|
+
observerAnnouncer.observe(this.el, {
|
|
242
|
+
subtree: true,
|
|
243
|
+
attributes: true,
|
|
244
|
+
attributeFilter: ["selected"],
|
|
245
|
+
childList: true,
|
|
246
|
+
});
|
|
247
|
+
// Set up observer that ensures parent reload
|
|
248
|
+
// when children wm-tag-options are removed
|
|
249
|
+
const optionListObserver = new MutationObserver((optionListMutations) => optionListMutations.forEach((mutationRecord) => this.handleOptionListChange(mutationRecord)));
|
|
250
|
+
optionListObserver.observe(this.el, {
|
|
251
|
+
childList: true,
|
|
252
|
+
});
|
|
253
|
+
// Set up the observer that will handle focus
|
|
254
|
+
// when tag list changes
|
|
255
|
+
if (!!this.tagAreaEl) {
|
|
256
|
+
const tagListObserver = new MutationObserver((tagListMutations) => tagListMutations.forEach((mutationRecord) => this.handleTagListChange(mutationRecord)));
|
|
257
|
+
tagListObserver.observe(this.tagAreaEl, {
|
|
258
|
+
childList: true,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
handleChangeAnnouncement(mutationRecord) {
|
|
263
|
+
const tagOptionEl = mutationRecord.target;
|
|
264
|
+
if (mutationRecord.type == "childList" && mutationRecord.removedNodes.length > 0) {
|
|
265
|
+
// announce deselection of user-added tag, whose element removal is picked up
|
|
266
|
+
this.announce(this.tagRemovedMessage(mutationRecord.removedNodes[0].textContent));
|
|
267
|
+
}
|
|
268
|
+
else if (mutationRecord.type == "attributes") {
|
|
269
|
+
// announce selection or deselection of all kinds of tags
|
|
270
|
+
if (tagOptionEl.selected) {
|
|
271
|
+
this.announce(this.tagAddedMessage(tagOptionEl.textContent));
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
this.announce(this.tagRemovedMessage(tagOptionEl.textContent));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
handleOptionListChange(record) {
|
|
279
|
+
const addedNodes = Array.from(record.addedNodes);
|
|
280
|
+
if (addedNodes.length > 0) {
|
|
281
|
+
addedNodes.forEach((n) => !this.tagsList.includes(n) && this.tagsList.push(n));
|
|
282
|
+
}
|
|
283
|
+
const removedNodes = Array.from(record.removedNodes);
|
|
284
|
+
if (removedNodes.length > 0) {
|
|
285
|
+
this.tagsList = this.tagsList.filter((t) => !removedNodes.includes(t));
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
handleTagOptionSelected(ev) {
|
|
289
|
+
const selOption = ev.target;
|
|
290
|
+
this.tagsList = this.tagsList.concat(selOption);
|
|
291
|
+
}
|
|
292
|
+
handleTagOptionDeselected(ev) {
|
|
293
|
+
const deselOption = ev.target;
|
|
294
|
+
this.tagsList = this.tagsList.filter((t) => t != deselOption);
|
|
295
|
+
}
|
|
296
|
+
handleTagListChange(mutationRecord) {
|
|
297
|
+
// there are 2 cases: the option still exists but is no longer selected,
|
|
298
|
+
// or it was removed altogether
|
|
299
|
+
const removedTag = mutationRecord.removedNodes[0];
|
|
300
|
+
if (!!removedTag) {
|
|
301
|
+
// this is a trick. focusedTag gets the ref from an index. When an element
|
|
302
|
+
// is removed it will fall back on the new element with that index if it exists
|
|
303
|
+
if (this.focusedTag) {
|
|
304
|
+
this.focusTag(this.focusedTag);
|
|
305
|
+
}
|
|
306
|
+
else if (this.focusableTags.length > 0) {
|
|
307
|
+
// Otherwise the last tag was deleted and we reassign to the new last tag.
|
|
308
|
+
const tagToFocus = this.focusableTags[this.focusableTags.length - 1];
|
|
309
|
+
this.focusTag(tagToFocus);
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
// unless there are no more tags...
|
|
313
|
+
this.inputEl.focus();
|
|
314
|
+
}
|
|
315
|
+
this.lastAddedTags = [];
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
componentDidRender() {
|
|
319
|
+
this.positionInput();
|
|
320
|
+
// check each tag if truncation is needed
|
|
321
|
+
this._tagEls.forEach((tag) => {
|
|
322
|
+
const textEl = tag.querySelector(".tag-text");
|
|
323
|
+
const wrapper = this.el.shadowRoot.querySelector(".tags-and-input-wrapper");
|
|
324
|
+
const leftBound = textEl.getBoundingClientRect().left;
|
|
325
|
+
// the numbers represent spacing values for padding, margin, and delete icon
|
|
326
|
+
const rightBound = wrapper.getBoundingClientRect().right - 10 - 8 - 28;
|
|
327
|
+
const id = tag.id.replace("tag-", "");
|
|
328
|
+
const optionEl = id && this.el.querySelector("#" + id);
|
|
329
|
+
if (optionEl) {
|
|
330
|
+
// tag text for table variant is first column text
|
|
331
|
+
textEl.textContent = truncateText(textEl, this.getTagName(optionEl), rightBound - leftBound, 5);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
createPlaceholderDefault(addNew, hasOptions) {
|
|
336
|
+
const addAndSearchPlaceholder = intl.formatMessage({
|
|
337
|
+
id: "tagInput.placeholderAddAndSearch",
|
|
338
|
+
defaultMessage: "Add or search for a tag",
|
|
339
|
+
description: "Placeholder text. Use imperative",
|
|
340
|
+
});
|
|
341
|
+
const searchPlaceholder = intl.formatMessage({
|
|
342
|
+
id: "tagInput.placeholderSearch",
|
|
343
|
+
defaultMessage: "Search and select a tag",
|
|
344
|
+
description: "Placeholder text. Use imperative",
|
|
345
|
+
});
|
|
346
|
+
const addPlaceholder = intl.formatMessage({
|
|
347
|
+
id: "tagInput.placeholderAdd",
|
|
348
|
+
defaultMessage: "Add a new tag",
|
|
349
|
+
description: "Placeholder text. Use imperative",
|
|
350
|
+
});
|
|
351
|
+
let placeholder = "";
|
|
352
|
+
if (addNew && hasOptions) {
|
|
353
|
+
placeholder = addAndSearchPlaceholder;
|
|
354
|
+
}
|
|
355
|
+
else if (!addNew && hasOptions) {
|
|
356
|
+
placeholder = searchPlaceholder;
|
|
357
|
+
}
|
|
358
|
+
else if (addNew) {
|
|
359
|
+
placeholder = addPlaceholder;
|
|
360
|
+
}
|
|
361
|
+
return placeholder;
|
|
362
|
+
}
|
|
363
|
+
handleErrorMessageChange() {
|
|
364
|
+
if (this.errorMessage) {
|
|
365
|
+
this.announce(this.errorMessage);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
handleClick(ev) {
|
|
369
|
+
const el = ev.target;
|
|
370
|
+
if (this.isDropdown && !this.el.contains(el) && this.isExpanded) {
|
|
371
|
+
this.closeDropdown();
|
|
372
|
+
}
|
|
373
|
+
else if (Array.from(this.el.children).includes(el)) {
|
|
374
|
+
const option = el;
|
|
375
|
+
const tagName = this.getTagName(option);
|
|
376
|
+
this.lastAddedTags = [tagName];
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
handleOptionClick(ev) {
|
|
423
380
|
ev.preventDefault();
|
|
424
|
-
this.
|
|
425
|
-
|
|
426
|
-
case "ArrowLeft":
|
|
381
|
+
this.resetInput();
|
|
382
|
+
let option;
|
|
427
383
|
if (this.isTable) {
|
|
428
|
-
|
|
429
|
-
|
|
384
|
+
option = ev.target;
|
|
385
|
+
option = this.tagOptionFromEl(option.closest("tr"));
|
|
430
386
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (this.isTable) {
|
|
434
|
-
ev.preventDefault();
|
|
435
|
-
this.focusNextCell();
|
|
387
|
+
else {
|
|
388
|
+
option = this.tagOptionFromEl(ev.target);
|
|
436
389
|
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (
|
|
440
|
-
|
|
390
|
+
// if someone wants to attach a click event listener on wm-tag-option
|
|
391
|
+
option.click();
|
|
392
|
+
if (!option.locked) {
|
|
393
|
+
option.selected
|
|
394
|
+
? this.isTable && option.emitDeselectedEvent() // dropdown doesn't deselect on option click
|
|
395
|
+
: option.emitSelectedEvent();
|
|
441
396
|
}
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
397
|
+
}
|
|
398
|
+
// From wm-button
|
|
399
|
+
// we need to listen for scroll events during the capture phase because they do not bubble up
|
|
400
|
+
// there can be layouts where the main content has 100vh and overflows
|
|
401
|
+
// in these cases window will register no scroll events unless we catch on they way down
|
|
402
|
+
dismissTooltip() {
|
|
403
|
+
if (this.tooltipVisible) {
|
|
404
|
+
hideTooltip();
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
handleInputKeyDown(ev) {
|
|
408
|
+
if (/^.$/.test(ev.key) && this.charCount >= this.characterLimit) {
|
|
409
|
+
this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
|
|
410
|
+
}
|
|
411
|
+
// prevent keydown triggering on tag area
|
|
412
|
+
ev.stopPropagation();
|
|
413
|
+
switch (ev.key) {
|
|
414
|
+
case "Enter":
|
|
415
|
+
ev.preventDefault();
|
|
416
|
+
this.handleInputEnter();
|
|
417
|
+
break;
|
|
418
|
+
case "ArrowDown":
|
|
419
|
+
ev.preventDefault();
|
|
420
|
+
this.handleInputArrowDown();
|
|
421
|
+
break;
|
|
422
|
+
case "ArrowUp":
|
|
423
|
+
ev.preventDefault();
|
|
424
|
+
this.handleInputArrowUp();
|
|
425
|
+
break;
|
|
426
|
+
case "ArrowLeft":
|
|
427
|
+
if (this.isTable) {
|
|
428
|
+
ev.preventDefault();
|
|
429
|
+
this.focusPrevCell();
|
|
430
|
+
}
|
|
431
|
+
break;
|
|
432
|
+
case "ArrowRight":
|
|
433
|
+
if (this.isTable) {
|
|
434
|
+
ev.preventDefault();
|
|
435
|
+
this.focusNextCell();
|
|
436
|
+
}
|
|
437
|
+
break;
|
|
438
|
+
case "Escape":
|
|
439
|
+
if (this.isDropdown && this.isExpanded) {
|
|
440
|
+
this.closeDropdown();
|
|
441
|
+
}
|
|
442
|
+
break;
|
|
443
|
+
case "ArrowLeft":
|
|
444
|
+
case "Backspace":
|
|
445
|
+
this.handleInputBackspace();
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
handleInputFocus() {
|
|
450
|
+
if (this.isDropdown) {
|
|
451
|
+
this.openDropdown();
|
|
452
|
+
this.clearOptionFocus();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
handleInputChanged(ev) {
|
|
456
|
+
this.clearOptionFocus();
|
|
457
|
+
if (this.isDropdown) {
|
|
458
|
+
if (this.charCount >= this.characterLimit - 5) {
|
|
459
|
+
this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
|
|
460
|
+
}
|
|
461
|
+
if (!this.isExpanded) {
|
|
462
|
+
this.openDropdown();
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const val = ev.target.value;
|
|
466
|
+
if (val.includes(",") && this.addNew) {
|
|
467
|
+
this.addTags(val);
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
this.announceExistingOptions();
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
handleInputEnter() {
|
|
474
|
+
// user has selected an option in the list
|
|
475
|
+
if (this.focusedOption) {
|
|
476
|
+
const tagName = this.getTagName(this.focusedOption);
|
|
477
|
+
this.lastAddedTags = [tagName];
|
|
478
|
+
this.focusedOption.click();
|
|
479
|
+
this.focusedOption.selected
|
|
480
|
+
? this.isTable && this.focusedOption.emitDeselectedEvent()
|
|
481
|
+
: this.focusedOption.emitSelectedEvent();
|
|
482
|
+
this.resetInput();
|
|
483
|
+
}
|
|
484
|
+
else if (this.isDropdown) {
|
|
485
|
+
// user is adding a new tag
|
|
486
|
+
const tagName = this.inputEl.value;
|
|
487
|
+
if (!!tagName) {
|
|
488
|
+
this.isExistingTag(tagName) ? this.announce(this.tagAlreadyAddedMessage(tagName)) : this.addTags(tagName);
|
|
489
|
+
this.resetInput();
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
handleInputArrowDown() {
|
|
494
|
+
if (this.isDropdown) {
|
|
495
|
+
if (!this.isExpanded) {
|
|
496
|
+
this.openDropdown();
|
|
497
|
+
}
|
|
498
|
+
else {
|
|
499
|
+
let items = [];
|
|
500
|
+
// the id check prevents a bug where the ref is reassigned to the first option causing it to be added twice (after adding a new user option)
|
|
501
|
+
if (this.addNewButton && this.addNewButton.id === "add-new-btn") {
|
|
502
|
+
items.push(this.addNewButton);
|
|
503
|
+
}
|
|
504
|
+
this.filteredOptionEls.forEach((o) => {
|
|
505
|
+
items.push(this.elFromTagOption(o));
|
|
506
|
+
});
|
|
507
|
+
const next = findNext(items, this._focusedOption, true);
|
|
508
|
+
this.focusOption(next);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
const items = this.filteredOptionEls.filter((o) => !o.locked).map((o) => this.elFromTagOption(o));
|
|
513
|
+
const next = findNext(items, this._focusedOption, true);
|
|
514
|
+
this.focusOption(next);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
handleInputArrowUp() {
|
|
518
|
+
if (this.isDropdown) {
|
|
519
|
+
if (!this.isExpanded) {
|
|
520
|
+
this.openDropdown();
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
let items = [];
|
|
524
|
+
if (this.addNewButton) {
|
|
525
|
+
items.push(this.addNewButton);
|
|
526
|
+
}
|
|
527
|
+
this.filteredOptionEls.forEach((o) => {
|
|
528
|
+
items.push(this.elFromTagOption(o));
|
|
529
|
+
});
|
|
530
|
+
const prev = findPrev(items, this._focusedOption, true);
|
|
531
|
+
this.focusOption(prev);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
else {
|
|
535
|
+
const items = this.filteredOptionEls.filter((o) => !o.locked).map((o) => this.elFromTagOption(o));
|
|
536
|
+
const prev = findPrev(items, this._focusedOption, true);
|
|
537
|
+
this.focusOption(prev);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
handleInputBackspace() {
|
|
541
|
+
if (this.inputEl.value === "" && this.focusableTags.length > 0) {
|
|
542
|
+
// wait for events to finish firing before redirecting focus
|
|
543
|
+
// prevents double input in input area and tag area
|
|
544
|
+
window.requestAnimationFrame(() => {
|
|
545
|
+
this.tagAreaEl.focus();
|
|
546
|
+
this.focusTag(this.focusableTags[this.focusableTags.length - 1]);
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
handleTagAreaKeyDown(ev) {
|
|
551
|
+
switch (ev.key) {
|
|
552
|
+
case "ArrowLeft":
|
|
553
|
+
case "ArrowUp":
|
|
554
|
+
ev.preventDefault();
|
|
555
|
+
if (this.focusedTag) {
|
|
556
|
+
const prev = findPrev(this.focusableTags, this.focusedTag, true);
|
|
557
|
+
this.focusTag(prev);
|
|
558
|
+
}
|
|
559
|
+
break;
|
|
560
|
+
case "ArrowRight":
|
|
561
|
+
case "ArrowDown":
|
|
562
|
+
ev.preventDefault();
|
|
563
|
+
if (this.focusedTag) {
|
|
564
|
+
const next = findNext(this.focusableTags, this.focusedTag, true);
|
|
565
|
+
this.focusTag(next);
|
|
566
|
+
}
|
|
567
|
+
break;
|
|
568
|
+
case "Backspace":
|
|
569
|
+
case "Delete":
|
|
570
|
+
if (this.focusedTag) {
|
|
571
|
+
const option = this.tagOptionFromTag(this.focusedTag);
|
|
572
|
+
if (!option.locked) {
|
|
573
|
+
option.emitDeselectedEvent();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
handleBlur(ev) {
|
|
580
|
+
this.dismissTooltip();
|
|
581
|
+
this.clearOptionFocus();
|
|
582
|
+
const relTarget = ev.relatedTarget;
|
|
583
|
+
if (!this.isElOrChild(relTarget)) {
|
|
584
|
+
this.fieldWrapperEl.classList.remove("focused");
|
|
585
|
+
if (this.isDropdown) {
|
|
586
|
+
this.closeDropdown();
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
handleTagAreaFocus(ev) {
|
|
591
|
+
if (this.isDropdown) {
|
|
592
|
+
this.closeDropdown();
|
|
593
|
+
}
|
|
594
|
+
if (this.focusableTags.length > 0) {
|
|
595
|
+
const relTarget = ev.relatedTarget;
|
|
596
|
+
if (relTarget && relTarget.id === "input") {
|
|
597
|
+
const lastFocusableTag = this.focusableTags[this.focusableTags.length - 1];
|
|
598
|
+
this.focusTag(lastFocusableTag);
|
|
599
|
+
}
|
|
600
|
+
else {
|
|
601
|
+
const firstFocusableTag = this.focusableTags[0];
|
|
602
|
+
this.focusTag(firstFocusableTag);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
focusPrevCell() {
|
|
607
|
+
if (this.focusedOption) {
|
|
608
|
+
if (this.focusedColumn > 0) {
|
|
609
|
+
this.focusedColumn -= 1;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
focusNextCell() {
|
|
614
|
+
if (this._focusedOption) {
|
|
615
|
+
const lastCellIdx = this._focusedOption.querySelectorAll("td").length - 1;
|
|
616
|
+
if (this.focusedColumn < lastCellIdx) {
|
|
617
|
+
this.focusedColumn += 1;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
focusOption(optionToFocus) {
|
|
622
|
+
if (optionToFocus) {
|
|
623
|
+
// will be undefined for the "Add New" button
|
|
624
|
+
this.focusedOption = this.tagOptionFromEl(optionToFocus);
|
|
625
|
+
if (optionToFocus === this.addNewButton) {
|
|
626
|
+
this.addNewButton.classList.add("focused");
|
|
627
|
+
}
|
|
628
|
+
else {
|
|
629
|
+
this.addNewButton && this.addNewButton.classList.remove("focused");
|
|
630
|
+
}
|
|
631
|
+
if (this.isTable) {
|
|
632
|
+
// tooltip
|
|
633
|
+
const contentWrapper = this._focusedOption.querySelector(".cell-content-wrapper");
|
|
634
|
+
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
635
|
+
this.dismissTooltip();
|
|
636
|
+
if (isTruncated) {
|
|
637
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
638
|
+
showTooltip("bottom", this._focusedOption, this._focusedOption.innerText);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
optionToFocus.scrollIntoView({ block: "nearest" });
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
showTooltipIfTruncated(el) {
|
|
645
|
+
const displayedText = el.querySelector(".tag-text").textContent;
|
|
646
|
+
const id = el.id.replace("tag-", "");
|
|
647
|
+
if (id) {
|
|
648
|
+
const tagEl = this.el.querySelector("#" + id);
|
|
649
|
+
const fullText = this.getTagName(tagEl);
|
|
650
|
+
if (displayedText !== fullText && displayedText.includes("...")) {
|
|
651
|
+
showTooltip("bottom", el, fullText);
|
|
652
|
+
}
|
|
503
653
|
}
|
|
504
|
-
|
|
505
|
-
|
|
654
|
+
}
|
|
655
|
+
focusTag(element) {
|
|
656
|
+
// technically it's the tag area that has focus. This function handles the aria-activedescendant value within that parent
|
|
657
|
+
this.focusedTagIndex = this.focusableTags.indexOf(element);
|
|
658
|
+
element.scrollIntoView({ block: "nearest" });
|
|
659
|
+
window.requestAnimationFrame(() => {
|
|
660
|
+
hideTooltip();
|
|
661
|
+
this.showTooltipIfTruncated(element);
|
|
506
662
|
});
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
663
|
+
}
|
|
664
|
+
clearOptionFocus() {
|
|
665
|
+
this.focusedOption = undefined;
|
|
666
|
+
this.focusedColumn = 0;
|
|
667
|
+
}
|
|
668
|
+
openDropdown() {
|
|
669
|
+
// offset of -2px to avoid overlapping the focus border
|
|
670
|
+
this.openUp = shouldOpenUp(this.el, this.dropdownEl.clientHeight, this.el.clientHeight, -2);
|
|
671
|
+
this.isExpanded = true;
|
|
672
|
+
}
|
|
673
|
+
closeDropdown() {
|
|
674
|
+
this.clearOptionFocus();
|
|
675
|
+
this.isExpanded = false;
|
|
676
|
+
}
|
|
677
|
+
resetInput() {
|
|
678
|
+
this.inputEl.value = "";
|
|
679
|
+
}
|
|
680
|
+
announce(message) {
|
|
681
|
+
// \u00A0 is a non-breaking space character, which causes the message to be read as a new one
|
|
682
|
+
if (this.liveRegionEl.textContent === message) {
|
|
683
|
+
message += "\u00A0";
|
|
526
684
|
}
|
|
527
|
-
this.
|
|
528
|
-
|
|
685
|
+
this.liveRegionMessage = message;
|
|
686
|
+
}
|
|
687
|
+
addTags(tagNames) {
|
|
688
|
+
// covers both typing "," and pasting in text that includes ","
|
|
689
|
+
// if tag added without "," (typing enter), split puts the whole string in an array
|
|
690
|
+
this.lastAddedTags = tagNames.split(",").filter((t) => t.match(/\S/));
|
|
691
|
+
this.lastAddedTags.forEach((tag) => {
|
|
692
|
+
this.wmTagInputTagAdded.emit(tag);
|
|
529
693
|
});
|
|
530
|
-
|
|
531
|
-
this.
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
ev.preventDefault();
|
|
555
|
-
if (this.focusedTag) {
|
|
556
|
-
const prev = findPrev(this.focusableTags, this.focusedTag, true);
|
|
557
|
-
this.focusTag(prev);
|
|
694
|
+
this.announce(this.tagAddedMessage(this.lastAddedTags.join(", ")));
|
|
695
|
+
this.resetInput();
|
|
696
|
+
}
|
|
697
|
+
announceExistingOptions() {
|
|
698
|
+
// request animation frame to wait for re-rendering of filtered options
|
|
699
|
+
window.requestAnimationFrame(() => {
|
|
700
|
+
let numResults = 0;
|
|
701
|
+
if (this.isDropdown) {
|
|
702
|
+
numResults = this.optionEls.length;
|
|
703
|
+
}
|
|
704
|
+
else if (this.isTable) {
|
|
705
|
+
numResults = this.filteredOptionEls.length;
|
|
706
|
+
}
|
|
707
|
+
const existingOptionsMessage = intl.formatMessage({
|
|
708
|
+
id: "tagInput.existingOptions",
|
|
709
|
+
defaultMessage: "{num, plural, one {1 existing option.} other {# existing options.}}",
|
|
710
|
+
}, { num: numResults });
|
|
711
|
+
this.announce(existingOptionsMessage);
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
generateCharacterLimitWarning(charCount, charLimit) {
|
|
715
|
+
let message = globalMessages.getCharactersEntered(charCount, charLimit);
|
|
716
|
+
if (charCount >= charLimit) {
|
|
717
|
+
message += ` ${globalMessages.characterLimitReached}`;
|
|
558
718
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
719
|
+
return message;
|
|
720
|
+
}
|
|
721
|
+
positionInput() {
|
|
722
|
+
if (this.tagAreaEl) {
|
|
723
|
+
const lastTag = this._tagEls[this._tagEls.length - 1];
|
|
724
|
+
// default placement to fall back to when no tags are present, or not enough space is available
|
|
725
|
+
this.inputEl.style.position = "static";
|
|
726
|
+
this.inputEl.style.width = "100%";
|
|
727
|
+
this.inputEl.classList.add("extended");
|
|
728
|
+
if (lastTag) {
|
|
729
|
+
const spaceAvailable = this.tagAreaEl.getBoundingClientRect().right - lastTag.getBoundingClientRect().right;
|
|
730
|
+
if (spaceAvailable >= this.inputMinimumWidth) {
|
|
731
|
+
// because the input has right: 0px
|
|
732
|
+
// all thats needed to properly place it is setting position: absolute, top, and width
|
|
733
|
+
this.inputEl.style.position = "absolute";
|
|
734
|
+
this.inputEl.style.top = lastTag.offsetTop.toString() + "px";
|
|
735
|
+
this.inputEl.style.width = (spaceAvailable - 8).toString() + "px";
|
|
736
|
+
this.inputEl.classList.remove("extended");
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
handleTagMouseEnter(ev) {
|
|
742
|
+
this.showTooltipIfTruncated(ev.target);
|
|
743
|
+
}
|
|
744
|
+
renderDropdown() {
|
|
745
|
+
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.filteredOptionEls.map((o) => this.renderListItem(o)))));
|
|
746
|
+
}
|
|
747
|
+
renderHelpText() {
|
|
748
|
+
if (this.helpText)
|
|
749
|
+
return this.helpText;
|
|
750
|
+
let helpText = "";
|
|
751
|
+
if (this.optionEls.length > 0) {
|
|
752
|
+
helpText = this.selectionHelpText;
|
|
753
|
+
}
|
|
754
|
+
if (this.addNew) {
|
|
755
|
+
helpText += " " + this.addNewHelpText;
|
|
756
|
+
}
|
|
757
|
+
return helpText;
|
|
758
|
+
}
|
|
759
|
+
renderAddNewButton() {
|
|
760
|
+
const inputValue = this.inputEl.value.trim();
|
|
761
|
+
const hasNonWhiteSpaceCharacters = this.inputEl.value.match(/\S/);
|
|
762
|
+
const optionAlreadyExists = this.isExistingTag(this.inputEl.value.trim());
|
|
763
|
+
return (this.addNew &&
|
|
764
|
+
hasNonWhiteSpaceCharacters &&
|
|
765
|
+
!optionAlreadyExists && (h("li", { ref: (el) => (this.addNewButton = el), id: "add-new-btn", class: "add-new-btn", onClick: () => this.addTags(inputValue) }, "Add " + inputValue)));
|
|
766
|
+
}
|
|
767
|
+
renderTable() {
|
|
768
|
+
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.filteredOptionEls.length ? (this.filteredOptionEls.map((o) => this.renderTableRow(o))) : (h("div", { class: "no-results" }, this.noResultsMessage)))));
|
|
769
|
+
}
|
|
770
|
+
renderTableHeaders() {
|
|
771
|
+
return (h("tr", { class: "headers", role: "row" }, csvToArray(this.colHeaders).map((header, idx) => {
|
|
772
|
+
let overflowRule = "wrap";
|
|
773
|
+
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
774
|
+
overflowRule = csvToArray(this.colWrap)[idx];
|
|
775
|
+
}
|
|
776
|
+
return (h("th", { class: `header-cell ${overflowRule}`, role: "columnheader",
|
|
777
|
+
// @ts-ignore
|
|
778
|
+
width: this.colWidths ? csvToArray(this.colWidths)[idx] : "" }, header));
|
|
779
|
+
})));
|
|
780
|
+
}
|
|
781
|
+
renderTag(o) {
|
|
782
|
+
const focused = this.focusedTag && this.focusedTag.id === "tag-" + o.id ? "focused" : "";
|
|
783
|
+
const tagName = this.getTagName(o);
|
|
784
|
+
const highlight = this.lastAddedTags.includes(tagName) ? "highlight" : "";
|
|
785
|
+
return (h("li", { id: "tag-" + o.id, role: "option", class: `tag ${highlight} ${focused} ${o.locked ? "locked" : ""}`, onMouseEnter: (ev) => this.handleTagMouseEnter(ev), onMouseLeave: hideTooltip }, h("span", { class: "sr-only" }, tagName), h("span", { class: "tag-text", "aria-hidden": "true" }, tagName), o.locked ? (h("div", { class: "icon lock" })) : (h("button", { class: "icon remove-btn", tabIndex: -1, onClick: () => o.emitDeselectedEvent() }))));
|
|
786
|
+
}
|
|
787
|
+
renderTags() {
|
|
788
|
+
return this.tagsList.map((o) => this.renderTag(o));
|
|
789
|
+
}
|
|
790
|
+
renderTagCounter() {
|
|
791
|
+
if (this.maxTags) {
|
|
792
|
+
return (h("div", { class: "lower-row" }, h("div", { id: "max-tags" }, this.renderMaxTags())));
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
renderMaxTags() {
|
|
796
|
+
if (this.helpText) {
|
|
797
|
+
return this.helpText;
|
|
566
798
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
option.emitDeselectedEvent();
|
|
574
|
-
}
|
|
799
|
+
else {
|
|
800
|
+
let msg = `${this.tagsAddedMessage}: ${this.taggedOptions.length}/${this.maxTags}`;
|
|
801
|
+
if (this.tagLimitReached) {
|
|
802
|
+
msg += `- ${this.maxTagsReachedMessage}`;
|
|
803
|
+
}
|
|
804
|
+
return msg;
|
|
575
805
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
this.dismissTooltip();
|
|
581
|
-
this.clearOptionFocus();
|
|
582
|
-
const relTarget = ev.relatedTarget;
|
|
583
|
-
if (!this.isElOrChild(relTarget)) {
|
|
584
|
-
this.fieldWrapperEl.classList.remove("focused");
|
|
585
|
-
if (this.isDropdown) {
|
|
586
|
-
this.closeDropdown();
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
handleTagAreaFocus(ev) {
|
|
591
|
-
if (this.isDropdown) {
|
|
592
|
-
this.closeDropdown();
|
|
593
|
-
}
|
|
594
|
-
if (this.focusableTags.length > 0) {
|
|
595
|
-
const relTarget = ev.relatedTarget;
|
|
596
|
-
if (relTarget && relTarget.id === "input") {
|
|
597
|
-
const lastFocusableTag = this.focusableTags[this.focusableTags.length - 1];
|
|
598
|
-
this.focusTag(lastFocusableTag);
|
|
599
|
-
}
|
|
600
|
-
else {
|
|
601
|
-
const firstFocusableTag = this.focusableTags[0];
|
|
602
|
-
this.focusTag(firstFocusableTag);
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
focusPrevCell() {
|
|
607
|
-
if (this.focusedOption) {
|
|
608
|
-
if (this.focusedColumn > 0) {
|
|
609
|
-
this.focusedColumn -= 1;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
focusNextCell() {
|
|
614
|
-
if (this._focusedOption) {
|
|
615
|
-
const lastCellIdx = this._focusedOption.querySelectorAll("td").length - 1;
|
|
616
|
-
if (this.focusedColumn < lastCellIdx) {
|
|
617
|
-
this.focusedColumn += 1;
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
focusOption(optionToFocus) {
|
|
622
|
-
if (optionToFocus) {
|
|
623
|
-
// will be undefined for the "Add New" button
|
|
624
|
-
this.focusedOption = this.tagOptionFromEl(optionToFocus);
|
|
625
|
-
if (optionToFocus === this.addNewButton) {
|
|
626
|
-
this.addNewButton.classList.add("focused");
|
|
627
|
-
}
|
|
628
|
-
else {
|
|
629
|
-
this.addNewButton && this.addNewButton.classList.remove("focused");
|
|
630
|
-
}
|
|
631
|
-
if (this.isTable) {
|
|
632
|
-
// tooltip
|
|
633
|
-
const contentWrapper = this._focusedOption.querySelector(".cell-content-wrapper");
|
|
806
|
+
}
|
|
807
|
+
handleCellMouseEnter(ev) {
|
|
808
|
+
const cell = ev.target;
|
|
809
|
+
const contentWrapper = cell.querySelector(".cell-content-wrapper");
|
|
634
810
|
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
635
|
-
this.dismissTooltip();
|
|
636
811
|
if (isTruncated) {
|
|
637
|
-
|
|
638
|
-
|
|
812
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
813
|
+
showTooltip("bottom", cell, cell.innerText);
|
|
639
814
|
}
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
}
|
|
668
|
-
openDropdown() {
|
|
669
|
-
// offset of -2px to avoid overlapping the focus border
|
|
670
|
-
this.openUp = shouldOpenUp(this.el, this.dropdownEl.clientHeight, this.el.clientHeight, -2);
|
|
671
|
-
this.isExpanded = true;
|
|
672
|
-
}
|
|
673
|
-
closeDropdown() {
|
|
674
|
-
this.clearOptionFocus();
|
|
675
|
-
this.isExpanded = false;
|
|
676
|
-
}
|
|
677
|
-
resetInput() {
|
|
678
|
-
this.inputEl.value = "";
|
|
679
|
-
}
|
|
680
|
-
announce(message) {
|
|
681
|
-
// \u00A0 is a non-breaking space character, which causes the message to be read as a new one
|
|
682
|
-
if (this.liveRegionEl.textContent === message) {
|
|
683
|
-
message += "\u00A0";
|
|
684
|
-
}
|
|
685
|
-
this.liveRegionMessage = message;
|
|
686
|
-
}
|
|
687
|
-
addTags(tagNames) {
|
|
688
|
-
// covers both typing "," and pasting in text that includes ","
|
|
689
|
-
// if tag added without "," (typing enter), split puts the whole string in an array
|
|
690
|
-
this.lastAddedTags = tagNames.split(",").filter((t) => t.match(/\S/));
|
|
691
|
-
this.lastAddedTags.forEach((tag) => {
|
|
692
|
-
this.wmTagInputTagAdded.emit(tag);
|
|
693
|
-
});
|
|
694
|
-
this.announce(this.tagAddedMessage(this.lastAddedTags.join(", ")));
|
|
695
|
-
this.resetInput();
|
|
696
|
-
}
|
|
697
|
-
announceExistingOptions() {
|
|
698
|
-
// request animation frame to wait for re-rendering of filtered options
|
|
699
|
-
window.requestAnimationFrame(() => {
|
|
700
|
-
let numResults = 0;
|
|
701
|
-
if (this.isDropdown) {
|
|
702
|
-
numResults = this.optionEls.length;
|
|
703
|
-
}
|
|
704
|
-
else if (this.isTable) {
|
|
705
|
-
numResults = this.filteredOptionEls.length;
|
|
706
|
-
}
|
|
707
|
-
const existingOptionsMessage = intl.formatMessage({
|
|
708
|
-
id: "tagInput.existingOptions",
|
|
709
|
-
defaultMessage: "{num, plural, one {1 existing option.} other {# existing options.}}",
|
|
710
|
-
}, { num: numResults });
|
|
711
|
-
this.announce(existingOptionsMessage);
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
generateCharacterLimitWarning(charCount, charLimit) {
|
|
715
|
-
let message = globalMessages.getCharactersEntered(charCount, charLimit);
|
|
716
|
-
if (charCount >= charLimit) {
|
|
717
|
-
message += ` ${globalMessages.characterLimitReached}`;
|
|
718
|
-
}
|
|
719
|
-
return message;
|
|
720
|
-
}
|
|
721
|
-
positionInput() {
|
|
722
|
-
if (this.tagAreaEl) {
|
|
723
|
-
const lastTag = this._tagEls[this._tagEls.length - 1];
|
|
724
|
-
// default placement to fall back to when no tags are present, or not enough space is available
|
|
725
|
-
this.inputEl.style.position = "static";
|
|
726
|
-
this.inputEl.style.width = "100%";
|
|
727
|
-
this.inputEl.classList.add("extended");
|
|
728
|
-
if (lastTag) {
|
|
729
|
-
const spaceAvailable = this.tagAreaEl.getBoundingClientRect().right - lastTag.getBoundingClientRect().right;
|
|
730
|
-
if (spaceAvailable >= this.inputMinimumWidth) {
|
|
731
|
-
// because the input has right: 0px
|
|
732
|
-
// all thats needed to properly place it is setting position: absolute, top, and width
|
|
733
|
-
this.inputEl.style.position = "absolute";
|
|
734
|
-
this.inputEl.style.top = lastTag.offsetTop.toString() + "px";
|
|
735
|
-
this.inputEl.style.width = (spaceAvailable - 8).toString() + "px";
|
|
736
|
-
this.inputEl.classList.remove("extended");
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
handleTagMouseEnter(ev) {
|
|
742
|
-
this.showTooltipIfTruncated(ev.target);
|
|
743
|
-
}
|
|
744
|
-
renderDropdown() {
|
|
745
|
-
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.filteredOptionEls.map((o) => this.renderListItem(o)))));
|
|
746
|
-
}
|
|
747
|
-
renderHelpText() {
|
|
748
|
-
if (this.helpText)
|
|
749
|
-
return this.helpText;
|
|
750
|
-
let helpText = "";
|
|
751
|
-
if (this.optionEls.length > 0) {
|
|
752
|
-
helpText = this.selectionHelpText;
|
|
753
|
-
}
|
|
754
|
-
if (this.addNew) {
|
|
755
|
-
helpText += " " + this.addNewHelpText;
|
|
756
|
-
}
|
|
757
|
-
return helpText;
|
|
758
|
-
}
|
|
759
|
-
renderAddNewButton() {
|
|
760
|
-
const inputValue = this.inputEl.value.trim();
|
|
761
|
-
const hasNonWhiteSpaceCharacters = this.inputEl.value.match(/\S/);
|
|
762
|
-
const optionAlreadyExists = this.isExistingTag(this.inputEl.value.trim());
|
|
763
|
-
return (this.addNew &&
|
|
764
|
-
hasNonWhiteSpaceCharacters &&
|
|
765
|
-
!optionAlreadyExists && (h("li", { ref: (el) => (this.addNewButton = el), id: "add-new-btn", class: "add-new-btn", onClick: () => this.addTags(inputValue) }, "Add " + inputValue)));
|
|
766
|
-
}
|
|
767
|
-
renderTable() {
|
|
768
|
-
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.filteredOptionEls.length ? (this.filteredOptionEls.map((o) => this.renderTableRow(o))) : (h("div", { class: "no-results" }, this.noResultsMessage)))));
|
|
769
|
-
}
|
|
770
|
-
renderTableHeaders() {
|
|
771
|
-
return (h("tr", { class: "headers", role: "row" }, csvToArray(this.colHeaders).map((header, idx) => {
|
|
772
|
-
let overflowRule = "wrap";
|
|
773
|
-
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
774
|
-
overflowRule = csvToArray(this.colWrap)[idx];
|
|
775
|
-
}
|
|
776
|
-
return (h("th", { class: `header-cell ${overflowRule}`, role: "columnheader",
|
|
777
|
-
// @ts-ignore
|
|
778
|
-
width: this.colWidths ? csvToArray(this.colWidths)[idx] : "" }, header));
|
|
779
|
-
})));
|
|
780
|
-
}
|
|
781
|
-
renderTag(o) {
|
|
782
|
-
const focused = this.focusedTag && this.focusedTag.id === "tag-" + o.id ? "focused" : "";
|
|
783
|
-
const tagName = this.getTagName(o);
|
|
784
|
-
const highlight = this.lastAddedTags.includes(tagName) ? "highlight" : "";
|
|
785
|
-
return (h("li", { id: "tag-" + o.id, role: "option", class: `tag ${highlight} ${focused} ${o.locked ? "locked" : ""}`, onMouseEnter: (ev) => this.handleTagMouseEnter(ev), onMouseLeave: hideTooltip }, h("span", { class: "sr-only" }, tagName), h("span", { class: "tag-text", "aria-hidden": "true" }, tagName), o.locked ? (h("div", { class: "icon lock" })) : (h("button", { class: "icon remove-btn", tabIndex: -1, onClick: () => o.emitDeselectedEvent() }))));
|
|
786
|
-
}
|
|
787
|
-
renderTags() {
|
|
788
|
-
return this.tagsList.map((o) => this.renderTag(o));
|
|
789
|
-
}
|
|
790
|
-
renderTagCounter() {
|
|
791
|
-
if (this.maxTags) {
|
|
792
|
-
return (h("div", { class: "lower-row" }, h("div", { id: "max-tags" }, this.renderMaxTags())));
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
renderMaxTags() {
|
|
796
|
-
if (this.helpText) {
|
|
797
|
-
return this.helpText;
|
|
798
|
-
}
|
|
799
|
-
else {
|
|
800
|
-
let msg = `${this.tagsAddedMessage}: ${this.taggedOptions.length}/${this.maxTags}`;
|
|
801
|
-
if (this.tagLimitReached) {
|
|
802
|
-
msg += `- ${this.maxTagsReachedMessage}`;
|
|
803
|
-
}
|
|
804
|
-
return msg;
|
|
805
|
-
}
|
|
806
|
-
}
|
|
807
|
-
handleCellMouseEnter(ev) {
|
|
808
|
-
const cell = ev.target;
|
|
809
|
-
const contentWrapper = cell.querySelector(".cell-content-wrapper");
|
|
810
|
-
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
811
|
-
if (isTruncated) {
|
|
812
|
-
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
813
|
-
showTooltip("bottom", cell, cell.innerText);
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
renderTableCells(o) {
|
|
817
|
-
const colValues = [o.col1, o.col2, o.col3, o.col4].filter((val) => !!val);
|
|
818
|
-
return colValues.map((val, idx) => {
|
|
819
|
-
const cellId = `${o.id}-col${idx + 1}`;
|
|
820
|
-
let overflowRule = "wrap";
|
|
821
|
-
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
822
|
-
overflowRule = csvToArray(this.colWrap)[idx];
|
|
823
|
-
}
|
|
824
|
-
const classes = {
|
|
825
|
-
focused: !!this._focusedCell && cellId === this._focusedCell.id,
|
|
826
|
-
};
|
|
827
|
-
return (h("td", { id: cellId, class: classes, role: "gridcell", "aria-describedby": `${cellId}-description`, "aria-selected": o.selected ? "true" : "false", onMouseEnter: (ev) => this.handleCellMouseEnter(ev), onMouseLeave: () => hideTooltip() }, h("div", { class: `cell-content-wrapper ${overflowRule}` }, val), h("div", { class: "description", id: `${cellId}-description` }, o.locked ? "locked" : "")));
|
|
828
|
-
});
|
|
829
|
-
}
|
|
830
|
-
renderTableRow(o) {
|
|
831
|
-
const classes = {
|
|
832
|
-
selected: o.selected,
|
|
833
|
-
locked: o.locked,
|
|
834
|
-
focused: this.focusedOption && o === this.focusedOption ? true : false,
|
|
835
|
-
};
|
|
836
|
-
return (h("tr", { id: o.id, class: classes, onClick: (ev) => this.handleOptionClick(ev) }, this.renderTableCells(o)));
|
|
837
|
-
}
|
|
838
|
-
renderListItem(o) {
|
|
839
|
-
if (!!this.inputEl) {
|
|
840
|
-
const isFocused = this.focusedOption && o === this.focusedOption;
|
|
841
|
-
return (h("li", { id: o.id, role: "option", class: `option ${isFocused ? "focused" : ""}`, "aria-selected": o.selected ? "true" : "false", onClick: (ev) => this.handleOptionClick(ev) }, o.textContent));
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
render() {
|
|
845
|
-
return (h("div", { class: `wrapper label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { class: "label-wrapper" }, h("label", { class: "label", htmlFor: "input" }, this.label, this.requiredField && (h("span", { class: "required", "aria-hidden": "true" }, "*")))), h("div", { class: `field-wrapper ${this.el.shadowRoot.activeElement === this.inputEl ? "focused" : ""} ${this.errorMessage ? "invalid" : ""}`, ref: (el) => (this.fieldWrapperEl = el) }, h("div", { class: "upper-row" }, h("div", { class: `tags-and-input-wrapper ${this.inModal ? "in-modal" : ""}` }, h("ul", { ref: (el) => (this.tagAreaEl = el), class: `tag-area ${this.taggedOptions.length === 0 && "empty"}`, role: "listbox", "aria-activedescendant": this.focusedTag ? this.focusedTag.id : null, "aria-orientation": "horizontal", "aria-label": `${this.label} ${this.tagAreaInstructions}`, tabindex: this.focusableTags.length > 0 ? 0 : -1, "aria-describedby": `info max-tags`, onFocus: (ev) => this.handleTagAreaFocus(ev), onBlur: (ev) => {
|
|
846
|
-
this.focusedTagIndex = undefined;
|
|
847
|
-
this.handleBlur(ev);
|
|
848
|
-
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags()), h("input", { id: "input", class: "input", 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.isDropdown ? globalMessages.getCharacterLimit(this.characterLimit) : ""}`, "aria-expanded": this.isDropdown ? this.isExpanded.toString() : null, "aria-activedescendant": this.inputActiveDescendantId, placeholder: this.placeholder, maxLength: this.isDropdown ? this.characterLimit : undefined, onInput: (ev) => this.handleInputChanged(ev), onBlur: (ev) => {
|
|
849
|
-
this.handleBlur(ev);
|
|
850
|
-
}, onFocus: () => this.handleInputFocus(), onKeyDown: (ev) => this.handleInputKeyDown(ev) })), this.isDropdown && (h("div", { class: "character-count" }, this.charCount, "/", this.characterLimit))), this.renderTagCounter(), this.isDropdown && 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.isTable && this.renderTable()));
|
|
851
|
-
}
|
|
852
|
-
static get is() { return "wm-tag-input"; }
|
|
853
|
-
static get encapsulation() { return "shadow"; }
|
|
854
|
-
static get delegatesFocus() { return true; }
|
|
855
|
-
static get originalStyleUrls() {
|
|
856
|
-
return {
|
|
857
|
-
"$": ["wm-tag-input.scss"]
|
|
858
|
-
};
|
|
859
|
-
}
|
|
860
|
-
static get styleUrls() {
|
|
861
|
-
return {
|
|
862
|
-
"$": ["wm-tag-input.css"]
|
|
863
|
-
};
|
|
864
|
-
}
|
|
865
|
-
static get properties() {
|
|
866
|
-
return {
|
|
867
|
-
"label": {
|
|
868
|
-
"type": "string",
|
|
869
|
-
"mutable": false,
|
|
870
|
-
"complexType": {
|
|
871
|
-
"original": "string",
|
|
872
|
-
"resolved": "string",
|
|
873
|
-
"references": {}
|
|
874
|
-
},
|
|
875
|
-
"required": true,
|
|
876
|
-
"optional": false,
|
|
877
|
-
"docs": {
|
|
878
|
-
"tags": [],
|
|
879
|
-
"text": ""
|
|
880
|
-
},
|
|
881
|
-
"attribute": "label",
|
|
882
|
-
"reflect": false
|
|
883
|
-
},
|
|
884
|
-
"errorMessage": {
|
|
885
|
-
"type": "string",
|
|
886
|
-
"mutable": false,
|
|
887
|
-
"complexType": {
|
|
888
|
-
"original": "string",
|
|
889
|
-
"resolved": "string | undefined",
|
|
890
|
-
"references": {}
|
|
891
|
-
},
|
|
892
|
-
"required": false,
|
|
893
|
-
"optional": true,
|
|
894
|
-
"docs": {
|
|
895
|
-
"tags": [],
|
|
896
|
-
"text": ""
|
|
897
|
-
},
|
|
898
|
-
"attribute": "error-message",
|
|
899
|
-
"reflect": false
|
|
900
|
-
},
|
|
901
|
-
"info": {
|
|
902
|
-
"type": "string",
|
|
903
|
-
"mutable": false,
|
|
904
|
-
"complexType": {
|
|
905
|
-
"original": "string",
|
|
906
|
-
"resolved": "string | undefined",
|
|
907
|
-
"references": {}
|
|
908
|
-
},
|
|
909
|
-
"required": false,
|
|
910
|
-
"optional": true,
|
|
911
|
-
"docs": {
|
|
912
|
-
"tags": [],
|
|
913
|
-
"text": ""
|
|
914
|
-
},
|
|
915
|
-
"attribute": "info",
|
|
916
|
-
"reflect": false
|
|
917
|
-
},
|
|
918
|
-
"labelPosition": {
|
|
919
|
-
"type": "string",
|
|
920
|
-
"mutable": false,
|
|
921
|
-
"complexType": {
|
|
922
|
-
"original": "\"top\" | \"left\" | \"none\"",
|
|
923
|
-
"resolved": "\"left\" | \"none\" | \"top\"",
|
|
924
|
-
"references": {}
|
|
925
|
-
},
|
|
926
|
-
"required": false,
|
|
927
|
-
"optional": false,
|
|
928
|
-
"docs": {
|
|
929
|
-
"tags": [],
|
|
930
|
-
"text": ""
|
|
931
|
-
},
|
|
932
|
-
"attribute": "label-position",
|
|
933
|
-
"reflect": false,
|
|
934
|
-
"defaultValue": "\"top\""
|
|
935
|
-
},
|
|
936
|
-
"maxTags": {
|
|
937
|
-
"type": "number",
|
|
938
|
-
"mutable": false,
|
|
939
|
-
"complexType": {
|
|
940
|
-
"original": "number",
|
|
941
|
-
"resolved": "number | undefined",
|
|
942
|
-
"references": {}
|
|
943
|
-
},
|
|
944
|
-
"required": false,
|
|
945
|
-
"optional": true,
|
|
946
|
-
"docs": {
|
|
947
|
-
"tags": [],
|
|
948
|
-
"text": ""
|
|
949
|
-
},
|
|
950
|
-
"attribute": "max-tags",
|
|
951
|
-
"reflect": false
|
|
952
|
-
},
|
|
953
|
-
"placeholder": {
|
|
954
|
-
"type": "string",
|
|
955
|
-
"mutable": true,
|
|
956
|
-
"complexType": {
|
|
957
|
-
"original": "string",
|
|
958
|
-
"resolved": "string | undefined",
|
|
959
|
-
"references": {}
|
|
960
|
-
},
|
|
961
|
-
"required": false,
|
|
962
|
-
"optional": true,
|
|
963
|
-
"docs": {
|
|
964
|
-
"tags": [],
|
|
965
|
-
"text": ""
|
|
966
|
-
},
|
|
967
|
-
"attribute": "placeholder",
|
|
968
|
-
"reflect": false
|
|
969
|
-
},
|
|
970
|
-
"requiredField": {
|
|
971
|
-
"type": "boolean",
|
|
972
|
-
"mutable": false,
|
|
973
|
-
"complexType": {
|
|
974
|
-
"original": "boolean",
|
|
975
|
-
"resolved": "boolean",
|
|
976
|
-
"references": {}
|
|
977
|
-
},
|
|
978
|
-
"required": false,
|
|
979
|
-
"optional": false,
|
|
980
|
-
"docs": {
|
|
981
|
-
"tags": [],
|
|
982
|
-
"text": ""
|
|
983
|
-
},
|
|
984
|
-
"attribute": "required-field",
|
|
985
|
-
"reflect": false,
|
|
986
|
-
"defaultValue": "false"
|
|
987
|
-
},
|
|
988
|
-
"tagInputType": {
|
|
989
|
-
"type": "string",
|
|
990
|
-
"mutable": false,
|
|
991
|
-
"complexType": {
|
|
992
|
-
"original": "\"dropdown\" | \"table\"",
|
|
993
|
-
"resolved": "\"dropdown\" | \"table\"",
|
|
994
|
-
"references": {}
|
|
995
|
-
},
|
|
996
|
-
"required": false,
|
|
997
|
-
"optional": false,
|
|
998
|
-
"docs": {
|
|
999
|
-
"tags": [],
|
|
1000
|
-
"text": ""
|
|
1001
|
-
},
|
|
1002
|
-
"attribute": "tag-input-type",
|
|
1003
|
-
"reflect": false,
|
|
1004
|
-
"defaultValue": "\"dropdown\""
|
|
1005
|
-
},
|
|
1006
|
-
"helpText": {
|
|
1007
|
-
"type": "string",
|
|
1008
|
-
"mutable": false,
|
|
1009
|
-
"complexType": {
|
|
1010
|
-
"original": "string",
|
|
1011
|
-
"resolved": "string | undefined",
|
|
1012
|
-
"references": {}
|
|
1013
|
-
},
|
|
1014
|
-
"required": false,
|
|
1015
|
-
"optional": true,
|
|
1016
|
-
"docs": {
|
|
1017
|
-
"tags": [],
|
|
1018
|
-
"text": ""
|
|
1019
|
-
},
|
|
1020
|
-
"attribute": "help-text",
|
|
1021
|
-
"reflect": false
|
|
1022
|
-
},
|
|
1023
|
-
"addNew": {
|
|
1024
|
-
"type": "boolean",
|
|
1025
|
-
"mutable": false,
|
|
1026
|
-
"complexType": {
|
|
1027
|
-
"original": "boolean",
|
|
1028
|
-
"resolved": "boolean",
|
|
1029
|
-
"references": {}
|
|
1030
|
-
},
|
|
1031
|
-
"required": false,
|
|
1032
|
-
"optional": false,
|
|
1033
|
-
"docs": {
|
|
1034
|
-
"tags": [],
|
|
1035
|
-
"text": ""
|
|
1036
|
-
},
|
|
1037
|
-
"attribute": "add-new",
|
|
1038
|
-
"reflect": false,
|
|
1039
|
-
"defaultValue": "true"
|
|
1040
|
-
},
|
|
1041
|
-
"characterLimit": {
|
|
1042
|
-
"type": "number",
|
|
1043
|
-
"mutable": false,
|
|
1044
|
-
"complexType": {
|
|
1045
|
-
"original": "number",
|
|
1046
|
-
"resolved": "number",
|
|
1047
|
-
"references": {}
|
|
1048
|
-
},
|
|
1049
|
-
"required": false,
|
|
1050
|
-
"optional": false,
|
|
1051
|
-
"docs": {
|
|
1052
|
-
"tags": [],
|
|
1053
|
-
"text": ""
|
|
1054
|
-
},
|
|
1055
|
-
"attribute": "character-limit",
|
|
1056
|
-
"reflect": false,
|
|
1057
|
-
"defaultValue": "50"
|
|
1058
|
-
},
|
|
1059
|
-
"colHeaders": {
|
|
1060
|
-
"type": "string",
|
|
1061
|
-
"mutable": false,
|
|
1062
|
-
"complexType": {
|
|
1063
|
-
"original": "string",
|
|
1064
|
-
"resolved": "string",
|
|
1065
|
-
"references": {}
|
|
1066
|
-
},
|
|
1067
|
-
"required": true,
|
|
1068
|
-
"optional": false,
|
|
1069
|
-
"docs": {
|
|
1070
|
-
"tags": [],
|
|
1071
|
-
"text": ""
|
|
1072
|
-
},
|
|
1073
|
-
"attribute": "col-headers",
|
|
1074
|
-
"reflect": false
|
|
1075
|
-
},
|
|
1076
|
-
"colWidths": {
|
|
1077
|
-
"type": "string",
|
|
1078
|
-
"mutable": false,
|
|
1079
|
-
"complexType": {
|
|
1080
|
-
"original": "string",
|
|
1081
|
-
"resolved": "string | undefined",
|
|
1082
|
-
"references": {}
|
|
1083
|
-
},
|
|
1084
|
-
"required": false,
|
|
1085
|
-
"optional": true,
|
|
1086
|
-
"docs": {
|
|
1087
|
-
"tags": [],
|
|
1088
|
-
"text": ""
|
|
1089
|
-
},
|
|
1090
|
-
"attribute": "col-widths",
|
|
1091
|
-
"reflect": false
|
|
1092
|
-
},
|
|
1093
|
-
"colWrap": {
|
|
1094
|
-
"type": "string",
|
|
1095
|
-
"mutable": false,
|
|
1096
|
-
"complexType": {
|
|
1097
|
-
"original": "string",
|
|
1098
|
-
"resolved": "string | undefined",
|
|
1099
|
-
"references": {}
|
|
1100
|
-
},
|
|
1101
|
-
"required": false,
|
|
1102
|
-
"optional": true,
|
|
1103
|
-
"docs": {
|
|
1104
|
-
"tags": [],
|
|
1105
|
-
"text": ""
|
|
1106
|
-
},
|
|
1107
|
-
"attribute": "col-wrap",
|
|
1108
|
-
"reflect": false
|
|
1109
|
-
}
|
|
1110
|
-
};
|
|
1111
|
-
}
|
|
1112
|
-
static get states() {
|
|
1113
|
-
return {
|
|
1114
|
-
"isExpanded": {},
|
|
1115
|
-
"liveRegionMessage": {},
|
|
1116
|
-
"focusedOption": {},
|
|
1117
|
-
"focusedColumn": {},
|
|
1118
|
-
"focusedTagIndex": {},
|
|
1119
|
-
"tagsList": {}
|
|
1120
|
-
};
|
|
1121
|
-
}
|
|
1122
|
-
static get events() {
|
|
1123
|
-
return [{
|
|
1124
|
-
"method": "wmTagInputTagAdded",
|
|
1125
|
-
"name": "wmTagInputTagAdded",
|
|
1126
|
-
"bubbles": true,
|
|
1127
|
-
"cancelable": true,
|
|
1128
|
-
"composed": true,
|
|
1129
|
-
"docs": {
|
|
1130
|
-
"tags": [],
|
|
1131
|
-
"text": ""
|
|
1132
|
-
},
|
|
1133
|
-
"complexType": {
|
|
1134
|
-
"original": "any",
|
|
1135
|
-
"resolved": "any",
|
|
1136
|
-
"references": {}
|
|
815
|
+
}
|
|
816
|
+
renderTableCells(o) {
|
|
817
|
+
const colValues = [o.col1, o.col2, o.col3, o.col4].filter((val) => !!val);
|
|
818
|
+
return colValues.map((val, idx) => {
|
|
819
|
+
const cellId = `${o.id}-col${idx + 1}`;
|
|
820
|
+
let overflowRule = "wrap";
|
|
821
|
+
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
822
|
+
overflowRule = csvToArray(this.colWrap)[idx];
|
|
823
|
+
}
|
|
824
|
+
const classes = {
|
|
825
|
+
focused: !!this._focusedCell && cellId === this._focusedCell.id,
|
|
826
|
+
};
|
|
827
|
+
return (h("td", { id: cellId, class: classes, role: "gridcell", "aria-describedby": `${cellId}-description`, "aria-selected": o.selected ? "true" : "false", onMouseEnter: (ev) => this.handleCellMouseEnter(ev), onMouseLeave: () => hideTooltip() }, h("div", { class: `cell-content-wrapper ${overflowRule}` }, val), h("div", { class: "description", id: `${cellId}-description` }, o.locked ? "locked" : "")));
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
renderTableRow(o) {
|
|
831
|
+
const classes = {
|
|
832
|
+
selected: o.selected,
|
|
833
|
+
locked: o.locked,
|
|
834
|
+
focused: this.focusedOption && o === this.focusedOption ? true : false,
|
|
835
|
+
};
|
|
836
|
+
return (h("tr", { id: o.id, class: classes, onClick: (ev) => this.handleOptionClick(ev) }, this.renderTableCells(o)));
|
|
837
|
+
}
|
|
838
|
+
renderListItem(o) {
|
|
839
|
+
if (!!this.inputEl) {
|
|
840
|
+
const isFocused = this.focusedOption && o === this.focusedOption;
|
|
841
|
+
return (h("li", { id: o.id, role: "option", class: `option ${isFocused ? "focused" : ""}`, "aria-selected": o.selected ? "true" : "false", onClick: (ev) => this.handleOptionClick(ev) }, o.textContent));
|
|
1137
842
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
return
|
|
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
|
-
|
|
843
|
+
}
|
|
844
|
+
render() {
|
|
845
|
+
return (h("div", { class: `wrapper label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { class: "label-wrapper" }, h("label", { class: "label", htmlFor: "input" }, this.label, this.requiredField && (h("span", { class: "required", "aria-hidden": "true" }, "*")))), h("div", { class: `field-wrapper ${this.el.shadowRoot.activeElement === this.inputEl ? "focused" : ""} ${this.errorMessage ? "invalid" : ""}`, ref: (el) => (this.fieldWrapperEl = el) }, h("div", { class: "upper-row" }, h("div", { class: `tags-and-input-wrapper ${this.inModal ? "in-modal" : ""}` }, h("ul", { ref: (el) => (this.tagAreaEl = el), class: `tag-area ${this.taggedOptions.length === 0 && "empty"}`, role: "listbox", "aria-activedescendant": this.focusedTag ? this.focusedTag.id : null, "aria-orientation": "horizontal", "aria-label": `${this.label} ${this.tagAreaInstructions}`, tabindex: this.focusableTags.length > 0 ? 0 : -1, "aria-describedby": `info max-tags`, onFocus: (ev) => this.handleTagAreaFocus(ev), onBlur: (ev) => {
|
|
846
|
+
this.focusedTagIndex = undefined;
|
|
847
|
+
this.handleBlur(ev);
|
|
848
|
+
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags()), h("input", { id: "input", class: "input", 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.isDropdown ? globalMessages.getCharacterLimit(this.characterLimit) : ""}`, "aria-expanded": this.isDropdown ? this.isExpanded.toString() : null, "aria-activedescendant": this.inputActiveDescendantId, placeholder: this.placeholder, maxLength: this.isDropdown ? this.characterLimit : undefined, onInput: (ev) => this.handleInputChanged(ev), onBlur: (ev) => {
|
|
849
|
+
this.handleBlur(ev);
|
|
850
|
+
}, onFocus: () => this.handleInputFocus(), onKeyDown: (ev) => this.handleInputKeyDown(ev) })), this.isDropdown && (h("div", { class: "character-count" }, this.charCount, "/", this.characterLimit))), this.renderTagCounter(), this.isDropdown && 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.isTable && this.renderTable()));
|
|
851
|
+
}
|
|
852
|
+
static get is() { return "wm-tag-input"; }
|
|
853
|
+
static get encapsulation() { return "shadow"; }
|
|
854
|
+
static get delegatesFocus() { return true; }
|
|
855
|
+
static get originalStyleUrls() {
|
|
856
|
+
return {
|
|
857
|
+
"$": ["wm-tag-input.scss"]
|
|
858
|
+
};
|
|
859
|
+
}
|
|
860
|
+
static get styleUrls() {
|
|
861
|
+
return {
|
|
862
|
+
"$": ["wm-tag-input.css"]
|
|
863
|
+
};
|
|
864
|
+
}
|
|
865
|
+
static get properties() {
|
|
866
|
+
return {
|
|
867
|
+
"label": {
|
|
868
|
+
"type": "string",
|
|
869
|
+
"mutable": false,
|
|
870
|
+
"complexType": {
|
|
871
|
+
"original": "string",
|
|
872
|
+
"resolved": "string",
|
|
873
|
+
"references": {}
|
|
874
|
+
},
|
|
875
|
+
"required": true,
|
|
876
|
+
"optional": false,
|
|
877
|
+
"docs": {
|
|
878
|
+
"tags": [],
|
|
879
|
+
"text": ""
|
|
880
|
+
},
|
|
881
|
+
"attribute": "label",
|
|
882
|
+
"reflect": false
|
|
883
|
+
},
|
|
884
|
+
"errorMessage": {
|
|
885
|
+
"type": "string",
|
|
886
|
+
"mutable": false,
|
|
887
|
+
"complexType": {
|
|
888
|
+
"original": "string",
|
|
889
|
+
"resolved": "string | undefined",
|
|
890
|
+
"references": {}
|
|
891
|
+
},
|
|
892
|
+
"required": false,
|
|
893
|
+
"optional": true,
|
|
894
|
+
"docs": {
|
|
895
|
+
"tags": [],
|
|
896
|
+
"text": ""
|
|
897
|
+
},
|
|
898
|
+
"attribute": "error-message",
|
|
899
|
+
"reflect": false
|
|
900
|
+
},
|
|
901
|
+
"info": {
|
|
902
|
+
"type": "string",
|
|
903
|
+
"mutable": false,
|
|
904
|
+
"complexType": {
|
|
905
|
+
"original": "string",
|
|
906
|
+
"resolved": "string | undefined",
|
|
907
|
+
"references": {}
|
|
908
|
+
},
|
|
909
|
+
"required": false,
|
|
910
|
+
"optional": true,
|
|
911
|
+
"docs": {
|
|
912
|
+
"tags": [],
|
|
913
|
+
"text": ""
|
|
914
|
+
},
|
|
915
|
+
"attribute": "info",
|
|
916
|
+
"reflect": false
|
|
917
|
+
},
|
|
918
|
+
"labelPosition": {
|
|
919
|
+
"type": "string",
|
|
920
|
+
"mutable": false,
|
|
921
|
+
"complexType": {
|
|
922
|
+
"original": "\"top\" | \"left\" | \"none\"",
|
|
923
|
+
"resolved": "\"left\" | \"none\" | \"top\"",
|
|
924
|
+
"references": {}
|
|
925
|
+
},
|
|
926
|
+
"required": false,
|
|
927
|
+
"optional": false,
|
|
928
|
+
"docs": {
|
|
929
|
+
"tags": [],
|
|
930
|
+
"text": ""
|
|
931
|
+
},
|
|
932
|
+
"attribute": "label-position",
|
|
933
|
+
"reflect": false,
|
|
934
|
+
"defaultValue": "\"top\""
|
|
935
|
+
},
|
|
936
|
+
"maxTags": {
|
|
937
|
+
"type": "number",
|
|
938
|
+
"mutable": false,
|
|
939
|
+
"complexType": {
|
|
940
|
+
"original": "number",
|
|
941
|
+
"resolved": "number | undefined",
|
|
942
|
+
"references": {}
|
|
943
|
+
},
|
|
944
|
+
"required": false,
|
|
945
|
+
"optional": true,
|
|
946
|
+
"docs": {
|
|
947
|
+
"tags": [],
|
|
948
|
+
"text": ""
|
|
949
|
+
},
|
|
950
|
+
"attribute": "max-tags",
|
|
951
|
+
"reflect": false
|
|
952
|
+
},
|
|
953
|
+
"placeholder": {
|
|
954
|
+
"type": "string",
|
|
955
|
+
"mutable": true,
|
|
956
|
+
"complexType": {
|
|
957
|
+
"original": "string",
|
|
958
|
+
"resolved": "string | undefined",
|
|
959
|
+
"references": {}
|
|
960
|
+
},
|
|
961
|
+
"required": false,
|
|
962
|
+
"optional": true,
|
|
963
|
+
"docs": {
|
|
964
|
+
"tags": [],
|
|
965
|
+
"text": ""
|
|
966
|
+
},
|
|
967
|
+
"attribute": "placeholder",
|
|
968
|
+
"reflect": false
|
|
969
|
+
},
|
|
970
|
+
"requiredField": {
|
|
971
|
+
"type": "boolean",
|
|
972
|
+
"mutable": false,
|
|
973
|
+
"complexType": {
|
|
974
|
+
"original": "boolean",
|
|
975
|
+
"resolved": "boolean",
|
|
976
|
+
"references": {}
|
|
977
|
+
},
|
|
978
|
+
"required": false,
|
|
979
|
+
"optional": false,
|
|
980
|
+
"docs": {
|
|
981
|
+
"tags": [],
|
|
982
|
+
"text": ""
|
|
983
|
+
},
|
|
984
|
+
"attribute": "required-field",
|
|
985
|
+
"reflect": false,
|
|
986
|
+
"defaultValue": "false"
|
|
987
|
+
},
|
|
988
|
+
"tagInputType": {
|
|
989
|
+
"type": "string",
|
|
990
|
+
"mutable": false,
|
|
991
|
+
"complexType": {
|
|
992
|
+
"original": "\"dropdown\" | \"table\"",
|
|
993
|
+
"resolved": "\"dropdown\" | \"table\"",
|
|
994
|
+
"references": {}
|
|
995
|
+
},
|
|
996
|
+
"required": false,
|
|
997
|
+
"optional": false,
|
|
998
|
+
"docs": {
|
|
999
|
+
"tags": [],
|
|
1000
|
+
"text": ""
|
|
1001
|
+
},
|
|
1002
|
+
"attribute": "tag-input-type",
|
|
1003
|
+
"reflect": false,
|
|
1004
|
+
"defaultValue": "\"dropdown\""
|
|
1005
|
+
},
|
|
1006
|
+
"helpText": {
|
|
1007
|
+
"type": "string",
|
|
1008
|
+
"mutable": false,
|
|
1009
|
+
"complexType": {
|
|
1010
|
+
"original": "string",
|
|
1011
|
+
"resolved": "string | undefined",
|
|
1012
|
+
"references": {}
|
|
1013
|
+
},
|
|
1014
|
+
"required": false,
|
|
1015
|
+
"optional": true,
|
|
1016
|
+
"docs": {
|
|
1017
|
+
"tags": [],
|
|
1018
|
+
"text": ""
|
|
1019
|
+
},
|
|
1020
|
+
"attribute": "help-text",
|
|
1021
|
+
"reflect": false
|
|
1022
|
+
},
|
|
1023
|
+
"addNew": {
|
|
1024
|
+
"type": "boolean",
|
|
1025
|
+
"mutable": false,
|
|
1026
|
+
"complexType": {
|
|
1027
|
+
"original": "boolean",
|
|
1028
|
+
"resolved": "boolean",
|
|
1029
|
+
"references": {}
|
|
1030
|
+
},
|
|
1031
|
+
"required": false,
|
|
1032
|
+
"optional": false,
|
|
1033
|
+
"docs": {
|
|
1034
|
+
"tags": [],
|
|
1035
|
+
"text": ""
|
|
1036
|
+
},
|
|
1037
|
+
"attribute": "add-new",
|
|
1038
|
+
"reflect": false,
|
|
1039
|
+
"defaultValue": "true"
|
|
1040
|
+
},
|
|
1041
|
+
"characterLimit": {
|
|
1042
|
+
"type": "number",
|
|
1043
|
+
"mutable": false,
|
|
1044
|
+
"complexType": {
|
|
1045
|
+
"original": "number",
|
|
1046
|
+
"resolved": "number",
|
|
1047
|
+
"references": {}
|
|
1048
|
+
},
|
|
1049
|
+
"required": false,
|
|
1050
|
+
"optional": false,
|
|
1051
|
+
"docs": {
|
|
1052
|
+
"tags": [],
|
|
1053
|
+
"text": ""
|
|
1054
|
+
},
|
|
1055
|
+
"attribute": "character-limit",
|
|
1056
|
+
"reflect": false,
|
|
1057
|
+
"defaultValue": "50"
|
|
1058
|
+
},
|
|
1059
|
+
"colHeaders": {
|
|
1060
|
+
"type": "string",
|
|
1061
|
+
"mutable": false,
|
|
1062
|
+
"complexType": {
|
|
1063
|
+
"original": "string",
|
|
1064
|
+
"resolved": "string",
|
|
1065
|
+
"references": {}
|
|
1066
|
+
},
|
|
1067
|
+
"required": true,
|
|
1068
|
+
"optional": false,
|
|
1069
|
+
"docs": {
|
|
1070
|
+
"tags": [],
|
|
1071
|
+
"text": ""
|
|
1072
|
+
},
|
|
1073
|
+
"attribute": "col-headers",
|
|
1074
|
+
"reflect": false
|
|
1075
|
+
},
|
|
1076
|
+
"colWidths": {
|
|
1077
|
+
"type": "string",
|
|
1078
|
+
"mutable": false,
|
|
1079
|
+
"complexType": {
|
|
1080
|
+
"original": "string",
|
|
1081
|
+
"resolved": "string | undefined",
|
|
1082
|
+
"references": {}
|
|
1083
|
+
},
|
|
1084
|
+
"required": false,
|
|
1085
|
+
"optional": true,
|
|
1086
|
+
"docs": {
|
|
1087
|
+
"tags": [],
|
|
1088
|
+
"text": ""
|
|
1089
|
+
},
|
|
1090
|
+
"attribute": "col-widths",
|
|
1091
|
+
"reflect": false
|
|
1092
|
+
},
|
|
1093
|
+
"colWrap": {
|
|
1094
|
+
"type": "string",
|
|
1095
|
+
"mutable": false,
|
|
1096
|
+
"complexType": {
|
|
1097
|
+
"original": "string",
|
|
1098
|
+
"resolved": "string | undefined",
|
|
1099
|
+
"references": {}
|
|
1100
|
+
},
|
|
1101
|
+
"required": false,
|
|
1102
|
+
"optional": true,
|
|
1103
|
+
"docs": {
|
|
1104
|
+
"tags": [],
|
|
1105
|
+
"text": ""
|
|
1106
|
+
},
|
|
1107
|
+
"attribute": "col-wrap",
|
|
1108
|
+
"reflect": false
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
}
|
|
1112
|
+
static get states() {
|
|
1113
|
+
return {
|
|
1114
|
+
"isExpanded": {},
|
|
1115
|
+
"liveRegionMessage": {},
|
|
1116
|
+
"focusedOption": {},
|
|
1117
|
+
"focusedColumn": {},
|
|
1118
|
+
"focusedTagIndex": {},
|
|
1119
|
+
"tagsList": {}
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1122
|
+
static get events() {
|
|
1123
|
+
return [{
|
|
1124
|
+
"method": "wmTagInputTagAdded",
|
|
1125
|
+
"name": "wmTagInputTagAdded",
|
|
1126
|
+
"bubbles": true,
|
|
1127
|
+
"cancelable": true,
|
|
1128
|
+
"composed": true,
|
|
1129
|
+
"docs": {
|
|
1130
|
+
"tags": [],
|
|
1131
|
+
"text": ""
|
|
1132
|
+
},
|
|
1133
|
+
"complexType": {
|
|
1134
|
+
"original": "any",
|
|
1135
|
+
"resolved": "any",
|
|
1136
|
+
"references": {}
|
|
1137
|
+
}
|
|
1138
|
+
}];
|
|
1139
|
+
}
|
|
1140
|
+
static get elementRef() { return "el"; }
|
|
1141
|
+
static get watchers() {
|
|
1142
|
+
return [{
|
|
1143
|
+
"propName": "errorMessage",
|
|
1144
|
+
"methodName": "handleErrorMessageChange"
|
|
1145
|
+
}];
|
|
1146
|
+
}
|
|
1147
|
+
static get listeners() {
|
|
1148
|
+
return [{
|
|
1149
|
+
"name": "privTagOptionSelected",
|
|
1150
|
+
"method": "handleTagOptionSelected",
|
|
1151
|
+
"target": undefined,
|
|
1152
|
+
"capture": false,
|
|
1153
|
+
"passive": false
|
|
1154
|
+
}, {
|
|
1155
|
+
"name": "privTagOptionDeselected",
|
|
1156
|
+
"method": "handleTagOptionDeselected",
|
|
1157
|
+
"target": undefined,
|
|
1158
|
+
"capture": false,
|
|
1159
|
+
"passive": false
|
|
1160
|
+
}, {
|
|
1161
|
+
"name": "click",
|
|
1162
|
+
"method": "handleClick",
|
|
1163
|
+
"target": "document",
|
|
1164
|
+
"capture": false,
|
|
1165
|
+
"passive": false
|
|
1166
|
+
}, {
|
|
1167
|
+
"name": "scroll",
|
|
1168
|
+
"method": "dismissTooltip",
|
|
1169
|
+
"target": "window",
|
|
1170
|
+
"capture": true,
|
|
1171
|
+
"passive": true
|
|
1172
|
+
}, {
|
|
1173
|
+
"name": "blur",
|
|
1174
|
+
"method": "handleBlur",
|
|
1175
|
+
"target": undefined,
|
|
1176
|
+
"capture": false,
|
|
1177
|
+
"passive": false
|
|
1178
|
+
}];
|
|
1179
|
+
}
|
|
1180
1180
|
}
|