@bootkit/ng0 0.0.0-alpha.26 → 0.0.0-alpha.28

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/common/index.d.ts CHANGED
@@ -3,14 +3,6 @@ import { InjectionToken, TrackByFunction } from '@angular/core';
3
3
  import { Observable } from 'rxjs';
4
4
 
5
5
  declare const RTL: InjectionToken<boolean>;
6
- /**
7
- * List item interface.
8
- */
9
- interface SelectOption {
10
- id: string;
11
- value: any;
12
- show?: boolean;
13
- }
14
6
 
15
7
  /**
16
8
  * Represents a claim object that can contain multiple claims.
@@ -129,7 +121,7 @@ type CssClassGetter = (obj: any) => CssClass;
129
121
  /**
130
122
  * A type that represents a CSS class or a function that returns a CSS class.
131
123
  */
132
- type CssClassLike = CssClass | CssClassGetter | null | undefined;
124
+ type CssClassLike = CssClass | CssClassGetter;
133
125
  /**
134
126
  * Converts a CssClassLike to a CssClassGetter function.
135
127
  * @param v The CssClassLike to convert.
@@ -162,20 +154,6 @@ declare function defaultEqualityComparer(a: any, b: any): boolean;
162
154
  * @returns The converted EqualityComparer.
163
155
  */
164
156
  declare function equalityComparerAttribute(e: EqualityComparerLike): EqualityComparer;
165
- /**
166
- * @private
167
- * @param items
168
- * @param value
169
- * @param comparer
170
- */
171
- declare function findValueByComparer(items: any[], value: any, comparer: EqualityComparer): any;
172
- /**
173
- * @private
174
- * @param items
175
- * @param values
176
- * @param comparer
177
- */
178
- declare function findValuesByComparer(items: any[], values: any[], comparer: EqualityComparer): any[];
179
157
 
180
158
  /**
181
159
  * Value writer function type.
@@ -231,19 +209,27 @@ declare function comparerAttribute(v: ComparerLike): Comparer;
231
209
  /**
232
210
  * Filter predicate function type.
233
211
  * @param item The item to test against the filter.
212
+ * @param params Additional parameters to pass to the filter.
234
213
  * @returns True if the item matches the filter, false otherwise.
235
214
  */
236
- type FilterPredicate = (item: any) => boolean;
215
+ type FilterPredicate = (item: any, ...params: any[]) => boolean;
237
216
  /**
238
217
  * Filter predicate can be a function or a string representing the property name to filter.
239
218
  */
240
219
  type FilterPredicateLike = FilterPredicate | string;
241
220
  /**
242
- *
243
- * @param item
244
- * @returns
221
+ * No-op filter predicate that always returns true.
222
+ * @param item The item to test against the filter.
223
+ * @returns true
245
224
  */
246
225
  declare const noopFilter: FilterPredicate;
