@watermarkinsights/ripple 5.32.0-alpha.9 → 5.32.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/{app-globals-b72b9127.js → app-globals-5a9e2484.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/ripple.cjs.js +1 -1
- 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-option_2.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-input.cjs.entry.js +46 -22
- package/dist/cjs/wm-uploader.cjs.entry.js +1 -1
- package/dist/collection/components/selects/wm-select/wm-select.js +1 -1
- package/dist/collection/components/wm-action-menu/wm-action-menu.css +1 -1
- package/dist/collection/components/wm-button/wm-button.css +1 -1
- package/dist/collection/components/wm-tag-input/wm-tag-input.js +47 -23
- package/dist/collection/components/wm-uploader/wm-uploader.css +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/esm/{app-globals-11e2d8e5.js → app-globals-e9a97ede.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/ripple.js +1 -1
- package/dist/esm/wm-action-menu_2.entry.js +1 -1
- package/dist/esm/wm-button.entry.js +1 -1
- package/dist/esm/wm-option_2.entry.js +1 -1
- package/dist/esm/wm-tag-input.entry.js +47 -23
- package/dist/esm/wm-uploader.entry.js +1 -1
- package/dist/ripple/{p-54ff1220.entry.js → p-5c2fc42a.entry.js} +1 -1
- package/dist/ripple/p-7799953c.entry.js +1 -0
- package/dist/ripple/p-87ef0cfa.entry.js +1 -0
- package/dist/ripple/p-d7a1be0b.entry.js +1 -0
- package/dist/ripple/p-f6f92d2a.js +1 -0
- package/dist/ripple/p-fc843bb8.entry.js +1 -0
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/types/components/wm-tag-input/wm-tag-input.d.ts +5 -2
- package/package.json +2 -2
- package/dist/ripple/p-27b90777.entry.js +0 -1
- package/dist/ripple/p-2e78fa0f.entry.js +0 -1
- package/dist/ripple/p-a82ad01f.entry.js +0 -1
- package/dist/ripple/p-d43d7f88.js +0 -1
- package/dist/ripple/p-ea02567a.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
|
-
import { csvToArray, debounce, hideTooltip, intl, measureText, shouldOpenUp, showTooltip, truncateText, findPrev, findNext, } from "../../global/functions";
|
|
2
|
+
import { csvToArray, debounce, generateId, hideTooltip, intl, measureText, shouldOpenUp, showTooltip, truncateText, findPrev, findNext, } from "../../global/functions";
|
|
3
3
|
import { globalMessages } from "../../global/intl";
|
|
4
4
|
/**
|
|
5
5
|
* Input for selecting or creating a list of tags. Two variants: `'dropdown'` (options in a
|
|
@@ -216,6 +216,14 @@ export class TagInput {
|
|
|
216
216
|
});
|
|
217
217
|
return list;
|
|
218
218
|
}
|
|
219
|
+
// internal representations (dropdown li or table tr) of the options matching the user query.
|
|
220
|
+
// An option has no such element until the render that follows its insertion, so the list can be
|
|
221
|
+
// shorter than filteredOptionEls.
|
|
222
|
+
get filteredOptionRowEls() {
|
|
223
|
+
return this.filteredOptionEls
|
|
224
|
+
.map((o) => this.elFromTagOption(o))
|
|
225
|
+
.filter((el) => !!el);
|
|
226
|
+
}
|
|
219
227
|
// the ones that should be rendered as tags
|
|
220
228
|
get taggedOptions() {
|
|
221
229
|
return this.optionEls.filter((o) => o.selected || o.locked);
|
|
@@ -229,18 +237,23 @@ export class TagInput {
|
|
|
229
237
|
return this._tagEls[this.focusedTagIndex];
|
|
230
238
|
}
|
|
231
239
|
}
|
|
240
|
+
// an empty id would make querySelector throw on the "#" selector
|
|
241
|
+
optionById(id) {
|
|
242
|
+
return id ? this.el.querySelector("#" + id) : undefined;
|
|
243
|
+
}
|
|
232
244
|
// get the wm-tag-option, given the internal representation (dropdown li or table tr)
|
|
233
245
|
tagOptionFromEl(el) {
|
|
234
|
-
return el.id === "add-new-btn" ? undefined : this.
|
|
246
|
+
return el.id === "add-new-btn" ? undefined : this.optionById(el.id);
|
|
235
247
|
}
|
|
236
248
|
// get the wm-tag-option, given the internal representation of a tag
|
|
237
249
|
tagOptionFromTag(el) {
|
|
238
|
-
|
|
239
|
-
return this.el.querySelector("#" + id);
|
|
250
|
+
return this.optionById(el.id.replace("tag-", ""));
|
|
240
251
|
}
|
|
241
252
|
// get the internal representation of a wm-tag-option
|
|
242
253
|
elFromTagOption(el) {
|
|
243
|
-
return
|
|
254
|
+
return el.id
|
|
255
|
+
? this.el.shadowRoot.querySelector("#" + el.id)
|
|
256
|
+
: undefined;
|
|
244
257
|
}
|
|
245
258
|
// focusedOption state refers to the wm-tag-option. This gets the corresponding element in the shadow DOM, or the "Add New" button.
|
|
246
259
|
get _focusedOption() {
|
|
@@ -329,7 +342,18 @@ export class TagInput {
|
|
|
329
342
|
isElOrChild(el) {
|
|
330
343
|
return el === this.el || this.el.shadowRoot.contains(el) || this.el.contains(el);
|
|
331
344
|
}
|
|
345
|
+
// Rows and tags are rendered with the id of their wm-tag-option, and that id is the only link
|
|
346
|
+
// back from a row or a tag to its option. wm-tag-option assigns its own id when it loads, which
|
|
347
|
+
// happens after this component renders, so any missing id is assigned here instead.
|
|
348
|
+
assignOptionIds() {
|
|
349
|
+
this.optionEls.forEach((o) => {
|
|
350
|
+
if (!o.id) {
|
|
351
|
+
o.id = generateId();
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
}
|
|
332
355
|
componentWillLoad() {
|
|
356
|
+
this.assignOptionIds();
|
|
333
357
|
if (!this.placeholder) {
|
|
334
358
|
this.placeholder = this.createPlaceholderDefault(this.addNew, this.optionEls.length > 0);
|
|
335
359
|
}
|
|
@@ -361,7 +385,6 @@ export class TagInput {
|
|
|
361
385
|
this.tagsList = [...lockedTags, ...regularTags];
|
|
362
386
|
}
|
|
363
387
|
componentDidLoad() {
|
|
364
|
-
this.handleLayoutChange();
|
|
365
388
|
// Set up observer to announce changes in selected tags, or removed user-added tags
|
|
366
389
|
const observerAnnouncer = new MutationObserver((optionListMutations) => optionListMutations.forEach((mutationRecord) => this.handleChangeAnnouncement(mutationRecord)));
|
|
367
390
|
observerAnnouncer.observe(this.el, {
|
|
@@ -412,6 +435,7 @@ export class TagInput {
|
|
|
412
435
|
handleOptionListChange(record) {
|
|
413
436
|
const addedNodes = Array.from(record.addedNodes);
|
|
414
437
|
if (addedNodes.length > 0) {
|
|
438
|
+
this.assignOptionIds();
|
|
415
439
|
addedNodes.forEach((n) => !this.tagsList.includes(n) && this.tagsList.push(n));
|
|
416
440
|
}
|
|
417
441
|
const removedNodes = Array.from(record.removedNodes);
|
|
@@ -467,8 +491,7 @@ export class TagInput {
|
|
|
467
491
|
const leftBound = textEl.getBoundingClientRect().left;
|
|
468
492
|
// the numbers represent spacing values for padding, margin, and delete icon
|
|
469
493
|
const rightBound = wrapper.getBoundingClientRect().right - 10 - 8 - 28;
|
|
470
|
-
const
|
|
471
|
-
const optionEl = id && this.el.querySelector("#" + id);
|
|
494
|
+
const optionEl = this.tagOptionFromTag(tag);
|
|
472
495
|
if (optionEl) {
|
|
473
496
|
// tag text for table variant is first column text
|
|
474
497
|
textEl.textContent = truncateText(textEl, this.getTagName(optionEl), rightBound - leftBound, 5);
|
|
@@ -520,12 +543,15 @@ export class TagInput {
|
|
|
520
543
|
this.resetInput();
|
|
521
544
|
let option;
|
|
522
545
|
if (this.isTable) {
|
|
523
|
-
|
|
524
|
-
option = this.tagOptionFromEl(
|
|
546
|
+
const target = ev.target;
|
|
547
|
+
option = this.tagOptionFromEl(target.closest("tr"));
|
|
525
548
|
}
|
|
526
549
|
else {
|
|
527
550
|
option = this.tagOptionFromEl(ev.target);
|
|
528
551
|
}
|
|
552
|
+
if (!option) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
529
555
|
// if someone wants to attach a click event listener on wm-tag-option
|
|
530
556
|
option.click();
|
|
531
557
|
if (option.locked) {
|
|
@@ -646,15 +672,13 @@ export class TagInput {
|
|
|
646
672
|
if (this.addNewButton && this.addNewButton.id === "add-new-btn") {
|
|
647
673
|
items.push(this.addNewButton);
|
|
648
674
|
}
|
|
649
|
-
this.
|
|
650
|
-
items.push(this.elFromTagOption(o));
|
|
651
|
-
});
|
|
675
|
+
items.push(...this.filteredOptionRowEls);
|
|
652
676
|
const next = findNext(items, this._focusedOption, true);
|
|
653
677
|
this.focusOption(next);
|
|
654
678
|
}
|
|
655
679
|
}
|
|
656
680
|
else {
|
|
657
|
-
const items = this.
|
|
681
|
+
const items = this.filteredOptionRowEls;
|
|
658
682
|
const next = findNext(items, this._focusedOption, true);
|
|
659
683
|
this.focusOption(next);
|
|
660
684
|
}
|
|
@@ -669,15 +693,13 @@ export class TagInput {
|
|
|
669
693
|
if (this.addNewButton) {
|
|
670
694
|
items.push(this.addNewButton);
|
|
671
695
|
}
|
|
672
|
-
this.
|
|
673
|
-
items.push(this.elFromTagOption(o));
|
|
674
|
-
});
|
|
696
|
+
items.push(...this.filteredOptionRowEls);
|
|
675
697
|
const prev = findPrev(items, this._focusedOption, true);
|
|
676
698
|
this.focusOption(prev);
|
|
677
699
|
}
|
|
678
700
|
}
|
|
679
701
|
else {
|
|
680
|
-
const items = this.
|
|
702
|
+
const items = this.filteredOptionRowEls;
|
|
681
703
|
const prev = findPrev(items, this._focusedOption, true);
|
|
682
704
|
this.focusOption(prev);
|
|
683
705
|
}
|
|
@@ -715,6 +737,9 @@ export class TagInput {
|
|
|
715
737
|
case "Delete":
|
|
716
738
|
if (this.focusedTag) {
|
|
717
739
|
const option = this.tagOptionFromTag(this.focusedTag);
|
|
740
|
+
if (!option) {
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
718
743
|
if (option.locked) {
|
|
719
744
|
this.announce(this.tagLockedMessage(this.getTagName(option)));
|
|
720
745
|
}
|
|
@@ -855,9 +880,8 @@ export class TagInput {
|
|
|
855
880
|
}
|
|
856
881
|
showTooltipIfTruncated(el) {
|
|
857
882
|
const displayedText = el.querySelector(".tag-text").textContent;
|
|
858
|
-
const
|
|
859
|
-
if (
|
|
860
|
-
const tagEl = this.el.querySelector("#" + id);
|
|
883
|
+
const tagEl = this.tagOptionFromTag(el);
|
|
884
|
+
if (tagEl) {
|
|
861
885
|
const fullText = this.getTagName(tagEl);
|
|
862
886
|
if (displayedText !== fullText && displayedText.includes("...")) {
|
|
863
887
|
showTooltip("bottom", el, fullText);
|
|
@@ -1051,10 +1075,10 @@ export class TagInput {
|
|
|
1051
1075
|
}
|
|
1052
1076
|
}
|
|
1053
1077
|
render() {
|
|
1054
|
-
return (h("div", { key: '
|
|
1078
|
+
return (h("div", { key: '3320626934db9d58503b2964530e0bac1126775e', class: `wrapper label-${this.labelPosition} ${this.errorMessage ? "invalid" : ""}` }, h("div", { key: '9342d3b7db294e8c6c791bb0b4debfa537ab4029', class: "label-wrapper" }, h("label", { key: '48f8454c94c26ee09d69221d5985d9bc6d14ad90', class: "label", htmlFor: "input", onMouseEnter: (ev) => this.handleLabelMouseEnter(ev), onMouseLeave: () => hideTooltip() }, this.label), this.labelPosition !== "none" && this.requiredField && (h("div", { key: '533458abd912ff8608419c53560baf6ff3e8ecb2', class: "required", "aria-hidden": "true" }, "*"))), h("div", { key: '8581fb8e727570200a2a024db5b3c767d79fb433', class: `field-wrapper ${this.el.shadowRoot.activeElement === this.inputEl ? "focused" : ""} ${this.errorMessage ? "invalid" : ""}`, ref: (el) => (this.fieldWrapperEl = el) }, h("div", { key: 'dc8aa608d413c1ccf2ce686d78ac14944f200421', class: "upper-row" }, h("div", { key: '8c076d96f42b6ce47d6ca49068fae2e51bbba705', class: "svg-icon svg-search" }), h("div", { key: '7dba4a97ab9435c4cd2f930e91922247349f0269', class: `tags-and-input-wrapper` }, h("ul", { key: '96f539b009fdc8cf9b267b8b7d9f9d110c00a24b', ref: (el) => (this.tagAreaEl = el), class: `tag-area ${this.taggedOptions.length === 0 && "empty"} ${this.isKeying ? "user-is-keying" : ""}`, role: "listbox", "aria-activedescendant": this.focusedTag ? this.focusedTag.id : null, "aria-orientation": "horizontal", "aria-labelledby": "sr-instructions", tabindex: this._tagEls.length > 0 ? 0 : -1, "aria-describedby": `info max-tags`, onFocus: (ev) => this.handleTagAreaFocus(ev), onBlur: (ev) => {
|
|
1055
1079
|
this.focusedTagIndex = undefined;
|
|
1056
1080
|
this.handleBlur(ev);
|
|
1057
|
-
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags()), h("div", { key: '
|
|
1081
|
+
}, onKeyDown: (ev) => this.handleTagAreaKeyDown(ev) }, this.renderTags()), h("div", { key: '85c5677a7c97baf49906f90d0a2e20af3853b3d7', class: "sr-only", id: "sr-instructions" }, this.label, ". ", this.tagAreaInstructions), this.isDropdown && this.renderDropdownInput(), this.isTable && this.renderTableInput()), this.isDropdown && (h("div", { key: 'a60ae5ab37b6a973127ef0dbc73fdd25defa2b00', class: "character-count" }, this.charCount, "/", this.characterLimit))), this.renderTagCounter(), this.isDropdown && this.renderDropdown()), this.info && (h("div", { key: 'f66a9b7ab8687707e271dc606c54486e799a2dcc', id: "info", class: "info-text" }, this.info)), h("div", { key: '0e644fd0b06345ff5bb459e2dc46f7f6601bc92d', id: "error" }, this.errorMessage), h("div", { key: '94bea1eb5b48bd5a669d0f8a4ae98cc1ddde7692', class: "sr-only", "aria-live": "polite", ref: (el) => (this.liveRegionEl = el), "aria-atomic": "true" }, this.liveRegionMessage), this.isTable && this.renderTable()));
|
|
1058
1082
|
}
|
|
1059
1083
|
static get is() { return "wm-tag-input"; }
|
|
1060
1084
|
static get encapsulation() { return "shadow"; }
|
package/dist/docs/docs.json
CHANGED
package/dist/esm/loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { b as bootstrapLazy } from './index-3425d80d.js';
|
|
2
2
|
export { s as setNonce } from './index-3425d80d.js';
|
|
3
|
-
import { g as globalScripts } from './app-globals-
|
|
3
|
+
import { g as globalScripts } from './app-globals-e9a97ede.js';
|
|
4
4
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
package/dist/esm/ripple.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { p as promiseResolve, b as bootstrapLazy } from './index-3425d80d.js';
|
|
2
2
|
export { s as setNonce } from './index-3425d80d.js';
|
|
3
|
-
import { g as globalScripts } from './app-globals-
|
|
3
|
+
import { g as globalScripts } from './app-globals-e9a97ede.js';
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
Stencil Client Patch Browser v4.21.0 | MIT Licensed | https://stenciljs.com
|