@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,5 +1,5 @@
|
|
|
1
|
-
import { h, Component, Host, Element, Prop, Listen, State, Event, Watch } from "@stencil/core";
|
|
2
|
-
import { generateId, shouldOpenUp, intl, debounce } from "../../global/functions";
|
|
1
|
+
import { h, Component, Host, Element, Prop, Listen, State, Event, Watch, forceUpdate, } from "@stencil/core";
|
|
2
|
+
import { csvToArray, generateId, shouldOpenUp, intl, debounce, showTooltip, hideTooltip } from "../../global/functions";
|
|
3
3
|
export class TagInput {
|
|
4
4
|
constructor() {
|
|
5
5
|
this.labelPosition = "top";
|
|
@@ -7,11 +7,14 @@ export class TagInput {
|
|
|
7
7
|
this.selectedTags = ""; // csv
|
|
8
8
|
this.addNew = true;
|
|
9
9
|
this.characterLimit = 50;
|
|
10
|
+
this.tagInputType = "dropdown";
|
|
10
11
|
this.uid = this.el.id ? this.el.id : generateId();
|
|
11
12
|
this.openUp = false;
|
|
13
|
+
this.tooltipVisible = false;
|
|
14
|
+
this.tablePosition = { row: 0, column: 1 };
|
|
12
15
|
this.isExpanded = false;
|
|
13
|
-
this.tagsList =
|
|
14
|
-
this.optionsList =
|
|
16
|
+
this.tagsList = csvToArray(this.selectedTags);
|
|
17
|
+
this.optionsList = csvToArray(this.options);
|
|
15
18
|
this.charCount = 0;
|
|
16
19
|
this.liveRegionMessage = "";
|
|
17
20
|
this.tagAreaInstructions = intl.formatMessage({
|
|
@@ -38,6 +41,25 @@ export class TagInput {
|
|
|
38
41
|
get optionEls() {
|
|
39
42
|
return Array.from(this.dropdownEl.querySelectorAll(".option"));
|
|
40
43
|
}
|
|
44
|
+
get wmRowEls() {
|
|
45
|
+
return Array.from(this.el.querySelectorAll("wm-tag-input-row"));
|
|
46
|
+
}
|
|
47
|
+
get localRowEls() {
|
|
48
|
+
return Array.from(this.el.shadowRoot.querySelectorAll("tr"));
|
|
49
|
+
}
|
|
50
|
+
get filteredRows() {
|
|
51
|
+
return this.wmRowEls.filter((row) => {
|
|
52
|
+
const colValues = [row.col1, row.col2, row.col3, row.col4].join("").toLowerCase();
|
|
53
|
+
return this.inputEl && this.inputEl.value.toLowerCase() ? colValues.includes(this.inputEl.value) : true;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
get noResultsMessage() {
|
|
57
|
+
return intl.formatMessage({
|
|
58
|
+
id: "tagInput.noResults",
|
|
59
|
+
defaultMessage: "No results match your search.",
|
|
60
|
+
description: "Message displayed when a user's search returns empty.",
|
|
61
|
+
});
|
|
62
|
+
}
|
|
41
63
|
generateTagAddedMessage(tag) {
|
|
42
64
|
return intl.formatMessage({
|
|
43
65
|
id: "tagInput.tagAdded",
|
|
@@ -100,7 +122,7 @@ export class TagInput {
|
|
|
100
122
|
this.options += `${this.options.length > 0 ? "," : ""}${tag}`;
|
|
101
123
|
}
|
|
102
124
|
});
|
|
103
|
-
this.optionsList =
|
|
125
|
+
this.optionsList = csvToArray(this.options);
|
|
104
126
|
}
|
|
105
127
|
createPlaceholderDefault(addNew, hasOptions) {
|
|
106
128
|
const addAndSearchPlaceholder = intl.formatMessage({
|
|
@@ -134,12 +156,25 @@ export class TagInput {
|
|
|
134
156
|
this.selectedTags = this.listToCSV(this.tagsList);
|
|
135
157
|
this.wmTagInputChanged.emit({ value: this.tagsList });
|
|
136
158
|
}
|
|
159
|
+
handleRowUpdate() {
|
|
160
|
+
forceUpdate(this.el);
|
|
161
|
+
}
|
|
137
162
|
closeIfNotElOrChild(ev) {
|
|
138
163
|
const isntElOrChild = ev.target !== this.el && !this.el.shadowRoot.contains(ev.target);
|
|
139
|
-
if (isntElOrChild && this.isExpanded) {
|
|
164
|
+
if (this.tagInputType === "dropdown" && isntElOrChild && this.isExpanded) {
|
|
140
165
|
this.closeDropdown();
|
|
141
166
|
}
|
|
142
167
|
}
|
|
168
|
+
// From wm-button
|
|
169
|
+
// we need to listen for scroll events during the capture phase because they do not bubble up
|
|
170
|
+
// there can be layouts where the main content has 100vh and overflows
|
|
171
|
+
// in these cases window will register no scroll events unless we catch on they way down
|
|
172
|
+
dismissTooltip() {
|
|
173
|
+
if (this.tooltipVisible) {
|
|
174
|
+
hideTooltip();
|
|
175
|
+
this.tooltipVisible = false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
143
178
|
handleResize() {
|
|
144
179
|
this.debouncedResize();
|
|
145
180
|
}
|
|
@@ -153,7 +188,7 @@ export class TagInput {
|
|
|
153
188
|
case "Enter":
|
|
154
189
|
case ",":
|
|
155
190
|
ev.preventDefault();
|
|
156
|
-
this.
|
|
191
|
+
this.handleInputEnter();
|
|
157
192
|
break;
|
|
158
193
|
case "ArrowDown":
|
|
159
194
|
ev.preventDefault();
|
|
@@ -163,8 +198,20 @@ export class TagInput {
|
|
|
163
198
|
ev.preventDefault();
|
|
164
199
|
this.handleInputArrowUp();
|
|
165
200
|
break;
|
|
201
|
+
case "ArrowLeft":
|
|
202
|
+
ev.preventDefault();
|
|
203
|
+
if (this.tagInputType === "table" && this.tablePosition.row) {
|
|
204
|
+
this.moveLeftCell();
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
case "ArrowRight":
|
|
208
|
+
ev.preventDefault();
|
|
209
|
+
if (this.tagInputType === "table" && this.tablePosition.row) {
|
|
210
|
+
this.moveRightCell();
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
166
213
|
case "Escape":
|
|
167
|
-
if (this.isExpanded) {
|
|
214
|
+
if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
168
215
|
this.closeDropdown();
|
|
169
216
|
}
|
|
170
217
|
break;
|
|
@@ -174,41 +221,71 @@ export class TagInput {
|
|
|
174
221
|
break;
|
|
175
222
|
}
|
|
176
223
|
}
|
|
224
|
+
handleInputFocus() {
|
|
225
|
+
if (this.tagInputType === "dropdown") {
|
|
226
|
+
this.openDropdown();
|
|
227
|
+
this.clearListItemFocus();
|
|
228
|
+
}
|
|
229
|
+
// force update needed to apply styled state of field-wrapper el
|
|
230
|
+
forceUpdate(this.el);
|
|
231
|
+
}
|
|
177
232
|
handleInputChanged(value) {
|
|
178
233
|
this.charCount = value.length;
|
|
179
|
-
if (this.
|
|
180
|
-
this.
|
|
234
|
+
if (this.tagInputType === "dropdown") {
|
|
235
|
+
this.clearListItemFocus();
|
|
236
|
+
if (this.charCount >= this.characterLimit - 5) {
|
|
237
|
+
this.announceCharacterLimitWarning(this.charCount, this.characterLimit);
|
|
238
|
+
}
|
|
239
|
+
if (!this.isExpanded) {
|
|
240
|
+
this.openDropdown();
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
else if (this.tagInputType === "table") {
|
|
244
|
+
this.clearCellFocus();
|
|
245
|
+
this.tablePosition = { row: 0, column: 1 };
|
|
181
246
|
}
|
|
182
247
|
this.announceExistingOptions();
|
|
183
|
-
|
|
184
|
-
|
|
248
|
+
}
|
|
249
|
+
handleInputEnter() {
|
|
250
|
+
if (this.tagInputType === "dropdown") {
|
|
251
|
+
if (this.focusedListItem) {
|
|
252
|
+
this.handleListItemClick(this.focusedListItem);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
this.submitInput(this.addNew, this.inputEl.value.trim());
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else if (this.tagInputType === "table" && this.tablePosition.row > 0) {
|
|
259
|
+
this.handleTableRowClick(this.localRowEls[this.tablePosition.row].id);
|
|
185
260
|
}
|
|
186
261
|
}
|
|
187
262
|
submitInput(canAddNew, value) {
|
|
188
263
|
const hasNonWhiteSpaceCharacters = value.match(/\S/);
|
|
189
264
|
if (canAddNew && hasNonWhiteSpaceCharacters) {
|
|
190
|
-
this.
|
|
265
|
+
this.addTag(value);
|
|
191
266
|
this.optionsList = this.addOption(value);
|
|
192
267
|
this.resetInput();
|
|
193
|
-
// if maxTags has been reached, focus should go to the tagArea instead of the input
|
|
194
|
-
if (this.maxTags && this.tagsList.length >= this.maxTags) {
|
|
195
|
-
this.tagAreaEl.focus();
|
|
196
|
-
}
|
|
197
268
|
}
|
|
198
269
|
}
|
|
199
270
|
handleInputArrowDown() {
|
|
200
|
-
if (this.
|
|
271
|
+
if (this.tagInputType === "table") {
|
|
272
|
+
this.moveDownRow();
|
|
273
|
+
}
|
|
274
|
+
else if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
201
275
|
this.moveDownListItem();
|
|
202
276
|
}
|
|
203
|
-
else {
|
|
277
|
+
else if (this.tagInputType === "dropdown") {
|
|
204
278
|
this.openDropdown();
|
|
205
279
|
}
|
|
206
280
|
}
|
|
207
281
|
handleInputArrowUp() {
|
|
208
|
-
if (this.
|
|
282
|
+
if (this.tagInputType === "table") {
|
|
283
|
+
this.moveUpRow();
|
|
284
|
+
}
|
|
285
|
+
else if (this.tagInputType === "dropdown" && this.isExpanded) {
|
|
209
286
|
this.moveUpListItem();
|
|
210
287
|
}
|
|
211
|
-
else {
|
|
288
|
+
else if (this.tagInputType === "dropdown") {
|
|
212
289
|
this.openDropdown();
|
|
213
290
|
}
|
|
214
291
|
}
|
|
@@ -242,27 +319,37 @@ export class TagInput {
|
|
|
242
319
|
if (this.focusedElement !== this.inputEl) {
|
|
243
320
|
this.inputEl.focus();
|
|
244
321
|
}
|
|
245
|
-
else {
|
|
322
|
+
else if (this.tagInputType === "dropdown") {
|
|
246
323
|
this.closeDropdown();
|
|
247
324
|
}
|
|
248
325
|
break;
|
|
249
326
|
}
|
|
250
327
|
}
|
|
251
|
-
handleListItemClick(
|
|
252
|
-
const
|
|
253
|
-
const tag = typedEvTarget.dataset.option.trim() || "";
|
|
328
|
+
handleListItemClick(item) {
|
|
329
|
+
const tag = item.dataset.option.trim() || "";
|
|
254
330
|
if (this.includesCaseInsensitive(this.tagsList, tag)) {
|
|
255
331
|
this.announce(this.generateTagAlreadyAddedMessage(tag));
|
|
256
332
|
}
|
|
257
333
|
else {
|
|
258
334
|
this.announce(this.generateTagAddedMessage(tag));
|
|
259
335
|
this.resetInput();
|
|
260
|
-
this.
|
|
336
|
+
this.addTag(tag);
|
|
261
337
|
this.optionsList = this.addOption(tag);
|
|
262
338
|
this.focusedListItem = null;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
handleTableRowClick(rowId) {
|
|
342
|
+
const referencedRow = this.el.querySelector(`#${rowId}`);
|
|
343
|
+
const tagText = referencedRow.col1;
|
|
344
|
+
const isLocked = referencedRow.locked;
|
|
345
|
+
if (!isLocked) {
|
|
346
|
+
if (this.includesCaseInsensitive(this.tagsList, rowId)) {
|
|
347
|
+
this.removeTag(rowId);
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
this.announce(this.generateTagAddedMessage(tagText));
|
|
351
|
+
this.addTag(rowId);
|
|
352
|
+
}
|
|
266
353
|
}
|
|
267
354
|
}
|
|
268
355
|
handleTagAreaKeyDown(ev) {
|
|
@@ -284,7 +371,8 @@ export class TagInput {
|
|
|
284
371
|
}
|
|
285
372
|
}
|
|
286
373
|
handleTagAreaDelete() {
|
|
287
|
-
|
|
374
|
+
const isLocked = this.focusedTag && this.focusedTag.classList.contains("locked");
|
|
375
|
+
if (this.focusedTag && this.focusedTag.dataset.tag && !isLocked) {
|
|
288
376
|
this.removeTag(this.focusedTag.dataset.tag);
|
|
289
377
|
if (this.tagsList.length === 0) {
|
|
290
378
|
// focus input if no tags are left
|
|
@@ -299,13 +387,29 @@ export class TagInput {
|
|
|
299
387
|
}
|
|
300
388
|
handleBlur(ev, component) {
|
|
301
389
|
const isntElOrChild = ev.relatedTarget !== component && !this.el.shadowRoot.contains(ev.relatedTarget);
|
|
390
|
+
this.dismissTooltip();
|
|
391
|
+
this.tablePosition = { row: 0, column: 1 };
|
|
392
|
+
this.clearCellFocus();
|
|
302
393
|
if (isntElOrChild) {
|
|
303
|
-
this.closeDropdown();
|
|
304
394
|
this.fieldWrapperEl.classList.remove("focused");
|
|
395
|
+
if (this.tagInputType === "dropdown") {
|
|
396
|
+
this.closeDropdown();
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
handleCellMouseEnter(ev) {
|
|
401
|
+
const cell = ev.target;
|
|
402
|
+
const isTruncated = cell.scrollWidth > cell.clientWidth;
|
|
403
|
+
if (isTruncated) {
|
|
404
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
405
|
+
showTooltip("bottom", cell, cell.innerText);
|
|
406
|
+
this.tooltipVisible = true;
|
|
305
407
|
}
|
|
306
408
|
}
|
|
307
409
|
handleTagAreaFocus() {
|
|
308
|
-
this.
|
|
410
|
+
if (this.tagInputType === "dropdown") {
|
|
411
|
+
this.closeDropdown();
|
|
412
|
+
}
|
|
309
413
|
if (!this.focusedTag) {
|
|
310
414
|
this.focusedTag = this.tagEls[0];
|
|
311
415
|
}
|
|
@@ -339,11 +443,72 @@ export class TagInput {
|
|
|
339
443
|
this.focusListItem(this.focusedListItem.previousElementSibling);
|
|
340
444
|
}
|
|
341
445
|
else {
|
|
342
|
-
this.
|
|
343
|
-
this.inputEl.focus();
|
|
446
|
+
this.clearListItemFocus();
|
|
344
447
|
}
|
|
345
448
|
}
|
|
346
449
|
}
|
|
450
|
+
moveDownRow() {
|
|
451
|
+
if (this.filteredRows.length > 0) {
|
|
452
|
+
if (this.tablePosition.row === 0) {
|
|
453
|
+
this.tablePosition.row = 1;
|
|
454
|
+
}
|
|
455
|
+
else if (this.tablePosition.row === this.filteredRows.length) {
|
|
456
|
+
this.tablePosition.row = 1;
|
|
457
|
+
}
|
|
458
|
+
else {
|
|
459
|
+
this.tablePosition.row++;
|
|
460
|
+
}
|
|
461
|
+
this.focusCell(this.tablePosition);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
moveUpRow() {
|
|
465
|
+
if (this.filteredRows.length > 0) {
|
|
466
|
+
if (this.tablePosition.row === 0) {
|
|
467
|
+
this.tablePosition.row = this.filteredRows.length;
|
|
468
|
+
}
|
|
469
|
+
else if (this.tablePosition.row === 1) {
|
|
470
|
+
this.tablePosition.row = 0;
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
this.tablePosition.row--;
|
|
474
|
+
}
|
|
475
|
+
this.focusCell(this.tablePosition);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
moveLeftCell() {
|
|
479
|
+
const numCols = csvToArray(this.colHeaders).length;
|
|
480
|
+
if (this.tablePosition.column === 1 && this.tablePosition.row === 1) {
|
|
481
|
+
// if in first cell in first row, focus the input
|
|
482
|
+
this.tablePosition.row = 0;
|
|
483
|
+
}
|
|
484
|
+
else if (this.tablePosition.column === 1) {
|
|
485
|
+
// if in first cell, focus last cell of previous row
|
|
486
|
+
this.tablePosition.row--;
|
|
487
|
+
this.tablePosition.column = numCols;
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
this.tablePosition.column--;
|
|
491
|
+
}
|
|
492
|
+
this.focusCell(this.tablePosition);
|
|
493
|
+
}
|
|
494
|
+
moveRightCell() {
|
|
495
|
+
const numRows = this.filteredRows.length;
|
|
496
|
+
const numCols = csvToArray(this.colHeaders).length;
|
|
497
|
+
if (this.tablePosition.column === numCols && this.tablePosition.row === numRows) {
|
|
498
|
+
// if in last cell in last row, focus the first cell
|
|
499
|
+
this.tablePosition.row = 1;
|
|
500
|
+
this.tablePosition.column = 1;
|
|
501
|
+
}
|
|
502
|
+
else if (this.tablePosition.column === numCols) {
|
|
503
|
+
// if in last cell, focus first cell of next row
|
|
504
|
+
this.tablePosition.row++;
|
|
505
|
+
this.tablePosition.column = 1;
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
this.tablePosition.column++;
|
|
509
|
+
}
|
|
510
|
+
this.focusCell(this.tablePosition);
|
|
511
|
+
}
|
|
347
512
|
moveLeftTag() {
|
|
348
513
|
const lastTag = this.tagEls[this.tagEls.length - 1];
|
|
349
514
|
if (this.focusedTag && this.tagEls.includes(this.focusedTag.previousElementSibling)) {
|
|
@@ -381,44 +546,79 @@ export class TagInput {
|
|
|
381
546
|
const tagExistsAsOption = this.optionsList.filter((x) => x.toLowerCase() === tag.toLowerCase())[0];
|
|
382
547
|
if (!tagAlreadyAdded) {
|
|
383
548
|
this.announce(this.generateTagAddedMessage(tag));
|
|
384
|
-
|
|
549
|
+
this.tagsList = newTagsList.concat(tagExistsAsOption || tag);
|
|
550
|
+
// if maxTags has been reached, focus should go to the tagArea
|
|
551
|
+
if (this.maxTags && this.tagsList.length >= this.maxTags) {
|
|
552
|
+
this.tagAreaEl.focus();
|
|
553
|
+
}
|
|
385
554
|
}
|
|
386
|
-
return newTagsList;
|
|
387
555
|
}
|
|
388
556
|
removeTag(tag) {
|
|
389
557
|
const tagRemovedMessage = intl.formatMessage({ id: "tagInput.tagRemoved", defaultMessage: "{tag} removed" }, { tag: tag });
|
|
390
558
|
this.announce(tagRemovedMessage);
|
|
391
559
|
this.tagsList = this.filterCaseInsensitive(this.tagsList, tag);
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
this.
|
|
560
|
+
if (this.tagInputType === "dropdown") {
|
|
561
|
+
// if a tag was introduced by the user, also remove it from the dropdown options
|
|
562
|
+
const devOptionsList = csvToArray(this.options);
|
|
563
|
+
if (this.includesCaseInsensitive(this.optionsList, tag) && !this.includesCaseInsensitive(devOptionsList, tag)) {
|
|
564
|
+
this.removeOption(tag);
|
|
565
|
+
}
|
|
395
566
|
}
|
|
396
567
|
}
|
|
397
568
|
focusListItem(item) {
|
|
398
569
|
this.focusedListItem = item;
|
|
399
|
-
|
|
570
|
+
this.inputEl.setAttribute("aria-activedescendant", this.focusedListItem.id);
|
|
571
|
+
item.scrollIntoView({ block: "nearest" });
|
|
400
572
|
}
|
|
401
573
|
focusTag(element) {
|
|
402
574
|
this.focusedTag = element;
|
|
403
575
|
this.tagAreaEl.setAttribute("aria-activedescendant", this.focusedTag.id);
|
|
404
576
|
}
|
|
577
|
+
focusCell(position) {
|
|
578
|
+
this.clearCellFocus();
|
|
579
|
+
if (position.row) {
|
|
580
|
+
const rowToFocus = this.localRowEls[position.row];
|
|
581
|
+
const rowCells = rowToFocus.querySelectorAll("td");
|
|
582
|
+
const cellToFocus = rowCells[position.column - 1];
|
|
583
|
+
const isTruncated = cellToFocus.scrollWidth > cellToFocus.clientWidth;
|
|
584
|
+
rowToFocus.classList.add("focused");
|
|
585
|
+
cellToFocus.classList.add("focused");
|
|
586
|
+
cellToFocus.scrollIntoView({ block: "nearest" });
|
|
587
|
+
this.inputEl.setAttribute("aria-activedescendant", cellToFocus.id);
|
|
588
|
+
this.dismissTooltip();
|
|
589
|
+
if (isTruncated) {
|
|
590
|
+
// innerText is necessary vs textContent, as innerText ignores sr-only / display: none text
|
|
591
|
+
showTooltip("bottom", cellToFocus, cellToFocus.innerText);
|
|
592
|
+
this.tooltipVisible = true;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
}
|
|
405
596
|
clearTagFocus() {
|
|
406
|
-
this.tagAreaEl.
|
|
597
|
+
this.tagAreaEl.setAttribute("aria-activedescendant", "");
|
|
407
598
|
this.focusedTag = null;
|
|
408
599
|
}
|
|
600
|
+
clearCellFocus() {
|
|
601
|
+
this.inputEl.setAttribute("aria-activedescendant", "");
|
|
602
|
+
this.localRowEls.forEach((row) => {
|
|
603
|
+
row.classList.remove("focused");
|
|
604
|
+
row.querySelectorAll("td").forEach((cell) => {
|
|
605
|
+
cell.classList.remove("focused");
|
|
606
|
+
});
|
|
607
|
+
});
|
|
608
|
+
}
|
|
409
609
|
openDropdown() {
|
|
410
610
|
// given an offset of -2px because the dropdown is transformed downwards to avoid overlapping the focus border
|
|
411
611
|
this.openUp = shouldOpenUp(this.el, this.dropdownEl, this.el.clientHeight, -2);
|
|
412
612
|
this.isExpanded = true;
|
|
413
613
|
}
|
|
414
614
|
closeDropdown() {
|
|
415
|
-
this.
|
|
615
|
+
this.clearListItemFocus();
|
|
416
616
|
this.isExpanded = false;
|
|
417
617
|
}
|
|
418
618
|
clearListItemFocus() {
|
|
419
619
|
this.focusedListItem = null;
|
|
620
|
+
this.inputEl.setAttribute("aria-activedescendant", "");
|
|
420
621
|
this.listItemEls.forEach((el) => {
|
|
421
|
-
el.tabIndex = -1;
|
|
422
622
|
el.classList.remove("focused");
|
|
423
623
|
});
|
|
424
624
|
}
|
|
@@ -436,11 +636,18 @@ export class TagInput {
|
|
|
436
636
|
announceExistingOptions() {
|
|
437
637
|
// request animation frame to wait for re-rendering of filtered options
|
|
438
638
|
window.requestAnimationFrame(() => {
|
|
639
|
+
let numResults = 0;
|
|
640
|
+
if (this.tagInputType === "dropdown") {
|
|
641
|
+
numResults = this.optionEls.length;
|
|
642
|
+
}
|
|
643
|
+
else if (this.tagInputType === "table") {
|
|
644
|
+
numResults = this.filteredRows.length;
|
|
645
|
+
}
|
|
439
646
|
const existingOptionsMessage = intl.formatMessage({
|
|
440
647
|
id: "tagInput.existingOptions",
|
|
441
648
|
defaultMessage: "{num, plural, one {1 existing option.} other {# existing options.}}",
|
|
442
|
-
}, { num:
|
|
443
|
-
if (
|
|
649
|
+
}, { num: numResults });
|
|
650
|
+
if (numResults > 0) {
|
|
444
651
|
this.announce(existingOptionsMessage);
|
|
445
652
|
}
|
|
446
653
|
});
|
|
@@ -480,9 +687,6 @@ export class TagInput {
|
|
|
480
687
|
listToCSV(list) {
|
|
481
688
|
return list.join(",");
|
|
482
689
|
}
|
|
483
|
-
csvToArray(csv) {
|
|
484
|
-
return csv ? csv.split(/, ?/) : [];
|
|
485
|
-
}
|
|
486
690
|
includesCaseInsensitive(list, element) {
|
|
487
691
|
const lowercaseList = list.map((str) => str.toLowerCase());
|
|
488
692
|
return lowercaseList.includes(element.toLowerCase());
|
|
@@ -503,11 +707,30 @@ export class TagInput {
|
|
|
503
707
|
renderTags() {
|
|
504
708
|
return this.tagsList.map((tag, idx) => {
|
|
505
709
|
const id = `tag${idx + 1}`;
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
710
|
+
let tagText = "";
|
|
711
|
+
let isLocked = false;
|
|
712
|
+
if (this.tagInputType === "dropdown") {
|
|
713
|
+
tagText = tag;
|
|
714
|
+
}
|
|
715
|
+
else if (this.tagInputType === "table") {
|
|
716
|
+
// display table tags using col1 of the row with the same id
|
|
717
|
+
// if one can't be found, display as empty
|
|
718
|
+
const referencedRow = this.el.querySelector(`#${tag}`);
|
|
719
|
+
tagText = referencedRow ? referencedRow.col1 : "";
|
|
720
|
+
isLocked = referencedRow.locked;
|
|
721
|
+
}
|
|
722
|
+
return (h("li", { id: id, class: `tag highlight ${this.focusedTag && this.focusedTag.id === id ? "focused" : ""} ${isLocked ? "locked" : ""}`, "data-tag": tag, role: "option" },
|
|
723
|
+
tagText,
|
|
724
|
+
isLocked ? (h("div", { class: "icon lock" })) : (h("button", { class: "icon remove-btn", tabIndex: -1, onClick: () => this.handleRemoveButtonClick(tag) }))));
|
|
509
725
|
});
|
|
510
726
|
}
|
|
727
|
+
renderDropdown() {
|
|
728
|
+
return (h("div", { class: `dropdown-wrapper ${this.isExpanded ? "open" : ""} ${this.openUp ? "upwards" : ""}`, ref: (el) => (this.dropdownEl = el) },
|
|
729
|
+
h("div", { id: "help-text", class: "help-text" }, this.renderHelpText()),
|
|
730
|
+
h("ul", { class: "dropdown", id: "dropdown", role: "listbox", "aria-multiselectable": "true", "aria-expanded": this.isExpanded ? "true" : false, "aria-label": this.label, tabindex: -1 },
|
|
731
|
+
this.inputEl && this.renderAddNewButton(),
|
|
732
|
+
this.renderListItems(this.optionsList))));
|
|
733
|
+
}
|
|
511
734
|
renderListItems(optionsList) {
|
|
512
735
|
optionsList = this.sortCaseInsensitive(optionsList);
|
|
513
736
|
// filter by input
|
|
@@ -518,7 +741,7 @@ export class TagInput {
|
|
|
518
741
|
const id = `option${idx + 1}`;
|
|
519
742
|
const isFocused = this.focusedListItem && this.focusedListItem.id === id;
|
|
520
743
|
const isSelected = this.includesCaseInsensitive(this.tagsList, option);
|
|
521
|
-
return (h("li", { class: `option ${isFocused ? "focused" : ""}`, role: "option", id: id, "data-option": option,
|
|
744
|
+
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));
|
|
522
745
|
});
|
|
523
746
|
}
|
|
524
747
|
renderAddNewButton() {
|
|
@@ -527,7 +750,7 @@ export class TagInput {
|
|
|
527
750
|
if (this.addNew && hasNonWhiteSpaceCharacters && !optionAlreadyExists) {
|
|
528
751
|
const id = `add-new-btn`;
|
|
529
752
|
const isFocused = this.focusedListItem && this.focusedListItem.id === id;
|
|
530
|
-
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()}"`));
|
|
753
|
+
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()}"`));
|
|
531
754
|
}
|
|
532
755
|
else
|
|
533
756
|
return "";
|
|
@@ -560,41 +783,67 @@ export class TagInput {
|
|
|
560
783
|
this.tagsList.length >= this.maxTags && h("span", { class: "sr-only" }, this.maxTagsReachedMessage))));
|
|
561
784
|
}
|
|
562
785
|
}
|
|
786
|
+
renderTable() {
|
|
787
|
+
return (h("div", { class: "table-wrapper", onScroll: () => this.dismissTooltip() },
|
|
788
|
+
h("table", { id: "table", role: "grid", class: `${this.colWidths ? "fixed-widths" : ""}`, "aria-label": this.label, "aria-multiselectable": "true" },
|
|
789
|
+
this.renderTableHeaders(),
|
|
790
|
+
this.filteredRows.length ? this.renderTableRows() : h("div", { class: "no-results" }, this.noResultsMessage))));
|
|
791
|
+
}
|
|
792
|
+
renderTableHeaders() {
|
|
793
|
+
return (h("tr", { class: "headers", role: "row" }, csvToArray(this.colHeaders).map((header, idx) => {
|
|
794
|
+
let overflowRule = "wrap";
|
|
795
|
+
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
796
|
+
overflowRule = csvToArray(this.colWrap)[idx];
|
|
797
|
+
}
|
|
798
|
+
return (h("th", { class: `header-cell ${overflowRule}`, role: "columnheader",
|
|
799
|
+
// @ts-ignore
|
|
800
|
+
width: this.colWidths ? csvToArray(this.colWidths)[idx] : "" }, header));
|
|
801
|
+
})));
|
|
802
|
+
}
|
|
803
|
+
renderTableRows() {
|
|
804
|
+
return this.filteredRows.map((row) => {
|
|
805
|
+
const isSelected = this.includesCaseInsensitive(this.tagsList, row.id);
|
|
806
|
+
return (h("tr", { id: row.id, class: `${row.locked ? "locked" : ""} ${isSelected ? "selected" : ""}`, role: "row", onClick: () => this.handleTableRowClick(row.id) }, this.renderTableCells(row)));
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
renderTableCells(row) {
|
|
810
|
+
const colValues = [row.col1, row.col2, row.col3, row.col4].filter((val) => !!val);
|
|
811
|
+
const isSelected = this.includesCaseInsensitive(this.tagsList, row.id);
|
|
812
|
+
return colValues.map((val, idx) => {
|
|
813
|
+
const localId = `${row.id}-col${idx + 1}`;
|
|
814
|
+
let overflowRule = "wrap";
|
|
815
|
+
if (this.colWrap && csvToArray(this.colWrap)[idx]) {
|
|
816
|
+
overflowRule = csvToArray(this.colWrap)[idx];
|
|
817
|
+
}
|
|
818
|
+
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() },
|
|
819
|
+
val,
|
|
820
|
+
h("div", { class: "description", id: `${localId}-description` }, row.locked ? "locked" : "")));
|
|
821
|
+
});
|
|
822
|
+
}
|
|
563
823
|
render() {
|
|
564
|
-
const isFocused = this.focusedElement &&
|
|
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
824
|
return (h(Host, { id: this.uid },
|
|
570
825
|
h("div", { class: `wrapper label-${this.labelPosition}` },
|
|
571
826
|
h("div", { class: "label-wrapper" },
|
|
572
827
|
h("label", { class: "label", htmlFor: `input${this.uid}` }, this.label)),
|
|
573
|
-
h("div", { class: `field-wrapper ${
|
|
828
|
+
h("div", { class: `field-wrapper ${this.focusedElement ? "focused" : ""}`, ref: (el) => (this.fieldWrapperEl = el) },
|
|
574
829
|
h("div", { class: "upper-row" },
|
|
575
830
|
h("div", { class: "tags-and-input-wrapper" },
|
|
576
831
|
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) => {
|
|
577
832
|
this.clearTagFocus();
|
|
578
833
|
this.handleBlur(ev, this.el);
|
|
579
834
|
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags()),
|
|
580
|
-
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":
|
|
835
|
+
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) => {
|
|
581
836
|
this.handleBlur(ev, this.el);
|
|
582
|
-
}, onFocus: () =>
|
|
583
|
-
|
|
584
|
-
this.clearListItemFocus();
|
|
585
|
-
}, onKeyDown: (ev) => this.handleInputKeyDown(ev) })),
|
|
586
|
-
h("div", { class: "character-count" },
|
|
837
|
+
}, onFocus: () => this.handleInputFocus(), onKeyDown: (ev) => this.handleInputKeyDown(ev) })),
|
|
838
|
+
this.tagInputType === "dropdown" && (h("div", { class: "character-count" },
|
|
587
839
|
this.charCount,
|
|
588
840
|
"/",
|
|
589
|
-
this.characterLimit)),
|
|
841
|
+
this.characterLimit))),
|
|
590
842
|
this.renderTagCounter(),
|
|
591
|
-
|
|
592
|
-
h("div", { id: "help-text", class: "help-text" }, this.renderHelpText()),
|
|
593
|
-
h("ul", { class: "dropdown", id: "dropdown", role: "listbox", "aria-multiselectable": "true", "aria-expanded": this.isExpanded ? "true" : false, "aria-label": this.label, tabindex: -1 },
|
|
594
|
-
this.inputEl && this.renderAddNewButton(),
|
|
595
|
-
this.renderListItems(this.optionsList)))),
|
|
843
|
+
this.tagInputType === "dropdown" && this.renderDropdown()),
|
|
596
844
|
this.info ? (h("div", { id: "info", class: "info-text" }, this.info)) : (""),
|
|
597
|
-
h("div", { class: "sr-only", "aria-live": "assertive", ref: (el) => (this.liveRegionEl = el), "aria-atomic": "true" }, this.liveRegionMessage)
|
|
845
|
+
h("div", { class: "sr-only", "aria-live": "assertive", ref: (el) => (this.liveRegionEl = el), "aria-atomic": "true" }, this.liveRegionMessage),
|
|
846
|
+
this.tagInputType === "table" && this.renderTable())));
|
|
598
847
|
}
|
|
599
848
|
static get is() { return "wm-tag-input"; }
|
|
600
849
|
static get encapsulation() { return "shadow"; }
|
|
@@ -762,11 +1011,81 @@ export class TagInput {
|
|
|
762
1011
|
},
|
|
763
1012
|
"attribute": "max-tags",
|
|
764
1013
|
"reflect": false
|
|
1014
|
+
},
|
|
1015
|
+
"tagInputType": {
|
|
1016
|
+
"type": "string",
|
|
1017
|
+
"mutable": false,
|
|
1018
|
+
"complexType": {
|
|
1019
|
+
"original": "\"dropdown\" | \"table\"",
|
|
1020
|
+
"resolved": "\"dropdown\" | \"table\"",
|
|
1021
|
+
"references": {}
|
|
1022
|
+
},
|
|
1023
|
+
"required": false,
|
|
1024
|
+
"optional": false,
|
|
1025
|
+
"docs": {
|
|
1026
|
+
"tags": [],
|
|
1027
|
+
"text": ""
|
|
1028
|
+
},
|
|
1029
|
+
"attribute": "tag-input-type",
|
|
1030
|
+
"reflect": false,
|
|
1031
|
+
"defaultValue": "\"dropdown\""
|
|
1032
|
+
},
|
|
1033
|
+
"colHeaders": {
|
|
1034
|
+
"type": "string",
|
|
1035
|
+
"mutable": false,
|
|
1036
|
+
"complexType": {
|
|
1037
|
+
"original": "string",
|
|
1038
|
+
"resolved": "string",
|
|
1039
|
+
"references": {}
|
|
1040
|
+
},
|
|
1041
|
+
"required": true,
|
|
1042
|
+
"optional": false,
|
|
1043
|
+
"docs": {
|
|
1044
|
+
"tags": [],
|
|
1045
|
+
"text": ""
|
|
1046
|
+
},
|
|
1047
|
+
"attribute": "col-headers",
|
|
1048
|
+
"reflect": false
|
|
1049
|
+
},
|
|
1050
|
+
"colWidths": {
|
|
1051
|
+
"type": "string",
|
|
1052
|
+
"mutable": false,
|
|
1053
|
+
"complexType": {
|
|
1054
|
+
"original": "string",
|
|
1055
|
+
"resolved": "string | undefined",
|
|
1056
|
+
"references": {}
|
|
1057
|
+
},
|
|
1058
|
+
"required": false,
|
|
1059
|
+
"optional": true,
|
|
1060
|
+
"docs": {
|
|
1061
|
+
"tags": [],
|
|
1062
|
+
"text": ""
|
|
1063
|
+
},
|
|
1064
|
+
"attribute": "col-widths",
|
|
1065
|
+
"reflect": false
|
|
1066
|
+
},
|
|
1067
|
+
"colWrap": {
|
|
1068
|
+
"type": "string",
|
|
1069
|
+
"mutable": false,
|
|
1070
|
+
"complexType": {
|
|
1071
|
+
"original": "string",
|
|
1072
|
+
"resolved": "string | undefined",
|
|
1073
|
+
"references": {}
|
|
1074
|
+
},
|
|
1075
|
+
"required": false,
|
|
1076
|
+
"optional": true,
|
|
1077
|
+
"docs": {
|
|
1078
|
+
"tags": [],
|
|
1079
|
+
"text": ""
|
|
1080
|
+
},
|
|
1081
|
+
"attribute": "col-wrap",
|
|
1082
|
+
"reflect": false
|
|
765
1083
|
}
|
|
766
1084
|
}; }
|
|
767
1085
|
static get states() { return {
|
|
768
1086
|
"focusedListItem": {},
|
|
769
1087
|
"focusedTag": {},
|
|
1088
|
+
"tablePosition": {},
|
|
770
1089
|
"isExpanded": {},
|
|
771
1090
|
"tagsList": {},
|
|
772
1091
|
"optionsList": {},
|
|
@@ -795,11 +1114,23 @@ export class TagInput {
|
|
|
795
1114
|
"methodName": "reflectSelectedTags"
|
|
796
1115
|
}]; }
|
|
797
1116
|
static get listeners() { return [{
|
|
1117
|
+
"name": "wmTagInputRowUpdated",
|
|
1118
|
+
"method": "handleRowUpdate",
|
|
1119
|
+
"target": undefined,
|
|
1120
|
+
"capture": false,
|
|
1121
|
+
"passive": false
|
|
1122
|
+
}, {
|
|
798
1123
|
"name": "click",
|
|
799
1124
|
"method": "closeIfNotElOrChild",
|
|
800
1125
|
"target": "document",
|
|
801
1126
|
"capture": false,
|
|
802
1127
|
"passive": false
|
|
1128
|
+
}, {
|
|
1129
|
+
"name": "scroll",
|
|
1130
|
+
"method": "dismissTooltip",
|
|
1131
|
+
"target": "window",
|
|
1132
|
+
"capture": true,
|
|
1133
|
+
"passive": true
|
|
803
1134
|
}, {
|
|
804
1135
|
"name": "resize",
|
|
805
1136
|
"method": "handleResize",
|