226
+ /**
227
+ * A simple filter predicate that checks if the item's string representation includes the match string.
228
+ * @param item The item to test against the filter.
229
+ * @param match The string to match.
230
+ * @returns True if the item matches the filter, false otherwise.
231
+ */
232
+ declare const defaultFilter: FilterPredicate;
247
233
  /**
248
234
  * Converts a FilterPredicateLike to a FilterPredicate function.
249
235
  * If the input is a string, it creates a predicate that checks the property with that name.
@@ -286,5 +272,5 @@ declare class IfDirective {
286
272
  static ɵdir: i0.ɵɵDirectiveDeclaration<IfDirective, "[ng0If]", ["ng0If"], { "show": { "alias": "ng0If"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
287
273
  }
288
274
 
289
- export { CssClassAttribute, IdGeneratorAttribute, IfDirective, RTL, TrackByAttribute, comparerAttribute, defaultComparer, defaultEqualityComparer, defaultValueWriter, deleteEntries, equalityComparerAttribute, filterPredicateAttribute, findValueByComparer, findValuesByComparer, flipPlacement, formatString, getEnumValues, noopFilter, numberArray, sequentialIdGenerator, toObservable, trackByIndex, trackByItem, valueWriterAttribute };
290
- export type { Alignment, ClaimLike, ClaimObject, Comparer, ComparerLike, CssClass, CssClassGetter, CssClassLike, EqualityComparer, EqualityComparerLike, FilterPredicate, FilterPredicateLike, IdGenerator, IdGeneratorLike, MenuItem, Placement, SelectOption, TrackByLike, ValueWriter, ValueWriterLike };
275
+ export { CssClassAttribute, IdGeneratorAttribute, IfDirective, RTL, TrackByAttribute, comparerAttribute, defaultComparer, defaultEqualityComparer, defaultFilter, defaultValueWriter, deleteEntries, equalityComparerAttribute, filterPredicateAttribute, flipPlacement, formatString, getEnumValues, noopFilter, numberArray, sequentialIdGenerator, toObservable, trackByIndex, trackByItem, valueWriterAttribute };
276
+ export type { Alignment, ClaimLike, ClaimObject, Comparer, ComparerLike, CssClass, CssClassGetter, CssClassLike, EqualityComparer, EqualityComparerLike, FilterPredicate, FilterPredicateLike, IdGenerator, IdGeneratorLike, MenuItem, Placement, TrackByLike, ValueWriter, ValueWriterLike };
@@ -1,66 +1,49 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { OnInit, AfterContentInit, OnDestroy, Renderer2, DestroyRef } from '@angular/core';
3
- import { NgForm } from '@angular/forms';
4
- import { LocalizationService } from '@bootkit/ng0/localization';
2
+ import { AfterContentInit } from '@angular/core';
3
+ import { NgControl } from '@angular/forms';
5
4
  import * as i1 from '@angular/common';
6
5
 
7
- declare class FormFieldComponent implements OnInit, AfterContentInit, OnDestroy {
8
- private _renderer;
6
+ declare class FormFieldComponent implements AfterContentInit {
7
+ private _ngControlElement?;
9
8
  private _destroyRef;
10
- private _form;
11
- private _ls;
9
+ private _renderer;
10
+ private _localizationService;
11
+ protected _ngControl?: NgControl;
12
+ protected _status: _angular_core.WritableSignal<string>;
13
+ protected _hasRequiredControl: _angular_core.WritableSignal<boolean>;
14
+ protected _errorText: _angular_core.Signal<string | undefined>;
12
15
  /**
13
16
  * The label text for the form field.
14
17
  */
15
- label: _angular_core.InputSignal<string | undefined>;
18
+ readonly label: _angular_core.InputSignal<string | undefined>;
16
19
  /**
17
20
  * The hint text to display below the form field.
18
- * This is typically used to provide additional information or instructions to the user.
19
21
  */
20
- hint: _angular_core.InputSignal<string | undefined>;
22
+ readonly hint: _angular_core.InputSignal<string | undefined>;
21
23
  /**
22
24
  * If true, the form-field will show validation errors.
23
- * This is useful for displaying validation messages when the form control is invalid.
24
25
  */
25
- showErrors: _angular_core.InputSignal<boolean>;
26
+ readonly showErrors: _angular_core.InputSignalWithTransform<boolean, unknown>;
26
27
  /**
27
- * If true, the form-field will show a red asterisk for required fields.
28
- * This is only a visual indicator and does not enforce validation.
28
+ * If undefined, the indicator will be shown based on the control's required state.
29
+ * If true, the form-field will show a required indicator (*) next to the label (regardless of the control's required state).
30
+ * If false, the required indicator will not be shown (regardless of the control's required state).
29
31
  */
30
- showRequiredIndicator: _angular_core.InputSignal<boolean>;
32
+ readonly showRequired: _angular_core.InputSignal<boolean | undefined>;
31
33
  /**
32
34
  * If true, the form-field will show subscripts (e.g. hints, errors) for the field label.
33
- * This is useful for displaying additional information or validation messages.
34
35
  */
35
- showSubscripts: _angular_core.InputSignal<boolean>;
36
+ readonly showSubscripts: _angular_core.InputSignalWithTransform<boolean, unknown>;
36
37
  /**
37
38
  * If true, the form-field will be rendered inside a ".input-group" element.
38
39
  */
39
- inputGroup: _angular_core.InputSignal<boolean>;
40
- /**
41
- * Returns the first localized error of the control
42
- */
43
- get errorText(): string | undefined;
44
- /** Reports whether the control is touched. */
45
- get touched(): boolean | null | undefined;
46
- /** Reports whether the control is dirty. */
47
- get dirty(): boolean | null | undefined;
48
- /** Returns true if this form-field is required, otherwise returns false. */
49
- get isRequired(): boolean;
50
- private _onFocusOut;
51
- private _ngControl?;
52
- private _ngControlElement?;
53
- private _isRequired;
54
- private _locale?;
55
- private _errorText?;
56
- constructor(_renderer: Renderer2, _destroyRef: DestroyRef, _form: NgForm, _ls: LocalizationService);
57
- ngOnInit(): void;
40
+ readonly inputGroup: _angular_core.InputSignalWithTransform<boolean, unknown>;
58
41
  ngAfterContentInit(): void;
