@watermarkinsights/ripple 3.15.0-2 → 3.16.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-08494c24.js → chartFunctions-f77a6366.js} +11 -10
- package/dist/cjs/{functions-e1b590e0.js → functions-1c5fdef0.js} +48 -0
- package/dist/cjs/{global-0a41410c.js → global-1aa1d96b.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- 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 +2 -2
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +1 -1
- package/dist/cjs/wm-button.cjs.entry.js +1 -1
- package/dist/cjs/wm-chart.cjs.entry.js +2 -2
- package/dist/cjs/wm-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-input.cjs.entry.js +1 -1
- package/dist/cjs/wm-modal-header.cjs.entry.js +1 -1
- package/dist/cjs/wm-modal.cjs.entry.js +1 -1
- package/dist/cjs/wm-navigation_3.cjs.entry.js +1 -1
- package/dist/cjs/wm-navigator.cjs.entry.js +1 -1
- package/dist/cjs/wm-network-uploader.cjs.entry.js +1 -1
- package/dist/cjs/wm-option_2.cjs.entry.js +1 -1
- package/dist/cjs/wm-pagination.cjs.entry.js +1 -1
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-search.cjs.entry.js +1 -1
- package/dist/cjs/wm-snackbar.cjs.entry.js +1 -1
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-input-row.cjs.entry.js +19 -0
- package/dist/cjs/wm-tag-input.cjs.entry.js +305 -62
- 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 +3 -46
- package/dist/collection/collection-manifest.json +6 -0
- package/dist/collection/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.js +115 -0
- package/dist/collection/components/wm-tag-input/wm-tag-input.css +133 -13
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +403 -72
- package/dist/collection/components/wm-uploader/wm-uploader.js +3 -46
- package/dist/collection/global/chartFunctions.js +10 -9
- package/dist/collection/global/functions.js +45 -0
- package/dist/esm/{chartFunctions-a310b9d0.js → chartFunctions-0883598c.js} +11 -10
- package/dist/esm/{functions-b4b62a23.js → functions-d39bf1c4.js} +46 -1
- package/dist/esm/{global-e80a0ec8.js → global-93944c59.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/priv-chart-popover.entry.js +1 -1
- package/dist/esm/priv-datepicker.entry.js +1 -1
- package/dist/esm/ripple.js +2 -2
- package/dist/esm/wm-action-menu_2.entry.js +1 -1
- package/dist/esm/wm-button.entry.js +1 -1
- package/dist/esm/wm-chart.entry.js +2 -2
- package/dist/esm/wm-datepicker.entry.js +1 -1
- package/dist/esm/wm-input.entry.js +1 -1
- package/dist/esm/wm-modal-header.entry.js +1 -1
- package/dist/esm/wm-modal.entry.js +1 -1
- package/dist/esm/wm-navigation_3.entry.js +1 -1
- package/dist/esm/wm-navigator.entry.js +1 -1
- package/dist/esm/wm-network-uploader.entry.js +1 -1
- package/dist/esm/wm-option_2.entry.js +1 -1
- package/dist/esm/wm-pagination.entry.js +1 -1
- package/dist/esm/wm-progress-indicator_3.entry.js +2 -2
- package/dist/esm/wm-search.entry.js +1 -1
- package/dist/esm/wm-snackbar.entry.js +1 -1
- package/dist/esm/wm-tab-item_3.entry.js +1 -1
- package/dist/esm/wm-tag-input-row.entry.js +15 -0
- package/dist/esm/wm-tag-input.entry.js +306 -63
- 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 +3 -46
- package/dist/esm-es5/chartFunctions-0883598c.js +1 -0
- package/dist/esm-es5/{functions-b4b62a23.js → functions-d39bf1c4.js} +1 -1
- package/dist/esm-es5/{global-e80a0ec8.js → global-93944c59.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-input.entry.js +1 -1
- package/dist/esm-es5/wm-modal-header.entry.js +1 -1
- package/dist/esm-es5/wm-modal.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-network-uploader.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-pagination.entry.js +1 -1
- package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
- package/dist/esm-es5/wm-search.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input-row.entry.js +1 -0
- package/dist/esm-es5/wm-tag-input.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/ripple/{p-93321f18.system.entry.js → p-078141c4.system.entry.js} +1 -1
- package/dist/ripple/{p-617b738b.system.entry.js → p-1456d52f.system.entry.js} +1 -1
- package/dist/ripple/{p-7a07096b.system.entry.js → p-171b3c6c.system.entry.js} +1 -1
- package/dist/ripple/{p-7833008a.entry.js → p-1abe7a88.entry.js} +1 -1
- package/dist/ripple/{p-477688c8.entry.js → p-1cc8fd4b.entry.js} +1 -1
- package/dist/ripple/{p-0f08a806.system.entry.js → p-222d670b.system.entry.js} +1 -1
- package/dist/ripple/{p-d3326191.entry.js → p-27060507.entry.js} +1 -1
- package/dist/ripple/p-32ba6ca4.system.entry.js +1 -0
- package/dist/ripple/{p-b5a6aebc.entry.js → p-35c05d11.entry.js} +1 -1
- package/dist/ripple/{p-3a71d9a3.entry.js → p-38414137.entry.js} +1 -1
- package/dist/ripple/p-3ae9cb55.system.entry.js +1 -0
- package/dist/ripple/{p-9caf189d.system.entry.js → p-3fe2023e.system.entry.js} +1 -1
- package/dist/ripple/p-40c8e2f2.entry.js +1 -0
- package/dist/ripple/{p-9ef524df.system.entry.js → p-4275d767.system.entry.js} +1 -1
- package/dist/ripple/{p-990db03b.system.entry.js → p-4405cdb4.system.entry.js} +1 -1
- package/dist/ripple/{p-9fd29197.system.entry.js → p-49bda38c.system.entry.js} +1 -1
- package/dist/ripple/p-4b8f71c9.entry.js +1 -0
- package/dist/ripple/{p-6d7a6954.js → p-4ca088ef.js} +1 -1
- package/dist/ripple/p-4edfdcf4.entry.js +1 -0
- package/dist/ripple/{p-32da7cdf.entry.js → p-4f8767df.entry.js} +1 -1
- package/dist/ripple/p-50f5c187.system.entry.js +1 -0
- package/dist/ripple/{p-96b47a13.js → p-5435b11d.js} +1 -1
- package/dist/ripple/{p-61e2a39a.system.entry.js → p-59593d4a.system.entry.js} +1 -1
- package/dist/ripple/{p-981788dd.system.entry.js → p-5fb85304.system.entry.js} +1 -1
- package/dist/ripple/{p-73a66a6c.entry.js → p-78c5b0ee.entry.js} +1 -1
- package/dist/ripple/p-80046dc1.entry.js +1 -0
- package/dist/ripple/{p-719864a5.system.entry.js → p-80fdafba.system.entry.js} +1 -1
- package/dist/ripple/{p-1ba2134b.system.entry.js → p-8ab3a80b.system.entry.js} +1 -1
- package/dist/ripple/{p-a2f8608f.system.entry.js → p-8d2dfe15.system.entry.js} +1 -1
- package/dist/ripple/{p-6ddfada6.entry.js → p-91c90e0e.entry.js} +1 -1
- package/dist/ripple/{p-428b8b24.entry.js → p-92d93fc5.entry.js} +1 -1
- package/dist/ripple/{p-4be49461.system.entry.js → p-96b03f2d.system.entry.js} +1 -1
- package/dist/ripple/{p-eb308bc7.js → p-9f81517c.js} +1 -1
- package/dist/ripple/{p-9ad7db55.entry.js → p-a4e8e1b5.entry.js} +1 -1
- package/dist/ripple/p-c5d594c4.entry.js +1 -0
- package/dist/ripple/{p-c95317b4.system.entry.js → p-c7ceb8b2.system.entry.js} +1 -1
- package/dist/ripple/{p-79542ae3.system.entry.js → p-c8eb6f95.system.entry.js} +1 -1
- package/dist/ripple/{p-c5a3766f.entry.js → p-c98dcd45.entry.js} +1 -1
- package/dist/ripple/p-c9f09fea.system.js +1 -0
- package/dist/ripple/{p-ab7ce269.system.entry.js → p-cbeb1cc5.system.entry.js} +1 -1
- package/dist/ripple/{p-2531b343.system.entry.js → p-cfbdcbba.system.entry.js} +1 -1
- package/dist/ripple/{p-fcb81a4e.entry.js → p-d187e19a.entry.js} +1 -1
- package/dist/ripple/{p-99791f7a.system.js → p-d1c34819.system.js} +1 -1
- package/dist/ripple/{p-79b8e996.entry.js → p-d2fcd64d.entry.js} +1 -1
- package/dist/ripple/{p-75346877.entry.js → p-d6db9e72.entry.js} +1 -1
- package/dist/ripple/{p-65d5f494.entry.js → p-dc382256.entry.js} +1 -1
- package/dist/ripple/{p-aa35c9dd.system.entry.js → p-df7ff551.system.entry.js} +1 -1
- package/dist/ripple/{p-51b60241.system.entry.js → p-e106957e.system.entry.js} +1 -1
- package/dist/ripple/p-e5a2eabe.system.js +1 -0
- package/dist/ripple/{p-1cadcfc1.entry.js → p-e906e855.entry.js} +1 -1
- package/dist/ripple/{p-6ac734b7.entry.js → p-e9c3d4c8.entry.js} +1 -1
- package/dist/ripple/p-eb19ef4c.system.js +1 -0
- package/dist/ripple/{p-1c75615f.entry.js → p-eb549326.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/wm-tag-input/wm-tag-input-row/wm-tag-input-row.d.ts +11 -0
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +34 -3
- package/dist/types/components/wm-uploader/wm-uploader.d.ts +0 -4
- package/dist/types/components.d.ts +32 -0
- package/dist/types/global/functions.d.ts +4 -0
- package/package.json +1 -1
- package/dist/esm-es5/chartFunctions-a310b9d0.js +0 -1
- package/dist/ripple/p-375a850f.system.js +0 -1
- package/dist/ripple/p-5754e2b8.system.js +0 -1
- package/dist/ripple/p-591fae61.system.js +0 -1
- package/dist/ripple/p-5f589556.entry.js +0 -1
- package/dist/ripple/p-b6c197c7.system.entry.js +0 -1
- package/dist/ripple/p-ce696630.entry.js +0 -1
- package/dist/ripple/p-e47b10b1.system.entry.js +0 -1
- package/dist/ripple/p-f5cec3d1.entry.js +0 -1
- package/dist/ripple/p-f7c2b508.entry.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-17c79cc6.js';
|
|
2
|
-
import { g as generateId, i as intl, d as debounce, l as shouldOpenUp } from './functions-
|
|
1
|
+
import { r as registerInstance, c as createEvent, f as forceUpdate, h, H as Host, g as getElement } from './index-17c79cc6.js';
|
|
2
|
+
import { g as generateId, p as csvToArray, i as intl, d as debounce, q as hideTooltip, r as showTooltip, l as shouldOpenUp } from './functions-d39bf1c4.js';
|
|
3
3
|
|
|
4
|
-
const wmTagInputCss = ":host,wm-tag-input{font-family:inherit;width:100%}:host *,wm-tag-input *{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:14px}:host .wrapper,wm-tag-input .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,wm-tag-input .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-tag-input .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-tag-input .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-tag-input .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-tag-input .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,wm-tag-input .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,wm-tag-input .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-tag-input .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,[dir=RTL] wm-tag-input .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-tag-input .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper,wm-tag-input .wrapper{width:100%;position:relative}:host .field-wrapper,wm-tag-input .field-wrapper{position:relative;width:100%;min-height:2.5rem;border:1px solid #4a4a4a;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px}:host .field-wrapper.focused,wm-tag-input .field-wrapper.focused{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}:host .character-count,wm-tag-input .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:rgba(74, 74, 74, 0.05);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .tags-and-input-wrapper,wm-tag-input .tags-and-input-wrapper{position:relative;width:100%;padding:0.5rem 0.25rem;margin-bottom:-0.5rem}:host .upper-row,wm-tag-input .upper-row{width:100%;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:justify;justify-content:space-between;-ms-flex-align:center;align-items:center}:host .lower-row,wm-tag-input .lower-row{width:100%;border-radius:0 0 3px 3px}:host #max-tags,wm-tag-input #max-tags{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:1.875rem;background-color:#6b6b6b;padding:0.5rem 1rem;color:white;font-size:0.875rem}:host .tag-area,wm-tag-input .tag-area{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin:0;padding:0}:host .tag-area:focus,wm-tag-input .tag-area:focus{outline:none}:host .tag-area [role=option],wm-tag-input .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:#4a4a4a;background-color:rgba(3, 0, 0, 0.1);padding:0.5rem 0.625rem;margin-bottom:0.5rem;margin-right:0.25rem;margin-left:0.25rem;-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,wm-tag-input .tag-area [role=option].highlight{-webkit-animation:fadeIn 1s;animation:fadeIn 1s}@-webkit-keyframes fadeIn{0%{background-color:rgba(3, 0, 0, 0.1)}50%{background-color:#c8dfcc}100%{background-color:rgba(3, 0, 0, 0.1)}}@keyframes fadeIn{0%{background-color:rgba(3, 0, 0, 0.1)}50%{background-color:#c8dfcc}100%{background-color:rgba(3, 0, 0, 0.1)}}:host .tag-area [role=option].focused,wm-tag-input .tag-area [role=option].focused{background-color:#d1d1d1}:host .tag-area [role=option] .remove-btn,wm-tag-input .tag-area [role=option] .remove-btn{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;border:1px solid #575195;color:#575195;border-radius:50%;padding:0;margin-left:0.5rem;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] .remove-btn:hover,wm-tag-input .tag-area [role=option] .remove-btn:hover{color:white;background-color:#575195}:host .tag-area [role=option] .remove-btn:before,wm-tag-input .tag-area [role=option] .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 input,wm-tag-input input{font-family:inherit;border:none;height:1.75rem;padding:0;margin-bottom:0.5rem;margin-right:0.25rem;padding-left:0.5rem;right:0px}:host input.hidden,wm-tag-input input.hidden{display:none}:host input:focus,wm-tag-input input:focus{outline:none}:host .dropdown-wrapper,wm-tag-input .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;background:#fff;z-index:100;width:100%;font-size:0.875rem}:host .dropdown-wrapper .dropdown,wm-tag-input .dropdown-wrapper .dropdown{-webkit-overflow-scrolling:touch;overflow:auto;max-height:12.5rem;margin:0;padding:0}:host .dropdown-wrapper.open,wm-tag-input .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,wm-tag-input .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,wm-tag-input .dropdown-wrapper li,wm-tag-input .dropdown-wrapper div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 1rem;background:#fff;list-style:none;height:2.6875rem;white-space:pre}: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,wm-tag-input .dropdown-wrapper li[role=option],wm-tag-input .dropdown-wrapper li.add-new-btn,wm-tag-input .dropdown-wrapper div[role=option],wm-tag-input .dropdown-wrapper div.add-new-btn{cursor:pointer;color:#575195;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],wm-tag-input .dropdown-wrapper li[role=option][aria-selected=true],wm-tag-input .dropdown-wrapper li.add-new-btn[aria-selected=true],wm-tag-input .dropdown-wrapper div[role=option][aria-selected=true],wm-tag-input .dropdown-wrapper div.add-new-btn[aria-selected=true]{color:#6b6b6b;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,wm-tag-input .dropdown-wrapper li[role=option]:hover:not([aria-selected=true]),wm-tag-input .dropdown-wrapper li[role=option].focused,wm-tag-input .dropdown-wrapper li.add-new-btn:hover:not([aria-selected=true]),wm-tag-input .dropdown-wrapper li.add-new-btn.focused,wm-tag-input .dropdown-wrapper div[role=option]:hover:not([aria-selected=true]),wm-tag-input .dropdown-wrapper div[role=option].focused,wm-tag-input .dropdown-wrapper div.add-new-btn:hover:not([aria-selected=true]),wm-tag-input .dropdown-wrapper div.add-new-btn.focused{outline:none;background:#f4f4f4}:host .dropdown-wrapper li.help-text,:host .dropdown-wrapper div.help-text,wm-tag-input .dropdown-wrapper li.help-text,wm-tag-input .dropdown-wrapper div.help-text{color:#4a4a4a;min-height:2.6875rem;padding-top:0.25rem;padding-bottom:0.25rem}:host .dropdown-wrapper li:not(:last-child),:host .dropdown-wrapper div:not(:last-child),wm-tag-input .dropdown-wrapper li:not(:last-child),wm-tag-input .dropdown-wrapper div:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host .info-text,wm-tag-input .info-text{font-style:italic;margin-top:0.25rem}:host .sr-only,wm-tag-input .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}";
|
|
4
|
+
const wmTagInputCss = ":host,wm-tag-input{font-family:inherit;width:100%}:host *,wm-tag-input *{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:14px}:host .wrapper,wm-tag-input .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,wm-tag-input .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required,wm-tag-input .wrapper .label .required{color:#c0392b}:host .wrapper.label-left,wm-tag-input .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper,wm-tag-input .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label,wm-tag-input .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,wm-tag-input .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,wm-tag-input .wrapper.invalid .label{color:#c0392b}:host .wrapper.invalid .label:after,wm-tag-input .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,[dir=RTL] wm-tag-input .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label,wm-tag-input .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper,wm-tag-input .wrapper{width:100%;position:relative}:host .field-wrapper,wm-tag-input .field-wrapper{position:relative;width:100%;min-height:2.5rem;border:1px solid #4a4a4a;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px}:host .field-wrapper.focused,wm-tag-input .field-wrapper.focused{-webkit-box-shadow:0 0 0 1px #20cbd4;-moz-box-shadow:0 0 0 1px #20cbd4;box-shadow:0 0 0 1px #20cbd4;outline:none;border-color:#20cbd4}:host .character-count,wm-tag-input .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:rgba(74, 74, 74, 0.05);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .tags-and-input-wrapper,wm-tag-input .tags-and-input-wrapper{position:relative;width:100%;padding:0.5rem 0.25rem 0.5rem 0;margin-bottom:-0.5rem}:host .upper-row,wm-tag-input .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,wm-tag-input .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:#b5b5b5;padding:0.75rem 0.5rem 0.75rem 0.75rem}:host .lower-row,wm-tag-input .lower-row{width:100%}:host #max-tags,wm-tag-input #max-tags{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;height:1.875rem;background-color:#e6e6e6;padding:0.5rem 1rem;color:#4a4a4a;font-size:0.875rem;border-top:1px solid rgba(35, 35, 35, 0.6);border-radius:0 0 3px 3px}:host .tag-area,wm-tag-input .tag-area{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;margin:0;padding:0}:host .tag-area:focus,wm-tag-input .tag-area:focus{outline:none}:host .tag-area [role=option],wm-tag-input .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:#4a4a4a;background-color:rgba(3, 0, 0, 0.1);padding:0.5rem 0.625rem;margin-bottom:0.5rem;margin-right:0.25rem;margin-left:0.25rem;-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,wm-tag-input .tag-area [role=option].highlight{-webkit-animation:fadeIn 1s;animation:fadeIn 1s}@-webkit-keyframes fadeIn{0%{background-color:rgba(3, 0, 0, 0.1)}50%{background-color:#c8dfcc}100%{background-color:rgba(3, 0, 0, 0.1)}}@keyframes fadeIn{0%{background-color:rgba(3, 0, 0, 0.1)}50%{background-color:#c8dfcc}100%{background-color:rgba(3, 0, 0, 0.1)}}:host .tag-area [role=option].focused,wm-tag-input .tag-area [role=option].focused{background-color:#d1d1d1}:host .tag-area [role=option].locked,wm-tag-input .tag-area [role=option].locked{background-color:#6b6b6b;color:white}:host .tag-area [role=option] .icon,wm-tag-input .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,wm-tag-input .tag-area [role=option] .icon.remove-btn{border:1px solid #575195;color:#575195;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,wm-tag-input .tag-area [role=option] .icon.remove-btn:hover{color:white;background-color:#575195}:host .tag-area [role=option] .icon.remove-btn:before,wm-tag-input .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,wm-tag-input .tag-area [role=option] .icon.lock{color:white}:host .tag-area [role=option] .icon.lock:before,wm-tag-input .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,wm-tag-input input{font-family:inherit;border:none;height:1.75rem;padding:0;margin-bottom:0.5rem;margin-right:0.25rem;padding-left:0.5rem;right:0px}:host input.hidden,wm-tag-input input.hidden{display:none}:host input:focus,wm-tag-input input:focus{outline:none}:host .dropdown-wrapper,wm-tag-input .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;background:#fff;z-index:100;width:100%;font-size:0.875rem}:host .dropdown-wrapper .dropdown,wm-tag-input .dropdown-wrapper .dropdown{-webkit-overflow-scrolling:touch;overflow:auto;max-height:12.5rem;margin:0;padding:0}:host .dropdown-wrapper.open,wm-tag-input .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,wm-tag-input .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,wm-tag-input .dropdown-wrapper li,wm-tag-input .dropdown-wrapper div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 1rem;background:#fff;list-style:none;height:2.6875rem;white-space:pre}: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,wm-tag-input .dropdown-wrapper li[role=option],wm-tag-input .dropdown-wrapper li.add-new-btn,wm-tag-input .dropdown-wrapper div[role=option],wm-tag-input .dropdown-wrapper div.add-new-btn{cursor:pointer;color:#575195;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],wm-tag-input .dropdown-wrapper li[role=option][aria-selected=true],wm-tag-input .dropdown-wrapper li.add-new-btn[aria-selected=true],wm-tag-input .dropdown-wrapper div[role=option][aria-selected=true],wm-tag-input .dropdown-wrapper div.add-new-btn[aria-selected=true]{color:#6b6b6b;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,wm-tag-input .dropdown-wrapper li[role=option]:hover:not([aria-selected=true]),wm-tag-input .dropdown-wrapper li[role=option].focused,wm-tag-input .dropdown-wrapper li.add-new-btn:hover:not([aria-selected=true]),wm-tag-input .dropdown-wrapper li.add-new-btn.focused,wm-tag-input .dropdown-wrapper div[role=option]:hover:not([aria-selected=true]),wm-tag-input .dropdown-wrapper div[role=option].focused,wm-tag-input .dropdown-wrapper div.add-new-btn:hover:not([aria-selected=true]),wm-tag-input .dropdown-wrapper div.add-new-btn.focused{outline:none;background:#f4f4f4}:host .dropdown-wrapper li.help-text,:host .dropdown-wrapper div.help-text,wm-tag-input .dropdown-wrapper li.help-text,wm-tag-input .dropdown-wrapper div.help-text{color:#4a4a4a;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),wm-tag-input .dropdown-wrapper li:not(:last-child),wm-tag-input .dropdown-wrapper div:not(:last-child){border-bottom:2px solid rgba(46, 27, 70, 0.05)}:host .info-text,wm-tag-input .info-text{font-style:italic;margin-top:0.25rem}:host .table-wrapper,wm-tag-input .table-wrapper{max-height:17.5rem;overflow:auto;margin-top:1.5rem}:host .table-wrapper #table,wm-tag-input .table-wrapper #table{width:100%;border-spacing:0px}:host .table-wrapper #table.fixed-widths,wm-tag-input .table-wrapper #table.fixed-widths{table-layout:fixed}:host .table-wrapper #table .headers,wm-tag-input .table-wrapper #table .headers{height:2.5rem;background-color:#eeedf4}:host .table-wrapper #table .headers th,wm-tag-input .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.locked td:first-child:before,wm-tag-input .table-wrapper tr.locked td:first-child: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:#4a4a4a}:host .table-wrapper tr:nth-child(even),wm-tag-input .table-wrapper tr:nth-child(even){background-color:#fafafa}:host .table-wrapper tr.selected,wm-tag-input .table-wrapper tr.selected{background-color:rgba(25, 161, 169, 0.2);-webkit-box-shadow:inset 0 0 0 1px #19a1a9;box-shadow:inset 0 0 0 1px #19a1a9;font-weight:500}:host .table-wrapper tr.focused,:host .table-wrapper tr:hover,wm-tag-input .table-wrapper tr.focused,wm-tag-input .table-wrapper tr:hover{background-color:#e9e7ec;-webkit-box-shadow:none;box-shadow:none}:host .table-wrapper td,wm-tag-input .table-wrapper td{height:3.75rem;vertical-align:middle;padding:0 1.5rem;cursor:pointer}:host .table-wrapper td.trunc,wm-tag-input .table-wrapper td.trunc{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .table-wrapper td.focused,wm-tag-input .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 #61279e;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 #61279e}:host .table-wrapper td .description,wm-tag-input .table-wrapper td .description{display:none}:host .no-results,wm-tag-input .no-results{padding:1.25rem 1.5rem}:host .sr-only,wm-tag-input .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}";
|
|
5
5
|
|
|
6
6
|
const TagInput = class {
|
|
7
7
|
constructor(hostRef) {
|
|
@@ -12,11 +12,14 @@ const TagInput = class {
|
|
|
12
12
|
this.selectedTags = ""; // csv
|
|
13
13
|
this.addNew = true;
|
|
14
14
|
this.characterLimit = 50;
|
|
15
|
+
this.tagInputType = "dropdown";
|
|
15
16
|
this.uid = this.el.id ? this.el.id : generateId();
|
|
16
17
|
this.openUp = false;
|
|
18
|
+
this.tooltipVisible = false;
|
|
19
|
+
this.tablePosition = { row: 0, column: 1 };
|
|
17
20
|
this.isExpanded = false;
|
|
18
|
-
this.tagsList =
|
|
19
|
-
this.optionsList =
|
|
21
|
+
this.tagsList = csvToArray(this.selectedTags);
|
|
22
|
+
this.optionsList = csvToArray(this.options);
|
|
20
23
|
this.charCount = 0;
|
|
21
24
|
this.liveRegionMessage = "";
|
|
22
25
|
this.tagAreaInstructions = intl.formatMessage({
|
|
@@ -43,6 +46,25 @@ const TagInput = class {
|
|
|
43
46
|
get optionEls() {
|
|
44
47
|
return Array.from(this.dropdownEl.querySelectorAll(".option"));
|
|
45
48
|
}
|
|
49
|
+
get wmRowEls() {
|
|
50
|
+
return Array.from(this.el.querySelectorAll("wm-tag-input-row"));
|
|
51
|
+
}
|
|
52
|
+
get localRowEls() {
|
|
53
|
+
return Array.from(this.el.shadowRoot.querySelectorAll("tr"));
|
|
54
|
+
}
|
|
55
|
+
get filteredRows() {
|
|
56
|
+
return this.wmRowEls.filter((row) => {
|
|
57
|
+
const colValues = [row.col1, row.col2, row.col3, row.col4].join("").toLowerCase();
|
|
58
|
+
return this.inputEl && this.inputEl.value.toLowerCase() ? colValues.includes(this.inputEl.value) : true;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
get noResultsMessage() {
|
|
62
|
+
return intl.formatMessage({
|
|
63
|
+
id: "tagInput.noResults",
|
|
64
|
+
defaultMessage: "No results match your search.",
|
|
65
|
+
description: "Message displayed when a user's search returns empty.",
|
|
66
|
+
});
|
|
67
|
+
}
|
|
46
68
|
generateTagAddedMessage(tag) {
|
|
47
69
|
return intl.formatMessage({
|
|
48
70
|
id: "tagInput.tagAdded",
|
|
@@ -105,7 +127,7 @@ const TagInput = class {
|
|
|
105
127
|
this.options += `${this.options.length > 0 ? "," : ""}${tag}`;
|
|
106
128
|
}
|
|
107
129
|
});
|
|
108
|
-
this.optionsList =
|
|
130
|
+
this.optionsList = csvToArray(this.options);
|
|
109
131
|
}
|
|
110
132
|
createPlaceholderDefault(addNew, hasOptions) {
|
|
111
133
|
const addAndSearchPlaceholder = intl.formatMessage({
|
|
@@ -139,12 +161,25 @@ const TagInput = class {
|
|
|
139
161
|
this.selectedTags = this.listToCSV(this.tagsList);
|
|
140
162
|
this.wmTagInputChanged.emit({ value: this.tagsList });
|
|
141
163
|
}
|
|
164
|
+
handleRowUpdate() {
|
|
165
|
+
forceUpdate(this.el);
|
|
166
|
+
}
|
|
142
167
|
closeIfNotElOrChild(ev) {
|
|
143
168
|
const isntElOrChild = ev.target !== this.el && !this.el.shadowRoot.contains(ev.target);
|
|
144
|
-
if (isntElOrChild && this.isExpanded) {
|
|
169
|
+
if (this.tagInputType === "dropdown" && isntElOrChild && this.isExpanded) {
|
|
145
170
|
this.closeDropdown();
|
|
146
171
|
}
|
|
147
172
|
}
|
|
173
|
+
// From wm-button
|
|
174
|
+
// we need to listen for scroll events during the capture phase because they do not bubble up
|
|
175
|
+
// there can be layouts where the main content has 100vh and overflows
|
|
176
|
+
// in these cases window will register no scroll events unless we catch on they way down
|
|
177
|
+
dismissTooltip() {
|
|
178
|
+
if (this.tooltipVisible) {
|
|
179
|
+
hideTooltip();
|
|
180
|
+
this.tooltipVisible = false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
148
183
|
handleResize() {
|
|
149
184
|
this.debouncedResize();
|
|
150
185
|
}
|
|
@@ -158,7 +193,7 @@ const TagInput = class {
|
|
|
158
193
|
case "Enter":
|
|
159
194
|
case ",":
|
|
160
195
|
ev.preventDefault();
|
|
161
|
-
this.
|
|
196
|
+
this.handleInputEnter();
|
|
162
197
|
break;
|
|
163
198
|
case "ArrowDown":
|
|
164
199
|
ev.preventDefault();
|
|
@@ -168,8 +203,20 @@ const TagInput = class {
|
|
|
168
203
|
ev.preventDefault();
|
|
169
204
|
this.handleInputArrowUp();
|
|
170
205
|
break;
|
|
206
|
+
case "ArrowLeft":
|
|
207
|
+
ev.preventDefault();
|
|
208
|
+
if (this.tagInputType === "table" && this.tablePosition.row) {
|
|
209
|
+
this.moveLeftCell();
|
|
210
|
+
}
|
|
211
|
+
break;
|
|
212
|
+
case "ArrowRight":
|
|
213
|
+
ev.preventDefault();
|
|
214
|
+
if (this.tagInputType === "table" && this.tablePosition.row) {
|
|
215
|
+
this.moveRightCell();
|
|
216
|
+
}
|
|
217
|
+
break;
|
|
171
218
|
case "Escape":
|
|
172
|
-
if (this.isExpanded) {
|
|
219
|
+
if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
173
220
|
this.closeDropdown();
|
|
174
221
|
}
|
|
175
222
|
break;
|
|
@@ -179,41 +226,71 @@ const TagInput = class {
|
|
|
179
226
|
break;
|
|
180
227
|
}
|
|
181
228
|
}
|
|
229
|
+
handleInputFocus() {
|
|
230
|
+
if (this.tagInputType === "dropdown") {
|
|
231
|
+
this.openDropdown();
|
|
232
|
+
this.clearListItemFocus();
|
|
233
|
+
}
|
|
234
|
+
// force update needed to apply styled state of field-wrapper el
|
|
235
|
+
forceUpdate(this.el);
|
|
236
|
+
}
|
|
182
237
|
handleInputChanged(value) {
|
|
183
238
|
this.charCount = value.length;
|
|
184
|
-
if (this.
|
|
185
|
-
this.
|
|
239
|
+
if (this.tagInputType === "dropdown") {
|
|
240
|
+
this.clearListItemFocus();
|
|
241
|
+
if (this.charCount >= this.characterLimit - 5) {
|
|
242
|
+
this.announceCharacterLimitWarning(this.charCount, this.characterLimit);
|
|
243
|
+
}
|
|
244
|
+
if (!this.isExpanded) {
|
|
245
|
+
this.openDropdown();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else if (this.tagInputType === "table") {
|
|
249
|
+
this.clearCellFocus();
|
|
250
|
+
this.tablePosition = { row: 0, column: 1 };
|
|
186
251
|
}
|
|
187
252
|
this.announceExistingOptions();
|
|
188
|
-
|
|
189
|
-
|
|
253
|
+
}
|
|
254
|
+
handleInputEnter() {
|
|
255
|
+
if (this.tagInputType === "dropdown") {
|
|
256
|
+
if (this.focusedListItem) {
|
|
257
|
+
this.handleListItemClick(this.focusedListItem);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
this.submitInput(this.addNew, this.inputEl.value.trim());
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
else if (this.tagInputType === "table" && this.tablePosition.row > 0) {
|
|
264
|
+
this.handleTableRowClick(this.localRowEls[this.tablePosition.row].id);
|
|
190
265
|
}
|
|
191
266
|
}
|
|
192
267
|
submitInput(canAddNew, value) {
|
|
193
268
|
const hasNonWhiteSpaceCharacters = value.match(/\S/);
|
|
194
269
|
if (canAddNew && hasNonWhiteSpaceCharacters) {
|
|
195
|
-
this.
|
|
270
|
+
this.addTag(value);
|
|
196
271
|
this.optionsList = this.addOption(value);
|
|
197
272
|
this.resetInput();
|
|
198
|
-
// if maxTags has been reached, focus should go to the tagArea instead of the input
|
|
199
|
-
if (this.maxTags && this.tagsList.length >= this.maxTags) {
|
|
200
|
-
this.tagAreaEl.focus();
|
|
201
|
-
}
|
|
202
273
|
}
|
|
203
274
|
}
|
|
204
275
|
handleInputArrowDown() {
|
|
205
|
-
if (this.
|
|
276
|
+
if (this.tagInputType === "table") {
|
|
277
|
+
this.moveDownRow();
|
|
278
|
+
}
|
|
279
|
+
else if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
206
280
|
this.moveDownListItem();
|
|
207
281
|
}
|
|
208
|
-
else {
|
|
282
|
+
else if (this.tagInputType === "dropdown") {
|
|
209
283
|
this.openDropdown();
|
|
210
284
|
}
|
|
211
285
|
}
|
|
212
286
|
handleInputArrowUp() {
|
|
213
|
-
if (this.
|
|
287
|
+
if (this.tagInputType === "table") {
|
|
288
|
+
this.moveUpRow();
|
|
289
|
+
}
|
|
290
|
+
else if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
214
291
|
this.moveUpListItem();
|
|
215
292
|
}
|
|
216
|
-
else {
|
|
293
|
+
else if (this.tagInputType === "dropdown") {
|
|
217
294
|
this.openDropdown();
|
|
218
295
|
}
|
|
219
296
|
}
|
|
@@ -247,27 +324,37 @@ const TagInput = class {
|
|
|
247
324
|
if (this.focusedElement !== this.inputEl) {
|
|
248
325
|
this.inputEl.focus();
|
|
249
326
|
}
|
|
250
|
-
else {
|
|
327
|
+
else if (this.tagInputType === "dropdown") {
|
|
251
328
|
this.closeDropdown();
|
|
252
329
|
}
|
|
253
330
|
break;
|
|
254
331
|
}
|
|
255
332
|
}
|
|
256
|
-
handleListItemClick(
|
|
257
|
-
const
|
|
258
|
-
const tag = typedEvTarget.dataset.option.trim() || "";
|
|
333
|
+
handleListItemClick(item) {
|
|
334
|
+
const tag = item.dataset.option.trim() || "";
|
|
259
335
|
if (this.includesCaseInsensitive(this.tagsList, tag)) {
|
|
260
336
|
this.announce(this.generateTagAlreadyAddedMessage(tag));
|
|
261
337
|
}
|
|
262
338
|
else {
|
|
263
339
|
this.announce(this.generateTagAddedMessage(tag));
|
|
264
340
|
this.resetInput();
|
|
265
|
-
this.
|
|
341
|
+
this.addTag(tag);
|
|
266
342
|
this.optionsList = this.addOption(tag);
|
|
267
343
|
this.focusedListItem = null;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
handleTableRowClick(rowId) {
|
|
347
|
+
const referencedRow = this.el.querySelector(`#${rowId}`);
|
|
348
|
+
const tagText = referencedRow.col1;
|
|
349
|
+
const isLocked = referencedRow.locked;
|
|
350
|
+
if (!isLocked) {
|
|
351
|
+
if (this.includesCaseInsensitive(this.tagsList, rowId)) {
|
|
352
|
+
this.removeTag(rowId);
|
|
353
|
+
}
|
|
354
|
+
else {
|
|
355
|
+
this.announce(this.generateTagAddedMessage(tagText));
|
|
356
|
+
this.addTag(rowId);
|
|
357
|
+
}
|
|
271
358
|
}
|
|
272
359
|
}
|
|
273
360
|
handleTagAreaKeyDown(ev) {
|
|
@@ -289,7 +376,8 @@ const TagInput = class {
|
|
|
289
376
|
}
|
|
290
377
|
}
|
|
291
378
|
handleTagAreaDelete() {
|
|
292
|
-
|
|
379
|
+
const isLocked = this.focusedTag && this.focusedTag.classList.contains("locked");
|
|
380
|
+
if (this.focusedTag && this.focusedTag.dataset.tag && !isLocked) {
|
|
293
381
|
this.removeTag(this.focusedTag.dataset.tag);
|
|
294
382
|
if (this.tagsList.length === 0) {
|
|
295
383
|
// focus input if no tags are left
|
|
@@ -304,13 +392,29 @@ const TagInput = class {
|
|
|
304
392
|
}
|
|
305
393
|
handleBlur(ev, component) {
|
|
306
394
|
const isntElOrChild = ev.relatedTarget !== component && !this.el.shadowRoot.contains(ev.relatedTarget);
|
|
395
|
+
this.dismissTooltip();
|
|
396
|
+
this.tablePosition = { row: 0, column: 1 };
|
|
397
|
+
this.clearCellFocus();
|
|
307
398
|
if (isntElOrChild) {
|
|
308
|
-
this.closeDropdown();
|
|
309
399
|
this.fieldWrapperEl.classList.remove("focused");
|
|
400
|
+
if (this.tagInputType === "dropdown") {
|
|
401
|
+
this.closeDropdown();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
handleCellMouseEnter(ev) {
|
|
406
|
+
const cell = ev.target;
|
|
407
|
+
const isTruncated = cell.scrollWidth > cell.clientWidth;
|
|
408
|
+
if (isTruncated) {
|
|
409
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
410
|
+
showTooltip("bottom", cell, cell.innerText);
|
|
411
|
+
this.tooltipVisible = true;
|
|
310
412
|
}
|
|
311
413
|
}
|
|
312
414
|
handleTagAreaFocus() {
|
|
313
|
-
this.
|
|
415
|
+
if (this.tagInputType === "dropdown") {
|
|
416
|
+
this.closeDropdown();
|
|
417
|
+
}
|
|
314
418
|
if (!this.focusedTag) {
|
|
315
419
|
this.focusedTag = this.tagEls[0];
|
|
316
420
|
}
|
|
@@ -344,10 +448,71 @@ const TagInput = class {
|
|
|
344
448
|
this.focusListItem(this.focusedListItem.previousElementSibling);
|
|
345
449
|
}
|
|
346
450
|
else {
|
|
347
|
-
this.
|
|
348
|
-
|
|
451
|
+
this.clearListItemFocus();
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
moveDownRow() {
|
|
456
|
+
if (this.filteredRows.length > 0) {
|
|
457
|
+
if (this.tablePosition.row === 0) {
|
|
458
|
+
this.tablePosition.row = 1;
|
|
459
|
+
}
|
|
460
|
+
else if (this.tablePosition.row === this.filteredRows.length) {
|
|
461
|
+
this.tablePosition.row = 1;
|
|
462
|
+
}
|
|
463
|
+
else {
|
|
464
|
+
this.tablePosition.row++;
|
|
465
|
+
}
|
|
466
|
+
this.focusCell(this.tablePosition);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
moveUpRow() {
|
|
470
|
+
if (this.filteredRows.length > 0) {
|
|
471
|
+
if (this.tablePosition.row === 0) {
|
|
472
|
+
this.tablePosition.row = this.filteredRows.length;
|
|
473
|
+
}
|
|
474
|
+
else if (this.tablePosition.row === 1) {
|
|
475
|
+
this.tablePosition.row = 0;
|
|
349
476
|
}
|
|
477
|
+
else {
|
|
478
|
+
this.tablePosition.row--;
|
|
479
|
+
}
|
|
480
|
+
this.focusCell(this.tablePosition);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
moveLeftCell() {
|
|
484
|
+
const numCols = csvToArray(this.colHeaders).length;
|
|
485
|
+
if (this.tablePosition.column === 1 && this.tablePosition.row === 1) {
|
|
486
|
+
// if in first cell in first row, focus the input
|
|
487
|
+
this.tablePosition.row = 0;
|
|
488
|
+
}
|
|
489
|
+
else if (this.tablePosition.column === 1) {
|
|
490
|
+
// if in first cell, focus last cell of previous row
|
|
491
|
+
this.tablePosition.row--;
|
|
492
|
+
this.tablePosition.column = numCols;
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
this.tablePosition.column--;
|
|
350
496
|
}
|
|
497
|
+
this.focusCell(this.tablePosition);
|
|
498
|
+
}
|
|
499
|
+
moveRightCell() {
|
|
500
|
+
const numRows = this.filteredRows.length;
|
|
501
|
+
const numCols = csvToArray(this.colHeaders).length;
|
|
502
|
+
if (this.tablePosition.column === numCols && this.tablePosition.row === numRows) {
|
|
503
|
+
// if in last cell in last row, focus the first cell
|
|
504
|
+
this.tablePosition.row = 1;
|
|
505
|
+
this.tablePosition.column = 1;
|
|
506
|
+
}
|
|
507
|
+
else if (this.tablePosition.column === numCols) {
|
|
508
|
+
// if in last cell, focus first cell of next row
|
|
509
|
+
this.tablePosition.row++;
|
|
510
|
+
this.tablePosition.column = 1;
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
this.tablePosition.column++;
|
|
514
|
+
}
|
|
515
|
+
this.focusCell(this.tablePosition);
|
|
351
516
|
}
|
|
352
517
|
moveLeftTag() {
|
|
353
518
|
const lastTag = this.tagEls[this.tagEls.length - 1];
|
|
@@ -386,44 +551,79 @@ const TagInput = class {
|
|
|
386
551
|
const tagExistsAsOption = this.optionsList.filter((x) => x.toLowerCase() === tag.toLowerCase())[0];
|
|
387
552
|
if (!tagAlreadyAdded) {
|
|
388
553
|
this.announce(this.generateTagAddedMessage(tag));
|
|
389
|
-
|
|
554
|
+
this.tagsList = newTagsList.concat(tagExistsAsOption || tag);
|
|
555
|
+
// if maxTags has been reached, focus should go to the tagArea
|
|
556
|
+
if (this.maxTags && this.tagsList.length >= this.maxTags) {
|
|
557
|
+
this.tagAreaEl.focus();
|
|
558
|
+
}
|
|
390
559
|
}
|
|
391
|
-
return newTagsList;
|
|
392
560
|
}
|
|
393
561
|
removeTag(tag) {
|
|
394
562
|
const tagRemovedMessage = intl.formatMessage({ id: "tagInput.tagRemoved", defaultMessage: "{tag} removed" }, { tag: tag });
|
|
395
563
|
this.announce(tagRemovedMessage);
|
|
396
564
|
this.tagsList = this.filterCaseInsensitive(this.tagsList, tag);
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
this.
|
|
565
|
+
if (this.tagInputType === "dropdown") {
|
|
566
|
+
// if a tag was introduced by the user, also remove it from the dropdown options
|
|
567
|
+
const devOptionsList = csvToArray(this.options);
|
|
568
|
+
if (this.includesCaseInsensitive(this.optionsList, tag) && !this.includesCaseInsensitive(devOptionsList, tag)) {
|
|
569
|
+
this.removeOption(tag);
|
|
570
|
+
}
|
|
400
571
|
}
|
|
401
572
|
}
|
|
402
573
|
focusListItem(item) {
|
|
403
574
|
this.focusedListItem = item;
|
|
404
|
-
|
|
575
|
+
this.inputEl.setAttribute("aria-activedescendant", this.focusedListItem.id);
|
|
576
|
+
item.scrollIntoView({ block: "nearest" });
|
|
405
577
|
}
|
|
406
578
|
focusTag(element) {
|
|
407
579
|
this.focusedTag = element;
|
|
408
580
|
this.tagAreaEl.setAttribute("aria-activedescendant", this.focusedTag.id);
|
|
409
581
|
}
|
|
582
|
+
focusCell(position) {
|
|
583
|
+
this.clearCellFocus();
|
|
584
|
+
if (position.row) {
|
|
585
|
+
const rowToFocus = this.localRowEls[position.row];
|
|
586
|
+
const rowCells = rowToFocus.querySelectorAll("td");
|
|
587
|
+
const cellToFocus = rowCells[position.column - 1];
|
|
588
|
+
const isTruncated = cellToFocus.scrollWidth > cellToFocus.clientWidth;
|
|
589
|
+
rowToFocus.classList.add("focused");
|
|
590
|
+
cellToFocus.classList.add("focused");
|
|
591
|
+
cellToFocus.scrollIntoView({ block: "nearest" });
|
|
592
|
+
this.inputEl.setAttribute("aria-activedescendant", cellToFocus.id);
|
|
593
|
+
this.dismissTooltip();
|
|
594
|
+
if (isTruncated) {
|
|
595
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
596
|
+
showTooltip("bottom", cellToFocus, cellToFocus.innerText);
|
|
597
|
+
this.tooltipVisible = true;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
410
601
|
clearTagFocus() {
|
|
411
|
-
this.tagAreaEl.
|
|
602
|
+
this.tagAreaEl.setAttribute("aria-activedescendant", "");
|
|
412
603
|
this.focusedTag = null;
|
|
413
604
|
}
|
|
605
|
+
clearCellFocus() {
|
|
606
|
+
this.inputEl.setAttribute("aria-activedescendant", "");
|
|
607
|
+
this.localRowEls.forEach((row) => {
|
|
608
|
+
row.classList.remove("focused");
|
|
609
|
+
row.querySelectorAll("td").forEach((cell) => {
|
|
610
|
+
cell.classList.remove("focused");
|
|
611
|
+
});
|
|
612
|
+
});
|
|
613
|
+
}
|
|
414
614
|
openDropdown() {
|
|
415
615
|
// given an offset of -2px because the dropdown is transformed downwards to avoid overlapping the focus border
|
|
416
616
|
this.openUp = shouldOpenUp(this.el, this.dropdownEl, this.el.clientHeight, -2);
|
|
417
617
|
this.isExpanded = true;
|
|
418
618
|
}
|
|
419
619
|
closeDropdown() {
|
|
420
|
-
this.
|
|
620
|
+
this.clearListItemFocus();
|
|
421
621
|
this.isExpanded = false;
|
|
422
622
|
}
|
|
423
623
|
clearListItemFocus() {
|
|
424
624
|
this.focusedListItem = null;
|
|
625
|
+
this.inputEl.setAttribute("aria-activedescendant", "");
|
|
425
626
|
this.listItemEls.forEach((el) => {
|
|
426
|
-
el.tabIndex = -1;
|
|
427
627
|
el.classList.remove("focused");
|
|
428
628
|
});
|
|
429
629
|
}
|
|
@@ -441,11 +641,18 @@ const TagInput = class {
|
|
|
441
641
|
announceExistingOptions() {
|
|
442
642
|
// request animation frame to wait for re-rendering of filtered options
|
|
443
643
|
window.requestAnimationFrame(() => {
|
|
644
|
+
let numResults = 0;
|
|
645
|
+
if (this.tagInputType === "dropdown") {
|
|
646
|
+
numResults = this.optionEls.length;
|
|
647
|
+
}
|
|
648
|
+
else if (this.tagInputType === "table") {
|
|
649
|
+
numResults = this.filteredRows.length;
|
|
650
|
+
}
|
|
444
651
|
const existingOptionsMessage = intl.formatMessage({
|
|
445
652
|
id: "tagInput.existingOptions",
|
|
446
653
|
defaultMessage: "{num, plural, one {1 existing option.} other {# existing options.}}",
|
|
447
|
-
}, { num:
|
|
448
|
-
if (
|
|
654
|
+
}, { num: numResults });
|
|
655
|
+
if (numResults > 0) {
|
|
449
656
|
this.announce(existingOptionsMessage);
|
|
450
657
|
}
|
|
451
658
|
});
|
|
@@ -485,9 +692,6 @@ const TagInput = class {
|
|
|
485
692
|
listToCSV(list) {
|
|
486
693
|
return list.join(",");
|
|
487
694
|
}
|
|
488
|
-
csvToArray(csv) {
|
|
489
|
-
return csv ? csv.split(/, ?/) : [];
|
|
490
|
-
}
|
|
491
695
|
includesCaseInsensitive(list, element) {
|
|
492
696
|
const lowercaseList = list.map((str) => str.toLowerCase());
|
|
493
697
|
return lowercaseList.includes(element.toLowerCase());
|
|
@@ -508,9 +712,24 @@ const TagInput = class {
|
|
|
508
712
|
renderTags() {
|
|
509
713
|
return this.tagsList.map((tag, idx) => {
|
|
510
714
|
const id = `tag${idx + 1}`;
|
|
511
|
-
|
|
715
|
+
let tagText = "";
|
|
716
|
+
let isLocked = false;
|
|
717
|
+
if (this.tagInputType === "dropdown") {
|
|
718
|
+
tagText = tag;
|
|
719
|
+
}
|
|
720
|
+
else if (this.tagInputType === "table") {
|
|
721
|
+
// display table tags using col1 of the row with the same id
|
|
722
|
+
// if one can't be found, display as empty
|
|
723
|
+
const referencedRow = this.el.querySelector(`#${tag}`);
|
|
724
|
+
tagText = referencedRow ? referencedRow.col1 : "";
|
|
725
|
+
isLocked = referencedRow.locked;
|
|
726
|
+
}
|
|
727
|
+
return (h("li", { id: id, class: `tag highlight ${this.focusedTag && this.focusedTag.id === id ? "focused" : ""} ${isLocked ? "locked" : ""}`, "data-tag": tag, role: "option" }, tagText, isLocked ? (h("div", { class: "icon lock" })) : (h("button", { class: "icon remove-btn", tabIndex: -1, onClick: () => this.handleRemoveButtonClick(tag) }))));
|
|
512
728
|
});
|
|
513
729
|
}
|
|
730
|
+
renderDropdown() {
|
|
731
|
+
return (h("div", { class: `dropdown-wrapper ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, ref: (el) => (this.dropdownEl = el) }, h("div", { id: "help-text", class: "help-text" }, this.renderHelpText()), h("ul", { class: "dropdown", id: "dropdown", role: "listbox", "aria-multiselectable": "true", "aria-expanded": this.isExpanded ? "true" : false, "aria-label": this.label, tabindex: -1 }, this.inputEl && this.renderAddNewButton(), this.renderListItems(this.optionsList))));
|
|
732
|
+
}
|
|
514
733
|
renderListItems(optionsList) {
|
|
515
734
|
optionsList = this.sortCaseInsensitive(optionsList);
|
|
516
735
|
// filter by input
|
|
@@ -521,7 +740,7 @@ const TagInput = class {
|
|
|
521
740
|
const id = `option${idx + 1}`;
|
|
522
741
|
const isFocused = this.focusedListItem && this.focusedListItem.id === id;
|
|
523
742
|
const isSelected = this.includesCaseInsensitive(this.tagsList, option);
|
|
524
|
-
return (h("li", { class: `option ${isFocused ? "focused" : ""}`, role: "option", id: id, "data-option": option,
|
|
743
|
+
return (h("li", { class: `option ${isFocused ? "focused" : ""}`, role: "option", id: id, "data-option": option, "aria-selected": isSelected ? "true" : "false", "aria-disabled": isSelected ? "true" : "false", onKeyDown: (ev) => this.handleListItemKeyDown(ev), onBlur: (ev) => this.handleBlur(ev, this.el), onClick: (ev) => this.handleListItemClick(ev.target) }, option));
|
|
525
744
|
});
|
|
526
745
|
}
|
|
527
746
|
renderAddNewButton() {
|
|
@@ -530,7 +749,7 @@ const TagInput = class {
|
|
|
530
749
|
if (this.addNew && hasNonWhiteSpaceCharacters && !optionAlreadyExists) {
|
|
531
750
|
const id = `add-new-btn`;
|
|
532
751
|
const isFocused = this.focusedListItem && this.focusedListItem.id === id;
|
|
533
|
-
return (h("li", { role: "option", class: `add-new-btn ${isFocused ? "focused" : ""}`, id: id, "data-option": this.inputEl.value, onKeyDown: (ev) => this.handleListItemKeyDown(ev), onBlur: (ev) => this.handleBlur(ev, this.el), onClick: (ev) => this.handleListItemClick(ev), tabIndex: isFocused ? 0 : -1 }, `Add "${this.inputEl.value.trim()}"`));
|
|
752
|
+
return (h("li", { role: "option", class: `add-new-btn ${isFocused ? "focused" : ""}`, id: id, "data-option": this.inputEl.value, onKeyDown: (ev) => this.handleListItemKeyDown(ev), onBlur: (ev) => this.handleBlur(ev, this.el), onClick: (ev) => this.handleListItemClick(ev.target), tabIndex: isFocused ? 0 : -1 }, `Add "${this.inputEl.value.trim()}"`));
|
|
534
753
|
}
|
|
535
754
|
else
|
|
536
755
|
return "";
|
|
@@ -560,21 +779,45 @@ const TagInput = class {
|
|
|
560
779
|
return (h("div", { class: "lower-row" }, h("div", { id: "max-tags" }, this.generateTagCounterMessage(this.tagsList.length, this.maxTags), this.tagsList.length >= this.maxTags && h("span", { class: "sr-only" }, this.maxTagsReachedMessage))));
|
|
561
780
|
}
|
|
562
781
|
}
|
|
782
|
+
renderTable() {
|
|
783
|
+
return (h("div", { class: "table-wrapper", onScroll: () => this.dismissTooltip() }, h("table", { id: "table", role: "grid", class: `${this.colWidths ? "fixed-widths" : ""}`, "aria-label": this.label, "aria-multiselectable": "true" }, this.renderTableHeaders(), this.filteredRows.length ? this.renderTableRows() : h("div", { class: "no-results" }, this.noResultsMessage))));
|
|
784
|
+
}
|
|
785
|
+
renderTableHeaders() {
|
|
786
|
+
return (h("tr", { class: "headers", role: "row" }, csvToArray(this.colHeaders).map((header, idx) => {
|
|
787
|
+
let overflowRule = "wrap";
|
|
788
|
+
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
789
|
+
overflowRule = csvToArray(this.colWrap)[idx];
|
|
790
|
+
}
|
|
791
|
+
return (h("th", { class: `header-cell ${overflowRule}`, role: "columnheader",
|
|
792
|
+
// @ts-ignore
|
|
793
|
+
width: this.colWidths ? csvToArray(this.colWidths)[idx] : "" }, header));
|
|
794
|
+
})));
|
|
795
|
+
}
|
|
796
|
+
renderTableRows() {
|
|
797
|
+
return this.filteredRows.map((row) => {
|
|
798
|
+
const isSelected = this.includesCaseInsensitive(this.tagsList, row.id);
|
|
799
|
+
return (h("tr", { id: row.id, class: `${row.locked ? "locked" : ""} ${isSelected ? "selected" : ""}`, role: "row", onClick: () => this.handleTableRowClick(row.id) }, this.renderTableCells(row)));
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
renderTableCells(row) {
|
|
803
|
+
const colValues = [row.col1, row.col2, row.col3, row.col4].filter((val) => !!val);
|
|
804
|
+
const isSelected = this.includesCaseInsensitive(this.tagsList, row.id);
|
|
805
|
+
return colValues.map((val, idx) => {
|
|
806
|
+
const localId = `${row.id}-col${idx + 1}`;
|
|
807
|
+
let overflowRule = "wrap";
|
|
808
|
+
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
809
|
+
overflowRule = csvToArray(this.colWrap)[idx];
|
|
810
|
+
}
|
|
811
|
+
return (h("td", { id: localId, role: "gridcell", class: overflowRule, "aria-describedby": `${localId}-description`, "aria-selected": isSelected.toString(), onMouseEnter: (ev) => this.handleCellMouseEnter(ev), onMouseLeave: () => this.dismissTooltip() }, val, h("div", { class: "description", id: `${localId}-description` }, row.locked ? "locked" : "")));
|
|
812
|
+
});
|
|
813
|
+
}
|
|
563
814
|
render() {
|
|
564
|
-
|
|
565
|
-
(this.focusedElement === this.inputEl ||
|
|
566
|
-
this.focusedElement === this.tagAreaEl ||
|
|
567
|
-
this.focusedElement.classList.contains("add-new-btn") ||
|
|
568
|
-
(this.optionsList.length > 0 && this.listItemEls.includes(this.focusedElement)));
|
|
569
|
-
return (h(Host, { id: this.uid }, h("div", { class: `wrapper label-${this.labelPosition}` }, h("div", { class: "label-wrapper" }, h("label", { class: "label", htmlFor: `input${this.uid}` }, this.label)), h("div", { class: `field-wrapper ${isFocused ? "focused" : ""}`, ref: (el) => (this.fieldWrapperEl = el) }, h("div", { class: "upper-row" }, h("div", { class: "tags-and-input-wrapper" }, h("ul", { ref: (el) => (this.tagAreaEl = el), class: "tag-area", role: "listbox", "aria-orientation": "horizontal", "aria-label": `${this.label} ${this.tagsList.length > 0 ? this.tagAreaInstructions : ""}`, tabindex: this.tagsList.length > 0 ? 0 : -1, "aria-describedby": `info max-tags`, onFocus: () => this.handleTagAreaFocus(), onBlur: (ev) => {
|
|
815
|
+
return (h(Host, { id: this.uid }, h("div", { class: `wrapper label-${this.labelPosition}` }, h("div", { class: "label-wrapper" }, h("label", { class: "label", htmlFor: `input${this.uid}` }, this.label)), h("div", { class: `field-wrapper ${this.focusedElement ? "focused" : ""}`, ref: (el) => (this.fieldWrapperEl = el) }, h("div", { class: "upper-row" }, h("div", { class: "tags-and-input-wrapper" }, h("ul", { ref: (el) => (this.tagAreaEl = el), class: "tag-area", role: "listbox", "aria-orientation": "horizontal", "aria-label": `${this.label} ${this.tagsList.length > 0 ? this.tagAreaInstructions : ""}`, tabindex: this.tagsList.length > 0 ? 0 : -1, "aria-describedby": `info max-tags`, onFocus: () => this.handleTagAreaFocus(), onBlur: (ev) => {
|
|
570
816
|
this.clearTagFocus();
|
|
571
817
|
this.handleBlur(ev, this.el);
|
|
572
|
-
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags()), h("input", { id: `input${this.uid}`, class: this.maxTags && this.tagsList.length >= this.maxTags ? "hidden" : "", role: "combobox", ref: (el) => (this.inputEl = el), autocomplete: "off", "aria-controls":
|
|
818
|
+
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags()), h("input", { id: `input${this.uid}`, class: this.maxTags && this.tagsList.length >= this.maxTags ? "hidden" : "", role: "combobox", ref: (el) => (this.inputEl = el), autocomplete: "off", "aria-controls": this.tagInputType, "aria-describedby": "help-text", "aria-label": `${this.label} ${this.generateCharacterLimitLabel(this.characterLimit)}`, "aria-expanded": this.tagInputType === "dropdown" ? this.isExpanded.toString() : null, placeholder: this.placeholder, maxLength: this.tagInputType === "dropdown" ? this.characterLimit : undefined, onInput: () => this.handleInputChanged(this.inputEl.value), onBlur: (ev) => {
|
|
573
819
|
this.handleBlur(ev, this.el);
|
|
574
|
-
}, onFocus: () => {
|
|
575
|
-
this.openDropdown();
|
|
576
|
-
this.clearListItemFocus();
|
|
577
|
-
}, onKeyDown: (ev) => this.handleInputKeyDown(ev) })), h("div", { class: "character-count" }, this.charCount, "/", this.characterLimit)), this.renderTagCounter(), h("div", { class: `dropdown-wrapper ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, ref: (el) => (this.dropdownEl = el) }, h("div", { id: "help-text", class: "help-text" }, this.renderHelpText()), h("ul", { class: "dropdown", id: "dropdown", role: "listbox", "aria-multiselectable": "true", "aria-expanded": this.isExpanded ? "true" : false, "aria-label": this.label, tabindex: -1 }, this.inputEl && this.renderAddNewButton(), this.renderListItems(this.optionsList)))), this.info ? (h("div", { id: "info", class: "info-text" }, this.info)) : (""), h("div", { class: "sr-only", "aria-live": "assertive", ref: (el) => (this.liveRegionEl = el), "aria-atomic": "true" }, this.liveRegionMessage))));
|
|
820
|
+
}, onFocus: () => this.handleInputFocus(), onKeyDown: (ev) => this.handleInputKeyDown(ev) })), this.tagInputType === "dropdown" && (h("div", { class: "character-count" }, this.charCount, "/", this.characterLimit))), this.renderTagCounter(), this.tagInputType === "dropdown" && this.renderDropdown()), this.info ? (h("div", { id: "info", class: "info-text" }, this.info)) : (""), h("div", { class: "sr-only", "aria-live": "assertive", ref: (el) => (this.liveRegionEl = el), "aria-atomic": "true" }, this.liveRegionMessage), this.tagInputType === "table" && this.renderTable())));
|
|
578
821
|
}
|
|
579
822
|
get el() { return getElement(this); }
|
|
580
823
|
static get watchers() { return {
|