@watermarkinsights/ripple 4.0.0-9 → 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-33cb3097.js → chartFunctions-f5ded027.js} +1 -1
- package/dist/cjs/{functions-833ccc83.js → functions-e7db4a26.js} +67 -824
- package/dist/cjs/{global-d57c118b.js → global-b33cf49b.js} +1 -1
- package/dist/cjs/{intl-ab07bd0b.js → intl-9ef93563.js} +3 -3
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/priv-chart-popover.cjs.entry.js +1 -1
- package/dist/cjs/priv-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/ripple.cjs.js +3 -3
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +2 -2
- package/dist/cjs/wm-button.cjs.entry.js +1 -1
- package/dist/cjs/wm-chart.cjs.entry.js +4 -4
- package/dist/cjs/wm-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-file.cjs.entry.js +7 -4
- package/dist/cjs/wm-input.cjs.entry.js +4 -9
- package/dist/cjs/wm-line-chart.cjs.entry.js +3 -3
- package/dist/cjs/wm-modal-header.cjs.entry.js +2 -2
- package/dist/cjs/wm-modal.cjs.entry.js +1 -1
- package/dist/cjs/wm-navigation_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-navigator.cjs.entry.js +1 -1
- package/dist/cjs/wm-option_2.cjs.entry.js +68 -119
- package/dist/cjs/wm-pagination.cjs.entry.js +1 -1
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +4 -4
- package/dist/cjs/wm-search.cjs.entry.js +2 -2
- package/dist/cjs/wm-snackbar.cjs.entry.js +2 -2
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-tag-input.cjs.entry.js +521 -617
- package/dist/cjs/wm-tag-option.cjs.entry.js +43 -0
- package/dist/cjs/wm-timepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-toggletip.cjs.entry.js +1 -1
- package/dist/cjs/wm-uploader.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/charts/wm-chart/wm-chart.css +0 -1
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.css +0 -1
- package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.css +9 -1
- package/dist/collection/components/wm-file/wm-file.js +23 -3
- package/dist/collection/components/wm-file/wm-file.spec.js +83 -34
- package/dist/collection/components/wm-file-list/wm-file-list.spec.js +32 -59
- package/dist/collection/components/wm-input/wm-input.js +1 -8
- package/dist/collection/components/wm-menuitem/wm-menuitem.js +1 -1
- package/dist/collection/components/wm-option/wm-option.css +6 -6
- package/dist/collection/components/wm-option/wm-option.js +47 -3
- package/dist/collection/components/wm-select/wm-select.e2e.js +60 -114
- package/dist/collection/components/wm-select/wm-select.js +80 -141
- package/dist/collection/components/wm-select/wm-select.spec.js +9 -11
- package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.css +0 -1
- package/dist/collection/components/wm-tag-input/wm-tag-input.css +19 -22
- package/dist/collection/components/wm-tag-input/wm-tag-input.e2e.js +3 -3
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +597 -726
- package/dist/collection/components/wm-tag-input/wm-tag-option/wm-tag-option.js +241 -0
- package/dist/collection/components/wm-uploader/wm-uploader.e2e.js +26 -47
- package/dist/collection/components/wm-uploader/wm-uploader.js +3 -3
- package/dist/collection/components/wm-uploader/wm-uploader.spec.js +67 -140
- package/dist/collection/global/functions.js +22 -10
- package/dist/collection/global/intl.js +2 -2
- package/dist/collection/lang/lang.spec.js +2 -2
- package/dist/esm/{chartFunctions-36eb2d1a.js → chartFunctions-2a4603c6.js} +1 -1
- package/dist/esm/{functions-061ab506.js → functions-358a1a02.js} +66 -824
- package/dist/esm/{global-509460f7.js → global-ba03a879.js} +1 -1
- package/dist/esm/{intl-d698d52f.js → intl-48057c4d.js} +3 -3
- package/dist/esm/loader.js +3 -3
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/priv-chart-popover.entry.js +1 -1
- package/dist/esm/priv-datepicker.entry.js +1 -1
- package/dist/esm/ripple.js +3 -3
- package/dist/esm/wm-action-menu_2.entry.js +2 -2
- package/dist/esm/wm-button.entry.js +1 -1
- package/dist/esm/wm-chart.entry.js +4 -4
- package/dist/esm/wm-datepicker.entry.js +1 -1
- package/dist/esm/wm-file.entry.js +7 -4
- package/dist/esm/wm-input.entry.js +4 -9
- package/dist/esm/wm-line-chart.entry.js +3 -3
- package/dist/esm/wm-modal-header.entry.js +2 -2
- package/dist/esm/wm-modal.entry.js +1 -1
- package/dist/esm/wm-navigation_3.entry.js +2 -2
- package/dist/esm/wm-navigator.entry.js +1 -1
- package/dist/esm/wm-option_2.entry.js +68 -119
- package/dist/esm/wm-pagination.entry.js +1 -1
- package/dist/esm/wm-progress-indicator_3.entry.js +4 -4
- package/dist/esm/wm-search.entry.js +2 -2
- package/dist/esm/wm-snackbar.entry.js +2 -2
- package/dist/esm/wm-tab-item_3.entry.js +2 -2
- package/dist/esm/wm-tag-input.entry.js +522 -618
- package/dist/esm/wm-tag-option.entry.js +39 -0
- package/dist/esm/wm-timepicker.entry.js +1 -1
- package/dist/esm/wm-toggletip.entry.js +1 -1
- package/dist/esm/wm-uploader.entry.js +2 -2
- package/dist/esm-es5/{chartFunctions-36eb2d1a.js → chartFunctions-2a4603c6.js} +1 -1
- package/dist/esm-es5/functions-358a1a02.js +1 -0
- package/dist/esm-es5/global-ba03a879.js +1 -0
- package/dist/esm-es5/{intl-d698d52f.js → intl-48057c4d.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
- package/dist/esm-es5/priv-datepicker.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-file.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-line-chart.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 -0
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/ripple/{p-3f159fa3.entry.js → p-05ef4092.entry.js} +1 -1
- package/dist/ripple/p-11d629cb.system.entry.js +1 -0
- package/dist/ripple/p-126fbcdb.entry.js +1 -0
- package/dist/ripple/p-12a140e0.system.entry.js +1 -0
- package/dist/ripple/{p-e61e2d7f.entry.js → p-191fafc6.entry.js} +1 -1
- package/dist/ripple/p-1ab62a21.system.entry.js +1 -0
- package/dist/ripple/{p-d8287161.entry.js → p-1e7e2ca4.entry.js} +1 -1
- package/dist/ripple/{p-fef28649.system.entry.js → p-1ee49e28.system.entry.js} +1 -1
- package/dist/ripple/{p-e82eae12.entry.js → p-299bf10c.entry.js} +1 -1
- package/dist/ripple/{p-c20c248a.entry.js → p-2d6bb6d7.entry.js} +1 -1
- package/dist/ripple/{p-a31e736a.entry.js → p-366a9608.entry.js} +1 -1
- package/dist/ripple/p-3a20b1ed.system.entry.js +1 -0
- package/dist/ripple/p-3bb79457.entry.js +1 -0
- package/dist/ripple/{p-1f7a67cc.system.js → p-426fa249.system.js} +1 -1
- package/dist/ripple/p-44d4705c.system.js +1 -0
- package/dist/ripple/p-492dd748.system.entry.js +1 -0
- package/dist/ripple/p-4aa8e2cf.entry.js +1 -0
- package/dist/ripple/{p-ff891d67.js → p-52f5ec85.js} +1 -1
- package/dist/ripple/{p-484d57e1.entry.js → p-546d5c1d.entry.js} +1 -1
- package/dist/ripple/{p-d231aed1.system.entry.js → p-585732f7.system.entry.js} +1 -1
- package/dist/ripple/p-6767b009.system.js +1 -0
- package/dist/ripple/{p-c6ba5d3d.system.entry.js → p-681c9539.system.entry.js} +1 -1
- package/dist/ripple/{p-d2c9264d.entry.js → p-68cade03.entry.js} +1 -1
- package/dist/ripple/{p-260fd686.system.entry.js → p-6c27afee.system.entry.js} +1 -1
- package/dist/ripple/{p-d108107c.entry.js → p-7740db9a.entry.js} +1 -1
- package/dist/ripple/{p-055d1c23.system.entry.js → p-7d005413.system.entry.js} +1 -1
- package/dist/ripple/{p-c9830db6.system.entry.js → p-7e2c2c46.system.entry.js} +1 -1
- package/dist/ripple/p-7fa84884.system.entry.js +1 -0
- package/dist/ripple/{p-9a3d8f0b.system.entry.js → p-8b143e9d.system.entry.js} +1 -1
- package/dist/ripple/{p-0790bfed.entry.js → p-8ea235b6.entry.js} +1 -1
- package/dist/ripple/{p-4eae76a6.entry.js → p-8fadf5dd.entry.js} +1 -1
- package/dist/ripple/{p-8df34bf3.system.entry.js → p-94c65a69.system.entry.js} +1 -1
- package/dist/ripple/{p-3bd6839a.entry.js → p-9690de6c.entry.js} +1 -1
- package/dist/ripple/p-acb0156f.system.entry.js +1 -0
- package/dist/ripple/p-ae7290c2.entry.js +1 -0
- package/dist/ripple/{p-030b527a.js → p-aea9a33a.js} +1 -1
- package/dist/ripple/p-b6e5408c.js +1 -0
- package/dist/ripple/p-b75c0973.system.js +1 -0
- package/dist/ripple/{p-21f73fee.system.entry.js → p-b858d526.system.entry.js} +1 -1
- package/dist/ripple/{p-40b5b7d1.system.entry.js → p-b92c2e16.system.entry.js} +1 -1
- package/dist/ripple/p-be79e95d.entry.js +1 -0
- package/dist/ripple/{p-b623fdc8.entry.js → p-bfff12b4.entry.js} +1 -1
- package/dist/ripple/{p-68d7cf2b.entry.js → p-c028f29c.entry.js} +1 -1
- package/dist/ripple/p-c19ed569.entry.js +1 -0
- package/dist/ripple/{p-f42031f5.system.js → p-c3da681d.system.js} +1 -1
- package/dist/ripple/{p-9b94467e.entry.js → p-c5105455.entry.js} +1 -1
- package/dist/ripple/{p-15457a4b.system.entry.js → p-c86a7f4d.system.entry.js} +1 -1
- package/dist/ripple/{p-b9283910.entry.js → p-db58d96b.entry.js} +1 -1
- package/dist/ripple/p-dd92850a.js +1 -0
- package/dist/ripple/p-e39e6c2b.entry.js +1 -0
- package/dist/ripple/{p-a8ea87d1.system.entry.js → p-ec831e59.system.entry.js} +1 -1
- package/dist/ripple/{p-f1029090.system.entry.js → p-ee51efe0.system.entry.js} +1 -1
- package/dist/ripple/{p-777ced5b.entry.js → p-eec01bbe.entry.js} +1 -1
- package/dist/ripple/{p-5ed1b0a2.system.entry.js → p-f339d590.system.entry.js} +1 -1
- package/dist/ripple/{p-5b593411.system.entry.js → p-f3407959.system.entry.js} +1 -1
- package/dist/ripple/{p-da727af8.system.entry.js → p-f3a374ff.system.entry.js} +1 -1
- package/dist/ripple/{p-867b20a9.system.entry.js → p-f43fda55.system.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/wm-file/wm-file.d.ts +1 -1
- package/dist/types/components/wm-input/wm-input.d.ts +0 -1
- package/dist/types/components/wm-option/wm-option.d.ts +2 -0
- package/dist/types/components/wm-select/wm-select.d.ts +7 -7
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +65 -85
- package/dist/types/components/wm-tag-input/wm-tag-option/wm-tag-option.d.ts +18 -0
- package/dist/types/components/wm-uploader/wm-uploader.d.ts +1 -1
- package/dist/types/components.d.ts +30 -27
- package/dist/types/global/functions.d.ts +2 -1
- package/dist/types/global/intl.d.ts +2 -2
- package/package.json +1 -1
- package/dist/cjs/wm-tag-input-row.cjs.entry.js +0 -23
- package/dist/collection/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.js +0 -122
- package/dist/collection/components/wm-tag-input/wm-tag-input.spec.js +0 -1039
- package/dist/esm/wm-tag-input-row.entry.js +0 -19
- package/dist/esm-es5/functions-061ab506.js +0 -1
- package/dist/esm-es5/global-509460f7.js +0 -1
- package/dist/esm-es5/wm-tag-input-row.entry.js +0 -1
- package/dist/ripple/p-1c3ba701.system.entry.js +0 -1
- package/dist/ripple/p-4a8c95b9.system.entry.js +0 -1
- package/dist/ripple/p-5f2c09f6.entry.js +0 -1
- package/dist/ripple/p-647a4a4a.system.entry.js +0 -1
- package/dist/ripple/p-7011accc.entry.js +0 -1
- package/dist/ripple/p-707383d5.system.js +0 -1
- package/dist/ripple/p-7c2e47bc.system.entry.js +0 -1
- package/dist/ripple/p-839d7e0f.system.js +0 -1
- package/dist/ripple/p-928cc755.system.entry.js +0 -1
- package/dist/ripple/p-9888c825.js +0 -1
- package/dist/ripple/p-a5308115.js +0 -1
- package/dist/ripple/p-b45a2fc3.entry.js +0 -1
- package/dist/ripple/p-b4b57baf.system.entry.js +0 -1
- package/dist/ripple/p-c15f29e5.system.js +0 -1
- package/dist/ripple/p-d38882eb.entry.js +0 -1
- package/dist/ripple/p-d601c5a1.entry.js +0 -1
- package/dist/ripple/p-d68678d2.entry.js +0 -1
- package/dist/ripple/p-e703d9cd.entry.js +0 -1
- package/dist/ripple/p-eb0d569a.system.entry.js +0 -1
- package/dist/types/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.d.ts +0 -11
|
@@ -1,90 +1,150 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, f as forceUpdate, h,
|
|
2
|
-
import {
|
|
3
|
-
import { g as globalMessages } from './intl-
|
|
1
|
+
import { r as registerInstance, c as createEvent, f as forceUpdate, h, g as getElement } from './index-294d486f.js';
|
|
2
|
+
import { i as intl, d as debounce, q as measureText, j as truncateText, h as hideTooltip, r as findNext, u as findPrev, s as showTooltip, m as shouldOpenUp, v as csvToArray } from './functions-358a1a02.js';
|
|
3
|
+
import { g as globalMessages } from './intl-48057c4d.js';
|
|
4
4
|
|
|
5
|
-
const wmTagInputCss = ":host{--wmcolor-taginput-altrow-background-table:var(--wmcolor-table-altrow-background);--wmcolor-taginput-border:var(--wmcolor-input-border);--wmcolor-taginput-charcount-background:var(--wmcolor-input-charcount-background);--wmcolor-taginput-header-background-table:var(--wmcolor-table-header-background);--wmcolor-taginput-help-text:var(--wmcolor-text);--wmcolor-taginput-icon:var(--wmcolor-icon-accent);--wmcolor-taginput-maxtags-background:var(--wmcolor-background-readonly);--wmcolor-taginput-maxtags-border:var(--wmcolor-input-border);--wmcolor-taginput-maxtags-text:var(--wmcolor-text);--wmcolor-taginput-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-taginput-option-background:var(--wmcolor-option-background);--wmcolor-taginput-option-border:var(--wmcolor-option-border);--wmcolor-taginput-option-text-selected:var(--wmcolor-option-text-disabled);--wmcolor-taginput-option-text:var(--wmcolor-interactive);--wmcolor-taginput-row-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-taginput-row-background-selected:var(--wmcolor-table-row-background-selected);--wmcolor-taginput-row-background-table:var(--wmcolor-table-row-background);--wmcolor-taginput-row-border-selected:var(--wmcolor-table-row-border-selected);--wmcolor-taginput-tag-background-focus:var(--wmcolor-palelilacgray-dark);--wmcolor-taginput-tag-background-highlight:var(--wmcolor-background-highlight);--wmcolor-taginput-tag-background-locked:var(--wmcolor-interactive-disabled);--wmcolor-taginput-tag-background:var(--wmcolor-palelilacgray);--wmcolor-taginput-tag-text-locked:var(--wmcolor-text-ondark);--wmcolor-taginput-tag-text:var(--wmcolor-text);--wmcolor-taginput-tagbutton-background-hover:var(--wmcolor-button-background-icononly-hover);--wmcolor-taginput-tagbutton-border:var(--wmcolor-button-border-icononly);--wmcolor-taginput-tagbutton-icon-hover:var(--wmcolor-button-icon-icononly-hover);--wmcolor-taginput-tagbutton-icon:var(--wmcolor-button-icon-icononly);font-family:inherit;width:100%;display:block;max-height:80vh}:host *{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:14px}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f026\";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper{width:100%;height:100%;max-height:inherit;min-height:inherit;position:relative}:host .field-wrapper{position:relative;width:100%;border:1px solid;border-color:var(--wmcolor-taginput-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px}:host .field-wrapper.focused{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);outline:none;border-color:var(--wmcolor-input-border-focus)}:host .field-wrapper.invalid{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper:not(.label-left) .field-wrapper{-ms-flex-negative:0;flex-shrink:0}:host .character-count{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:5rem;background-color:var(--wmcolor-taginput-charcount-background);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .tags-and-input-wrapper{position:relative;width:100%;padding:8px 8px 8px 0;overflow:auto;max-height:200px}:host .tags-and-input-wrapper.in-modal{max-height:20vh}:host .upper-row{width:100%;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:justify;justify-content:space-between}:host .upper-row:before{-ms-flex-item-align:start;align-self:flex-start;display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f349\";color:var(--wmcolor-taginput-icon);padding:0.75rem 0.5rem 0.75rem 0.75rem;line-height:normal;font-size:1.12rem}:host .lower-row{width:100%;min-height:1.875rem}:host #max-tags{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:1.875rem;background-color:var(--wmcolor-taginput-maxtags-background);padding:0.5rem 1rem;color:var(--wmcolor-taginput-maxtags-text);font-size:0.875rem;border-top:1px solid var(--wmcolor-taginput-maxtags-border);border-radius:0 0 3px 3px}:host .tag-area{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:0;margin:0;gap:8px}:host .tag-area:focus{outline:none}:host .tag-area [role=option]{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;height:1.75rem;list-style:none;color:var(--wmcolor-taginput-tag-text);background-color:var(--wmcolor-taginput-tag-background);padding:0.5rem 0.625rem;-webkit-transition:background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);white-space:pre}:host .tag-area [role=option].highlight{-webkit-animation:fadeIn 1s;animation:fadeIn 1s}@-webkit-keyframes fadeIn{0%{background-color:var(--wmcolor-taginput-tag-background)}50%{background-color:var(--wmcolor-taginput-tag-background-highlight)}100%{background-color:var(--wmcolor-taginput-tag-background)}}@keyframes fadeIn{0%{background-color:var(--wmcolor-taginput-tag-background)}50%{background-color:var(--wmcolor-taginput-tag-background-highlight)}100%{background-color:var(--wmcolor-taginput-tag-background)}}:host .tag-area [role=option].focused{background-color:var(--wmcolor-taginput-tag-background-focus)}:host .tag-area [role=option].locked{background-color:var(--wmcolor-taginput-tag-background-locked);color:var(--wmcolor-taginput-tag-text-locked)}:host .tag-area [role=option] .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:1.25rem;width:1.25rem;padding:0;margin-left:0.5rem}:host .tag-area [role=option] .icon.remove-btn{border:1px solid var(--wmcolor-taginput-tagbutton-border);color:var(--wmcolor-taginput-tagbutton-icon);border-radius:50%;cursor:pointer;-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1)}:host .tag-area [role=option] .icon.remove-btn:hover{color:var(--wmcolor-taginput-tagbutton-icon-hover);background-color:var(--wmcolor-taginput-tagbutton-background-hover)}:host .tag-area [role=option] .icon.remove-btn:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f156\"}:host .tag-area [role=option] .icon.lock{color:var(--wmcolor-taginput-tag-text-locked)}:host .tag-area [role=option] .icon.lock:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f341\"}:host .input{font-family:inherit;border:none;height:1.75rem;padding:0;margin:0;right:8px}:host .input.hidden{display:none}:host .input:focus{outline:none}:host .tag-area+.input.extended{-webkit-margin-before:8px;margin-block-start:8px}:host .dropdown-wrapper{margin:0;padding:0;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:calc(100% + 2px);right:0;z-index:100;width:100%;font-size:0.875rem}:host .dropdown-wrapper .dropdown{-webkit-overflow-scrolling:touch;overflow:auto;max-height:12.5rem;margin:0;padding:0}:host .dropdown-wrapper.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .dropdown-wrapper.upwards{top:unset;bottom:calc(100% + 2px);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}:host .dropdown-wrapper li,:host .dropdown-wrapper div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 1rem;background:var(--wmcolor-taginput-option-background);list-style:none;min-height:2.6875rem;white-space:pre-wrap;overflow-wrap:anywhere}:host .dropdown-wrapper li[role=option],:host .dropdown-wrapper li.add-new-btn,:host .dropdown-wrapper div[role=option],:host .dropdown-wrapper div.add-new-btn{cursor:pointer;color:var(--wmcolor-taginput-option-text);font-weight:bold;width:100%;border:none}:host .dropdown-wrapper li[role=option][aria-selected=true],:host .dropdown-wrapper li.add-new-btn[aria-selected=true],:host .dropdown-wrapper div[role=option][aria-selected=true],:host .dropdown-wrapper div.add-new-btn[aria-selected=true]{color:var(--wmcolor-taginput-option-text-selected);font-style:italic;font-weight:normal;cursor:unset}:host .dropdown-wrapper li[role=option]:hover:not([aria-selected=true]),:host .dropdown-wrapper li[role=option].focused,:host .dropdown-wrapper li.add-new-btn:hover:not([aria-selected=true]),:host .dropdown-wrapper li.add-new-btn.focused,:host .dropdown-wrapper div[role=option]:hover:not([aria-selected=true]),:host .dropdown-wrapper div[role=option].focused,:host .dropdown-wrapper div.add-new-btn:hover:not([aria-selected=true]),:host .dropdown-wrapper div.add-new-btn.focused{outline:none;background:var(--wmcolor-taginput-option-background-hover)}:host .dropdown-wrapper li.help-text,:host .dropdown-wrapper div.help-text{color:var(--wmcolor-taginput-help-text);height:auto;min-height:2.6875rem;padding-top:0.25rem;padding-bottom:0.25rem;white-space:normal}:host .dropdown-wrapper li:not(:last-child),:host .dropdown-wrapper div:not(:last-child){border-bottom:2px solid var(--wmcolor-taginput-option-border)}:host .info-text{font-style:italic;margin-top:0.25rem}:host .table-wrapper{overflow:auto;margin-top:1.5rem}:host .table-wrapper #table{width:100%;border-spacing:0px}:host .table-wrapper #table.fixed-widths{table-layout:fixed}:host .table-wrapper #table .headers{height:2.5rem;background-color:var(--wmcolor-taginput-header-background-table)}:host .table-wrapper #table .headers th{text-align:left;font-size:0.75rem;font-weight:700;text-transform:uppercase;padding:0 1.5rem}:host .table-wrapper tr:nth-child(even){background-color:var(--wmcolor-taginput-altrow-background-table)}:host .table-wrapper tr.selected{background-color:var(--wmcolor-taginput-row-background-selected);-webkit-box-shadow:inset 0 0 0 1px var(--wmcolor-taginput-row-border-selected);box-shadow:inset 0 0 0 1px var(--wmcolor-taginput-row-border-selected);font-weight:500}:host .table-wrapper tr.focused:not(.locked),:host .table-wrapper tr:hover:not(.locked){background-color:var(--wmcolor-taginput-row-background-hover);-webkit-box-shadow:none;box-shadow:none}:host .table-wrapper tr.locked td{cursor:auto}:host .table-wrapper tr.locked td:first-child .cell-content-wrapper:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f33e\";margin-right:0.5rem;color:var(--wmcolor-taginput-tag-text)}:host .table-wrapper td{height:3.75rem;vertical-align:middle;padding:0 1.5rem;cursor:pointer}:host .table-wrapper td.focused{-webkit-box-shadow:inset 0 2px 2px 0 rgba(244, 243, 246, 0.2), inset 0 2px 2px 0 rgba(0, 0, 0, 0.1), inset 0 0 4px 3px var(--wmcolor-interactive-focus);box-shadow:inset 0 2px 2px 0 rgba(244, 243, 246, 0.2), inset 0 2px 2px 0 rgba(0, 0, 0, 0.1), inset 0 0 4px 3px var(--wmcolor-interactive-focus)}:host .table-wrapper td .cell-content-wrapper.trunc{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .table-wrapper td .description{display:none}:host .no-results{padding:1.25rem 1.5rem}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host #error{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-top:0.25rem}";
|
|
5
|
+
const wmTagInputCss = ":host{--wmcolor-taginput-altrow-background-table:var(--wmcolor-table-altrow-background);--wmcolor-taginput-border:var(--wmcolor-input-border);--wmcolor-taginput-charcount-background:var(--wmcolor-input-charcount-background);--wmcolor-taginput-header-background-table:var(--wmcolor-table-header-background);--wmcolor-taginput-help-text:var(--wmcolor-text);--wmcolor-taginput-icon:var(--wmcolor-icon-accent);--wmcolor-taginput-maxtags-background:var(--wmcolor-background-readonly);--wmcolor-taginput-maxtags-border:var(--wmcolor-input-border);--wmcolor-taginput-maxtags-text:var(--wmcolor-text);--wmcolor-taginput-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-taginput-option-background:var(--wmcolor-option-background);--wmcolor-taginput-option-border:var(--wmcolor-option-border);--wmcolor-taginput-option-text-selected:var(--wmcolor-option-text-disabled);--wmcolor-taginput-option-text:var(--wmcolor-interactive);--wmcolor-taginput-row-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-taginput-row-background-selected:var(--wmcolor-table-row-background-selected);--wmcolor-taginput-row-background-table:var(--wmcolor-table-row-background);--wmcolor-taginput-row-border-selected:var(--wmcolor-table-row-border-selected);--wmcolor-taginput-tag-background-focus:var(--wmcolor-palelilacgray-dark);--wmcolor-taginput-tag-background-highlight:var(--wmcolor-background-highlight);--wmcolor-taginput-tag-background-locked:var(--wmcolor-interactive-disabled);--wmcolor-taginput-tag-background:var(--wmcolor-palelilacgray);--wmcolor-taginput-tag-text-locked:var(--wmcolor-text-ondark);--wmcolor-taginput-tag-text:var(--wmcolor-text);--wmcolor-taginput-tagbutton-background-hover:var(--wmcolor-button-background-icononly-hover);--wmcolor-taginput-tagbutton-border:var(--wmcolor-button-border-icononly);--wmcolor-taginput-tagbutton-icon-hover:var(--wmcolor-button-icon-icononly-hover);--wmcolor-taginput-tagbutton-icon:var(--wmcolor-button-icon-icononly);font-family:inherit;width:100%;display:block;max-height:80vh}:host *{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:14px}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f026\";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper{width:100%;height:100%;max-height:inherit;min-height:inherit;position:relative}:host .field-wrapper{position:relative;width:100%;border:1px solid;border-color:var(--wmcolor-taginput-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px}:host .field-wrapper.focused{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);box-shadow:0 0 0 1px var(--wmcolor-input-border-focus);outline:none;border-color:var(--wmcolor-input-border-focus)}:host .field-wrapper.invalid{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper:not(.label-left) .field-wrapper{-ms-flex-negative:0;flex-shrink:0}:host .character-count{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:5rem;background-color:var(--wmcolor-taginput-charcount-background);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .tags-and-input-wrapper{position:relative;width:100%;padding:8px 8px 8px 0;overflow:auto;max-height:200px}:host .tags-and-input-wrapper.in-modal{max-height:20vh}:host .upper-row{width:100%;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:justify;justify-content:space-between}:host .upper-row:before{-ms-flex-item-align:start;align-self:flex-start;display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f349\";color:var(--wmcolor-taginput-icon);padding:0.75rem 0.5rem 0.75rem 0.75rem;line-height:normal;font-size:1.12rem}:host .lower-row{width:100%;min-height:1.875rem}:host #max-tags{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:1.875rem;background-color:var(--wmcolor-taginput-maxtags-background);padding:0.5rem 1rem;color:var(--wmcolor-taginput-maxtags-text);font-size:0.875rem;border-top:1px solid var(--wmcolor-taginput-maxtags-border);border-radius:0 0 3px 3px}:host .tag-area{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:0;margin:0;gap:8px}:host .tag-area:focus{outline:none}:host .tag-area li{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;height:1.75rem;list-style:none;color:var(--wmcolor-taginput-tag-text);background-color:var(--wmcolor-taginput-tag-background);padding:0.5rem 0.625rem;-webkit-transition:background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);white-space:pre}:host .tag-area li.highlight{-webkit-animation:fadeIn 1s;animation:fadeIn 1s}@-webkit-keyframes fadeIn{0%{background-color:var(--wmcolor-taginput-tag-background)}50%{background-color:var(--wmcolor-taginput-tag-background-highlight)}100%{background-color:var(--wmcolor-taginput-tag-background)}}@keyframes fadeIn{0%{background-color:var(--wmcolor-taginput-tag-background)}50%{background-color:var(--wmcolor-taginput-tag-background-highlight)}100%{background-color:var(--wmcolor-taginput-tag-background)}}:host .tag-area li.focused{background-color:var(--wmcolor-taginput-tag-background-focus)}:host .tag-area li.locked{background-color:var(--wmcolor-taginput-tag-background-locked);color:var(--wmcolor-taginput-tag-text-locked)}:host .tag-area li .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:1.25rem;width:1.25rem;padding:0;margin-left:0.5rem}:host .tag-area li .icon.remove-btn{border:1px solid var(--wmcolor-taginput-tagbutton-border);color:var(--wmcolor-taginput-tagbutton-icon);border-radius:50%;cursor:pointer;-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1)}:host .tag-area li .icon.remove-btn:hover{color:var(--wmcolor-taginput-tagbutton-icon-hover);background-color:var(--wmcolor-taginput-tagbutton-background-hover)}:host .tag-area li .icon.remove-btn:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f156\"}:host .tag-area li .icon.lock{color:var(--wmcolor-taginput-tag-text-locked)}:host .tag-area li .icon.lock:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f341\"}:host .input{font-family:inherit;border:none;height:1.75rem;padding:0;margin:0;right:8px}:host .input:focus{outline:none}:host .tag-area:not(.empty)+.input.extended{-webkit-margin-before:8px;margin-block-start:8px}:host .dropdown-wrapper{margin:0;padding:0;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:calc(100% + 2px);right:0;z-index:100;width:100%;font-size:0.875rem}:host .dropdown-wrapper .dropdown{-webkit-overflow-scrolling:touch;overflow:auto;max-height:12.5rem;margin:0;padding:0}:host .dropdown-wrapper.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .dropdown-wrapper.upwards{top:unset;bottom:calc(100% + 2px);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}:host .dropdown-wrapper li,:host .dropdown-wrapper div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 1rem;background:var(--wmcolor-taginput-option-background);list-style:none;min-height:2.6875rem;white-space:pre-wrap;overflow-wrap:anywhere}:host .dropdown-wrapper li.option,:host .dropdown-wrapper li.add-new-btn,:host .dropdown-wrapper div.option,:host .dropdown-wrapper div.add-new-btn{cursor:pointer;color:var(--wmcolor-taginput-option-text);font-weight:bold;width:100%;border:none}:host .dropdown-wrapper li.option[aria-selected=true],:host .dropdown-wrapper li.add-new-btn[aria-selected=true],:host .dropdown-wrapper div.option[aria-selected=true],:host .dropdown-wrapper div.add-new-btn[aria-selected=true]{color:var(--wmcolor-taginput-option-text-selected);font-style:italic;font-weight:normal;cursor:unset}:host .dropdown-wrapper li.option:hover:not([aria-selected=true]),:host .dropdown-wrapper li.option.focused,:host .dropdown-wrapper li.add-new-btn:hover:not([aria-selected=true]),:host .dropdown-wrapper li.add-new-btn.focused,:host .dropdown-wrapper div.option:hover:not([aria-selected=true]),:host .dropdown-wrapper div.option.focused,:host .dropdown-wrapper div.add-new-btn:hover:not([aria-selected=true]),:host .dropdown-wrapper div.add-new-btn.focused{outline:none;background:var(--wmcolor-taginput-option-background-hover)}:host .dropdown-wrapper li.help-text,:host .dropdown-wrapper div.help-text{color:var(--wmcolor-taginput-help-text);height:auto;min-height:2.6875rem;padding-top:0.25rem;padding-bottom:0.25rem;white-space:normal}:host .dropdown-wrapper li:not(:last-child),:host .dropdown-wrapper div:not(:last-child){border-bottom:2px solid var(--wmcolor-taginput-option-border)}:host .info-text{font-style:italic;margin-top:0.25rem}:host .table-wrapper{overflow:auto;margin-top:1.5rem}:host .table-wrapper #table{width:100%;border-spacing:0px}:host .table-wrapper #table.fixed-widths{table-layout:fixed}:host .table-wrapper #table .headers{height:2.5rem;background-color:var(--wmcolor-taginput-header-background-table)}:host .table-wrapper #table .headers th{text-align:left;font-size:0.75rem;font-weight:700;text-transform:uppercase;padding:0 1.5rem}:host .table-wrapper tr:nth-child(even){background-color:var(--wmcolor-taginput-altrow-background-table)}:host .table-wrapper tr.selected,:host .table-wrapper tr.locked{background-color:var(--wmcolor-taginput-row-background-selected);-webkit-box-shadow:inset 0 0 0 1px var(--wmcolor-taginput-row-border-selected);box-shadow:inset 0 0 0 1px var(--wmcolor-taginput-row-border-selected);font-weight:500}:host .table-wrapper tr.focused:not(.locked),:host .table-wrapper tr:hover:not(.locked){background-color:var(--wmcolor-taginput-row-background-hover);-webkit-box-shadow:none;box-shadow:none}:host .table-wrapper tr.locked td{cursor:auto}:host .table-wrapper tr.locked td:first-child .cell-content-wrapper:before{display:inline-block;font:normal normal normal 24px/1 \"Material Design Icons\";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:\"\\f33e\";margin-right:0.5rem;color:var(--wmcolor-taginput-tag-text)}:host .table-wrapper td{height:3.75rem;vertical-align:middle;padding:0 1.5rem;cursor:pointer}:host .table-wrapper td.focused{-webkit-box-shadow:inset 0 2px 2px 0 rgba(244, 243, 246, 0.2), inset 0 2px 2px 0 rgba(0, 0, 0, 0.1), inset 0 0 4px 3px var(--wmcolor-interactive-focus);box-shadow:inset 0 2px 2px 0 rgba(244, 243, 246, 0.2), inset 0 2px 2px 0 rgba(0, 0, 0, 0.1), inset 0 0 4px 3px var(--wmcolor-interactive-focus)}:host .table-wrapper td .cell-content-wrapper.trunc{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .table-wrapper td .description{display:none}:host .no-results{padding:1.25rem 1.5rem}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host #error{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem;margin-top:0.25rem}";
|
|
6
6
|
|
|
7
7
|
const TagInput = class {
|
|
8
8
|
constructor(hostRef) {
|
|
9
9
|
registerInstance(this, hostRef);
|
|
10
|
-
this.
|
|
11
|
-
this.
|
|
10
|
+
this.wmTagInputTagAdded = createEvent(this, "wmTagInputTagAdded", 7);
|
|
11
|
+
this.addNewHelpText = intl.formatMessage({
|
|
12
|
+
id: "tagInput.addNewHelpText",
|
|
13
|
+
defaultMessage: "Press the Enter or Comma key to add a new tag.",
|
|
14
|
+
description: "Help text appearing in a dropdown. Use imperative",
|
|
15
|
+
});
|
|
16
|
+
this.selectionHelpText = intl.formatMessage({
|
|
17
|
+
id: "tagInput.selectionHelpText",
|
|
18
|
+
defaultMessage: "Search and select a tag.",
|
|
19
|
+
description: "Help text appearing in a dropdown. Use imperative",
|
|
20
|
+
});
|
|
21
|
+
this.maxTagsReachedMessage = intl.formatMessage({
|
|
22
|
+
id: "tagInput.maxTagsReached",
|
|
23
|
+
defaultMessage: "No more tags can be added because the limit has been reached.",
|
|
24
|
+
});
|
|
25
|
+
this.tagAreaInstructions = intl.formatMessage({
|
|
26
|
+
id: "tagInput.tagAreaInstructions",
|
|
27
|
+
defaultMessage: "tag selection. Press Backspace or Delete to remove a tag.",
|
|
28
|
+
});
|
|
29
|
+
this.tagsAddedMessage = intl.formatMessage({
|
|
30
|
+
id: "tagInput.tagsAdded",
|
|
31
|
+
defaultMessage: "Tags added",
|
|
32
|
+
description: "Full message for context: 'Tags added: x/y",
|
|
33
|
+
});
|
|
12
34
|
this.openUp = false;
|
|
13
35
|
this.inModal = false;
|
|
36
|
+
this.lastAddedTags = []; // the tag(s) added by the user on their last action (for highlighting)
|
|
14
37
|
this.debouncedUpdate = debounce(() => forceUpdate(this.el), 30);
|
|
15
38
|
this.label = undefined;
|
|
16
|
-
this.labelPosition = "top";
|
|
17
|
-
this.options = "";
|
|
18
|
-
this.selectedTags = "";
|
|
19
|
-
this.info = undefined;
|
|
20
39
|
this.errorMessage = undefined;
|
|
21
|
-
this.
|
|
40
|
+
this.info = undefined;
|
|
41
|
+
this.labelPosition = "top";
|
|
42
|
+
this.maxTags = undefined;
|
|
22
43
|
this.placeholder = undefined;
|
|
23
44
|
this.requiredField = false;
|
|
24
|
-
this.characterLimit = 50;
|
|
25
|
-
this.maxTags = undefined;
|
|
26
45
|
this.tagInputType = "dropdown";
|
|
46
|
+
this.helpText = undefined;
|
|
47
|
+
this.addNew = true;
|
|
48
|
+
this.characterLimit = 50;
|
|
27
49
|
this.colHeaders = undefined;
|
|
28
50
|
this.colWidths = undefined;
|
|
29
51
|
this.colWrap = undefined;
|
|
30
|
-
this.messageConfig = "";
|
|
31
|
-
this.focusedListItem = undefined;
|
|
32
|
-
this.focusedTag = null;
|
|
33
|
-
this.tablePosition = { row: 0, column: 1 };
|
|
34
52
|
this.isExpanded = false;
|
|
35
|
-
this.tagsList = csvToArray(this.selectedTags);
|
|
36
|
-
this.optionsList = csvToArray(this.options);
|
|
37
|
-
this.charCount = 0;
|
|
38
53
|
this.liveRegionMessage = "";
|
|
54
|
+
this.focusedOption = undefined;
|
|
55
|
+
this.focusedColumn = 0;
|
|
56
|
+
this.focusedTagIndex = undefined;
|
|
57
|
+
this.tagsList = [];
|
|
58
|
+
}
|
|
59
|
+
get isDropdown() {
|
|
60
|
+
return this.tagInputType === "dropdown";
|
|
61
|
+
}
|
|
62
|
+
get isTable() {
|
|
63
|
+
return this.tagInputType === "table";
|
|
64
|
+
}
|
|
65
|
+
get charCount() {
|
|
66
|
+
return this.inputEl ? this.inputEl.value.length : 0;
|
|
39
67
|
}
|
|
40
68
|
get tooltipVisible() {
|
|
41
69
|
return document.getElementById("wm-tooltip").classList.contains("show");
|
|
42
70
|
}
|
|
43
|
-
get
|
|
44
|
-
return this.el.
|
|
71
|
+
get optionEls() {
|
|
72
|
+
return Array.from(this.el.querySelectorAll("wm-tag-option"));
|
|
73
|
+
}
|
|
74
|
+
// list of options matching user query
|
|
75
|
+
get filteredOptionEls() {
|
|
76
|
+
const query = this.inputEl ? this.inputEl.value.toLowerCase() : "";
|
|
77
|
+
const list = Array.from(this.optionEls).filter((o) => {
|
|
78
|
+
let values = "";
|
|
79
|
+
if (this.isDropdown) {
|
|
80
|
+
values = o.textContent.toLowerCase();
|
|
81
|
+
}
|
|
82
|
+
else if (this.isTable) {
|
|
83
|
+
values = [o.col1, o.col2, o.col3, o.col4].join("").toLowerCase();
|
|
84
|
+
}
|
|
85
|
+
return values.includes(query);
|
|
86
|
+
});
|
|
87
|
+
return list;
|
|
45
88
|
}
|
|
46
|
-
|
|
47
|
-
|
|
89
|
+
// the ones that should be rendered as tags
|
|
90
|
+
get taggedOptions() {
|
|
91
|
+
return this.optionEls.filter((o) => o.selected || o.locked);
|
|
48
92
|
}
|
|
49
|
-
|
|
93
|
+
// for visual stuff (measuring, truncating...)
|
|
94
|
+
get _tagEls() {
|
|
50
95
|
return this.tagAreaEl ? Array.from(this.tagAreaEl.querySelectorAll(".tag")) : [];
|
|
51
96
|
}
|
|
52
|
-
|
|
53
|
-
|
|
97
|
+
// unlocked and selected tags, i.e. the ones that the user can interact with.
|
|
98
|
+
// (as opposed to locked tags who can't be focused / deleted)
|
|
99
|
+
// used for focus logic
|
|
100
|
+
get focusableTags() {
|
|
101
|
+
return this._tagEls.filter((t) => !t.classList.contains("locked"));
|
|
54
102
|
}
|
|
55
|
-
get
|
|
56
|
-
|
|
103
|
+
get focusedTag() {
|
|
104
|
+
if (this.focusedTagIndex !== undefined && this.focusedTagIndex >= 0)
|
|
105
|
+
return this.focusableTags[this.focusedTagIndex];
|
|
57
106
|
}
|
|
58
|
-
get
|
|
59
|
-
|
|
107
|
+
// get the wm-tag-option, given the internal representation (dropdown li or table tr)
|
|
108
|
+
tagOptionFromEl(el) {
|
|
109
|
+
return el.id === "add-new-btn" ? undefined : this.el.querySelector("#" + el.id);
|
|
60
110
|
}
|
|
61
|
-
get
|
|
62
|
-
|
|
111
|
+
// get the wm-tag-option, given the internal representation of a tag
|
|
112
|
+
tagOptionFromTag(el) {
|
|
113
|
+
const id = el.id.replace("tag-", "");
|
|
114
|
+
return this.el.querySelector("#" + id);
|
|
63
115
|
}
|
|
64
|
-
get
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const colValues = [row.col1, row.col2, row.col3, row.col4].join("").toLowerCase();
|
|
68
|
-
return colValues.includes(query);
|
|
69
|
-
});
|
|
116
|
+
// get the internal representation of a wm-tag-option
|
|
117
|
+
elFromTagOption(el) {
|
|
118
|
+
return this.el.shadowRoot.querySelector("#" + el.id);
|
|
70
119
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (this.
|
|
74
|
-
this.
|
|
75
|
-
const correspondingRowEl = this.wmRowEls.filter((row) => id === row.id)[0];
|
|
76
|
-
if (!correspondingRowEl.locked) {
|
|
77
|
-
list.push(id);
|
|
78
|
-
}
|
|
79
|
-
});
|
|
120
|
+
// focusedOption state refers to the wm-tag-option. This gets the corresponding element in the shadow DOM, or the "Add New" button.
|
|
121
|
+
get _focusedOption() {
|
|
122
|
+
if (!!this.focusedOption) {
|
|
123
|
+
return this.elFromTagOption(this.focusedOption);
|
|
80
124
|
}
|
|
81
|
-
else if (this.
|
|
82
|
-
|
|
125
|
+
else if (this.addNewButton && this.addNewButton.classList.contains("focused")) {
|
|
126
|
+
return this.addNewButton;
|
|
83
127
|
}
|
|
84
|
-
|
|
128
|
+
}
|
|
129
|
+
get _focusedCell() {
|
|
130
|
+
if (!!this._focusedOption) {
|
|
131
|
+
const allCells = Array.from(this._focusedOption.querySelectorAll("td"));
|
|
132
|
+
const index = this.focusedColumn || 0;
|
|
133
|
+
return allCells[index];
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
get inputActiveDescendantId() {
|
|
137
|
+
if (this._focusedOption) {
|
|
138
|
+
if (this.isTable) {
|
|
139
|
+
const cells = Array.from(this._focusedOption.querySelectorAll("td"));
|
|
140
|
+
return cells[this.focusedColumn].id;
|
|
141
|
+
}
|
|
142
|
+
return this._focusedOption.id;
|
|
143
|
+
}
|
|
144
|
+
return null;
|
|
85
145
|
}
|
|
86
146
|
get tagLimitReached() {
|
|
87
|
-
return !!(this.maxTags && this.
|
|
147
|
+
return !!(this.maxTags && this.taggedOptions.length >= this.maxTags);
|
|
88
148
|
}
|
|
89
149
|
get noResultsMessage() {
|
|
90
150
|
return intl.formatMessage({
|
|
@@ -93,78 +153,62 @@ const TagInput = class {
|
|
|
93
153
|
description: "Message displayed when a user's search returns empty.",
|
|
94
154
|
});
|
|
95
155
|
}
|
|
96
|
-
get componentMessages() {
|
|
97
|
-
const addNewHelpText = intl.formatMessage({
|
|
98
|
-
id: "tagInput.addNewHelpText",
|
|
99
|
-
defaultMessage: "Press the Enter or Comma key to add a new tag.",
|
|
100
|
-
description: "Help text appearing in a dropdown. Use imperative",
|
|
101
|
-
});
|
|
102
|
-
const selectionHelpText = intl.formatMessage({
|
|
103
|
-
id: "tagInput.selectionHelpText",
|
|
104
|
-
defaultMessage: "Search and select a tag.",
|
|
105
|
-
description: "Help text appearing in a dropdown. Use imperative",
|
|
106
|
-
});
|
|
107
|
-
const maxTagsReachedMessage = intl.formatMessage({
|
|
108
|
-
id: "tagInput.maxTagsReached",
|
|
109
|
-
defaultMessage: "No more tags can be added because the limit has been reached.",
|
|
110
|
-
});
|
|
111
|
-
const tagAreaInstructions = intl.formatMessage({
|
|
112
|
-
id: "tagInput.tagAreaInstructions",
|
|
113
|
-
defaultMessage: "tag selection. Press Backspace or Delete to remove a tag.",
|
|
114
|
-
});
|
|
115
|
-
const tagsAddedMessage = intl.formatMessage({
|
|
116
|
-
id: "tagInput.tagsAdded",
|
|
117
|
-
defaultMessage: "Tags added",
|
|
118
|
-
description: "For the user to understand how close they are to the tag limit, followed by x/y count",
|
|
119
|
-
});
|
|
120
|
-
const defaultConfig = {
|
|
121
|
-
addNewHelpText: addNewHelpText,
|
|
122
|
-
selectionHelpText: selectionHelpText,
|
|
123
|
-
maxTagsReached: maxTagsReachedMessage,
|
|
124
|
-
tagAreaInstructions: tagAreaInstructions,
|
|
125
|
-
tagsAdded: tagsAddedMessage,
|
|
126
|
-
};
|
|
127
|
-
const userProvidedConfig = safeParseJSON(this.messageConfig);
|
|
128
|
-
return userProvidedConfig ? Object.assign(Object.assign({}, defaultConfig), userProvidedConfig) : defaultConfig;
|
|
129
|
-
}
|
|
130
156
|
get inputMinimumWidth() {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
if (this._tagEls) {
|
|
158
|
+
// 150px is the minimum width of the input field, or the length of the placeholder text
|
|
159
|
+
const inputElStyles = getComputedStyle(this.inputEl);
|
|
160
|
+
const tagElStyles = getComputedStyle(this._tagEls[this._tagEls.length - 1]);
|
|
161
|
+
const inputElBuffer = [
|
|
162
|
+
inputElStyles.paddingLeft,
|
|
163
|
+
inputElStyles.paddingRight,
|
|
164
|
+
inputElStyles.marginLeft,
|
|
165
|
+
inputElStyles.marginRight,
|
|
166
|
+
tagElStyles.marginRight,
|
|
167
|
+
].reduce((prev, curr) => prev + parseInt(curr.replace("px", "")), 0);
|
|
168
|
+
const minimumWidth = Math.max(150, measureText(this.inputEl, this.placeholder).width + inputElBuffer);
|
|
169
|
+
return minimumWidth;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
return 150;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
getTagName(o) {
|
|
176
|
+
// 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)
|
|
177
|
+
return this.isDropdown ? o.textContent : o.col1;
|
|
178
|
+
}
|
|
179
|
+
tagAddedMessage(tag) {
|
|
145
180
|
return intl.formatMessage({
|
|
146
181
|
id: "tagInput.tagAdded",
|
|
147
182
|
defaultMessage: "{tagName} added.",
|
|
148
183
|
description: "A confirmation for adding a tag.",
|
|
149
184
|
}, { tagName: tag });
|
|
150
185
|
}
|
|
151
|
-
|
|
186
|
+
tagRemovedMessage(tag) {
|
|
187
|
+
return intl.formatMessage({
|
|
188
|
+
id: "tagInput.tagRemoved",
|
|
189
|
+
defaultMessage: "{tagName} removed.",
|
|
190
|
+
description: "A confirmation for removing a tag.",
|
|
191
|
+
}, { tagName: tag });
|
|
192
|
+
}
|
|
193
|
+
tagAlreadyAddedMessage(tag) {
|
|
152
194
|
return intl.formatMessage({
|
|
153
195
|
id: "tagInput.tagAlreadyAdded",
|
|
154
196
|
defaultMessage: "{tagName} has already been added.",
|
|
155
197
|
description: "An alert for adding a tag that is already present.",
|
|
156
198
|
}, { tagName: tag });
|
|
157
199
|
}
|
|
200
|
+
isElOrChild(el) {
|
|
201
|
+
return el === this.el || this.el.shadowRoot.contains(el) || this.el.contains(el);
|
|
202
|
+
}
|
|
158
203
|
componentWillLoad() {
|
|
159
204
|
if (!this.placeholder) {
|
|
160
|
-
this.placeholder = this.createPlaceholderDefault(this.addNew, !!this.
|
|
205
|
+
this.placeholder = this.createPlaceholderDefault(this.addNew, !!this.optionEls);
|
|
161
206
|
}
|
|
162
207
|
if (!this.label) {
|
|
163
208
|
console.error("wm-tag-input must have a label property");
|
|
164
209
|
}
|
|
165
|
-
this.consolidateSelectedTags();
|
|
166
210
|
this.el.focus = () => {
|
|
167
|
-
const firstFocusableTag = this.
|
|
211
|
+
const firstFocusableTag = this.focusableTags[0];
|
|
168
212
|
if (firstFocusableTag) {
|
|
169
213
|
this.tagAreaEl.focus();
|
|
170
214
|
this.focusTag(firstFocusableTag);
|
|
@@ -180,37 +224,115 @@ const TagInput = class {
|
|
|
180
224
|
if (this.el.closest("wm-modal")) {
|
|
181
225
|
this.inModal = true;
|
|
182
226
|
}
|
|
227
|
+
const lockedTags = [];
|
|
228
|
+
const regularTags = [];
|
|
229
|
+
this.optionEls.forEach((o) => {
|
|
230
|
+
if (o.locked) {
|
|
231
|
+
lockedTags.push(o);
|
|
232
|
+
}
|
|
233
|
+
else if (o.selected) {
|
|
234
|
+
regularTags.push(o);
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
this.tagsList = [...lockedTags, ...regularTags];
|
|
183
238
|
}
|
|
184
239
|
componentDidLoad() {
|
|
185
|
-
//
|
|
186
|
-
|
|
240
|
+
// Set up observer to announce changes in selected tags, or removed user-added tags
|
|
241
|
+
const observerAnnouncer = new MutationObserver((optionListMutations) => optionListMutations.forEach((mutationRecord) => this.handleChangeAnnouncement(mutationRecord)));
|
|
242
|
+
observerAnnouncer.observe(this.el, {
|
|
243
|
+
subtree: true,
|
|
244
|
+
attributes: true,
|
|
245
|
+
attributeFilter: ["selected"],
|
|
246
|
+
childList: true,
|
|
247
|
+
});
|
|
248
|
+
// Set up observer that ensures parent reload
|
|
249
|
+
// when children wm-tag-options are removed
|
|
250
|
+
const optionListObserver = new MutationObserver((optionListMutations) => optionListMutations.forEach((mutationRecord) => this.handleOptionListChange(mutationRecord)));
|
|
251
|
+
optionListObserver.observe(this.el, {
|
|
252
|
+
childList: true,
|
|
253
|
+
});
|
|
254
|
+
// Set up the observer that will handle focus
|
|
255
|
+
// when tag list changes
|
|
256
|
+
if (!!this.tagAreaEl) {
|
|
257
|
+
const tagListObserver = new MutationObserver((tagListMutations) => tagListMutations.forEach((mutationRecord) => this.handleTagListChange(mutationRecord)));
|
|
258
|
+
tagListObserver.observe(this.tagAreaEl, {
|
|
259
|
+
childList: true,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
handleChangeAnnouncement(mutationRecord) {
|
|
264
|
+
const tagOptionEl = mutationRecord.target;
|
|
265
|
+
if (mutationRecord.type == "childList" && mutationRecord.removedNodes.length > 0) {
|
|
266
|
+
// announce deselection of user-added tag, whose element removal is picked up
|
|
267
|
+
this.announce(this.tagRemovedMessage(mutationRecord.removedNodes[0].textContent));
|
|
268
|
+
}
|
|
269
|
+
else if (mutationRecord.type == "attributes") {
|
|
270
|
+
// announce selection or deselection of all kinds of tags
|
|
271
|
+
if (tagOptionEl.selected) {
|
|
272
|
+
this.announce(this.tagAddedMessage(tagOptionEl.textContent));
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
this.announce(this.tagRemovedMessage(tagOptionEl.textContent));
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
handleOptionListChange(record) {
|
|
280
|
+
const addedNodes = Array.from(record.addedNodes);
|
|
281
|
+
if (addedNodes.length > 0) {
|
|
282
|
+
addedNodes.forEach((n) => !this.tagsList.includes(n) && this.tagsList.push(n));
|
|
283
|
+
}
|
|
284
|
+
const removedNodes = Array.from(record.removedNodes);
|
|
285
|
+
if (removedNodes.length > 0) {
|
|
286
|
+
this.tagsList = this.tagsList.filter((t) => !removedNodes.includes(t));
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
handleTagOptionSelected(ev) {
|
|
290
|
+
const selOption = ev.target;
|
|
291
|
+
this.tagsList = this.tagsList.concat(selOption);
|
|
292
|
+
}
|
|
293
|
+
handleTagOptionDeselected(ev) {
|
|
294
|
+
const deselOption = ev.target;
|
|
295
|
+
this.tagsList = this.tagsList.filter((t) => t != deselOption);
|
|
296
|
+
}
|
|
297
|
+
handleTagListChange(mutationRecord) {
|
|
298
|
+
// there are 2 cases: the option still exists but is no longer selected,
|
|
299
|
+
// or it was removed altogether
|
|
300
|
+
const removedTag = mutationRecord.removedNodes[0];
|
|
301
|
+
if (!!removedTag) {
|
|
302
|
+
// this is a trick. focusedTag gets the ref from an index. When an element
|
|
303
|
+
// is removed it will fall back on the new element with that index if it exists
|
|
304
|
+
if (this.focusedTag) {
|
|
305
|
+
this.focusTag(this.focusedTag);
|
|
306
|
+
}
|
|
307
|
+
else if (this.focusableTags.length > 0) {
|
|
308
|
+
// Otherwise the last tag was deleted and we reassign to the new last tag.
|
|
309
|
+
const tagToFocus = this.focusableTags[this.focusableTags.length - 1];
|
|
310
|
+
this.focusTag(tagToFocus);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
// unless there are no more tags...
|
|
314
|
+
this.inputEl.focus();
|
|
315
|
+
}
|
|
316
|
+
this.lastAddedTags = [];
|
|
317
|
+
}
|
|
187
318
|
}
|
|
188
319
|
componentDidRender() {
|
|
189
320
|
this.positionInput();
|
|
190
321
|
// check each tag if truncation is needed
|
|
191
|
-
this.
|
|
322
|
+
this._tagEls.forEach((tag) => {
|
|
192
323
|
const textEl = tag.querySelector(".tag-text");
|
|
193
324
|
const wrapper = this.el.shadowRoot.querySelector(".tags-and-input-wrapper");
|
|
194
325
|
const leftBound = textEl.getBoundingClientRect().left;
|
|
195
326
|
// the numbers represent spacing values for padding, margin, and delete icon
|
|
196
327
|
const rightBound = wrapper.getBoundingClientRect().right - 10 - 8 - 28;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
328
|
+
const id = tag.id.replace("tag-", "");
|
|
329
|
+
const optionEl = id && this.el.querySelector("#" + id);
|
|
330
|
+
if (optionEl) {
|
|
331
|
+
// tag text for table variant is first column text
|
|
332
|
+
textEl.textContent = truncateText(textEl, this.getTagName(optionEl), rightBound - leftBound, 5);
|
|
202
333
|
}
|
|
203
|
-
textEl.textContent = truncateText(textEl, displayText, rightBound - leftBound, 5);
|
|
204
334
|
});
|
|
205
335
|
}
|
|
206
|
-
consolidateSelectedTags() {
|
|
207
|
-
this.tagsList.forEach((tag) => {
|
|
208
|
-
if (!this.includesCaseInsensitive(this.optionsList, tag)) {
|
|
209
|
-
this.options += `${this.options.length > 0 ? "," : ""}${tag}`;
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
this.optionsList = csvToArray(this.options);
|
|
213
|
-
}
|
|
214
336
|
createPlaceholderDefault(addNew, hasOptions) {
|
|
215
337
|
const addAndSearchPlaceholder = intl.formatMessage({
|
|
216
338
|
id: "tagInput.placeholderAddAndSearch",
|
|
@@ -239,38 +361,40 @@ const TagInput = class {
|
|
|
239
361
|
}
|
|
240
362
|
return placeholder;
|
|
241
363
|
}
|
|
242
|
-
reflectSelectedTags(newValue, oldValue) {
|
|
243
|
-
const isAddition = newValue.length > oldValue.length;
|
|
244
|
-
let changedTag = "";
|
|
245
|
-
let selectedTags = this.tagsList;
|
|
246
|
-
if (isAddition) {
|
|
247
|
-
changedTag = newValue.filter((val) => !oldValue.includes(val))[0];
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
changedTag = oldValue.filter((val) => !newValue.includes(val))[0];
|
|
251
|
-
}
|
|
252
|
-
// event emitted by type table uses element references instead of strings
|
|
253
|
-
if (this.tagInputType === "table") {
|
|
254
|
-
changedTag = this.wmRowEls.filter((row) => row.id === changedTag)[0];
|
|
255
|
-
selectedTags = this.tagsList.map((id) => this.el.querySelector(`#${id}`));
|
|
256
|
-
}
|
|
257
|
-
this.selectedTags = this.listToCSV(this.tagsList);
|
|
258
|
-
let detail = { value: selectedTags, tagChanged: changedTag };
|
|
259
|
-
this.wmTagInputChanged.emit(detail);
|
|
260
|
-
}
|
|
261
364
|
handleErrorMessageChange() {
|
|
262
365
|
if (this.errorMessage) {
|
|
263
366
|
this.announce(this.errorMessage);
|
|
264
367
|
}
|
|
265
368
|
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
closeIfNotElOrChild(ev) {
|
|
270
|
-
const isntElOrChild = ev.target !== this.el && !this.el.shadowRoot.contains(ev.target);
|
|
271
|
-
if (this.tagInputType === "dropdown" && isntElOrChild && this.isExpanded) {
|
|
369
|
+
handleClick(ev) {
|
|
370
|
+
const el = ev.target;
|
|
371
|
+
if (this.isDropdown && !this.el.contains(el) && this.isExpanded) {
|
|
272
372
|
this.closeDropdown();
|
|
273
373
|
}
|
|
374
|
+
else if (Array.from(this.el.children).includes(el)) {
|
|
375
|
+
const option = el;
|
|
376
|
+
const tagName = this.getTagName(option);
|
|
377
|
+
this.lastAddedTags = [tagName];
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
handleOptionClick(ev) {
|
|
381
|
+
ev.preventDefault();
|
|
382
|
+
this.resetInput();
|
|
383
|
+
let option;
|
|
384
|
+
if (this.isTable) {
|
|
385
|
+
option = ev.target;
|
|
386
|
+
option = this.tagOptionFromEl(option.closest("tr"));
|
|
387
|
+
}
|
|
388
|
+
else {
|
|
389
|
+
option = this.tagOptionFromEl(ev.target);
|
|
390
|
+
}
|
|
391
|
+
// if someone wants to attach a click event listener on wm-tag-option
|
|
392
|
+
option.click();
|
|
393
|
+
if (!option.locked) {
|
|
394
|
+
option.selected
|
|
395
|
+
? this.isTable && option.emitDeselectedEvent() // dropdown doesn't deselect on option click
|
|
396
|
+
: option.emitSelectedEvent();
|
|
397
|
+
}
|
|
274
398
|
}
|
|
275
399
|
// From wm-button
|
|
276
400
|
// we need to listen for scroll events during the capture phase because they do not bubble up
|
|
@@ -282,8 +406,8 @@ const TagInput = class {
|
|
|
282
406
|
}
|
|
283
407
|
}
|
|
284
408
|
handleInputKeyDown(ev) {
|
|
285
|
-
if (/^.$/.test(ev.key) && this.
|
|
286
|
-
this.announce(this.generateCharacterLimitWarning(this.
|
|
409
|
+
if (/^.$/.test(ev.key) && this.charCount >= this.characterLimit) {
|
|
410
|
+
this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
|
|
287
411
|
}
|
|
288
412
|
// prevent keydown triggering on tag area
|
|
289
413
|
ev.stopPropagation();
|
|
@@ -301,19 +425,19 @@ const TagInput = class {
|
|
|
301
425
|
this.handleInputArrowUp();
|
|
302
426
|
break;
|
|
303
427
|
case "ArrowLeft":
|
|
304
|
-
if (this.
|
|
428
|
+
if (this.isTable) {
|
|
305
429
|
ev.preventDefault();
|
|
306
|
-
this.
|
|
430
|
+
this.focusPrevCell();
|
|
307
431
|
}
|
|
308
432
|
break;
|
|
309
433
|
case "ArrowRight":
|
|
310
|
-
if (this.
|
|
434
|
+
if (this.isTable) {
|
|
311
435
|
ev.preventDefault();
|
|
312
|
-
this.
|
|
436
|
+
this.focusNextCell();
|
|
313
437
|
}
|
|
314
438
|
break;
|
|
315
439
|
case "Escape":
|
|
316
|
-
if (this.
|
|
440
|
+
if (this.isDropdown && this.isExpanded) {
|
|
317
441
|
this.closeDropdown();
|
|
318
442
|
}
|
|
319
443
|
break;
|
|
@@ -324,17 +448,14 @@ const TagInput = class {
|
|
|
324
448
|
}
|
|
325
449
|
}
|
|
326
450
|
handleInputFocus() {
|
|
327
|
-
if (this.
|
|
451
|
+
if (this.isDropdown) {
|
|
328
452
|
this.openDropdown();
|
|
329
|
-
this.
|
|
453
|
+
this.clearOptionFocus();
|
|
330
454
|
}
|
|
331
|
-
// force update needed to apply styled state of field-wrapper el
|
|
332
|
-
forceUpdate(this.el);
|
|
333
455
|
}
|
|
334
|
-
handleInputChanged(
|
|
335
|
-
this.
|
|
336
|
-
if (this.
|
|
337
|
-
this.clearListItemFocus();
|
|
456
|
+
handleInputChanged(ev) {
|
|
457
|
+
this.clearOptionFocus();
|
|
458
|
+
if (this.isDropdown) {
|
|
338
459
|
if (this.charCount >= this.characterLimit - 5) {
|
|
339
460
|
this.announce(this.generateCharacterLimitWarning(this.charCount, this.characterLimit));
|
|
340
461
|
}
|
|
@@ -342,415 +463,208 @@ const TagInput = class {
|
|
|
342
463
|
this.openDropdown();
|
|
343
464
|
}
|
|
344
465
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
if (value.includes(",") && this.addNew) {
|
|
349
|
-
// covers both typing "," and pasting in text that includes ","
|
|
350
|
-
value.split(",").forEach((tag) => this.submitInput(this.addNew, tag.trim()));
|
|
351
|
-
this.announce(this.generateTagAddedMessage(value.split(",").join(", ")));
|
|
466
|
+
const val = ev.target.value;
|
|
467
|
+
if (val.includes(",") && this.addNew) {
|
|
468
|
+
this.addTags(val);
|
|
352
469
|
}
|
|
353
470
|
else {
|
|
354
471
|
this.announceExistingOptions();
|
|
355
472
|
}
|
|
356
473
|
}
|
|
357
474
|
handleInputEnter() {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
else if (this.tagInputType === "table" && this.tablePosition.row > 0) {
|
|
367
|
-
this.handleTableRowClick(this.localRowEls[this.tablePosition.row].id);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
submitInput(canAddNew, value) {
|
|
371
|
-
const hasNonWhiteSpaceCharacters = value.match(/\S/);
|
|
372
|
-
if (canAddNew && hasNonWhiteSpaceCharacters) {
|
|
373
|
-
this.addTag(value);
|
|
374
|
-
this.optionsList = this.addOption(value);
|
|
475
|
+
// user has selected an option in the list
|
|
476
|
+
if (this.focusedOption) {
|
|
477
|
+
const tagName = this.getTagName(this.focusedOption);
|
|
478
|
+
this.lastAddedTags = [tagName];
|
|
479
|
+
this.focusedOption.click();
|
|
480
|
+
this.focusedOption.selected
|
|
481
|
+
? this.isTable && this.focusedOption.emitDeselectedEvent()
|
|
482
|
+
: this.focusedOption.emitSelectedEvent();
|
|
375
483
|
this.resetInput();
|
|
376
484
|
}
|
|
485
|
+
else if (this.isDropdown) {
|
|
486
|
+
// user is adding a new tag
|
|
487
|
+
const tagName = this.inputEl.value;
|
|
488
|
+
if (!!tagName) {
|
|
489
|
+
this.isExistingTag(tagName) ? this.announce(this.tagAlreadyAddedMessage(tagName)) : this.addTags(tagName);
|
|
490
|
+
this.resetInput();
|
|
491
|
+
}
|
|
492
|
+
}
|
|
377
493
|
}
|
|
378
494
|
handleInputArrowDown() {
|
|
379
|
-
if (this.
|
|
380
|
-
this.
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
495
|
+
if (this.isDropdown) {
|
|
496
|
+
if (!this.isExpanded) {
|
|
497
|
+
this.openDropdown();
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
let items = [];
|
|
501
|
+
// 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)
|
|
502
|
+
if (this.addNewButton && this.addNewButton.id === "add-new-btn") {
|
|
503
|
+
items.push(this.addNewButton);
|
|
504
|
+
}
|
|
505
|
+
this.filteredOptionEls.forEach((o) => {
|
|
506
|
+
items.push(this.elFromTagOption(o));
|
|
507
|
+
});
|
|
508
|
+
const next = findNext(items, this._focusedOption, true);
|
|
509
|
+
this.focusOption(next);
|
|
510
|
+
}
|
|
384
511
|
}
|
|
385
|
-
else
|
|
386
|
-
this.
|
|
512
|
+
else {
|
|
513
|
+
const items = this.filteredOptionEls.filter((o) => !o.locked).map((o) => this.elFromTagOption(o));
|
|
514
|
+
const next = findNext(items, this._focusedOption, true);
|
|
515
|
+
this.focusOption(next);
|
|
387
516
|
}
|
|
388
517
|
}
|
|
389
518
|
handleInputArrowUp() {
|
|
390
|
-
if (this.
|
|
391
|
-
this.
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
519
|
+
if (this.isDropdown) {
|
|
520
|
+
if (!this.isExpanded) {
|
|
521
|
+
this.openDropdown();
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
let items = [];
|
|
525
|
+
if (this.addNewButton) {
|
|
526
|
+
items.push(this.addNewButton);
|
|
527
|
+
}
|
|
528
|
+
this.filteredOptionEls.forEach((o) => {
|
|
529
|
+
items.push(this.elFromTagOption(o));
|
|
530
|
+
});
|
|
531
|
+
const prev = findPrev(items, this._focusedOption, true);
|
|
532
|
+
this.focusOption(prev);
|
|
533
|
+
}
|
|
395
534
|
}
|
|
396
|
-
else
|
|
397
|
-
this.
|
|
535
|
+
else {
|
|
536
|
+
const items = this.filteredOptionEls.filter((o) => !o.locked).map((o) => this.elFromTagOption(o));
|
|
537
|
+
const prev = findPrev(items, this._focusedOption, true);
|
|
538
|
+
this.focusOption(prev);
|
|
398
539
|
}
|
|
399
540
|
}
|
|
400
541
|
handleInputBackspace() {
|
|
401
|
-
if (this.inputEl.value === "" && this.
|
|
542
|
+
if (this.inputEl.value === "" && this.focusableTags.length > 0) {
|
|
402
543
|
// wait for events to finish firing before redirecting focus
|
|
403
544
|
// prevents double input in input area and tag area
|
|
404
545
|
window.requestAnimationFrame(() => {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
this.focusTag(this.tagEls[this.tagEls.length - 1]);
|
|
408
|
-
}
|
|
546
|
+
this.tagAreaEl.focus();
|
|
547
|
+
this.focusTag(this.focusableTags[this.focusableTags.length - 1]);
|
|
409
548
|
});
|
|
410
549
|
}
|
|
411
550
|
}
|
|
412
|
-
handleListItemKeyDown(ev) {
|
|
413
|
-
const typedEvTarget = ev.target;
|
|
414
|
-
switch (ev.key) {
|
|
415
|
-
case "Enter":
|
|
416
|
-
case " ":
|
|
417
|
-
ev.preventDefault();
|
|
418
|
-
typedEvTarget.click();
|
|
419
|
-
break;
|
|
420
|
-
case "ArrowDown":
|
|
421
|
-
ev.preventDefault();
|
|
422
|
-
this.moveDownListItem();
|
|
423
|
-
break;
|
|
424
|
-
case "ArrowUp":
|
|
425
|
-
ev.preventDefault();
|
|
426
|
-
this.moveUpListItem();
|
|
427
|
-
break;
|
|
428
|
-
case "Escape":
|
|
429
|
-
if (this.focusedElement !== this.inputEl) {
|
|
430
|
-
this.inputEl.focus();
|
|
431
|
-
}
|
|
432
|
-
else if (this.tagInputType === "dropdown") {
|
|
433
|
-
this.closeDropdown();
|
|
434
|
-
}
|
|
435
|
-
break;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
handleListItemClick(item) {
|
|
439
|
-
const tag = item.dataset.option.trim() || "";
|
|
440
|
-
if (this.includesCaseInsensitive(this.tagsList, tag)) {
|
|
441
|
-
this.announce(this.generateTagAlreadyAddedMessage(tag));
|
|
442
|
-
}
|
|
443
|
-
else {
|
|
444
|
-
this.resetInput();
|
|
445
|
-
this.addTag(tag);
|
|
446
|
-
this.optionsList = this.addOption(tag);
|
|
447
|
-
this.focusedListItem = null;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
handleTableRowClick(rowId) {
|
|
451
|
-
const referencedRow = this.el.querySelector(`#${rowId}`);
|
|
452
|
-
const isLocked = referencedRow.locked;
|
|
453
|
-
if (!isLocked) {
|
|
454
|
-
if (this.includesCaseInsensitive(this.tagsList, rowId)) {
|
|
455
|
-
this.removeTag(rowId);
|
|
456
|
-
}
|
|
457
|
-
else if (!this.tagLimitReached) {
|
|
458
|
-
this.addTag(rowId);
|
|
459
|
-
this.resetInput();
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
551
|
handleTagAreaKeyDown(ev) {
|
|
464
552
|
switch (ev.key) {
|
|
465
553
|
case "ArrowLeft":
|
|
466
554
|
case "ArrowUp":
|
|
467
555
|
ev.preventDefault();
|
|
468
|
-
this.
|
|
556
|
+
if (this.focusedTag) {
|
|
557
|
+
const prev = findPrev(this.focusableTags, this.focusedTag, true);
|
|
558
|
+
this.focusTag(prev);
|
|
559
|
+
}
|
|
469
560
|
break;
|
|
470
561
|
case "ArrowRight":
|
|
471
562
|
case "ArrowDown":
|
|
472
563
|
ev.preventDefault();
|
|
473
|
-
this.
|
|
564
|
+
if (this.focusedTag) {
|
|
565
|
+
const next = findNext(this.focusableTags, this.focusedTag, true);
|
|
566
|
+
this.focusTag(next);
|
|
567
|
+
}
|
|
474
568
|
break;
|
|
475
569
|
case "Backspace":
|
|
476
570
|
case "Delete":
|
|
477
|
-
this.
|
|
571
|
+
if (this.focusedTag) {
|
|
572
|
+
const option = this.tagOptionFromTag(this.focusedTag);
|
|
573
|
+
if (!option.locked) {
|
|
574
|
+
option.emitDeselectedEvent();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
478
577
|
break;
|
|
479
578
|
}
|
|
480
579
|
}
|
|
481
|
-
|
|
482
|
-
const isLocked = this.focusedTag && this.focusedTag.classList.contains("locked");
|
|
483
|
-
if (this.focusedTag && !isLocked) {
|
|
484
|
-
this.removeTag(this.focusedTag.dataset.tag);
|
|
485
|
-
if (this.nonLockedTagsList.length === 0) {
|
|
486
|
-
// focus input if no tags are left
|
|
487
|
-
this.inputEl.focus();
|
|
488
|
-
}
|
|
489
|
-
else {
|
|
490
|
-
const removingLastTag = this.focusedTag === this.tagEls[this.tagEls.length - 1];
|
|
491
|
-
// if removing the last tag, reassign focused tag to previous task
|
|
492
|
-
this.focusedTag = removingLastTag ? this.tagEls[this.tagEls.length - 2] : this.focusedTag;
|
|
493
|
-
this.focusTag(this.focusedTag);
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
handleBlur(ev, component) {
|
|
498
|
-
const isntElOrChild = ev.relatedTarget !== component && !this.el.shadowRoot.contains(ev.relatedTarget);
|
|
580
|
+
handleBlur(ev) {
|
|
499
581
|
this.dismissTooltip();
|
|
500
|
-
this.
|
|
501
|
-
|
|
582
|
+
this.clearOptionFocus();
|
|
583
|
+
const relTarget = ev.relatedTarget;
|
|
584
|
+
if (!this.isElOrChild(relTarget)) {
|
|
502
585
|
this.fieldWrapperEl.classList.remove("focused");
|
|
503
|
-
if (this.
|
|
586
|
+
if (this.isDropdown) {
|
|
504
587
|
this.closeDropdown();
|
|
505
588
|
}
|
|
506
589
|
}
|
|
507
590
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
const contentWrapper = cell.querySelector(".cell-content-wrapper");
|
|
511
|
-
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
512
|
-
if (isTruncated) {
|
|
513
|
-
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
514
|
-
showTooltip("bottom", cell, cell.innerText);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
handleTagAreaFocus() {
|
|
518
|
-
if (this.tagInputType === "dropdown") {
|
|
591
|
+
handleTagAreaFocus(ev) {
|
|
592
|
+
if (this.isDropdown) {
|
|
519
593
|
this.closeDropdown();
|
|
520
594
|
}
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
this.removeTag(tag);
|
|
527
|
-
}
|
|
528
|
-
moveDownListItem() {
|
|
529
|
-
if (this.listItemEls.length > 0) {
|
|
530
|
-
const firstListItem = this.listItemEls[0];
|
|
531
|
-
if (!this.focusedListItem) {
|
|
532
|
-
this.focusListItem(firstListItem);
|
|
533
|
-
}
|
|
534
|
-
else if (this.focusedListItem.nextElementSibling) {
|
|
535
|
-
this.focusListItem(this.focusedListItem.nextElementSibling);
|
|
595
|
+
if (this.focusableTags.length > 0) {
|
|
596
|
+
const relTarget = ev.relatedTarget;
|
|
597
|
+
if (relTarget && relTarget.id === "input") {
|
|
598
|
+
const lastFocusableTag = this.focusableTags[this.focusableTags.length - 1];
|
|
599
|
+
this.focusTag(lastFocusableTag);
|
|
536
600
|
}
|
|
537
601
|
else {
|
|
538
|
-
this.
|
|
602
|
+
const firstFocusableTag = this.focusableTags[0];
|
|
603
|
+
this.focusTag(firstFocusableTag);
|
|
539
604
|
}
|
|
540
605
|
}
|
|
541
606
|
}
|
|
542
|
-
|
|
543
|
-
if (this.
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
this.focusListItem(lastListItem);
|
|
547
|
-
}
|
|
548
|
-
else if (this.focusedListItem.previousElementSibling) {
|
|
549
|
-
this.focusListItem(this.focusedListItem.previousElementSibling);
|
|
550
|
-
}
|
|
551
|
-
else {
|
|
552
|
-
this.clearListItemFocus();
|
|
607
|
+
focusPrevCell() {
|
|
608
|
+
if (this.focusedOption) {
|
|
609
|
+
if (this.focusedColumn > 0) {
|
|
610
|
+
this.focusedColumn -= 1;
|
|
553
611
|
}
|
|
554
612
|
}
|
|
555
613
|
}
|
|
556
|
-
|
|
557
|
-
if (this.
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
else if (this.tablePosition.row === this.filteredRows.length) {
|
|
562
|
-
this.tablePosition.row = 1;
|
|
563
|
-
}
|
|
564
|
-
else {
|
|
565
|
-
this.tablePosition.row++;
|
|
566
|
-
}
|
|
567
|
-
// skip locked rows
|
|
568
|
-
const rowToFocus = this.filteredRows[this.tablePosition.row - 1];
|
|
569
|
-
if (rowToFocus.locked) {
|
|
570
|
-
this.moveDownRow();
|
|
571
|
-
}
|
|
572
|
-
else {
|
|
573
|
-
this.focusCell(this.tablePosition);
|
|
614
|
+
focusNextCell() {
|
|
615
|
+
if (this._focusedOption) {
|
|
616
|
+
const lastCellIdx = this._focusedOption.querySelectorAll("td").length - 1;
|
|
617
|
+
if (this.focusedColumn < lastCellIdx) {
|
|
618
|
+
this.focusedColumn += 1;
|
|
574
619
|
}
|
|
575
620
|
}
|
|
576
621
|
}
|
|
577
|
-
|
|
578
|
-
if (
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
this.tablePosition.row = 0;
|
|
584
|
-
}
|
|
585
|
-
else {
|
|
586
|
-
this.tablePosition.row--;
|
|
587
|
-
}
|
|
588
|
-
// skip locked rows
|
|
589
|
-
const rowToFocus = this.filteredRows[this.tablePosition.row - 1];
|
|
590
|
-
if (rowToFocus && rowToFocus.locked) {
|
|
591
|
-
this.moveUpRow();
|
|
592
|
-
}
|
|
593
|
-
else if (rowToFocus) {
|
|
594
|
-
this.focusCell(this.tablePosition);
|
|
622
|
+
focusOption(optionToFocus) {
|
|
623
|
+
if (optionToFocus) {
|
|
624
|
+
// will be undefined for the "Add New" button
|
|
625
|
+
this.focusedOption = this.tagOptionFromEl(optionToFocus);
|
|
626
|
+
if (optionToFocus === this.addNewButton) {
|
|
627
|
+
this.addNewButton.classList.add("focused");
|
|
595
628
|
}
|
|
596
629
|
else {
|
|
597
|
-
this.
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
const numCols = csvToArray(this.colHeaders).length;
|
|
609
|
-
if (this.tablePosition.column < numCols) {
|
|
610
|
-
this.tablePosition.column++;
|
|
611
|
-
this.focusCell(this.tablePosition);
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
moveLeftTag() {
|
|
615
|
-
const lastTag = this.tagEls[this.tagEls.length - 1];
|
|
616
|
-
if (this.focusedTag && this.tagEls.includes(this.focusedTag.previousElementSibling)) {
|
|
617
|
-
this.focusedTag = this.focusedTag.previousElementSibling;
|
|
618
|
-
}
|
|
619
|
-
else {
|
|
620
|
-
this.focusedTag = lastTag;
|
|
621
|
-
}
|
|
622
|
-
// skip locked tags
|
|
623
|
-
if (this.focusedTag.classList.contains("locked") && this.nonLockedTagEls.length > 0) {
|
|
624
|
-
this.moveLeftTag();
|
|
625
|
-
}
|
|
626
|
-
else {
|
|
627
|
-
this.focusTag(this.focusedTag);
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
moveRightTag() {
|
|
631
|
-
const firstTag = this.tagEls[0];
|
|
632
|
-
if (this.focusedTag && this.tagEls.includes(this.focusedTag.nextElementSibling)) {
|
|
633
|
-
this.focusedTag = this.focusedTag.nextElementSibling;
|
|
634
|
-
}
|
|
635
|
-
else {
|
|
636
|
-
this.focusedTag = firstTag;
|
|
637
|
-
}
|
|
638
|
-
// skip locked tags
|
|
639
|
-
if (this.focusedTag.classList.contains("locked")) {
|
|
640
|
-
this.moveRightTag();
|
|
641
|
-
}
|
|
642
|
-
else {
|
|
643
|
-
this.focusTag(this.focusedTag);
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
addOption(option) {
|
|
647
|
-
let newOptionsList = this.optionsList;
|
|
648
|
-
const optionAlreadyExists = this.includesCaseInsensitive(this.optionsList, option);
|
|
649
|
-
if (!optionAlreadyExists) {
|
|
650
|
-
newOptionsList = newOptionsList.concat(option);
|
|
651
|
-
}
|
|
652
|
-
return newOptionsList;
|
|
653
|
-
}
|
|
654
|
-
removeOption(option) {
|
|
655
|
-
this.optionsList = this.filterCaseInsensitive(this.optionsList, option);
|
|
656
|
-
}
|
|
657
|
-
addTag(tag) {
|
|
658
|
-
let newTagsList = this.tagsList;
|
|
659
|
-
const tagAlreadyAdded = this.includesCaseInsensitive(this.tagsList, tag);
|
|
660
|
-
const tagExistsAsOption = this.optionsList.filter((x) => x.toLowerCase() === tag.toLowerCase())[0];
|
|
661
|
-
if (!tagAlreadyAdded) {
|
|
662
|
-
let textToAnnounce = tag;
|
|
663
|
-
if (this.tagInputType === "table") {
|
|
664
|
-
const referencedRow = this.el.querySelector(`#${tag}`);
|
|
665
|
-
textToAnnounce = referencedRow.col1;
|
|
666
|
-
}
|
|
667
|
-
this.announce(this.generateTagAddedMessage(textToAnnounce));
|
|
668
|
-
this.tagsList = newTagsList.concat(tagExistsAsOption || tag);
|
|
669
|
-
// if maxTags has been reached, focus should go to the tagArea
|
|
670
|
-
// otherwise, input field should be focused and in view
|
|
671
|
-
if (this.tagLimitReached) {
|
|
672
|
-
this.tagAreaEl.focus();
|
|
673
|
-
}
|
|
674
|
-
else {
|
|
675
|
-
// wait for component to render new selected tag before bringing bottom of wrapper in view
|
|
676
|
-
window.requestAnimationFrame(() => (this.tagsAndInputWrapperEl.scrollTop = this.tagsAndInputWrapperEl.scrollHeight));
|
|
630
|
+
this.addNewButton && this.addNewButton.classList.remove("focused");
|
|
631
|
+
}
|
|
632
|
+
if (this.isTable) {
|
|
633
|
+
// tooltip
|
|
634
|
+
const contentWrapper = this._focusedOption.querySelector(".cell-content-wrapper");
|
|
635
|
+
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
636
|
+
this.dismissTooltip();
|
|
637
|
+
if (isTruncated) {
|
|
638
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
639
|
+
showTooltip("bottom", this._focusedOption, this._focusedOption.innerText);
|
|
640
|
+
}
|
|
677
641
|
}
|
|
642
|
+
optionToFocus.scrollIntoView({ block: "nearest" });
|
|
678
643
|
}
|
|
679
644
|
}
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
this.tagsList = this.filterCaseInsensitive(this.tagsList, tag);
|
|
689
|
-
if (this.tagInputType === "dropdown") {
|
|
690
|
-
// if a tag was introduced by the user, also remove it from the dropdown options
|
|
691
|
-
const devOptionsList = csvToArray(this.options);
|
|
692
|
-
if (this.includesCaseInsensitive(this.optionsList, tag) && !this.includesCaseInsensitive(devOptionsList, tag)) {
|
|
693
|
-
this.removeOption(tag);
|
|
645
|
+
showTooltipIfTruncated(el) {
|
|
646
|
+
const displayedText = el.querySelector(".tag-text").textContent;
|
|
647
|
+
const id = el.id.replace("tag-", "");
|
|
648
|
+
if (id) {
|
|
649
|
+
const tagEl = this.el.querySelector("#" + id);
|
|
650
|
+
const fullText = this.getTagName(tagEl);
|
|
651
|
+
if (displayedText !== fullText && displayedText.includes("...")) {
|
|
652
|
+
showTooltip("bottom", el, fullText);
|
|
694
653
|
}
|
|
695
654
|
}
|
|
696
655
|
}
|
|
697
|
-
focusListItem(item) {
|
|
698
|
-
this.focusedListItem = item;
|
|
699
|
-
this.inputEl.setAttribute("aria-activedescendant", this.focusedListItem.id);
|
|
700
|
-
item.scrollIntoView({ block: "nearest" });
|
|
701
|
-
}
|
|
702
656
|
focusTag(element) {
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
}
|
|
707
|
-
else {
|
|
708
|
-
this.focusedTag = element;
|
|
709
|
-
this.tagAreaEl.setAttribute("aria-activedescendant", this.focusedTag.id);
|
|
710
|
-
this.focusedTag.scrollIntoView({ block: "nearest" });
|
|
711
|
-
}
|
|
657
|
+
// technically it's the tag area that has focus. This function handles the aria-activedescendant value within that parent
|
|
658
|
+
this.focusedTagIndex = this.focusableTags.indexOf(element);
|
|
659
|
+
element.scrollIntoView({ block: "nearest" });
|
|
712
660
|
window.requestAnimationFrame(() => {
|
|
713
661
|
hideTooltip();
|
|
714
|
-
|
|
715
|
-
const fullText = element.dataset.tag;
|
|
716
|
-
const isTruncated = fullText !== textEl.textContent && textEl.textContent.includes("...");
|
|
717
|
-
isTruncated && showTooltip("bottom", element, fullText);
|
|
662
|
+
this.showTooltipIfTruncated(element);
|
|
718
663
|
});
|
|
719
664
|
}
|
|
720
|
-
|
|
721
|
-
this.
|
|
722
|
-
|
|
723
|
-
const rowToFocus = this.localRowEls[position.row];
|
|
724
|
-
const rowCells = rowToFocus.querySelectorAll("td");
|
|
725
|
-
const cellToFocus = rowCells[position.column - 1];
|
|
726
|
-
const contentWrapper = cellToFocus.querySelector(".cell-content-wrapper");
|
|
727
|
-
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
728
|
-
rowToFocus.classList.add("focused");
|
|
729
|
-
cellToFocus.classList.add("focused");
|
|
730
|
-
cellToFocus.scrollIntoView({ block: "nearest" });
|
|
731
|
-
this.inputEl.setAttribute("aria-activedescendant", cellToFocus.id);
|
|
732
|
-
this.dismissTooltip();
|
|
733
|
-
if (isTruncated) {
|
|
734
|
-
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
735
|
-
showTooltip("bottom", cellToFocus, cellToFocus.innerText);
|
|
736
|
-
}
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
|
-
clearTagFocus() {
|
|
740
|
-
this.tagAreaEl.setAttribute("aria-activedescendant", "");
|
|
741
|
-
this.focusedTag = null;
|
|
742
|
-
}
|
|
743
|
-
clearCellFocus(resetPosition = true) {
|
|
744
|
-
this.inputEl.setAttribute("aria-activedescendant", "");
|
|
745
|
-
if (resetPosition) {
|
|
746
|
-
this.tablePosition = { row: 0, column: 1 };
|
|
747
|
-
}
|
|
748
|
-
this.localRowEls.forEach((row) => {
|
|
749
|
-
row.classList.remove("focused");
|
|
750
|
-
row.querySelectorAll("td").forEach((cell) => {
|
|
751
|
-
cell.classList.remove("focused");
|
|
752
|
-
});
|
|
753
|
-
});
|
|
665
|
+
clearOptionFocus() {
|
|
666
|
+
this.focusedOption = undefined;
|
|
667
|
+
this.focusedColumn = 0;
|
|
754
668
|
}
|
|
755
669
|
openDropdown() {
|
|
756
670
|
// offset of -2px to avoid overlapping the focus border
|
|
@@ -758,18 +672,10 @@ const TagInput = class {
|
|
|
758
672
|
this.isExpanded = true;
|
|
759
673
|
}
|
|
760
674
|
closeDropdown() {
|
|
761
|
-
this.
|
|
675
|
+
this.clearOptionFocus();
|
|
762
676
|
this.isExpanded = false;
|
|
763
677
|
}
|
|
764
|
-
clearListItemFocus() {
|
|
765
|
-
this.focusedListItem = null;
|
|
766
|
-
this.inputEl.setAttribute("aria-activedescendant", "");
|
|
767
|
-
this.listItemEls.forEach((el) => {
|
|
768
|
-
el.classList.remove("focused");
|
|
769
|
-
});
|
|
770
|
-
}
|
|
771
678
|
resetInput() {
|
|
772
|
-
this.charCount = 0;
|
|
773
679
|
this.inputEl.value = "";
|
|
774
680
|
}
|
|
775
681
|
announce(message) {
|
|
@@ -779,15 +685,25 @@ const TagInput = class {
|
|
|
779
685
|
}
|
|
780
686
|
this.liveRegionMessage = message;
|
|
781
687
|
}
|
|
688
|
+
addTags(tagNames) {
|
|
689
|
+
// covers both typing "," and pasting in text that includes ","
|
|
690
|
+
// if tag added without "," (typing enter), split puts the whole string in an array
|
|
691
|
+
this.lastAddedTags = tagNames.split(",").filter((t) => t.match(/\S/));
|
|
692
|
+
this.lastAddedTags.forEach((tag) => {
|
|
693
|
+
this.wmTagInputTagAdded.emit(tag);
|
|
694
|
+
});
|
|
695
|
+
this.announce(this.tagAddedMessage(this.lastAddedTags.join(", ")));
|
|
696
|
+
this.resetInput();
|
|
697
|
+
}
|
|
782
698
|
announceExistingOptions() {
|
|
783
699
|
// request animation frame to wait for re-rendering of filtered options
|
|
784
700
|
window.requestAnimationFrame(() => {
|
|
785
701
|
let numResults = 0;
|
|
786
|
-
if (this.
|
|
702
|
+
if (this.isDropdown) {
|
|
787
703
|
numResults = this.optionEls.length;
|
|
788
704
|
}
|
|
789
|
-
else if (this.
|
|
790
|
-
numResults = this.
|
|
705
|
+
else if (this.isTable) {
|
|
706
|
+
numResults = this.filteredOptionEls.length;
|
|
791
707
|
}
|
|
792
708
|
const existingOptionsMessage = intl.formatMessage({
|
|
793
709
|
id: "tagInput.existingOptions",
|
|
@@ -804,117 +720,61 @@ const TagInput = class {
|
|
|
804
720
|
return message;
|
|
805
721
|
}
|
|
806
722
|
positionInput() {
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
723
|
+
if (this.tagAreaEl) {
|
|
724
|
+
const lastTag = this._tagEls[this._tagEls.length - 1];
|
|
725
|
+
// default placement to fall back to when no tags are present, or not enough space is available
|
|
726
|
+
this.inputEl.style.position = "static";
|
|
727
|
+
this.inputEl.style.width = "100%";
|
|
728
|
+
this.inputEl.classList.add("extended");
|
|
729
|
+
if (lastTag) {
|
|
730
|
+
const spaceAvailable = this.tagAreaEl.getBoundingClientRect().right - lastTag.getBoundingClientRect().right;
|
|
731
|
+
if (spaceAvailable >= this.inputMinimumWidth) {
|
|
732
|
+
// because the input has right: 0px
|
|
733
|
+
// all thats needed to properly place it is setting position: absolute, top, and width
|
|
734
|
+
this.inputEl.style.position = "absolute";
|
|
735
|
+
this.inputEl.style.top = lastTag.offsetTop.toString() + "px";
|
|
736
|
+
this.inputEl.style.width = (spaceAvailable - 8).toString() + "px";
|
|
737
|
+
this.inputEl.classList.remove("extended");
|
|
738
|
+
}
|
|
821
739
|
}
|
|
822
740
|
}
|
|
823
741
|
}
|
|
824
742
|
handleTagMouseEnter(ev) {
|
|
825
|
-
|
|
826
|
-
const fullText = ev.target.dataset.tag;
|
|
827
|
-
const isTruncated = displayedText !== fullText && displayedText.includes("...");
|
|
828
|
-
isTruncated && showTooltip("bottom", ev.target, fullText);
|
|
743
|
+
this.showTooltipIfTruncated(ev.target);
|
|
829
744
|
}
|
|
830
745
|
/// Helpers
|
|
831
746
|
listToCSV(list) {
|
|
832
747
|
return list.join(",");
|
|
833
748
|
}
|
|
834
|
-
|
|
835
|
-
const
|
|
836
|
-
return
|
|
837
|
-
}
|
|
838
|
-
filterCaseInsensitive(list, element) {
|
|
839
|
-
return list.filter((x) => x.toLowerCase() !== element.toLowerCase());
|
|
840
|
-
}
|
|
841
|
-
sortCaseInsensitive(list) {
|
|
842
|
-
// The vanilla .sort method places words that start with capital letters above others (ASCII order)
|
|
843
|
-
// so we need to pass in our own compare function to sort case-insensitive
|
|
844
|
-
return list.sort((a, b) => {
|
|
845
|
-
a = a.toLowerCase();
|
|
846
|
-
b = b.toLowerCase();
|
|
847
|
-
return a > b ? 1 : a < b ? -1 : 0;
|
|
848
|
-
});
|
|
849
|
-
}
|
|
850
|
-
/// Renders
|
|
851
|
-
renderTags() {
|
|
852
|
-
let lockedTags = [];
|
|
853
|
-
let unlockedTags = [];
|
|
854
|
-
this.tagsList.forEach((tag, idx) => {
|
|
855
|
-
const id = `tag${idx + 1}`;
|
|
856
|
-
let tagText = "";
|
|
857
|
-
let isLocked = false;
|
|
858
|
-
if (this.tagInputType === "dropdown") {
|
|
859
|
-
tagText = tag;
|
|
860
|
-
}
|
|
861
|
-
else if (this.tagInputType === "table") {
|
|
862
|
-
// display table tags using col1 of the row with the same id
|
|
863
|
-
// if one can't be found, display as empty
|
|
864
|
-
const referencedRow = this.el.querySelector(`#${tag}`);
|
|
865
|
-
tagText = referencedRow ? referencedRow.col1 : "";
|
|
866
|
-
isLocked = referencedRow ? referencedRow.locked : false;
|
|
867
|
-
}
|
|
868
|
-
// make sure locked tags always appear in front of list
|
|
869
|
-
const targetList = isLocked ? lockedTags : unlockedTags;
|
|
870
|
-
targetList.push(h("li", { id: id, class: `tag highlight ${this.focusedTag && this.focusedTag.id === id ? "focused" : ""} ${isLocked ? "locked" : ""}`, "data-tag": tag, role: "option", onMouseEnter: (ev) => this.handleTagMouseEnter(ev), onMouseLeave: hideTooltip }, h("span", { class: "sr-only" }, tag), h("span", { class: "tag-text", "aria-hidden": "true" }, tagText), isLocked ? (h("div", { class: "icon lock" })) : (h("button", { class: "icon remove-btn", tabIndex: -1, onClick: () => this.handleRemoveButtonClick(tag) }))));
|
|
871
|
-
});
|
|
872
|
-
return [...lockedTags, ...unlockedTags];
|
|
749
|
+
isExistingTag(tag) {
|
|
750
|
+
const list = this.optionEls.map((o) => this.getTagName(o).toLowerCase());
|
|
751
|
+
return list.includes(tag.toLowerCase());
|
|
873
752
|
}
|
|
874
753
|
renderDropdown() {
|
|
875
|
-
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.
|
|
876
|
-
}
|
|
877
|
-
renderListItems(optionsList) {
|
|
878
|
-
optionsList = this.sortCaseInsensitive(optionsList);
|
|
879
|
-
// filter by input
|
|
880
|
-
if (this.inputEl && this.inputEl.value) {
|
|
881
|
-
optionsList = this.optionsList.filter((option) => option.toLowerCase().includes(this.inputEl.value.toLowerCase()));
|
|
882
|
-
}
|
|
883
|
-
return optionsList.map((option, idx) => {
|
|
884
|
-
const id = `option${idx + 1}`;
|
|
885
|
-
const isFocused = this.focusedListItem && this.focusedListItem.id === id;
|
|
886
|
-
const isSelected = this.includesCaseInsensitive(this.tagsList, option);
|
|
887
|
-
return (h("li", { class: `option ${isFocused ? "focused" : ""}`, role: "option", id: id, "data-option": option, "aria-selected": isSelected ? "true" : "false", "aria-disabled": isSelected ? "true" : "false", onKeyDown: (ev) => this.handleListItemKeyDown(ev), onBlur: (ev) => this.handleBlur(ev, this.el), onClick: (ev) => this.handleListItemClick(ev.target) }, option));
|
|
888
|
-
});
|
|
889
|
-
}
|
|
890
|
-
renderAddNewButton() {
|
|
891
|
-
const hasNonWhiteSpaceCharacters = this.inputEl.value.match(/\S/);
|
|
892
|
-
const optionAlreadyExists = this.includesCaseInsensitive(this.optionsList, this.inputEl.value.trim());
|
|
893
|
-
if (this.addNew && hasNonWhiteSpaceCharacters && !optionAlreadyExists) {
|
|
894
|
-
const id = `add-new-btn`;
|
|
895
|
-
const isFocused = this.focusedListItem && this.focusedListItem.id === id;
|
|
896
|
-
return (h("li", { role: "option", class: `add-new-btn ${isFocused ? "focused" : ""}`, id: id, "data-option": this.inputEl.value, onKeyDown: (ev) => this.handleListItemKeyDown(ev), onBlur: (ev) => this.handleBlur(ev, this.el), onClick: (ev) => this.handleListItemClick(ev.target), tabIndex: isFocused ? 0 : -1 }, `Add "${this.inputEl.value.trim()}"`));
|
|
897
|
-
}
|
|
898
|
-
else
|
|
899
|
-
return "";
|
|
754
|
+
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)))));
|
|
900
755
|
}
|
|
901
756
|
renderHelpText() {
|
|
757
|
+
if (this.helpText)
|
|
758
|
+
return this.helpText;
|
|
902
759
|
let helpText = "";
|
|
903
|
-
if (this.
|
|
904
|
-
helpText += this.
|
|
760
|
+
if (this._tagEls.length > 0) {
|
|
761
|
+
helpText += this.selectionHelpText;
|
|
905
762
|
}
|
|
906
763
|
if (this.addNew) {
|
|
907
|
-
helpText += " " + this.
|
|
764
|
+
helpText += " " + this.addNewHelpText;
|
|
908
765
|
}
|
|
909
766
|
return helpText;
|
|
910
767
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
768
|
+
renderAddNewButton() {
|
|
769
|
+
const inputValue = this.inputEl.value.trim();
|
|
770
|
+
const hasNonWhiteSpaceCharacters = this.inputEl.value.match(/\S/);
|
|
771
|
+
const optionAlreadyExists = this.isExistingTag(this.inputEl.value.trim());
|
|
772
|
+
return (this.addNew &&
|
|
773
|
+
hasNonWhiteSpaceCharacters &&
|
|
774
|
+
!optionAlreadyExists && (h("li", { ref: (el) => (this.addNewButton = el), id: "add-new-btn", class: "add-new-btn", onClick: () => this.addTags(inputValue) }, "Add " + inputValue)));
|
|
915
775
|
}
|
|
916
776
|
renderTable() {
|
|
917
|
-
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.
|
|
777
|
+
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)))));
|
|
918
778
|
}
|
|
919
779
|
renderTableHeaders() {
|
|
920
780
|
return (h("tr", { class: "headers", role: "row" }, csvToArray(this.colHeaders).map((header, idx) => {
|
|
@@ -927,36 +787,80 @@ const TagInput = class {
|
|
|
927
787
|
width: this.colWidths ? csvToArray(this.colWidths)[idx] : "" }, header));
|
|
928
788
|
})));
|
|
929
789
|
}
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
});
|
|
790
|
+
renderTag(o) {
|
|
791
|
+
const focused = this.focusedTag && this.focusedTag.id === "tag-" + o.id ? "focused" : "";
|
|
792
|
+
const tagName = this.getTagName(o);
|
|
793
|
+
const highlight = this.lastAddedTags.includes(tagName) ? "highlight" : "";
|
|
794
|
+
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() }))));
|
|
795
|
+
}
|
|
796
|
+
renderTags() {
|
|
797
|
+
return this.tagsList.map((o) => this.renderTag(o));
|
|
935
798
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
799
|
+
renderTagCounter() {
|
|
800
|
+
if (this.maxTags) {
|
|
801
|
+
return (h("div", { class: "lower-row" }, h("div", { id: "max-tags" }, this.renderMaxTags())));
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
renderMaxTags() {
|
|
805
|
+
if (this.helpText) {
|
|
806
|
+
return this.helpText;
|
|
807
|
+
}
|
|
808
|
+
else {
|
|
809
|
+
let msg = `${this.tagsAddedMessage}: ${this.taggedOptions.length}/${this.maxTags}`;
|
|
810
|
+
if (this.tagLimitReached) {
|
|
811
|
+
msg += `- ${this.maxTagsReachedMessage}`;
|
|
812
|
+
}
|
|
813
|
+
return msg;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
handleCellMouseEnter(ev) {
|
|
817
|
+
const cell = ev.target;
|
|
818
|
+
const contentWrapper = cell.querySelector(".cell-content-wrapper");
|
|
819
|
+
const isTruncated = contentWrapper.scrollWidth > contentWrapper.clientWidth;
|
|
820
|
+
if (isTruncated) {
|
|
821
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
822
|
+
showTooltip("bottom", cell, cell.innerText);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
renderTableCells(o) {
|
|
826
|
+
const colValues = [o.col1, o.col2, o.col3, o.col4].filter((val) => !!val);
|
|
939
827
|
return colValues.map((val, idx) => {
|
|
940
|
-
const
|
|
828
|
+
const cellId = `${o.id}-col${idx + 1}`;
|
|
941
829
|
let overflowRule = "wrap";
|
|
942
830
|
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
943
831
|
overflowRule = csvToArray(this.colWrap)[idx];
|
|
944
832
|
}
|
|
945
|
-
|
|
833
|
+
const classes = {
|
|
834
|
+
focused: !!this._focusedCell && cellId === this._focusedCell.id,
|
|
835
|
+
};
|
|
836
|
+
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" : "")));
|
|
946
837
|
});
|
|
947
838
|
}
|
|
839
|
+
renderTableRow(o) {
|
|
840
|
+
const classes = {
|
|
841
|
+
selected: o.selected,
|
|
842
|
+
locked: o.locked,
|
|
843
|
+
focused: this.focusedOption && o === this.focusedOption ? true : false,
|
|
844
|
+
};
|
|
845
|
+
return (h("tr", { id: o.id, class: classes, onClick: (ev) => this.handleOptionClick(ev) }, this.renderTableCells(o)));
|
|
846
|
+
}
|
|
847
|
+
renderListItem(o) {
|
|
848
|
+
if (!!this.inputEl) {
|
|
849
|
+
const isFocused = this.focusedOption && o === this.focusedOption;
|
|
850
|
+
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));
|
|
851
|
+
}
|
|
852
|
+
}
|
|
948
853
|
render() {
|
|
949
|
-
return (h(
|
|
950
|
-
this.
|
|
951
|
-
this.handleBlur(ev
|
|
952
|
-
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags())
|
|
953
|
-
this.handleBlur(ev
|
|
954
|
-
}, onFocus: () => this.handleInputFocus(), onKeyDown: (ev) => this.handleInputKeyDown(ev) })), this.
|
|
854
|
+
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) => {
|
|
855
|
+
this.focusedTagIndex = undefined;
|
|
856
|
+
this.handleBlur(ev);
|
|
857
|
+
}, 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) => {
|
|
858
|
+
this.handleBlur(ev);
|
|
859
|
+
}, 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()));
|
|
955
860
|
}
|
|
956
861
|
static get delegatesFocus() { return true; }
|
|
957
862
|
get el() { return getElement(this); }
|
|
958
863
|
static get watchers() { return {
|
|
959
|
-
"tagsList": ["reflectSelectedTags"],
|
|
960
864
|
"errorMessage": ["handleErrorMessageChange"]
|
|
961
865
|
}; }
|
|
962
866
|
};
|