@dso-toolkit/core 69.0.0 → 69.1.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/dso-alert_6.cjs.entry.js +14 -1
- package/dist/cjs/dso-alert_6.cjs.entry.js.map +1 -1
- package/dist/cjs/dso-autosuggest.cjs.entry.js +149 -20
- package/dist/cjs/dso-autosuggest.cjs.entry.js.map +1 -1
- package/dist/cjs/dso-pagination.cjs.entry.js +39 -26
- package/dist/cjs/dso-pagination.cjs.entry.js.map +1 -1
- package/dist/cjs/dso-scrollable.cjs.entry.js +5 -2
- package/dist/cjs/dso-scrollable.cjs.entry.js.map +1 -1
- package/dist/cjs/dso-toolkit.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/autosuggest/autosuggest.css +23 -11
- package/dist/collection/components/autosuggest/autosuggest.interfaces.js.map +1 -1
- package/dist/collection/components/autosuggest/autosuggest.js +158 -23
- package/dist/collection/components/autosuggest/autosuggest.js.map +1 -1
- package/dist/collection/components/ozon-content/nodes/abbr.node.js +11 -0
- package/dist/collection/components/ozon-content/nodes/abbr.node.js.map +1 -0
- package/dist/collection/components/ozon-content/ozon-content-mapper.js +2 -0
- package/dist/collection/components/ozon-content/ozon-content-mapper.js.map +1 -1
- package/dist/collection/components/ozon-content/ozon-content.css +4 -0
- package/dist/collection/components/pagination/pagination.js +39 -26
- package/dist/collection/components/pagination/pagination.js.map +1 -1
- package/dist/collection/components/scrollable/scrollable.js +5 -2
- package/dist/collection/components/scrollable/scrollable.js.map +1 -1
- package/dist/components/dso-autosuggest.js +150 -20
- package/dist/components/dso-autosuggest.js.map +1 -1
- package/dist/components/dso-pagination.js +39 -26
- package/dist/components/dso-pagination.js.map +1 -1
- package/dist/components/ozon-content.js +14 -1
- package/dist/components/ozon-content.js.map +1 -1
- package/dist/components/scrollable.js +5 -2
- package/dist/components/scrollable.js.map +1 -1
- package/dist/dso-toolkit/dso-toolkit.esm.js +1 -1
- package/dist/dso-toolkit/dso-toolkit.esm.js.map +1 -1
- package/dist/dso-toolkit/p-3efc1929.entry.js +2 -0
- package/dist/dso-toolkit/p-3efc1929.entry.js.map +1 -0
- package/dist/dso-toolkit/p-7949fc70.entry.js +2 -0
- package/dist/dso-toolkit/p-7949fc70.entry.js.map +1 -0
- package/dist/dso-toolkit/p-e26460b5.entry.js +2 -0
- package/dist/dso-toolkit/p-e26460b5.entry.js.map +1 -0
- package/dist/dso-toolkit/p-eeca54c6.entry.js +2 -0
- package/dist/dso-toolkit/p-eeca54c6.entry.js.map +1 -0
- package/dist/esm/dso-alert_6.entry.js +14 -1
- package/dist/esm/dso-alert_6.entry.js.map +1 -1
- package/dist/esm/dso-autosuggest.entry.js +149 -20
- package/dist/esm/dso-autosuggest.entry.js.map +1 -1
- package/dist/esm/dso-pagination.entry.js +39 -26
- package/dist/esm/dso-pagination.entry.js.map +1 -1
- package/dist/esm/dso-scrollable.entry.js +5 -2
- package/dist/esm/dso-scrollable.entry.js.map +1 -1
- package/dist/esm/dso-toolkit.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/autosuggest/autosuggest.d.ts +18 -7
- package/dist/types/components/autosuggest/autosuggest.interfaces.d.ts +10 -0
- package/dist/types/components/ozon-content/nodes/abbr.node.d.ts +6 -0
- package/dist/types/components/pagination/pagination.d.ts +2 -0
- package/dist/types/components.d.ts +6 -6
- package/package.json +3 -3
- package/dist/dso-toolkit/p-135bf595.entry.js +0 -2
- package/dist/dso-toolkit/p-135bf595.entry.js.map +0 -1
- package/dist/dso-toolkit/p-beaa587d.entry.js +0 -2
- package/dist/dso-toolkit/p-beaa587d.entry.js.map +0 -1
- package/dist/dso-toolkit/p-da7f089a.entry.js +0 -2
- package/dist/dso-toolkit/p-da7f089a.entry.js.map +0 -1
- package/dist/dso-toolkit/p-fd989862.entry.js +0 -2
- package/dist/dso-toolkit/p-fd989862.entry.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, h } from "@stencil/core";
|
|
1
|
+
import { Fragment, h, } from "@stencil/core";
|
|
2
2
|
import debounce from "debounce";
|
|
3
3
|
import escapeStringRegexp from "escape-string-regexp";
|
|
4
4
|
import { v4 } from "uuid";
|
|
@@ -7,14 +7,35 @@ import { translations } from "./autosuggest.i18n";
|
|
|
7
7
|
const maxSuggestionsViewable = 10;
|
|
8
8
|
const listboxPaddingBlock = 8;
|
|
9
9
|
const listboxBorderWidth = 1;
|
|
10
|
+
const Option = ({ id, mouseEnter, mouseLeave, click, selected, suggestion, ref, markedSuggestion }) => (h("div", { class: "option", role: "option", id: id, onMouseEnter: mouseEnter, onMouseLeave: mouseLeave, onClick: click, "aria-selected": selected, "aria-label": suggestion.value, ref: ref }, h("div", { class: "suggestion-row" }, h("span", { class: "value" }, markedSuggestion.value), markedSuggestion.type ? h("span", { class: "type" }, markedSuggestion.type) : undefined), markedSuggestion.extras &&
|
|
11
|
+
markedSuggestion.extras.map((markedChunk) => (h("div", { class: "suggestion-row" }, markedChunk.map((extra) => (h("span", { class: "extra" }, extra))))))));
|
|
12
|
+
function isGrouped(suggestions) {
|
|
13
|
+
return (!!suggestions &&
|
|
14
|
+
suggestions.length > 0 &&
|
|
15
|
+
suggestions.every((suggestion) => suggestion !== undefined &&
|
|
16
|
+
"groupLabel" in suggestion &&
|
|
17
|
+
suggestion.groupLabel !== undefined &&
|
|
18
|
+
"suggestions" in suggestion &&
|
|
19
|
+
suggestion.suggestions.length > 0));
|
|
20
|
+
}
|
|
21
|
+
function isFlat(suggestions) {
|
|
22
|
+
return (!!suggestions &&
|
|
23
|
+
suggestions.length > 0 &&
|
|
24
|
+
suggestions.every((suggestion) => suggestion !== undefined && "value" in suggestion && suggestion.value !== undefined));
|
|
25
|
+
}
|
|
10
26
|
export class Autosuggest {
|
|
11
27
|
constructor() {
|
|
12
28
|
/**
|
|
13
|
-
* The suggestions for the value of the slotted input element.
|
|
14
|
-
*
|
|
29
|
+
* The suggestions for the value of the slotted input element.
|
|
30
|
+
*
|
|
31
|
+
* This can be an array of type Suggestion or an Array of type SuggestionGroup.
|
|
32
|
+
*
|
|
33
|
+
* A suggestionGroup must have a `groupLabel` and `suggestions`.
|
|
15
34
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
35
|
+
* A suggestion must have a `value` and can have a `type`, an `item` or `extras`.
|
|
36
|
+
*
|
|
37
|
+
* The `type` is used to style the suggestion. `item` can be use to reference the original object that was used to
|
|
38
|
+
* create the suggestion. `extras` is an array of additional strings to further specify the suggestion.
|
|
18
39
|
*
|
|
19
40
|
* The value should be null when no suggestions have been fetched.
|
|
20
41
|
*/
|
|
@@ -235,22 +256,38 @@ export class Autosuggest {
|
|
|
235
256
|
return item;
|
|
236
257
|
});
|
|
237
258
|
}
|
|
238
|
-
selectSuggestion(suggestion) {
|
|
259
|
+
selectSuggestion(suggestion, group) {
|
|
239
260
|
this.selectedSuggestion = suggestion;
|
|
261
|
+
this.selectedSuggestionGroup = group;
|
|
240
262
|
this.setAriaActiveDescendant();
|
|
241
263
|
}
|
|
242
264
|
selectFirstSuggestion() {
|
|
243
265
|
if (!this.suggestions) {
|
|
244
266
|
return;
|
|
245
267
|
}
|
|
246
|
-
this.
|
|
268
|
+
if (isGrouped(this.suggestions) && this.selectedSuggestionGroup) {
|
|
269
|
+
this.selectedSuggestion = this.selectedSuggestionGroup.suggestions[0];
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
if (isFlat(this.suggestions)) {
|
|
273
|
+
this.selectedSuggestion = this.suggestions[0];
|
|
274
|
+
}
|
|
275
|
+
}
|
|
247
276
|
this.setAriaActiveDescendant(true);
|
|
248
277
|
}
|
|
249
278
|
selectLastSuggestion() {
|
|
250
279
|
if (!this.suggestions) {
|
|
251
280
|
return;
|
|
252
281
|
}
|
|
253
|
-
this.
|
|
282
|
+
if (isGrouped(this.suggestions) && this.selectedSuggestionGroup) {
|
|
283
|
+
this.selectedSuggestion =
|
|
284
|
+
this.selectedSuggestionGroup.suggestions[this.selectedSuggestionGroup.suggestions.length - 1];
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
if (isFlat(this.suggestions)) {
|
|
288
|
+
this.selectedSuggestion = this.suggestions[this.suggestions.length - 1];
|
|
289
|
+
}
|
|
290
|
+
}
|
|
254
291
|
this.setAriaActiveDescendant(true);
|
|
255
292
|
}
|
|
256
293
|
selectNextSuggestion() {
|
|
@@ -258,23 +295,91 @@ export class Autosuggest {
|
|
|
258
295
|
if (!this.suggestions) {
|
|
259
296
|
return;
|
|
260
297
|
}
|
|
261
|
-
|
|
262
|
-
|
|
298
|
+
if (isGrouped(this.suggestions)) {
|
|
299
|
+
this.selectNextGroupedSuggestion();
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
const index = this.selectedSuggestion ? this.suggestions.indexOf(this.selectedSuggestion) : -1;
|
|
303
|
+
this.selectedSuggestion = (_a = this.suggestions[index + 1]) !== null && _a !== void 0 ? _a : this.suggestions[0];
|
|
304
|
+
}
|
|
263
305
|
this.setAriaActiveDescendant(true);
|
|
264
306
|
}
|
|
307
|
+
selectNextGroupedSuggestion() {
|
|
308
|
+
var _a;
|
|
309
|
+
if (!this.suggestions) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
if (this.selectedSuggestionGroup) {
|
|
313
|
+
const indexInGroup = this.selectedSuggestion
|
|
314
|
+
? this.selectedSuggestionGroup.suggestions.indexOf(this.selectedSuggestion)
|
|
315
|
+
: -1;
|
|
316
|
+
if (indexInGroup === this.selectedSuggestionGroup.suggestions.length - 1) {
|
|
317
|
+
// Move to first suggestion in next or first group
|
|
318
|
+
const groupIndex = this.suggestionGroups.indexOf(this.selectedSuggestionGroup);
|
|
319
|
+
this.selectedSuggestionGroup = (_a = this.suggestionGroups[groupIndex + 1]) !== null && _a !== void 0 ? _a : this.suggestionGroups[0];
|
|
320
|
+
this.selectedSuggestion = this.selectedSuggestionGroup.suggestions[0];
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
// Within this group
|
|
324
|
+
this.selectedSuggestion = this.selectedSuggestionGroup.suggestions[indexInGroup + 1];
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
this.selectedSuggestionGroup = this.suggestionGroups[0];
|
|
329
|
+
this.selectedSuggestion = this.selectedSuggestionGroup.suggestions[0];
|
|
330
|
+
}
|
|
331
|
+
}
|
|
265
332
|
selectPreviousSuggestion() {
|
|
266
333
|
var _a;
|
|
267
334
|
if (!this.suggestions) {
|
|
268
335
|
return;
|
|
269
336
|
}
|
|
270
|
-
|
|
271
|
-
|
|
337
|
+
if (isGrouped(this.suggestions)) {
|
|
338
|
+
this.selectPreviousGroupedSuggestion();
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
const index = this.selectedSuggestion ? this.suggestions.indexOf(this.selectedSuggestion) : 0;
|
|
342
|
+
this.selectedSuggestion = (_a = this.suggestions[index - 1]) !== null && _a !== void 0 ? _a : this.suggestions[this.suggestions.length - 1];
|
|
343
|
+
}
|
|
272
344
|
this.setAriaActiveDescendant(true);
|
|
273
345
|
}
|
|
346
|
+
selectPreviousGroupedSuggestion() {
|
|
347
|
+
var _a;
|
|
348
|
+
if (!this.suggestions) {
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
if (this.selectedSuggestionGroup) {
|
|
352
|
+
const indexInGroup = this.selectedSuggestion
|
|
353
|
+
? this.selectedSuggestionGroup.suggestions.indexOf(this.selectedSuggestion)
|
|
354
|
+
: -1;
|
|
355
|
+
if (indexInGroup === 0) {
|
|
356
|
+
// Move to last suggestion in previous or last group
|
|
357
|
+
const groupIndex = this.suggestionGroups.indexOf(this.selectedSuggestionGroup);
|
|
358
|
+
this.selectedSuggestionGroup =
|
|
359
|
+
(_a = this.suggestionGroups[groupIndex - 1]) !== null && _a !== void 0 ? _a : this.suggestionGroups[this.suggestions.length - 1];
|
|
360
|
+
this.selectedSuggestion =
|
|
361
|
+
this.selectedSuggestionGroup.suggestions[this.selectedSuggestionGroup.suggestions.length - 1];
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
// Within this group
|
|
365
|
+
this.selectedSuggestion = this.selectedSuggestionGroup.suggestions[indexInGroup - 1];
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
this.selectedSuggestionGroup = this.suggestionGroups[this.suggestions.length - 1];
|
|
370
|
+
this.selectedSuggestion =
|
|
371
|
+
this.selectedSuggestionGroup.suggestions[this.selectedSuggestionGroup.suggestions.length - 1];
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
get suggestionGroups() {
|
|
375
|
+
return isGrouped(this.suggestions) ? this.suggestions : [];
|
|
376
|
+
}
|
|
274
377
|
setAriaActiveDescendant(scroll = false) {
|
|
275
378
|
var _a, _b;
|
|
276
379
|
if (this.selectedSuggestion) {
|
|
277
|
-
const id = this.
|
|
380
|
+
const id = this.selectedSuggestionGroup
|
|
381
|
+
? this.listboxGroupedItemId(this.selectedSuggestionGroup, this.selectedSuggestion)
|
|
382
|
+
: this.listboxItemId(this.selectedSuggestion);
|
|
278
383
|
(_a = this.input) === null || _a === void 0 ? void 0 : _a.setAttribute("aria-activedescendant", id);
|
|
279
384
|
if (scroll) {
|
|
280
385
|
(_b = document.getElementById(id)) === null || _b === void 0 ? void 0 : _b.scrollIntoView({ block: "nearest" });
|
|
@@ -286,6 +391,7 @@ export class Autosuggest {
|
|
|
286
391
|
this.showLoading = !this.loadingDelayed;
|
|
287
392
|
this.notFound = false;
|
|
288
393
|
this.selectedSuggestion = undefined;
|
|
394
|
+
this.selectedSuggestionGroup = undefined;
|
|
289
395
|
(_a = this.input) === null || _a === void 0 ? void 0 : _a.setAttribute("aria-activedescendant", "");
|
|
290
396
|
}
|
|
291
397
|
openSuggestions(selectSuggestion) {
|
|
@@ -321,10 +427,16 @@ export class Autosuggest {
|
|
|
321
427
|
if (!this.suggestions) {
|
|
322
428
|
return "";
|
|
323
429
|
}
|
|
324
|
-
return `${this.inputId}-${this.suggestions.indexOf(suggestion) + 1}`;
|
|
430
|
+
return `${this.inputId}-${isFlat(this.suggestions) && this.suggestions.indexOf(suggestion) + 1}`;
|
|
431
|
+
}
|
|
432
|
+
listboxGroupedItemId(suggestionGroup, suggestion) {
|
|
433
|
+
if (!this.suggestions) {
|
|
434
|
+
return "";
|
|
435
|
+
}
|
|
436
|
+
return `${this.inputId}-${this.suggestionGroups.indexOf(suggestionGroup) + 1}-${suggestionGroup.suggestions.indexOf(suggestion) + 1}`;
|
|
325
437
|
}
|
|
326
|
-
|
|
327
|
-
|
|
438
|
+
getMarkedChunkedExtras(extras, suggestion) {
|
|
439
|
+
const chunkedExtras = extras.reduce((resultArray, extra, index) => {
|
|
328
440
|
var _a;
|
|
329
441
|
const chunkIndex = Math.floor(index / 2);
|
|
330
442
|
if (!resultArray[chunkIndex]) {
|
|
@@ -333,21 +445,38 @@ export class Autosuggest {
|
|
|
333
445
|
(_a = resultArray[chunkIndex]) === null || _a === void 0 ? void 0 : _a.push(extra);
|
|
334
446
|
return resultArray;
|
|
335
447
|
}, []);
|
|
448
|
+
return chunkedExtras.map((chunk, index) => chunk.map((c, i) => this.handleMark(suggestion, c, "extra", index * 2 + i)));
|
|
449
|
+
}
|
|
450
|
+
getMarkedSuggestions(suggestion) {
|
|
451
|
+
return {
|
|
452
|
+
value: this.handleMark(suggestion, suggestion.value, "value"),
|
|
453
|
+
type: suggestion.type ? this.handleMark(suggestion, suggestion.type, "type") : undefined,
|
|
454
|
+
extras: suggestion.extras ? this.getMarkedChunkedExtras(suggestion.extras, suggestion) : undefined,
|
|
455
|
+
};
|
|
336
456
|
}
|
|
337
457
|
render() {
|
|
338
458
|
this.listboxItems = [];
|
|
339
459
|
const showListbox = this.showSuggestions || this.notFound;
|
|
460
|
+
const grouped = isGrouped(this.suggestions);
|
|
461
|
+
const flat = isFlat(this.suggestions);
|
|
340
462
|
if (showListbox && this.input) {
|
|
341
463
|
this.input.setAttribute("aria-controls", this.listboxId);
|
|
342
464
|
}
|
|
343
465
|
else if (this.input) {
|
|
344
466
|
this.input.removeAttribute("aria-controls");
|
|
345
467
|
}
|
|
346
|
-
return (h(Fragment, null, h("slot", { key: '
|
|
468
|
+
return (h(Fragment, null, h("slot", { key: '557d829f9238c3fa9f6082beba78381472115ccd' }), this.loading && this.showLoading ? (h("div", { class: "autosuggest-progress-box" }, h("dso-progress-indicator", { label: this.loadingLabel }))) : (showListbox && (h("dso-scrollable", { class: "listbox-container", ref: (element) => (this.listboxContainer = element), style: { "--max-block-size": `${this.listboxContainerMaxBlockSize}px` } }, h("div", { class: "listbox", role: "listbox", "aria-live": "polite", id: this.listboxId, "aria-labelledby": this.labelId, ref: (element) => (this.listbox = element), tabindex: "0" }, (flat &&
|
|
469
|
+
this.showSuggestions &&
|
|
347
470
|
this.suggestions &&
|
|
348
|
-
this.suggestions.map((suggestion) => (h(
|
|
349
|
-
|
|
350
|
-
|
|
471
|
+
this.suggestions.map((suggestion) => (h(Option, { id: this.listboxItemId(suggestion), mouseEnter: () => this.selectSuggestion(suggestion), mouseLeave: () => this.resetSelectedSuggestion(), click: () => this.pickSelectedValue(), selected: (suggestion === this.selectedSuggestion).toString(), suggestion: suggestion, ref: (element) => element && this.listboxItems.push(element), markedSuggestion: this.getMarkedSuggestions(suggestion) })))) ||
|
|
472
|
+
(grouped &&
|
|
473
|
+
this.showSuggestions &&
|
|
474
|
+
this.suggestions &&
|
|
475
|
+
this.suggestions.map((suggestionGroup) => {
|
|
476
|
+
const groupLabelId = v4();
|
|
477
|
+
return (h("div", { role: "group", class: "group", "aria-labelledby": groupLabelId }, h("div", { class: "group-label", role: "presentation", id: groupLabelId }, suggestionGroup.groupLabel), suggestionGroup.suggestions.map((suggestion) => (h(Option, { id: this.listboxGroupedItemId(suggestionGroup, suggestion), mouseEnter: () => this.selectSuggestion(suggestion, suggestionGroup), mouseLeave: () => this.resetSelectedSuggestion(), click: () => this.pickSelectedValue(), selected: (suggestion === this.selectedSuggestion).toString(), suggestion: suggestion, ref: (element) => element && this.listboxItems.push(element), markedSuggestion: this.getMarkedSuggestions(suggestion) })))));
|
|
478
|
+
})) ||
|
|
479
|
+
(this.notFound && (h("div", { class: "option" }, h("span", { class: "value" }, this.notFoundLabel ||
|
|
351
480
|
this.showInputValueNotFound(this.text("notFound", { inputValue: this.inputValue }))))))))))));
|
|
352
481
|
}
|
|
353
482
|
static get is() { return "dso-autosuggest"; }
|
|
@@ -368,13 +497,18 @@ export class Autosuggest {
|
|
|
368
497
|
"type": "unknown",
|
|
369
498
|
"mutable": false,
|
|
370
499
|
"complexType": {
|
|
371
|
-
"original": "Suggestion[] | null",
|
|
372
|
-
"resolved": "Suggestion[] | null",
|
|
500
|
+
"original": "Suggestion[] | SuggestionGroup[] | null",
|
|
501
|
+
"resolved": "SuggestionGroup[] | Suggestion[] | null",
|
|
373
502
|
"references": {
|
|
374
503
|
"Suggestion": {
|
|
375
504
|
"location": "import",
|
|
376
505
|
"path": "./autosuggest.interfaces",
|
|
377
506
|
"id": "src/components/autosuggest/autosuggest.interfaces.ts::Suggestion"
|
|
507
|
+
},
|
|
508
|
+
"SuggestionGroup": {
|
|
509
|
+
"location": "import",
|
|
510
|
+
"path": "./autosuggest.interfaces",
|
|
511
|
+
"id": "src/components/autosuggest/autosuggest.interfaces.ts::SuggestionGroup"
|
|
378
512
|
}
|
|
379
513
|
}
|
|
380
514
|
},
|
|
@@ -382,7 +516,7 @@ export class Autosuggest {
|
|
|
382
516
|
"optional": false,
|
|
383
517
|
"docs": {
|
|
384
518
|
"tags": [],
|
|
385
|
-
"text": "The suggestions for the value of the slotted input element
|
|
519
|
+
"text": "The suggestions for the value of the slotted input element.\r\n\r\nThis can be an array of type Suggestion or an Array of type SuggestionGroup.\r\n\r\nA suggestionGroup must have a `groupLabel` and `suggestions`.\r\n\r\nA suggestion must have a `value` and can have a `type`, an `item` or `extras`.\r\n\r\nThe `type` is used to style the suggestion. `item` can be use to reference the original object that was used to\r\ncreate the suggestion. `extras` is an array of additional strings to further specify the suggestion.\r\n\r\nThe value should be null when no suggestions have been fetched."
|
|
386
520
|
},
|
|
387
521
|
"getter": false,
|
|
388
522
|
"setter": false,
|
|
@@ -515,6 +649,7 @@ export class Autosuggest {
|
|
|
515
649
|
return {
|
|
516
650
|
"showSuggestions": {},
|
|
517
651
|
"selectedSuggestion": {},
|
|
652
|
+
"selectedSuggestionGroup": {},
|
|
518
653
|
"notFound": {},
|
|
519
654
|
"showLoading": {},
|
|
520
655
|
"listItemBlockSize": {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autosuggest.js","sourceRoot":"","sources":["../../../../src/components/autosuggest/autosuggest.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAgB,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAS,KAAK,EAAE,MAAM,eAAe,CAAC;AAExH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAGxC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAClC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAC9B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAO7B,MAAM,OAAO,WAAW;IALxB;QAME;;;;;;;;WAQG;QAEM,gBAAW,GAAwB,IAAI,CAAC;QAEjD;;WAEG;QAEH,YAAO,GAAG,KAAK,CAAC;QAEhB;;WAEG;QAEH,iBAAY,GAAY,oBAAoB,CAAC;QAc7C;;WAEG;QAEH,mBAAc,GAAG,KAAK,CAAC;QAgCvB,oBAAe,GAAG,KAAK,CAAC;QAMxB,aAAQ,GAAG,KA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Element, Event, EventEmitter, Fragment, h, Listen, Prop, State, VNode, Watch } from \"@stencil/core\";\r\n\r\nimport debounce from \"debounce\";\r\nimport escapeStringRegexp from \"escape-string-regexp\";\r\n\r\nimport { v4 } from \"uuid\";\r\n\r\nimport { i18n } from \"../../utils/i18n\";\r\n\r\nimport { AutosuggestMarkFunction, AutosuggestMarkItem, Suggestion } from \"./autosuggest.interfaces\";\r\nimport { translations } from \"./autosuggest.i18n\";\r\n\r\nconst maxSuggestionsViewable = 10;\r\nconst listboxPaddingBlock = 8;\r\nconst listboxBorderWidth = 1;\r\n\r\n@Component({\r\n tag: \"dso-autosuggest\",\r\n styleUrl: \"autosuggest.scss\",\r\n scoped: true,\r\n})\r\nexport class Autosuggest {\r\n /**\r\n * The suggestions for the value of the slotted input element. Optionally a\r\n * Suggestion can have a `type` and `item`.\r\n *\r\n * The `type` is used to style the suggestion. `item` can be use to reference\r\n * the original object that was used to create the suggestion.\r\n *\r\n * The value should be null when no suggestions have been fetched.\r\n */\r\n @Prop()\r\n readonly suggestions: Suggestion[] | null = null;\r\n\r\n /**\r\n * Shows progress indicator when fetching results.\r\n */\r\n @Prop()\r\n loading = false;\r\n\r\n /**\r\n * To override progress indicator's default loading label.\r\n */\r\n @Prop()\r\n loadingLabel?: string = \"Een moment geduld.\";\r\n\r\n /**\r\n * To delay progress indicator showing (in ms).\r\n */\r\n @Prop()\r\n loadingDelayed?: number;\r\n\r\n /**\r\n * To show text when no results are found.\r\n */\r\n @Prop()\r\n notFoundLabel?: string;\r\n\r\n /**\r\n * Whether the previous suggestions will be presented when the input gets focus again.\r\n */\r\n @Prop()\r\n suggestOnFocus = false;\r\n\r\n /**\r\n * A function provided by the consumer of the autosuggest component, that returns an array of `AutosuggestMarkItem`s\r\n */\r\n @Prop()\r\n mark?: AutosuggestMarkFunction;\r\n\r\n /**\r\n * Emitted when a suggestion is selected.\r\n * The `detail` property of the `CustomEvent` will contain the selected suggestion.\r\n */\r\n @Event()\r\n dsoSelect!: EventEmitter<Suggestion>;\r\n\r\n /**\r\n * This is emitted debounced for every change for the slotted input type=text element.\r\n */\r\n @Event()\r\n dsoChange!: EventEmitter<string>;\r\n\r\n /**\r\n * Emitted when enter is pressed.\r\n * The `detail` property of the `CustomEvent` will contain the input text.\r\n */\r\n @Event()\r\n dsoSearch!: EventEmitter<string>;\r\n\r\n @Element()\r\n host!: HTMLDsoAutosuggestElement;\r\n\r\n @State()\r\n showSuggestions = false;\r\n\r\n @State()\r\n selectedSuggestion: Suggestion | undefined;\r\n\r\n @State()\r\n notFound = false;\r\n\r\n @State()\r\n showLoading = false;\r\n\r\n @State()\r\n listItemBlockSize = 0;\r\n\r\n @State()\r\n listboxContainerMaxBlockSize = 0;\r\n\r\n @Watch(\"suggestions\")\r\n suggestionsWatcher() {\r\n this.resetSelectedSuggestion();\r\n\r\n if ((!this.showSuggestions || !this.notFound) && this.inputValue) {\r\n this.openSuggestions();\r\n } else if ((this.showSuggestions || this.notFound) && !this.inputValue) {\r\n this.closeSuggestions();\r\n }\r\n }\r\n\r\n private input?: HTMLInputElement;\r\n\r\n private listboxContainer: HTMLDsoScrollableElement | undefined;\r\n\r\n private listbox: HTMLUListElement | undefined;\r\n\r\n private listboxItems: HTMLLIElement[] = [];\r\n\r\n private listboxId: string = v4();\r\n\r\n private inputId: string = v4();\r\n\r\n private labelId: string = v4();\r\n\r\n private resizeObserver = new ResizeObserver(debounce(() => this.setListboxContainerMaxBlockSize(), 150));\r\n\r\n private debouncedEmitValue = debounce((value: string) => {\r\n this.dsoChange.emit(value);\r\n this.debouncedShowLoading();\r\n }, 200);\r\n\r\n private debouncedShowLoading = debounce(() => {\r\n if (this.inputValue) {\r\n this.showLoading = true;\r\n }\r\n }, this.loadingDelayed);\r\n\r\n private inputValue = \"\";\r\n\r\n private onInput = (event: Event) => {\r\n if (!(event.target instanceof HTMLInputElement)) {\r\n return;\r\n // throw new Error(\"event.target is not instanceof HTMLInputElement\"); #2293\r\n }\r\n\r\n this.showLoading = !this.loadingDelayed;\r\n this.inputValue = event.target.value;\r\n this.debouncedEmitValue(event.target.value.match(/(\\S+)/g) ? event.target.value : \"\");\r\n };\r\n\r\n private onFocusIn = () => {\r\n if (this.suggestOnFocus) {\r\n this.openSuggestions();\r\n }\r\n };\r\n\r\n @Listen(\"click\", { target: \"document\" })\r\n onDocumentClick(event: MouseEvent) {\r\n if (\r\n (this.showSuggestions || this.notFound) &&\r\n this.listbox &&\r\n event.target instanceof Node &&\r\n !this.listbox.contains(event.target) &&\r\n this.input !== event.target\r\n ) {\r\n this.closeSuggestions();\r\n }\r\n }\r\n\r\n private text = i18n(() => this.host, translations);\r\n\r\n componentDidRender() {\r\n this.setListboxContainerMaxBlockSize();\r\n }\r\n\r\n connectedCallback() {\r\n setTimeout(() => {\r\n const input = this.host.querySelector('input[type=\"text\"]');\r\n if (!(input instanceof HTMLInputElement)) {\r\n return;\r\n // throw new ReferenceError(\"Mandatory text input not found\"); #2293\r\n }\r\n\r\n this.input = input;\r\n if (input.id) {\r\n this.inputId = input.id;\r\n } else {\r\n input.id = this.inputId;\r\n }\r\n\r\n if (!this.input.labels || this.input.labels.length < 1) {\r\n return;\r\n // throw new ReferenceError(\"Mandatory label for text input not found\"); #2293\r\n }\r\n\r\n const label = this.input.labels[0];\r\n if (label?.id) {\r\n this.labelId = label.id;\r\n } else if (label) {\r\n label.id = this.labelId;\r\n }\r\n\r\n this.input.setAttribute(\"role\", \"combobox\");\r\n this.input.setAttribute(\"aria-haspopup\", \"listbox\");\r\n this.input.setAttribute(\"aria-expanded\", \"false\");\r\n this.input.setAttribute(\"autocomplete\", \"off\");\r\n this.input.setAttribute(\"aria-autocomplete\", \"list\");\r\n this.input.setAttribute(\"aria-activedescendant\", \"\");\r\n this.input.addEventListener(\"input\", this.onInput);\r\n this.input.addEventListener(\"keydown\", this.onKeyDown);\r\n this.input.addEventListener(\"focusin\", this.onFocusIn);\r\n\r\n window.addEventListener(\"resize\", this.onWindowResize);\r\n\r\n document.addEventListener(\"scrollend\", this.onScrollend);\r\n\r\n this.resizeObserver.observe(this.host);\r\n\r\n this.setListboxContainerMaxBlockSize();\r\n });\r\n }\r\n\r\n disconnectedCallback() {\r\n this.input?.removeEventListener(\"input\", this.onInput);\r\n this.input?.removeEventListener(\"keydown\", this.onKeyDown);\r\n this.input?.removeEventListener(\"focusin\", this.onFocusIn);\r\n\r\n window.removeEventListener(\"resize\", this.onWindowResize);\r\n\r\n document.removeEventListener(\"scrollend\", this.onScrollend);\r\n\r\n this.resizeObserver.disconnect();\r\n }\r\n\r\n private onWindowResize = debounce(() => this.setListboxContainerMaxBlockSize(), 150);\r\n\r\n private onScrollend = () => this.setListboxContainerMaxBlockSize();\r\n\r\n private setListboxContainerMaxBlockSize(): void {\r\n if (!this.listboxContainer || !this.showSuggestions) {\r\n return;\r\n }\r\n\r\n if (this.listboxItems[0] && this.showSuggestions) {\r\n this.listItemBlockSize = this.listboxItems[0].getBoundingClientRect().height;\r\n }\r\n\r\n const availableBlockSize = window.innerHeight - this.host.getBoundingClientRect().bottom;\r\n const listboxMaxBlockSize =\r\n this.listItemBlockSize * maxSuggestionsViewable + 2 * listboxPaddingBlock + 2 * listboxBorderWidth;\r\n\r\n if (availableBlockSize > this.listItemBlockSize) {\r\n if (availableBlockSize < listboxMaxBlockSize) {\r\n this.listboxContainerMaxBlockSize = availableBlockSize - 2 * listboxPaddingBlock;\r\n } else {\r\n this.listboxContainerMaxBlockSize = listboxMaxBlockSize;\r\n }\r\n }\r\n }\r\n\r\n private showInputValueNotFound(text?: string) {\r\n return this.processAutosuggestMarkItems(this.markTerms(this.input?.value.split(\" \").filter((t) => t) ?? [], text));\r\n }\r\n\r\n private handleMark(\r\n suggestion: Suggestion,\r\n text: string,\r\n type?: \"value\" | \"type\" | \"extra\",\r\n extraIndex?: number,\r\n ): (VNode | string)[] {\r\n if (this.mark && type) {\r\n return this.processAutosuggestMarkItems(this.mark(suggestion, text, type, extraIndex));\r\n }\r\n return this.processAutosuggestMarkItems(this.markTerms(this.input?.value.split(\" \").filter((t) => t) ?? [], text));\r\n }\r\n\r\n private markTerms(terms: string[], suggestionValue?: string): AutosuggestMarkItem[] {\r\n if (!suggestionValue || !terms || terms.length === 0 || terms[0] === undefined) {\r\n return [\"\"];\r\n }\r\n\r\n const termRegex = new RegExp(`(${escapeStringRegexp(terms[0])})`, \"gi\");\r\n\r\n return suggestionValue.split(termRegex).reduce((total: AutosuggestMarkItem[], valuePart: string) => {\r\n if (!valuePart) {\r\n total.push(valuePart);\r\n } else if (termRegex.test(valuePart)) {\r\n total.push({ mark: valuePart });\r\n } else if (terms.length === 1) {\r\n total.push(valuePart);\r\n } else {\r\n total.push(...this.markTerms(terms.slice(1), valuePart));\r\n }\r\n\r\n return total;\r\n }, []);\r\n }\r\n\r\n private processAutosuggestMarkItems(items: AutosuggestMarkItem[]): (VNode | string)[] {\r\n if (items.length === 0) {\r\n return [\"\"];\r\n }\r\n\r\n return items.map((item) => {\r\n if (typeof item === \"object\") {\r\n return <mark>{item.mark}</mark>;\r\n }\r\n return item;\r\n });\r\n }\r\n\r\n private selectSuggestion(suggestion: Suggestion) {\r\n this.selectedSuggestion = suggestion;\r\n\r\n this.setAriaActiveDescendant();\r\n }\r\n\r\n private selectFirstSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n this.selectedSuggestion = this.suggestions[0];\r\n\r\n this.setAriaActiveDescendant(true);\r\n }\r\n\r\n private selectLastSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n this.selectedSuggestion = this.suggestions[this.suggestions.length - 1];\r\n\r\n this.setAriaActiveDescendant(true);\r\n }\r\n\r\n private selectNextSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n const index = this.selectedSuggestion ? this.suggestions.indexOf(this.selectedSuggestion) : -1;\r\n\r\n this.selectedSuggestion = this.suggestions[index + 1] ?? this.suggestions[0];\r\n\r\n this.setAriaActiveDescendant(true);\r\n }\r\n\r\n private selectPreviousSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n const index = this.selectedSuggestion ? this.suggestions.indexOf(this.selectedSuggestion) : 0;\r\n\r\n this.selectedSuggestion = this.suggestions[index - 1] ?? this.suggestions[this.suggestions.length - 1];\r\n\r\n this.setAriaActiveDescendant(true);\r\n }\r\n\r\n private setAriaActiveDescendant(scroll = false): void {\r\n if (this.selectedSuggestion) {\r\n const id = this.listboxItemId(this.selectedSuggestion);\r\n this.input?.setAttribute(\"aria-activedescendant\", id);\r\n if (scroll) {\r\n document.getElementById(id)?.scrollIntoView({ block: \"nearest\" });\r\n }\r\n }\r\n }\r\n\r\n private resetSelectedSuggestion() {\r\n this.showLoading = !this.loadingDelayed;\r\n this.notFound = false;\r\n this.selectedSuggestion = undefined;\r\n this.input?.setAttribute(\"aria-activedescendant\", \"\");\r\n }\r\n\r\n private openSuggestions(selectSuggestion?: \"first\" | \"last\") {\r\n this.showSuggestions = (this.suggestions && this.suggestions.length > 0) ?? false;\r\n this.notFound = (this.suggestions && this.suggestions?.length === 0) ?? false;\r\n this.input?.setAttribute(\"aria-expanded\", (this.showSuggestions || this.notFound).toString());\r\n\r\n if (this.showSuggestions && selectSuggestion === \"first\") {\r\n this.selectFirstSuggestion();\r\n } else if (this.showSuggestions && selectSuggestion === \"last\") {\r\n this.selectLastSuggestion();\r\n }\r\n }\r\n\r\n private closeSuggestions() {\r\n this.showSuggestions = false;\r\n this.notFound = false;\r\n this.input?.setAttribute(\"aria-expanded\", \"false\");\r\n this.selectFirstSuggestion();\r\n }\r\n\r\n private pickSelectedValue() {\r\n if (this.selectedSuggestion && this.showSuggestions) {\r\n this.dsoSelect.emit(this.selectedSuggestion);\r\n } else {\r\n this.dsoSearch.emit(this.input?.value);\r\n }\r\n\r\n this.closeSuggestions();\r\n }\r\n\r\n private onKeyDown = (event: KeyboardEvent) => {\r\n if (event.defaultPrevented || this.loading) {\r\n return;\r\n }\r\n\r\n switch (event.key) {\r\n case \"ArrowDown\":\r\n if (!this.showSuggestions) {\r\n this.openSuggestions(\"first\");\r\n } else {\r\n this.selectNextSuggestion();\r\n }\r\n\r\n break;\r\n\r\n case \"ArrowUp\":\r\n if (!this.showSuggestions) {\r\n this.openSuggestions(\"last\");\r\n } else {\r\n this.selectPreviousSuggestion();\r\n }\r\n\r\n break;\r\n\r\n case \"Tab\":\r\n this.closeSuggestions();\r\n return;\r\n\r\n case \"Escape\":\r\n this.closeSuggestions();\r\n break;\r\n\r\n case \"Enter\":\r\n this.pickSelectedValue();\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n };\r\n\r\n private listboxItemId(suggestion: Suggestion): string {\r\n if (!this.suggestions) {\r\n return \"\";\r\n }\r\n return `${this.inputId}-${this.suggestions.indexOf(suggestion) + 1}`;\r\n }\r\n\r\n private getChunkedExtras(extras: string[]): string[][] {\r\n return extras.reduce((resultArray: string[][], extra, index) => {\r\n const chunkIndex = Math.floor(index / 2);\r\n\r\n if (!resultArray[chunkIndex]) {\r\n resultArray[chunkIndex] = [];\r\n }\r\n resultArray[chunkIndex]?.push(extra);\r\n return resultArray;\r\n }, []);\r\n }\r\n\r\n render() {\r\n this.listboxItems = [];\r\n\r\n const showListbox = this.showSuggestions || this.notFound;\r\n\r\n if (showListbox && this.input) {\r\n this.input.setAttribute(\"aria-controls\", this.listboxId);\r\n } else if (this.input) {\r\n this.input.removeAttribute(\"aria-controls\");\r\n }\r\n\r\n return (\r\n <>\r\n <slot />\r\n {this.loading && this.showLoading ? (\r\n <div class=\"autosuggest-progress-box\">\r\n <dso-progress-indicator label={this.loadingLabel}></dso-progress-indicator>\r\n </div>\r\n ) : (\r\n showListbox && (\r\n <dso-scrollable\r\n class=\"listbox-container\"\r\n ref={(element) => (this.listboxContainer = element)}\r\n style={{ \"--max-block-size\": `${this.listboxContainerMaxBlockSize}px` }}\r\n >\r\n <ul\r\n role=\"listbox\"\r\n aria-live=\"polite\"\r\n id={this.listboxId}\r\n aria-labelledby={this.labelId}\r\n ref={(element) => (this.listbox = element)}\r\n tabindex=\"0\"\r\n >\r\n {(this.showSuggestions &&\r\n this.suggestions &&\r\n this.suggestions.map((suggestion) => (\r\n <li\r\n role=\"option\"\r\n id={this.listboxItemId(suggestion)}\r\n key={suggestion.value}\r\n onMouseEnter={() => this.selectSuggestion(suggestion)}\r\n onMouseLeave={() => this.resetSelectedSuggestion()}\r\n onClick={() => this.pickSelectedValue()}\r\n aria-selected={(suggestion === this.selectedSuggestion).toString()}\r\n aria-label={suggestion.value}\r\n ref={(li) => li && this.listboxItems.push(li)}\r\n >\r\n <div class=\"suggestion-row\">\r\n <span class=\"value\">{this.handleMark(suggestion, suggestion.value, \"value\")}</span>\r\n {suggestion.type ? (\r\n <span class=\"type\">{this.handleMark(suggestion, suggestion.type, \"type\")}</span>\r\n ) : undefined}\r\n </div>\r\n {suggestion.extras &&\r\n this.getChunkedExtras(suggestion.extras).map((chunk, index) => (\r\n <div class=\"suggestion-row\">\r\n {chunk.map((c, i) => (\r\n <span class=\"extra\">{this.handleMark(suggestion, c, \"extra\", index * 2 + i)}</span>\r\n ))}\r\n </div>\r\n ))}\r\n </li>\r\n ))) ||\r\n (this.notFound && (\r\n <li>\r\n <span class=\"value\">\r\n {this.notFoundLabel ||\r\n this.showInputValueNotFound(this.text(\"notFound\", { inputValue: this.inputValue }))}\r\n </span>\r\n </li>\r\n ))}\r\n </ul>\r\n </dso-scrollable>\r\n )\r\n )}\r\n </>\r\n );\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"autosuggest.js","sourceRoot":"","sources":["../../../../src/components/autosuggest/autosuggest.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,QAAQ,EAER,CAAC,EACD,MAAM,EACN,IAAI,EACJ,KAAK,EAEL,KAAK,GACN,MAAM,eAAe,CAAC;AAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\r\n Component,\r\n Element,\r\n Event,\r\n EventEmitter,\r\n Fragment,\r\n FunctionalComponent,\r\n h,\r\n Listen,\r\n Prop,\r\n State,\r\n VNode,\r\n Watch,\r\n} from \"@stencil/core\";\r\n\r\nimport debounce from \"debounce\";\r\nimport escapeStringRegexp from \"escape-string-regexp\";\r\n\r\nimport { v4 } from \"uuid\";\r\n\r\nimport { i18n } from \"../../utils/i18n\";\r\n\r\nimport { AutosuggestMarkFunction, AutosuggestMarkItem, Suggestion, SuggestionGroup } from \"./autosuggest.interfaces\";\r\nimport { translations } from \"./autosuggest.i18n\";\r\n\r\ninterface MarkedSuggestion {\r\n value: (VNode | string)[];\r\n type?: (VNode | string)[];\r\n extras?: (VNode | string)[][][];\r\n}\r\n\r\nconst maxSuggestionsViewable = 10;\r\nconst listboxPaddingBlock = 8;\r\nconst listboxBorderWidth = 1;\r\n\r\nconst Option: FunctionalComponent<{\r\n id: string;\r\n mouseEnter: () => void;\r\n mouseLeave: () => void;\r\n click: () => void;\r\n selected: string;\r\n suggestion: Suggestion;\r\n markedSuggestion: MarkedSuggestion;\r\n ref: (element: HTMLDivElement | undefined) => void;\r\n}> = ({ id, mouseEnter, mouseLeave, click, selected, suggestion, ref, markedSuggestion }) => (\r\n <div\r\n class=\"option\"\r\n role=\"option\"\r\n id={id}\r\n onMouseEnter={mouseEnter}\r\n onMouseLeave={mouseLeave}\r\n onClick={click}\r\n aria-selected={selected}\r\n aria-label={suggestion.value}\r\n ref={ref}\r\n >\r\n <div class=\"suggestion-row\">\r\n <span class=\"value\">{markedSuggestion.value}</span>\r\n {markedSuggestion.type ? <span class=\"type\">{markedSuggestion.type}</span> : undefined}\r\n </div>\r\n {markedSuggestion.extras &&\r\n markedSuggestion.extras.map((markedChunk) => (\r\n <div class=\"suggestion-row\">\r\n {markedChunk.map((extra) => (\r\n <span class=\"extra\">{extra}</span>\r\n ))}\r\n </div>\r\n ))}\r\n </div>\r\n);\r\n\r\nfunction isGrouped(suggestions: Suggestion[] | SuggestionGroup[] | null): suggestions is SuggestionGroup[] {\r\n return (\r\n !!suggestions &&\r\n suggestions.length > 0 &&\r\n suggestions.every(\r\n (suggestion) =>\r\n suggestion !== undefined &&\r\n \"groupLabel\" in suggestion &&\r\n suggestion.groupLabel !== undefined &&\r\n \"suggestions\" in suggestion &&\r\n suggestion.suggestions.length > 0,\r\n )\r\n );\r\n}\r\n\r\nfunction isFlat(suggestions: Suggestion[] | SuggestionGroup[] | null): suggestions is Suggestion[] {\r\n return (\r\n !!suggestions &&\r\n suggestions.length > 0 &&\r\n suggestions.every(\r\n (suggestion) => suggestion !== undefined && \"value\" in suggestion && suggestion.value !== undefined,\r\n )\r\n );\r\n}\r\n\r\n@Component({\r\n tag: \"dso-autosuggest\",\r\n styleUrl: \"autosuggest.scss\",\r\n scoped: true,\r\n})\r\nexport class Autosuggest {\r\n /**\r\n * The suggestions for the value of the slotted input element.\r\n *\r\n * This can be an array of type Suggestion or an Array of type SuggestionGroup.\r\n *\r\n * A suggestionGroup must have a `groupLabel` and `suggestions`.\r\n *\r\n * A suggestion must have a `value` and can have a `type`, an `item` or `extras`.\r\n *\r\n * The `type` is used to style the suggestion. `item` can be use to reference the original object that was used to\r\n * create the suggestion. `extras` is an array of additional strings to further specify the suggestion.\r\n *\r\n * The value should be null when no suggestions have been fetched.\r\n */\r\n @Prop()\r\n readonly suggestions: Suggestion[] | SuggestionGroup[] | null = null;\r\n\r\n /**\r\n * Shows progress indicator when fetching results.\r\n */\r\n @Prop()\r\n loading = false;\r\n\r\n /**\r\n * To override progress indicator's default loading label.\r\n */\r\n @Prop()\r\n loadingLabel?: string = \"Een moment geduld.\";\r\n\r\n /**\r\n * To delay progress indicator showing (in ms).\r\n */\r\n @Prop()\r\n loadingDelayed?: number;\r\n\r\n /**\r\n * To show text when no results are found.\r\n */\r\n @Prop()\r\n notFoundLabel?: string;\r\n\r\n /**\r\n * Whether the previous suggestions will be presented when the input gets focus again.\r\n */\r\n @Prop()\r\n suggestOnFocus = false;\r\n\r\n /**\r\n * A function provided by the consumer of the autosuggest component, that returns an array of `AutosuggestMarkItem`s\r\n */\r\n @Prop()\r\n mark?: AutosuggestMarkFunction;\r\n\r\n /**\r\n * Emitted when a suggestion is selected.\r\n * The `detail` property of the `CustomEvent` will contain the selected suggestion.\r\n */\r\n @Event()\r\n dsoSelect!: EventEmitter<Suggestion>;\r\n\r\n /**\r\n * This is emitted debounced for every change for the slotted input type=text element.\r\n */\r\n @Event()\r\n dsoChange!: EventEmitter<string>;\r\n\r\n /**\r\n * Emitted when enter is pressed.\r\n * The `detail` property of the `CustomEvent` will contain the input text.\r\n */\r\n @Event()\r\n dsoSearch!: EventEmitter<string>;\r\n\r\n @Element()\r\n host!: HTMLDsoAutosuggestElement;\r\n\r\n @State()\r\n showSuggestions = false;\r\n\r\n @State()\r\n selectedSuggestion: Suggestion | undefined;\r\n\r\n @State()\r\n selectedSuggestionGroup: SuggestionGroup | undefined;\r\n\r\n @State()\r\n notFound = false;\r\n\r\n @State()\r\n showLoading = false;\r\n\r\n @State()\r\n listItemBlockSize = 0;\r\n\r\n @State()\r\n listboxContainerMaxBlockSize = 0;\r\n\r\n @Watch(\"suggestions\")\r\n suggestionsWatcher() {\r\n this.resetSelectedSuggestion();\r\n\r\n if ((!this.showSuggestions || !this.notFound) && this.inputValue) {\r\n this.openSuggestions();\r\n } else if ((this.showSuggestions || this.notFound) && !this.inputValue) {\r\n this.closeSuggestions();\r\n }\r\n }\r\n\r\n private input?: HTMLInputElement;\r\n\r\n private listboxContainer: HTMLDsoScrollableElement | undefined;\r\n\r\n private listbox: HTMLDivElement | undefined;\r\n\r\n private listboxItems: HTMLDivElement[] = [];\r\n\r\n private listboxId: string = v4();\r\n\r\n private inputId: string = v4();\r\n\r\n private labelId: string = v4();\r\n\r\n private resizeObserver = new ResizeObserver(debounce(() => this.setListboxContainerMaxBlockSize(), 150));\r\n\r\n private debouncedEmitValue = debounce((value: string) => {\r\n this.dsoChange.emit(value);\r\n this.debouncedShowLoading();\r\n }, 200);\r\n\r\n private debouncedShowLoading = debounce(() => {\r\n if (this.inputValue) {\r\n this.showLoading = true;\r\n }\r\n }, this.loadingDelayed);\r\n\r\n private inputValue = \"\";\r\n\r\n private onInput = (event: Event) => {\r\n if (!(event.target instanceof HTMLInputElement)) {\r\n return;\r\n // throw new Error(\"event.target is not instanceof HTMLInputElement\"); #2293\r\n }\r\n\r\n this.showLoading = !this.loadingDelayed;\r\n this.inputValue = event.target.value;\r\n this.debouncedEmitValue(event.target.value.match(/(\\S+)/g) ? event.target.value : \"\");\r\n };\r\n\r\n private onFocusIn = () => {\r\n if (this.suggestOnFocus) {\r\n this.openSuggestions();\r\n }\r\n };\r\n\r\n @Listen(\"click\", { target: \"document\" })\r\n onDocumentClick(event: MouseEvent) {\r\n if (\r\n (this.showSuggestions || this.notFound) &&\r\n this.listbox &&\r\n event.target instanceof Node &&\r\n !this.listbox.contains(event.target) &&\r\n this.input !== event.target\r\n ) {\r\n this.closeSuggestions();\r\n }\r\n }\r\n\r\n private text = i18n(() => this.host, translations);\r\n\r\n componentDidRender() {\r\n this.setListboxContainerMaxBlockSize();\r\n }\r\n\r\n connectedCallback() {\r\n setTimeout(() => {\r\n const input = this.host.querySelector('input[type=\"text\"]');\r\n if (!(input instanceof HTMLInputElement)) {\r\n return;\r\n // throw new ReferenceError(\"Mandatory text input not found\"); #2293\r\n }\r\n\r\n this.input = input;\r\n if (input.id) {\r\n this.inputId = input.id;\r\n } else {\r\n input.id = this.inputId;\r\n }\r\n\r\n if (!this.input.labels || this.input.labels.length < 1) {\r\n return;\r\n // throw new ReferenceError(\"Mandatory label for text input not found\"); #2293\r\n }\r\n\r\n const label = this.input.labels[0];\r\n if (label?.id) {\r\n this.labelId = label.id;\r\n } else if (label) {\r\n label.id = this.labelId;\r\n }\r\n\r\n this.input.setAttribute(\"role\", \"combobox\");\r\n this.input.setAttribute(\"aria-haspopup\", \"listbox\");\r\n this.input.setAttribute(\"aria-expanded\", \"false\");\r\n this.input.setAttribute(\"autocomplete\", \"off\");\r\n this.input.setAttribute(\"aria-autocomplete\", \"list\");\r\n this.input.setAttribute(\"aria-activedescendant\", \"\");\r\n this.input.addEventListener(\"input\", this.onInput);\r\n this.input.addEventListener(\"keydown\", this.onKeyDown);\r\n this.input.addEventListener(\"focusin\", this.onFocusIn);\r\n\r\n window.addEventListener(\"resize\", this.onWindowResize);\r\n\r\n document.addEventListener(\"scrollend\", this.onScrollend);\r\n\r\n this.resizeObserver.observe(this.host);\r\n\r\n this.setListboxContainerMaxBlockSize();\r\n });\r\n }\r\n\r\n disconnectedCallback() {\r\n this.input?.removeEventListener(\"input\", this.onInput);\r\n this.input?.removeEventListener(\"keydown\", this.onKeyDown);\r\n this.input?.removeEventListener(\"focusin\", this.onFocusIn);\r\n\r\n window.removeEventListener(\"resize\", this.onWindowResize);\r\n\r\n document.removeEventListener(\"scrollend\", this.onScrollend);\r\n\r\n this.resizeObserver.disconnect();\r\n }\r\n\r\n private onWindowResize = debounce(() => this.setListboxContainerMaxBlockSize(), 150);\r\n\r\n private onScrollend = () => this.setListboxContainerMaxBlockSize();\r\n\r\n private setListboxContainerMaxBlockSize(): void {\r\n if (!this.listboxContainer || !this.showSuggestions) {\r\n return;\r\n }\r\n\r\n if (this.listboxItems[0] && this.showSuggestions) {\r\n this.listItemBlockSize = this.listboxItems[0].getBoundingClientRect().height;\r\n }\r\n\r\n const availableBlockSize = window.innerHeight - this.host.getBoundingClientRect().bottom;\r\n const listboxMaxBlockSize =\r\n this.listItemBlockSize * maxSuggestionsViewable + 2 * listboxPaddingBlock + 2 * listboxBorderWidth;\r\n\r\n if (availableBlockSize > this.listItemBlockSize) {\r\n if (availableBlockSize < listboxMaxBlockSize) {\r\n this.listboxContainerMaxBlockSize = availableBlockSize - 2 * listboxPaddingBlock;\r\n } else {\r\n this.listboxContainerMaxBlockSize = listboxMaxBlockSize;\r\n }\r\n }\r\n }\r\n\r\n private showInputValueNotFound(text?: string) {\r\n return this.processAutosuggestMarkItems(this.markTerms(this.input?.value.split(\" \").filter((t) => t) ?? [], text));\r\n }\r\n\r\n private handleMark(\r\n suggestion: Suggestion,\r\n text: string,\r\n type?: \"value\" | \"type\" | \"extra\",\r\n extraIndex?: number,\r\n ): (VNode | string)[] {\r\n if (this.mark && type) {\r\n return this.processAutosuggestMarkItems(this.mark(suggestion, text, type, extraIndex));\r\n }\r\n return this.processAutosuggestMarkItems(this.markTerms(this.input?.value.split(\" \").filter((t) => t) ?? [], text));\r\n }\r\n\r\n private markTerms(terms: string[], suggestionValue?: string): AutosuggestMarkItem[] {\r\n if (!suggestionValue || !terms || terms.length === 0 || terms[0] === undefined) {\r\n return [\"\"];\r\n }\r\n\r\n const termRegex = new RegExp(`(${escapeStringRegexp(terms[0])})`, \"gi\");\r\n\r\n return suggestionValue.split(termRegex).reduce((total: AutosuggestMarkItem[], valuePart: string) => {\r\n if (!valuePart) {\r\n total.push(valuePart);\r\n } else if (termRegex.test(valuePart)) {\r\n total.push({ mark: valuePart });\r\n } else if (terms.length === 1) {\r\n total.push(valuePart);\r\n } else {\r\n total.push(...this.markTerms(terms.slice(1), valuePart));\r\n }\r\n\r\n return total;\r\n }, []);\r\n }\r\n\r\n private processAutosuggestMarkItems(items: AutosuggestMarkItem[]): (VNode | string)[] {\r\n if (items.length === 0) {\r\n return [\"\"];\r\n }\r\n\r\n return items.map((item) => {\r\n if (typeof item === \"object\") {\r\n return <mark>{item.mark}</mark>;\r\n }\r\n return item;\r\n });\r\n }\r\n\r\n private selectSuggestion(suggestion: Suggestion, group?: SuggestionGroup) {\r\n this.selectedSuggestion = suggestion;\r\n this.selectedSuggestionGroup = group;\r\n\r\n this.setAriaActiveDescendant();\r\n }\r\n\r\n private selectFirstSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n if (isGrouped(this.suggestions) && this.selectedSuggestionGroup) {\r\n this.selectedSuggestion = this.selectedSuggestionGroup.suggestions[0];\r\n } else {\r\n if (isFlat(this.suggestions)) {\r\n this.selectedSuggestion = this.suggestions[0];\r\n }\r\n }\r\n\r\n this.setAriaActiveDescendant(true);\r\n }\r\n\r\n private selectLastSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n if (isGrouped(this.suggestions) && this.selectedSuggestionGroup) {\r\n this.selectedSuggestion =\r\n this.selectedSuggestionGroup.suggestions[this.selectedSuggestionGroup.suggestions.length - 1];\r\n } else {\r\n if (isFlat(this.suggestions)) {\r\n this.selectedSuggestion = this.suggestions[this.suggestions.length - 1];\r\n }\r\n }\r\n this.setAriaActiveDescendant(true);\r\n }\r\n\r\n private selectNextSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n if (isGrouped(this.suggestions)) {\r\n this.selectNextGroupedSuggestion();\r\n } else {\r\n const index = this.selectedSuggestion ? this.suggestions.indexOf(this.selectedSuggestion) : -1;\r\n\r\n this.selectedSuggestion = this.suggestions[index + 1] ?? this.suggestions[0];\r\n }\r\n\r\n this.setAriaActiveDescendant(true);\r\n }\r\n\r\n private selectNextGroupedSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n if (this.selectedSuggestionGroup) {\r\n const indexInGroup = this.selectedSuggestion\r\n ? this.selectedSuggestionGroup.suggestions.indexOf(this.selectedSuggestion)\r\n : -1;\r\n\r\n if (indexInGroup === this.selectedSuggestionGroup.suggestions.length - 1) {\r\n // Move to first suggestion in next or first group\r\n const groupIndex = this.suggestionGroups.indexOf(this.selectedSuggestionGroup);\r\n this.selectedSuggestionGroup = this.suggestionGroups[groupIndex + 1] ?? this.suggestionGroups[0];\r\n this.selectedSuggestion = this.selectedSuggestionGroup!.suggestions[0];\r\n } else {\r\n // Within this group\r\n this.selectedSuggestion = this.selectedSuggestionGroup.suggestions[indexInGroup + 1];\r\n }\r\n } else {\r\n this.selectedSuggestionGroup = this.suggestionGroups[0];\r\n this.selectedSuggestion = this.selectedSuggestionGroup!.suggestions[0];\r\n }\r\n }\r\n\r\n private selectPreviousSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n if (isGrouped(this.suggestions)) {\r\n this.selectPreviousGroupedSuggestion();\r\n } else {\r\n const index = this.selectedSuggestion ? this.suggestions.indexOf(this.selectedSuggestion) : 0;\r\n\r\n this.selectedSuggestion = this.suggestions[index - 1] ?? this.suggestions[this.suggestions.length - 1];\r\n }\r\n\r\n this.setAriaActiveDescendant(true);\r\n }\r\n\r\n private selectPreviousGroupedSuggestion() {\r\n if (!this.suggestions) {\r\n return;\r\n }\r\n\r\n if (this.selectedSuggestionGroup) {\r\n const indexInGroup = this.selectedSuggestion\r\n ? this.selectedSuggestionGroup.suggestions.indexOf(this.selectedSuggestion)\r\n : -1;\r\n\r\n if (indexInGroup === 0) {\r\n // Move to last suggestion in previous or last group\r\n const groupIndex = this.suggestionGroups.indexOf(this.selectedSuggestionGroup);\r\n\r\n this.selectedSuggestionGroup =\r\n this.suggestionGroups[groupIndex - 1] ?? this.suggestionGroups[this.suggestions.length - 1];\r\n this.selectedSuggestion =\r\n this.selectedSuggestionGroup!.suggestions[this.selectedSuggestionGroup!.suggestions.length - 1];\r\n } else {\r\n // Within this group\r\n this.selectedSuggestion = this.selectedSuggestionGroup.suggestions[indexInGroup - 1];\r\n }\r\n } else {\r\n this.selectedSuggestionGroup = this.suggestionGroups[this.suggestions.length - 1];\r\n this.selectedSuggestion =\r\n this.selectedSuggestionGroup!.suggestions[this.selectedSuggestionGroup!.suggestions.length - 1];\r\n }\r\n }\r\n\r\n private get suggestionGroups(): SuggestionGroup[] {\r\n return isGrouped(this.suggestions) ? this.suggestions : [];\r\n }\r\n\r\n private setAriaActiveDescendant(scroll = false): void {\r\n if (this.selectedSuggestion) {\r\n const id = this.selectedSuggestionGroup\r\n ? this.listboxGroupedItemId(this.selectedSuggestionGroup, this.selectedSuggestion)\r\n : this.listboxItemId(this.selectedSuggestion);\r\n this.input?.setAttribute(\"aria-activedescendant\", id);\r\n if (scroll) {\r\n document.getElementById(id)?.scrollIntoView({ block: \"nearest\" });\r\n }\r\n }\r\n }\r\n\r\n private resetSelectedSuggestion() {\r\n this.showLoading = !this.loadingDelayed;\r\n this.notFound = false;\r\n this.selectedSuggestion = undefined;\r\n this.selectedSuggestionGroup = undefined;\r\n this.input?.setAttribute(\"aria-activedescendant\", \"\");\r\n }\r\n\r\n private openSuggestions(selectSuggestion?: \"first\" | \"last\") {\r\n this.showSuggestions = (this.suggestions && this.suggestions.length > 0) ?? false;\r\n this.notFound = (this.suggestions && this.suggestions?.length === 0) ?? false;\r\n this.input?.setAttribute(\"aria-expanded\", (this.showSuggestions || this.notFound).toString());\r\n\r\n if (this.showSuggestions && selectSuggestion === \"first\") {\r\n this.selectFirstSuggestion();\r\n } else if (this.showSuggestions && selectSuggestion === \"last\") {\r\n this.selectLastSuggestion();\r\n }\r\n }\r\n\r\n private closeSuggestions() {\r\n this.showSuggestions = false;\r\n this.notFound = false;\r\n this.input?.setAttribute(\"aria-expanded\", \"false\");\r\n this.selectFirstSuggestion();\r\n }\r\n\r\n private pickSelectedValue() {\r\n if (this.selectedSuggestion && this.showSuggestions) {\r\n this.dsoSelect.emit(this.selectedSuggestion);\r\n } else {\r\n this.dsoSearch.emit(this.input?.value);\r\n }\r\n\r\n this.closeSuggestions();\r\n }\r\n\r\n private onKeyDown = (event: KeyboardEvent) => {\r\n if (event.defaultPrevented || this.loading) {\r\n return;\r\n }\r\n\r\n switch (event.key) {\r\n case \"ArrowDown\":\r\n if (!this.showSuggestions) {\r\n this.openSuggestions(\"first\");\r\n } else {\r\n this.selectNextSuggestion();\r\n }\r\n\r\n break;\r\n\r\n case \"ArrowUp\":\r\n if (!this.showSuggestions) {\r\n this.openSuggestions(\"last\");\r\n } else {\r\n this.selectPreviousSuggestion();\r\n }\r\n\r\n break;\r\n\r\n case \"Tab\":\r\n this.closeSuggestions();\r\n return;\r\n\r\n case \"Escape\":\r\n this.closeSuggestions();\r\n break;\r\n\r\n case \"Enter\":\r\n this.pickSelectedValue();\r\n break;\r\n\r\n default:\r\n return;\r\n }\r\n\r\n event.preventDefault();\r\n };\r\n\r\n private listboxItemId(suggestion: Suggestion): string {\r\n if (!this.suggestions) {\r\n return \"\";\r\n }\r\n return `${this.inputId}-${isFlat(this.suggestions) && this.suggestions.indexOf(suggestion) + 1}`;\r\n }\r\n\r\n private listboxGroupedItemId(suggestionGroup: SuggestionGroup, suggestion: Suggestion): string {\r\n if (!this.suggestions) {\r\n return \"\";\r\n }\r\n\r\n return `${this.inputId}-${this.suggestionGroups.indexOf(suggestionGroup) + 1}-${suggestionGroup.suggestions.indexOf(suggestion) + 1}`;\r\n }\r\n\r\n private getMarkedChunkedExtras(extras: string[], suggestion: Suggestion): (string | VNode)[][][] {\r\n const chunkedExtras = extras.reduce((resultArray: string[][], extra, index) => {\r\n const chunkIndex = Math.floor(index / 2);\r\n\r\n if (!resultArray[chunkIndex]) {\r\n resultArray[chunkIndex] = [];\r\n }\r\n resultArray[chunkIndex]?.push(extra);\r\n return resultArray;\r\n }, []);\r\n\r\n return chunkedExtras.map((chunk, index) =>\r\n chunk.map((c, i) => this.handleMark(suggestion, c, \"extra\", index * 2 + i)),\r\n );\r\n }\r\n\r\n private getMarkedSuggestions(suggestion: Suggestion): MarkedSuggestion {\r\n return {\r\n value: this.handleMark(suggestion, suggestion.value, \"value\"),\r\n type: suggestion.type ? this.handleMark(suggestion, suggestion.type, \"type\") : undefined,\r\n extras: suggestion.extras ? this.getMarkedChunkedExtras(suggestion.extras, suggestion) : undefined,\r\n };\r\n }\r\n\r\n render() {\r\n this.listboxItems = [];\r\n\r\n const showListbox = this.showSuggestions || this.notFound;\r\n\r\n const grouped = isGrouped(this.suggestions);\r\n const flat = isFlat(this.suggestions);\r\n\r\n if (showListbox && this.input) {\r\n this.input.setAttribute(\"aria-controls\", this.listboxId);\r\n } else if (this.input) {\r\n this.input.removeAttribute(\"aria-controls\");\r\n }\r\n\r\n return (\r\n <>\r\n <slot />\r\n {this.loading && this.showLoading ? (\r\n <div class=\"autosuggest-progress-box\">\r\n <dso-progress-indicator label={this.loadingLabel}></dso-progress-indicator>\r\n </div>\r\n ) : (\r\n showListbox && (\r\n <dso-scrollable\r\n class=\"listbox-container\"\r\n ref={(element) => (this.listboxContainer = element)}\r\n style={{ \"--max-block-size\": `${this.listboxContainerMaxBlockSize}px` }}\r\n >\r\n <div\r\n class=\"listbox\"\r\n role=\"listbox\"\r\n aria-live=\"polite\"\r\n id={this.listboxId}\r\n aria-labelledby={this.labelId}\r\n ref={(element) => (this.listbox = element)}\r\n tabindex=\"0\"\r\n >\r\n {(flat &&\r\n this.showSuggestions &&\r\n this.suggestions &&\r\n this.suggestions.map((suggestion) => (\r\n <Option\r\n id={this.listboxItemId(suggestion)}\r\n mouseEnter={() => this.selectSuggestion(suggestion)}\r\n mouseLeave={() => this.resetSelectedSuggestion()}\r\n click={() => this.pickSelectedValue()}\r\n selected={(suggestion === this.selectedSuggestion).toString()}\r\n suggestion={suggestion}\r\n ref={(element) => element && this.listboxItems.push(element)}\r\n markedSuggestion={this.getMarkedSuggestions(suggestion)}\r\n />\r\n ))) ||\r\n (grouped &&\r\n this.showSuggestions &&\r\n this.suggestions &&\r\n this.suggestions.map((suggestionGroup) => {\r\n const groupLabelId = v4();\r\n return (\r\n <div role=\"group\" class=\"group\" aria-labelledby={groupLabelId}>\r\n <div class=\"group-label\" role=\"presentation\" id={groupLabelId}>\r\n {suggestionGroup.groupLabel}\r\n </div>\r\n {suggestionGroup.suggestions.map((suggestion) => (\r\n <Option\r\n id={this.listboxGroupedItemId(suggestionGroup, suggestion)}\r\n mouseEnter={() => this.selectSuggestion(suggestion, suggestionGroup)}\r\n mouseLeave={() => this.resetSelectedSuggestion()}\r\n click={() => this.pickSelectedValue()}\r\n selected={(suggestion === this.selectedSuggestion).toString()}\r\n suggestion={suggestion}\r\n ref={(element) => element && this.listboxItems.push(element)}\r\n markedSuggestion={this.getMarkedSuggestions(suggestion)}\r\n />\r\n ))}\r\n </div>\r\n );\r\n })) ||\r\n (this.notFound && (\r\n <div class=\"option\">\r\n <span class=\"value\">\r\n {this.notFoundLabel ||\r\n this.showInputValueNotFound(this.text(\"notFound\", { inputValue: this.inputValue }))}\r\n </span>\r\n </div>\r\n ))}\r\n </div>\r\n </dso-scrollable>\r\n )\r\n )}\r\n </>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class OzonContentAbbrNode {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.name = "abbr";
|
|
5
|
+
}
|
|
6
|
+
render(node, { mapNodeToJsx }) {
|
|
7
|
+
const title = node.getAttribute("title");
|
|
8
|
+
return (h("span", { class: "od-abbr" }, h("abbr", null, mapNodeToJsx(node.childNodes)), title && ` (${title})`));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=abbr.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abbr.node.js","sourceRoot":"","sources":["../../../../../src/components/ozon-content/nodes/abbr.node.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAKlC,MAAM,OAAO,mBAAmB;IAAhC;QACE,SAAI,GAAG,MAAM,CAAC;IAYhB,CAAC;IAVC,MAAM,CAAC,IAAa,EAAE,EAAE,YAAY,EAA0B;QAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QAEzC,OAAO,CACL,YAAM,KAAK,EAAC,SAAS;YACnB,gBAAO,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAQ;YAC3C,KAAK,IAAI,KAAK,KAAK,GAAG,CAClB,CACR,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { h } from \"@stencil/core\";\r\n\r\nimport { OzonContentNode } from \"../ozon-content-node.interface\";\r\nimport { OzonContentNodeContext } from \"../ozon-content-node-context.interface\";\r\n\r\nexport class OzonContentAbbrNode implements OzonContentNode {\r\n name = \"abbr\";\r\n\r\n render(node: Element, { mapNodeToJsx }: OzonContentNodeContext) {\r\n const title = node.getAttribute(\"title\");\r\n\r\n return (\r\n <span class=\"od-abbr\">\r\n <abbr>{mapNodeToJsx(node.childNodes)}</abbr>\r\n {title && ` (${title})`}\r\n </span>\r\n );\r\n }\r\n}\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Fragment, h } from "@stencil/core";
|
|
2
2
|
import { getNodeName } from "./get-node-name.function";
|
|
3
|
+
import { OzonContentAbbrNode } from "./nodes/abbr.node";
|
|
3
4
|
import { OzonContentAlNode } from "./nodes/al.node";
|
|
4
5
|
import { OzonContentBronNode } from "./nodes/bron.node";
|
|
5
6
|
import { OzonContentDocumentNode } from "./nodes/document.node";
|
|
@@ -21,6 +22,7 @@ import { OzonContentVerwijderdeTekstNode } from "./nodes/verwijderde-tekst.node"
|
|
|
21
22
|
export class Mapper {
|
|
22
23
|
constructor() {
|
|
23
24
|
this.mappers = [
|
|
25
|
+
new OzonContentAbbrNode(),
|
|
24
26
|
new OzonContentTextNode(),
|
|
25
27
|
new OzonContentDocumentNode(),
|
|
26
28
|
new OzonContentInhoudNode(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ozon-content-mapper.js","sourceRoot":"","sources":["../../../../src/components/ozon-content/ozon-content-mapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAO,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM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get-node-name.function\";\r\nimport { OzonContentAlNode } from \"./nodes/al.node\";\r\nimport { OzonContentBronNode } from \"./nodes/bron.node\";\r\nimport { OzonContentDocumentNode } from \"./nodes/document.node\";\r\nimport { OzonContentExtRefNode } from \"./nodes/ext-ref.node\";\r\nimport { OzonContentFallbackNode } from \"./nodes/fallback.node\";\r\nimport { OzonContentFiguurNode } from \"./nodes/figuur.node\";\r\nimport { OzonContentInhoudNode } from \"./nodes/inhoud.node\";\r\nimport { OzonContentInlineTekstAfbeeldingNode } from \"./nodes/inline-tekst-afbeelding.node\";\r\nimport { OzonContentInlineNodes } from \"./nodes/inline.nodes\";\r\nimport { OzonContentIntIoRefNode } from \"./nodes/int-io-ref.node\";\r\nimport { OzonContentIntRefNode } from \"./nodes/int-ref.node\";\r\nimport { OzonContentLijstNode } from \"./nodes/lijst.node\";\r\nimport { OzonContentNieuweTekstNode } from \"./nodes/nieuwe-tekst.node\";\r\nimport { OzonContentNootNode } from \"./nodes/noot.node\";\r\nimport { OzonContentKopNode } from \"./nodes/kop.node\";\r\nimport { OzonContentTableNode } from \"./nodes/table.node\";\r\nimport { OzonContentTextNode } from \"./nodes/text.node\";\r\nimport { OzonContentVerwijderdeTekstNode } from \"./nodes/verwijderde-tekst.node\";\r\nimport { OzonContentContext } from \"./ozon-content-context.interface\";\r\nimport { OzonContentNode } from \"./ozon-content-node.interface\";\r\nimport { OzonContentInputType } from \"./ozon-content.interfaces\";\r\n\r\nexport class Mapper {\r\n private mappers: OzonContentNode[] = [\r\n new OzonContentTextNode(),\r\n new OzonContentDocumentNode(),\r\n new OzonContentInhoudNode(),\r\n new OzonContentKopNode(),\r\n new OzonContentIntRefNode(),\r\n new OzonContentExtRefNode(),\r\n new OzonContentAlNode(),\r\n new OzonContentInlineNodes(),\r\n new OzonContentInlineTekstAfbeeldingNode(),\r\n new OzonContentNootNode(),\r\n new OzonContentTableNode(),\r\n new OzonContentIntIoRefNode(),\r\n new OzonContentFiguurNode(),\r\n new OzonContentLijstNode(),\r\n new OzonContentBronNode(),\r\n new OzonContentNieuweTekstNode(),\r\n new OzonContentVerwijderdeTekstNode(),\r\n ];\r\n\r\n private skip = this.mappers.reduce<string[]>((t, m) => {\r\n if (m.handles) {\r\n t.push(...m.handles);\r\n }\r\n\r\n return t;\r\n }, []);\r\n\r\n private fallbackNode = new OzonContentFallbackNode();\r\n\r\n private domParser?: DOMParser;\r\n\r\n private findMapper(name: string): OzonContentNode | undefined {\r\n if (this.skip.includes(name)) {\r\n return undefined;\r\n }\r\n\r\n return (\r\n this.mappers.find((m) => {\r\n if (Array.isArray(m.name)) {\r\n return m.name.includes(name);\r\n }\r\n\r\n return m.name === name;\r\n }) ?? this.fallbackNode\r\n );\r\n }\r\n\r\n mapNodeToJsx(node: Node | Node[] | NodeList, context: OzonContentContext, path: Node[]): JSX.Element {\r\n if (node instanceof NodeList) {\r\n return (\r\n <Fragment>\r\n {Array.from(node).map((n, index) => {\r\n return (\r\n <>\r\n {context.addSpaceBeforeNode && index > 0 && \" \"}\r\n {this.mapNodeToJsx(n, context, path)}\r\n </>\r\n );\r\n })}\r\n </Fragment>\r\n );\r\n }\r\n\r\n if (Array.isArray(node)) {\r\n return (\r\n <Fragment>\r\n {node.map((n, index) => {\r\n return (\r\n <>\r\n {context.addSpaceBeforeNode && index > 0 && \" \"}\r\n {this.mapNodeToJsx(n, context, path)}\r\n </>\r\n );\r\n })}\r\n </Fragment>\r\n );\r\n }\r\n\r\n const nodeName = getNodeName(node);\r\n const mapper = this.findMapper(nodeName);\r\n if (!mapper) {\r\n return <Fragment />;\r\n }\r\n\r\n const identity = mapper.identify?.(node);\r\n\r\n const state = identity ? context.state[identity] : undefined;\r\n const setState = identity ? (s: unknown) => context.setState({ ...context.state, [identity]: s }) : undefined;\r\n\r\n return mapper.render(node, {\r\n inline: context.inline,\r\n mark: context.mark,\r\n mapNodeToJsx: (n) => this.mapNodeToJsx(n, context, [...path, node]),\r\n emitAnchorClick: context.emitAnchorClick,\r\n setState,\r\n emitMarkItemHighlight: context.emitMarkItemHighlight,\r\n state,\r\n path,\r\n });\r\n }\r\n\r\n transform(input: OzonContentInputType | undefined, context: OzonContentContext): JSX.Element {\r\n if (!input) {\r\n return <Fragment />;\r\n }\r\n\r\n const document = this.inputToXmlDocument(input);\r\n if (document.querySelector(\"parsererror\")) {\r\n console.error({\r\n message: \"[DSO Toolkit: Ozon Content Mapper] Unable to parse XML\",\r\n context,\r\n input,\r\n document,\r\n });\r\n\r\n return <Fragment />;\r\n }\r\n\r\n return this.mapNodeToJsx(document.getRootNode(), context, []);\r\n }\r\n\r\n private inputToXmlDocument(input: OzonContentInputType): XMLDocument {\r\n if (input instanceof XMLDocument) {\r\n return input;\r\n }\r\n\r\n if (typeof input === \"string\") {\r\n this.domParser ??= new DOMParser();\r\n\r\n return this.domParser.parseFromString(input, \"text/xml\");\r\n }\r\n\r\n return document.implementation.createDocument(null, null);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"ozon-content-mapper.js","sourceRoot":"","sources":["../../../../src/components/ozon-content/ozon-content-mapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAO,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAA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B;YACpD,KAAK;YACL,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,SAAS,CAAC,KAAuC,EAAE,OAA2B;QAC5E,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,EAAC,QAAQ,OAAG,CAAC;QACtB,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC;YAC1C,OAAO,CAAC,KAAK,CAAC;gBACZ,OAAO,EAAE,wDAAwD;gBACjE,OAAO;gBACP,KAAK;gBACL,QAAQ;aACT,CAAC,CAAC;YAEH,OAAO,EAAC,QAAQ,OAAG,CAAC;QACtB,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IAChE,CAAC;IAEO,kBAAkB,CAAC,KAA2B;;QACpD,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;YACjC,OAAO,KAAK,CAAC;QACf,CAAC;QAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAC9B,MAAA,IAAI,CAAC,SAAS,oCAAd,IAAI,CAAC,SAAS,GAAK,IAAI,SAAS,EAAE,EAAC;YAEnC,OAAO,IAAI,CAAC,SAAS,CAAC,eAAe,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,QAAQ,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;CACF","sourcesContent":["import { Fragment, h, JSX } from \"@stencil/core\";\r\n\r\nimport { getNodeName } from \"./get-node-name.function\";\r\nimport { OzonContentAbbrNode } from \"./nodes/abbr.node\";\r\nimport { OzonContentAlNode } from \"./nodes/al.node\";\r\nimport { OzonContentBronNode } from \"./nodes/bron.node\";\r\nimport { OzonContentDocumentNode } from \"./nodes/document.node\";\r\nimport { OzonContentExtRefNode } from \"./nodes/ext-ref.node\";\r\nimport { OzonContentFallbackNode } from \"./nodes/fallback.node\";\r\nimport { OzonContentFiguurNode } from \"./nodes/figuur.node\";\r\nimport { OzonContentInhoudNode } from \"./nodes/inhoud.node\";\r\nimport { OzonContentInlineTekstAfbeeldingNode } from \"./nodes/inline-tekst-afbeelding.node\";\r\nimport { OzonContentInlineNodes } from \"./nodes/inline.nodes\";\r\nimport { OzonContentIntIoRefNode } from \"./nodes/int-io-ref.node\";\r\nimport { OzonContentIntRefNode } from \"./nodes/int-ref.node\";\r\nimport { OzonContentLijstNode } from \"./nodes/lijst.node\";\r\nimport { OzonContentNieuweTekstNode } from \"./nodes/nieuwe-tekst.node\";\r\nimport { OzonContentNootNode } from \"./nodes/noot.node\";\r\nimport { OzonContentKopNode } from \"./nodes/kop.node\";\r\nimport { OzonContentTableNode } from \"./nodes/table.node\";\r\nimport { OzonContentTextNode } from \"./nodes/text.node\";\r\nimport { OzonContentVerwijderdeTekstNode } from \"./nodes/verwijderde-tekst.node\";\r\nimport { OzonContentContext } from \"./ozon-content-context.interface\";\r\nimport { OzonContentNode } from \"./ozon-content-node.interface\";\r\nimport { OzonContentInputType } from \"./ozon-content.interfaces\";\r\n\r\nexport class Mapper {\r\n private mappers: OzonContentNode[] = [\r\n new OzonContentAbbrNode(),\r\n new OzonContentTextNode(),\r\n new OzonContentDocumentNode(),\r\n new OzonContentInhoudNode(),\r\n new OzonContentKopNode(),\r\n new OzonContentIntRefNode(),\r\n new OzonContentExtRefNode(),\r\n new OzonContentAlNode(),\r\n new OzonContentInlineNodes(),\r\n new OzonContentInlineTekstAfbeeldingNode(),\r\n new OzonContentNootNode(),\r\n new OzonContentTableNode(),\r\n new OzonContentIntIoRefNode(),\r\n new OzonContentFiguurNode(),\r\n new OzonContentLijstNode(),\r\n new OzonContentBronNode(),\r\n new OzonContentNieuweTekstNode(),\r\n new OzonContentVerwijderdeTekstNode(),\r\n ];\r\n\r\n private skip = this.mappers.reduce<string[]>((t, m) => {\r\n if (m.handles) {\r\n t.push(...m.handles);\r\n }\r\n\r\n return t;\r\n }, []);\r\n\r\n private fallbackNode = new OzonContentFallbackNode();\r\n\r\n private domParser?: DOMParser;\r\n\r\n private findMapper(name: string): OzonContentNode | undefined {\r\n if (this.skip.includes(name)) {\r\n return undefined;\r\n }\r\n\r\n return (\r\n this.mappers.find((m) => {\r\n if (Array.isArray(m.name)) {\r\n return m.name.includes(name);\r\n }\r\n\r\n return m.name === name;\r\n }) ?? this.fallbackNode\r\n );\r\n }\r\n\r\n mapNodeToJsx(node: Node | Node[] | NodeList, context: OzonContentContext, path: Node[]): JSX.Element {\r\n if (node instanceof NodeList) {\r\n return (\r\n <Fragment>\r\n {Array.from(node).map((n, index) => {\r\n return (\r\n <>\r\n {context.addSpaceBeforeNode && index > 0 && \" \"}\r\n {this.mapNodeToJsx(n, context, path)}\r\n </>\r\n );\r\n })}\r\n </Fragment>\r\n );\r\n }\r\n\r\n if (Array.isArray(node)) {\r\n return (\r\n <Fragment>\r\n {node.map((n, index) => {\r\n return (\r\n <>\r\n {context.addSpaceBeforeNode && index > 0 && \" \"}\r\n {this.mapNodeToJsx(n, context, path)}\r\n </>\r\n );\r\n })}\r\n </Fragment>\r\n );\r\n }\r\n\r\n const nodeName = getNodeName(node);\r\n const mapper = this.findMapper(nodeName);\r\n if (!mapper) {\r\n return <Fragment />;\r\n }\r\n\r\n const identity = mapper.identify?.(node);\r\n\r\n const state = identity ? context.state[identity] : undefined;\r\n const setState = identity ? (s: unknown) => context.setState({ ...context.state, [identity]: s }) : undefined;\r\n\r\n return mapper.render(node, {\r\n inline: context.inline,\r\n mark: context.mark,\r\n mapNodeToJsx: (n) => this.mapNodeToJsx(n, context, [...path, node]),\r\n emitAnchorClick: context.emitAnchorClick,\r\n setState,\r\n emitMarkItemHighlight: context.emitMarkItemHighlight,\r\n state,\r\n path,\r\n });\r\n }\r\n\r\n transform(input: OzonContentInputType | undefined, context: OzonContentContext): JSX.Element {\r\n if (!input) {\r\n return <Fragment />;\r\n }\r\n\r\n const document = this.inputToXmlDocument(input);\r\n if (document.querySelector(\"parsererror\")) {\r\n console.error({\r\n message: \"[DSO Toolkit: Ozon Content Mapper] Unable to parse XML\",\r\n context,\r\n input,\r\n document,\r\n });\r\n\r\n return <Fragment />;\r\n }\r\n\r\n return this.mapNodeToJsx(document.getRootNode(), context, []);\r\n }\r\n\r\n private inputToXmlDocument(input: OzonContentInputType): XMLDocument {\r\n if (input instanceof XMLDocument) {\r\n return input;\r\n }\r\n\r\n if (typeof input === \"string\") {\r\n this.domParser ??= new DOMParser();\r\n\r\n return this.domParser.parseFromString(input, \"text/xml\");\r\n }\r\n\r\n return document.implementation.createDocument(null, null);\r\n }\r\n}\r\n"]}
|