@bootkit/ng0 0.0.0-alpha.21 → 0.0.0-alpha.23

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
@@ -79,13 +79,16 @@ declare function toObservable<T>(value: T | Observable<T> | Promise<T>): Observa
79
79
  * @returns An array of numbers within the specified range.
80
80
  */
81
81
  declare function numberArray(start: number, end: number): number[];
82
+ /**
83
+ * Deletes multiple entries from an array based on the provided indices.
84
+ * @param array
85
+ * @param indices
86
+ * @private
87
+ */
88
+ declare function deleteEntries(array: any[], indices: number[]): void;
82
89
 
83
90
  declare function getEnumValues(enumClass: Record<string, string | number>): Array<string | number>;
84
91
 
85
- declare abstract class _IdGenerator {
86
- private static _idCounter;
87
- static next(): number;
88
- }
89
92
  /**
90
93
  * Type definition for an ID generator function.
91
94
  */
@@ -108,7 +111,7 @@ type CssClass = string | string[] | Set<string> | {
108
111
  * @param item The item to get the CSS class for.
109
112
  * @returns The CSS class for the item.
110
113
  */
111
- type CssClassGetter = (item: any) => CssClass;
114
+ type CssClassGetter = (obj: any) => CssClass;
112
115
  /**
113
116
  * A type that represents a CSS class or a function that returns a CSS class.
114
117
  */
@@ -120,5 +123,120 @@ type CssClassLike = CssClass | CssClassGetter | null | undefined;
120
123
  */
121
124
  declare function CssClassAttribute(v: CssClassLike): CssClassGetter;
122
125
 
123
- export { CssClassAttribute, RTL, _IdGenerator, flipPlacement, formatString, getEnumValues, numberArray, sequentialIdGenerator, toObservable };
124
- export type { Alignment, ClaimLike, ClaimObject, CssClass, CssClassGetter, CssClassLike, IdGenerator, MenuItem, Placement, SelectOption };
126
+ /**
127
+ * Equality comparer function type.
128
+ * @param a First value to compare.
129
+ * @param b Second value to compare.
130
+ * @returns true if a is considered equal to b else returns false
131
+ */
132
+ type EqualityComparer = (a: any, b: any) => boolean;
133
+ /**
134
+ * Equality comparer like type.
135
+ * can be a function or a string representing the property name to compare.
136
+ */
137
+ type EqualityComparerLike = EqualityComparer | string;
138
+ /**
139
+ * Default equality comparer function.
140
+ * @param a First value to compare.
141
+ * @param b Second value to compare.
142
+ * @returns true if a === b else returns false
143
+ */
144
+ declare function defaultEqualityComparer(a: any, b: any): boolean;
145
+ /**
146
+ * Converts an EqualityComparerLike to an EqualityComparer function.
147
+ * @param e The EqualityComparerLike to convert.
148
+ * @returns The converted EqualityComparer.
149
+ */
150
+ declare function equalityComparerAttribute(e: EqualityComparerLike): EqualityComparer;
151
+ /**
152
+ * @private
153
+ * @param items
154
+ * @param value
155
+ * @param comparer
156
+ */
157
+ declare function findValueByComparer(items: any[], value: any, comparer: EqualityComparer): any;
158
+ /**
159
+ * @private
160
+ * @param items
161
+ * @param values
162
+ * @param comparer
163
+ */
164
+ declare function findValuesByComparer(items: any[], values: any[], comparer: EqualityComparer): any[];
165
+
166
+ /**
167
+ * Value writer function type.
168
+ * @param a The input value
169
+ * @returns The written value
170
+ */
171
+ type ValueWriter = (a: any) => any;
172
+ /**
173
+ * Value writer can be a function or a string representing the property name to extract the value from.
174
+ */
175
+ type ValueWriterLike = ValueWriter | string;
176
+ /**
177
+ * Default value writer function.
178
+ * @param a The input value
179
+ * @returns the input value (it does not transform it)
180
+ */
181
+ declare function defaultValueWriter(a: any): any;
182
+ /**
183
+ * Converts a ValueWriterLike to a ValueWriterFunction.
184
+ * @param v The value writer to convert.
185
+ * @returns A ValueWriter function.
186
+ */
187
+ declare function valueWriterAttribute(v: ValueWriterLike): ValueWriter;
188
+
189
+ /**
190
+ * A comparison function type that defines an ordering relation between two values.
191
+ * @param a The first value to compare.
192
+ * @param b The second value to compare.
193
+ * @returns
194
+ * - A negative number if `a` should come before `b`
195
+ * - A positive number if `a` should come after `b`
196
+ * - Zero if `a` and `b` are considered equal
197
+ */
198
+ type Comparer = (a: any, b: any) => number;
199
+ /**
200
+ * Value comparer can be a function or a string representing the property name to compare.
201
+ */
202
+ type ComparerLike = Comparer | string;
203
+ /**
204
+ * A simple comparer function.
205
+ * @param a The first value to compare.
206
+ * @param b The second value to compare.
207
+ * @returns -1 if a < b, 1 if a > b, 0 if a === b
208
+ */
209
+ declare function defaultComparer(a: any, b: any): number;
210
+ /**
211
+ * Converts a ComparerLike to a Comparer.
212
+ * @param v The comparer to convert.
213
+ * @returns A function that compares two values.
214
+ */
215
+ declare function comparerAttribute(v: ComparerLike): Comparer;
216
+
217
+ /**
218
+ * Filter predicate function type.
219
+ * @param item The item to test against the filter.
220
+ * @returns True if the item matches the filter, false otherwise.
221
+ */
222
+ type FilterPredicate = (item: any) => boolean;
223
+ /**
224
+ * Filter predicate can be a function or a string representing the property name to filter.
225
+ */
226
+ type FilterPredicateLike = FilterPredicate | string;
227
+ /**
228
+ *
229
+ * @param item
230
+ * @returns
231
+ */
232
+ declare const noopFilter: FilterPredicate;
233
+ /**
234
+ * Converts a FilterPredicateLike to a FilterPredicate function.
235
+ * If the input is a string, it creates a predicate that checks the property with that name.
236
+ * @param v The FilterPredicateLike to convert.
237
+ * @returns The corresponding FilterPredicate function.
238
+ */
239
+ declare function filterPredicateAttribute(v: FilterPredicateLike): FilterPredicate;
240
+
241
+ export { CssClassAttribute, RTL, comparerAttribute, defaultComparer, defaultEqualityComparer, defaultValueWriter, deleteEntries, equalityComparerAttribute, filterPredicateAttribute, findValueByComparer, findValuesByComparer, flipPlacement, formatString, getEnumValues, noopFilter, numberArray, sequentialIdGenerator, toObservable, valueWriterAttribute };
242
+ export type { Alignment, ClaimLike, ClaimObject, Comparer, ComparerLike, CssClass, CssClassGetter, CssClassLike, EqualityComparer, EqualityComparerLike, FilterPredicate, FilterPredicateLike, IdGenerator, MenuItem, Placement, SelectOption, ValueWriter, ValueWriterLike };
@@ -1,7 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { QueryList, ElementRef } from '@angular/core';
3
- import { Placement } from '@bootkit/ng0/common';
4
- import { ScrollStrategy } from '@angular/cdk/overlay';
2
+ import { ElementRef } from '@angular/core';
3
+ import { Placement, CssClass } from '@bootkit/ng0/common';
4
+
5
+ declare class DropdownDividerComponent {
6
+ static ɵfac: i0.ɵɵFactoryDeclaration<DropdownDividerComponent, never>;
7
+ static ɵcmp: i0.ɵɵComponentDeclaration<DropdownDividerComponent, "ng0-dropdown-divider", ["ng0DropdownDivider"], {}, {}, never, never, true, never>;
8
+ }
5
9
 
6
10
  /**
7
11
  * Defines the possible values for the dropdown auto-close behavior.
@@ -17,62 +21,120 @@ type DropdownAutoCloseBehavior = 'default' | 'inside' | 'outside' | 'manual';
17
21
  */
18
22
  type DropdownSize = 'default' | 'small' | 'large';
19
23
 
20
- declare class DropdownItemComponent {
21
- constructor();
22
- static ɵfac: i0.ɵɵFactoryDeclaration<DropdownItemComponent, never>;
23
- static ɵcmp: i0.ɵɵComponentDeclaration<DropdownItemComponent, "ng0-dropdown-item", ["ng0DropdownItem"], {}, {}, never, ["*"], true, never>;
24
- }
25
-
26
24
  declare class DropdownComponent {
27
- protected _items: QueryList<DropdownItemComponent>;
28
- protected _scrollStrategy: ScrollStrategy;
25
+ private _dropdownMenu;
26
+ private _mainButton;
27
+ private _splitButton?;
29
28
  protected _el: ElementRef<any>;
30
29
  private _renderer;
31
- private _overlay;
32
30
  /**
33
31
  * The placement of the dropdown menu in relation to the dropdown toggle.
34
32
  */
35
33
  placement: i0.InputSignal<Placement>;
34
+ /**
35
+ * The CSS classes to apply to the dropdown toggle button.
36
+ * @default 'btn btn-primary'
37
+ */
38
+ cssClass: i0.InputSignal<CssClass>;
39
+ /**
40
+ * The CSS classes to apply to the dropdown split button.
41
+ * @default 'btn btn-primary'
42
+ */
43
+ splitCssClass: i0.InputSignal<CssClass>;
36
44
  /**
37
45
  * Indicates whether the dropdown is open or closed.
46
+ * @default false
38
47
  */
39
48
  readonly open: i0.ModelSignal<boolean>;
40
49
  /**
41
- *
50
+ * Indicates whether the dropdown is a split button.
51
+ * A split button dropdown has a separate toggle button.
52
+ * @default false
53
+ */
54
+ readonly split: i0.InputSignalWithTransform<boolean, unknown>;
55
+ /**
56
+ * Indicates whether the dropdown has an automatic close behavior.
57
+ * @default 'default'
42
58
  */
43
59
  readonly autoClose: i0.InputSignal<DropdownAutoCloseBehavior>;
60
+ /**
61
+ * Dropdown size
62
+ * @default 'default'
63
+ */
64
+ readonly size: i0.InputSignal<DropdownSize>;
65
+ protected _directionCssClass: i0.Signal<"dropup" | "dropstart" | "dropend" | undefined>;
44
66
  constructor();
45
- protected _onOverlayAttach(): void;
46
- protected _onOverlayDetach(): void;
67
+ /**
68
+ * Toggle the dropdown open or closed.
69
+ */
70
+ toggle(): void;
71
+ private _onDocumentClick;
47
72
  static ɵfac: i0.ɵɵFactoryDeclaration<DropdownComponent, never>;
48
- static ɵcmp: i0.ɵɵComponentDeclaration<DropdownComponent, "ng0-dropdown", ["ng0Dropdown"], { "placement": { "alias": "placement"; "required": false; "isSignal": true; }; "open": { "alias": "open"; "required": false; "isSignal": true; }; "autoClose": { "alias": "autoClose"; "required": false; "isSignal": true; }; }, { "open": "openChange"; }, ["_items"], ["*", "ng0-dropdown-menu"], true, never>;
73
+ static ɵcmp: i0.ɵɵComponentDeclaration<DropdownComponent, "ng0-dropdown", ["ng0Dropdown"], { "placement": { "alias": "placement"; "required": false; "isSignal": true; }; "cssClass": { "alias": "cssClass"; "required": false; "isSignal": true; }; "splitCssClass": { "alias": "splitCssClass"; "required": false; "isSignal": true; }; "open": { "alias": "open"; "required": false; "isSignal": true; }; "split": { "alias": "split"; "required": false; "isSignal": true; }; "autoClose": { "alias": "autoClose"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, { "open": "openChange"; }, ["_dropdownMenu"], ["*", "ng0-dropdown-menu"], true, never>;
49
74
  }
50
75
 
51
76
  declare class DropdownMenuComponent {
52
- private _el;
53
77
  private _renderer;
54
78
  private _dropdown;
79
+ elementRef: ElementRef<any>;
55
80
  constructor();
56
- private _onClick;
57
81
  static ɵfac: i0.ɵɵFactoryDeclaration<DropdownMenuComponent, never>;
58
82
  static ɵcmp: i0.ɵɵComponentDeclaration<DropdownMenuComponent, "ng0-dropdown-menu", ["ng0Dropdownmenu"], {}, {}, never, ["*"], true, never>;
59
83
  }
60
84
 
85
+ /**
86
+ * An item within a dropdown menu.
87
+ */
88
+ declare class DropdownItemComponent {
89
+ /**
90
+ * The CSS classes to apply to the dropdown item.
91
+ * */
92
+ readonly cssClass: i0.InputSignal<CssClass>;
93
+ /**
94
+ * Whether the dropdown item is disabled.
95
+ */
96
+ readonly disabled: i0.InputSignalWithTransform<boolean, unknown>;
97
+ private _onClick;
98
+ static ɵfac: i0.ɵɵFactoryDeclaration<DropdownItemComponent, never>;
99
+ static ɵcmp: i0.ɵɵComponentDeclaration<DropdownItemComponent, "ng0-dropdown-item", ["ng0DropdownItem"], { "cssClass": { "alias": "cssClass"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
100
+ }
101
+
102
+ /**
103
+ * A link item within a dropdown menu.
104
+ * This component is used to create a navigable link inside a dropdown.
105
+ */
106
+ declare class DropdownLinkComponent {
107
+ /**
108
+ * The link or URL to navigate to when the dropdown item is clicked.
109
+ */
110
+ readonly link: i0.InputSignal<string | string[] | undefined>;
111
+ /**
112
+ * The router link active class to apply when the link is active.
113
+ */
114
+ readonly active: i0.InputSignal<string | string[]>;
115
+ /**
116
+ * Specifies where to open the linked document.
117
+ */
118
+ readonly target: i0.InputSignal<"_self" | "_blank" | "_parent" | "_top" | undefined>;
119
+ /**
120
+ * Whether the dropdown link is disabled.
121
+ */
122
+ readonly disabled: i0.InputSignalWithTransform<boolean, unknown>;
123
+ private _onClick;
124
+ static ɵfac: i0.ɵɵFactoryDeclaration<DropdownLinkComponent, never>;
125
+ static ɵcmp: i0.ɵɵComponentDeclaration<DropdownLinkComponent, "ng0-dropdown-link", ["ng0DropdownLink"], { "link": { "alias": "link"; "required": true; "isSignal": true; }; "active": { "alias": "active"; "required": false; "isSignal": true; }; "target": { "alias": "target"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
126
+ }
127
+
61
128
  declare class DropdownHeaderComponent {
62
129
  static ɵfac: i0.ɵɵFactoryDeclaration<DropdownHeaderComponent, never>;
63
130
  static ɵcmp: i0.ɵɵComponentDeclaration<DropdownHeaderComponent, "ng0-dropdown-header", ["ng0DropdownItem"], {}, {}, never, ["*"], true, never>;
64
131
  }
65
132
 
66
- declare class DropdownDividerComponent {
67
- static ɵfac: i0.ɵɵFactoryDeclaration<DropdownDividerComponent, never>;
68
- static ɵcmp: i0.ɵɵComponentDeclaration<DropdownDividerComponent, "ng0-dropdown-divider", ["ng0DropdownDivider"], {}, {}, never, never, true, never>;
69
- }
70
-
71
133
  declare class DropdownModule {
72
134
  static ɵfac: i0.ɵɵFactoryDeclaration<DropdownModule, never>;
73
- static ɵmod: i0.ɵɵNgModuleDeclaration<DropdownModule, never, [typeof DropdownComponent, typeof DropdownMenuComponent, typeof DropdownItemComponent, typeof DropdownHeaderComponent, typeof DropdownDividerComponent], [typeof DropdownComponent, typeof DropdownMenuComponent, typeof DropdownItemComponent, typeof DropdownHeaderComponent, typeof DropdownDividerComponent]>;
135
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DropdownModule, never, [typeof DropdownComponent, typeof DropdownMenuComponent, typeof DropdownItemComponent, typeof DropdownLinkComponent, typeof DropdownHeaderComponent, typeof DropdownDividerComponent], [typeof DropdownComponent, typeof DropdownMenuComponent, typeof DropdownItemComponent, typeof DropdownLinkComponent, typeof DropdownHeaderComponent, typeof DropdownDividerComponent]>;
74
136
  static ɵinj: i0.ɵɵInjectorDeclaration<DropdownModule>;
75
137
  }
76
138
 
77
- export { DropdownComponent, DropdownDividerComponent, DropdownHeaderComponent, DropdownItemComponent, DropdownMenuComponent, DropdownModule };
139
+ export { DropdownComponent, DropdownDividerComponent, DropdownHeaderComponent, DropdownItemComponent, DropdownLinkComponent, DropdownMenuComponent, DropdownModule };
78
140
  export type { DropdownAutoCloseBehavior, DropdownSize };
@@ -1,37 +1,33 @@
1
- import * as _bootkit_ng0_common from '@bootkit/ng0/common';
2
- import { CssClassLike, IdGenerator } from '@bootkit/ng0/common';
3
1
  import * as _bootkit_ng0_localization from '@bootkit/ng0/localization';
4
- import * as _bootkit_ng0_data from '@bootkit/ng0/data';
5
- import { DataSource, DataSourceLike, FilterPredicate } from '@bootkit/ng0/data';
2
+ import * as _bootkit_ng0_common from '@bootkit/ng0/common';
3
+ import { FilterPredicate, IdGenerator } from '@bootkit/ng0/common';
6
4
  import * as _angular_core from '@angular/core';
7
- import { OnInit, ElementRef, TemplateRef, Renderer2, DestroyRef } from '@angular/core';
5
+ import { TemplateRef, ElementRef, EventEmitter } from '@angular/core';
6
+ import { DataSource, DataSourceLike } from '@bootkit/ng0/data';
8
7
  import { ControlValueAccessor } from '@angular/forms';
9
8
 
10
- interface ListItem {
11
- id: string;
12
- value: any;
13
- selected?: boolean;
14
- disabled?: boolean;
15
- filtered?: boolean;
16
- }
17
-
18
9
  /**
19
10
  * Select component that allows users to choose an option from a dropdown list.
20
11
  */
21
- declare class ListComponent implements OnInit, ControlValueAccessor {
22
- protected _el: ElementRef<HTMLDivElement>;
23
- private _renderer;
24
- private _destroyRef;
12
+ declare class ListComponent implements ControlValueAccessor {
25
13
  private _document;
26
14
  private _ls;
15
+ private _renderer;
16
+ private _destroyRef;
27
17
  private _changeDetector;
28
- protected _value: _angular_core.WritableSignal<any>;
29
- private _onChangeCallback;
30
- private _onTouchedCallback;
18
+ private _value;
19
+ private _changeCallback?;
20
+ private _touchCallback?;
21
+ private _selectedIndices;
31
22
  protected readonly _items: _angular_core.WritableSignal<ListItem[]>;
32
23
  protected readonly _isDisabled: _angular_core.WritableSignal<boolean>;
33
24
  protected readonly _activeOptionIndex: _angular_core.WritableSignal<number>;
34
25
  protected _itemTemplate?: TemplateRef<any>;
26
+ private _ariaActiveDescendant;
27
+ /**
28
+ * Reference to the host element
29
+ */
30
+ elementRef: ElementRef<HTMLElement>;
35
31
  /**
36
32
  * The data source for the select component.
37
33
  * This can be an array of data, a function that returns an observable of data,
@@ -46,50 +42,108 @@ declare class ListComponent implements OnInit, ControlValueAccessor {
46
42
  * Indicates whether to show selection indicator (checkbox/radio) next to each item.
47
43
  * Default is false.
48
44
  */
49
- readonly showIndicator: _angular_core.InputSignalWithTransform<boolean, unknown>;
45
+ readonly showSelectionIndicator: _angular_core.InputSignalWithTransform<boolean, unknown>;
50
46
  /**
51
47
  * A custom comparer function or the name of a field for comparing two objects.
52
48
  */
53
- readonly compareBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_data.BooleanValueComparer, _bootkit_ng0_data.BooleanValueComparerLike>;
49
+ readonly compareBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.EqualityComparer, _bootkit_ng0_common.EqualityComparerLike>;
54
50
  /**
55
51
  * Custom format function to convert an item to a string for display.
56
52
  * Default converts the item to a string using its toString method.
57
53
  */
58
- readonly formatBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_localization.ValueFormatterFunction, _bootkit_ng0_localization.ValueFormatterLike>;
54
+ readonly formatBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_localization.ObjectFormatter, _bootkit_ng0_localization.ObjectFormatterLike>;
59
55
  /**
60
56
  * Custom value extractor function to extract the value of any object while writing values.
61
57
  */
62
- readonly writeBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_data.ValueExtractor, _bootkit_ng0_data.ValueExtractorLike>;
58
+ readonly writeBy: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.ValueWriter, _bootkit_ng0_common.ValueWriterLike>;
63
59
  /**
64
60
  * A custom filter predicate function to filter items based on a search string.
65
61
  * Default checks if the item's string representation contains the filter string (case-insensitive).
66
62
  * The filter predicate can be a function or a string representing the property name to filter.
67
63
  */
68
- readonly filterBy: _angular_core.InputSignalWithTransform<FilterPredicate, _bootkit_ng0_data.FilterPredicateLike>;
64
+ readonly filterBy: _angular_core.InputSignalWithTransform<FilterPredicate, _bootkit_ng0_common.FilterPredicateLike>;
69
65
  /**
70
66
  * CSS class or classes to apply to the list container.
71
67
  * Default is undefined.
72
68
  */
73
- readonly itemClass: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.CssClassGetter, CssClassLike>;
69
+ readonly itemClass: _angular_core.InputSignalWithTransform<_bootkit_ng0_common.CssClassGetter, _bootkit_ng0_common.CssClassLike>;
70
+ /**
71
+ * Defines the focus behavior of the list component.
72
+ * - 'none': No keyboard interaction is possible. The list cannot be focused.
73
+ * - 'roving': Roving tabindex is enabled. The list can be focused and the active item is tabbable.
74
+ * - 'activeDescendant': The list can be focused, but no item is tabbable. The active item is indicated using aria-activedescendant.
75
+ * @default 'activeDescendant'.
76
+ */
74
77
  readonly focus: _angular_core.InputSignal<"none" | "roving" | "activeDescendant">;
75
- readonly idGenerator: _angular_core.InputSignal<IdGenerator | undefined>;
76
- constructor(_el: ElementRef<HTMLDivElement>, _renderer: Renderer2, _destroyRef: DestroyRef);
77
- ngOnInit(): void;
78
+ /**
79
+ * Custom id generator function to generate unique ids for each item.
80
+ * Default generates sequential ids with the prefix 'ng0-list-item-'.
81
+ * If set to undefined, no ids will be generated.
82
+ * @default sequentialIdGenerator('ng0-list-item-')
83
+ */
84
+ readonly idGenerator: _angular_core.InputSignal<IdGenerator>;
85
+ /**
86
+ * Event emitted when the selection state of an item changes by user interaction.
87
+ */
88
+ readonly selectionChange: EventEmitter<ListSelectionChangeEvent>;
89
+ constructor();
90
+ /**
91
+ * Gets the items of the list component.
92
+ * @returns A readonly array of the items in the list.
93
+ */
94
+ items(): ReadonlyArray<ListItem>;
78
95
  /**
79
96
  * Sets an option as active
97
+ * @param index The index of the option to set as active.
98
+ * @param scrollIntoView Whether to scroll the active option into view. Default is true.
99
+ * @returns void
80
100
  */
81
- active(index: number): void;
101
+ active(index: number, scrollIntoView?: boolean): void;
82
102
  /**
83
- * Filters the list items based on the provided criteria.
84
- * @param params The filter parameters to apply.
103
+ * Selects an option by index
104
+ * @param index The index of the option to select.
85
105
  * @returns void
86
106
  */
87
- filter(...params: any[]): void;
107
+ select(index: number): void;
88
108
  /**
89
- * Clears any applied filters and shows all items in the list.
109
+ * Deselects an option by index
110
+ * @param index The index of the option to deselect.
90
111
  * @returns void
91
112
  */
92
- clearFilter(): void;
113
+ deselect(index: number): void;
114
+ /**
115
+ * Toggles the selection state of an option by index
116
+ * @param index The index of the option to toggle.
117
+ * @returns void
118
+ */
119
+ toggle(index: number): void;
120
+ /**
121
+ * Checks if an option is selected.
122
+ * @param index The index of the option to check.
123
+ * @returns True if the option is selected, false otherwise.
124
+ */
125
+ isSelected(index: number): boolean;
126
+ /**
127
+ * Checks if an option is active.
128
+ * @param index The index of the option to check.
129
+ * @returns True if the option is active, false otherwise.
130
+ */
131
+ isActive(index: number): boolean;
132
+ /**
133
+ * Sets the value of the list component.
134
+ * @param value The value to set. Can be a single value or an array of values in multiple selection mode.
135
+ */
136
+ set(value: any): void;
137
+ /**
138
+ * Gets the currently selected indices.
139
+ * @returns An array of the currently selected indices.
140
+ * @description
141
+ * - In single selection mode, the array will contain at most one item.
142
+ * - In multiple selection mode, the array can contain multiple items.
143
+ * - Changing the selection should be done using select(), deselect(), or toggle() methods to ensure proper event emission and state management.
144
+ * - Direct manipulation of the returned array will not affect the component's state.
145
+ */
146
+ selectedIndices(): ReadonlyArray<number>;
93
147
  /**
94
148
  * Scrolls the item at the specified index into view within the dropdown list.
95
149
  * @param index The index of the item to scroll into view.
@@ -98,21 +152,59 @@ declare class ListComponent implements OnInit, ControlValueAccessor {
98
152
  * Default is 'nearest'.
99
153
  * @param behavior The scrolling behavior.
100
154
  */
101
- scrollItemIntoView(index: number, position?: ScrollLogicalPosition, behavior?: ScrollBehavior): void;
102
- /**
103
- * Toggles the selection of an option by index
104
- */
105
- toggleSelection(index: number): void;
106
- writeValue(v: any): void;
155
+ scrollIntoView(index: number, position?: ScrollLogicalPosition, behavior?: ScrollBehavior): void;
156
+ writeValue(value: any): void;
157
+ private _setValue;
107
158
  registerOnChange(fn: any): void;
108
159
  registerOnTouched(fn: any): void;
109
160
  setDisabledState?(isDisabled: boolean): void;
110
- protected _onKeydown(e: KeyboardEvent, firedByFilter?: boolean): void;
161
+ protected _getItemTabIndex(index: number): -1 | 0 | undefined;
162
+ protected _handleUserSelection(index: number, item: ListItem): void;
111
163
  private _loadItems;
112
- private _listenToDataSourceChanges;
113
- private _insertItems;
164
+ private _createItems;
165
+ private _onHostClick;
166
+ private _onKeydown;
167
+ private _verifyIndexRange;
114
168
  static ɵfac: _angular_core.ɵɵFactoryDeclaration<ListComponent, never>;
115
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<ListComponent, "ng0-list", ["ng0List"], { "source": { "alias": "source"; "required": true; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "showIndicator": { "alias": "showIndicator"; "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; }; "itemClass": { "alias": "itemClass"; "required": false; "isSignal": true; }; "focus": { "alias": "focus"; "required": false; "isSignal": true; }; "idGenerator": { "alias": "idGenerator"; "required": false; "isSignal": true; }; }, {}, ["_itemTemplate"], never, true, never>;
169
+ 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; }; "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>;
170
+ }
171
+ /**
172
+ * Represents an item in the list.
173
+ */
174
+ interface ListItem {
175
+ /**
176
+ * Id of the item (if idGenerator is provided, otherwise undefined).
177
+ */
178
+ id: string;
179
+ /**
180
+ * Value of the item.
181
+ */
182
+ value: any;
183
+ }
184
+ /**
185
+ * Event emitted when the selection state of the list changes by user interaction.
186
+ */
187
+ interface ListSelectionChangeEvent {
188
+ /**
189
+ * Index of the item that was selected or deselected.
190
+ */
191
+ readonly index: number;
192
+ /**
193
+ * The value of the item that was selected or deselected.
194
+ */
195
+ readonly value: any;
196
+ /**
197
+ * Indicates whether the item was selected (true) or deselected (false).
198
+ */
199
+ readonly selected: boolean;
200
+ /**
201
+ * The indices of all currently selected items.
202
+ */
203
+ readonly selectedIndices: ReadonlyArray<number>;
204
+ /**
205
+ * The list component that emitted the event.
206
+ */
207
+ readonly list: ListComponent;
116
208
  }
117
209
 
118
210
  /**
@@ -125,3 +217,4 @@ declare class ListModule {
125
217
  }
126
218
 
127
219
  export { ListComponent, ListModule };
220
+ export type { ListItem, ListSelectionChangeEvent };