@nova-design-system/nova-webcomponents 3.0.0-beta.34 → 3.0.0-beta.35
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/blazor-docs.json +1402 -175
- package/dist/cjs/index-ddc37f87.js +12 -12
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/native.cjs.js +1 -1
- package/dist/cjs/{nv-badge.cjs.entry.js → nv-badge_2.cjs.entry.js} +43 -1
- package/dist/cjs/nv-badge_2.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js +1067 -0
- package/dist/cjs/nv-fieldmultiselect.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-fieldnumber.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldpassword.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldradio.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldselect.cjs.entry.js +5 -5
- package/dist/cjs/nv-fieldtext.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldtextarea.cjs.entry.js +3 -3
- package/dist/cjs/nv-fieldtoggle.cjs.entry.js +2 -2
- package/dist/cjs/nv-icon.cjs.entry.js +1 -1
- package/dist/cjs/{nv-iconbutton.cjs.entry.js → nv-iconbutton_2.cjs.entry.js} +28 -2
- package/dist/cjs/nv-iconbutton_2.cjs.entry.js.map +1 -0
- package/dist/cjs/nv-menu.cjs.entry.js +1 -1
- package/dist/cjs/nv-menuitem.cjs.entry.js +1 -1
- package/dist/cjs/nv-popover.cjs.entry.js +1 -1
- package/dist/cjs/nv-row.cjs.entry.js +1 -1
- package/dist/cjs/nv-stack.cjs.entry.js +1 -1
- package/dist/cjs/nv-table.cjs.entry.js +2 -2
- package/dist/cjs/nv-tablebody.cjs.entry.js +1 -1
- package/dist/cjs/nv-tablecolumn.cjs.entry.js +1 -1
- package/dist/cjs/nv-tabledatacell.cjs.entry.js +1 -1
- package/dist/cjs/nv-tablehead.cjs.entry.js +1 -1
- package/dist/cjs/nv-tablerow.cjs.entry.js +1 -1
- package/dist/cjs/nv-tooltip.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.css +12 -0
- package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.docs.js +6 -0
- package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.docs.js.map +1 -0
- package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.js +185 -0
- package/dist/collection/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.js.map +1 -0
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.css +204 -0
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.js +249 -0
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.js.map +1 -0
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js +1651 -0
- package/dist/collection/components/nv-fieldmultiselect/nv-fieldmultiselect.js.map +1 -0
- package/dist/collection/components/nv-fieldnumber/nv-fieldnumber.js +3 -3
- package/dist/collection/components/nv-fieldpassword/nv-fieldpassword.js +3 -3
- package/dist/collection/components/nv-fieldradio/nv-fieldradio.js +3 -3
- package/dist/collection/components/nv-fieldselect/nv-fieldselect.js +5 -5
- package/dist/collection/components/nv-fieldtext/nv-fieldtext.js +3 -3
- package/dist/collection/components/nv-fieldtextarea/nv-fieldtextarea.js +3 -3
- package/dist/collection/components/nv-fieldtoggle/nv-fieldtoggle.js +2 -2
- package/dist/collection/components/nv-icon/nv-icon.js +1 -1
- package/dist/collection/components/nv-iconbutton/nv-iconbutton.js +1 -1
- package/dist/collection/components/nv-loader/nv-loader.js +1 -1
- package/dist/collection/components/nv-menu/nv-menu.js +1 -1
- package/dist/collection/components/nv-menuitem/nv-menuitem.js +1 -1
- package/dist/collection/components/nv-popover/nv-popover.js +1 -1
- package/dist/collection/components/nv-row/nv-row.js +1 -1
- package/dist/collection/components/nv-stack/nv-stack.js +1 -1
- package/dist/collection/components/nv-table/nv-table.js +2 -2
- package/dist/collection/components/nv-tablebody/nv-tablebody.js +1 -1
- package/dist/collection/components/nv-tablecolumn/nv-tablecolumn.js +1 -1
- package/dist/collection/components/nv-tabledatacell/nv-tabledatacell.js +1 -1
- package/dist/collection/components/nv-tablehead/nv-tablehead.js +1 -1
- package/dist/collection/components/nv-tablerow/nv-tablerow.js +1 -1
- package/dist/collection/components/nv-tooltip/nv-tooltip.js +1 -1
- package/dist/components/nv-alert.js +1 -1
- package/dist/components/nv-avatar.js +1 -1
- package/dist/components/nv-badge.js +1 -173
- package/dist/components/nv-badge.js.map +1 -1
- package/dist/components/nv-breadcrumb.js +3 -3
- package/dist/components/nv-button.js +1 -1
- package/dist/components/nv-fieldcheckbox.js +1 -152
- package/dist/components/nv-fieldcheckbox.js.map +1 -1
- package/dist/components/nv-fielddropdown.js +5 -5
- package/dist/components/nv-fielddropdownitem.js +1 -1
- package/dist/components/nv-fielddropdownitemcheck.d.ts +11 -0
- package/dist/components/nv-fielddropdownitemcheck.js +8 -0
- package/dist/components/nv-fielddropdownitemcheck.js.map +1 -0
- package/dist/components/nv-fieldmultiselect.d.ts +11 -0
- package/dist/components/nv-fieldmultiselect.js +1159 -0
- package/dist/components/nv-fieldmultiselect.js.map +1 -0
- package/dist/components/nv-fieldnumber.js +4 -4
- package/dist/components/nv-fieldpassword.js +6 -6
- package/dist/components/nv-fieldradio.js +3 -3
- package/dist/components/nv-fieldselect.js +6 -6
- package/dist/components/nv-fieldtext.js +4 -4
- package/dist/components/nv-fieldtextarea.js +3 -3
- package/dist/components/nv-fieldtoggle.js +2 -2
- package/dist/components/nv-icon.js +1 -1
- package/dist/components/nv-iconbutton.js +1 -1
- package/dist/components/nv-loader.js +1 -1
- package/dist/components/nv-menu.js +2 -2
- package/dist/components/nv-menuitem.js +2 -2
- package/dist/components/nv-popover.js +1 -1
- package/dist/components/nv-row.js +1 -1
- package/dist/components/nv-stack.js +1 -1
- package/dist/components/nv-table.js +2 -2
- package/dist/components/nv-tablebody.js +1 -1
- package/dist/components/nv-tablecolumn.js +1 -1
- package/dist/components/nv-tabledatacell.js +1 -1
- package/dist/components/nv-tablehead.js +1 -1
- package/dist/components/nv-tablerow.js +1 -1
- package/dist/components/nv-tooltip.js +1 -1
- package/dist/components/{p-b7462fc2.js → p-0b30dd1b.js} +2 -2
- package/dist/components/{p-b7462fc2.js.map → p-0b30dd1b.js.map} +1 -1
- package/dist/{esm/nv-badge.entry.js → components/p-2abfadb8.js} +48 -12
- package/dist/components/p-2abfadb8.js.map +1 -0
- package/dist/components/{p-a61d9ce8.js → p-5b98036c.js} +2 -2
- package/dist/components/{p-a61d9ce8.js.map → p-5b98036c.js.map} +1 -1
- package/dist/components/p-63afc71f.js +74 -0
- package/dist/components/p-63afc71f.js.map +1 -0
- package/dist/components/{p-ce67d70c.js → p-78e7c594.js} +2 -2
- package/dist/components/{p-ce67d70c.js.map → p-78e7c594.js.map} +1 -1
- package/dist/components/{p-09a2a880.js → p-7a19fef7.js} +2 -2
- package/dist/components/{p-09a2a880.js.map → p-7a19fef7.js.map} +1 -1
- package/dist/components/{p-e7131c30.js → p-7c0db67e.js} +3 -3
- package/dist/components/{p-e7131c30.js.map → p-7c0db67e.js.map} +1 -1
- package/dist/components/p-afa1c98e.js +156 -0
- package/dist/components/p-afa1c98e.js.map +1 -0
- package/dist/components/{p-0cdf2cc7.js → p-d3b1c116.js} +4 -4
- package/dist/components/{p-0cdf2cc7.js.map → p-d3b1c116.js.map} +1 -1
- package/dist/docs.json +1394 -183
- package/dist/esm/index-cd557d0a.js +12 -12
- package/dist/esm/loader.js +1 -1
- package/dist/esm/native.js +1 -1
- package/dist/esm/nv-badge_2.entry.js +182 -0
- package/dist/esm/nv-badge_2.entry.js.map +1 -0
- package/dist/esm/nv-fieldmultiselect.entry.js +1063 -0
- package/dist/esm/nv-fieldmultiselect.entry.js.map +1 -0
- package/dist/esm/nv-fieldnumber.entry.js +3 -3
- package/dist/esm/nv-fieldpassword.entry.js +3 -3
- package/dist/esm/nv-fieldradio.entry.js +3 -3
- package/dist/esm/nv-fieldselect.entry.js +5 -5
- package/dist/esm/nv-fieldtext.entry.js +3 -3
- package/dist/esm/nv-fieldtextarea.entry.js +3 -3
- package/dist/esm/nv-fieldtoggle.entry.js +2 -2
- package/dist/esm/nv-icon.entry.js +1 -1
- package/dist/esm/{nv-iconbutton.entry.js → nv-iconbutton_2.entry.js} +28 -3
- package/dist/esm/nv-iconbutton_2.entry.js.map +1 -0
- package/dist/esm/nv-menu.entry.js +1 -1
- package/dist/esm/nv-menuitem.entry.js +1 -1
- package/dist/esm/nv-popover.entry.js +1 -1
- package/dist/esm/nv-row.entry.js +1 -1
- package/dist/esm/nv-stack.entry.js +1 -1
- package/dist/esm/nv-table.entry.js +2 -2
- package/dist/esm/nv-tablebody.entry.js +1 -1
- package/dist/esm/nv-tablecolumn.entry.js +1 -1
- package/dist/esm/nv-tabledatacell.entry.js +1 -1
- package/dist/esm/nv-tablehead.entry.js +1 -1
- package/dist/esm/nv-tablerow.entry.js +1 -1
- package/dist/esm/nv-tooltip.entry.js +1 -1
- package/dist/native/native.css +1 -1
- package/dist/native/native.esm.js +1 -1
- package/dist/native/native.esm.js.map +1 -1
- package/dist/native/{p-b902c7c0.entry.js → p-0a9a738c.entry.js} +2 -2
- package/dist/native/{p-f1545844.entry.js → p-18b227b5.entry.js} +2 -2
- package/dist/native/p-18b227b5.entry.js.map +1 -0
- package/dist/native/{p-3e9521a0.entry.js → p-1e2bd4e3.entry.js} +2 -2
- package/dist/native/p-225962f2.entry.js +2 -0
- package/dist/native/{p-bbc45099.entry.js.map → p-225962f2.entry.js.map} +1 -1
- package/dist/native/{p-f2ea8aa9.entry.js → p-3283505f.entry.js} +2 -2
- package/dist/native/{p-c59e3500.entry.js → p-3adf0c45.entry.js} +2 -2
- package/dist/native/{p-0710efd7.entry.js → p-4e056cd8.entry.js} +2 -2
- package/dist/native/p-4ffd5c51.entry.js +2 -0
- package/dist/native/{p-6c1b9c89.entry.js.map → p-4ffd5c51.entry.js.map} +1 -1
- package/dist/native/{p-ee78addb.entry.js → p-552e7ea4.entry.js} +2 -2
- package/dist/native/{p-74778f5f.entry.js → p-575ea40b.entry.js} +2 -2
- package/dist/native/p-5f160072.entry.js +2 -0
- package/dist/native/{p-10a06059.entry.js → p-6bb2c88f.entry.js} +2 -2
- package/dist/native/{p-e56d3715.entry.js → p-6ea62d17.entry.js} +2 -2
- package/dist/native/{p-45aa0c68.entry.js → p-788712dd.entry.js} +2 -2
- package/dist/native/{p-9cef006d.entry.js → p-7dfb4a60.entry.js} +2 -2
- package/dist/native/p-826f1d28.entry.js +2 -0
- package/dist/native/p-826f1d28.entry.js.map +1 -0
- package/dist/native/p-8ae9aaf1.entry.js +2 -0
- package/dist/native/p-967f1aee.entry.js +2 -0
- package/dist/native/p-967f1aee.entry.js.map +1 -0
- package/dist/native/{p-f4ecacf6.entry.js → p-cd251f91.entry.js} +2 -2
- package/dist/native/p-e8d181e6.entry.js +2 -0
- package/dist/native/{p-e390557d.entry.js → p-ed825c80.entry.js} +2 -2
- package/dist/native/{p-d0f83d1f.entry.js → p-f79752ca.entry.js} +2 -2
- package/dist/native/p-fc8cad13.entry.js +2 -0
- package/dist/types/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.d.ts +56 -0
- package/dist/types/components/nv-fielddropdownitemcheck/nv-fielddropdownitemcheck.docs.d.ts +4 -0
- package/dist/types/components/nv-fieldmultiselect/nv-fieldmultiselect.d.ts +404 -0
- package/dist/types/components/nv-fieldmultiselect/nv-fieldmultiselect.docs.d.ts +4 -0
- package/dist/types/components.d.ts +329 -0
- package/dist/vscode-data.json +324 -0
- package/hydrate/index.js +1201 -38
- package/hydrate/index.mjs +1201 -38
- package/package.json +10 -2
- package/dist/cjs/nv-badge.cjs.entry.js.map +0 -1
- package/dist/cjs/nv-iconbutton.cjs.entry.js.map +0 -1
- package/dist/cjs/nv-loader.cjs.entry.js +0 -35
- package/dist/cjs/nv-loader.cjs.entry.js.map +0 -1
- package/dist/esm/nv-badge.entry.js.map +0 -1
- package/dist/esm/nv-iconbutton.entry.js.map +0 -1
- package/dist/esm/nv-loader.entry.js +0 -31
- package/dist/esm/nv-loader.entry.js.map +0 -1
- package/dist/native/p-132b8588.entry.js +0 -2
- package/dist/native/p-132b8588.entry.js.map +0 -1
- package/dist/native/p-5d67a825.entry.js +0 -2
- package/dist/native/p-6c1b9c89.entry.js +0 -2
- package/dist/native/p-907c3eda.entry.js +0 -2
- package/dist/native/p-91d4b4d7.entry.js +0 -2
- package/dist/native/p-a9b6461b.entry.js +0 -2
- package/dist/native/p-a9b6461b.entry.js.map +0 -1
- package/dist/native/p-bbc45099.entry.js +0 -2
- package/dist/native/p-f1545844.entry.js.map +0 -1
- package/dist/native/p-f42e87b5.entry.js +0 -2
- /package/dist/native/{p-b902c7c0.entry.js.map → p-0a9a738c.entry.js.map} +0 -0
- /package/dist/native/{p-3e9521a0.entry.js.map → p-1e2bd4e3.entry.js.map} +0 -0
- /package/dist/native/{p-f2ea8aa9.entry.js.map → p-3283505f.entry.js.map} +0 -0
- /package/dist/native/{p-c59e3500.entry.js.map → p-3adf0c45.entry.js.map} +0 -0
- /package/dist/native/{p-0710efd7.entry.js.map → p-4e056cd8.entry.js.map} +0 -0
- /package/dist/native/{p-ee78addb.entry.js.map → p-552e7ea4.entry.js.map} +0 -0
- /package/dist/native/{p-74778f5f.entry.js.map → p-575ea40b.entry.js.map} +0 -0
- /package/dist/native/{p-5d67a825.entry.js.map → p-5f160072.entry.js.map} +0 -0
- /package/dist/native/{p-10a06059.entry.js.map → p-6bb2c88f.entry.js.map} +0 -0
- /package/dist/native/{p-e56d3715.entry.js.map → p-6ea62d17.entry.js.map} +0 -0
- /package/dist/native/{p-45aa0c68.entry.js.map → p-788712dd.entry.js.map} +0 -0
- /package/dist/native/{p-9cef006d.entry.js.map → p-7dfb4a60.entry.js.map} +0 -0
- /package/dist/native/{p-907c3eda.entry.js.map → p-8ae9aaf1.entry.js.map} +0 -0
- /package/dist/native/{p-f4ecacf6.entry.js.map → p-cd251f91.entry.js.map} +0 -0
- /package/dist/native/{p-f42e87b5.entry.js.map → p-e8d181e6.entry.js.map} +0 -0
- /package/dist/native/{p-e390557d.entry.js.map → p-ed825c80.entry.js.map} +0 -0
- /package/dist/native/{p-d0f83d1f.entry.js.map → p-f79752ca.entry.js.map} +0 -0
- /package/dist/native/{p-91d4b4d7.entry.js.map → p-fc8cad13.entry.js.map} +0 -0
|
@@ -0,0 +1,1651 @@
|
|
|
1
|
+
import { Host, h, } from "@stencil/core";
|
|
2
|
+
import { v4 as uuidv4 } from "uuid";
|
|
3
|
+
/**
|
|
4
|
+
* @slot content - The content of the list.
|
|
5
|
+
* @slot leading-input - Content to be placed before the input text, within the input container.
|
|
6
|
+
* @slot before-input - Content to be placed before the input text, outside the input container.
|
|
7
|
+
* @slot after-input - Content to be placed after the input text, outside the input container.
|
|
8
|
+
* @slot label - Content to be placed as the label, will override the label prop.
|
|
9
|
+
* @slot description - Content to be placed as the description, will override the description prop.
|
|
10
|
+
* @slot error-description - Content to be placed as the error description, will override the errorDescription prop.
|
|
11
|
+
*/
|
|
12
|
+
export class NvFieldmultiselect {
|
|
13
|
+
constructor() {
|
|
14
|
+
/****************************************************************************/
|
|
15
|
+
//#region PROPERTIES
|
|
16
|
+
/**
|
|
17
|
+
* Sets the ID for the input element and the for attribute of the associated
|
|
18
|
+
* label. If no ID is provided, a random one will be automatically generated
|
|
19
|
+
* to ensure unique identification, facilitating proper label association and
|
|
20
|
+
* accessibility.
|
|
21
|
+
*/
|
|
22
|
+
this.inputId = uuidv4();
|
|
23
|
+
/**
|
|
24
|
+
* Defines the maximum height of the multiselect list when open.
|
|
25
|
+
*/
|
|
26
|
+
this.maxHeight = '200px';
|
|
27
|
+
/**
|
|
28
|
+
* Text for the badge showing the number of selected items.
|
|
29
|
+
*/
|
|
30
|
+
this.badgeLabel = '';
|
|
31
|
+
/**
|
|
32
|
+
* The text to display when no items match the filter.
|
|
33
|
+
*/
|
|
34
|
+
this.emptyresult = 'No results found';
|
|
35
|
+
/**
|
|
36
|
+
* Marks the input field as required.
|
|
37
|
+
*/
|
|
38
|
+
this.required = false;
|
|
39
|
+
/**
|
|
40
|
+
* Alters the input field's appearance to indicate an error.
|
|
41
|
+
*/
|
|
42
|
+
this.error = false;
|
|
43
|
+
/**
|
|
44
|
+
* Display the input field's content without allowing users to change it.
|
|
45
|
+
*/
|
|
46
|
+
this.readonly = false;
|
|
47
|
+
/**
|
|
48
|
+
* Disables the input field.
|
|
49
|
+
*/
|
|
50
|
+
this.disabled = false;
|
|
51
|
+
/**
|
|
52
|
+
* The autocomplete prop for faster input filling.
|
|
53
|
+
*/
|
|
54
|
+
this.autocomplete = 'off';
|
|
55
|
+
/**
|
|
56
|
+
* Enables or disables the filtering feature for the multiselect items.
|
|
57
|
+
*/
|
|
58
|
+
this.filterable = false;
|
|
59
|
+
/**
|
|
60
|
+
* State of the multiselect popover.
|
|
61
|
+
*/
|
|
62
|
+
this.open = false;
|
|
63
|
+
/**
|
|
64
|
+
* Options configuration for the multiselect items.
|
|
65
|
+
*/
|
|
66
|
+
this.parsedOptions = [];
|
|
67
|
+
/**
|
|
68
|
+
* List of selected values in the multiselect.
|
|
69
|
+
*/
|
|
70
|
+
this.selectedValues = [];
|
|
71
|
+
/**
|
|
72
|
+
* Sorted options for display.
|
|
73
|
+
*/
|
|
74
|
+
this.sortedOptions = [];
|
|
75
|
+
/**
|
|
76
|
+
* The text entered by the user for filtering multiselect items.
|
|
77
|
+
*/
|
|
78
|
+
this.filterText = '';
|
|
79
|
+
/**
|
|
80
|
+
* Determines whether the multiselect is filterable.
|
|
81
|
+
*/
|
|
82
|
+
this.isFilterable = this.filterable;
|
|
83
|
+
/**
|
|
84
|
+
* Delay in milliseconds before the search is triggered when typing in the filter input.
|
|
85
|
+
* @default 300
|
|
86
|
+
*/
|
|
87
|
+
this.debounceDelay = 300;
|
|
88
|
+
/**
|
|
89
|
+
* State for the mode of the multiselect.
|
|
90
|
+
* @type {'options' | 'slots'}
|
|
91
|
+
* @default 'options'
|
|
92
|
+
*/
|
|
93
|
+
this.modeState = 'options'; // Default value
|
|
94
|
+
this.isHandlingEscape = false;
|
|
95
|
+
/**x
|
|
96
|
+
* Handle badge close for options mode.
|
|
97
|
+
*/
|
|
98
|
+
this.handleBadgeCloseOptions = () => {
|
|
99
|
+
this.selectedValues = [];
|
|
100
|
+
this.multiselectChange.emit(this.selectedValues);
|
|
101
|
+
// Uncheck all elements
|
|
102
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
103
|
+
items.forEach(item => {
|
|
104
|
+
item.checked = false;
|
|
105
|
+
item.style.display = '';
|
|
106
|
+
});
|
|
107
|
+
// Reorder options without the divider since there are no selected elements
|
|
108
|
+
this.parsedOptions = this.parsedOptions.filter(option => !option.isDivider);
|
|
109
|
+
// Reorder options without the divider since there are no selected elements
|
|
110
|
+
this.reorderOptionsContent();
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Handle badge close for slots mode.
|
|
114
|
+
*/
|
|
115
|
+
this.handleBadgeCloseSlots = () => {
|
|
116
|
+
this.selectedValues = [];
|
|
117
|
+
this.multiselectChange.emit(this.selectedValues);
|
|
118
|
+
// Uncheck all elements
|
|
119
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
120
|
+
items.forEach(item => {
|
|
121
|
+
item.checked = false;
|
|
122
|
+
item.style.display = '';
|
|
123
|
+
});
|
|
124
|
+
// Reorder slot content
|
|
125
|
+
this.reorderSlotContent();
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Handle popover close
|
|
129
|
+
*/
|
|
130
|
+
this.handlePopoverClose = () => {
|
|
131
|
+
// If we are handling Escape, ignore this event
|
|
132
|
+
if (this.isHandlingEscape) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this.open = false;
|
|
136
|
+
this.filterText = '';
|
|
137
|
+
// Only reorder based on the mode
|
|
138
|
+
if (this.modeState === 'options') {
|
|
139
|
+
this.reorderOptionsContent();
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
this.reorderSlotContent();
|
|
143
|
+
}
|
|
144
|
+
// Reset filter if needed
|
|
145
|
+
if (this.filterable) {
|
|
146
|
+
this.resetFilter();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Handle input blur for options mode.
|
|
151
|
+
*/
|
|
152
|
+
this.handleInputBlurOptions = () => {
|
|
153
|
+
setTimeout(() => {
|
|
154
|
+
if (!this.el.contains(document.activeElement)) {
|
|
155
|
+
// Close the popover without affecting the divider
|
|
156
|
+
this.open = false;
|
|
157
|
+
this.popoverElement.hide();
|
|
158
|
+
// Reset filter if needed
|
|
159
|
+
if (this.filterable) {
|
|
160
|
+
this.filterText = '';
|
|
161
|
+
this.resetFilter();
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}, 150);
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Handle click on the input container for options mode.
|
|
168
|
+
* @param {MouseEvent} event - The click event.
|
|
169
|
+
*/
|
|
170
|
+
this.handleInputContainerClickOptions = (event) => {
|
|
171
|
+
if (this.disabled || this.readonly) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const target = event.target;
|
|
175
|
+
if (target.tagName === 'P' || target.tagName === 'SPAN') {
|
|
176
|
+
this.open = true;
|
|
177
|
+
this.popoverElement.show();
|
|
178
|
+
const inputContainer = this.el.querySelector('.input-container');
|
|
179
|
+
if (inputContainer) {
|
|
180
|
+
inputContainer.classList.add('focus-within');
|
|
181
|
+
const removeFocusWithin = () => {
|
|
182
|
+
inputContainer.classList.remove('focus-within');
|
|
183
|
+
};
|
|
184
|
+
this.popoverElement.addEventListener('hide', removeFocusWithin);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Handle click on the input container for slots mode.
|
|
190
|
+
* @param {MouseEvent} event - The click event.
|
|
191
|
+
*/
|
|
192
|
+
this.handleInputContainerClickSlots = (event) => {
|
|
193
|
+
if (this.disabled || this.readonly) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
const target = event.target;
|
|
197
|
+
if (target.tagName === 'P' || target.tagName === 'SPAN') {
|
|
198
|
+
this.open = true;
|
|
199
|
+
this.popoverElement.show();
|
|
200
|
+
const inputContainer = this.el.querySelector('.input-container');
|
|
201
|
+
if (inputContainer) {
|
|
202
|
+
inputContainer.classList.add('focus-within');
|
|
203
|
+
const removeFocusWithin = () => {
|
|
204
|
+
inputContainer.classList.remove('focus-within');
|
|
205
|
+
};
|
|
206
|
+
this.popoverElement.addEventListener('hide', removeFocusWithin);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Handle input change for options mode.
|
|
212
|
+
* @param {Event} event - The input event.
|
|
213
|
+
*/
|
|
214
|
+
this.handleInputOptions = (event) => {
|
|
215
|
+
if (!this.filterable)
|
|
216
|
+
return;
|
|
217
|
+
if (this.disabled || this.readonly) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const input = event.target;
|
|
221
|
+
this.value = input.value;
|
|
222
|
+
this.valueChanged.emit(this.value);
|
|
223
|
+
// Clear any existing timer
|
|
224
|
+
if (this.debounceTimer) {
|
|
225
|
+
window.clearTimeout(this.debounceTimer);
|
|
226
|
+
}
|
|
227
|
+
// Set a new timer for filtering
|
|
228
|
+
this.debounceTimer = window.setTimeout(() => {
|
|
229
|
+
this.filterText = input.value.toLowerCase();
|
|
230
|
+
this.filterItemsOption();
|
|
231
|
+
}, this.debounceDelay);
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* Handle input change for slots mode
|
|
235
|
+
* @param {Event} event - The input event.
|
|
236
|
+
*/
|
|
237
|
+
this.handleInputSlots = (event) => {
|
|
238
|
+
if (!this.filterable)
|
|
239
|
+
return;
|
|
240
|
+
if (this.disabled || this.readonly)
|
|
241
|
+
return;
|
|
242
|
+
const input = event.target;
|
|
243
|
+
this.value = input.value;
|
|
244
|
+
this.valueChanged.emit(this.value);
|
|
245
|
+
// Clear any existing timer
|
|
246
|
+
if (this.debounceTimer) {
|
|
247
|
+
window.clearTimeout(this.debounceTimer);
|
|
248
|
+
}
|
|
249
|
+
// Set a new timer for filtering
|
|
250
|
+
this.debounceTimer = window.setTimeout(() => {
|
|
251
|
+
this.filterText = input.value.toLowerCase();
|
|
252
|
+
this.filterSlotsItems();
|
|
253
|
+
}, this.debounceDelay);
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Handle input focus for options mode.
|
|
257
|
+
*/
|
|
258
|
+
this.handleInputFocusOptions = () => {
|
|
259
|
+
if (this.disabled || this.readonly) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
this.open = true;
|
|
263
|
+
};
|
|
264
|
+
/**
|
|
265
|
+
* Handle input focus for slots mode.
|
|
266
|
+
*/
|
|
267
|
+
this.handleInputFocusSlots = () => {
|
|
268
|
+
if (this.disabled || this.readonly) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
this.open = true;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* Handle input blur for slots mode.
|
|
275
|
+
*/
|
|
276
|
+
this.handleInputBlurSlots = () => {
|
|
277
|
+
setTimeout(() => {
|
|
278
|
+
if (!this.el.contains(document.activeElement)) {
|
|
279
|
+
// Fermer le popover sans affecter le divider
|
|
280
|
+
this.open = false;
|
|
281
|
+
this.popoverElement.hide();
|
|
282
|
+
// Reset filter if needed
|
|
283
|
+
if (this.filterable) {
|
|
284
|
+
this.filterText = '';
|
|
285
|
+
this.resetFilter();
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}, 150);
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* Toggle the multiselect popover for options mode.
|
|
292
|
+
*/
|
|
293
|
+
this.togglePopoverOptions = () => {
|
|
294
|
+
if (this.disabled || this.readonly) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (this.open) {
|
|
298
|
+
this.handlePopoverClose();
|
|
299
|
+
}
|
|
300
|
+
else {
|
|
301
|
+
this.open = true;
|
|
302
|
+
this.popoverElement.show();
|
|
303
|
+
if (!this.filterable) {
|
|
304
|
+
this.focusFirstItem();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
/**
|
|
309
|
+
* Toggle the multiselect popover for slots mode.
|
|
310
|
+
*/
|
|
311
|
+
this.togglePopoverSlots = () => {
|
|
312
|
+
if (this.disabled || this.readonly) {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
if (this.open) {
|
|
316
|
+
this.handlePopoverClose();
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
this.open = true;
|
|
320
|
+
this.popoverElement.show();
|
|
321
|
+
if (!this.filterable) {
|
|
322
|
+
this.focusFirstItem();
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
//#endregion PROPERTIES
|
|
328
|
+
/****************************************************************************/
|
|
329
|
+
//#region LIFECYCLE
|
|
330
|
+
/**
|
|
331
|
+
* Subscribe to click outside event.
|
|
332
|
+
*/
|
|
333
|
+
connectedCallback() {
|
|
334
|
+
document.addEventListener('click', this.handleClickOutside.bind(this));
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Set the mode state and handle options change.
|
|
338
|
+
*/
|
|
339
|
+
componentWillLoad() {
|
|
340
|
+
this.modeState = this.mode;
|
|
341
|
+
// Don't call handleOptionsChange if we are in slots mode
|
|
342
|
+
if (this.modeState === 'options') {
|
|
343
|
+
this.handleOptionsChange(this.options);
|
|
344
|
+
}
|
|
345
|
+
// Add the listener for the hide event
|
|
346
|
+
requestAnimationFrame(() => {
|
|
347
|
+
if (this.popoverElement) {
|
|
348
|
+
this.popoverElement.addEventListener('hide', () => {
|
|
349
|
+
this.handlePopoverClose();
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
// Specific initialization for slots mode
|
|
354
|
+
if (this.modeState === 'slots') {
|
|
355
|
+
Promise.resolve().then(() => {
|
|
356
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
357
|
+
// Initialize selectedValues with checked items
|
|
358
|
+
this.selectedValues = items
|
|
359
|
+
.filter(item => item.hasAttribute('checked'))
|
|
360
|
+
.map(item => item.getAttribute('value') || '');
|
|
361
|
+
// Force a reorder after initialization
|
|
362
|
+
requestAnimationFrame(() => {
|
|
363
|
+
this.reorderSlotContent();
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
// Initialize the sorted options array with the parsed options for initial rendering
|
|
368
|
+
if (this.modeState === 'options') {
|
|
369
|
+
this.sortedOptions = [...this.parsedOptions];
|
|
370
|
+
}
|
|
371
|
+
// Apply filtering if the multiselect is filterable and there is a value
|
|
372
|
+
if (this.filterable && this.value) {
|
|
373
|
+
this.filterText = String(this.value).toLocaleLowerCase();
|
|
374
|
+
this.filterItems();
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
// Reset visibility state of all dropdown items
|
|
378
|
+
this.resetFilter();
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Force reorder if options mode in componentDidLoad because of the initial render not trigger @watch
|
|
383
|
+
*/
|
|
384
|
+
componentDidLoad() {
|
|
385
|
+
if (this.modeState === 'options') {
|
|
386
|
+
requestAnimationFrame(() => {
|
|
387
|
+
this.reorderOptionsContent();
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Unsubscribe from click outside event.
|
|
393
|
+
*/
|
|
394
|
+
disconnectedCallback() {
|
|
395
|
+
document.removeEventListener('click', this.handleClickOutside.bind(this));
|
|
396
|
+
// Remove the listener for the hide event
|
|
397
|
+
if (this.popoverElement) {
|
|
398
|
+
this.popoverElement.removeEventListener('hide', () => {
|
|
399
|
+
this.handlePopoverClose();
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Emitted when the input loses focus.
|
|
405
|
+
* @param {CustomEvent<boolean>} event - The event object containing the focus state.
|
|
406
|
+
*/
|
|
407
|
+
handleOpenChanged(event) {
|
|
408
|
+
// Update the open state of popover
|
|
409
|
+
this.open = event.detail;
|
|
410
|
+
if (this.open) {
|
|
411
|
+
if (this.filterText) {
|
|
412
|
+
this.filterItems();
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
else if (this.modeState === 'options') {
|
|
416
|
+
this.reorderOptionsContent();
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
this.reorderSlotContent();
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Listen for the `itemChecked` event emitted by child items.
|
|
424
|
+
* @param {CustomEvent<{ value: string; checked: boolean }>} event - The event object containing the selected value and its checked state.
|
|
425
|
+
*/
|
|
426
|
+
handleItemChecked(event) {
|
|
427
|
+
if (this.disabled || this.readonly) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
const { value, checked } = event.detail;
|
|
431
|
+
if (value !== undefined && value !== null) {
|
|
432
|
+
const newSelectedValues = [...this.selectedValues];
|
|
433
|
+
const valueIndex = newSelectedValues.indexOf(value);
|
|
434
|
+
if (checked && valueIndex === -1) {
|
|
435
|
+
newSelectedValues.push(value);
|
|
436
|
+
}
|
|
437
|
+
else if (!checked && valueIndex > -1) {
|
|
438
|
+
newSelectedValues.splice(valueIndex, 1);
|
|
439
|
+
}
|
|
440
|
+
// Update the state and emit the event only if the selection has changed
|
|
441
|
+
if (JSON.stringify(this.selectedValues) !==
|
|
442
|
+
JSON.stringify(newSelectedValues)) {
|
|
443
|
+
this.selectedValues = newSelectedValues;
|
|
444
|
+
// Use requestAnimationFrame to ensure the state is updated before emitting the event
|
|
445
|
+
requestAnimationFrame(() => {
|
|
446
|
+
this.multiselectChange.emit(this.selectedValues);
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
console.warn('Received itemChecked event with undefined or null value'); // Warning log
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Emitted when the options change.
|
|
456
|
+
* @param {string | Array<{label: string, value: string, isDivider?: boolean, disabled?: boolean, description?: string, checked?: boolean}>} newValue - The new value of the options.
|
|
457
|
+
*/
|
|
458
|
+
handleOptionsChange(newValue) {
|
|
459
|
+
if (typeof newValue === 'string') {
|
|
460
|
+
try {
|
|
461
|
+
const parsedOpts = JSON.parse(newValue);
|
|
462
|
+
this.selectedValues = parsedOpts
|
|
463
|
+
.filter(option => option.checked)
|
|
464
|
+
.map(option => option.value);
|
|
465
|
+
this.parsedOptions = [...parsedOpts];
|
|
466
|
+
}
|
|
467
|
+
catch (error) {
|
|
468
|
+
console.error('Error parsing options:', error);
|
|
469
|
+
this.parsedOptions = [];
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
else if (Array.isArray(newValue)) {
|
|
473
|
+
this.selectedValues = newValue
|
|
474
|
+
.filter(option => option.checked)
|
|
475
|
+
.map(option => option.value);
|
|
476
|
+
this.parsedOptions = [...newValue];
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
this.parsedOptions = [];
|
|
480
|
+
}
|
|
481
|
+
// Wait for the options to be fully loaded
|
|
482
|
+
Promise.resolve().then(() => {
|
|
483
|
+
requestAnimationFrame(() => {
|
|
484
|
+
if (this.modeState === 'options') {
|
|
485
|
+
this.reorderOptionsContent();
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Emitted when the value changes.
|
|
492
|
+
*/
|
|
493
|
+
watchValueHandler() {
|
|
494
|
+
// Handle value change and update the corresponding multiselect item if it exists
|
|
495
|
+
this.setInitialSelection();
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Emitted when the filterable property changes.
|
|
499
|
+
* @param {boolean} newValue - The new value of the filterable property.
|
|
500
|
+
*/
|
|
501
|
+
watchFilterableHandler(newValue) {
|
|
502
|
+
this.isFilterable = newValue;
|
|
503
|
+
this.filterable = newValue;
|
|
504
|
+
}
|
|
505
|
+
// Add a listener for the slot content
|
|
506
|
+
handleSlotChange(event) {
|
|
507
|
+
// Check: we only want to reorder if it's the "content" slot
|
|
508
|
+
const slot = event.target;
|
|
509
|
+
if (slot && slot.name === 'content') {
|
|
510
|
+
// To give other platforms (VueJS, React, etc.) time to insert all their items,
|
|
511
|
+
// we place the reorder in a requestAnimationFrame
|
|
512
|
+
requestAnimationFrame(() => {
|
|
513
|
+
this.reorderSlotContent();
|
|
514
|
+
});
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
//#endregion EVENTS
|
|
518
|
+
/****************************************************************************/
|
|
519
|
+
//#region METHODS
|
|
520
|
+
/**
|
|
521
|
+
* Retrieves the current filter text entered by the user.
|
|
522
|
+
* @returns {string} The filter text.
|
|
523
|
+
*/
|
|
524
|
+
async getFilterText() {
|
|
525
|
+
return this.filterText;
|
|
526
|
+
}
|
|
527
|
+
/**
|
|
528
|
+
* Set the initial selection based on the current value and update the inputElement value.
|
|
529
|
+
*/
|
|
530
|
+
setInitialSelection() {
|
|
531
|
+
var _a;
|
|
532
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitem'));
|
|
533
|
+
const selectedItem = items.find(item => {
|
|
534
|
+
var _a;
|
|
535
|
+
return item.getAttribute('label') === this.value ||
|
|
536
|
+
item.getAttribute('value') === this.value ||
|
|
537
|
+
((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.trim()) === this.value;
|
|
538
|
+
});
|
|
539
|
+
// Remove 'selected' from all items first to reset the state
|
|
540
|
+
items.forEach(item => {
|
|
541
|
+
item.removeAttribute('selected');
|
|
542
|
+
item.classList.remove('selected');
|
|
543
|
+
});
|
|
544
|
+
if (selectedItem) {
|
|
545
|
+
// Add the `selected` attribute and `selected` class for visual styling
|
|
546
|
+
selectedItem.setAttribute('selected', 'true');
|
|
547
|
+
selectedItem.classList.add('selected');
|
|
548
|
+
// Update the value and inputElement value to reflect the pre-selected item
|
|
549
|
+
this.value =
|
|
550
|
+
selectedItem.getAttribute('label') ||
|
|
551
|
+
selectedItem.getAttribute('value') ||
|
|
552
|
+
((_a = selectedItem.textContent) === null || _a === void 0 ? void 0 : _a.trim()) ||
|
|
553
|
+
'';
|
|
554
|
+
if (this.inputElement) {
|
|
555
|
+
this.inputElement.value = this.value;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* Reset the filter and make all items visible.
|
|
561
|
+
*/
|
|
562
|
+
async resetFilter() {
|
|
563
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
564
|
+
// Reset visibility state of all dropdown items
|
|
565
|
+
items.forEach(item => {
|
|
566
|
+
item.style.display = '';
|
|
567
|
+
});
|
|
568
|
+
// Clean up filter-related UI elements
|
|
569
|
+
const ul = this.el.querySelector('ul');
|
|
570
|
+
if (ul) {
|
|
571
|
+
const emptyMessage = ul.querySelector('[data-empty]');
|
|
572
|
+
if (emptyMessage)
|
|
573
|
+
emptyMessage.remove();
|
|
574
|
+
// Reorder with divider if needed
|
|
575
|
+
const selectedItems = items.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
576
|
+
const unselectedItems = items.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
577
|
+
if (selectedItems.length > 0) {
|
|
578
|
+
this.manageDivider(ul, selectedItems, unselectedItems);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Returns the list of selected values.
|
|
584
|
+
* @returns {string[]} The selected values.
|
|
585
|
+
*/
|
|
586
|
+
async getSelectedValues() {
|
|
587
|
+
return this.selectedValues;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Reorder the content of the slot.
|
|
591
|
+
*/
|
|
592
|
+
reorderSlotContent() {
|
|
593
|
+
if (this.modeState === 'options')
|
|
594
|
+
return;
|
|
595
|
+
const ul = this.el.querySelector('ul');
|
|
596
|
+
if (!ul)
|
|
597
|
+
return;
|
|
598
|
+
// Remove all existing <hr class="multiselect-divider">
|
|
599
|
+
ul.querySelectorAll('hr.multiselect-divider').forEach(divider => divider.remove());
|
|
600
|
+
// Retrieve all items (not hidden)
|
|
601
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck')).filter(item => item.style.display !== 'none');
|
|
602
|
+
// If you possibly have a "No results" message:
|
|
603
|
+
const hasEmptyMessage = ul.querySelector('[data-empty]');
|
|
604
|
+
if (hasEmptyMessage) {
|
|
605
|
+
// if there is a "No results found" message, do not reorder
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
// Separate checked vs unchecked
|
|
609
|
+
const selectedItems = items.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
610
|
+
const unselectedItems = items.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
611
|
+
// Reinsert CHECKED items FIRST
|
|
612
|
+
// appendChild() moves the element without recreating it
|
|
613
|
+
// this is not trigger a re-rendering of the component in the platforms
|
|
614
|
+
selectedItems.forEach(item => {
|
|
615
|
+
ul.appendChild(item); // <-- The <li> (or <nv-fielddropdownitemcheck>) is just "moved" to the end of the list
|
|
616
|
+
});
|
|
617
|
+
// Add a divider if needed
|
|
618
|
+
if (selectedItems.length > 0 && unselectedItems.length > 0) {
|
|
619
|
+
const divider = document.createElement('hr');
|
|
620
|
+
divider.className = 'multiselect-divider';
|
|
621
|
+
ul.appendChild(divider);
|
|
622
|
+
}
|
|
623
|
+
// Reinsert UNCHECKED items at the end
|
|
624
|
+
unselectedItems.forEach(item => {
|
|
625
|
+
ul.appendChild(item);
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
/**
|
|
629
|
+
* Reorder the content for options mode with async handling
|
|
630
|
+
*/
|
|
631
|
+
reorderOptionsContent() {
|
|
632
|
+
const ul = this.el.querySelector('ul[role="content"]');
|
|
633
|
+
if (!ul)
|
|
634
|
+
return;
|
|
635
|
+
const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck')).filter(item => item.style.display !== 'none');
|
|
636
|
+
const selectedItems = items.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
637
|
+
const unselectedItems = items.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
638
|
+
// Reorder the elements
|
|
639
|
+
selectedItems.forEach(item => ul.appendChild(item));
|
|
640
|
+
unselectedItems.forEach(item => ul.appendChild(item));
|
|
641
|
+
// Manage the divider after the reordering
|
|
642
|
+
this.manageDivider(ul, selectedItems, unselectedItems);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Filter multiselect items based on the text entered by the user.
|
|
646
|
+
*/
|
|
647
|
+
filterItems() {
|
|
648
|
+
const ul = this.el.querySelector('ul');
|
|
649
|
+
if (!ul)
|
|
650
|
+
return;
|
|
651
|
+
// Remove existing empty message if any
|
|
652
|
+
const existingEmptyMessage = ul.querySelector('[data-empty]');
|
|
653
|
+
if (existingEmptyMessage) {
|
|
654
|
+
existingEmptyMessage.remove();
|
|
655
|
+
}
|
|
656
|
+
if (!this.filterText.trim()) {
|
|
657
|
+
if (this.parsedOptions && this.parsedOptions.length > 0) {
|
|
658
|
+
// Reset options display
|
|
659
|
+
const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
660
|
+
items.forEach(item => {
|
|
661
|
+
item.style.display = '';
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
else {
|
|
665
|
+
// Reset slot items display
|
|
666
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
667
|
+
items.forEach(item => {
|
|
668
|
+
item.style.display = '';
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
// Reorder with divider
|
|
672
|
+
const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
673
|
+
const selectedItems = items.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
674
|
+
const unselectedItems = items.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
675
|
+
this.manageDivider(ul, selectedItems, unselectedItems);
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
const normalizedFilter = this.normalizeText(this.filterText);
|
|
679
|
+
let hasVisibleItems = false;
|
|
680
|
+
if (this.parsedOptions && this.parsedOptions.length > 0) {
|
|
681
|
+
// Filter options mode
|
|
682
|
+
const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
683
|
+
items.forEach(item => {
|
|
684
|
+
const option = this.parsedOptions.find(opt => opt.value === item.getAttribute('value'));
|
|
685
|
+
if (option && !option.isDivider) {
|
|
686
|
+
const matchesFilter = this.normalizeText(option.label).includes(normalizedFilter) ||
|
|
687
|
+
this.normalizeText(option.value).includes(normalizedFilter);
|
|
688
|
+
item.style.display = matchesFilter ? '' : 'none';
|
|
689
|
+
if (matchesFilter)
|
|
690
|
+
hasVisibleItems = true;
|
|
691
|
+
}
|
|
692
|
+
});
|
|
693
|
+
// Manage the divider with the visible items
|
|
694
|
+
const visibleItems = items.filter(item => item.style.display !== 'none');
|
|
695
|
+
const visibleSelected = visibleItems.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
696
|
+
const visibleUnselected = visibleItems.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
697
|
+
this.manageDivider(ul, visibleSelected, visibleUnselected);
|
|
698
|
+
}
|
|
699
|
+
else {
|
|
700
|
+
// Filter slot items mode
|
|
701
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
702
|
+
items.forEach(item => {
|
|
703
|
+
const label = item.getAttribute('label') || '';
|
|
704
|
+
const value = item.getAttribute('value') || '';
|
|
705
|
+
const textContent = item.textContent || '';
|
|
706
|
+
const matchesFilter = this.normalizeText(label).includes(normalizedFilter) ||
|
|
707
|
+
this.normalizeText(value).includes(normalizedFilter) ||
|
|
708
|
+
this.normalizeText(textContent).includes(normalizedFilter);
|
|
709
|
+
item.style.display = matchesFilter ? '' : 'none';
|
|
710
|
+
if (matchesFilter)
|
|
711
|
+
hasVisibleItems = true;
|
|
712
|
+
});
|
|
713
|
+
}
|
|
714
|
+
// Add empty message if no items match the filter
|
|
715
|
+
if (!hasVisibleItems) {
|
|
716
|
+
const emptyMessage = document.createElement('li');
|
|
717
|
+
emptyMessage.setAttribute('data-empty', 'true');
|
|
718
|
+
emptyMessage.textContent = this.emptyresult;
|
|
719
|
+
emptyMessage.classList.add('no-results-message');
|
|
720
|
+
ul.appendChild(emptyMessage);
|
|
721
|
+
}
|
|
722
|
+
this.reorderSlotContent();
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Filter multiselect items in options mode.
|
|
726
|
+
*/
|
|
727
|
+
filterItemsOption() {
|
|
728
|
+
const ul = this.el.querySelector('ul');
|
|
729
|
+
if (!ul)
|
|
730
|
+
return;
|
|
731
|
+
const normalizedFilter = this.normalizeText(this.filterText);
|
|
732
|
+
let hasVisibleItems = false;
|
|
733
|
+
const items = Array.from(ul.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
734
|
+
// Reset items if the filter text is empty
|
|
735
|
+
if (!this.filterText.trim()) {
|
|
736
|
+
// Remove the empty message if it exists
|
|
737
|
+
this.removeEmptyMessageOption(ul);
|
|
738
|
+
items.forEach(item => (item.style.display = ''));
|
|
739
|
+
this.reorderOptionsContent(); // Reorder after reset
|
|
740
|
+
return;
|
|
741
|
+
}
|
|
742
|
+
// Filter the items
|
|
743
|
+
items.forEach(item => {
|
|
744
|
+
const label = item.getAttribute('label') || '';
|
|
745
|
+
const value = item.getAttribute('value') || '';
|
|
746
|
+
const matchesFilter = this.normalizeText(label).includes(normalizedFilter) ||
|
|
747
|
+
this.normalizeText(value).includes(normalizedFilter);
|
|
748
|
+
item.style.display = matchesFilter ? '' : 'none';
|
|
749
|
+
if (matchesFilter)
|
|
750
|
+
hasVisibleItems = true;
|
|
751
|
+
});
|
|
752
|
+
// Manage the divider with the visible items
|
|
753
|
+
const visibleItems = items.filter(item => item.style.display !== 'none');
|
|
754
|
+
const visibleSelected = visibleItems.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
755
|
+
const visibleUnselected = visibleItems.filter(item => !this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
756
|
+
this.manageDivider(ul, visibleSelected, visibleUnselected);
|
|
757
|
+
// Add or remove the empty message based on the case
|
|
758
|
+
if (!hasVisibleItems) {
|
|
759
|
+
this.addEmptyMessageOption(ul);
|
|
760
|
+
}
|
|
761
|
+
else {
|
|
762
|
+
this.removeEmptyMessageOption(ul);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Filter multiselect items in slots mode
|
|
767
|
+
*/
|
|
768
|
+
filterSlotsItems() {
|
|
769
|
+
if (this.modeState === 'options')
|
|
770
|
+
return;
|
|
771
|
+
const ul = this.el.querySelector('ul');
|
|
772
|
+
if (!ul)
|
|
773
|
+
return;
|
|
774
|
+
// Remove existing empty message if any
|
|
775
|
+
const existingEmptyMessage = ul.querySelector('[data-empty]');
|
|
776
|
+
if (existingEmptyMessage) {
|
|
777
|
+
existingEmptyMessage.remove();
|
|
778
|
+
}
|
|
779
|
+
// If filter text is empty, reset all items visibility
|
|
780
|
+
if (!this.filterText.trim()) {
|
|
781
|
+
this.resetFilter();
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
const normalizedFilter = this.normalizeText(this.filterText);
|
|
785
|
+
let hasVisibleItems = false;
|
|
786
|
+
// Get all items and preserve them in the DOM
|
|
787
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck'));
|
|
788
|
+
// Instead of removing/reordering, just hide/show items
|
|
789
|
+
items.forEach(item => {
|
|
790
|
+
var _a;
|
|
791
|
+
const label = item.getAttribute('label') || '';
|
|
792
|
+
const value = item.getAttribute('value') || '';
|
|
793
|
+
const textContent = ((_a = item.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || '';
|
|
794
|
+
const matchesFilter = this.normalizeText(label).includes(normalizedFilter) ||
|
|
795
|
+
this.normalizeText(value).includes(normalizedFilter) ||
|
|
796
|
+
this.normalizeText(textContent).includes(normalizedFilter);
|
|
797
|
+
item.style.display = matchesFilter ? '' : 'none';
|
|
798
|
+
if (matchesFilter)
|
|
799
|
+
hasVisibleItems = true;
|
|
800
|
+
});
|
|
801
|
+
// Get visible items after filtering
|
|
802
|
+
const visibleItems = items.filter(item => item.style.display !== 'none');
|
|
803
|
+
const visibleSelectedItems = visibleItems.filter(item => this.selectedValues.includes(item.getAttribute('value') || ''));
|
|
804
|
+
this.manageDivider(ul, visibleSelectedItems, visibleItems.filter(item => !this.selectedValues.includes(item.getAttribute('value') || '')));
|
|
805
|
+
// Add empty message if no items match the filter
|
|
806
|
+
if (!hasVisibleItems) {
|
|
807
|
+
const emptyMessage = document.createElement('li');
|
|
808
|
+
emptyMessage.setAttribute('data-empty', 'true');
|
|
809
|
+
emptyMessage.textContent = this.emptyresult;
|
|
810
|
+
emptyMessage.classList.add('no-results-message');
|
|
811
|
+
ul.appendChild(emptyMessage);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* Normalizes text by removing accents and converting to lowercase
|
|
816
|
+
* @param {string} text - The text to normalize
|
|
817
|
+
* @returns {string} The normalized text
|
|
818
|
+
*
|
|
819
|
+
* @example
|
|
820
|
+
* normalizeText("Café Latte") => "cafe latte"
|
|
821
|
+
*
|
|
822
|
+
* @description
|
|
823
|
+
* This function performs text normalization in three steps:
|
|
824
|
+
* 1. Decomposes characters into their base form and combining characters (NFD)
|
|
825
|
+
* 2. Removes all diacritical marks (accents, umlauts, etc.)
|
|
826
|
+
* 3. Converts to lowercase and trims whitespace
|
|
827
|
+
*
|
|
828
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/normalize} - MDN documentation on String.normalize()
|
|
829
|
+
* @see {@link https://en.wikipedia.org/wiki/Unicode_equivalence#Normal_forms} - More info about Unicode normalization forms
|
|
830
|
+
*/
|
|
831
|
+
normalizeText(text) {
|
|
832
|
+
return text
|
|
833
|
+
.normalize('NFD') // Decompose characters into base + combining characters (e.g., é => e + ´)
|
|
834
|
+
.replace(/[\u0300-\u036f]/g, '') // Remove all diacritical marks (Unicode range for combining characters)
|
|
835
|
+
.toLowerCase() // Convert to lowercase
|
|
836
|
+
.trim(); // Remove leading and trailing whitespace
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Handle click outside the component.
|
|
840
|
+
* @param {MouseEvent} event - The click event.
|
|
841
|
+
*/
|
|
842
|
+
handleClickOutside(event) {
|
|
843
|
+
if (this.el.contains(event.target) ||
|
|
844
|
+
(this.inputElement && this.inputElement.contains(event.target))) {
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
// Use handlePopoverClose for all cases
|
|
848
|
+
this.handlePopoverClose();
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* Handle keyboard events & arrow key navigation.
|
|
852
|
+
* If the multiselect is not open, opens it and focuses on the first item if the list is not filterable.
|
|
853
|
+
* If the multiselect is open, handles arrow key navigation and closes it if the focus is outside the component.
|
|
854
|
+
* @param {KeyboardEvent} event - The keyboard event.
|
|
855
|
+
*/
|
|
856
|
+
async handleKeyDown(event) {
|
|
857
|
+
if (!this.open) {
|
|
858
|
+
if (event.key === 'ArrowDown') {
|
|
859
|
+
this.open = true;
|
|
860
|
+
this.popoverElement.show();
|
|
861
|
+
// Focus on the first item if the list is not filterable
|
|
862
|
+
if (!this.filterable) {
|
|
863
|
+
requestAnimationFrame(() => {
|
|
864
|
+
this.focusFirstItem();
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
event.preventDefault();
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
return;
|
|
871
|
+
}
|
|
872
|
+
const items = Array.from(this.el.querySelectorAll('nv-fielddropdownitemcheck:not([style*="display: none"])'));
|
|
873
|
+
if (items.length === 0) {
|
|
874
|
+
console.warn('No visible items found to navigate');
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
let currentIndex = items.findIndex(item => item.classList.contains('highlighted'));
|
|
878
|
+
if (event.key === 'ArrowDown') {
|
|
879
|
+
event.preventDefault();
|
|
880
|
+
currentIndex =
|
|
881
|
+
currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
|
|
882
|
+
this.updateHighlightedItem(items, currentIndex);
|
|
883
|
+
}
|
|
884
|
+
else if (event.key === 'ArrowUp') {
|
|
885
|
+
event.preventDefault();
|
|
886
|
+
currentIndex =
|
|
887
|
+
currentIndex === -1
|
|
888
|
+
? items.length - 1
|
|
889
|
+
: (currentIndex - 1 + items.length) % items.length;
|
|
890
|
+
this.updateHighlightedItem(items, currentIndex);
|
|
891
|
+
}
|
|
892
|
+
else if (event.key === 'Enter' && currentIndex >= 0) {
|
|
893
|
+
event.preventDefault();
|
|
894
|
+
const selectedItem = items[currentIndex];
|
|
895
|
+
// Toggle the checked state
|
|
896
|
+
const isCurrentlyChecked = selectedItem.hasAttribute('checked');
|
|
897
|
+
selectedItem.checked = !isCurrentlyChecked;
|
|
898
|
+
// Trigger a click event to ensure proper event handling
|
|
899
|
+
selectedItem.dispatchEvent(new MouseEvent('click', {
|
|
900
|
+
view: window,
|
|
901
|
+
bubbles: true,
|
|
902
|
+
cancelable: true,
|
|
903
|
+
}));
|
|
904
|
+
}
|
|
905
|
+
else if (event.key === 'Escape') {
|
|
906
|
+
event.preventDefault();
|
|
907
|
+
event.stopPropagation(); // Prevent the event from propagating to the popover
|
|
908
|
+
// Do the reorder and wait a bit before closing
|
|
909
|
+
const handleEscape = async () => {
|
|
910
|
+
this.isHandlingEscape = true; // Disable the hide listener
|
|
911
|
+
if (this.modeState === 'options') {
|
|
912
|
+
this.reorderOptionsContent();
|
|
913
|
+
}
|
|
914
|
+
else {
|
|
915
|
+
this.reorderSlotContent();
|
|
916
|
+
}
|
|
917
|
+
// Wait for the reorder to be applied
|
|
918
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
919
|
+
// Reactivate the hide listener after a short delay
|
|
920
|
+
setTimeout(() => {
|
|
921
|
+
this.isHandlingEscape = false;
|
|
922
|
+
this.open = false;
|
|
923
|
+
this.popoverElement.hide();
|
|
924
|
+
}, 150);
|
|
925
|
+
if (this.inputElement) {
|
|
926
|
+
this.inputElement.blur();
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
await handleEscape();
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Updates the highlighted item in the dropdown list.
|
|
934
|
+
*
|
|
935
|
+
* @param {(HTMLNvFielddropdownitemElement | HTMLNvFielddropdownitemcheckElement)[]} items - The items to update.
|
|
936
|
+
* @param {number} index - The index of the item to highlight.
|
|
937
|
+
*/
|
|
938
|
+
updateHighlightedItem(items, index) {
|
|
939
|
+
items.forEach((item, i) => {
|
|
940
|
+
if (i === index) {
|
|
941
|
+
item.classList.add('highlighted');
|
|
942
|
+
item.setAttribute('tabindex', '0');
|
|
943
|
+
item.scrollIntoView({ block: 'nearest' });
|
|
944
|
+
// Focus on the nv-fieldcheckbox inside
|
|
945
|
+
const checkbox = item.querySelector('nv-fieldcheckbox');
|
|
946
|
+
if (checkbox) {
|
|
947
|
+
checkbox.focus();
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
item.classList.remove('highlighted');
|
|
952
|
+
item.setAttribute('tabindex', '-1');
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Focus on the first item in the dropdown list.
|
|
958
|
+
*/
|
|
959
|
+
focusFirstItem() {
|
|
960
|
+
const firstItem = this.el.querySelector('nv-fielddropdownitemcheck:not([style*="display: none"])');
|
|
961
|
+
if (firstItem) {
|
|
962
|
+
firstItem.setAttribute('tabindex', '0');
|
|
963
|
+
firstItem.classList.add('highlighted');
|
|
964
|
+
firstItem.scrollIntoView({ block: 'nearest' });
|
|
965
|
+
// Focus on the nv-fieldcheckbox inside
|
|
966
|
+
const checkbox = firstItem.querySelector('nv-fieldcheckbox');
|
|
967
|
+
if (checkbox) {
|
|
968
|
+
checkbox.focus();
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
console.warn('No visible first item found to focus');
|
|
973
|
+
}
|
|
974
|
+
}
|
|
975
|
+
addEmptyMessageOption(ul) {
|
|
976
|
+
const existingMessage = ul.querySelector('[data-empty]');
|
|
977
|
+
if (existingMessage)
|
|
978
|
+
return;
|
|
979
|
+
const emptyMessage = document.createElement('li');
|
|
980
|
+
emptyMessage.setAttribute('data-empty', 'true');
|
|
981
|
+
emptyMessage.textContent = this.emptyresult;
|
|
982
|
+
emptyMessage.classList.add('no-results-message');
|
|
983
|
+
ul.appendChild(emptyMessage);
|
|
984
|
+
}
|
|
985
|
+
removeEmptyMessageOption(ul) {
|
|
986
|
+
const existingMessage = ul.querySelector('[data-empty]');
|
|
987
|
+
if (existingMessage)
|
|
988
|
+
existingMessage.remove();
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* Watch for changes in the mode prop and update modeState accordingly
|
|
992
|
+
* @param {string} newValue - The new mode value
|
|
993
|
+
*/
|
|
994
|
+
handleModeChange(newValue) {
|
|
995
|
+
this.modeState = newValue;
|
|
996
|
+
}
|
|
997
|
+
manageDivider(ul, selectedItems, unselectedItems) {
|
|
998
|
+
let divider = ul.querySelector('hr.multiselect-divider');
|
|
999
|
+
if (!divider) {
|
|
1000
|
+
divider = document.createElement('hr');
|
|
1001
|
+
divider.className = 'multiselect-divider';
|
|
1002
|
+
ul.appendChild(divider);
|
|
1003
|
+
}
|
|
1004
|
+
const shouldShowDivider = selectedItems.length > 0 && unselectedItems.length > 0;
|
|
1005
|
+
if (shouldShowDivider) {
|
|
1006
|
+
// Place the divider after the last selected item
|
|
1007
|
+
const lastSelectedItem = selectedItems[selectedItems.length - 1];
|
|
1008
|
+
lastSelectedItem.after(divider);
|
|
1009
|
+
divider.style.display = '';
|
|
1010
|
+
}
|
|
1011
|
+
else {
|
|
1012
|
+
divider.style.display = 'none';
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
//#endregion METHODS
|
|
1016
|
+
/****************************************************************************/
|
|
1017
|
+
//#region RENDER
|
|
1018
|
+
/**
|
|
1019
|
+
* Renders the component in options mode
|
|
1020
|
+
* @returns {any} The JSX for options mode
|
|
1021
|
+
*/
|
|
1022
|
+
renderOptionsMode() {
|
|
1023
|
+
return (h(Host, null, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { htmlFor: this.inputId }, h("slot", { name: "label" }, this.label))), h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, h("slot", { name: "before-input" }), h("div", { class: "input-container-multiselect" }, h("slot", { name: "leading-input" }), h("nv-badge", { slot: "leading-input", "prevent-auto-close": "true", color: "10", dismissible: this.selectedValues.length > 0, hidden: this.selectedValues.length <= 0, label: `${this.selectedValues.length} ${this.badgeLabel}`, "aria-label": `Clear all ${this.selectedValues.length} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseOptions }), this.isFilterable || this.disabled || this.readonly ? (h("input", { id: this.inputId, ref: e => (this.inputElement = e), autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.value, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputOptions, onFocus: this.handleInputFocusOptions, onBlur: this.handleInputBlurOptions, onKeyDown: this.handleKeyDown })) : (h("p", { id: this.inputId, class: "non-filterable-text", onClick: this.handleInputContainerClickOptions, tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleInputFocusOptions, role: "combobox", "aria-expanded": this.open }, h("span", null, this.value || this.placeholder))), h("nv-iconbutton", { class: "toggle-dropdown-icon", name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', "aria-pressed": this.open.toString(), onClick: this.togglePopoverOptions })), h("slot", { name: "after-input" })), h("div", { slot: "content", role: "listbox", "aria-multiselectable": "true", style: { 'max-height': this.maxHeight, 'overflow-y': 'auto' } }, h("ul", { role: "content" }, this.parsedOptions.map(option => (h("nv-fielddropdownitemcheck", { label: option.label, description: option.description, value: option.value, checked: this.selectedValues.includes(option.value), disabled: option.disabled }))), h("hr", { class: "multiselect-divider", style: { display: 'none' } })))), this.renderDescriptions()));
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Renders the component in slots mode
|
|
1027
|
+
* @returns {any} The JSX for slots mode
|
|
1028
|
+
*/
|
|
1029
|
+
renderSlotsMode() {
|
|
1030
|
+
return (h(Host, null, (this.label || this.el.querySelector('[slot="label"]')) && (h("label", { htmlFor: this.inputId }, h("slot", { name: "label" }, this.label))), h("nv-popover", { ref: el => (this.popoverElement = el), triggerMode: "controlled", placement: "bottom-start", open: this.open }, h("div", { class: "input-wrapper-multiselect", slot: "trigger" }, h("slot", { name: "before-input" }), h("div", { class: "input-container-multiselect", onClick: this.handleInputContainerClickSlots }, h("slot", { name: "leading-input" }, h("p", null, "No leading input")), h("nv-badge", { slot: "leading-input", "prevent-auto-close": "true", color: "10", dismissible: this.selectedValues.length > 0, hidden: this.selectedValues.length <= 0, label: `${this.selectedValues.length} ${this.badgeLabel}`, "aria-label": `Clear all ${this.selectedValues.length} ${this.badgeLabel} items`, onCloseClicked: this.handleBadgeCloseSlots }), this.isFilterable || this.disabled || this.readonly ? (h("input", { id: this.inputId, ref: e => (this.inputElement = e), autocomplete: this.autocomplete, placeholder: this.placeholder, name: this.name, value: this.value, required: this.required, disabled: this.disabled, readOnly: this.readonly, onInput: this.handleInputSlots, onFocus: this.handleInputFocusSlots, onBlur: this.handleInputBlurSlots, onKeyDown: this.handleKeyDown })) : (h("p", { id: this.inputId, class: "non-filterable-text", onClick: this.handleInputContainerClickSlots, tabIndex: 0, onKeyDown: this.handleKeyDown, onFocus: this.handleInputFocusSlots, role: "combobox", "aria-expanded": this.open }, h("span", null, this.value || this.placeholder))), h("nv-iconbutton", { class: "toggle-dropdown-icon", name: this.open ? 'chevron-top' : 'chevron-down', size: "md", emphasis: "lower", "aria-label": this.open ? 'Hide dropdown' : 'Show dropdown', "aria-pressed": this.open.toString(), onClick: this.togglePopoverSlots })), h("slot", { name: "after-input" })), h("div", { slot: "content", role: "listbox", "aria-multiselectable": "true", style: { 'max-height': this.maxHeight, 'overflow-y': 'auto' } }, h("slot", { name: "content" }))), this.renderDescriptions()));
|
|
1031
|
+
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Renders description and error description sections
|
|
1034
|
+
* @returns {any} The JSX for descriptions
|
|
1035
|
+
*/
|
|
1036
|
+
renderDescriptions() {
|
|
1037
|
+
return [
|
|
1038
|
+
(this.description || this.el.querySelector('[slot="description"]')) && (h("div", { class: "description" }, h("slot", { name: "description" }, this.description))),
|
|
1039
|
+
(this.errorDescription ||
|
|
1040
|
+
this.el.querySelector('[slot="error-description"]')) && (h("div", { hidden: !this.error, class: "error-description" }, h("slot", { name: "error-description" }, this.errorDescription))),
|
|
1041
|
+
];
|
|
1042
|
+
}
|
|
1043
|
+
/**
|
|
1044
|
+
* Main render method that decides which mode to render
|
|
1045
|
+
* @returns {any} The JSX for the component
|
|
1046
|
+
*/
|
|
1047
|
+
render() {
|
|
1048
|
+
return this.modeState === 'options'
|
|
1049
|
+
? this.renderOptionsMode()
|
|
1050
|
+
: this.renderSlotsMode();
|
|
1051
|
+
}
|
|
1052
|
+
static get is() { return "nv-fieldmultiselect"; }
|
|
1053
|
+
static get originalStyleUrls() {
|
|
1054
|
+
return {
|
|
1055
|
+
"$": ["nv-fieldmultiselect.scss"]
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
static get styleUrls() {
|
|
1059
|
+
return {
|
|
1060
|
+
"$": ["nv-fieldmultiselect.css"]
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
1063
|
+
static get properties() {
|
|
1064
|
+
return {
|
|
1065
|
+
"inputId": {
|
|
1066
|
+
"type": "string",
|
|
1067
|
+
"mutable": false,
|
|
1068
|
+
"complexType": {
|
|
1069
|
+
"original": "string",
|
|
1070
|
+
"resolved": "string",
|
|
1071
|
+
"references": {}
|
|
1072
|
+
},
|
|
1073
|
+
"required": false,
|
|
1074
|
+
"optional": false,
|
|
1075
|
+
"docs": {
|
|
1076
|
+
"tags": [],
|
|
1077
|
+
"text": "Sets the ID for the input element and the for attribute of the associated\nlabel. If no ID is provided, a random one will be automatically generated\nto ensure unique identification, facilitating proper label association and\naccessibility."
|
|
1078
|
+
},
|
|
1079
|
+
"getter": false,
|
|
1080
|
+
"setter": false,
|
|
1081
|
+
"attribute": "input-id",
|
|
1082
|
+
"reflect": true,
|
|
1083
|
+
"defaultValue": "uuidv4()"
|
|
1084
|
+
},
|
|
1085
|
+
"name": {
|
|
1086
|
+
"type": "string",
|
|
1087
|
+
"mutable": false,
|
|
1088
|
+
"complexType": {
|
|
1089
|
+
"original": "string",
|
|
1090
|
+
"resolved": "string",
|
|
1091
|
+
"references": {}
|
|
1092
|
+
},
|
|
1093
|
+
"required": false,
|
|
1094
|
+
"optional": false,
|
|
1095
|
+
"docs": {
|
|
1096
|
+
"tags": [],
|
|
1097
|
+
"text": "Defines the name attribute of the input field, which is crucial for form\nsubmission. This value is used as the key in the key-value pair sent to\nthe server, representing the input's data in form submissions. It should be\nunique within the form to avoid conflicts."
|
|
1098
|
+
},
|
|
1099
|
+
"getter": false,
|
|
1100
|
+
"setter": false,
|
|
1101
|
+
"attribute": "name",
|
|
1102
|
+
"reflect": true
|
|
1103
|
+
},
|
|
1104
|
+
"label": {
|
|
1105
|
+
"type": "string",
|
|
1106
|
+
"mutable": false,
|
|
1107
|
+
"complexType": {
|
|
1108
|
+
"original": "string",
|
|
1109
|
+
"resolved": "string",
|
|
1110
|
+
"references": {}
|
|
1111
|
+
},
|
|
1112
|
+
"required": false,
|
|
1113
|
+
"optional": false,
|
|
1114
|
+
"docs": {
|
|
1115
|
+
"tags": [],
|
|
1116
|
+
"text": "Lets you define the text that explains what users should enter in the text\ninput field. It's a crucial element for making forms clear and user-friendly."
|
|
1117
|
+
},
|
|
1118
|
+
"getter": false,
|
|
1119
|
+
"setter": false,
|
|
1120
|
+
"attribute": "label",
|
|
1121
|
+
"reflect": true
|
|
1122
|
+
},
|
|
1123
|
+
"description": {
|
|
1124
|
+
"type": "string",
|
|
1125
|
+
"mutable": false,
|
|
1126
|
+
"complexType": {
|
|
1127
|
+
"original": "string",
|
|
1128
|
+
"resolved": "string",
|
|
1129
|
+
"references": {}
|
|
1130
|
+
},
|
|
1131
|
+
"required": false,
|
|
1132
|
+
"optional": false,
|
|
1133
|
+
"docs": {
|
|
1134
|
+
"tags": [],
|
|
1135
|
+
"text": "Add helpful hints or extra information under the text input field."
|
|
1136
|
+
},
|
|
1137
|
+
"getter": false,
|
|
1138
|
+
"setter": false,
|
|
1139
|
+
"attribute": "description",
|
|
1140
|
+
"reflect": true
|
|
1141
|
+
},
|
|
1142
|
+
"placeholder": {
|
|
1143
|
+
"type": "string",
|
|
1144
|
+
"mutable": false,
|
|
1145
|
+
"complexType": {
|
|
1146
|
+
"original": "string",
|
|
1147
|
+
"resolved": "string",
|
|
1148
|
+
"references": {}
|
|
1149
|
+
},
|
|
1150
|
+
"required": false,
|
|
1151
|
+
"optional": false,
|
|
1152
|
+
"docs": {
|
|
1153
|
+
"tags": [],
|
|
1154
|
+
"text": "Display temporary text inside the input field."
|
|
1155
|
+
},
|
|
1156
|
+
"getter": false,
|
|
1157
|
+
"setter": false,
|
|
1158
|
+
"attribute": "placeholder",
|
|
1159
|
+
"reflect": true
|
|
1160
|
+
},
|
|
1161
|
+
"maxHeight": {
|
|
1162
|
+
"type": "string",
|
|
1163
|
+
"mutable": false,
|
|
1164
|
+
"complexType": {
|
|
1165
|
+
"original": "string",
|
|
1166
|
+
"resolved": "string",
|
|
1167
|
+
"references": {}
|
|
1168
|
+
},
|
|
1169
|
+
"required": false,
|
|
1170
|
+
"optional": false,
|
|
1171
|
+
"docs": {
|
|
1172
|
+
"tags": [],
|
|
1173
|
+
"text": "Defines the maximum height of the multiselect list when open."
|
|
1174
|
+
},
|
|
1175
|
+
"getter": false,
|
|
1176
|
+
"setter": false,
|
|
1177
|
+
"attribute": "max-height",
|
|
1178
|
+
"reflect": true,
|
|
1179
|
+
"defaultValue": "'200px'"
|
|
1180
|
+
},
|
|
1181
|
+
"badgeLabel": {
|
|
1182
|
+
"type": "string",
|
|
1183
|
+
"mutable": false,
|
|
1184
|
+
"complexType": {
|
|
1185
|
+
"original": "string",
|
|
1186
|
+
"resolved": "string",
|
|
1187
|
+
"references": {}
|
|
1188
|
+
},
|
|
1189
|
+
"required": false,
|
|
1190
|
+
"optional": false,
|
|
1191
|
+
"docs": {
|
|
1192
|
+
"tags": [],
|
|
1193
|
+
"text": "Text for the badge showing the number of selected items."
|
|
1194
|
+
},
|
|
1195
|
+
"getter": false,
|
|
1196
|
+
"setter": false,
|
|
1197
|
+
"attribute": "badge-label",
|
|
1198
|
+
"reflect": true,
|
|
1199
|
+
"defaultValue": "''"
|
|
1200
|
+
},
|
|
1201
|
+
"emptyresult": {
|
|
1202
|
+
"type": "string",
|
|
1203
|
+
"mutable": false,
|
|
1204
|
+
"complexType": {
|
|
1205
|
+
"original": "string",
|
|
1206
|
+
"resolved": "string",
|
|
1207
|
+
"references": {}
|
|
1208
|
+
},
|
|
1209
|
+
"required": false,
|
|
1210
|
+
"optional": false,
|
|
1211
|
+
"docs": {
|
|
1212
|
+
"tags": [],
|
|
1213
|
+
"text": "The text to display when no items match the filter."
|
|
1214
|
+
},
|
|
1215
|
+
"getter": false,
|
|
1216
|
+
"setter": false,
|
|
1217
|
+
"attribute": "emptyresult",
|
|
1218
|
+
"reflect": true,
|
|
1219
|
+
"defaultValue": "'No results found'"
|
|
1220
|
+
},
|
|
1221
|
+
"required": {
|
|
1222
|
+
"type": "boolean",
|
|
1223
|
+
"mutable": false,
|
|
1224
|
+
"complexType": {
|
|
1225
|
+
"original": "boolean",
|
|
1226
|
+
"resolved": "boolean",
|
|
1227
|
+
"references": {}
|
|
1228
|
+
},
|
|
1229
|
+
"required": false,
|
|
1230
|
+
"optional": false,
|
|
1231
|
+
"docs": {
|
|
1232
|
+
"tags": [],
|
|
1233
|
+
"text": "Marks the input field as required."
|
|
1234
|
+
},
|
|
1235
|
+
"getter": false,
|
|
1236
|
+
"setter": false,
|
|
1237
|
+
"attribute": "required",
|
|
1238
|
+
"reflect": true,
|
|
1239
|
+
"defaultValue": "false"
|
|
1240
|
+
},
|
|
1241
|
+
"error": {
|
|
1242
|
+
"type": "boolean",
|
|
1243
|
+
"mutable": false,
|
|
1244
|
+
"complexType": {
|
|
1245
|
+
"original": "boolean",
|
|
1246
|
+
"resolved": "boolean",
|
|
1247
|
+
"references": {}
|
|
1248
|
+
},
|
|
1249
|
+
"required": false,
|
|
1250
|
+
"optional": false,
|
|
1251
|
+
"docs": {
|
|
1252
|
+
"tags": [],
|
|
1253
|
+
"text": "Alters the input field's appearance to indicate an error."
|
|
1254
|
+
},
|
|
1255
|
+
"getter": false,
|
|
1256
|
+
"setter": false,
|
|
1257
|
+
"attribute": "error",
|
|
1258
|
+
"reflect": true,
|
|
1259
|
+
"defaultValue": "false"
|
|
1260
|
+
},
|
|
1261
|
+
"errorDescription": {
|
|
1262
|
+
"type": "string",
|
|
1263
|
+
"mutable": false,
|
|
1264
|
+
"complexType": {
|
|
1265
|
+
"original": "string",
|
|
1266
|
+
"resolved": "string",
|
|
1267
|
+
"references": {}
|
|
1268
|
+
},
|
|
1269
|
+
"required": false,
|
|
1270
|
+
"optional": false,
|
|
1271
|
+
"docs": {
|
|
1272
|
+
"tags": [],
|
|
1273
|
+
"text": "A description that appears when there is an error."
|
|
1274
|
+
},
|
|
1275
|
+
"getter": false,
|
|
1276
|
+
"setter": false,
|
|
1277
|
+
"attribute": "error-description",
|
|
1278
|
+
"reflect": true
|
|
1279
|
+
},
|
|
1280
|
+
"readonly": {
|
|
1281
|
+
"type": "boolean",
|
|
1282
|
+
"mutable": false,
|
|
1283
|
+
"complexType": {
|
|
1284
|
+
"original": "boolean",
|
|
1285
|
+
"resolved": "boolean",
|
|
1286
|
+
"references": {}
|
|
1287
|
+
},
|
|
1288
|
+
"required": false,
|
|
1289
|
+
"optional": false,
|
|
1290
|
+
"docs": {
|
|
1291
|
+
"tags": [],
|
|
1292
|
+
"text": "Display the input field's content without allowing users to change it."
|
|
1293
|
+
},
|
|
1294
|
+
"getter": false,
|
|
1295
|
+
"setter": false,
|
|
1296
|
+
"attribute": "readonly",
|
|
1297
|
+
"reflect": true,
|
|
1298
|
+
"defaultValue": "false"
|
|
1299
|
+
},
|
|
1300
|
+
"disabled": {
|
|
1301
|
+
"type": "boolean",
|
|
1302
|
+
"mutable": false,
|
|
1303
|
+
"complexType": {
|
|
1304
|
+
"original": "boolean",
|
|
1305
|
+
"resolved": "boolean",
|
|
1306
|
+
"references": {}
|
|
1307
|
+
},
|
|
1308
|
+
"required": false,
|
|
1309
|
+
"optional": false,
|
|
1310
|
+
"docs": {
|
|
1311
|
+
"tags": [],
|
|
1312
|
+
"text": "Disables the input field."
|
|
1313
|
+
},
|
|
1314
|
+
"getter": false,
|
|
1315
|
+
"setter": false,
|
|
1316
|
+
"attribute": "disabled",
|
|
1317
|
+
"reflect": true,
|
|
1318
|
+
"defaultValue": "false"
|
|
1319
|
+
},
|
|
1320
|
+
"autocomplete": {
|
|
1321
|
+
"type": "string",
|
|
1322
|
+
"mutable": false,
|
|
1323
|
+
"complexType": {
|
|
1324
|
+
"original": "`${TextInputAutocomplete}`",
|
|
1325
|
+
"resolved": "\"on\" | \"off\" | \"home\" | \"section-*\" | \"shipping\" | \"billing\" | \"work\" | \"mobile\" | \"fax\" | \"pager\" | \"tel\" | \"tel-country-code\" | \"tel-national\" | \"tel-area-code\" | \"tel-local\" | \"tel-local-prefix\" | \"tel-local-suffix\" | \"tel-extension\" | \"email\" | \"impp\" | \"name\" | \"honorific-prefix\" | \"given-name\" | \"additional-name\" | \"family-name\" | \"honorific-suffix\" | \"nickname\" | \"username\" | \"new-password\" | \"current-password\" | \"one-time-code\" | \"organization-title\" | \"organization\" | \"street-address\" | \"address-line1\" | \"address-line2\" | \"address-line3\" | \"address-level4\" | \"address-level3\" | \"address-level2\" | \"address-level1\" | \"country\" | \"country-name\" | \"postal-code\" | \"cc-name\" | \"cc-given-name\" | \"cc-additional-name\" | \"cc-family-name\" | \"cc-number\" | \"cc-exp\" | \"cc-exp-month\" | \"cc-exp-year\" | \"cc-csc\" | \"cc-type\" | \"transaction-currency\" | \"transaction-amount\" | \"language\" | \"bday\" | \"bday-day\" | \"bday-month\" | \"bday-year\" | \"sex\" | \"url\" | \"photo\"",
|
|
1326
|
+
"references": {
|
|
1327
|
+
"TextInputAutocomplete": {
|
|
1328
|
+
"location": "import",
|
|
1329
|
+
"path": "../../utils/constants",
|
|
1330
|
+
"id": "src/utils/constants.ts::TextInputAutocomplete"
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
},
|
|
1334
|
+
"required": false,
|
|
1335
|
+
"optional": false,
|
|
1336
|
+
"docs": {
|
|
1337
|
+
"tags": [],
|
|
1338
|
+
"text": "The autocomplete prop for faster input filling."
|
|
1339
|
+
},
|
|
1340
|
+
"getter": false,
|
|
1341
|
+
"setter": false,
|
|
1342
|
+
"attribute": "autocomplete",
|
|
1343
|
+
"reflect": true,
|
|
1344
|
+
"defaultValue": "'off'"
|
|
1345
|
+
},
|
|
1346
|
+
"filterable": {
|
|
1347
|
+
"type": "boolean",
|
|
1348
|
+
"mutable": true,
|
|
1349
|
+
"complexType": {
|
|
1350
|
+
"original": "boolean",
|
|
1351
|
+
"resolved": "boolean",
|
|
1352
|
+
"references": {}
|
|
1353
|
+
},
|
|
1354
|
+
"required": false,
|
|
1355
|
+
"optional": false,
|
|
1356
|
+
"docs": {
|
|
1357
|
+
"tags": [],
|
|
1358
|
+
"text": "Enables or disables the filtering feature for the multiselect items."
|
|
1359
|
+
},
|
|
1360
|
+
"getter": false,
|
|
1361
|
+
"setter": false,
|
|
1362
|
+
"attribute": "filterable",
|
|
1363
|
+
"reflect": true,
|
|
1364
|
+
"defaultValue": "false"
|
|
1365
|
+
},
|
|
1366
|
+
"value": {
|
|
1367
|
+
"type": "string",
|
|
1368
|
+
"mutable": true,
|
|
1369
|
+
"complexType": {
|
|
1370
|
+
"original": "string",
|
|
1371
|
+
"resolved": "string",
|
|
1372
|
+
"references": {}
|
|
1373
|
+
},
|
|
1374
|
+
"required": false,
|
|
1375
|
+
"optional": false,
|
|
1376
|
+
"docs": {
|
|
1377
|
+
"tags": [],
|
|
1378
|
+
"text": "Specifies the value of the input field."
|
|
1379
|
+
},
|
|
1380
|
+
"getter": false,
|
|
1381
|
+
"setter": false,
|
|
1382
|
+
"attribute": "value",
|
|
1383
|
+
"reflect": true
|
|
1384
|
+
},
|
|
1385
|
+
"open": {
|
|
1386
|
+
"type": "boolean",
|
|
1387
|
+
"mutable": true,
|
|
1388
|
+
"complexType": {
|
|
1389
|
+
"original": "boolean",
|
|
1390
|
+
"resolved": "boolean",
|
|
1391
|
+
"references": {}
|
|
1392
|
+
},
|
|
1393
|
+
"required": false,
|
|
1394
|
+
"optional": false,
|
|
1395
|
+
"docs": {
|
|
1396
|
+
"tags": [],
|
|
1397
|
+
"text": "State of the multiselect popover."
|
|
1398
|
+
},
|
|
1399
|
+
"getter": false,
|
|
1400
|
+
"setter": false,
|
|
1401
|
+
"attribute": "open",
|
|
1402
|
+
"reflect": true,
|
|
1403
|
+
"defaultValue": "false"
|
|
1404
|
+
},
|
|
1405
|
+
"mode": {
|
|
1406
|
+
"type": "string",
|
|
1407
|
+
"mutable": false,
|
|
1408
|
+
"complexType": {
|
|
1409
|
+
"original": "'options' | 'slots'",
|
|
1410
|
+
"resolved": "\"options\" | \"slots\"",
|
|
1411
|
+
"references": {}
|
|
1412
|
+
},
|
|
1413
|
+
"required": false,
|
|
1414
|
+
"optional": false,
|
|
1415
|
+
"docs": {
|
|
1416
|
+
"tags": [],
|
|
1417
|
+
"text": "Multiselect mode: 'options' (JSON data) or 'slots' (custom items).\nThis property is now reflected in the modeState."
|
|
1418
|
+
},
|
|
1419
|
+
"getter": false,
|
|
1420
|
+
"setter": false,
|
|
1421
|
+
"attribute": "mode",
|
|
1422
|
+
"reflect": true
|
|
1423
|
+
},
|
|
1424
|
+
"options": {
|
|
1425
|
+
"type": "string",
|
|
1426
|
+
"mutable": false,
|
|
1427
|
+
"complexType": {
|
|
1428
|
+
"original": "string",
|
|
1429
|
+
"resolved": "string",
|
|
1430
|
+
"references": {}
|
|
1431
|
+
},
|
|
1432
|
+
"required": false,
|
|
1433
|
+
"optional": true,
|
|
1434
|
+
"docs": {
|
|
1435
|
+
"tags": [{
|
|
1436
|
+
"name": "description",
|
|
1437
|
+
"text": "The options are passed as a JSON string."
|
|
1438
|
+
}, {
|
|
1439
|
+
"name": "example",
|
|
1440
|
+
"text": "options='[{\"label\": \"Option 1\", \"value\": \"option1\"}, {\"label\": \"Option 2\", \"value\": \"option2\"}]'"
|
|
1441
|
+
}],
|
|
1442
|
+
"text": "List of options available in the multiselect."
|
|
1443
|
+
},
|
|
1444
|
+
"getter": false,
|
|
1445
|
+
"setter": false,
|
|
1446
|
+
"attribute": "options",
|
|
1447
|
+
"reflect": true
|
|
1448
|
+
},
|
|
1449
|
+
"debounceDelay": {
|
|
1450
|
+
"type": "number",
|
|
1451
|
+
"mutable": false,
|
|
1452
|
+
"complexType": {
|
|
1453
|
+
"original": "number",
|
|
1454
|
+
"resolved": "number",
|
|
1455
|
+
"references": {}
|
|
1456
|
+
},
|
|
1457
|
+
"required": false,
|
|
1458
|
+
"optional": false,
|
|
1459
|
+
"docs": {
|
|
1460
|
+
"tags": [{
|
|
1461
|
+
"name": "default",
|
|
1462
|
+
"text": "300"
|
|
1463
|
+
}],
|
|
1464
|
+
"text": "Delay in milliseconds before the search is triggered when typing in the filter input."
|
|
1465
|
+
},
|
|
1466
|
+
"getter": false,
|
|
1467
|
+
"setter": false,
|
|
1468
|
+
"attribute": "debounce-delay",
|
|
1469
|
+
"reflect": true,
|
|
1470
|
+
"defaultValue": "300"
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
static get states() {
|
|
1475
|
+
return {
|
|
1476
|
+
"parsedOptions": {},
|
|
1477
|
+
"selectedValues": {},
|
|
1478
|
+
"sortedOptions": {},
|
|
1479
|
+
"filterText": {},
|
|
1480
|
+
"isFilterable": {},
|
|
1481
|
+
"modeState": {},
|
|
1482
|
+
"isHandlingEscape": {}
|
|
1483
|
+
};
|
|
1484
|
+
}
|
|
1485
|
+
static get events() {
|
|
1486
|
+
return [{
|
|
1487
|
+
"method": "dropdownItemSelected",
|
|
1488
|
+
"name": "dropdownItemSelected",
|
|
1489
|
+
"bubbles": true,
|
|
1490
|
+
"cancelable": true,
|
|
1491
|
+
"composed": true,
|
|
1492
|
+
"docs": {
|
|
1493
|
+
"tags": [],
|
|
1494
|
+
"text": "Event emitted when an item is selected."
|
|
1495
|
+
},
|
|
1496
|
+
"complexType": {
|
|
1497
|
+
"original": "DropdownItemSelectedEventDetail",
|
|
1498
|
+
"resolved": "DropdownItemSelectedEventDetail",
|
|
1499
|
+
"references": {
|
|
1500
|
+
"DropdownItemSelectedEventDetail": {
|
|
1501
|
+
"location": "import",
|
|
1502
|
+
"path": "../nv-fielddropdownitem/DropdownItemSelectedEventDetail",
|
|
1503
|
+
"id": "src/components/nv-fielddropdownitem/DropdownItemSelectedEventDetail.tsx::DropdownItemSelectedEventDetail"
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
}, {
|
|
1508
|
+
"method": "valueChanged",
|
|
1509
|
+
"name": "valueChanged",
|
|
1510
|
+
"bubbles": true,
|
|
1511
|
+
"cancelable": true,
|
|
1512
|
+
"composed": true,
|
|
1513
|
+
"docs": {
|
|
1514
|
+
"tags": [{
|
|
1515
|
+
"name": "bind",
|
|
1516
|
+
"text": "value"
|
|
1517
|
+
}],
|
|
1518
|
+
"text": "Emitted when the input value changes."
|
|
1519
|
+
},
|
|
1520
|
+
"complexType": {
|
|
1521
|
+
"original": "string",
|
|
1522
|
+
"resolved": "string",
|
|
1523
|
+
"references": {}
|
|
1524
|
+
}
|
|
1525
|
+
}, {
|
|
1526
|
+
"method": "multiselectChange",
|
|
1527
|
+
"name": "multiselectChange",
|
|
1528
|
+
"bubbles": true,
|
|
1529
|
+
"cancelable": true,
|
|
1530
|
+
"composed": true,
|
|
1531
|
+
"docs": {
|
|
1532
|
+
"tags": [],
|
|
1533
|
+
"text": "Event emitted when the selection changes in the multiselect.\nEmits the current list of selected values."
|
|
1534
|
+
},
|
|
1535
|
+
"complexType": {
|
|
1536
|
+
"original": "string[]",
|
|
1537
|
+
"resolved": "string[]",
|
|
1538
|
+
"references": {}
|
|
1539
|
+
}
|
|
1540
|
+
}];
|
|
1541
|
+
}
|
|
1542
|
+
static get methods() {
|
|
1543
|
+
return {
|
|
1544
|
+
"getFilterText": {
|
|
1545
|
+
"complexType": {
|
|
1546
|
+
"signature": "() => Promise<string>",
|
|
1547
|
+
"parameters": [],
|
|
1548
|
+
"references": {
|
|
1549
|
+
"Promise": {
|
|
1550
|
+
"location": "global",
|
|
1551
|
+
"id": "global::Promise"
|
|
1552
|
+
}
|
|
1553
|
+
},
|
|
1554
|
+
"return": "Promise<string>"
|
|
1555
|
+
},
|
|
1556
|
+
"docs": {
|
|
1557
|
+
"text": "Retrieves the current filter text entered by the user.",
|
|
1558
|
+
"tags": [{
|
|
1559
|
+
"name": "returns",
|
|
1560
|
+
"text": "The filter text."
|
|
1561
|
+
}]
|
|
1562
|
+
}
|
|
1563
|
+
},
|
|
1564
|
+
"resetFilter": {
|
|
1565
|
+
"complexType": {
|
|
1566
|
+
"signature": "() => Promise<void>",
|
|
1567
|
+
"parameters": [],
|
|
1568
|
+
"references": {
|
|
1569
|
+
"Promise": {
|
|
1570
|
+
"location": "global",
|
|
1571
|
+
"id": "global::Promise"
|
|
1572
|
+
},
|
|
1573
|
+
"HTMLElement": {
|
|
1574
|
+
"location": "global",
|
|
1575
|
+
"id": "global::HTMLElement"
|
|
1576
|
+
}
|
|
1577
|
+
},
|
|
1578
|
+
"return": "Promise<void>"
|
|
1579
|
+
},
|
|
1580
|
+
"docs": {
|
|
1581
|
+
"text": "Reset the filter and make all items visible.",
|
|
1582
|
+
"tags": []
|
|
1583
|
+
}
|
|
1584
|
+
},
|
|
1585
|
+
"getSelectedValues": {
|
|
1586
|
+
"complexType": {
|
|
1587
|
+
"signature": "() => Promise<string[]>",
|
|
1588
|
+
"parameters": [],
|
|
1589
|
+
"references": {
|
|
1590
|
+
"Promise": {
|
|
1591
|
+
"location": "global",
|
|
1592
|
+
"id": "global::Promise"
|
|
1593
|
+
}
|
|
1594
|
+
},
|
|
1595
|
+
"return": "Promise<string[]>"
|
|
1596
|
+
},
|
|
1597
|
+
"docs": {
|
|
1598
|
+
"text": "Returns the list of selected values.",
|
|
1599
|
+
"tags": [{
|
|
1600
|
+
"name": "returns",
|
|
1601
|
+
"text": "The selected values."
|
|
1602
|
+
}]
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
static get elementRef() { return "el"; }
|
|
1608
|
+
static get watchers() {
|
|
1609
|
+
return [{
|
|
1610
|
+
"propName": "options",
|
|
1611
|
+
"methodName": "handleOptionsChange"
|
|
1612
|
+
}, {
|
|
1613
|
+
"propName": "value",
|
|
1614
|
+
"methodName": "watchValueHandler"
|
|
1615
|
+
}, {
|
|
1616
|
+
"propName": "filterable",
|
|
1617
|
+
"methodName": "watchFilterableHandler"
|
|
1618
|
+
}, {
|
|
1619
|
+
"propName": "mode",
|
|
1620
|
+
"methodName": "handleModeChange"
|
|
1621
|
+
}];
|
|
1622
|
+
}
|
|
1623
|
+
static get listeners() {
|
|
1624
|
+
return [{
|
|
1625
|
+
"name": "openChanged",
|
|
1626
|
+
"method": "handleOpenChanged",
|
|
1627
|
+
"target": undefined,
|
|
1628
|
+
"capture": false,
|
|
1629
|
+
"passive": false
|
|
1630
|
+
}, {
|
|
1631
|
+
"name": "itemChecked",
|
|
1632
|
+
"method": "handleItemChecked",
|
|
1633
|
+
"target": undefined,
|
|
1634
|
+
"capture": false,
|
|
1635
|
+
"passive": false
|
|
1636
|
+
}, {
|
|
1637
|
+
"name": "slotchange",
|
|
1638
|
+
"method": "handleSlotChange",
|
|
1639
|
+
"target": undefined,
|
|
1640
|
+
"capture": false,
|
|
1641
|
+
"passive": false
|
|
1642
|
+
}, {
|
|
1643
|
+
"name": "keydown",
|
|
1644
|
+
"method": "handleKeyDown",
|
|
1645
|
+
"target": undefined,
|
|
1646
|
+
"capture": false,
|
|
1647
|
+
"passive": false
|
|
1648
|
+
}];
|
|
1649
|
+
}
|
|
1650
|
+
}
|
|
1651
|
+
//# sourceMappingURL=nv-fieldmultiselect.js.map
|