angular-ui-controls 0.0.0-stage → 0.1.0-rc.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.
@@ -0,0 +1,425 @@
1
+ import { BaseControlValueAccessor } from 'angular-ui-controls/text-input';
2
+ export * from 'angular-ui-controls/text-input';
3
+ import * as i0 from '@angular/core';
4
+ import { EventEmitter, Signal, ChangeDetectorRef, SimpleChanges, PipeTransform } from '@angular/core';
5
+ import { NgControl } from '@angular/forms';
6
+ import { MatSelectChange } from '@angular/material/select';
7
+
8
+ /**
9
+ * Base field information shared across all emitted events
10
+ */
11
+ interface SearchableSelectFieldInfo {
12
+ /** Current value(s) bound to the select */
13
+ value: any;
14
+ /** @deprecated Use value. */
15
+ modelValue: any;
16
+ /** Field identifier used in parent component */
17
+ fieldName: string | number;
18
+ /** @deprecated Use fieldName. */
19
+ textFieldName: string | number;
20
+ /** Optional reference to native input element */
21
+ inputRef?: Element | null;
22
+ }
23
+ /**
24
+ * Selection change event payload
25
+ */
26
+ interface SearchableSelectSelectionChangeEvent extends SearchableSelectFieldInfo {
27
+ /** MatSelect change event containing selected value(s) */
28
+ selectionChange: MatSelectChange | null;
29
+ }
30
+ /**
31
+ * Toggle "Select All" event payload
32
+ */
33
+ interface SearchableSelectToggleAllEvent extends SearchableSelectFieldInfo {
34
+ /** True if all options are selected, false if cleared */
35
+ selectAllValue: boolean;
36
+ }
37
+ /**
38
+ * Open/close change event payload
39
+ */
40
+ interface SearchableSelectOpenCloseEvent extends SearchableSelectFieldInfo {
41
+ /** Boolean indicating whether the dropdown is opened or closed */
42
+ isOpen: boolean;
43
+ /** @deprecated Use isOpen. */
44
+ selectionChange: boolean;
45
+ }
46
+ /**
47
+ * Option click event payload
48
+ */
49
+ interface SearchableSelectOptionClickEvent {
50
+ /** The clicked option */
51
+ activeOption: SearchableSelectOption;
52
+ }
53
+ /**
54
+ * Interface representing an option object with standard flags
55
+ */
56
+ interface SearchableSelectOptionItem {
57
+ [key: string]: any;
58
+ isDisabled?: boolean;
59
+ isHidden?: boolean;
60
+ }
61
+ /**
62
+ * Single selectable option type
63
+ * Can be primitive (string/number) or an object with arbitrary keys
64
+ */
65
+ type SearchableSelectOption = string | number | SearchableSelectOptionItem | Record<string, any>;
66
+
67
+ declare class SearchableSelectComponent extends BaseControlValueAccessor<any> {
68
+ ngControl: NgControl;
69
+ private changeDetectorRef;
70
+ private readonly _icons;
71
+ /**
72
+ * Height in pixels of each option for virtual scrolling (defaults to 36px)
73
+ * @default 36
74
+ * @type number
75
+ */
76
+ itemSize: number;
77
+ /** HTML id for the select element */
78
+ protected rawInputId: string;
79
+ /**
80
+ * Identifier assigned to the inner control; combined with idPrefix when supplied.
81
+ * @type string
82
+ * @remarks Required Angular input; provide a stable identifier.
83
+ */
84
+ set inputId(id: string);
85
+ get inputId(): string;
86
+ /**
87
+ * Label text or translation key displayed for this control.
88
+ * @default ''
89
+ * @type string
90
+ */
91
+ label: string;
92
+ /**
93
+ * Enable the search in the option
94
+ * @default true
95
+ * @type boolean
96
+ */
97
+ showSearch: boolean;
98
+ /**
99
+ * Error message shown when validation fails
100
+ * @default ''
101
+ * @type string
102
+ */
103
+ errorMessage: string;
104
+ /**
105
+ * Marks this control as required in its existing template; parent-form validators remain separately configured.
106
+ * @default false
107
+ * @type boolean
108
+ */
109
+ required: boolean;
110
+ /**
111
+ * Consumer-defined field identifier included in event metadata. Existing event payload key names are preserved.
112
+ * @type string | number
113
+ * @renamedFrom textFieldName
114
+ */
115
+ fieldName: string | number;
116
+ /**
117
+ * Placeholder text for the select field
118
+ * @default ''
119
+ * @type string
120
+ */
121
+ selectPlaceholder: string;
122
+ /**
123
+ * Placeholder text for search input
124
+ * @default ''
125
+ * @type string
126
+ */
127
+ searchPlaceholder: string;
128
+ /**
129
+ * Requests the existing read-only behavior without disabling the parent form control.
130
+ * @default false
131
+ * @type boolean
132
+ * @remarks Retained input; no consumer of this setting is present in the supplied class/template.
133
+ */
134
+ readonly: boolean;
135
+ /**
136
+ * Displays "Select All" checkbox
137
+ * @default false
138
+ * @type boolean
139
+ */
140
+ showToggleAllCheckbox: boolean;
141
+ /**
142
+ * Label shown when no entries are found
143
+ * @default 'No Entries Found'
144
+ * @type string
145
+ */
146
+ noEntriesFoundLabel: string;
147
+ /**
148
+ * Tooltip message for select-all checkbox
149
+ * @default ''
150
+ * @type string
151
+ */
152
+ toggleAllCheckboxTooltipMessage: string;
153
+ /**
154
+ * Shows checkbox in search area
155
+ * @default false
156
+ * @type boolean
157
+ * @renamedFrom showSearchCheckBox
158
+ */
159
+ showSearchCheckbox: boolean;
160
+ /**
161
+ * Enables the existing multiple-selection mode.
162
+ * @default false
163
+ * @type boolean
164
+ * @renamedFrom showMultiSelect
165
+ */
166
+ multiple: boolean;
167
+ /**
168
+ * Options rendered by the control; use the label/value key inputs for object options.
169
+ * @default []
170
+ * @type SearchableSelectOption[]
171
+ * @renamedFrom selectList
172
+ */
173
+ options: SearchableSelectOption[];
174
+ /**
175
+ * Property name read from an option object to obtain its visible label.
176
+ * @default ''
177
+ * @type string
178
+ * @renamedFrom displayKey
179
+ */
180
+ labelKey: string;
181
+ /**
182
+ * Property name used to identify or extract an option value.
183
+ * @default ''
184
+ * @type string
185
+ * @renamedFrom idKey
186
+ */
187
+ valueKey: string;
188
+ /**
189
+ * Key in option object used to determine if the option should be hidden from dropdown. Defaults to 'isHidden'.
190
+ * @default 'isHidden'
191
+ * @type string
192
+ */
193
+ hiddenKey: string;
194
+ /**
195
+ * Enables server-side/external search by bypassing local pipe filtering
196
+ * @default false
197
+ * @type boolean
198
+ */
199
+ serverSideSearch: boolean;
200
+ /** Search text entered by the user */
201
+ searchText: string;
202
+ private _modelValueTracker;
203
+ private _selectedValue;
204
+ private isBlankValue;
205
+ get hasSelectedValue(): boolean;
206
+ /** Internal model bound to mat-select */
207
+ get selectedValue(): any;
208
+ set selectedValue(value: any);
209
+ /** @deprecated Use selectedValue for direct component access. */
210
+ get inputModelValue(): any;
211
+ set inputModelValue(value: any);
212
+ internalSelectList: any[];
213
+ private readonly allOptionKey;
214
+ private readonly primitiveAllOption;
215
+ private _allOptionObj;
216
+ private modelNameMapping;
217
+ private multiSelectInternalList;
218
+ /**
219
+ * Internal model getter/setter backed by the shared control value.
220
+ */
221
+ get modelValue(): any;
222
+ set modelValue(newValue: any);
223
+ /** Enable/disable search in the starting/conatin mode */
224
+ filterConditionStartWith: boolean;
225
+ /**
226
+ * Configuration for search starts with.
227
+ * @type boolean
228
+ * @renamedFrom isSearchStartsWith
229
+ */
230
+ set searchStartsWith(condition: boolean);
231
+ /**
232
+ * To clear the selected dropdown list
233
+ * @default false
234
+ * @type boolean
235
+ */
236
+ showClearIcon: boolean;
237
+ /**
238
+ * Emits when the select-all action runs.
239
+ * @payload SearchableSelectToggleAllEvent
240
+ * @remarks Payload shape is unchanged; see the emitting handler for field metadata.
241
+ * @renamedFrom toggleSelectHandle
242
+ */
243
+ selectAllChange: EventEmitter<SearchableSelectToggleAllEvent>;
244
+ /**
245
+ * Emits when the selection handler processes a selection.
246
+ * @payload SearchableSelectSelectionChangeEvent
247
+ * @remarks Payload shape is unchanged; see the emitting handler for field metadata.
248
+ * @renamedFrom onselectionChange
249
+ */
250
+ selectionChange: EventEmitter<SearchableSelectSelectionChangeEvent>;
251
+ /**
252
+ * Emits when the select panel open state changes.
253
+ * @payload SearchableSelectOpenCloseEvent
254
+ * @remarks Payload shape is unchanged; see the emitting handler for field metadata.
255
+ * @renamedFrom onOpenedChange
256
+ */
257
+ panelOpenChange: EventEmitter<SearchableSelectOpenCloseEvent>;
258
+ /**
259
+ * Emits when the select panel opens.
260
+ * @payload SearchableSelectFieldInfo
261
+ * @remarks Payload shape is unchanged; see the emitting handler for field metadata.
262
+ * @renamedFrom onOpened
263
+ */
264
+ panelOpened: EventEmitter<SearchableSelectFieldInfo>;
265
+ /**
266
+ * Emits when the select panel closes.
267
+ * @payload SearchableSelectFieldInfo
268
+ * @remarks Payload shape is unchanged; see the emitting handler for field metadata.
269
+ * @renamedFrom onClosed
270
+ */
271
+ panelClosed: EventEmitter<SearchableSelectFieldInfo>;
272
+ /**
273
+ * Emits when the control loses focus.
274
+ * @payload SearchableSelectFieldInfo
275
+ * @remarks Payload shape is unchanged; see the emitting handler for field metadata.
276
+ * @renamedFrom onBlur
277
+ */
278
+ blurred: EventEmitter<SearchableSelectFieldInfo>;
279
+ /**
280
+ * Emits when an option is clicked.
281
+ * @payload SearchableSelectOptionClickEvent
282
+ * @remarks Payload shape is unchanged; see the emitting handler for field metadata.
283
+ * @renamedFrom onOptionClick
284
+ */
285
+ optionClicked: EventEmitter<SearchableSelectOptionClickEvent>;
286
+ /**
287
+ * Emits the updated search string for consumer filtering.
288
+ * @payload string
289
+ * @remarks Payload shape is unchanged; see the emitting handler for field metadata.
290
+ * @renamedFrom onSearchTextModelChange
291
+ */
292
+ searchTextChange: EventEmitter<string>;
293
+ private virtualOptions;
294
+ private matSelectRef;
295
+ private virtualScroll;
296
+ hiddenOptions: Signal<any[]>;
297
+ /**
298
+ * Key used to map model value to option
299
+ * @default false
300
+ * @type boolean
301
+ */
302
+ enableAllOption: boolean;
303
+ /**
304
+ * Removes the "All" option that is otherwise added automatically in multi-select mode
305
+ * @default false
306
+ * @type boolean
307
+ */
308
+ hideAllOption: boolean;
309
+ /**
310
+ * Key used to enable / disable sorting
311
+ * @default false
312
+ * @type boolean
313
+ */
314
+ enableSorting: boolean;
315
+ /**
316
+ * Keeps each option on a single line with ellipsis; full text is shown in a tooltip on hover when truncated
317
+ * @default false
318
+ * @type boolean
319
+ */
320
+ singleLineOption: boolean;
321
+ /**
322
+ * Defines whether the list should be sorted in ascending order.
323
+ * @type boolean
324
+ */
325
+ set sortAscending(sortOrder: boolean);
326
+ /** Key used to enable / disable sorting */
327
+ private isAscendingOrder;
328
+ /**
329
+ * Key used to sort the array
330
+ * @type string
331
+ */
332
+ set sortKey(key: string);
333
+ private sortKeyValue;
334
+ constructor(ngControl: NgControl, changeDetectorRef: ChangeDetectorRef);
335
+ /** Identifies an option by valueKey, so a parent replacing options with new objects keeps the same option */
336
+ private getOptionKey;
337
+ /**
338
+ * Intercept values written by Angular Forms framework (e.g., ngModel)
339
+ */
340
+ writeValue(value: any): void;
341
+ trackByFn: (index: number, item: any) => any;
342
+ compareObjects: (option1: any, option2: any) => boolean;
343
+ private fieldInfo;
344
+ getSelectedModelValue(selectedValue: any): any;
345
+ /**
346
+ * Emits when the selected value changes in the dropdown.
347
+ *
348
+ * @param handleSelectionChange - MatSelect change event containing selected value(s)
349
+ * @returns void
350
+ */
351
+ handleSelectionChange(event: MatSelectChange): void;
352
+ /**
353
+ * Handles select-all toggle action from search checkbox.
354
+ *
355
+ * @param selectAllValue - True to select all options, false to clear selection
356
+ * @returns void
357
+ */
358
+ toggleSelectAll(selectAllValue: boolean): void;
359
+ handleOpenedChange(isOpen: boolean): void;
360
+ /**
361
+ * Emits when the open state of the dropdown changes.
362
+ *
363
+ * @param changeEvent - Boolean indicating open (true) or closed (false) state
364
+ * @returns void
365
+ */
366
+ openedChange(opened: boolean): void;
367
+ /**
368
+ * Emits when the dropdown panel is opened.
369
+ *
370
+ * @returns void
371
+ */
372
+ opened(): void;
373
+ /**
374
+ * Emits when the dropdown panel is closed.
375
+ *
376
+ * @returns void
377
+ */
378
+ closed(): void;
379
+ /**
380
+ * Emits when the select element loses focus.
381
+ *
382
+ * @returns void
383
+ */
384
+ blur(): void;
385
+ /**
386
+ * Emits when a select option is clicked.
387
+ *
388
+ * @param selectedOption - The option object that was clicked
389
+ * @returns void
390
+ */
391
+ optionClick(selectedOption: any): void;
392
+ searchTextModelChange(changedSearchText: string): void;
393
+ private _cachedOptionWidth;
394
+ isTooltipDisabled(optionRef: unknown, text: string): boolean;
395
+ getTriggerText(): string;
396
+ ngOnChanges(changes: SimpleChanges): void;
397
+ /**
398
+ * Generates the internal scroll list, automatically injecting
399
+ * an "All" option if multiple mode is active, and filtering out hidden options.
400
+ */
401
+ private updateInternalList;
402
+ /**
403
+ * Ensures the selectedValue incorporates or removes the "All" item automatically
404
+ * based on whether every single standard item has been selected or not.
405
+ */
406
+ private syncMultiSelectModel;
407
+ private areValuesEqual;
408
+ optionSelectionChange(event: any, option: any): void;
409
+ /** Opens the dropdown panel programmatically */
410
+ open(): void;
411
+ clearSelect(): void;
412
+ private sortInternalSelectList;
413
+ static ɵfac: i0.ɵɵFactoryDeclaration<SearchableSelectComponent, [{ optional: true; self: true; }, null]>;
414
+ static ɵcmp: i0.ɵɵComponentDeclaration<SearchableSelectComponent, "ui-searchable-select", never, { "itemSize": { "alias": "itemSize"; "required": false; }; "inputId": { "alias": "inputId"; "required": true; }; "label": { "alias": "label"; "required": false; }; "showSearch": { "alias": "showSearch"; "required": false; }; "errorMessage": { "alias": "errorMessage"; "required": false; }; "required": { "alias": "required"; "required": false; }; "fieldName": { "alias": "fieldName"; "required": false; }; "selectPlaceholder": { "alias": "selectPlaceholder"; "required": false; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; }; "readonly": { "alias": "readonly"; "required": false; }; "showToggleAllCheckbox": { "alias": "showToggleAllCheckbox"; "required": false; }; "noEntriesFoundLabel": { "alias": "noEntriesFoundLabel"; "required": false; }; "toggleAllCheckboxTooltipMessage": { "alias": "toggleAllCheckboxTooltipMessage"; "required": false; }; "showSearchCheckbox": { "alias": "showSearchCheckbox"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "options": { "alias": "options"; "required": false; }; "labelKey": { "alias": "labelKey"; "required": false; }; "valueKey": { "alias": "valueKey"; "required": false; }; "hiddenKey": { "alias": "hiddenKey"; "required": false; }; "serverSideSearch": { "alias": "serverSideSearch"; "required": false; }; "searchStartsWith": { "alias": "searchStartsWith"; "required": false; }; "showClearIcon": { "alias": "showClearIcon"; "required": false; }; "enableAllOption": { "alias": "enableAllOption"; "required": false; }; "hideAllOption": { "alias": "hideAllOption"; "required": false; }; "enableSorting": { "alias": "enableSorting"; "required": false; }; "singleLineOption": { "alias": "singleLineOption"; "required": false; }; "sortAscending": { "alias": "sortAscending"; "required": false; }; "sortKey": { "alias": "sortKey"; "required": false; }; }, { "selectAllChange": "selectAllChange"; "selectionChange": "selectionChange"; "panelOpenChange": "panelOpenChange"; "panelOpened": "panelOpened"; "panelClosed": "panelClosed"; "blurred": "blurred"; "optionClicked": "optionClicked"; "searchTextChange": "searchTextChange"; }, never, never, true, never>;
415
+ }
416
+
417
+ declare class IsEmptyPipe implements PipeTransform {
418
+ transform(value: unknown): boolean;
419
+ static ɵfac: i0.ɵɵFactoryDeclaration<IsEmptyPipe, never>;
420
+ static ɵpipe: i0.ɵɵPipeDeclaration<IsEmptyPipe, "isEmpty", true>;
421
+ }
422
+
423
+ export { IsEmptyPipe, SearchableSelectComponent };
424
+ export type { SearchableSelectFieldInfo, SearchableSelectOpenCloseEvent, SearchableSelectOption, SearchableSelectOptionClickEvent, SearchableSelectOptionItem, SearchableSelectSelectionChangeEvent, SearchableSelectToggleAllEvent };
425
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sources":["../../../projects/ui-controls/src/lib/component/searchable-select/searchable-select.interface.ts","../../../projects/ui-controls/src/lib/component/searchable-select/searchable-select.component.ts","../../../projects/ui-controls/src/lib/component/searchable-select/is-empty.pipe.ts"],"mappings":";;;;;;;AAEA;;AAEG;AACH,mCAAiB;;;;;;AAOf;;AAEA;;AAGA,eAAW,OAAO;AACnB;AAED;;AAEG;AACH,UAAM,oCAAW,SAAqC,yBAAQ;;AAE5D,qBAAiB,eAAe;AACjC;AAED;;AAEG;AACH,UAAM,8BAAW,SAA+B,yBAAQ;;;AAGvD;AAED;;AAEG;AACH,UAAM,8BAAW,SAA+B,yBAAQ;;;;;AAKvD;AAED;;AAEG;AACH,0CAAiB;;kBAED,sBAAsB;AACrC;AAED;;AAEG;AACH,oCAAiB;AACf;;;AAGD;AAED;;;AAGG;AACH,KAAA,sBAAY,qBAER,0BACA,GAAA,MAA0B;;AC7B9B,cAAA,y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