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