@bootkit/ng0 0.0.0-alpha.25 → 0.0.0-alpha.27

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,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.
@@ -160,14 +164,17 @@ declare class ListComponent implements ControlValueAccessor {
160
164
  * Event emitted when the selection state of an item changes by user interaction.
161
165
  */
162
166
  readonly selectionChange: EventEmitter<ListSelectionChangeEvent>;
163
- _uuid: number;
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,47 @@ 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; }; }, { "selectionChange": "selectionChange"; }, ["_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
234
  interface ListSelectionChangeEvent {
235
+ /**
236
+ * The index of the item that was selected or deselected.
237
+ * This is the index of the item in the list and ignores any items that are not currently visible.
238
+ */
239
+ index: number;
240
+ /**
241
+ * The value of the item that was selected or deselected.
242
+ */
243
+ value: any;
220
244
  /**
221
245
  * The item that was selected or deselected.
222
246
  */
223
- readonly item: ListItemComponent;
247
+ readonly item: ListItem;
224
248
  /**
225
249
  * The list component that emitted the event.
226
250
  */
@@ -1,8 +1,7 @@
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 } 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';
@@ -11,104 +10,123 @@ import { ListSelectionChangeEvent } from '@bootkit/ng0/components/list';
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
91
  constructor();
92
- ngOnInit(): void;
92
+ /**
93
+ * Indicates whether the given value is selected.
94
+ * @param item
95
+ * @returns
96
+ */
97
+ isSelected(value: any): boolean;
98
+ /**
99
+ * Selects the given value.
100
+ * @param item
101
+ */
102
+ select(value: any): void;
103
+ /**
104
+ * Deselects the given value.
105
+ * @param item
106
+ */
107
+ deselect(value: any): void;
108
+ /**
109
+ * Toggles the selection state of the given value.
110
+ * @param item
111
+ */
112
+ toggle(value: any): void;
93
113
  writeValue(obj: any): void;
94
114
  registerOnChange(fn: any): void;
95
115
  registerOnTouched(fn: any): void;
96
116
  setDisabledState?(isDisabled: boolean): void;
97
- protected _onFilterBlur(): void;
117
+ private _findAndSelectItems;
118
+ private _updateValue;
98
119
  protected _onOverlayAttach(): void;
99
120
  protected _onOverlayDetach(): void;
100
121
  protected _onListSelectionChange(e: ListSelectionChangeEvent): void;
101
- protected _mappedValue: _angular_core.Signal<any>;
122
+ protected _filterPredicate: _angular_core.Signal<(item: any) => boolean>;
123
+ protected _onFilterKeydown(e: KeyboardEvent): void;
102
124
  private _listenToResizeEvents;
103
125
  private _unlistenFromResizeEvents;
104
- private _selectFirst;
105
- private _selectLast;
106
- private _selectNext;
107
- private _selectPrevious;
108
126
  private _onHostKeydown;
109
127
  private _onHostClick;
110
128
  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>;
129
+ 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"; }, ["itemTemplate"], never, true, never>;
112
130
  }
113
131
 
