@aquera/nile-elements 0.1.74-beta-1.0 → 0.1.75-beta-1.2
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/README.md +3 -0
- package/demo/index.html +117 -22
- package/dist/{fixture-3bfb4490.cjs.js → fixture-5b79f853.cjs.js} +2 -2
- package/dist/{fixture-3bfb4490.cjs.js.map → fixture-5b79f853.cjs.js.map} +1 -1
- package/dist/{fixture-e7023246.esm.js → fixture-90b199c4.esm.js} +1 -1
- package/dist/{fixture-8edec91c.esm.js → fixture-cf7bfcf5.esm.js} +1 -1
- package/dist/{fixture-7bfb866e.cjs.js → fixture-dbd66009.cjs.js} +2 -2
- package/dist/{fixture-fe6c932e.cjs.js.map → fixture-dbd66009.cjs.js.map} +1 -1
- package/dist/index.js +10 -5
- package/dist/nile-accordion/nile-accordian.test.cjs.js +1 -1
- package/dist/nile-accordion/nile-accordian.test.esm.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.esm.js +1 -1
- package/dist/nile-avatar/nile-avatar.test.cjs.js +1 -1
- package/dist/nile-avatar/nile-avatar.test.esm.js +1 -1
- package/dist/nile-badge/nile-badge.test.cjs.js +1 -1
- package/dist/nile-badge/nile-badge.test.esm.js +1 -1
- package/dist/nile-button/nile-button.test.cjs.js +1 -1
- package/dist/nile-button/nile-button.test.esm.js +1 -1
- package/dist/nile-button-toggle-group/nile-button-toggle-group.test.cjs.js +1 -1
- package/dist/nile-button-toggle-group/nile-button-toggle-group.test.esm.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.esm.js +1 -1
- package/dist/nile-card/nile-card.test.cjs.js +1 -1
- package/dist/nile-card/nile-card.test.esm.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.cjs.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.esm.js +1 -1
- package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.test.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.test.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.test.esm.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.esm.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.test.cjs.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.test.esm.js +1 -1
- package/dist/nile-empty-state/nile-empty-state.test.cjs.js +1 -1
- package/dist/nile-empty-state/nile-empty-state.test.esm.js +1 -1
- package/dist/nile-error-message/nile-error-message.test.cjs.js +1 -1
- package/dist/nile-error-message/nile-error-message.test.esm.js +1 -1
- package/dist/nile-file-preview/nile-file-preview.test.cjs.js +1 -1
- package/dist/nile-file-preview/nile-file-preview.test.esm.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.test.cjs.js +1 -1
- package/dist/nile-file-upload/nile-file-upload.test.esm.js +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.test.cjs.js +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.test.esm.js +1 -1
- package/dist/nile-form-group/nile-form-group.test.cjs.js +1 -1
- package/dist/nile-form-group/nile-form-group.test.esm.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.esm.js +1 -1
- package/dist/nile-hero/nile-hero.test.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.test.esm.js +1 -1
- package/dist/nile-icon/nile-icon.test.cjs.js +1 -1
- package/dist/nile-icon/nile-icon.test.esm.js +1 -1
- package/dist/nile-input/nile-input.test.cjs.js +1 -1
- package/dist/nile-input/nile-input.test.esm.js +1 -1
- package/dist/nile-link/nile-link.test.cjs.js +1 -1
- package/dist/nile-link/nile-link.test.esm.js +1 -1
- package/dist/nile-loader/nile-loader.test.cjs.js +1 -1
- package/dist/nile-loader/nile-loader.test.esm.js +1 -1
- package/dist/nile-popover/nile-popover.test.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.test.esm.js +1 -1
- package/dist/nile-popup/nile-popup.test.cjs.js +1 -1
- package/dist/nile-popup/nile-popup.test.esm.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.test.cjs.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.test.esm.js +1 -1
- package/dist/nile-radio/nile-radio.test.cjs.js +1 -1
- package/dist/nile-radio/nile-radio.test.esm.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.test.cjs.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.test.esm.js +1 -1
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.esm.js +1 -1
- package/dist/nile-select/nile-select.test.cjs.js +1 -1
- package/dist/nile-select/nile-select.test.esm.js +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.test.cjs.js +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.test.esm.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.esm.js +1 -1
- package/dist/nile-textarea/nile-textarea.test.cjs.js +1 -1
- package/dist/nile-textarea/nile-textarea.test.esm.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.esm.js +4 -0
- package/dist/nile-virtual-select/nile-virtual-select.esm.js +2 -2
- package/dist/nile-virtual-select/nile-virtual-select.test.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.test.esm.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js.map +1 -1
- package/dist/nile-virtual-select/renderer.esm.js +4 -3
- package/dist/nile-virtual-select/temp_nile-virtual-select copy.cjs.js +2 -0
- package/dist/nile-virtual-select/temp_nile-virtual-select copy.cjs.js.map +1 -0
- package/dist/nile-virtual-select/temp_nile-virtual-select copy.esm.js +231 -0
- package/dist/src/internal/resizable-helper.d.ts +59 -0
- package/dist/src/internal/resizable-helper.js +115 -0
- package/dist/src/internal/resizable-helper.js.map +1 -0
- package/dist/src/internal/resizable-styles.d.ts +16 -0
- package/dist/src/internal/resizable-styles.js +144 -0
- package/dist/src/internal/resizable-styles.js.map +1 -0
- package/dist/src/internal/virtualizer-error-handler.d.ts +30 -0
- package/dist/src/internal/virtualizer-error-handler.js +82 -0
- package/dist/src/internal/virtualizer-error-handler.js.map +1 -0
- package/dist/src/lib/index.d.ts +7 -0
- package/dist/src/lib/index.js +8 -0
- package/dist/src/lib/index.js.map +1 -0
- package/dist/src/lib/virtualize.d.ts +32 -0
- package/dist/src/lib/virtualize.js +105 -0
- package/dist/src/lib/virtualize.js.map +1 -0
- package/dist/src/lib/virtualize.test.d.ts +7 -0
- package/dist/src/lib/virtualize.test.js +57 -0
- package/dist/src/lib/virtualize.test.js.map +1 -0
- package/dist/src/nile-badge/__snapshots__/nile-badge.test.snap.js +17 -0
- package/dist/src/nile-calendar/__snapshots__/nile-calendar.test.snap.js +310 -0
- package/dist/src/nile-card/__snapshots__/nile-card.test.snap.js +34 -0
- package/dist/src/nile-checkbox/__snapshots__/nile-checkbox.test.snap.js +31 -0
- package/dist/src/nile-grid/data-processor.d.ts +37 -0
- package/dist/src/nile-grid/data-processor.js +122 -0
- package/dist/src/nile-grid/data-processor.js.map +1 -0
- package/dist/src/nile-grid/event-handlers.d.ts +35 -0
- package/dist/src/nile-grid/event-handlers.js +158 -0
- package/dist/src/nile-grid/event-handlers.js.map +1 -0
- package/dist/src/nile-grid/index.d.ts +5 -0
- package/dist/src/nile-grid/index.js +6 -0
- package/dist/src/nile-grid/index.js.map +1 -0
- package/dist/src/nile-grid/nile-grid.css.d.ts +1 -0
- package/dist/src/nile-grid/nile-grid.css.js +120 -0
- package/dist/src/nile-grid/nile-grid.css.js.map +1 -0
- package/dist/src/nile-grid/nile-grid.d.ts +39 -0
- package/dist/src/nile-grid/nile-grid.js +182 -0
- package/dist/src/nile-grid/nile-grid.js.map +1 -0
- package/dist/src/nile-grid/renderer.d.ts +8 -0
- package/dist/src/nile-grid/renderer.js +78 -0
- package/dist/src/nile-grid/renderer.js.map +1 -0
- package/dist/src/nile-grid/resize-handler.d.ts +4 -0
- package/dist/src/nile-grid/resize-handler.js +36 -0
- package/dist/src/nile-grid/resize-handler.js.map +1 -0
- package/dist/src/nile-grid/types.d.ts +32 -0
- package/dist/src/nile-grid/types.js +2 -0
- package/dist/src/nile-grid/types.js.map +1 -0
- package/dist/src/nile-grid/utils.d.ts +4 -0
- package/dist/src/nile-grid/utils.js +32 -0
- package/dist/src/nile-grid/utils.js.map +1 -0
- package/dist/src/nile-hero/__snapshots__/nile-hero.test.snap.js +47 -0
- package/dist/src/nile-icon/__snapshots__/nile-icon.test.snap.js +16 -0
- package/dist/src/nile-input/__snapshots__/nile-input.test.snap.js +75 -0
- package/dist/src/nile-popover/__snapshots__/nile-popover.test.snap.js +22 -0
- package/dist/src/nile-select/nile-select.js +3 -2
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-table-body/virtual-scroll-helper.d.ts +9 -0
- package/dist/src/nile-table-body/virtual-scroll-helper.js +24 -0
- package/dist/src/nile-table-body/virtual-scroll-helper.js.map +1 -0
- package/dist/src/nile-virtual-select/nile-virtual-select.css.js +4 -0
- package/dist/src/nile-virtual-select/nile-virtual-select.css.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.d.ts +10 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.js +71 -9
- package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
- package/dist/src/nile-virtual-select/renderer.d.ts +2 -2
- package/dist/src/nile-virtual-select/renderer.js +6 -5
- package/dist/src/nile-virtual-select/renderer.js.map +1 -1
- package/dist/src/nile-virtual-select/temp_nile-virtual-select copy.d.ts +273 -0
- package/dist/src/nile-virtual-select/temp_nile-virtual-select copy.js +1305 -0
- package/dist/src/nile-virtual-select/temp_nile-virtual-select copy.js.map +1 -0
- package/dist/src/nile-virtual-select/virtualizer-error-handler.d.ts +21 -0
- package/dist/src/nile-virtual-select/virtualizer-error-handler.js +56 -0
- package/dist/src/nile-virtual-select/virtualizer-error-handler.js.map +1 -0
- package/dist/src/nile-virtual-table-body/index.d.ts +2 -0
- package/dist/src/nile-virtual-table-body/index.js +3 -0
- package/dist/src/nile-virtual-table-body/index.js.map +1 -0
- package/dist/src/nile-virtual-table-body/nile-virtual-table-body.css.d.ts +1 -0
- package/dist/src/nile-virtual-table-body/nile-virtual-table-body.css.js +44 -0
- package/dist/src/nile-virtual-table-body/nile-virtual-table-body.css.js.map +1 -0
- package/dist/src/nile-virtual-table-body/nile-virtual-table-body.d.ts +50 -0
- package/dist/src/nile-virtual-table-body/nile-virtual-table-body.js +135 -0
- package/dist/src/nile-virtual-table-body/nile-virtual-table-body.js.map +1 -0
- package/dist/src/nile-virtual-table-body/renderer.d.ts +16 -0
- package/dist/src/nile-virtual-table-body/renderer.js +49 -0
- package/dist/src/nile-virtual-table-body/renderer.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-select/nile-select.ts +3 -2
- package/src/nile-virtual-select/nile-virtual-select.css.ts +4 -0
- package/src/nile-virtual-select/nile-virtual-select.ts +86 -11
- package/src/nile-virtual-select/renderer.ts +7 -5
- package/src/nile-virtual-select/temp_nile-virtual-select copy.ts +1398 -0
- package/vscode-html-custom-data.json +246 -1
- package/dist/axe.min-2b379f29.cjs.js +0 -12
- package/dist/axe.min-2b379f29.cjs.js.map +0 -1
- package/dist/axe.min-c2cd8733.esm.js +0 -12
- package/dist/fixture-2b5b3aba.esm.js +0 -569
- package/dist/fixture-7bfb866e.cjs.js.map +0 -1
- package/dist/fixture-fe6c932e.cjs.js +0 -395
@@ -0,0 +1,1305 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright Aquera Inc 2025
|
3
|
+
*
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { __decorate } from "tslib";
|
8
|
+
import { html, } from 'lit';
|
9
|
+
import { customElement, property } from 'lit/decorators.js';
|
10
|
+
import { styles } from './nile-virtual-select.css';
|
11
|
+
import '../nile-icon';
|
12
|
+
import '../nile-popup/nile-popup';
|
13
|
+
import '../nile-tag/nile-tag';
|
14
|
+
import '../nile-checkbox/nile-checkbox';
|
15
|
+
import '../nile-loader/nile-loader';
|
16
|
+
import { animateTo, stopAnimations } from '../internal/animate';
|
17
|
+
import { classMap } from 'lit/directives/class-map.js';
|
18
|
+
import { query, state } from 'lit/decorators.js';
|
19
|
+
import { defaultValue } from '../internal/default-value';
|
20
|
+
import { FormControlController } from '../internal/form';
|
21
|
+
import { getAnimation, setDefaultAnimation, } from '../utilities/animation-registry';
|
22
|
+
import { HasSlotController } from '../internal/slot';
|
23
|
+
import { waitForEvent } from '../internal/event';
|
24
|
+
import { watch } from '../internal/watch';
|
25
|
+
import NileElement from '../internal/nile-element';
|
26
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
27
|
+
import { VirtualSelectSelectionManager } from './selection-manager.js';
|
28
|
+
import { VirtualSelectSearchManager } from './search-manager.js';
|
29
|
+
import { VirtualSelectRenderer } from './renderer.js';
|
30
|
+
/**
|
31
|
+
* Nile Virtual Select component.
|
32
|
+
*
|
33
|
+
* @tag nile-virtual-select
|
34
|
+
*
|
35
|
+
*/
|
36
|
+
/**
|
37
|
+
* @summary Virtual select component for handling large datasets with virtual scrolling.
|
38
|
+
* @status stable
|
39
|
+
* @since 2.0
|
40
|
+
*
|
41
|
+
* @dependency nile-icon
|
42
|
+
* @dependency nile-popup
|
43
|
+
* @dependency nile-tag
|
44
|
+
* @dependency nile-checkbox
|
45
|
+
*
|
46
|
+
* @slot label - The input's label. Alternatively, you can use the `label` attribute.
|
47
|
+
* @slot prefix - Used to prepend a presentational icon or similar element to the combobox.
|
48
|
+
* @slot clear-icon - An icon to use in lieu of the default clear icon.
|
49
|
+
* @slot expand-icon - The icon to show when the control is expanded and collapsed.
|
50
|
+
* @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.
|
51
|
+
*
|
52
|
+
* @event nile-change - Emitted when the control's value changes.
|
53
|
+
* @event nile-clear - Emitted when the control's value is cleared.
|
54
|
+
* @event nile-input - Emitted when the control receives input.
|
55
|
+
* @event nile-focus - Emitted when the control gains focus.
|
56
|
+
* @event nile-blur - Emitted when the control loses focus.
|
57
|
+
* @event nile-show - Emitted when the select's menu opens.
|
58
|
+
* @event nile-after-show - Emitted after the select's menu opens and all animations are complete.
|
59
|
+
* @event nile-hide - Emitted when the select's menu closes.
|
60
|
+
* @event nile-after-hide - Emitted after the select's menu closes and all animations are complete.
|
61
|
+
* @event nile-invalid - Emitted when the form control has been checked for validity and its constraints aren't satisfied.
|
62
|
+
* @event nile-search - Emitted when the user types in the search input. The event payload includes the search query for backend search functionality.
|
63
|
+
* @event nile-scroll - Emitted when the user scrolls within the virtualized container. The event payload includes scroll position information.
|
64
|
+
* @event nile-scroll-start - Emitted when the user starts scrolling within the virtualized container.
|
65
|
+
* @event nile-scroll-end - Emitted when the user stops scrolling and reaches the bottom of the virtualized container (debounced).
|
66
|
+
*
|
67
|
+
* @csspart form-control - The form control that wraps the label, input, and help text.
|
68
|
+
* @csspart form-control-label - The label's wrapper.
|
69
|
+
* @csspart form-control-input - The select's wrapper.
|
70
|
+
* @csspart form-control-help-text - The help text's wrapper.
|
71
|
+
* @csspart combobox - The container the wraps the prefix, combobox, clear icon, and expand button.
|
72
|
+
* @csspart prefix - The container that wraps the prefix slot.
|
73
|
+
* @csspart display-input - The element that displays the selected option's label, an `<input>` element.
|
74
|
+
* @csspart listbox - The listbox container where options are slotted.
|
75
|
+
* @csspart tags - The container that houses option tags when `multiple` is used.
|
76
|
+
* @csspart tag - The individual tags that represent each multiselect option.
|
77
|
+
* @csspart clear-button - The clear button.
|
78
|
+
* @csspart expand-icon - The container that wraps the expand icon.
|
79
|
+
* @csspart footer - The footer container with show selected and clear all options.
|
80
|
+
*/
|
81
|
+
let NileVirtualSelect = class NileVirtualSelect extends NileElement {
|
82
|
+
constructor() {
|
83
|
+
super(...arguments);
|
84
|
+
this.formControlController = new FormControlController(this, {
|
85
|
+
assumeInteractionOn: ['nile-blur', 'nile-input'],
|
86
|
+
});
|
87
|
+
this.hasSlotController = new HasSlotController(this, 'help-text', 'label');
|
88
|
+
this.hasFocus = false;
|
89
|
+
this.displayLabel = '';
|
90
|
+
this.selectedOptions = [];
|
91
|
+
this.oldValue = '';
|
92
|
+
this.scrolling = false;
|
93
|
+
/** The name of the select, submitted as a name/value pair with form data. */
|
94
|
+
this.name = '';
|
95
|
+
/** Array of all option items for virtual scrolling */
|
96
|
+
this.data = [];
|
97
|
+
/** Original unfiltered option items for search functionality */
|
98
|
+
this.originalOptionItems = [];
|
99
|
+
/**
|
100
|
+
* The current value of the select. When `multiple` is enabled, the value will be an array of selected values.
|
101
|
+
*/
|
102
|
+
this.value = '';
|
103
|
+
/** The default value of the form control. Primarily used for resetting the form control. */
|
104
|
+
this.defaultValue = '';
|
105
|
+
/** The select's size. */
|
106
|
+
this.size = 'medium';
|
107
|
+
/** Placeholder text to show as a hint when the select is empty. */
|
108
|
+
this.placeholder = 'Select...';
|
109
|
+
/** Current search value */
|
110
|
+
this.searchValue = '';
|
111
|
+
/** Enable search functionality */
|
112
|
+
this.searchEnabled = false;
|
113
|
+
/** Search input placeholder */
|
114
|
+
this.internalSearchPlaceHolder = 'Search...';
|
115
|
+
/** Disable local search filtering */
|
116
|
+
this.disableLocalSearch = false;
|
117
|
+
/** Show loading state */
|
118
|
+
this.optionsLoading = false;
|
119
|
+
/** Show loading state using nile-loader */
|
120
|
+
this.loading = false;
|
121
|
+
/** Allows more than one option to be selected. */
|
122
|
+
this.multiple = false;
|
123
|
+
/** Help text */
|
124
|
+
this.helpText = '';
|
125
|
+
/** Error message */
|
126
|
+
this.errorMessage = '';
|
127
|
+
/** Sets the input to a warning state */
|
128
|
+
this.warning = false;
|
129
|
+
/** Sets the input to an error state */
|
130
|
+
this.error = false;
|
131
|
+
/** Sets the input to a success state */
|
132
|
+
this.success = false;
|
133
|
+
/** Disables the select control. */
|
134
|
+
this.disabled = false;
|
135
|
+
/** Adds a clear button when the select is not empty. */
|
136
|
+
this.clearable = false;
|
137
|
+
/** The select's open state. */
|
138
|
+
this.open = false;
|
139
|
+
/**
|
140
|
+
* Enable this option to prevent the listbox from being clipped when the component is placed inside a container with
|
141
|
+
* `overflow: auto|scroll`. Hoisting uses a fixed positioning strategy that works in many, but not all, scenarios.
|
142
|
+
*/
|
143
|
+
this.hoist = false;
|
144
|
+
/** Draws a filled select. */
|
145
|
+
this.filled = false;
|
146
|
+
/** Draws a pill-style select with rounded edges. */
|
147
|
+
this.pill = false;
|
148
|
+
/** The select's label. If you need to display HTML, use the `label` slot instead. */
|
149
|
+
this.label = '';
|
150
|
+
/**
|
151
|
+
* The preferred placement of the select's menu. Note that the actual placement may vary as needed to keep the listbox
|
152
|
+
* inside of the viewport.
|
153
|
+
*/
|
154
|
+
this.placement = 'bottom';
|
155
|
+
/**
|
156
|
+
* By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you
|
157
|
+
* to place the form control outside of a form and associate it with the form that has this `id`. The form must be in
|
158
|
+
* the same document or shadow root for this to work.
|
159
|
+
*/
|
160
|
+
this.form = '';
|
161
|
+
/** The select's required attribute. */
|
162
|
+
this.required = false;
|
163
|
+
/** Show no results message */
|
164
|
+
this.showNoResults = false;
|
165
|
+
/** No results message */
|
166
|
+
this.noResultsMessage = 'No results found';
|
167
|
+
/** Show selected options only */
|
168
|
+
this.showSelected = false;
|
169
|
+
/** Block value change events */
|
170
|
+
this.blockValueChange = false;
|
171
|
+
/** Disable width synchronization */
|
172
|
+
this.noWidthSync = false;
|
173
|
+
/**
|
174
|
+
* The maximum number of selected options to show when `multiple` is true. After the maximum, "+n" will be shown to
|
175
|
+
* indicate the number of additional items that are selected. Set to 0 to remove the limit.
|
176
|
+
*/
|
177
|
+
this.maxOptionsVisible = 3;
|
178
|
+
this.oldMaxOptionsVisible = 1;
|
179
|
+
this.handleDocumentMouseDown = (event) => {
|
180
|
+
if (!this.open)
|
181
|
+
return;
|
182
|
+
const path = event.composedPath();
|
183
|
+
const hitSelf = path.includes(this);
|
184
|
+
const hitPopup = this.popup && path.includes(this.popup);
|
185
|
+
if (!hitSelf && !hitPopup) {
|
186
|
+
this.hide();
|
187
|
+
}
|
188
|
+
};
|
189
|
+
}
|
190
|
+
/** Gets the validity state object */
|
191
|
+
get validity() {
|
192
|
+
return this.valueInput?.validity;
|
193
|
+
}
|
194
|
+
/** Gets the validation message */
|
195
|
+
get validationMessage() {
|
196
|
+
return this.valueInput?.validationMessage ?? '';
|
197
|
+
}
|
198
|
+
connectedCallback() {
|
199
|
+
super.connectedCallback();
|
200
|
+
this.initializeComponent();
|
201
|
+
this.setupEventListeners();
|
202
|
+
this.updateComplete.then(() => {
|
203
|
+
if (this.value && this.data.length > 0) {
|
204
|
+
this.selectionChanged();
|
205
|
+
}
|
206
|
+
});
|
207
|
+
}
|
208
|
+
disconnectedCallback() {
|
209
|
+
this.removeOpenListeners();
|
210
|
+
// Clear any pending scroll timeout to prevent memory leaks
|
211
|
+
if (this.scrollTimeout) {
|
212
|
+
clearTimeout(this.scrollTimeout);
|
213
|
+
this.scrollTimeout = undefined;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
updated(changedProperties) {
|
217
|
+
if (changedProperties.has('value')) {
|
218
|
+
this.selectionChanged();
|
219
|
+
}
|
220
|
+
}
|
221
|
+
initializeComponent() {
|
222
|
+
this.open = false;
|
223
|
+
this.emit('nile-init');
|
224
|
+
}
|
225
|
+
/**
|
226
|
+
* Get display text for an item using renderItemConfig
|
227
|
+
*/
|
228
|
+
getDisplayText(item) {
|
229
|
+
if (this.renderItemConfig?.getDisplayText) {
|
230
|
+
return this.renderItemConfig.getDisplayText(item);
|
231
|
+
}
|
232
|
+
// Fallback to basic display
|
233
|
+
return item?.label || item?.name || item?.toString() || '';
|
234
|
+
}
|
235
|
+
/**
|
236
|
+
* Get value for an item using renderItemConfig or fallback to item.value
|
237
|
+
*/
|
238
|
+
getItemValue(item) {
|
239
|
+
if (this.renderItemConfig?.getValue) {
|
240
|
+
return this.renderItemConfig.getValue(item);
|
241
|
+
}
|
242
|
+
return item?.value || item;
|
243
|
+
}
|
244
|
+
/**
|
245
|
+
* Get search text for an item using renderItemConfig or fallback to display text
|
246
|
+
*/
|
247
|
+
getSearchText(item) {
|
248
|
+
if (this.renderItemConfig?.getSearchText) {
|
249
|
+
return this.renderItemConfig.getSearchText(item);
|
250
|
+
}
|
251
|
+
return this.getDisplayText(item);
|
252
|
+
}
|
253
|
+
setupEventListeners() {
|
254
|
+
this.handleDocumentFocusIn = this.handleDocumentFocusIn.bind(this);
|
255
|
+
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
256
|
+
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
257
|
+
}
|
258
|
+
addOpenListeners() {
|
259
|
+
document.addEventListener('focusin', this.handleDocumentFocusIn);
|
260
|
+
document.addEventListener('keydown', this.handleDocumentKeyDown);
|
261
|
+
document.addEventListener('mousedown', this.handleDocumentMouseDown);
|
262
|
+
}
|
263
|
+
removeOpenListeners() {
|
264
|
+
document.removeEventListener('focusin', this.handleDocumentFocusIn);
|
265
|
+
document.removeEventListener('keydown', this.handleDocumentKeyDown);
|
266
|
+
document.removeEventListener('mousedown', this.handleDocumentMouseDown);
|
267
|
+
}
|
268
|
+
handleFocus() {
|
269
|
+
this.hasFocus = true;
|
270
|
+
this.emit('nile-focus');
|
271
|
+
}
|
272
|
+
handleBlur() {
|
273
|
+
this.hasFocus = false;
|
274
|
+
this.emit('nile-blur');
|
275
|
+
}
|
276
|
+
handleDocumentFocusIn(event) {
|
277
|
+
if (!this.open)
|
278
|
+
return;
|
279
|
+
const path = event.composedPath();
|
280
|
+
const hitSelf = path.includes(this);
|
281
|
+
const hitPopup = this.popup && path.includes(this.popup);
|
282
|
+
if (!hitSelf && !hitPopup) {
|
283
|
+
this.hide();
|
284
|
+
}
|
285
|
+
}
|
286
|
+
handleDocumentKeyDown(event) {
|
287
|
+
if (this.shouldIgnoreKeyPress(event)) {
|
288
|
+
return;
|
289
|
+
}
|
290
|
+
if (this.isEscapeKey(event)) {
|
291
|
+
this.handleEscapeKey(event);
|
292
|
+
}
|
293
|
+
if (this.isEnterOrSpaceKey(event)) {
|
294
|
+
this.handleEnterOrSpaceKey(event);
|
295
|
+
}
|
296
|
+
}
|
297
|
+
shouldIgnoreKeyPress(event) {
|
298
|
+
const target = event.target;
|
299
|
+
const isClearButton = target.closest('.select__clear') !== null;
|
300
|
+
const isIconButton = target.closest('nile-icon-button') !== null;
|
301
|
+
return isClearButton || isIconButton;
|
302
|
+
}
|
303
|
+
isEscapeKey(event) {
|
304
|
+
return event.key === 'Escape' && this.open;
|
305
|
+
}
|
306
|
+
handleEscapeKey(event) {
|
307
|
+
event.preventDefault();
|
308
|
+
event.stopPropagation();
|
309
|
+
this.hide();
|
310
|
+
this.displayInput.focus({ preventScroll: true });
|
311
|
+
}
|
312
|
+
isEnterOrSpaceKey(event) {
|
313
|
+
return event.key === 'Enter' || event.key === ' ';
|
314
|
+
}
|
315
|
+
handleEnterOrSpaceKey(event) {
|
316
|
+
event.preventDefault();
|
317
|
+
event.stopImmediatePropagation();
|
318
|
+
if (!this.open) {
|
319
|
+
this.show();
|
320
|
+
return;
|
321
|
+
}
|
322
|
+
if (!this.multiple) {
|
323
|
+
this.hide();
|
324
|
+
this.displayInput.focus({ preventScroll: true });
|
325
|
+
}
|
326
|
+
}
|
327
|
+
handleFooterClick(event) {
|
328
|
+
event.stopPropagation();
|
329
|
+
event.preventDefault();
|
330
|
+
}
|
331
|
+
toggleShowSelected(event) {
|
332
|
+
event.stopPropagation();
|
333
|
+
event.preventDefault();
|
334
|
+
if (this.selectedOptions?.length === 0) {
|
335
|
+
return;
|
336
|
+
}
|
337
|
+
this.showSelected = !this.showSelected;
|
338
|
+
if (this.showSelected) {
|
339
|
+
const selectedValues = Array.isArray(this.value) ? this.value : [this.value];
|
340
|
+
this.data = this.originalOptionItems.filter((item) => selectedValues.includes(item.value));
|
341
|
+
}
|
342
|
+
else {
|
343
|
+
this.data = [...this.originalOptionItems];
|
344
|
+
}
|
345
|
+
this.requestUpdate();
|
346
|
+
this.resetScrollPosition();
|
347
|
+
}
|
348
|
+
unSelectAll() {
|
349
|
+
this.showSelected = false;
|
350
|
+
this.value = this.multiple ? [] : '';
|
351
|
+
this.data = [...this.originalOptionItems];
|
352
|
+
this.selectionChanged();
|
353
|
+
this.emit('nile-change', { value: this.value, name: this.name });
|
354
|
+
this.emit('nile-clear', { value: this.multiple ? this.value : '', name: this.name });
|
355
|
+
this.resetScrollPosition();
|
356
|
+
}
|
357
|
+
handleLabelClick() {
|
358
|
+
this.displayInput.focus();
|
359
|
+
this.hide();
|
360
|
+
}
|
361
|
+
handleComboboxMouseDown(event) {
|
362
|
+
if (this.shouldIgnoreComboboxClick(event)) {
|
363
|
+
return;
|
364
|
+
}
|
365
|
+
event.preventDefault();
|
366
|
+
this.displayInput.focus({ preventScroll: true });
|
367
|
+
this.open = !this.open;
|
368
|
+
}
|
369
|
+
shouldIgnoreComboboxClick(event) {
|
370
|
+
const path = event.composedPath();
|
371
|
+
const isIconButton = path.some(el => el instanceof Element && el.tagName.toLowerCase() === 'nile-icon-button');
|
372
|
+
return this.disabled || isIconButton;
|
373
|
+
}
|
374
|
+
handleComboboxKeyDown(event) {
|
375
|
+
if (this.isEnterOrSpaceKey(event)) {
|
376
|
+
event.preventDefault();
|
377
|
+
this.open = !this.open;
|
378
|
+
}
|
379
|
+
}
|
380
|
+
handleClearClick(event) {
|
381
|
+
event.stopPropagation();
|
382
|
+
this.clearSelection();
|
383
|
+
}
|
384
|
+
clearSelection() {
|
385
|
+
const oldValue = this.value;
|
386
|
+
this.value = this.multiple ? [] : '';
|
387
|
+
this.selectionChanged();
|
388
|
+
this.updateComplete.then(() => {
|
389
|
+
this.nileInput({ value: this.value, name: this.name });
|
390
|
+
this.nileChange({ value: this.value, name: this.name });
|
391
|
+
this.emit('nile-clear');
|
392
|
+
});
|
393
|
+
}
|
394
|
+
handleClearMouseDown(event) {
|
395
|
+
event.stopPropagation();
|
396
|
+
}
|
397
|
+
handleOptionClick(event) {
|
398
|
+
const target = event.target;
|
399
|
+
const option = target.closest('nile-option');
|
400
|
+
if (this.shouldBlockValueChange(option)) {
|
401
|
+
return;
|
402
|
+
}
|
403
|
+
const oldValue = this.value;
|
404
|
+
this.oldValue = oldValue;
|
405
|
+
if (option && !option.disabled) {
|
406
|
+
this.handleOptionSelection(option);
|
407
|
+
}
|
408
|
+
}
|
409
|
+
shouldBlockValueChange(option) {
|
410
|
+
if (this.blockValueChange && option) {
|
411
|
+
this.emit('nile-block-change', { value: option?.value, name: this.name });
|
412
|
+
this.hide();
|
413
|
+
return true;
|
414
|
+
}
|
415
|
+
return false;
|
416
|
+
}
|
417
|
+
handleOptionSelection(option) {
|
418
|
+
const optionValue = option.value;
|
419
|
+
if (this.multiple) {
|
420
|
+
this.toggleOptionSelection(optionValue);
|
421
|
+
}
|
422
|
+
else {
|
423
|
+
this.setSelectedOptions(optionValue);
|
424
|
+
}
|
425
|
+
this.updateComplete.then(() => this.displayInput.focus({ preventScroll: true }));
|
426
|
+
if (this.value !== this.oldValue) {
|
427
|
+
this.updateComplete.then(() => {
|
428
|
+
this.nileInput({ value: this.value, name: this.name });
|
429
|
+
this.nileChange({ value: this.value, name: this.name });
|
430
|
+
});
|
431
|
+
}
|
432
|
+
if (!this.multiple) {
|
433
|
+
this.hide();
|
434
|
+
this.displayInput.focus({ preventScroll: true });
|
435
|
+
}
|
436
|
+
}
|
437
|
+
setSelectedOptions(optionValue) {
|
438
|
+
this.value = optionValue;
|
439
|
+
this.selectionChanged();
|
440
|
+
}
|
441
|
+
toggleOptionSelection(optionValue) {
|
442
|
+
const currentValues = Array.isArray(this.value) ? this.value : [];
|
443
|
+
if (currentValues.includes(optionValue)) {
|
444
|
+
this.value = currentValues.filter(v => v !== optionValue);
|
445
|
+
}
|
446
|
+
else {
|
447
|
+
this.value = [...currentValues, optionValue];
|
448
|
+
}
|
449
|
+
this.selectionChanged();
|
450
|
+
}
|
451
|
+
handleTagRemove(event, option) {
|
452
|
+
event.stopPropagation();
|
453
|
+
if (!this.disabled) {
|
454
|
+
this.removeTagFromSelection(option);
|
455
|
+
this.emitTagRemovalEvent(option);
|
456
|
+
}
|
457
|
+
}
|
458
|
+
removeTagFromSelection(option) {
|
459
|
+
let currentValue = this.value;
|
460
|
+
if (!Array.isArray(currentValue)) {
|
461
|
+
currentValue = currentValue ? [currentValue] : [];
|
462
|
+
}
|
463
|
+
const newValue = currentValue.filter((v) => v !== option.value);
|
464
|
+
this.value = newValue;
|
465
|
+
this.selectionChanged();
|
466
|
+
}
|
467
|
+
emitTagRemovalEvent(option) {
|
468
|
+
this.updateComplete.then(() => {
|
469
|
+
this.nileInput({ value: this.value, name: this.name });
|
470
|
+
this.nileChange({ value: this.value, name: this.name });
|
471
|
+
this.emit('nile-tag-remove', { value: this.value, name: this.name, removedtagvalue: option.value });
|
472
|
+
});
|
473
|
+
}
|
474
|
+
selectionChanged() {
|
475
|
+
const itemsToSearch = this.originalOptionItems.length > 0 ? this.originalOptionItems : this.data;
|
476
|
+
this.selectedOptions = VirtualSelectSelectionManager.createVirtualOptionsFromValues(this.value, itemsToSearch, this.getDisplayText.bind(this), this.renderItemConfig?.getValue);
|
477
|
+
if (this.multiple) {
|
478
|
+
if (this.placeholder && this.value.length === 0) {
|
479
|
+
this.displayLabel = '';
|
480
|
+
}
|
481
|
+
else {
|
482
|
+
this.displayLabel = this.selectedOptions.length + ' selected';
|
483
|
+
}
|
484
|
+
}
|
485
|
+
else {
|
486
|
+
const currentValue = Array.isArray(this.value) ? this.value[0] : this.value;
|
487
|
+
const label = this.selectedOptions[0]?.getTextLabel();
|
488
|
+
this.displayLabel = label ? label : currentValue ?? '';
|
489
|
+
}
|
490
|
+
this.updateValidity();
|
491
|
+
if (this.selectedOptions.length === 0) {
|
492
|
+
this.showSelected = false;
|
493
|
+
}
|
494
|
+
this.calculateTotalWidthOfTags();
|
495
|
+
}
|
496
|
+
handleSearchFocus() {
|
497
|
+
document.removeEventListener('keydown', this.handleDocumentKeyDown);
|
498
|
+
}
|
499
|
+
handleSearchBlur() {
|
500
|
+
document.addEventListener('keydown', this.handleDocumentKeyDown);
|
501
|
+
}
|
502
|
+
handleSearchChange(e) {
|
503
|
+
this.searchValue = e.detail.value;
|
504
|
+
this.emit('nile-search', {
|
505
|
+
query: this.searchValue,
|
506
|
+
name: this.name
|
507
|
+
});
|
508
|
+
if (!this.disableLocalSearch) {
|
509
|
+
this.filterVirtualOptions(this.searchValue);
|
510
|
+
this.resetScrollPosition();
|
511
|
+
}
|
512
|
+
}
|
513
|
+
handleScroll(e) {
|
514
|
+
const target = e.target;
|
515
|
+
this.emit('nile-scroll', {
|
516
|
+
scrollTop: target.scrollTop,
|
517
|
+
scrollLeft: target.scrollLeft,
|
518
|
+
name: this.name
|
519
|
+
});
|
520
|
+
if (!this.scrolling) {
|
521
|
+
this.scrolling = true;
|
522
|
+
this.emit('nile-scroll-start', {
|
523
|
+
scrollTop: target.scrollTop,
|
524
|
+
scrollLeft: target.scrollLeft,
|
525
|
+
name: this.name
|
526
|
+
});
|
527
|
+
}
|
528
|
+
clearTimeout(this.scrollTimeout);
|
529
|
+
this.scrollTimeout = window.setTimeout(() => {
|
530
|
+
if (this.scrolling) {
|
531
|
+
this.scrolling = false;
|
532
|
+
}
|
533
|
+
}, 300);
|
534
|
+
const isAtBottom = Math.ceil(target.scrollTop) >= Math.floor(target.scrollHeight - target.offsetHeight);
|
535
|
+
if (isAtBottom) {
|
536
|
+
this.emit('nile-scroll-end', {
|
537
|
+
scrollTop: target.scrollTop,
|
538
|
+
scrollLeft: target.scrollLeft,
|
539
|
+
name: this.name,
|
540
|
+
isAtBottom: true
|
541
|
+
});
|
542
|
+
}
|
543
|
+
}
|
544
|
+
filterVirtualOptions(searchValue) {
|
545
|
+
const result = VirtualSelectSearchManager.filterVirtualOptions(searchValue, this.originalOptionItems, this.data, this.getDisplayText.bind(this), this.renderItemConfig?.getSearchText);
|
546
|
+
this.data = result.filteredItems;
|
547
|
+
this.showNoResults = result.showNoResults;
|
548
|
+
this.showSelected = false;
|
549
|
+
this.requestUpdate();
|
550
|
+
}
|
551
|
+
handleInvalid(event) {
|
552
|
+
this.formControlController.setValidity(false);
|
553
|
+
this.formControlController.emitInvalidEvent(event);
|
554
|
+
}
|
555
|
+
handleDisabledChange() {
|
556
|
+
if (this.disabled) {
|
557
|
+
this.open = false;
|
558
|
+
this.handleOpenChange();
|
559
|
+
}
|
560
|
+
}
|
561
|
+
handleValueChange() {
|
562
|
+
this.selectionChanged();
|
563
|
+
this.requestUpdate();
|
564
|
+
}
|
565
|
+
handleDataChange() {
|
566
|
+
if (this.data.length > 0 && this.open) {
|
567
|
+
this.originalOptionItems = [...this.data];
|
568
|
+
}
|
569
|
+
this.selectionChanged();
|
570
|
+
// Show no results message when data is empty and not loading
|
571
|
+
if (!this.optionsLoading && !this.loading && this.data.length === 0) {
|
572
|
+
this.showNoResults = true;
|
573
|
+
}
|
574
|
+
else if (this.data.length > 0) {
|
575
|
+
this.showNoResults = false;
|
576
|
+
}
|
577
|
+
this.requestUpdate();
|
578
|
+
}
|
579
|
+
handleRenderItemConfigChange() {
|
580
|
+
if (this.value && this.data.length > 0) {
|
581
|
+
this.selectionChanged();
|
582
|
+
this.requestUpdate();
|
583
|
+
}
|
584
|
+
}
|
585
|
+
handleOptionsLoadingChange() {
|
586
|
+
// Show no results message when loading stops and there are no results
|
587
|
+
if (!this.optionsLoading && this.data.length === 0) {
|
588
|
+
this.showNoResults = true;
|
589
|
+
}
|
590
|
+
this.requestUpdate();
|
591
|
+
}
|
592
|
+
handleLoadingChange() {
|
593
|
+
// Show no results message when loading stops and there are no results
|
594
|
+
if (!this.loading && this.data.length === 0) {
|
595
|
+
this.showNoResults = true;
|
596
|
+
}
|
597
|
+
this.requestUpdate();
|
598
|
+
}
|
599
|
+
async handleOpenChange() {
|
600
|
+
if (this.open && !this.disabled) {
|
601
|
+
await this.handleOpen();
|
602
|
+
}
|
603
|
+
else {
|
604
|
+
await this.handleClose();
|
605
|
+
}
|
606
|
+
}
|
607
|
+
async handleOpen() {
|
608
|
+
this.emit('nile-show', { value: this.value, name: this.name });
|
609
|
+
this.addOpenListeners();
|
610
|
+
this.showNoResults = !this.data?.length;
|
611
|
+
await stopAnimations(this);
|
612
|
+
this.popup.active = true;
|
613
|
+
const { keyframes, options } = getAnimation(this, 'select.show', {
|
614
|
+
dir: 'ltr',
|
615
|
+
});
|
616
|
+
await animateTo(this.popup.popup, keyframes, options);
|
617
|
+
this.initializeOriginalItems();
|
618
|
+
this.filterVirtualOptions(this.searchValue);
|
619
|
+
this.resetScrollPosition();
|
620
|
+
this.emit('nile-after-show', { value: this.value, name: this.name });
|
621
|
+
}
|
622
|
+
async handleClose() {
|
623
|
+
this.emit('nile-hide', { value: this.value, name: this.name });
|
624
|
+
this.removeOpenListeners();
|
625
|
+
await stopAnimations(this);
|
626
|
+
const { keyframes, options } = getAnimation(this, 'select.hide', {
|
627
|
+
dir: 'ltr',
|
628
|
+
});
|
629
|
+
await animateTo(this.popup.popup, keyframes, options);
|
630
|
+
this.popup.active = false;
|
631
|
+
this.searchValue = '';
|
632
|
+
this.emit('nile-after-hide', { value: this.value, name: this.name });
|
633
|
+
}
|
634
|
+
initializeOriginalItems() {
|
635
|
+
if (this.data.length > 0) {
|
636
|
+
this.originalOptionItems = [...this.data];
|
637
|
+
}
|
638
|
+
}
|
639
|
+
async show() {
|
640
|
+
if (this.open || this.disabled) {
|
641
|
+
this.open = false;
|
642
|
+
return undefined;
|
643
|
+
}
|
644
|
+
this.open = true;
|
645
|
+
return waitForEvent(this, 'nile-after-show');
|
646
|
+
}
|
647
|
+
async hide() {
|
648
|
+
if (!this.open || this.disabled) {
|
649
|
+
this.open = false;
|
650
|
+
return undefined;
|
651
|
+
}
|
652
|
+
this.open = false;
|
653
|
+
return waitForEvent(this, 'nile-after-hide');
|
654
|
+
}
|
655
|
+
checkValidity() {
|
656
|
+
return this.valueInput.checkValidity();
|
657
|
+
}
|
658
|
+
getForm() {
|
659
|
+
return this.formControlController.getForm();
|
660
|
+
}
|
661
|
+
reportValidity() {
|
662
|
+
return this.valueInput.reportValidity();
|
663
|
+
}
|
664
|
+
setCustomValidity(message) {
|
665
|
+
this.valueInput.setCustomValidity(message);
|
666
|
+
this.formControlController.updateValidity();
|
667
|
+
}
|
668
|
+
focus(options) {
|
669
|
+
this.displayInput.focus(options);
|
670
|
+
}
|
671
|
+
blur() {
|
672
|
+
this.displayInput.blur();
|
673
|
+
}
|
674
|
+
onInputChange(event) {
|
675
|
+
event.stopPropagation();
|
676
|
+
}
|
677
|
+
render() {
|
678
|
+
const hasLabelSlot = this.hasSlotController.test('label');
|
679
|
+
const hasHelpTextSlot = this.hasSlotController.test('help-text');
|
680
|
+
const hasLabelSuffixSlot = this.hasSlotController.test('label-suffix');
|
681
|
+
const hasCustomSelect = this.hasSlotController.test('custom-select');
|
682
|
+
const hasLabel = this.label ? true : !!hasLabelSlot;
|
683
|
+
const hasClearIcon = this.clearable && !this.disabled && this.value.length > 0;
|
684
|
+
const isPlaceholderVisible = !!this.placeholder && this.value.length === 0;
|
685
|
+
const hasHelpText = !!this.helpText;
|
686
|
+
const hasErrorMessage = !!this.errorMessage;
|
687
|
+
return html `
|
688
|
+
<div
|
689
|
+
part="form-control"
|
690
|
+
class=${classMap({
|
691
|
+
'form-control': true,
|
692
|
+
'form-control--small': this.size === 'small',
|
693
|
+
'form-control--medium': this.size === 'medium',
|
694
|
+
'form-control--large': this.size === 'large',
|
695
|
+
'form-control--has-label': hasLabel,
|
696
|
+
'form-control--has-help-text': hasHelpText,
|
697
|
+
})}
|
698
|
+
>
|
699
|
+
${this.renderLabel(hasLabel, hasLabelSuffixSlot)}
|
700
|
+
${this.renderFormControlInput(hasCustomSelect, hasClearIcon, isPlaceholderVisible, hasHelpText, hasErrorMessage)}
|
701
|
+
</div>
|
702
|
+
`;
|
703
|
+
}
|
704
|
+
renderLabel(hasLabel, hasLabelSuffixSlot) {
|
705
|
+
return html `
|
706
|
+
<label
|
707
|
+
id="label"
|
708
|
+
part="form-control-label"
|
709
|
+
class="form-control__label"
|
710
|
+
aria-hidden=${hasLabel ? 'false' : 'true'}
|
711
|
+
@click=${this.handleLabelClick}
|
712
|
+
>
|
713
|
+
<slot name="label">${this.label}</slot>
|
714
|
+
</label>
|
715
|
+
|
716
|
+
${hasLabelSuffixSlot ? html ` <slot name="label-suffix"></slot> ` : ``}
|
717
|
+
`;
|
718
|
+
}
|
719
|
+
renderFormControlInput(hasCustomSelect, hasClearIcon, isPlaceholderVisible, hasHelpText, hasErrorMessage) {
|
720
|
+
return html `
|
721
|
+
<div part="form-control-input" class="form-control-input">
|
722
|
+
${this.renderPopup(hasCustomSelect, hasClearIcon, isPlaceholderVisible)}
|
723
|
+
${this.renderHelpText(hasHelpText, hasErrorMessage)}
|
724
|
+
</div>
|
725
|
+
`;
|
726
|
+
}
|
727
|
+
renderPopup(hasCustomSelect, hasClearIcon, isPlaceholderVisible) {
|
728
|
+
return html `
|
729
|
+
<nile-popup
|
730
|
+
class=${classMap({
|
731
|
+
select: true,
|
732
|
+
'select--warning': this.warning,
|
733
|
+
'select--error': this.error,
|
734
|
+
'select--success': this.success,
|
735
|
+
'select--standard': true,
|
736
|
+
'select--filled': this.filled,
|
737
|
+
'select--pill': this.pill,
|
738
|
+
'select--open': this.open,
|
739
|
+
'select--disabled': this.disabled,
|
740
|
+
'select--multiple': this.multiple,
|
741
|
+
'select--focused': this.hasFocus,
|
742
|
+
'select--placeholder-visible': isPlaceholderVisible,
|
743
|
+
'select--top': this.placement === 'top',
|
744
|
+
'select--bottom': this.placement === 'bottom',
|
745
|
+
'select--small': this.size === 'small',
|
746
|
+
'select--medium': this.size === 'medium',
|
747
|
+
'select--large': this.size === 'large',
|
748
|
+
})}
|
749
|
+
placement=${this.placement}
|
750
|
+
strategy=${this.hoist ? 'fixed' : 'absolute'}
|
751
|
+
distance="6"
|
752
|
+
flip
|
753
|
+
shift
|
754
|
+
sync=${ifDefined(!this.noWidthSync ? 'width' : undefined)}
|
755
|
+
auto-size="vertical"
|
756
|
+
auto-size-padding="10"
|
757
|
+
>
|
758
|
+
${this.renderCustomSelect(hasCustomSelect)}
|
759
|
+
${this.renderCombobox(hasCustomSelect, hasClearIcon)}
|
760
|
+
${this.renderListbox()}
|
761
|
+
</nile-popup>
|
762
|
+
`;
|
763
|
+
}
|
764
|
+
renderCustomSelect(hasCustomSelect) {
|
765
|
+
return hasCustomSelect
|
766
|
+
? html `<slot
|
767
|
+
slot="anchor"
|
768
|
+
name="custom-select"
|
769
|
+
class="custom-select"
|
770
|
+
@keydown=${this.handleComboboxKeyDown}
|
771
|
+
@mousedown=${this.handleComboboxMouseDown}
|
772
|
+
></slot>`
|
773
|
+
: html ``;
|
774
|
+
}
|
775
|
+
renderCombobox(hasCustomSelect, hasClearIcon) {
|
776
|
+
return html `
|
777
|
+
<div
|
778
|
+
part="combobox"
|
779
|
+
class=${classMap({
|
780
|
+
select__combobox: true,
|
781
|
+
'select__hide-default': hasCustomSelect,
|
782
|
+
})}
|
783
|
+
slot="anchor"
|
784
|
+
@keydown=${this.handleComboboxKeyDown}
|
785
|
+
@mousedown=${this.handleComboboxMouseDown}
|
786
|
+
>
|
787
|
+
${this.renderPrefix()}
|
788
|
+
${this.renderDisplayInput()}
|
789
|
+
${this.renderTags()}
|
790
|
+
${this.renderValueInput()}
|
791
|
+
${this.renderClearButton(hasClearIcon)}
|
792
|
+
${this.renderSuffix()}
|
793
|
+
${this.renderExpandIcon()}
|
794
|
+
</div>
|
795
|
+
`;
|
796
|
+
}
|
797
|
+
renderPrefix() {
|
798
|
+
return html `
|
799
|
+
<slot
|
800
|
+
part="prefix"
|
801
|
+
name="prefix"
|
802
|
+
class=${classMap({
|
803
|
+
select__prefix: true,
|
804
|
+
multiple: this.multiple,
|
805
|
+
})}
|
806
|
+
></slot>
|
807
|
+
`;
|
808
|
+
}
|
809
|
+
renderDisplayInput() {
|
810
|
+
return html `
|
811
|
+
<input
|
812
|
+
part="display-input"
|
813
|
+
class="select__display-input"
|
814
|
+
type="text"
|
815
|
+
placeholder=${this.placeholder}
|
816
|
+
.disabled=${this.disabled}
|
817
|
+
.value=${this.displayLabel}
|
818
|
+
autocomplete="off"
|
819
|
+
spellcheck="false"
|
820
|
+
autocapitalize="off"
|
821
|
+
readonly
|
822
|
+
aria-controls="listbox"
|
823
|
+
aria-expanded=${this.open ? 'true' : 'false'}
|
824
|
+
aria-haspopup="listbox"
|
825
|
+
aria-labelledby="label"
|
826
|
+
aria-disabled=${this.disabled ? 'true' : 'false'}
|
827
|
+
aria-describedby="help-text"
|
828
|
+
role="combobox"
|
829
|
+
tabindex="0"
|
830
|
+
/>
|
831
|
+
`;
|
832
|
+
}
|
833
|
+
renderTags() {
|
834
|
+
return this.multiple
|
835
|
+
? html `
|
836
|
+
<div part="tags" class="select__tags">
|
837
|
+
${this.selectedOptions.map((option, index) => {
|
838
|
+
if (index < this.maxOptionsVisible ||
|
839
|
+
this.maxOptionsVisible <= 0) {
|
840
|
+
const classes = {
|
841
|
+
select__invisible: index + 1 > this.oldMaxOptionsVisible &&
|
842
|
+
this.maxOptionsVisible === Infinity,
|
843
|
+
};
|
844
|
+
return html `
|
845
|
+
<nile-tag
|
846
|
+
class=${classMap(classes)}
|
847
|
+
part="tag"
|
848
|
+
exportparts="
|
849
|
+
base:tag__base,
|
850
|
+
content:tag__content,
|
851
|
+
remove-button:tag__remove-button,
|
852
|
+
remove-button__base:tag__remove-button__base
|
853
|
+
"
|
854
|
+
?pill=${this.pill}
|
855
|
+
size=${this.size}
|
856
|
+
removable
|
857
|
+
@nile-remove=${(event) => this.handleTagRemove(event, option)}
|
858
|
+
>
|
859
|
+
${option.getTextLabel()}
|
860
|
+
</nile-tag>
|
861
|
+
`;
|
862
|
+
}
|
863
|
+
else if (index === this.maxOptionsVisible) {
|
864
|
+
return html `
|
865
|
+
<span class="select__tags-count"
|
866
|
+
>+${this.selectedOptions.length - index} More
|
867
|
+
</span>
|
868
|
+
`;
|
869
|
+
}
|
870
|
+
else {
|
871
|
+
return null;
|
872
|
+
}
|
873
|
+
})}
|
874
|
+
</div>
|
875
|
+
`
|
876
|
+
: html ``;
|
877
|
+
}
|
878
|
+
renderValueInput() {
|
879
|
+
return html `
|
880
|
+
<input
|
881
|
+
class="select__value-input"
|
882
|
+
type="text"
|
883
|
+
?disabled=${this.disabled}
|
884
|
+
?required=${this.required}
|
885
|
+
.value=${Array.isArray(this.value)
|
886
|
+
? this.value.join(', ')
|
887
|
+
: this.value}
|
888
|
+
tabindex="-1"
|
889
|
+
aria-hidden="true"
|
890
|
+
@focus=${() => this.focus()}
|
891
|
+
@invalid=${this.handleInvalid}
|
892
|
+
/>
|
893
|
+
`;
|
894
|
+
}
|
895
|
+
renderClearButton(hasClearIcon) {
|
896
|
+
return hasClearIcon
|
897
|
+
? html `
|
898
|
+
<button
|
899
|
+
part="clear-button"
|
900
|
+
class="select__clear"
|
901
|
+
type="button"
|
902
|
+
aria-label="clearEntry"
|
903
|
+
@mousedown=${this.handleClearMouseDown}
|
904
|
+
@click=${this.handleClearClick}
|
905
|
+
tabindex="-1"
|
906
|
+
>
|
907
|
+
<slot name="clear-icon">
|
908
|
+
<nile-icon name="close" library="system"></nile-icon>
|
909
|
+
</slot>
|
910
|
+
</button>
|
911
|
+
`
|
912
|
+
: html ``;
|
913
|
+
}
|
914
|
+
renderSuffix() {
|
915
|
+
return html `
|
916
|
+
<slot
|
917
|
+
part="suffix"
|
918
|
+
name="suffix"
|
919
|
+
class=${classMap({
|
920
|
+
select__suffix: true,
|
921
|
+
})}
|
922
|
+
></slot>
|
923
|
+
`;
|
924
|
+
}
|
925
|
+
renderExpandIcon() {
|
926
|
+
return html `
|
927
|
+
<slot
|
928
|
+
name="expand-icon"
|
929
|
+
part="expand-icon"
|
930
|
+
class="select__expand-icon"
|
931
|
+
>
|
932
|
+
<nile-icon library="system" name="arrowdown"></nile-icon>
|
933
|
+
</slot>
|
934
|
+
`;
|
935
|
+
}
|
936
|
+
renderListbox() {
|
937
|
+
return html `
|
938
|
+
<div
|
939
|
+
id="listbox"
|
940
|
+
role="listbox"
|
941
|
+
aria-expanded=${this.open ? 'true' : 'false'}
|
942
|
+
aria-multiselectable=${this.multiple ? 'true' : 'false'}
|
943
|
+
aria-labelledby="label"
|
944
|
+
part="listbox"
|
945
|
+
class="select__listbox ${this.searchEnabled
|
946
|
+
? 'select__search-enabled '
|
947
|
+
: ''}"
|
948
|
+
tabindex="-1"
|
949
|
+
@mouseup=${this.handleOptionClick}
|
950
|
+
>
|
951
|
+
${this.renderSearch()}
|
952
|
+
${this.getVirtualizedContent()}
|
953
|
+
${this.renderLoader()}
|
954
|
+
${this.renderFooter()}
|
955
|
+
</div>
|
956
|
+
`;
|
957
|
+
}
|
958
|
+
renderSearch() {
|
959
|
+
return this.searchEnabled
|
960
|
+
? html `
|
961
|
+
<div part="search" class="select__search">
|
962
|
+
<nile-input
|
963
|
+
size="small"
|
964
|
+
clearable
|
965
|
+
.value=${this.searchValue}
|
966
|
+
placeholder="${this.internalSearchPlaceHolder}"
|
967
|
+
@nile-input=${this.handleSearchChange}
|
968
|
+
@nile-focus=${this.handleSearchFocus}
|
969
|
+
@nile-change="${this.onInputChange}"
|
970
|
+
>
|
971
|
+
<nile-icon name="search" slot="suffix"> </nile-icon>
|
972
|
+
</nile-input>
|
973
|
+
</div>
|
974
|
+
`
|
975
|
+
: html ``;
|
976
|
+
}
|
977
|
+
renderLoader() {
|
978
|
+
if (this.loading) {
|
979
|
+
return html `
|
980
|
+
<span part="loader" class="virtual-select-loader">
|
981
|
+
<nile-loader size="sm"></nile-loader>
|
982
|
+
</span>
|
983
|
+
`;
|
984
|
+
}
|
985
|
+
if (this.optionsLoading) {
|
986
|
+
return html `
|
987
|
+
<span part="loader" class="select__loader">
|
988
|
+
<nile-icon
|
989
|
+
class="select__loader--icon"
|
990
|
+
name="button-loading-blue"
|
991
|
+
></nile-icon>
|
992
|
+
</span>
|
993
|
+
`;
|
994
|
+
}
|
995
|
+
return html ``;
|
996
|
+
}
|
997
|
+
renderFooter() {
|
998
|
+
return this.multiple
|
999
|
+
? html `
|
1000
|
+
<div
|
1001
|
+
part="footer"
|
1002
|
+
class="select__footer"
|
1003
|
+
@click="${this.handleFooterClick}"
|
1004
|
+
>
|
1005
|
+
<span
|
1006
|
+
@click="${this.toggleShowSelected}"
|
1007
|
+
style="cursor: pointer;"
|
1008
|
+
>
|
1009
|
+
<nile-checkbox
|
1010
|
+
?disabled="${this.selectedOptions.length === 0}"
|
1011
|
+
?checked="${this.showSelected}"
|
1012
|
+
>
|
1013
|
+
Show Selected</nile-checkbox
|
1014
|
+
>
|
1015
|
+
</span>
|
1016
|
+
${this.selectedOptions.length !== 0
|
1017
|
+
? html `
|
1018
|
+
<span
|
1019
|
+
class="select__clear"
|
1020
|
+
@click="${this.unSelectAll}"
|
1021
|
+
>
|
1022
|
+
Clear All
|
1023
|
+
</span>
|
1024
|
+
`
|
1025
|
+
: ``}
|
1026
|
+
</div>
|
1027
|
+
`
|
1028
|
+
: html ``;
|
1029
|
+
}
|
1030
|
+
renderHelpText(hasHelpText, hasErrorMessage) {
|
1031
|
+
return html `
|
1032
|
+
${hasHelpText
|
1033
|
+
? html ` <nile-form-help-text>${this.helpText}</nile-form-help-text> `
|
1034
|
+
: ``}
|
1035
|
+
${hasErrorMessage
|
1036
|
+
? html `
|
1037
|
+
<nile-form-error-message
|
1038
|
+
>${this.errorMessage}</nile-form-error-message
|
1039
|
+
>
|
1040
|
+
`
|
1041
|
+
: ``}
|
1042
|
+
`;
|
1043
|
+
}
|
1044
|
+
getVirtualizedContent() {
|
1045
|
+
return VirtualSelectRenderer.getVirtualizedContent(this.data, this.searchEnabled, this.getDisplayText.bind(this), this.value, this.multiple, this.renderItemConfig?.getDisplayText, this.renderItemConfig?.getValue, this.showNoResults, this.noResultsMessage, this.optionsLoading || this.loading, this.handleScroll.bind(this));
|
1046
|
+
}
|
1047
|
+
nileInput(value) {
|
1048
|
+
this.emit('nile-input', value);
|
1049
|
+
}
|
1050
|
+
nileChange(value) {
|
1051
|
+
this.emit('nile-change', value);
|
1052
|
+
}
|
1053
|
+
updateValidity() {
|
1054
|
+
this.updateComplete.then(() => {
|
1055
|
+
this.formControlController.updateValidity();
|
1056
|
+
});
|
1057
|
+
}
|
1058
|
+
calculateWidthOfSelectTagsDiv() {
|
1059
|
+
if (this.shadowRoot) {
|
1060
|
+
const selectTagsDiv = this.shadowRoot.querySelector('.select__tags');
|
1061
|
+
if (selectTagsDiv) {
|
1062
|
+
const width = selectTagsDiv.offsetWidth;
|
1063
|
+
return width - 70;
|
1064
|
+
}
|
1065
|
+
}
|
1066
|
+
return null;
|
1067
|
+
}
|
1068
|
+
calculateTotalWidthOfTags() {
|
1069
|
+
if (this.maxOptionsVisible !== Infinity) {
|
1070
|
+
this.oldMaxOptionsVisible = this.maxOptionsVisible;
|
1071
|
+
}
|
1072
|
+
this.maxOptionsVisible = Infinity;
|
1073
|
+
setTimeout(() => {
|
1074
|
+
let widths = [];
|
1075
|
+
if (this.shadowRoot) {
|
1076
|
+
const tags = this.shadowRoot.querySelectorAll('nile-tag');
|
1077
|
+
tags.forEach(tag => {
|
1078
|
+
if (tag instanceof HTMLElement) {
|
1079
|
+
widths.push(tag.offsetWidth);
|
1080
|
+
}
|
1081
|
+
});
|
1082
|
+
}
|
1083
|
+
if (this.value.length !== widths.length) {
|
1084
|
+
return;
|
1085
|
+
}
|
1086
|
+
let sum = widths.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
1087
|
+
const widthOfSelectTagsDiv = this.calculateWidthOfSelectTagsDiv();
|
1088
|
+
if (!widthOfSelectTagsDiv) {
|
1089
|
+
return;
|
1090
|
+
}
|
1091
|
+
let summ = 0;
|
1092
|
+
let lastindex = 0;
|
1093
|
+
for (let i = 0; i < widths.length; i++) {
|
1094
|
+
summ += widths[i];
|
1095
|
+
if (summ > widthOfSelectTagsDiv) {
|
1096
|
+
lastindex = i;
|
1097
|
+
break;
|
1098
|
+
}
|
1099
|
+
}
|
1100
|
+
this.maxOptionsVisible = lastindex;
|
1101
|
+
}, 1);
|
1102
|
+
}
|
1103
|
+
resetScrollPosition() {
|
1104
|
+
this.updateComplete.then(() => {
|
1105
|
+
if (this.virtualizedContainer) {
|
1106
|
+
this.virtualizedContainer.scrollTop = 0;
|
1107
|
+
const listbox = this.shadowRoot?.querySelector('.select__listbox');
|
1108
|
+
if (listbox) {
|
1109
|
+
listbox.scrollTop = 0;
|
1110
|
+
}
|
1111
|
+
const virtualizer = this.virtualizedContainer.querySelector('lit-virtualizer');
|
1112
|
+
if (virtualizer) {
|
1113
|
+
virtualizer.scrollTop = 0;
|
1114
|
+
}
|
1115
|
+
}
|
1116
|
+
});
|
1117
|
+
}
|
1118
|
+
};
|
1119
|
+
NileVirtualSelect.styles = styles;
|
1120
|
+
__decorate([
|
1121
|
+
query('.select')
|
1122
|
+
], NileVirtualSelect.prototype, "popup", void 0);
|
1123
|
+
__decorate([
|
1124
|
+
query('.select__display-input')
|
1125
|
+
], NileVirtualSelect.prototype, "displayInput", void 0);
|
1126
|
+
__decorate([
|
1127
|
+
query('.select__value-input')
|
1128
|
+
], NileVirtualSelect.prototype, "valueInput", void 0);
|
1129
|
+
__decorate([
|
1130
|
+
query('.virtualized')
|
1131
|
+
], NileVirtualSelect.prototype, "virtualizedContainer", void 0);
|
1132
|
+
__decorate([
|
1133
|
+
state()
|
1134
|
+
], NileVirtualSelect.prototype, "hasFocus", void 0);
|
1135
|
+
__decorate([
|
1136
|
+
state()
|
1137
|
+
], NileVirtualSelect.prototype, "displayLabel", void 0);
|
1138
|
+
__decorate([
|
1139
|
+
state()
|
1140
|
+
], NileVirtualSelect.prototype, "selectedOptions", void 0);
|
1141
|
+
__decorate([
|
1142
|
+
state()
|
1143
|
+
], NileVirtualSelect.prototype, "oldValue", void 0);
|
1144
|
+
__decorate([
|
1145
|
+
property()
|
1146
|
+
], NileVirtualSelect.prototype, "name", void 0);
|
1147
|
+
__decorate([
|
1148
|
+
property({ type: Array })
|
1149
|
+
], NileVirtualSelect.prototype, "data", void 0);
|
1150
|
+
__decorate([
|
1151
|
+
state()
|
1152
|
+
], NileVirtualSelect.prototype, "originalOptionItems", void 0);
|
1153
|
+
__decorate([
|
1154
|
+
property({
|
1155
|
+
converter: {
|
1156
|
+
fromAttribute: (value) => value.split(' '),
|
1157
|
+
toAttribute: (value) => value.join(' '),
|
1158
|
+
},
|
1159
|
+
})
|
1160
|
+
], NileVirtualSelect.prototype, "value", void 0);
|
1161
|
+
__decorate([
|
1162
|
+
defaultValue()
|
1163
|
+
], NileVirtualSelect.prototype, "defaultValue", void 0);
|
1164
|
+
__decorate([
|
1165
|
+
property()
|
1166
|
+
], NileVirtualSelect.prototype, "size", void 0);
|
1167
|
+
__decorate([
|
1168
|
+
property()
|
1169
|
+
], NileVirtualSelect.prototype, "placeholder", void 0);
|
1170
|
+
__decorate([
|
1171
|
+
state()
|
1172
|
+
], NileVirtualSelect.prototype, "searchValue", void 0);
|
1173
|
+
__decorate([
|
1174
|
+
property({ type: Boolean, reflect: true })
|
1175
|
+
], NileVirtualSelect.prototype, "searchEnabled", void 0);
|
1176
|
+
__decorate([
|
1177
|
+
property({ attribute: 'internal-search-placeholder' })
|
1178
|
+
], NileVirtualSelect.prototype, "internalSearchPlaceHolder", void 0);
|
1179
|
+
__decorate([
|
1180
|
+
property({ type: Boolean, reflect: true })
|
1181
|
+
], NileVirtualSelect.prototype, "disableLocalSearch", void 0);
|
1182
|
+
__decorate([
|
1183
|
+
property({ type: Boolean, reflect: true })
|
1184
|
+
], NileVirtualSelect.prototype, "optionsLoading", void 0);
|
1185
|
+
__decorate([
|
1186
|
+
property({ type: Boolean, reflect: true })
|
1187
|
+
], NileVirtualSelect.prototype, "loading", void 0);
|
1188
|
+
__decorate([
|
1189
|
+
property({ type: Boolean, reflect: true })
|
1190
|
+
], NileVirtualSelect.prototype, "multiple", void 0);
|
1191
|
+
__decorate([
|
1192
|
+
property({ attribute: 'help-text', reflect: true })
|
1193
|
+
], NileVirtualSelect.prototype, "helpText", void 0);
|
1194
|
+
__decorate([
|
1195
|
+
property({ attribute: 'error-message', reflect: true })
|
1196
|
+
], NileVirtualSelect.prototype, "errorMessage", void 0);
|
1197
|
+
__decorate([
|
1198
|
+
property({ type: Boolean })
|
1199
|
+
], NileVirtualSelect.prototype, "warning", void 0);
|
1200
|
+
__decorate([
|
1201
|
+
property({ type: Boolean })
|
1202
|
+
], NileVirtualSelect.prototype, "error", void 0);
|
1203
|
+
__decorate([
|
1204
|
+
property({ type: Boolean })
|
1205
|
+
], NileVirtualSelect.prototype, "success", void 0);
|
1206
|
+
__decorate([
|
1207
|
+
property({ type: Boolean, reflect: true })
|
1208
|
+
], NileVirtualSelect.prototype, "disabled", void 0);
|
1209
|
+
__decorate([
|
1210
|
+
property({ type: Boolean, reflect: true })
|
1211
|
+
], NileVirtualSelect.prototype, "clearable", void 0);
|
1212
|
+
__decorate([
|
1213
|
+
property({ type: Boolean, reflect: true })
|
1214
|
+
], NileVirtualSelect.prototype, "open", void 0);
|
1215
|
+
__decorate([
|
1216
|
+
property({ type: Boolean })
|
1217
|
+
], NileVirtualSelect.prototype, "hoist", void 0);
|
1218
|
+
__decorate([
|
1219
|
+
property({ type: Boolean, reflect: true })
|
1220
|
+
], NileVirtualSelect.prototype, "filled", void 0);
|
1221
|
+
__decorate([
|
1222
|
+
property({ type: Boolean, reflect: true })
|
1223
|
+
], NileVirtualSelect.prototype, "pill", void 0);
|
1224
|
+
__decorate([
|
1225
|
+
property()
|
1226
|
+
], NileVirtualSelect.prototype, "label", void 0);
|
1227
|
+
__decorate([
|
1228
|
+
property({ reflect: true })
|
1229
|
+
], NileVirtualSelect.prototype, "placement", void 0);
|
1230
|
+
__decorate([
|
1231
|
+
property({ reflect: true })
|
1232
|
+
], NileVirtualSelect.prototype, "form", void 0);
|
1233
|
+
__decorate([
|
1234
|
+
property({ type: Boolean, reflect: true })
|
1235
|
+
], NileVirtualSelect.prototype, "required", void 0);
|
1236
|
+
__decorate([
|
1237
|
+
property({ type: Boolean })
|
1238
|
+
], NileVirtualSelect.prototype, "showNoResults", void 0);
|
1239
|
+
__decorate([
|
1240
|
+
property({ type: String })
|
1241
|
+
], NileVirtualSelect.prototype, "noResultsMessage", void 0);
|
1242
|
+
__decorate([
|
1243
|
+
property({ type: Boolean })
|
1244
|
+
], NileVirtualSelect.prototype, "showSelected", void 0);
|
1245
|
+
__decorate([
|
1246
|
+
property({ attribute: false })
|
1247
|
+
], NileVirtualSelect.prototype, "renderItemConfig", void 0);
|
1248
|
+
__decorate([
|
1249
|
+
property({ type: Boolean, reflect: true })
|
1250
|
+
], NileVirtualSelect.prototype, "blockValueChange", void 0);
|
1251
|
+
__decorate([
|
1252
|
+
property({ type: Boolean, reflect: true })
|
1253
|
+
], NileVirtualSelect.prototype, "noWidthSync", void 0);
|
1254
|
+
__decorate([
|
1255
|
+
property({ attribute: 'max-options-visible', type: Number })
|
1256
|
+
], NileVirtualSelect.prototype, "maxOptionsVisible", void 0);
|
1257
|
+
__decorate([
|
1258
|
+
state()
|
1259
|
+
], NileVirtualSelect.prototype, "oldMaxOptionsVisible", void 0);
|
1260
|
+
__decorate([
|
1261
|
+
watch('disabled', { waitUntilFirstUpdate: true })
|
1262
|
+
], NileVirtualSelect.prototype, "handleDisabledChange", null);
|
1263
|
+
__decorate([
|
1264
|
+
watch('value', { waitUntilFirstUpdate: true })
|
1265
|
+
], NileVirtualSelect.prototype, "handleValueChange", null);
|
1266
|
+
__decorate([
|
1267
|
+
watch('data', { waitUntilFirstUpdate: true })
|
1268
|
+
], NileVirtualSelect.prototype, "handleDataChange", null);
|
1269
|
+
__decorate([
|
1270
|
+
watch('renderItemConfig', { waitUntilFirstUpdate: true })
|
1271
|
+
], NileVirtualSelect.prototype, "handleRenderItemConfigChange", null);
|
1272
|
+
__decorate([
|
1273
|
+
watch('optionsLoading', { waitUntilFirstUpdate: true })
|
1274
|
+
], NileVirtualSelect.prototype, "handleOptionsLoadingChange", null);
|
1275
|
+
__decorate([
|
1276
|
+
watch('loading', { waitUntilFirstUpdate: true })
|
1277
|
+
], NileVirtualSelect.prototype, "handleLoadingChange", null);
|
1278
|
+
__decorate([
|
1279
|
+
watch('open', { waitUntilFirstUpdate: true })
|
1280
|
+
], NileVirtualSelect.prototype, "handleOpenChange", null);
|
1281
|
+
NileVirtualSelect = __decorate([
|
1282
|
+
customElement('nile-virtual-select')
|
1283
|
+
], NileVirtualSelect);
|
1284
|
+
export { NileVirtualSelect };
|
1285
|
+
setDefaultAnimation('select.show', {
|
1286
|
+
keyframes: [
|
1287
|
+
{ opacity: 0, scale: 0.9 },
|
1288
|
+
{ opacity: 1, scale: 1 },
|
1289
|
+
],
|
1290
|
+
options: { duration: 100, easing: 'ease' },
|
1291
|
+
});
|
1292
|
+
setDefaultAnimation('select.hide', {
|
1293
|
+
keyframes: [
|
1294
|
+
{ opacity: 1, scale: 1 },
|
1295
|
+
{ opacity: 0, scale: 0.9 },
|
1296
|
+
],
|
1297
|
+
options: { duration: 100, easing: 'ease' },
|
1298
|
+
});
|
1299
|
+
export default NileVirtualSelect;
|
1300
|
+
// declare global {
|
1301
|
+
// interface HTMLElementTagNameMap {
|
1302
|
+
// 'nile-virtual-select': NileVirtualSelect;
|
1303
|
+
// }
|
1304
|
+
// }
|
1305
|
+
//# sourceMappingURL=temp_nile-virtual-select%20copy.js.map
|