59
- private _validate;
60
- private _isRequiredField;
61
- ngOnDestroy(): void;
62
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormFieldComponent, [null, null, { optional: true; }, null]>;
63
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormFieldComponent, "ng0-form-field, ng0-field", ["ng0FormField"], { "label": { "alias": "label"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "showErrors": { "alias": "showErrors"; "required": false; "isSignal": true; }; "showRequiredIndicator": { "alias": "showRequiredIndicator"; "required": false; "isSignal": true; }; "showSubscripts": { "alias": "showSubscripts"; "required": false; "isSignal": true; }; "inputGroup": { "alias": "inputGroup"; "required": false; "isSignal": true; }; }, {}, ["_ngControl", "_ngControlElement"], ["*"], true, never>;
42
+ private _isControlRequired;
43
+ private _updateControlStyles;
44
+ private _onFocusOut;
45
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<FormFieldComponent, never>;
46
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<FormFieldComponent, "ng0-form-field, ng0-field", ["ng0FormField"], { "label": { "alias": "label"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "showErrors": { "alias": "showErrors"; "required": false; "isSignal": true; }; "showRequired": { "alias": "showRequired"; "required": false; "isSignal": true; }; "showSubscripts": { "alias": "showSubscripts"; "required": false; "isSignal": true; }; "inputGroup": { "alias": "inputGroup"; "required": false; "isSignal": true; }; }, {}, ["_ngControlElement", "_ngControl"], ["*"], true, never>;
64
47
  }
65
48
 
66
49
  declare class FormFieldModule {
@@ -1,14 +1,14 @@
1
1
  import * as _bootkit_ng0_localization from '@bootkit/ng0/localization';
2
2
  import * as _bootkit_ng0_common from '@bootkit/ng0/common';
3
3
  import * as _angular_core from '@angular/core';
4
- import { ElementRef, TemplateRef, EventEmitter } from '@angular/core';
4
+ import { ElementRef, TemplateRef, QueryList, EventEmitter } from '@angular/core';
5
5
  import { DataSource, DataSourceLike } from '@bootkit/ng0/data';
6
6
  import { ControlValueAccessor } from '@angular/forms';
7
7
 
8
8
  /**
9
- * ListItemComponent represents an individual item within a ListComponent.
9
+ * ListItem represents an individual item within a ListComponent.
10
10
  */
11
- declare class ListItemComponent {
11
+ declare class ListItem {
12
12
  /**
13
13
  * The value associated with the item. This can be of any type.
14
14
  */
@@ -63,8 +63,8 @@ declare class ListItemComponent {
63
63
  */
64
64
  focus(): void;
65
65
  private _getTabIndex;
66
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<ListItemComponent, never>;
67
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ListItemComponent, "ng0-list-item", ["ng0ListItem"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
66
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ListItem, never>;
67
+ static ɵdir: _angular_core.ɵɵDirectiveDeclaration<ListItem, "ng0-list-item", ["ng0ListItem"], { "value": { "alias": "value"; "required": false; "isSignal": true; }; "id": { "alias": "id"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
68
68
  }
69
69
 
70
70
  /**
@@ -74,15 +74,19 @@ declare class ListItemComponent {
74
74
  declare class ListComponent implements ControlValueAccessor {
75
75
  private _localizationService;
76
76
  private _changeDetector;
77
- private _value;
78
77
  private _changeCallback?;
79
78
  private _touchCallback?;
79
+ private readonly _selectedItems;
80
80
  protected readonly _sourceItems: _angular_core.WritableSignal<any[]>;
81
- private readonly _selectedValues;
82
- protected readonly _activeItem: _angular_core.WritableSignal<ListItemComponent | undefined>;
83
- private readonly _visibleItems;
81
+ protected _itemTemplate?: TemplateRef<any>;
82
+ protected readonly _activeItem: _angular_core.WritableSignal<ListItem | undefined>;
84
83
  protected readonly _isDisabled: _angular_core.WritableSignal<boolean>;
85
- itemTemplate?: TemplateRef<any>;
84
+ private readonly _value;
85
+ private _renderer;
86
+ /**
87
+ * A list of all visible list items.
88
+ */
89
+ readonly listItems?: QueryList<ListItem>;
86
90
  /**
87
91
  * Reference to the host element
88
92
  */
@@ -103,22 +107,22 @@ declare class ListComponent implements ControlValueAccessor {
103
107
  */
104
108
  readonly showSelectionIndicator: _angular_core.InputSignalWithTransform<boolean, unknown>;
105
109
  /**
106
- * A custom comparer function or the name of a field for comparing two objects.
110
+ * A comparer to compare items for selection.
111
+ * Default uses strict equality (===).
107
112
  */
108
113
  readonly compareBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.EqualityComparer, _bootkit_ng0_common.EqualityComparerLike>;
109
114
  /**
110
- * Custom format function to convert an item to a string for display.
115
+ * A fromatter to convert each item to a string for display.
111
116
  * Default converts the item to a string using its toString method.
112
117
  */
113
118
  readonly formatBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_localization.ObjectFormatter, _bootkit_ng0_localization.ObjectFormatterLike>;
114
119
  /**
115
- * Custom value extractor function to extract the value of any object while writing values.
120
+ * Custom value writer to extract the value of any object while writing values.
116
121
  */
117
122
  readonly writeBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.ValueWriter, _bootkit_ng0_common.ValueWriterLike>;
118
123
  /**
119
- * A custom filter predicate function to filter items based on a search string.
120
- * Default checks if the item's string representation contains the filter string (case-insensitive).
121
- * The filter predicate can be a function or a string representing the property name to filter.
124
+ * Custom filter function to filter items.
125
+ * Default is a noop filter that does not filter any items.
122
126
  */
123
127
  readonly filterBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.FilterPredicate, _bootkit_ng0_common.FilterPredicateLike>;
124
128
  /**
@@ -140,7 +144,7 @@ declare class ListComponent implements ControlValueAccessor {
140
144
  * CSS class or classes to apply to the list container.
141
145
  * Default is undefined.
142
146
  */
143
- readonly itemClass: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.CssClassGetter, _bootkit_ng0_common.CssClassLike>;
147
+ readonly itemClass: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.CssClassGetter | undefined, _bootkit_ng0_common.CssClassLike>;
144
148
  /**
145
149
  * Defines the focus behavior of the list component.
146
150
  * - 'none': No keyboard interaction is possible. The list cannot be focused.
@@ -148,7 +152,7 @@ declare class ListComponent implements ControlValueAccessor {
148
152
  * - 'activeDescendant': The list can be focused, but no item is tabbable. The active item is indicated using aria-activedescendant.
149
153
  * @default 'activeDescendant'.
150
154
  */
151
- readonly focus: _angular_core.InputSignal<"none" | "roving" | "activeDescendant">;
155
+ readonly focusMode: _angular_core.InputSignal<"none" | "roving" | "activeDescendant">;
152
156
  /**
153
157
  * A function that generates unique ids for each item in the list.
154
158
  * If set to a function, it will be called with the item as an argument to generate the id.
@@ -159,15 +163,18 @@ declare class ListComponent implements ControlValueAccessor {
159
163
  /**
160
164
  * Event emitted when the selection state of an item changes by user interaction.
161
165
  */
162
- readonly selectionChange: EventEmitter<ListSelectionChangeEvent>;
163
- _uuid: number;
166
+ readonly itemSelect: EventEmitter<ListItemSelectEvent>;
167
+ /**
168
+ * The template to use for each item in the list.
169
+ */
170
+ readonly itemTemplate: _angular_core.InputSignal<TemplateRef<any> | undefined>;
164
171
  constructor();
165
172
  /**
166
173
  * Indicates whether an item is active.
167
174
  * @param item
168
175
  * @returns
169
176
  */
170
- isActive(item: ListItemComponent): boolean;
177
+ isActive(item: ListItem): boolean;
171
178
  /**
172
179
  * Indicates whether the given value is selected.
173
180
  * @param item
@@ -197,30 +204,42 @@ declare class ListComponent implements ControlValueAccessor {
197
204
  * Selects all items in the list. Only applicable in multiple selection mode.
198
205
  */
199
206
  selectAll(): void;
207
+ /**
208
+ * Gets the current value(s) of the list.
209
+ */
210
+ get value(): ReadonlyArray<any | any[]>;
211
+ /**
212
+ * Gets the current items in the list.
213
+ */
214
+ get items(): ReadonlyArray<any[]>;
200
215
  writeValue(value: any): void;
201
216
  registerOnChange(fn: any): void;
202
217
  registerOnTouched(fn: any): void;
203
218
  setDisabledState?(isDisabled: boolean): void;
204
- protected _handleUserSelection(item: ListItemComponent): void;
219
+ protected _handleUserSelection(item: ListItem, index: number): void;
205
220
  protected _showLoadingSppiner: _angular_core.Signal<boolean>;
206
- private _findAndSelectItems;
221
+ private _updateSelectedItems;
222
+ private _activateFirstSelectedItem;
207
223
  private _updateValue;
208
224
  private _hostAriaActiveDescendant;
209
225
  private _hostTabIndex;
210
- private _onHostClick;
211
226
  private _onHostBlur;
212
227
  private _onKeydown;
213
228
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ListComponent, never>;
214
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ListComponent, "ng0-list", ["ng0List"], { "source": { "alias": "source"; "required": true; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "showSelectionIndicator": { "alias": "showSelectionIndicator"; "required": false; "isSignal": true; }; "compareBy": { "alias": "compareBy"; "required": false; "isSignal": true; }; "formatBy": { "alias": "formatBy"; "required": false; "isSignal": true; }; "writeBy": { "alias": "writeBy"; "required": false; "isSignal": true; }; "filterBy": { "alias": "filterBy"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; "itemClass": { "alias": "itemClass"; "required": false; "isSignal": true; }; "focus": { "alias": "focus"; "required": false; "isSignal": true; }; "idGenerator": { "alias": "idGenerator"; "required": false; "isSignal": true; }; }, { "selectionChange": "selectionChange"; }, ["itemTemplate"], never, true, never>;
229
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<ListComponent, "ng0-list, ng0-select-list", ["ng0List"], { "source": { "alias": "source"; "required": true; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "showSelectionIndicator": { "alias": "showSelectionIndicator"; "required": false; "isSignal": true; }; "compareBy": { "alias": "compareBy"; "required": false; "isSignal": true; }; "formatBy": { "alias": "formatBy"; "required": false; "isSignal": true; }; "writeBy": { "alias": "writeBy"; "required": false; "isSignal": true; }; "filterBy": { "alias": "filterBy"; "required": false; "isSignal": true; }; "trackBy": { "alias": "trackBy"; "required": false; "isSignal": true; }; "itemClass": { "alias": "itemClass"; "required": false; "isSignal": true; }; "focusMode": { "alias": "focusMode"; "required": false; "isSignal": true; }; "idGenerator": { "alias": "idGenerator"; "required": false; "isSignal": true; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; "isSignal": true; }; }, { "itemSelect": "itemSelect"; }, ["_itemTemplate"], never, true, never>;
215
230
  }
216
231
  /**
217
232
  * Event emitted when the selection state of the list changes by user interaction.
218
233
  */
219
- interface ListSelectionChangeEvent {
234
+ interface ListItemSelectEvent {
235
+ /**
236
+ * The value of the item that was selected or deselected.
237
+ */
238
+ value: any;
220
239
  /**
221
240
  * The item that was selected or deselected.
222
241
  */
223
- readonly item: ListItemComponent;
242
+ readonly item: ListItem;
224
243
  /**
225
244
  * The list component that emitted the event.
226
245
  */
@@ -237,4 +256,4 @@ declare class ListModule {
237
256
  }
238
257
 
239
258
  export { ListComponent, ListModule };
240
- export type { ListSelectionChangeEvent };
259
+ export type { ListItemSelectEvent };
@@ -1,114 +1,149 @@
1
1
  import * as _bootkit_ng0_localization from '@bootkit/ng0/localization';
2
2
  import * as _bootkit_ng0_common from '@bootkit/ng0/common';
3
- import { SelectOption, FilterPredicate, IdGenerator } from '@bootkit/ng0/common';
4
3
  import * as _angular_core from '@angular/core';
5
- import { OnInit, TemplateRef, ElementRef } from '@angular/core';
4
+ import { ElementRef, TemplateRef, EventEmitter } from '@angular/core';
6
5
  import { DataSource, DataSourceLike } from '@bootkit/ng0/data';
7
6
  import { ControlValueAccessor } from '@angular/forms';
8
7
  import { FlexibleConnectedPositionStrategy, ScrollStrategy } from '@angular/cdk/overlay';
9
- import { ListSelectionChangeEvent } from '@bootkit/ng0/components/list';
8
+ import { ListItemSelectEvent } from '@bootkit/ng0/components/list';
10
9
 
11
10
  /**
12
11
  * Select component that allows users to choose an option from a dropdown list.
13
12
  */
14
- declare class SelectComponent implements OnInit, ControlValueAccessor {
15
- private _resizeObserver?;
16
- private _resizeObserverInitialized;
13
+ declare class SelectComponent implements ControlValueAccessor {
17
14
  private _viewpoerRulerSubscription?;
18
15
  private _filterElementRef?;
19
16
  private _listComponent?;
20
17
  private _changeCallback;
21
18
  private _touchCallback;
22
- protected readonly _options: _angular_core.WritableSignal<SelectOption[]>;
19
+ protected readonly _sourceItems: _angular_core.WritableSignal<any[] | undefined>;
20
+ protected readonly _selectedItems: Set<any>;
23
21
  protected readonly _isDisabled: _angular_core.WritableSignal<boolean>;
24
- protected readonly _activeOptionIndex: _angular_core.WritableSignal<number>;
25
- protected _optionTemplate?: TemplateRef<any>;
26
22
  protected _positionStrategy: FlexibleConnectedPositionStrategy;
27
23
  protected _scrollStrategy: ScrollStrategy;
28
24
  private _overlay;
29
- private _document;
30
- private _ls;
31
- private _destroyRef;
32
- protected _el: ElementRef<any>;
25
+ private _localizationService;
26
+ protected _elementRef: ElementRef<any>;
27
+ protected readonly _filterValue: _angular_core.WritableSignal<string>;
33
28
  private _renderer;
34
29
  private _viewportRuler;
35
- private _changeDetector;
36
- private _activateSlectedItemEffectRef;
30
+ private _changeDetectorRef;
31
+ private readonly _value;
32
+ /**
33
+ * Template for rendering each item in the select component.
34
+ */
35
+ itemTemplate?: TemplateRef<any>;
37
36
  /**
38
37
  * The data source for the select component.
39
38
  * This can be an array of data, a function that returns an observable of data,
40
39
  * or an instance of DataSource.
41
40
  */
42
41
  readonly source: _angular_core.InputSignalWithTransform<DataSource<any>, DataSourceLike<any>>;
43
- /**
44
- * Value of the select component.
45
- */
46
- value: _angular_core.ModelSignal<any>;
47
42
  /**
48
43
  * Indicates whether multi selection is enabled or not.
49
44
  */
50
45
  readonly multiple: _angular_core.InputSignalWithTransform<boolean, unknown>;
46
+ /**
47
+ * Indicates whether to show selection indicator (checkbox/radio) next to each item.
48
+ * Default is false.
49
+ */
50
+ readonly showSelectionIndicator: _angular_core.InputSignalWithTransform<boolean, unknown>;
51
51
  /**
52
52
  * Indicates whether the dropdown is open or closed.
53
53
  */
54
54
  readonly open: _angular_core.ModelSignal<boolean>;
55
55
  /**
56
- * A custom comparer function or the name of a field for comparing two objects.
56
+ * A comparer to compare items for selection.
57
57
  */
58
58
  readonly compareBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.EqualityComparer, _bootkit_ng0_common.EqualityComparerLike>;
59
59
  /**
60
- * Custom format function to convert an item to a string for display.
61
- * Default converts the item to a string using its toString method.
60
+ * A fromatter to convert each item to a string for display.
62
61
  */
63
62
  readonly formatBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_localization.ObjectFormatter, _bootkit_ng0_localization.ObjectFormatterLike>;
64
63
  /**
65
- * Custom value writer function to extract the value of any object while writing values.
64
+ * Custom value writer to extract the value of any object while writing values.
66
65
  */
67
66
  readonly writeBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.ValueWriter, _bootkit_ng0_common.ValueWriterLike>;
68
67
  /**
69
68
  * Indicates whether the select component is filterable.
70
69
  */
71
70
  readonly filterable: _angular_core.InputSignalWithTransform<boolean, unknown>;
72
- /**
73
- * Placeholder text for the filter input field.
74
- */
75
- readonly filterPlaceholder: _angular_core.InputSignal<string>;
76
71
  /**
77
72
  * Custom filter function to filter items based on a filter value.
78
73
  * Default checks if the item contains the filter value (case-insensitive).
79
74
  */
80
- readonly filterBy: _angular_core.InputSignal<FilterPredicate>;
75
+ readonly filterBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.FilterPredicate, _bootkit_ng0_common.FilterPredicateLike>;
76
+ /**
77
+ * Placeholder text for the filter input field.
78
+ */
79
+ readonly filterPlaceholder: _angular_core.InputSignal<string | undefined>;
81
80
  /**
82
81
  * CSS class or classes to apply to the items.
83
82
  */
84
- readonly itemClass: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.CssClassGetter, _bootkit_ng0_common.CssClassLike>;
83
+ readonly itemClass: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.CssClassGetter | undefined, _bootkit_ng0_common.CssClassLike>;
85
84
  /**
86
- * Custom id generator function to generate unique ids for each item.
87
- * Default generates sequential ids with the prefix 'ng0-select-item-'.
88
- * If set to undefined, no ids will be generated.
85
+ * A function that generates unique ids for each item in the list.
86
+ * If set to a function, it will be called with the item as an argument to generate the id.
87
+ * If set to undefined, no ids will be generated for the items.
88
+ * @default undefined
89
89
  */
90
- readonly idGenerator: _angular_core.InputSignal<IdGenerator>;
90
+ readonly idGenerator: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.IdGenerator | undefined, _bootkit_ng0_common.IdGeneratorLike>;
91
+ /**
92
+ * Event emitted when the selected value changes.
93
+ */
94
+ readonly valueChange: EventEmitter<SelectItemEvent>;
91
95
  constructor();
92
- ngOnInit(): void;
96
+ /**
97
+ * Indicates whether the given value is selected.
98
+ * @param item
99
+ * @returns
100
+ */
101
+ isSelected(value: any): boolean;
102
+ /**
103
+ * Selects the given value.
104
+ * @param item
105
+ */
106
+ select(value: any): void;
107
+ /**
108
+ * Deselects the given value.
109
+ * @param item
110
+ */
111
+ deselect(value: any): void;
112
+ /**
113
+ * Toggles the selection state of the given value.
114
+ * @param item
115
+ */
116
+ toggle(value: any): void;
93
117
  writeValue(obj: any): void;
94
118
  registerOnChange(fn: any): void;
95
119
  registerOnTouched(fn: any): void;
96
120
  setDisabledState?(isDisabled: boolean): void;
97
- protected _onFilterBlur(): void;
121
+ private _findAndSelectItems;
122
+ private _updateValue;
98
123
  protected _onOverlayAttach(): void;
99
124
  protected _onOverlayDetach(): void;
100
- protected _onListSelectionChange(e: ListSelectionChangeEvent): void;
101
- protected _mappedValue: _angular_core.Signal<any>;
125
+ protected _onListSelectionChange(e: ListItemSelectEvent): void;
126
+ protected _filterPredicate: _angular_core.Signal<(item: any) => boolean>;
127
+ protected _onFilterKeydown(e: KeyboardEvent): void;
102
128
  private _listenToResizeEvents;
103
129
  private _unlistenFromResizeEvents;
104
- private _selectFirst;
105
- private _selectLast;
106
- private _selectNext;
107
- private _selectPrevious;
108
130
  private _onHostKeydown;
109
131
  private _onHostClick;
110
132
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<SelectComponent, never>;
111
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectComponent, "ng0-select", ["ng0Select"], { "source": { "alias": "source"; "required": true; "isSignal": true; }; "value": { "alias": "value"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "open": { "alias": "open"; "required": false; "isSignal": true; }; "compareBy": { "alias": "compareBy"; "required": false; "isSignal": true; }; "formatBy": { "alias": "formatBy"; "required": false; "isSignal": true; }; "writeBy": { "alias": "writeBy"; "required": false; "isSignal": true; }; "filterable": { "alias": "filterable"; "required": false; "isSignal": true; }; "filterPlaceholder": { "alias": "filterPlaceholder"; "required": false; "isSignal": true; }; "filterBy": { "alias": "filterBy"; "required": false; "isSignal": true; }; "itemClass": { "alias": "itemClass"; "required": false; "isSignal": true; }; "idGenerator": { "alias": "idGenerator"; "required": false; "isSignal": true; }; }, { "value": "valueChange"; "open": "openChange"; }, ["_optionTemplate"], never, true, never>;
133
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<SelectComponent, "ng0-select", ["ng0Select"], { "source": { "alias": "source"; "required": true; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "showSelectionIndicator": { "alias": "showSelectionIndicator"; "required": false; "isSignal": true; }; "open": { "alias": "open"; "required": false; "isSignal": true; }; "compareBy": { "alias": "compareBy"; "required": false; "isSignal": true; }; "formatBy": { "alias": "formatBy"; "required": false; "isSignal": true; }; "writeBy": { "alias": "writeBy"; "required": false; "isSignal": true; }; "filterable": { "alias": "filterable"; "required": false; "isSignal": true; }; "filterBy": { "alias": "filterBy"; "required": false; "isSignal": true; }; "filterPlaceholder": { "alias": "filterPlaceholder"; "required": false; "isSignal": true; }; "itemClass": { "alias": "itemClass"; "required": false; "isSignal": true; }; "idGenerator": { "alias": "idGenerator"; "required": false; "isSignal": true; }; }, { "open": "openChange"; "valueChange": "valueChange"; }, ["itemTemplate"], never, true, never>;
134
+ }
135
+ /**
136
+ * Event emitted when the selection state of the select component changes by user interaction.
137
+ */
138
+ interface SelectItemEvent {
139
+ /**
140
+ * The value of the item that was selected or deselected.
141
+ */
142
+ value: any;
143
+ /**
144
+ * The select component that emitted the event.
145
+ */
146
+ readonly select: SelectComponent;
112
147
  }
113
148
 
114
149
  /**
@@ -121,3 +156,4 @@ declare class SelectModule {
121
156
  }
122
157
 
123
158
  export { SelectComponent, SelectModule };
159
+ export type { SelectItemEvent };
@@ -15,7 +15,7 @@ declare class SidenavComponent implements OnInit, OnDestroy {
15
15
  private _renderer;
16
16
  open: _angular_core.InputSignalWithTransform<boolean, unknown>;
17
17
  mode: _angular_core.InputSignal<SidenavMode>;
18
- hasBackdrop: _angular_core.InputSignal<boolean>;
18
+ hasBackdrop: _angular_core.InputSignalWithTransform<boolean, unknown>;
19
19
  zIndex: _angular_core.InputSignal<number | undefined>;
20
20
  position: _angular_core.InputSignal<SidenavPosition>;
21
21
  sidenavWidth: _angular_core.InputSignal<number>;
@@ -157,37 +157,6 @@ function equalityComparerAttribute(e) {
157
157
  }
158
158
  throw Error('invalid equality comparer');
159
159
  }
160
- /**
161
- * @private
162
- * @param items
163
- * @param value
164
- * @param comparer
165
- */
166
- function findValueByComparer(items, value, comparer) {
167
- if (!items || items.length === 0 || value === undefined || value === null) {
168
- return undefined;
169
- }
170
- return items.find(i => comparer(i, value));
171
- }
172
- /**
173
- * @private
174
- * @param items
175
- * @param values
176
- * @param comparer
177
- */
178
- function findValuesByComparer(items, values, comparer) {
179
- if (!items || items.length === 0 || !values || values.length === 0) {
180
- return [];
181
- }
182
- const result = [];
183
- for (let v of values) {
184
- const item = items.find(i => comparer(i, v));
185
- if (item) {
186
- result.push(item);
187
- }
188
- }
189
- return result;
190
- }
191
160
 
192
161
  /**
193
162
  * Default value writer function.
@@ -235,11 +204,26 @@ function comparerAttribute(v) {
235
204
  }
236
205
 
237
206
  /**
238
- *
239
- * @param item
240
- * @returns
207
+ * No-op filter predicate that always returns true.
208
+ * @param item The item to test against the filter.
209
+ * @returns true
241
210
  */
242
- const noopFilter = (item) => true;
211
+ const noopFilter = (item, ...params) => true;
212
+ /**
213
+ * A simple filter predicate that checks if the item's string representation includes the match string.
214
+ * @param item The item to test against the filter.
215
+ * @param match The string to match.
216
+ * @returns True if the item matches the filter, false otherwise.
217
+ */
218
+ const defaultFilter = (item, match) => {
219
+ if (match == undefined || match == '') {
220
+ return true;
221
+ }
222
+ if (item == undefined) {
223
+ return false;
224
+ }
225
+ return item.toString().toLowerCase().includes(match.toLowerCase());
226
+ };
243
227
  /**
244
228
  * Converts a FilterPredicateLike to a FilterPredicate function.
245
229
  * If the input is a string, it creates a predicate that checks the property with that name.
@@ -249,6 +233,9 @@ const noopFilter = (item) => true;
249
233
  function filterPredicateAttribute(v) {
250
234
  if (typeof v === 'function')
251
235
  return v;
236
+ else if (typeof v === 'string') {
237
+ return (item, match) => item != null && Object.hasOwn(item, v) ? defaultFilter(item[v], match) : false;
238
+ }
252
239
  throw Error('invalid filter predicate');
253
240
  }
254
241
 
@@ -325,5 +312,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.2.1", ngImpor
325
312
  * Generated bundle index. Do not edit.
326
313
  */
327
314
 
328
- export { CssClassAttribute, IdGeneratorAttribute, IfDirective, RTL, TrackByAttribute, comparerAttribute, defaultComparer, defaultEqualityComparer, defaultValueWriter, deleteEntries, equalityComparerAttribute, filterPredicateAttribute, findValueByComparer, findValuesByComparer, flipPlacement, formatString, getEnumValues, noopFilter, numberArray, sequentialIdGenerator, toObservable, trackByIndex, trackByItem, valueWriterAttribute };
315
+ export { CssClassAttribute, IdGeneratorAttribute, IfDirective, RTL, TrackByAttribute, comparerAttribute, defaultComparer, defaultEqualityComparer, defaultFilter, defaultValueWriter, deleteEntries, equalityComparerAttribute, filterPredicateAttribute, flipPlacement, formatString, getEnumValues, noopFilter, numberArray, sequentialIdGenerator, toObservable, trackByIndex, trackByItem, valueWriterAttribute };
329
316
  //# sourceMappingURL=bootkit-ng0-common.mjs.map