114
132
  /**
@@ -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
@@ -1 +1 @@
1
- {"version":3,"file":"bootkit-ng0-common.mjs","sources":["../../../projects/ng0/common/types.ts","../../../projects/ng0/common/layout.ts","../../../projects/ng0/common/string-utils.ts","../../../projects/ng0/common/rxjs-utils.ts","../../../projects/ng0/common/array-utils.ts","../../../projects/ng0/common/enum.ts","../../../projects/ng0/common/id-generator.ts","../../../projects/ng0/common/css-class.ts","../../../projects/ng0/common/equality-comparer.ts","../../../projects/ng0/common/value-writer.ts","../../../projects/ng0/common/comparer.ts","../../../projects/ng0/common/filter.ts","../../../projects/ng0/common/track-by.ts","../../../projects/ng0/common/if.directive.ts","../../../projects/ng0/common/bootkit-ng0-common.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\n\r\nexport const RTL = new InjectionToken<boolean>('RTL Direction');\r\n\r\n/**\r\n * List item interface.\r\n */\r\nexport interface SelectOption {\r\n id: string,\r\n value: any,\r\n show?: boolean,\r\n}\r\n\r\n\r\n","export type Placement = 'start' | 'end' | 'top' | 'bottom';\r\nexport type Alignment = 'start' | 'center' | 'end';\r\n\r\n/**\r\n * Flips the placement direction.\r\n * @param placement The placement direction to flip.\r\n * @returns The flipped placement direction.\r\n */\r\nexport function flipPlacement(placement: Placement) {\r\n switch (placement) {\r\n case 'bottom':\r\n return 'top'\r\n case 'top':\r\n return 'bottom'\r\n case 'start':\r\n return 'end'\r\n case 'end':\r\n return 'start'\r\n }\r\n}\r\n\r\n\r\n","/**\r\n * Formats a string by replacing placeholders with the provided arguments.\r\n * @param str The string to format, containing placeholders in the form of {0}, {1}, etc.\r\n * @param args The values to replace the placeholders with.\r\n * @returns The formatted string.\r\n */\r\nexport function formatString(str: string, ...args: any[]) {\r\n return str.replace(/\\{(\\d+)\\}/g, function (match, index) {\r\n return args[index];\r\n });\r\n}\r\n","import { from, Observable, of } from 'rxjs';\r\n\r\n/**\r\n * Converts a value to an Observable.\r\n * If the value is already an Observable, it returns it directly.\r\n * If the value is a Promise, it converts it to an Observable.\r\n * If the value is neither, it wraps it in an Observable using `of`.\r\n * @param value The value to convert.\r\n * @returns An Observable that emits the value.\r\n */\r\nexport function toObservable<T>(value: T | Observable<T> | Promise<T>): Observable<T> {\r\n if (value instanceof Observable) {\r\n return value;\r\n } else if (value instanceof Promise) {\r\n return from(value);\r\n } else {\r\n return of(value);\r\n }\r\n}\r\n","/**\r\n * Creates an array of numbers within a specified range.\r\n * @param start The starting number of the range (inclusive).\r\n * @param end The ending number of the range (inclusive).\r\n * @returns An array of numbers within the specified range.\r\n */\r\nexport function numberArray(start: number, end: number) {\r\n return Array.from({ length: end - start + 1 }, (_, i) => i + start)\r\n}\r\n\r\n/**\r\n * Deletes multiple entries from an array based on the provided indices.\r\n * @param array \r\n * @param indices \r\n * @private\r\n */\r\nexport function deleteEntries(array: any[], indices: number[]) {\r\n // Sort indices in descending order\r\n // This prevents index shifting issues when removing multiple items\r\n indices.sort((a, b) => b - a); \r\n indices.forEach(index => {\r\n if (index >= 0 && index < array.length) {\r\n array.splice(index, 1);\r\n } else {\r\n throw new Error(`Index out of bounds: ${index}`);\r\n }\r\n });\r\n}\r\n","\r\nexport function getEnumValues(enumClass: Record<string, string | number>): Array<string | number> {\r\n return Object.keys(enumClass)\r\n .filter(k => isNaN(Number(k))) // remove reverse-mapping keys\r\n .map(k => enumClass[k]);\r\n};\r\n","let _idCounter = 0;\r\n\r\n/**\r\n * Type definition for an ID generator function.\r\n * @param item The item for which the ID is to be generated.\r\n * @returns A string representing the generated ID.\r\n */\r\nexport type IdGenerator = (item: any) => string;\r\n\r\n/**\r\n * Type definition for an ID generator which can be a function or a string representing the property name to extract the ID from.\r\n */\r\nexport type IdGeneratorLike = IdGenerator | string;\r\n\r\n/**\r\n * Creates a sequential ID generator function with an optional prefix.\r\n * This function generates unique IDs by incrementing a counter each time it is called.\r\n * @param prefix Optional prefix for the generated IDs.\r\n * @returns A function that generates sequential IDs with the given prefix.\r\n */\r\nexport function sequentialIdGenerator(prefix?: string): IdGenerator {\r\n return (item: any) => `${prefix || ''}${_idCounter++}`;\r\n}\r\n\r\n/**\r\n * Converts an IdGeneratorLike to an IdGenerator function.\r\n * @param v The ID generator to convert.\r\n * @returns An IdGenerator function.\r\n */\r\nexport function IdGeneratorAttribute(v: IdGeneratorLike): IdGenerator {\r\n if (typeof v === 'function')\r\n return v;\r\n else if (typeof v === 'string') {\r\n return (item: any) => item ? item[v] : undefined;\r\n }\r\n\r\n throw Error('invalid id generator');\r\n}\r\n","/**\r\n * CSS class type which can be a string, array of strings, set of strings, or an object with class names as keys.\r\n */\r\nexport type CssClass = string | string[] | Set<string> | { [klass: string]: any } | null | undefined;\r\n\r\n\r\n/**\r\n * A function that takes an item and returns a CssClass.\r\n * @param item The item to get the CSS class for.\r\n * @returns The CSS class for the item.\r\n */\r\nexport type CssClassGetter = (obj: any) => CssClass;\r\n\r\n/**\r\n * A type that represents a CSS class or a function that returns a CSS class.\r\n */\r\nexport type CssClassLike = CssClass | CssClassGetter | null | undefined;\r\n\r\n\r\n/**\r\n * Converts a CssClassLike to a CssClassGetter function.\r\n * @param v The CssClassLike to convert.\r\n * @returns A function that returns the desired CSS class.\r\n */\r\nexport function CssClassAttribute(v: CssClassLike): CssClassGetter {\r\n if (v === undefined || v === null) {\r\n return (item: any) => undefined;\r\n } else if (typeof v === 'function')\r\n return v as CssClassGetter;\r\n else if (typeof v === 'string' || Array.isArray(v) || typeof v === 'object') {\r\n return (item: any) => v;\r\n }\r\n\r\n throw Error('invalid css class getter');\r\n}\r\n","/**\r\n * Equality comparer function type.\r\n * @param a First value to compare.\r\n * @param b Second value to compare.\r\n * @returns true if a is considered equal to b else returns false\r\n */\r\nexport type EqualityComparer = (a: any, b: any) => boolean;\r\n\r\n/**\r\n * Equality comparer like type.\r\n * can be a function or a string representing the property name to compare.\r\n */\r\nexport type EqualityComparerLike = EqualityComparer | string;\r\n\r\n/**\r\n * Default equality comparer function.\r\n * @param a First value to compare.\r\n * @param b Second value to compare.\r\n * @returns true if a === b else returns false\r\n */\r\nexport function defaultEqualityComparer(a: any, b: any): boolean {\r\n return a === b;\r\n}\r\n\r\n/**\r\n * Converts an EqualityComparerLike to an EqualityComparer function.\r\n * @param e The EqualityComparerLike to convert.\r\n * @returns The converted EqualityComparer.\r\n */\r\nexport function equalityComparerAttribute(e: EqualityComparerLike): EqualityComparer {\r\n if (typeof e === 'function')\r\n return e;\r\n if (typeof e === 'string') {\r\n return (a: any, b: any) => {\r\n let a2 = a != null && Object.hasOwn(a, e) ? a[e] : a;\r\n let b2 = b != null && Object.hasOwn(b, e) ? b[e] : b;\r\n return a2 === b2;\r\n }\r\n }\r\n\r\n throw Error('invalid equality comparer');\r\n}\r\n\r\n/**\r\n * @private \r\n * @param items \r\n * @param value \r\n * @param comparer \r\n */\r\nexport function findValueByComparer(items: any[], value: any, comparer: EqualityComparer): any {\r\n if (!items || items.length === 0 || value === undefined || value === null) {\r\n return undefined;\r\n }\r\n \r\n return items.find(i => comparer(i, value));\r\n}\r\n\r\n/**\r\n * @private \r\n * @param items \r\n * @param values\r\n * @param comparer \r\n */\r\nexport function findValuesByComparer(items: any[], values: any[], comparer: EqualityComparer): any[] {\r\n if (!items || items.length === 0 || !values || values.length === 0) {\r\n return [];\r\n }\r\n\r\n const result: any[] = [];\r\n for (let v of values) {\r\n const item = items.find(i => comparer(i, v));\r\n if (item) {\r\n result.push(item);\r\n }\r\n }\r\n\r\n return result;\r\n}\r\n","/**\r\n * Value writer function type.\r\n * @param a The input value\r\n * @returns The written value\r\n */\r\nexport type ValueWriter = (a: any) => any;\r\n\r\n/**\r\n * Value writer can be a function or a string representing the property name to extract the value from.\r\n */\r\nexport type ValueWriterLike = ValueWriter | string;\r\n\r\n\r\n/**\r\n * Default value writer function.\r\n * @param a The input value\r\n * @returns the input value (it does not transform it)\r\n */\r\nexport function defaultValueWriter(a: any): any {\r\n return a;\r\n}\r\n\r\n/**\r\n * Converts a ValueWriterLike to a ValueWriterFunction.\r\n * @param v The value writer to convert.\r\n * @returns A ValueWriter function.\r\n */\r\nexport function valueWriterAttribute(v: ValueWriterLike): ValueWriter {\r\n if (typeof v === 'function')\r\n return v;\r\n if (typeof v === 'string') {\r\n return (item: any) => item ? item[v] : undefined;\r\n }\r\n\r\n throw Error('invalid value writer');\r\n}\r\n","/**\r\n * A comparison function type that defines an ordering relation between two values.\r\n * @param a The first value to compare.\r\n * @param b The second value to compare.\r\n * @returns\r\n * - A negative number if `a` should come before `b`\r\n * - A positive number if `a` should come after `b`\r\n * - Zero if `a` and `b` are considered equal\r\n */\r\nexport type Comparer = (a: any, b: any) => number;\r\n\r\n/**\r\n * Value comparer can be a function or a string representing the property name to compare.\r\n */\r\nexport type ComparerLike = Comparer | string;\r\n\r\n/**\r\n * A simple comparer function.\r\n * @param a The first value to compare.\r\n * @param b The second value to compare.\r\n * @returns -1 if a < b, 1 if a > b, 0 if a === b\r\n */\r\nexport function defaultComparer(a: any, b: any): number {\r\n return a === b ? 0 : a < b ? -1 : 1;\r\n}\r\n\r\n/**\r\n * Converts a ComparerLike to a Comparer.\r\n * @param v The comparer to convert.\r\n * @returns A function that compares two values.\r\n */\r\nexport function comparerAttribute(v: ComparerLike): Comparer {\r\n if (typeof v === 'function')\r\n return v;\r\n if (typeof v === 'string') {\r\n return (a: any, b: any) => a?.[v] === b?.[v] ? 0 : a?.[v] < b?.[v] ? -1 : 1;\r\n }\r\n\r\n throw Error('invalid value comparer');\r\n}\r\n\r\n","/**\r\n * Filter predicate function type.\r\n * @param item The item to test against the filter.\r\n * @returns True if the item matches the filter, false otherwise.\r\n */\r\nexport type FilterPredicate = (item: any) => boolean;\r\n\r\n/**\r\n * Filter predicate can be a function or a string representing the property name to filter.\r\n */\r\nexport type FilterPredicateLike = FilterPredicate | string;\r\n\r\n/**\r\n * \r\n * @param item \r\n * @returns \r\n */\r\nexport const noopFilter: FilterPredicate = (item: string) => true;\r\n\r\n\r\n/**\r\n * Converts a FilterPredicateLike to a FilterPredicate function.\r\n * If the input is a string, it creates a predicate that checks the property with that name.\r\n * @param v The FilterPredicateLike to convert.\r\n * @returns The corresponding FilterPredicate function.\r\n */\r\nexport function filterPredicateAttribute(v: FilterPredicateLike): FilterPredicate {\r\n if (typeof v === 'function')\r\n return v;\r\n\r\n throw Error('invalid filter predicate');\r\n}\r\n","import { TrackByFunction } from \"@angular/core\";\r\n\r\n/**\r\n * An item tracker that can be either a TrackByFunction or a string property name.\r\n */\r\nexport type TrackByLike = TrackByFunction<any> | string;\r\n\r\n/**\r\n * A trackBy function that tracks items by their index.\r\n */\r\nexport const trackByIndex: TrackByFunction<any> = (index: number, item: any) => index;\r\n\r\n/**\r\n * A trackBy function that tracks items by the item itself.\r\n */\r\nexport const trackByItem: TrackByFunction<any> = (index: number, item: any) => item;\r\n\r\n/**\r\n * Converts a TrackByLike to a TrackByFunction.\r\n * @param v The item tracker to convert.\r\n * @returns A TrackByFunction.\r\n */\r\nexport function TrackByAttribute(v: TrackByLike): TrackByFunction<any> {\r\n if (typeof v === 'function')\r\n return v;\r\n else if (typeof v === 'string') {\r\n if(v.startsWith('@item')) {\r\n return trackByItem;\r\n } else if(v.startsWith('@index')) {\r\n return trackByIndex;\r\n } else {\r\n return (index: number, item: any) => item ? item[v] : undefined;\r\n }\r\n }\r\n\r\n throw Error('invalid TrackBy value');\r\n}\r\n","import { input, inject, Directive, TemplateRef, effect, ViewContainerRef, EmbeddedViewRef } from '@angular/core';\r\n\r\n/**\r\n * IfDirective is a structural directive that conditionally includes or excludes a template\r\n * based on the boolean value of the `show` input property.\r\n * \r\n */\r\n@Directive({\r\n selector: '[ng0If]',\r\n exportAs: 'ng0If',\r\n standalone: true,\r\n})\r\nexport class IfDirective {\r\n private readonly _templateRef = inject(TemplateRef<any>);\r\n private _vcr = inject(ViewContainerRef);\r\n private _viewRef?: EmbeddedViewRef<any>;\r\n public readonly show = input(true, { alias: 'ng0If' });\r\n\r\n constructor() {\r\n effect(() => {\r\n if (this.show()) {\r\n if (!this._viewRef) {\r\n this._viewRef = this._vcr.createEmbeddedView(this._templateRef);\r\n }\r\n\r\n if (this._vcr.length === 0) {\r\n this._vcr.insert(this._viewRef);\r\n }\r\n } else {\r\n if (this._vcr.length > 0) {\r\n this._vcr.detach(0);\r\n }\r\n }\r\n })\r\n }\r\n}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AA,EAAA,EAAA,EAAA,CAAA;;2FAAX,WAAW,EAAA,UAAA,EAAA,CAAA;kBALvB,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,SAAS;AACnB,oBAAA,QAAQ,EAAE,OAAO;AACjB,oBAAA,UAAU,EAAE,IAAI;AACnB,iBAAA;;;ACXD;;AAEG;;;;"}
1
+ {"version":3,"file":"bootkit-ng0-common.mjs","sources":["../../../projects/ng0/common/types.ts","../../../projects/ng0/common/layout.ts","../../../projects/ng0/common/string-utils.ts","../../../projects/ng0/common/rxjs-utils.ts","../../../projects/ng0/common/array-utils.ts","../../../projects/ng0/common/enum.ts","../../../projects/ng0/common/id-generator.ts","../../../projects/ng0/common/css-class.ts","../../../projects/ng0/common/equality-comparer.ts","../../../projects/ng0/common/value-writer.ts","../../../projects/ng0/common/comparer.ts","../../../projects/ng0/common/filter.ts","../../../projects/ng0/common/track-by.ts","../../../projects/ng0/common/if.directive.ts","../../../projects/ng0/common/bootkit-ng0-common.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\r\n\r\nexport const RTL = new InjectionToken<boolean>('RTL Direction');\r\n\r\n","export type Placement = 'start' | 'end' | 'top' | 'bottom';\r\nexport type Alignment = 'start' | 'center' | 'end';\r\n\r\n/**\r\n * Flips the placement direction.\r\n * @param placement The placement direction to flip.\r\n * @returns The flipped placement direction.\r\n */\r\nexport function flipPlacement(placement: Placement) {\r\n switch (placement) {\r\n case 'bottom':\r\n return 'top'\r\n case 'top':\r\n return 'bottom'\r\n case 'start':\r\n return 'end'\r\n case 'end':\r\n return 'start'\r\n }\r\n}\r\n\r\n\r\n","/**\r\n * Formats a string by replacing placeholders with the provided arguments.\r\n * @param str The string to format, containing placeholders in the form of {0}, {1}, etc.\r\n * @param args The values to replace the placeholders with.\r\n * @returns The formatted string.\r\n */\r\nexport function formatString(str: string, ...args: any[]) {\r\n return str.replace(/\\{(\\d+)\\}/g, function (match, index) {\r\n return args[index];\r\n });\r\n}\r\n","import { from, Observable, of } from 'rxjs';\r\n\r\n/**\r\n * Converts a value to an Observable.\r\n * If the value is already an Observable, it returns it directly.\r\n * If the value is a Promise, it converts it to an Observable.\r\n * If the value is neither, it wraps it in an Observable using `of`.\r\n * @param value The value to convert.\r\n * @returns An Observable that emits the value.\r\n */\r\nexport function toObservable<T>(value: T | Observable<T> | Promise<T>): Observable<T> {\r\n if (value instanceof Observable) {\r\n return value;\r\n } else if (value instanceof Promise) {\r\n return from(value);\r\n } else {\r\n return of(value);\r\n }\r\n}\r\n","/**\r\n * Creates an array of numbers within a specified range.\r\n * @param start The starting number of the range (inclusive).\r\n * @param end The ending number of the range (inclusive).\r\n * @returns An array of numbers within the specified range.\r\n */\r\nexport function numberArray(start: number, end: number) {\r\n return Array.from({ length: end - start + 1 }, (_, i) => i + start)\r\n}\r\n\r\n/**\r\n * Deletes multiple entries from an array based on the provided indices.\r\n * @param array \r\n * @param indices \r\n * @private\r\n */\r\nexport function deleteEntries(array: any[], indices: number[]) {\r\n // Sort indices in descending order\r\n // This prevents index shifting issues when removing multiple items\r\n indices.sort((a, b) => b - a); \r\n indices.forEach(index => {\r\n if (index >= 0 && index < array.length) {\r\n array.splice(index, 1);\r\n } else {\r\n throw new Error(`Index out of bounds: ${index}`);\r\n }\r\n });\r\n}\r\n","\r\nexport function getEnumValues(enumClass: Record<string, string | number>): Array<string | number> {\r\n return Object.keys(enumClass)\r\n .filter(k => isNaN(Number(k))) // remove reverse-mapping keys\r\n .map(k => enumClass[k]);\r\n};\r\n","let _idCounter = 0;\r\n\r\n/**\r\n * Type definition for an ID generator function.\r\n * @param item The item for which the ID is to be generated.\r\n * @returns A string representing the generated ID.\r\n */\r\nexport type IdGenerator = (item: any) => string;\r\n\r\n/**\r\n * Type definition for an ID generator which can be a function or a string representing the property name to extract the ID from.\r\n */\r\nexport type IdGeneratorLike = IdGenerator | string;\r\n\r\n/**\r\n * Creates a sequential ID generator function with an optional prefix.\r\n * This function generates unique IDs by incrementing a counter each time it is called.\r\n * @param prefix Optional prefix for the generated IDs.\r\n * @returns A function that generates sequential IDs with the given prefix.\r\n */\r\nexport function sequentialIdGenerator(prefix?: string): IdGenerator {\r\n return (item: any) => `${prefix || ''}${_idCounter++}`;\r\n}\r\n\r\n/**\r\n * Converts an IdGeneratorLike to an IdGenerator function.\r\n * @param v The ID generator to convert.\r\n * @returns An IdGenerator function.\r\n */\r\nexport function IdGeneratorAttribute(v: IdGeneratorLike): IdGenerator {\r\n if (typeof v === 'function')\r\n return v;\r\n else if (typeof v === 'string') {\r\n return (item: any) => item ? item[v] : undefined;\r\n }\r\n\r\n throw Error('invalid id generator');\r\n}\r\n","/**\r\n * CSS class type which can be a string, array of strings, set of strings, or an object with class names as keys.\r\n */\r\nexport type CssClass = string | string[] | Set<string> | { [klass: string]: any } | null | undefined;\r\n\r\n/**\r\n * A function that takes an item and returns a CssClass.\r\n * @param item The item to get the CSS class for.\r\n * @returns The CSS class for the item.\r\n */\r\nexport type CssClassGetter = (obj: any) => CssClass;\r\n\r\n/**\r\n * A type that represents a CSS class or a function that returns a CSS class.\r\n */\r\nexport type CssClassLike = CssClass | CssClassGetter;\r\n\r\n\r\n/**\r\n * Converts a CssClassLike to a CssClassGetter function.\r\n * @param v The CssClassLike to convert.\r\n * @returns A function that returns the desired CSS class.\r\n */\r\nexport function CssClassAttribute(v: CssClassLike): CssClassGetter {\r\n if (v === undefined || v === null) {\r\n return (item: any) => undefined;\r\n } else if (typeof v === 'function')\r\n return v as CssClassGetter;\r\n else if (typeof v === 'string' || Array.isArray(v) || typeof v === 'object') {\r\n return (item: any) => v;\r\n }\r\n\r\n throw Error('invalid css class getter');\r\n}\r\n","/**\r\n * Equality comparer function type.\r\n * @param a First value to compare.\r\n * @param b Second value to compare.\r\n * @returns true if a is considered equal to b else returns false\r\n */\r\nexport type EqualityComparer = (a: any, b: any) => boolean;\r\n\r\n/**\r\n * Equality comparer like type.\r\n * can be a function or a string representing the property name to compare.\r\n */\r\nexport type EqualityComparerLike = EqualityComparer | string;\r\n\r\n/**\r\n * Default equality comparer function.\r\n * @param a First value to compare.\r\n * @param b Second value to compare.\r\n * @returns true if a === b else returns false\r\n */\r\nexport function defaultEqualityComparer(a: any, b: any): boolean {\r\n return a === b;\r\n}\r\n\r\n/**\r\n * Converts an EqualityComparerLike to an EqualityComparer function.\r\n * @param e The EqualityComparerLike to convert.\r\n * @returns The converted EqualityComparer.\r\n */\r\nexport function equalityComparerAttribute(e: EqualityComparerLike): EqualityComparer {\r\n if (typeof e === 'function')\r\n return e;\r\n if (typeof e === 'string') {\r\n return (a: any, b: any) => {\r\n let a2 = a != null && Object.hasOwn(a, e) ? a[e] : a;\r\n let b2 = b != null && Object.hasOwn(b, e) ? b[e] : b;\r\n return a2 === b2;\r\n }\r\n }\r\n\r\n throw Error('invalid equality comparer');\r\n}\r\n","/**\r\n * Value writer function type.\r\n * @param a The input value\r\n * @returns The written value\r\n */\r\nexport type ValueWriter = (a: any) => any;\r\n\r\n/**\r\n * Value writer can be a function or a string representing the property name to extract the value from.\r\n */\r\nexport type ValueWriterLike = ValueWriter | string;\r\n\r\n\r\n/**\r\n * Default value writer function.\r\n * @param a The input value\r\n * @returns the input value (it does not transform it)\r\n */\r\nexport function defaultValueWriter(a: any): any {\r\n return a;\r\n}\r\n\r\n/**\r\n * Converts a ValueWriterLike to a ValueWriterFunction.\r\n * @param v The value writer to convert.\r\n * @returns A ValueWriter function.\r\n */\r\nexport function valueWriterAttribute(v: ValueWriterLike): ValueWriter {\r\n if (typeof v === 'function')\r\n return v;\r\n if (typeof v === 'string') {\r\n return (item: any) => item ? item[v] : undefined;\r\n }\r\n\r\n throw Error('invalid value writer');\r\n}\r\n","/**\r\n * A comparison function type that defines an ordering relation between two values.\r\n * @param a The first value to compare.\r\n * @param b The second value to compare.\r\n * @returns\r\n * - A negative number if `a` should come before `b`\r\n * - A positive number if `a` should come after `b`\r\n * - Zero if `a` and `b` are considered equal\r\n */\r\nexport type Comparer = (a: any, b: any) => number;\r\n\r\n/**\r\n * Value comparer can be a function or a string representing the property name to compare.\r\n */\r\nexport type ComparerLike = Comparer | string;\r\n\r\n/**\r\n * A simple comparer function.\r\n * @param a The first value to compare.\r\n * @param b The second value to compare.\r\n * @returns -1 if a < b, 1 if a > b, 0 if a === b\r\n */\r\nexport function defaultComparer(a: any, b: any): number {\r\n return a === b ? 0 : a < b ? -1 : 1;\r\n}\r\n\r\n/**\r\n * Converts a ComparerLike to a Comparer.\r\n * @param v The comparer to convert.\r\n * @returns A function that compares two values.\r\n */\r\nexport function comparerAttribute(v: ComparerLike): Comparer {\r\n if (typeof v === 'function')\r\n return v;\r\n if (typeof v === 'string') {\r\n return (a: any, b: any) => a?.[v] === b?.[v] ? 0 : a?.[v] < b?.[v] ? -1 : 1;\r\n }\r\n\r\n throw Error('invalid value comparer');\r\n}\r\n\r\n","/**\r\n * Filter predicate function type.\r\n * @param item The item to test against the filter.\r\n * @param params Additional parameters to pass to the filter.\r\n * @returns True if the item matches the filter, false otherwise.\r\n */\r\nexport type FilterPredicate = (item: any, ...params: any[]) => boolean;\r\n\r\n/**\r\n * Filter predicate can be a function or a string representing the property name to filter.\r\n */\r\nexport type FilterPredicateLike = FilterPredicate | string;\r\n\r\n/**\r\n * No-op filter predicate that always returns true.\r\n * @param item The item to test against the filter.\r\n * @returns true\r\n */\r\nexport const noopFilter: FilterPredicate = (item: any, ...params: any[]) => true;\r\n\r\n\r\n/**\r\n * A simple filter predicate that checks if the item's string representation includes the match string.\r\n * @param item The item to test against the filter.\r\n * @param match The string to match.\r\n * @returns True if the item matches the filter, false otherwise.\r\n */\r\nexport const defaultFilter: FilterPredicate = (item: any, match: string) => {\r\n if (match == undefined || match == '') {\r\n return true;\r\n }\r\n\r\n if (item == undefined) {\r\n return false;\r\n }\r\n\r\n return (item as Object).toString().toLowerCase().includes(match.toLowerCase());\r\n}\r\n\r\n\r\n/**\r\n * Converts a FilterPredicateLike to a FilterPredicate function.\r\n * If the input is a string, it creates a predicate that checks the property with that name.\r\n * @param v The FilterPredicateLike to convert.\r\n * @returns The corresponding FilterPredicate function.\r\n */\r\nexport function filterPredicateAttribute(v: FilterPredicateLike): FilterPredicate {\r\n if (typeof v === 'function')\r\n return v;\r\n else if (typeof v === 'string') {\r\n return (item: any, match: string) => \r\n item != null && Object.hasOwn(item, v) ? defaultFilter(item[v], match) : false;\r\n }\r\n\r\n throw Error('invalid filter predicate');\r\n}\r\n","import { TrackByFunction } from \"@angular/core\";\r\n\r\n/**\r\n * An item tracker that can be either a TrackByFunction or a string property name.\r\n */\r\nexport type TrackByLike = TrackByFunction<any> | string;\r\n\r\n/**\r\n * A trackBy function that tracks items by their index.\r\n */\r\nexport const trackByIndex: TrackByFunction<any> = (index: number, item: any) => index;\r\n\r\n/**\r\n * A trackBy function that tracks items by the item itself.\r\n */\r\nexport const trackByItem: TrackByFunction<any> = (index: number, item: any) => item;\r\n\r\n/**\r\n * Converts a TrackByLike to a TrackByFunction.\r\n * @param v The item tracker to convert.\r\n * @returns A TrackByFunction.\r\n */\r\nexport function TrackByAttribute(v: TrackByLike): TrackByFunction<any> {\r\n if (typeof v === 'function')\r\n return v;\r\n else if (typeof v === 'string') {\r\n if(v.startsWith('@item')) {\r\n return trackByItem;\r\n } else if(v.startsWith('@index')) {\r\n return trackByIndex;\r\n } else {\r\n return (index: number, item: any) => item ? item[v] : undefined;\r\n }\r\n }\r\n\r\n throw Error('invalid TrackBy value');\r\n}\r\n","import { input, inject, Directive, TemplateRef, effect, ViewContainerRef, EmbeddedViewRef } from '@angular/core';\r\n\r\n/**\r\n * IfDirective is a structural directive that conditionally includes or excludes a template\r\n * based on the boolean value of the `show` input property.\r\n * \r\n */\r\n@Directive({\r\n selector: '[ng0If]',\r\n exportAs: 'ng0If',\r\n standalone: true,\r\n})\r\nexport class IfDirective {\r\n private readonly _templateRef = inject(TemplateRef<any>);\r\n private _vcr = inject(ViewContainerRef);\r\n private _viewRef?: EmbeddedViewRef<any>;\r\n public readonly show = input(true, { alias: 'ng0If' });\r\n\r\n constructor() {\r\n effect(() => {\r\n if (this.show()) {\r\n if (!this._viewRef) {\r\n this._viewRef = this._vcr.createEmbeddedView(this._templateRef);\r\n }\r\n\r\n if (this._vcr.length === 0) {\r\n this._vcr.insert(this._viewRef);\r\n }\r\n } else {\r\n if (this._vcr.length > 0) {\r\n this._vcr.detach(0);\r\n }\r\n }\r\n })\r\n }\r\n}\r\n\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAEa,GAAG,GAAG,IAAI,cAAc,CAAU,eAAe;;ACC9D;;;;AAIG;AACG,SAAU,aAAa,CAAC,SAAoB,EAAA;IAC9C,QAAQ,SAAS;AACb,QAAA,KAAK,QAAQ;AACT,YAAA,OAAO,KAAK;AAChB,QAAA,KAAK,KAAK;AACN,YAAA,OAAO,QAAQ;AACnB,QAAA,KAAK,OAAO;AACR,YAAA,OAAO,KAAK;AAChB,QAAA,KAAK,KAAK;AACN,YAAA,OAAO,OAAO;;AAE1B;;ACnBA;;;;;AAKG;SACa,YAAY,CAAC,GAAW,EAAE,GAAG,IAAW,EAAA;IACpD,OAAO,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,UAAU,KAAK,EAAE,KAAK,EAAA;AACnD,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC;AACtB,IAAA,CAAC,CAAC;AACN;;ACRA;;;;;;;AAOG;AACG,SAAU,YAAY,CAAI,KAAqC,EAAA;AACjE,IAAA,IAAI,KAAK,YAAY,UAAU,EAAE;AAC7B,QAAA,OAAO,KAAK;IAChB;AAAO,SAAA,IAAI,KAAK,YAAY,OAAO,EAAE;AACjC,QAAA,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB;SAAO;AACH,QAAA,OAAO,EAAE,CAAC,KAAK,CAAC;IACpB;AACJ;;AClBA;;;;;AAKG;AACG,SAAU,WAAW,CAAC,KAAa,EAAE,GAAW,EAAA;IACpD,OAAO,KAAK,CAAC,IAAI,C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