@keenmate/web-multiselect 1.8.4 → 1.8.6
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 +43 -0
- package/dist/index.d.ts +669 -0
- package/dist/multiselect.js +44 -44
- package/dist/multiselect.umd.js +2 -2
- package/dist/style.css +1 -1
- package/package.json +4 -3
- package/src/css/_base.css +1 -1
- package/src/css/_rtl.css +23 -0
- package/src/css/_variables.css +4 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
import { Placement } from '@floating-ui/dom';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Action button configuration for dropdown actions (Select All, Clear All, custom actions)
|
|
5
|
+
* @template T The type of data items
|
|
6
|
+
*/
|
|
7
|
+
declare interface ActionButton<T = any> {
|
|
8
|
+
/** Action identifier ('select-all', 'clear-all', or 'custom' for custom actions) */
|
|
9
|
+
action: 'select-all' | 'clear-all' | 'custom';
|
|
10
|
+
/** Button text label */
|
|
11
|
+
text: string;
|
|
12
|
+
/** Optional CSS class(es) to add to the button */
|
|
13
|
+
cssClass?: string;
|
|
14
|
+
/** Optional tooltip text */
|
|
15
|
+
tooltip?: string;
|
|
16
|
+
/** Static visibility - set to false to hide button */
|
|
17
|
+
isVisible?: boolean;
|
|
18
|
+
/** Static disabled state - set to true to disable button */
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
/** Custom click handler (required for 'custom' action) */
|
|
21
|
+
onClick?: (multiselect: any) => void | Promise<void>;
|
|
22
|
+
/** Dynamic visibility callback - return false to hide button (takes priority over isVisible) */
|
|
23
|
+
isVisibleCallback?: (multiselect: any) => boolean;
|
|
24
|
+
/** Dynamic disabled state callback - return true to disable button (takes priority over isDisabled) */
|
|
25
|
+
isDisabledCallback?: (multiselect: any) => boolean;
|
|
26
|
+
/** Dynamic text callback - return button text (takes priority over text) */
|
|
27
|
+
getTextCallback?: (multiselect: any) => string;
|
|
28
|
+
/** Dynamic CSS class callback - return class name(s) (takes priority over cssClass) */
|
|
29
|
+
getClassCallback?: (multiselect: any) => string | string[];
|
|
30
|
+
/** Dynamic tooltip callback - return tooltip text (takes priority over tooltip) */
|
|
31
|
+
getTooltipCallback?: (multiselect: any) => string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Layout mode for action buttons container
|
|
36
|
+
* - 'nowrap': Buttons stay in single row (default)
|
|
37
|
+
* - 'wrap': Buttons wrap to multiple rows when needed
|
|
38
|
+
*/
|
|
39
|
+
declare type ActionsLayout = 'nowrap' | 'wrap';
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Context provided to renderBadgeContentCallback
|
|
43
|
+
*/
|
|
44
|
+
declare interface BadgeContentRenderContext {
|
|
45
|
+
/** Current badges display mode */
|
|
46
|
+
displayMode: BadgesDisplayMode;
|
|
47
|
+
/** Whether the badge is being rendered in the selected items popover */
|
|
48
|
+
isInPopover: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Display mode for selected items (badges area)
|
|
53
|
+
*/
|
|
54
|
+
export declare type BadgesDisplayMode = 'badges' | 'count' | 'compact' | 'partial' | 'none';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Position of the badges container relative to the input
|
|
58
|
+
*/
|
|
59
|
+
export declare type BadgesPosition = 'top' | 'bottom' | 'left' | 'right';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Threshold behavior mode when badges exceed threshold
|
|
63
|
+
*/
|
|
64
|
+
export declare type BadgesThresholdMode = 'count' | 'partial';
|
|
65
|
+
|
|
66
|
+
declare const BaseElement: typeof HTMLElement;
|
|
67
|
+
|
|
68
|
+
export declare const dataLogger: any;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Disable all logging (set to silent level)
|
|
72
|
+
*/
|
|
73
|
+
export declare function disableLogging(): void;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Enable all logging (set to debug level)
|
|
77
|
+
*/
|
|
78
|
+
export declare function enableLogging(): void;
|
|
79
|
+
|
|
80
|
+
export declare interface GlobalMultiSelectAPI {
|
|
81
|
+
version: () => string;
|
|
82
|
+
config: {
|
|
83
|
+
name: string;
|
|
84
|
+
version: string;
|
|
85
|
+
author: string;
|
|
86
|
+
license: string;
|
|
87
|
+
repository: string;
|
|
88
|
+
homepage: string;
|
|
89
|
+
};
|
|
90
|
+
logging: {
|
|
91
|
+
enableLogging: () => void;
|
|
92
|
+
disableLogging: () => void;
|
|
93
|
+
setLogLevel: (level: string) => void;
|
|
94
|
+
setCategoryLevel: (category: string, level: string) => void;
|
|
95
|
+
getCategories: () => string[];
|
|
96
|
+
};
|
|
97
|
+
register: () => void;
|
|
98
|
+
getInstances: () => HTMLElement[];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export declare const initLogger: any;
|
|
102
|
+
|
|
103
|
+
export declare const interactionLogger: any;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* List of all logging categories for introspection
|
|
107
|
+
*/
|
|
108
|
+
export declare const LOGGING_CATEGORIES: string[];
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Generic configuration options for the MultiSelect component
|
|
112
|
+
* @template T The type of data items
|
|
113
|
+
*/
|
|
114
|
+
declare interface MultiSelectConfig<T = any> {
|
|
115
|
+
/** Options array - can be objects or [key, value] tuples */
|
|
116
|
+
options?: T[];
|
|
117
|
+
/** Member property name for value/ID extraction */
|
|
118
|
+
valueMember?: string;
|
|
119
|
+
/** Callback to extract value/ID from item */
|
|
120
|
+
getValueCallback?: (item: T) => string | number;
|
|
121
|
+
/** Member property name for display value extraction */
|
|
122
|
+
displayValueMember?: string;
|
|
123
|
+
/** Callback to extract display value from item */
|
|
124
|
+
getDisplayValueCallback?: (item: T) => string;
|
|
125
|
+
/** Callback to customize badge display text (defaults to display value if not provided) */
|
|
126
|
+
getBadgeDisplayCallback?: (item: T) => string;
|
|
127
|
+
/** Callback to add custom CSS classes to badges - return string or array of class names */
|
|
128
|
+
getBadgeClassCallback?: (item: T) => string | string[];
|
|
129
|
+
/** Callback to inject custom CSS into Shadow DOM - return CSS string for styling custom classes */
|
|
130
|
+
customStylesCallback?: () => string;
|
|
131
|
+
/** Member property name for search value extraction */
|
|
132
|
+
searchValueMember?: string;
|
|
133
|
+
/** Callback to extract search value from item */
|
|
134
|
+
getSearchValueCallback?: (item: T) => string;
|
|
135
|
+
/** Member property name for icon extraction */
|
|
136
|
+
iconMember?: string;
|
|
137
|
+
/** Callback to extract icon from item */
|
|
138
|
+
getIconCallback?: (item: T) => string;
|
|
139
|
+
/** Member property name for subtitle extraction */
|
|
140
|
+
subtitleMember?: string;
|
|
141
|
+
/** Callback to extract subtitle from item */
|
|
142
|
+
getSubtitleCallback?: (item: T) => string;
|
|
143
|
+
/** Member property name for group extraction */
|
|
144
|
+
groupMember?: string;
|
|
145
|
+
/** Callback to extract group from item */
|
|
146
|
+
getGroupCallback?: (item: T) => string;
|
|
147
|
+
/** Callback to customize group label content (can return HTML) */
|
|
148
|
+
renderGroupLabelContentCallback?: (groupName: string) => string | HTMLElement;
|
|
149
|
+
/** Member property name for disabled state extraction */
|
|
150
|
+
disabledMember?: string;
|
|
151
|
+
/** Callback to extract disabled state from item */
|
|
152
|
+
getDisabledCallback?: (item: T) => boolean;
|
|
153
|
+
/** Custom renderer for dropdown option content - return HTML string or HTMLElement */
|
|
154
|
+
renderOptionContentCallback?: (item: T, context: OptionContentRenderContext) => string | HTMLElement;
|
|
155
|
+
/** Custom renderer for badge content (main badges area) - return HTML string or HTMLElement */
|
|
156
|
+
renderBadgeContentCallback?: (item: T, context: BadgeContentRenderContext) => string | HTMLElement;
|
|
157
|
+
/** Custom renderer for selected item content in popover - return HTML string or HTMLElement */
|
|
158
|
+
renderSelectedItemContentCallback?: (item: T) => string | HTMLElement;
|
|
159
|
+
/** Callback to add custom CSS classes to selected items in popover - return string or array of class names */
|
|
160
|
+
getSelectedItemClassCallback?: (item: T) => string | string[];
|
|
161
|
+
/** Custom renderer for selected item display in single-select mode - return plain text */
|
|
162
|
+
renderSelectedContentCallback?: (item: T) => string;
|
|
163
|
+
/** HTML form field ID/name for hidden input */
|
|
164
|
+
formFieldId?: string;
|
|
165
|
+
/** Format for value serialization (forms and callbacks) */
|
|
166
|
+
valueFormat?: ValueFormat;
|
|
167
|
+
/** Custom callback to format value */
|
|
168
|
+
getValueFormatCallback?: (selectedValues: (string | number)[]) => string;
|
|
169
|
+
/** Allow multiple selections (internal: isMultipleEnabled) */
|
|
170
|
+
isMultipleEnabled?: boolean;
|
|
171
|
+
/** Enable search/filtering (internal: isSearchEnabled) */
|
|
172
|
+
isSearchEnabled?: boolean;
|
|
173
|
+
/** Allow grouping of options (internal: isGroupsAllowed) */
|
|
174
|
+
isGroupsAllowed?: boolean;
|
|
175
|
+
/** Action buttons configuration (Select All, Clear All, custom actions) */
|
|
176
|
+
actionButtons?: ActionButton<T>[];
|
|
177
|
+
/** Show checkboxes next to options (internal: isCheckboxesShown) */
|
|
178
|
+
isCheckboxesShown?: boolean;
|
|
179
|
+
/** Keep Select All/Clear All buttons fixed at top while scrolling (internal: isActionsSticky) */
|
|
180
|
+
isActionsSticky?: boolean;
|
|
181
|
+
/** Close dropdown after selecting an option (internal: isCloseOnSelect) */
|
|
182
|
+
isCloseOnSelect?: boolean;
|
|
183
|
+
/** Lock dropdown placement after first open (internal: isPlacementLocked) */
|
|
184
|
+
isPlacementLocked?: boolean;
|
|
185
|
+
/** Allow adding new options not in the list (internal: isAddNewAllowed) */
|
|
186
|
+
isAddNewAllowed?: boolean;
|
|
187
|
+
/** Show count badge next to toggle icon (internal: isCounterShown) */
|
|
188
|
+
isCounterShown?: boolean;
|
|
189
|
+
/** Keep initial options visible when searchCallback is active and search term is empty/short (internal: isKeepOptionsOnSearch) */
|
|
190
|
+
isKeepOptionsOnSearch?: boolean;
|
|
191
|
+
/** Keep search text and filtered results when dropdown closes (default: true) */
|
|
192
|
+
shouldKeepSearchOnClose?: boolean;
|
|
193
|
+
/** Enable virtual scrolling for large datasets (internal: isVirtualScrollEnabled) */
|
|
194
|
+
isVirtualScrollEnabled?: boolean;
|
|
195
|
+
/** Vertical alignment of checkboxes relative to option content */
|
|
196
|
+
checkboxAlign?: 'top' | 'center' | 'bottom';
|
|
197
|
+
/** Hint text shown above the input when focused */
|
|
198
|
+
searchHint?: string;
|
|
199
|
+
/** Placeholder text for the search input */
|
|
200
|
+
searchPlaceholder?: string;
|
|
201
|
+
/** Minimum width for the dropdown (e.g., '20rem', '300px') */
|
|
202
|
+
dropdownMinWidth?: string | null;
|
|
203
|
+
/** Maximum width for the dropdown (e.g., '40rem', '500px') */
|
|
204
|
+
dropdownMaxWidth?: string | null;
|
|
205
|
+
/** Display mode for selected items in badges area */
|
|
206
|
+
badgesDisplayMode?: BadgesDisplayMode;
|
|
207
|
+
/** Position of badges container */
|
|
208
|
+
badgesPosition?: BadgesPosition;
|
|
209
|
+
/** Threshold behavior mode: 'count' shows count badge, 'partial' shows limited badges + more badge */
|
|
210
|
+
badgesThresholdMode?: BadgesThresholdMode;
|
|
211
|
+
/** Maximum height for dropdown */
|
|
212
|
+
maxHeight?: string;
|
|
213
|
+
/** Message shown when no results found */
|
|
214
|
+
emptyMessage?: string;
|
|
215
|
+
/** Message shown while loading async data */
|
|
216
|
+
loadingMessage?: string;
|
|
217
|
+
/** Search input display mode */
|
|
218
|
+
searchInputMode?: SearchInputMode;
|
|
219
|
+
/** Search behavior mode: 'filter' (hide non-matches) or 'navigate' (jump to matches, keep all visible) */
|
|
220
|
+
searchMode?: SearchMode;
|
|
221
|
+
/** Layout mode for action buttons: 'nowrap' (default) or 'wrap' for multi-row */
|
|
222
|
+
actionsLayout?: ActionsLayout;
|
|
223
|
+
/** Auto-switch from badges to count when threshold is exceeded */
|
|
224
|
+
badgesThreshold?: number | null;
|
|
225
|
+
/** Maximum number of badges to show in partial mode (used with thresholdMode='partial') */
|
|
226
|
+
badgesMaxVisible?: number | null;
|
|
227
|
+
/** Minimum search length before loading data */
|
|
228
|
+
minSearchLength?: number;
|
|
229
|
+
/** Minimum items before virtual scroll activates (default: 100) */
|
|
230
|
+
virtualScrollThreshold?: number;
|
|
231
|
+
/** Fixed height for each option in pixels (required for virtual scroll, default: 50) */
|
|
232
|
+
optionHeight?: number;
|
|
233
|
+
/** Fixed height for each badge in selected items popover in pixels (required for virtual scroll, default: 36) */
|
|
234
|
+
badgeHeight?: number;
|
|
235
|
+
/** Buffer size for virtual scroll - items above/below viewport (default: 10) */
|
|
236
|
+
virtualScrollBuffer?: number;
|
|
237
|
+
/** Pre-process search term before calling searchCallback. Return null to prevent search. Use for accent removal, validation, etc. */
|
|
238
|
+
beforeSearchCallback?: ((searchTerm: string) => string | null) | null;
|
|
239
|
+
/** Async function to load data: (searchTerm) => Promise<options[]> */
|
|
240
|
+
searchCallback?: ((searchTerm: string) => Promise<T[]>) | null;
|
|
241
|
+
/** Callback to add a new option when isAddNewAllowed is true */
|
|
242
|
+
addNewCallback?: ((value: string) => T | Promise<T>) | null;
|
|
243
|
+
/** Callback when an option is selected */
|
|
244
|
+
selectCallback?: ((option: T) => void) | null;
|
|
245
|
+
/** Callback when an option is deselected */
|
|
246
|
+
deselectCallback?: ((option: T) => void) | null;
|
|
247
|
+
/** Callback when selection changes */
|
|
248
|
+
changeCallback?: ((selectedOptions: T[]) => void) | null;
|
|
249
|
+
/** Callback to format count badge text (for i18n/pluralization). When moreCount is provided, it's for the "+X more" badge in partial mode. */
|
|
250
|
+
getCounterCallback?: ((count: number, moreCount?: number) => string) | null;
|
|
251
|
+
/** Enable tooltips on selected item badges (internal: isBadgeTooltipsEnabled) */
|
|
252
|
+
isBadgeTooltipsEnabled?: boolean;
|
|
253
|
+
/** Callback to generate custom tooltip content for a badge */
|
|
254
|
+
getBadgeTooltipCallback?: ((item: T) => string | HTMLElement) | null;
|
|
255
|
+
/** Callback to generate custom tooltip text for a remove button */
|
|
256
|
+
getRemoveButtonTooltipCallback?: ((item: T) => string) | null;
|
|
257
|
+
/** Format string for remove button tooltip text. Use {0} as placeholder for item name. Default: "Remove {0}" */
|
|
258
|
+
removeButtonTooltipText?: string;
|
|
259
|
+
/** Tooltip placement relative to badge */
|
|
260
|
+
badgeTooltipPlacement?: Placement;
|
|
261
|
+
/** Delay before showing tooltip in milliseconds */
|
|
262
|
+
badgeTooltipDelay?: number;
|
|
263
|
+
/** Offset distance for tooltip in pixels */
|
|
264
|
+
badgeTooltipOffset?: number;
|
|
265
|
+
/** Container element for dropdown/hint/popover (for Shadow DOM support) */
|
|
266
|
+
container?: HTMLElement | null;
|
|
267
|
+
/** Host element for appending hidden inputs (for form integration with shadow DOM) */
|
|
268
|
+
hostElement?: HTMLElement;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
export declare class MultiSelectElement<T = any> extends BaseElement {
|
|
272
|
+
private picker?;
|
|
273
|
+
private containerElement?;
|
|
274
|
+
private shadow;
|
|
275
|
+
private _options?;
|
|
276
|
+
private _valueMember?;
|
|
277
|
+
private _getValueCallback?;
|
|
278
|
+
private _displayValueMember?;
|
|
279
|
+
private _getDisplayValueCallback?;
|
|
280
|
+
private _getBadgeDisplayCallback?;
|
|
281
|
+
private _getBadgeClassCallback?;
|
|
282
|
+
private _customStylesCallback?;
|
|
283
|
+
private _searchValueMember?;
|
|
284
|
+
private _getSearchValueCallback?;
|
|
285
|
+
private _iconMember?;
|
|
286
|
+
private _getIconCallback?;
|
|
287
|
+
private _subtitleMember?;
|
|
288
|
+
private _getSubtitleCallback?;
|
|
289
|
+
private _groupMember?;
|
|
290
|
+
private _getGroupCallback?;
|
|
291
|
+
private _renderGroupLabelContentCallback?;
|
|
292
|
+
private _disabledMember?;
|
|
293
|
+
private _getDisabledCallback?;
|
|
294
|
+
private _getValueFormatCallback?;
|
|
295
|
+
private _getBadgeTooltipCallback?;
|
|
296
|
+
private _getRemoveButtonTooltipCallback?;
|
|
297
|
+
private _renderOptionContentCallback?;
|
|
298
|
+
private _renderBadgeContentCallback?;
|
|
299
|
+
private _renderSelectedItemContentCallback?;
|
|
300
|
+
private _getSelectedItemClassCallback?;
|
|
301
|
+
private _renderSelectedContentCallback?;
|
|
302
|
+
private _getCounterCallback?;
|
|
303
|
+
private _actionButtons?;
|
|
304
|
+
private _beforeSearchCallback?;
|
|
305
|
+
private _searchCallback?;
|
|
306
|
+
private _addNewCallback?;
|
|
307
|
+
private _selectCallback?;
|
|
308
|
+
private _deselectCallback?;
|
|
309
|
+
private _changeCallback?;
|
|
310
|
+
static get observedAttributes(): string[];
|
|
311
|
+
constructor();
|
|
312
|
+
connectedCallback(): void;
|
|
313
|
+
disconnectedCallback(): void;
|
|
314
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
315
|
+
private render;
|
|
316
|
+
private renderDebugInfo;
|
|
317
|
+
private updateDebugInfo;
|
|
318
|
+
/**
|
|
319
|
+
* Parse declarative <option> and <optgroup> elements from Light DOM
|
|
320
|
+
* Returns array of options in the format expected by the picker
|
|
321
|
+
*/
|
|
322
|
+
private parseDeclarativeOptions;
|
|
323
|
+
private _declarativeSelectedValues?;
|
|
324
|
+
private initializePicker;
|
|
325
|
+
private reinitialize;
|
|
326
|
+
get options(): T[] | undefined;
|
|
327
|
+
set options(value: T[] | undefined);
|
|
328
|
+
set valueMember(value: string | null);
|
|
329
|
+
get valueMember(): string | null;
|
|
330
|
+
set displayValueMember(value: string | null);
|
|
331
|
+
get displayValueMember(): string | null;
|
|
332
|
+
set searchValueMember(value: string | null);
|
|
333
|
+
get searchValueMember(): string | null;
|
|
334
|
+
set iconMember(value: string | null);
|
|
335
|
+
get iconMember(): string | null;
|
|
336
|
+
set subtitleMember(value: string | null);
|
|
337
|
+
get subtitleMember(): string | null;
|
|
338
|
+
set groupMember(value: string | null);
|
|
339
|
+
get groupMember(): string | null;
|
|
340
|
+
set disabledMember(value: string | null);
|
|
341
|
+
get disabledMember(): string | null;
|
|
342
|
+
set getValueCallback(callback: ((item: T) => string | number) | undefined);
|
|
343
|
+
get getValueCallback(): ((item: T) => string | number) | undefined;
|
|
344
|
+
set getDisplayValueCallback(callback: ((item: T) => string) | undefined);
|
|
345
|
+
get getDisplayValueCallback(): ((item: T) => string) | undefined;
|
|
346
|
+
set getBadgeDisplayCallback(callback: ((item: T) => string) | undefined);
|
|
347
|
+
get getBadgeDisplayCallback(): ((item: T) => string) | undefined;
|
|
348
|
+
set getBadgeClassCallback(callback: ((item: T) => string | string[]) | undefined);
|
|
349
|
+
get getBadgeClassCallback(): ((item: T) => string | string[]) | undefined;
|
|
350
|
+
set customStylesCallback(value: (() => string) | undefined);
|
|
351
|
+
get customStylesCallback(): (() => string) | undefined;
|
|
352
|
+
set getSearchValueCallback(callback: ((item: T) => string) | undefined);
|
|
353
|
+
get getSearchValueCallback(): ((item: T) => string) | undefined;
|
|
354
|
+
set getIconCallback(callback: ((item: T) => string) | undefined);
|
|
355
|
+
get getIconCallback(): ((item: T) => string) | undefined;
|
|
356
|
+
set getSubtitleCallback(callback: ((item: T) => string) | undefined);
|
|
357
|
+
get getSubtitleCallback(): ((item: T) => string) | undefined;
|
|
358
|
+
set getGroupCallback(callback: ((item: T) => string) | undefined);
|
|
359
|
+
get getGroupCallback(): ((item: T) => string) | undefined;
|
|
360
|
+
set renderGroupLabelContentCallback(callback: ((groupName: string) => string | HTMLElement) | undefined);
|
|
361
|
+
get renderGroupLabelContentCallback(): ((groupName: string) => string | HTMLElement) | undefined;
|
|
362
|
+
set getDisabledCallback(callback: ((item: T) => boolean) | undefined);
|
|
363
|
+
get getDisabledCallback(): ((item: T) => boolean) | undefined;
|
|
364
|
+
set renderOptionContentCallback(callback: ((item: T, context: OptionContentRenderContext) => string | HTMLElement) | undefined);
|
|
365
|
+
get renderOptionContentCallback(): ((item: T, context: OptionContentRenderContext) => string | HTMLElement) | undefined;
|
|
366
|
+
set renderBadgeContentCallback(callback: ((item: T, context: BadgeContentRenderContext) => string | HTMLElement) | undefined);
|
|
367
|
+
get renderBadgeContentCallback(): ((item: T, context: BadgeContentRenderContext) => string | HTMLElement) | undefined;
|
|
368
|
+
set renderSelectedItemContentCallback(callback: ((item: T) => string | HTMLElement) | undefined);
|
|
369
|
+
get renderSelectedItemContentCallback(): ((item: T) => string | HTMLElement) | undefined;
|
|
370
|
+
set getSelectedItemClassCallback(callback: ((item: T) => string | string[]) | undefined);
|
|
371
|
+
get getSelectedItemClassCallback(): ((item: T) => string | string[]) | undefined;
|
|
372
|
+
set renderSelectedContentCallback(callback: ((item: T) => string) | undefined);
|
|
373
|
+
get renderSelectedContentCallback(): ((item: T) => string) | undefined;
|
|
374
|
+
set name(value: string | null);
|
|
375
|
+
get name(): string | null;
|
|
376
|
+
set valueFormat(value: 'json' | 'csv' | 'array' | null);
|
|
377
|
+
get valueFormat(): string | null;
|
|
378
|
+
set getValueFormatCallback(callback: ((values: (string | number)[]) => string) | undefined);
|
|
379
|
+
get getValueFormatCallback(): ((values: (string | number)[]) => string) | undefined;
|
|
380
|
+
set thresholdMode(value: 'count' | 'partial' | null);
|
|
381
|
+
get thresholdMode(): string | null;
|
|
382
|
+
set badgesMaxVisible(value: number | null);
|
|
383
|
+
get badgesMaxVisible(): number | null;
|
|
384
|
+
set checkboxAlign(value: 'top' | 'center' | 'bottom' | null);
|
|
385
|
+
get checkboxAlign(): string | null;
|
|
386
|
+
set enableBadgeTooltips(value: boolean);
|
|
387
|
+
get enableBadgeTooltips(): boolean;
|
|
388
|
+
set badgeTooltipPlacement(value: string | null);
|
|
389
|
+
get badgeTooltipPlacement(): string | null;
|
|
390
|
+
set getBadgeTooltipCallback(callback: ((item: T) => string | HTMLElement) | undefined);
|
|
391
|
+
get getBadgeTooltipCallback(): ((item: T) => string | HTMLElement) | undefined;
|
|
392
|
+
set getRemoveButtonTooltipCallback(callback: ((item: T) => string) | undefined);
|
|
393
|
+
get getRemoveButtonTooltipCallback(): ((item: T) => string) | undefined;
|
|
394
|
+
set removeButtonTooltipText(value: string | null);
|
|
395
|
+
get removeButtonTooltipText(): string | null;
|
|
396
|
+
set getCounterCallback(callback: ((count: number, moreCount?: number) => string) | undefined);
|
|
397
|
+
get getCounterCallback(): ((count: number, moreCount?: number) => string) | undefined;
|
|
398
|
+
get beforeSearchCallback(): ((searchTerm: string) => string | null) | undefined;
|
|
399
|
+
set beforeSearchCallback(callback: ((searchTerm: string) => string | null) | undefined);
|
|
400
|
+
get searchCallback(): ((searchTerm: string) => Promise<T[]>) | undefined;
|
|
401
|
+
set searchCallback(callback: ((searchTerm: string) => Promise<T[]>) | undefined);
|
|
402
|
+
get addNewCallback(): ((value: string) => T | Promise<T>) | undefined;
|
|
403
|
+
set addNewCallback(callback: ((value: string) => T | Promise<T>) | undefined);
|
|
404
|
+
get selectCallback(): ((option: T) => void) | undefined;
|
|
405
|
+
set selectCallback(callback: ((option: T) => void) | undefined);
|
|
406
|
+
get deselectCallback(): ((option: T) => void) | undefined;
|
|
407
|
+
set deselectCallback(callback: ((option: T) => void) | undefined);
|
|
408
|
+
get changeCallback(): ((selectedOptions: T[]) => void) | undefined;
|
|
409
|
+
set changeCallback(callback: ((selectedOptions: T[]) => void) | undefined);
|
|
410
|
+
get actionButtons(): any[] | undefined;
|
|
411
|
+
set actionButtons(value: any[] | undefined);
|
|
412
|
+
get selectedValue(): string | number | (string | number)[] | null;
|
|
413
|
+
get selectedItem(): T | null;
|
|
414
|
+
getSelected(): T[];
|
|
415
|
+
setSelected(values: (string | number)[]): void;
|
|
416
|
+
getValue(): string | number | (string | number)[] | null;
|
|
417
|
+
destroy(): void;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
/**
|
|
421
|
+
* Event detail structure for multiselect events
|
|
422
|
+
* @template T The type of data items
|
|
423
|
+
*/
|
|
424
|
+
export declare interface MultiSelectEventDetail<T = any> {
|
|
425
|
+
/** Currently selected options */
|
|
426
|
+
selectedOptions: T[];
|
|
427
|
+
/** Selected values array */
|
|
428
|
+
selectedValues: (string | number)[];
|
|
429
|
+
/** The option that triggered the event (for select/deselect) */
|
|
430
|
+
option?: T;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Legacy interface for backward reference
|
|
435
|
+
* Note: New code should use generic types with member/callback properties
|
|
436
|
+
* @deprecated Use generic types with valueMember/displayValueMember instead
|
|
437
|
+
*/
|
|
438
|
+
export declare interface MultiSelectOption {
|
|
439
|
+
/** Unique identifier for the option */
|
|
440
|
+
value: string;
|
|
441
|
+
/** Display label */
|
|
442
|
+
label: string;
|
|
443
|
+
/** Optional icon or emoji */
|
|
444
|
+
icon?: string;
|
|
445
|
+
/** Optional subtitle/description */
|
|
446
|
+
subtitle?: string;
|
|
447
|
+
/** Optional group name */
|
|
448
|
+
group?: string;
|
|
449
|
+
/** Whether the option is disabled */
|
|
450
|
+
disabled?: boolean;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Legacy options interface
|
|
455
|
+
* @deprecated Use MultiSelectConfig<T> instead
|
|
456
|
+
*/
|
|
457
|
+
export declare interface MultiSelectOptions extends MultiSelectConfig<MultiSelectOption> {
|
|
458
|
+
options?: MultiSelectOption[];
|
|
459
|
+
searchCallback?: ((searchTerm: string) => Promise<MultiSelectOption[]>) | null;
|
|
460
|
+
addNewCallback?: ((value: string) => MultiSelectOption | Promise<MultiSelectOption>) | null;
|
|
461
|
+
selectCallback?: ((option: MultiSelectOption) => void) | null;
|
|
462
|
+
deselectCallback?: ((option: MultiSelectOption) => void) | null;
|
|
463
|
+
changeCallback?: ((selectedOptions: MultiSelectOption[]) => void) | null;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Context provided to renderOptionContentCallback
|
|
468
|
+
*/
|
|
469
|
+
declare interface OptionContentRenderContext {
|
|
470
|
+
/** Index of the option in the filtered list */
|
|
471
|
+
index: number;
|
|
472
|
+
/** Whether the option is currently selected */
|
|
473
|
+
isSelected: boolean;
|
|
474
|
+
/** Whether the option is currently focused (keyboard navigation) */
|
|
475
|
+
isFocused: boolean;
|
|
476
|
+
/** Whether the option matches the current search term (navigate mode only) */
|
|
477
|
+
isMatched: boolean;
|
|
478
|
+
/** Whether the option is disabled */
|
|
479
|
+
isDisabled: boolean;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Search input display mode
|
|
484
|
+
*/
|
|
485
|
+
export declare type SearchInputMode = 'normal' | 'readonly' | 'hidden';
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Search behavior mode
|
|
489
|
+
* - 'filter': Hide non-matching options (default)
|
|
490
|
+
* - 'navigate': Keep all options visible, jump to matches
|
|
491
|
+
*/
|
|
492
|
+
export declare type SearchMode = 'filter' | 'navigate';
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Set log level for a specific category
|
|
496
|
+
* @param category Category logger to configure (e.g., 'MULTISELECT:UI')
|
|
497
|
+
* @param level Log level to set ('trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent')
|
|
498
|
+
*/
|
|
499
|
+
export declare function setCategoryLevel(category: string, level: string): void;
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* Set log level for all loggers
|
|
503
|
+
* @param level Log level to set ('trace' | 'debug' | 'info' | 'warn' | 'error' | 'silent')
|
|
504
|
+
*/
|
|
505
|
+
export declare function setLogLevel(level: string): void;
|
|
506
|
+
|
|
507
|
+
export declare const uiLogger: any;
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Value format for serialization (forms and callbacks)
|
|
511
|
+
*/
|
|
512
|
+
export declare type ValueFormat = 'json' | 'csv' | 'array';
|
|
513
|
+
|
|
514
|
+
export declare class WebMultiSelect<T = any> {
|
|
515
|
+
private element;
|
|
516
|
+
private instanceId;
|
|
517
|
+
private options;
|
|
518
|
+
private isOpen;
|
|
519
|
+
private selectedValues;
|
|
520
|
+
private selectedOptions;
|
|
521
|
+
private allOptions;
|
|
522
|
+
private filteredOptions;
|
|
523
|
+
private hiddenInputs;
|
|
524
|
+
private focusedIndex;
|
|
525
|
+
private matchingIndices;
|
|
526
|
+
private searchTerm;
|
|
527
|
+
private isLoading;
|
|
528
|
+
private showSelectedPopover;
|
|
529
|
+
private selectedPopoverPlacement;
|
|
530
|
+
private dropdownPlacement;
|
|
531
|
+
private isRTL;
|
|
532
|
+
private effectiveBadgesPosition;
|
|
533
|
+
private justClosedViaClick;
|
|
534
|
+
private dropdownCleanup;
|
|
535
|
+
private hintCleanup;
|
|
536
|
+
private selectedPopoverCleanup;
|
|
537
|
+
private badgeTooltips;
|
|
538
|
+
private badgeTooltipCleanups;
|
|
539
|
+
private badgeTooltipShowTimeouts;
|
|
540
|
+
private badgeTooltipHideTimeouts;
|
|
541
|
+
private actionButtonTooltips;
|
|
542
|
+
private actionButtonTooltipCleanups;
|
|
543
|
+
private virtualScroll;
|
|
544
|
+
private optionsContainer;
|
|
545
|
+
private selectedPopoverVirtualScroll;
|
|
546
|
+
private selectedPopoverContainer;
|
|
547
|
+
private input;
|
|
548
|
+
private dropdown;
|
|
549
|
+
private dropdownInner;
|
|
550
|
+
private badgesContainer;
|
|
551
|
+
private counter;
|
|
552
|
+
private hint?;
|
|
553
|
+
private selectedPopover;
|
|
554
|
+
private documentKeydownHandler;
|
|
555
|
+
private documentClickHandler;
|
|
556
|
+
/**
|
|
557
|
+
* Extract value/ID from item
|
|
558
|
+
* Precedence: tuple[0] -> valueMember -> getValueCallback -> '[N/A]'
|
|
559
|
+
*/
|
|
560
|
+
private getItemValue;
|
|
561
|
+
/**
|
|
562
|
+
* Extract display value from item
|
|
563
|
+
* Precedence: tuple[1] -> displayValueMember -> getDisplayValueCallback -> '[N/A]'
|
|
564
|
+
*/
|
|
565
|
+
private getItemDisplayValue;
|
|
566
|
+
/**
|
|
567
|
+
* Extract badge display value from item
|
|
568
|
+
* Precedence: getBadgeDisplayCallback -> getItemDisplayValue()
|
|
569
|
+
* This allows customizing badge text separately from dropdown display text
|
|
570
|
+
*/
|
|
571
|
+
private getItemBadgeDisplayValue;
|
|
572
|
+
/**
|
|
573
|
+
* Extract search value from item
|
|
574
|
+
* Precedence: searchValueMember -> getSearchValueCallback -> displayValue
|
|
575
|
+
*/
|
|
576
|
+
private getItemSearchValue;
|
|
577
|
+
/**
|
|
578
|
+
* Extract icon from item
|
|
579
|
+
*/
|
|
580
|
+
private getItemIcon;
|
|
581
|
+
/**
|
|
582
|
+
* Extract subtitle from item
|
|
583
|
+
*/
|
|
584
|
+
private getItemSubtitle;
|
|
585
|
+
/**
|
|
586
|
+
* Extract group from item
|
|
587
|
+
*/
|
|
588
|
+
private getItemGroup;
|
|
589
|
+
/**
|
|
590
|
+
* Extract disabled state from item
|
|
591
|
+
*/
|
|
592
|
+
private getItemDisabled;
|
|
593
|
+
constructor(element: HTMLElement, options?: Partial<MultiSelectConfig<T>>);
|
|
594
|
+
private init;
|
|
595
|
+
private parseOptions;
|
|
596
|
+
private buildHTML;
|
|
597
|
+
/**
|
|
598
|
+
* Check if virtual scroll should be used
|
|
599
|
+
*/
|
|
600
|
+
private shouldUseVirtualScroll;
|
|
601
|
+
/**
|
|
602
|
+
* Check if any options have groups
|
|
603
|
+
*/
|
|
604
|
+
private hasGroups;
|
|
605
|
+
private renderDropdown;
|
|
606
|
+
/**
|
|
607
|
+
* Render dropdown with virtual scrolling
|
|
608
|
+
*/
|
|
609
|
+
private renderDropdownVirtual;
|
|
610
|
+
private renderOption;
|
|
611
|
+
private highlightMatch;
|
|
612
|
+
private groupOptions;
|
|
613
|
+
private renderBadges;
|
|
614
|
+
private attachEvents;
|
|
615
|
+
private handleSearch;
|
|
616
|
+
private handleKeydown;
|
|
617
|
+
private handleDropdownClick;
|
|
618
|
+
private handleBadgeClick;
|
|
619
|
+
private handleClickOutside;
|
|
620
|
+
private focusNext;
|
|
621
|
+
private focusPrevious;
|
|
622
|
+
private focusFirst;
|
|
623
|
+
private focusLast;
|
|
624
|
+
private focusNextMatch;
|
|
625
|
+
private focusPreviousMatch;
|
|
626
|
+
private focusPageUp;
|
|
627
|
+
private focusPageDown;
|
|
628
|
+
private scrollToFocused;
|
|
629
|
+
private toggleOption;
|
|
630
|
+
private handleAddNew;
|
|
631
|
+
private selectOption;
|
|
632
|
+
private deselectOption;
|
|
633
|
+
private selectAll;
|
|
634
|
+
private clearAll;
|
|
635
|
+
private open;
|
|
636
|
+
private close;
|
|
637
|
+
private positionDropdown;
|
|
638
|
+
private positionHint;
|
|
639
|
+
private parseInitialSelection;
|
|
640
|
+
private toggleSelectedPopover;
|
|
641
|
+
private showPopover;
|
|
642
|
+
private hideSelectedPopover;
|
|
643
|
+
private renderSelectedPopover;
|
|
644
|
+
private renderSelectedPopoverVirtual;
|
|
645
|
+
private renderBadgeForPopover;
|
|
646
|
+
private handleSelectedPopoverClick;
|
|
647
|
+
private positionSelectedPopover;
|
|
648
|
+
private updateHiddenInput;
|
|
649
|
+
private getFormValue;
|
|
650
|
+
getSelected(): T[];
|
|
651
|
+
setSelected(values: (string | number)[]): void;
|
|
652
|
+
get selectedItem(): T | null;
|
|
653
|
+
get selectedValue(): string | number | (string | number)[] | null;
|
|
654
|
+
getValue(): string | number | (string | number)[] | null;
|
|
655
|
+
private attachBadgeTooltips;
|
|
656
|
+
private createTooltipForElement;
|
|
657
|
+
private createRemoveButtonTooltip;
|
|
658
|
+
private positionBadgeTooltip;
|
|
659
|
+
private cleanupBadgeTooltip;
|
|
660
|
+
private destroyAllBadgeTooltips;
|
|
661
|
+
private attachActionButtonTooltips;
|
|
662
|
+
private createActionButtonTooltip;
|
|
663
|
+
private positionActionButtonTooltip;
|
|
664
|
+
private cleanupActionButtonTooltip;
|
|
665
|
+
private destroyAllActionButtonTooltips;
|
|
666
|
+
destroy(): void;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
export { }
|