@recursyve/ngx-material-components 19.0.0-beta.20 → 19.0.0-beta.21
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/chip-list/chip-list.d.ts +26 -0
- package/chip-list/icons/clear/chip-list-items-clear-icon.d.ts +5 -0
- package/chip-list/index.d.ts +2 -41
- package/chip-list/items/chip-list-items.d.ts +14 -0
- package/common/index.d.ts +4 -24
- package/common/provider.d.ts +3 -0
- package/common/translater/constant.d.ts +2 -0
- package/common/translater/options.d.ts +7 -0
- package/common/translater/translate-pipe.d.ts +8 -0
- package/common/translater/translater.d.ts +1 -0
- package/dropzone/config.d.ts +42 -0
- package/dropzone/constant.d.ts +2 -0
- package/dropzone/dropzone.d.ts +42 -0
- package/dropzone/dropzone.directive.d.ts +12 -0
- package/dropzone/icons/delete/delete-icon.component.d.ts +5 -0
- package/dropzone/icons/file/file-icon.component.d.ts +5 -0
- package/dropzone/icons/image/image-icon.component.d.ts +5 -0
- package/dropzone/index.d.ts +6 -125
- package/dropzone/models.d.ts +20 -0
- package/dropzone/options.d.ts +4 -0
- package/dropzone/pipes/file-size.pipe.d.ts +10 -0
- package/dropzone/preview/file-preview.d.ts +14 -0
- package/dropzone/provider.d.ts +3 -0
- package/fesm2022/recursyve-ngx-material-components-chip-list.mjs +13 -13
- package/fesm2022/recursyve-ngx-material-components-chip-list.mjs.map +1 -1
- package/fesm2022/recursyve-ngx-material-components-common.mjs +3 -3
- package/fesm2022/recursyve-ngx-material-components-common.mjs.map +1 -1
- package/fesm2022/recursyve-ngx-material-components-dropzone.mjs +35 -35
- package/fesm2022/recursyve-ngx-material-components-dropzone.mjs.map +1 -1
- package/fesm2022/recursyve-ngx-material-components-form-field-error.mjs +6 -6
- package/fesm2022/recursyve-ngx-material-components-form-field-error.mjs.map +1 -1
- package/fesm2022/recursyve-ngx-material-components-loading.mjs +10 -10
- package/fesm2022/recursyve-ngx-material-components-loading.mjs.map +1 -1
- package/fesm2022/recursyve-ngx-material-components-typeahead.mjs +49 -46
- package/fesm2022/recursyve-ngx-material-components-typeahead.mjs.map +1 -1
- package/form-field-error/constant.d.ts +3 -0
- package/form-field-error/error-transformer.d.ts +13 -0
- package/form-field-error/form-field-error.d.ts +8 -0
- package/form-field-error/form-field-error.directive.d.ts +17 -0
- package/form-field-error/index.d.ts +4 -53
- package/form-field-error/options.d.ts +9 -0
- package/form-field-error/provider.d.ts +3 -0
- package/index.d.ts +1 -3
- package/loading/constant.d.ts +2 -0
- package/loading/index.d.ts +3 -31
- package/loading/loading-spinner.d.ts +9 -0
- package/loading/loading.d.ts +13 -0
- package/loading/options.d.ts +4 -0
- package/loading/provider.d.ts +3 -0
- package/package.json +7 -7
- package/typeahead/async-typeahead.d.ts +34 -0
- package/typeahead/constants.d.ts +2 -0
- package/typeahead/icons/search/typeahead-search-icon.d.ts +5 -0
- package/typeahead/index.d.ts +4 -216
- package/typeahead/provider.d.ts +3 -0
- package/typeahead/providers/async-typeahead.provider.d.ts +11 -0
- package/typeahead/providers/async-typeahead.service.d.ts +48 -0
- package/typeahead/providers/index.d.ts +2 -0
- package/typeahead/typeahead-base.d.ts +111 -0
- package/typeahead/typeahead.d.ts +12 -0
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recursyve/ngx-material-components",
|
|
3
|
-
"version": "19.0.0-beta.
|
|
3
|
+
"version": "19.0.0-beta.21",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^
|
|
6
|
-
"@angular/core": "^
|
|
5
|
+
"@angular/common": "^19.2.0",
|
|
6
|
+
"@angular/core": "^19.2.0"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"tslib": "^2.3.0"
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"types": "./index.d.ts",
|
|
20
20
|
"default": "./fesm2022/recursyve-ngx-material-components.mjs"
|
|
21
21
|
},
|
|
22
|
-
"./common": {
|
|
23
|
-
"types": "./common/index.d.ts",
|
|
24
|
-
"default": "./fesm2022/recursyve-ngx-material-components-common.mjs"
|
|
25
|
-
},
|
|
26
22
|
"./chip-list": {
|
|
27
23
|
"types": "./chip-list/index.d.ts",
|
|
28
24
|
"default": "./fesm2022/recursyve-ngx-material-components-chip-list.mjs"
|
|
29
25
|
},
|
|
26
|
+
"./common": {
|
|
27
|
+
"types": "./common/index.d.ts",
|
|
28
|
+
"default": "./fesm2022/recursyve-ngx-material-components-common.mjs"
|
|
29
|
+
},
|
|
30
30
|
"./dropzone": {
|
|
31
31
|
"types": "./dropzone/index.d.ts",
|
|
32
32
|
"default": "./fesm2022/recursyve-ngx-material-components-dropzone.mjs"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ElementRef, OnInit } from "@angular/core";
|
|
2
|
+
import { MatOption } from "@angular/material/core";
|
|
3
|
+
import { Observable } from "rxjs";
|
|
4
|
+
import { NiceTypeaheadBase } from "./typeahead-base";
|
|
5
|
+
import * as i0 from "@angular/core";
|
|
6
|
+
export declare class NiceAsyncTypeahead<T, S extends object = object> extends NiceTypeaheadBase<T> implements OnInit {
|
|
7
|
+
readonly resource: import("@angular/core").InputSignal<string>;
|
|
8
|
+
readonly searchOptions: import("@angular/core").InputSignal<S | null>;
|
|
9
|
+
readonly autoSelectFirstValue: import("@angular/core").InputSignalWithTransform<boolean, unknown>;
|
|
10
|
+
readonly filteredValues: import("@angular/core").Signal<any[]>;
|
|
11
|
+
protected readonly optionsContainer: import("@angular/core").Signal<ElementRef<HTMLElement> | undefined>;
|
|
12
|
+
private readonly service;
|
|
13
|
+
protected _compareWith: (o1: T, o2: T) => boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Infinite scroll internal state
|
|
16
|
+
*/
|
|
17
|
+
private readonly scrollThresholdPercent;
|
|
18
|
+
private lastScrollHeight;
|
|
19
|
+
constructor();
|
|
20
|
+
ngOnInit(): void;
|
|
21
|
+
writeValue(value: T | string | number): void;
|
|
22
|
+
onFocusChanged(isFocused: boolean): void;
|
|
23
|
+
formatLabel(item: T): string;
|
|
24
|
+
removeActiveValue(): void;
|
|
25
|
+
protected _onSelect(option: MatOption): void;
|
|
26
|
+
setSearchOptions(options: S | null): void;
|
|
27
|
+
setActive(active: T | null): void;
|
|
28
|
+
patchSearchOptions(options: S | null): void;
|
|
29
|
+
reload(): Observable<void>;
|
|
30
|
+
reloadActive(): void;
|
|
31
|
+
protected onScroll(event: Event): void;
|
|
32
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NiceAsyncTypeahead<any, any>, never>;
|
|
33
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NiceAsyncTypeahead<any, any>, "nice-async-typeahead", never, { "resource": { "alias": "resource"; "required": true; "isSignal": true; }; "searchOptions": { "alias": "searchOptions"; "required": false; "isSignal": true; }; "autoSelectFirstValue": { "alias": "autoSelectFirstValue"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
export declare class NiceTypeaheadSearchIcon {
|
|
3
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NiceTypeaheadSearchIcon, never>;
|
|
4
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NiceTypeaheadSearchIcon, "nice-typeahead-search-icon", never, {}, {}, never, never, true, never>;
|
|
5
|
+
}
|
package/typeahead/index.d.ts
CHANGED
|
@@ -1,216 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import * as _angular_forms from '@angular/forms';
|
|
6
|
-
import { ControlValueAccessor, FormBuilder, NgControl } from '@angular/forms';
|
|
7
|
-
import { ActiveDescendantKeyManager } from '@angular/cdk/a11y';
|
|
8
|
-
import { SelectionModel } from '@angular/cdk/collections';
|
|
9
|
-
import { CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
|
10
|
-
import { MatFormFieldControl, MatFormField } from '@angular/material/form-field';
|
|
11
|
-
|
|
12
|
-
type NiceAsyncTypeaheadSearchResult<T> = {
|
|
13
|
-
items: T[];
|
|
14
|
-
nextPage: number | null;
|
|
15
|
-
};
|
|
16
|
-
declare abstract class NiceAsyncTypeaheadResourceProvider<T, ID = number, Options = object> {
|
|
17
|
-
abstract resource: string;
|
|
18
|
-
abstract search(searchQuery: string, page: number, options?: Options): Observable<NiceAsyncTypeaheadSearchResult<T>>;
|
|
19
|
-
abstract getById(id: ID, options?: Options): Observable<T>;
|
|
20
|
-
abstract format(item: T): string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
type AsyncTypeaheadRequests = {
|
|
24
|
-
page: number;
|
|
25
|
-
searchQuery?: string;
|
|
26
|
-
onFinish: Subject<void> | null;
|
|
27
|
-
};
|
|
28
|
-
type FetchActiveRequest = {
|
|
29
|
-
id: number | string;
|
|
30
|
-
};
|
|
31
|
-
type NiceTypeaheadInitOptions = {
|
|
32
|
-
autoSelectFirstValue?: boolean;
|
|
33
|
-
searchOptions?: object;
|
|
34
|
-
};
|
|
35
|
-
declare class NiceTypeaheadService<T extends object> {
|
|
36
|
-
private readonly resources;
|
|
37
|
-
private readonly destroyRef;
|
|
38
|
-
private readonly fetchResources$;
|
|
39
|
-
private readonly fetchActive$;
|
|
40
|
-
private resourceProvider;
|
|
41
|
-
private readonly _items;
|
|
42
|
-
private readonly _active;
|
|
43
|
-
private readonly _searchOptions;
|
|
44
|
-
private readonly _request;
|
|
45
|
-
private readonly _nextRequest;
|
|
46
|
-
private readonly _preloaded;
|
|
47
|
-
private readonly _autoSelectFirstValue;
|
|
48
|
-
private readonly _loading;
|
|
49
|
-
readonly items: _angular_core.Signal<T[]>;
|
|
50
|
-
readonly active: _angular_core.Signal<T | null>;
|
|
51
|
-
readonly loading: _angular_core.Signal<boolean>;
|
|
52
|
-
readonly isLastPage: _angular_core.Signal<boolean>;
|
|
53
|
-
init(resource: string, options?: NiceTypeaheadInitOptions): void;
|
|
54
|
-
setSearchOptions(options: object | null): void;
|
|
55
|
-
patchSearchOptions(options: object | null): void;
|
|
56
|
-
setActive(active: T | null): void;
|
|
57
|
-
setActiveFromId(id: number | string): void;
|
|
58
|
-
reload(): Observable<void>;
|
|
59
|
-
reloadActive(): void;
|
|
60
|
-
setItems(items: T[]): void;
|
|
61
|
-
search(searchQuery: string): Observable<void>;
|
|
62
|
-
loadMore(): Observable<void>;
|
|
63
|
-
fetchActive(request: FetchActiveRequest): Observable<void>;
|
|
64
|
-
fetchResources(request: AsyncTypeaheadRequests): Observable<void>;
|
|
65
|
-
formatLabel(item: T): string;
|
|
66
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NiceTypeaheadService<any>, never>;
|
|
67
|
-
static ɵprov: _angular_core.ɵɵInjectableDeclaration<NiceTypeaheadService<any>>;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
declare function provideAsyncTypeaheadResources(providers: Type<NiceAsyncTypeaheadResourceProvider<unknown, unknown>>[]): Provider[];
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Implementation of the same panel and overlay logic as the official Angular MatSelect.
|
|
74
|
-
* This used some of the logic from MatSelect to make this component look and feel like a MatSelect.
|
|
75
|
-
*/
|
|
76
|
-
declare class NiceTypeaheadBase<T> implements MatFormFieldControl<T>, ControlValueAccessor, OnInit, AfterViewInit, DoCheck, OnDestroy {
|
|
77
|
-
private readonly options;
|
|
78
|
-
readonly noItemsFoundLabel: _angular_core.InputSignal<string>;
|
|
79
|
-
readonly labelProperty: _angular_core.InputSignal<string | undefined>;
|
|
80
|
-
readonly formatLabelFn: _angular_core.InputSignal<((value: T) => string) | undefined>;
|
|
81
|
-
readonly optionTemplate: _angular_core.InputSignal<TemplateRef<{
|
|
82
|
-
$implicit: T;
|
|
83
|
-
}> | undefined>;
|
|
84
|
-
readonly panelClass: _angular_core.InputSignal<string | string[]>;
|
|
85
|
-
readonly canRemoveValue: _angular_core.InputSignal<boolean>;
|
|
86
|
-
readonly selected: _angular_core.OutputEmitterRef<T | null>;
|
|
87
|
-
private static nextId;
|
|
88
|
-
protected readonly _input: _angular_core.Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
89
|
-
protected readonly _panel: _angular_core.Signal<ElementRef<HTMLElement> | undefined>;
|
|
90
|
-
protected readonly _overlayDir: _angular_core.Signal<CdkConnectedOverlay | undefined>;
|
|
91
|
-
protected _errorStateTracker?: _ErrorStateTracker;
|
|
92
|
-
protected _required: boolean | null;
|
|
93
|
-
protected _focused: boolean;
|
|
94
|
-
protected _disabled: boolean;
|
|
95
|
-
protected _panelOpen: boolean;
|
|
96
|
-
protected _compareWith: (o1: T, o2: T) => boolean;
|
|
97
|
-
protected readonly _value: _angular_core.WritableSignal<T | null>;
|
|
98
|
-
protected readonly _empty: _angular_core.Signal<boolean>;
|
|
99
|
-
protected readonly _placeholder: _angular_core.WritableSignal<string>;
|
|
100
|
-
protected readonly _searchValue: _angular_core.WritableSignal<string>;
|
|
101
|
-
protected readonly _elementRef: ElementRef<any>;
|
|
102
|
-
protected readonly _destroyRef: DestroyRef;
|
|
103
|
-
protected readonly _changeDetectorRef: ChangeDetectorRef;
|
|
104
|
-
protected readonly _fb: FormBuilder;
|
|
105
|
-
protected readonly _searchControl: _angular_forms.FormControl<string>;
|
|
106
|
-
protected readonly _initialized: Subject<void>;
|
|
107
|
-
protected readonly _parentFormField: MatFormField | null;
|
|
108
|
-
readonly id: string;
|
|
109
|
-
readonly controlType: string;
|
|
110
|
-
readonly stateChanges: Subject<void>;
|
|
111
|
-
readonly optionSelectionChanges: Observable<MatOptionSelectionChange>;
|
|
112
|
-
readonly ngControl: NgControl | null;
|
|
113
|
-
readonly _panelDoneAnimatingStream: Subject<string>;
|
|
114
|
-
_keyManager: ActiveDescendantKeyManager<MatOption>;
|
|
115
|
-
_preferredOverlayOrigin?: CdkOverlayOrigin | ElementRef;
|
|
116
|
-
_overlayWidth: string | number;
|
|
117
|
-
_selectionModel: SelectionModel<MatOption>;
|
|
118
|
-
_onChange?: (value: T | null) => void;
|
|
119
|
-
_onTouched?: () => void;
|
|
120
|
-
get placeholder(): string;
|
|
121
|
-
set placeholder(placeholder: string);
|
|
122
|
-
get focused(): boolean;
|
|
123
|
-
set focused(isFocused: boolean);
|
|
124
|
-
get required(): boolean;
|
|
125
|
-
set required(isRequired: boolean);
|
|
126
|
-
get disabled(): boolean;
|
|
127
|
-
set disabled(value: boolean);
|
|
128
|
-
get value(): T | null;
|
|
129
|
-
set value(value: T | null);
|
|
130
|
-
get empty(): boolean;
|
|
131
|
-
get shouldLabelFloat(): boolean;
|
|
132
|
-
get errorState(): boolean;
|
|
133
|
-
set errorState(value: boolean);
|
|
134
|
-
get panelOpen(): boolean;
|
|
135
|
-
constructor();
|
|
136
|
-
ngOnInit(): void;
|
|
137
|
-
ngAfterViewInit(): void;
|
|
138
|
-
ngDoCheck(): void;
|
|
139
|
-
ngOnDestroy(): void;
|
|
140
|
-
onContainerClick(event: MouseEvent): void;
|
|
141
|
-
setDescribedByIds(ids: string[]): void;
|
|
142
|
-
onFocusChanged(isFocused: boolean): void;
|
|
143
|
-
writeValue(value: T): void;
|
|
144
|
-
registerOnChange(fn: (value: T | null) => void): void;
|
|
145
|
-
registerOnTouched(fn: () => void): void;
|
|
146
|
-
setDisabledState(isDisabled: boolean): void;
|
|
147
|
-
formatLabel(item: T): string;
|
|
148
|
-
removeActiveValue(): void;
|
|
149
|
-
updateErrorState(): void;
|
|
150
|
-
open(): void;
|
|
151
|
-
close(): void;
|
|
152
|
-
focus(options?: FocusOptions): void;
|
|
153
|
-
_handleKeydown(event: KeyboardEvent): void;
|
|
154
|
-
_handleScrollEnd(): void;
|
|
155
|
-
protected _canOpen(): boolean;
|
|
156
|
-
protected _onAttached(): void;
|
|
157
|
-
protected _initKeyManager(): void;
|
|
158
|
-
protected _getOverlayWidth(preferredOrigin?: ElementRef<ElementRef> | CdkOverlayOrigin): string | number;
|
|
159
|
-
protected _skipPredicate: (option: MatOption) => boolean;
|
|
160
|
-
protected _positioningSettled(): void;
|
|
161
|
-
protected _scrollOptionIntoView(index: number): void;
|
|
162
|
-
protected _resetOptions(): void;
|
|
163
|
-
protected _onSelect(option: MatOption): void;
|
|
164
|
-
protected _initializeSelection(): void;
|
|
165
|
-
protected _setSelectionByValue(value: T | null): void;
|
|
166
|
-
protected _selectOptionByValue(value: T): MatOption | undefined;
|
|
167
|
-
protected _highlightCorrectOption(): void;
|
|
168
|
-
protected _handleClosedKeydown(event: KeyboardEvent): void;
|
|
169
|
-
protected _handleOpenKeydown(event: KeyboardEvent): void;
|
|
170
|
-
protected _assignValue(newValue: T | null): boolean;
|
|
171
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NiceTypeaheadBase<any>, never>;
|
|
172
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<NiceTypeaheadBase<any>, never, never, { "noItemsFoundLabel": { "alias": "noItemsFoundLabel"; "required": false; "isSignal": true; }; "labelProperty": { "alias": "labelProperty"; "required": false; "isSignal": true; }; "formatLabelFn": { "alias": "formatLabelFn"; "required": false; "isSignal": true; }; "optionTemplate": { "alias": "optionTemplate"; "required": false; "isSignal": true; }; "panelClass": { "alias": "panelClass"; "required": false; "isSignal": true; }; "canRemoveValue": { "alias": "canRemoveValue"; "required": false; "isSignal": true; }; }, { "selected": "selected"; }, never, never, true, never>;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
declare class NiceAsyncTypeahead<T, S extends object = object> extends NiceTypeaheadBase<T> implements OnInit {
|
|
176
|
-
readonly resource: _angular_core.InputSignal<string>;
|
|
177
|
-
readonly searchOptions: _angular_core.InputSignal<S | null>;
|
|
178
|
-
readonly autoSelectFirstValue: _angular_core.InputSignalWithTransform<boolean, unknown>;
|
|
179
|
-
readonly filteredValues: _angular_core.Signal<any[]>;
|
|
180
|
-
protected readonly optionsContainer: _angular_core.Signal<ElementRef<HTMLElement> | undefined>;
|
|
181
|
-
private readonly service;
|
|
182
|
-
protected _compareWith: (o1: T, o2: T) => boolean;
|
|
183
|
-
/**
|
|
184
|
-
* Infinite scroll internal state
|
|
185
|
-
*/
|
|
186
|
-
private readonly scrollThresholdPercent;
|
|
187
|
-
private lastScrollHeight;
|
|
188
|
-
constructor();
|
|
189
|
-
ngOnInit(): void;
|
|
190
|
-
writeValue(value: T | string | number): void;
|
|
191
|
-
onFocusChanged(isFocused: boolean): void;
|
|
192
|
-
formatLabel(item: T): string;
|
|
193
|
-
removeActiveValue(): void;
|
|
194
|
-
protected _onSelect(option: MatOption): void;
|
|
195
|
-
setSearchOptions(options: S | null): void;
|
|
196
|
-
patchSearchOptions(options: S | null): void;
|
|
197
|
-
reload(): Observable<void>;
|
|
198
|
-
reloadActive(): void;
|
|
199
|
-
protected onScroll(event: Event): void;
|
|
200
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NiceAsyncTypeahead<any, any>, never>;
|
|
201
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NiceAsyncTypeahead<any, any>, "nice-async-typeahead", never, { "resource": { "alias": "resource"; "required": true; "isSignal": true; }; "searchOptions": { "alias": "searchOptions"; "required": false; "isSignal": true; }; "autoSelectFirstValue": { "alias": "autoSelectFirstValue"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
type SearchFunction<T> = (search: string, item: T) => boolean;
|
|
205
|
-
declare class NiceTypeahead<T> extends NiceTypeaheadBase<T> {
|
|
206
|
-
readonly values: _angular_core.InputSignal<T[]>;
|
|
207
|
-
readonly searchFn: _angular_core.InputSignal<SearchFunction<T> | undefined>;
|
|
208
|
-
readonly filteredValues: _angular_core.Signal<T[]>;
|
|
209
|
-
onFocusChanged(isFocused: boolean): void;
|
|
210
|
-
filterValuesFromSearch(searchValue: string, values: T[]): T[];
|
|
211
|
-
static ɵfac: _angular_core.ɵɵFactoryDeclaration<NiceTypeahead<any>, never>;
|
|
212
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<NiceTypeahead<any>, "nice-typeahead", never, { "values": { "alias": "values"; "required": true; "isSignal": true; }; "searchFn": { "alias": "searchFn"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
export { NiceAsyncTypeahead, NiceAsyncTypeaheadResourceProvider, NiceTypeahead, NiceTypeaheadService, provideAsyncTypeaheadResources };
|
|
216
|
-
export type { AsyncTypeaheadRequests, FetchActiveRequest, NiceAsyncTypeaheadSearchResult, NiceTypeaheadInitOptions, SearchFunction };
|
|
1
|
+
export * from "./providers";
|
|
2
|
+
export * from "./provider";
|
|
3
|
+
export * from "./async-typeahead";
|
|
4
|
+
export * from "./typeahead";
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Provider, Type } from "@angular/core";
|
|
2
|
+
import { NiceAsyncTypeaheadResourceProvider } from "./providers/async-typeahead.provider";
|
|
3
|
+
export declare function provideAsyncTypeaheadResources(providers: Type<NiceAsyncTypeaheadResourceProvider<unknown, unknown>>[]): Provider[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Observable } from "rxjs";
|
|
2
|
+
export type NiceAsyncTypeaheadSearchResult<T> = {
|
|
3
|
+
items: T[];
|
|
4
|
+
nextPage: number | null;
|
|
5
|
+
};
|
|
6
|
+
export declare abstract class NiceAsyncTypeaheadResourceProvider<T, ID = number, Options = object> {
|
|
7
|
+
abstract resource: string;
|
|
8
|
+
abstract search(searchQuery: string, page: number, options?: Options): Observable<NiceAsyncTypeaheadSearchResult<T>>;
|
|
9
|
+
abstract getById(id: ID, options?: Options): Observable<T>;
|
|
10
|
+
abstract format(item: T): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Observable, Subject } from "rxjs";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type AsyncTypeaheadRequests = {
|
|
4
|
+
page: number;
|
|
5
|
+
searchQuery?: string;
|
|
6
|
+
onFinish: Subject<void> | null;
|
|
7
|
+
};
|
|
8
|
+
export type FetchActiveRequest = {
|
|
9
|
+
id: number | string;
|
|
10
|
+
};
|
|
11
|
+
export type NiceTypeaheadInitOptions = {
|
|
12
|
+
autoSelectFirstValue?: boolean;
|
|
13
|
+
searchOptions?: object;
|
|
14
|
+
};
|
|
15
|
+
export declare class NiceTypeaheadService<T extends object> {
|
|
16
|
+
private readonly resources;
|
|
17
|
+
private readonly destroyRef;
|
|
18
|
+
private readonly fetchResources$;
|
|
19
|
+
private readonly fetchActive$;
|
|
20
|
+
private resourceProvider;
|
|
21
|
+
private readonly _items;
|
|
22
|
+
private readonly _active;
|
|
23
|
+
private readonly _searchOptions;
|
|
24
|
+
private readonly _request;
|
|
25
|
+
private readonly _nextRequest;
|
|
26
|
+
private readonly _preloaded;
|
|
27
|
+
private readonly _autoSelectFirstValue;
|
|
28
|
+
private readonly _loading;
|
|
29
|
+
readonly items: import("@angular/core").Signal<T[]>;
|
|
30
|
+
readonly active: import("@angular/core").Signal<T | null>;
|
|
31
|
+
readonly loading: import("@angular/core").Signal<boolean>;
|
|
32
|
+
readonly isLastPage: import("@angular/core").Signal<boolean>;
|
|
33
|
+
init(resource: string, options?: NiceTypeaheadInitOptions): void;
|
|
34
|
+
setSearchOptions(options: object | null): void;
|
|
35
|
+
patchSearchOptions(options: object | null): void;
|
|
36
|
+
setActive(active: T | null): void;
|
|
37
|
+
setActiveFromId(id: number | string): void;
|
|
38
|
+
reload(): Observable<void>;
|
|
39
|
+
reloadActive(): void;
|
|
40
|
+
setItems(items: T[]): void;
|
|
41
|
+
search(searchQuery: string): Observable<void>;
|
|
42
|
+
loadMore(): Observable<void>;
|
|
43
|
+
fetchActive(request: FetchActiveRequest): Observable<void>;
|
|
44
|
+
fetchResources(request: AsyncTypeaheadRequests): Observable<void>;
|
|
45
|
+
formatLabel(item: T): string;
|
|
46
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NiceTypeaheadService<any>, never>;
|
|
47
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NiceTypeaheadService<any>>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ActiveDescendantKeyManager } from "@angular/cdk/a11y";
|
|
2
|
+
import { SelectionModel } from "@angular/cdk/collections";
|
|
3
|
+
import { CdkConnectedOverlay, CdkOverlayOrigin } from "@angular/cdk/overlay";
|
|
4
|
+
import { AfterViewInit, ChangeDetectorRef, DestroyRef, DoCheck, ElementRef, OnDestroy, OnInit, TemplateRef } from "@angular/core";
|
|
5
|
+
import { ControlValueAccessor, FormBuilder, NgControl } from "@angular/forms";
|
|
6
|
+
import { _ErrorStateTracker, MatOption, MatOptionSelectionChange } from "@angular/material/core";
|
|
7
|
+
import { MatFormField, MatFormFieldControl } from "@angular/material/form-field";
|
|
8
|
+
import { Observable, Subject } from "rxjs";
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
/**
|
|
11
|
+
* Implementation of the same panel and overlay logic as the official Angular MatSelect.
|
|
12
|
+
* This used some of the logic from MatSelect to make this component look and feel like a MatSelect.
|
|
13
|
+
*/
|
|
14
|
+
export declare class NiceTypeaheadBase<T> implements MatFormFieldControl<T>, ControlValueAccessor, OnInit, AfterViewInit, DoCheck, OnDestroy {
|
|
15
|
+
private readonly options;
|
|
16
|
+
readonly noItemsFoundLabel: import("@angular/core").InputSignal<string>;
|
|
17
|
+
readonly labelProperty: import("@angular/core").InputSignal<string | undefined>;
|
|
18
|
+
readonly formatLabelFn: import("@angular/core").InputSignal<((value: T) => string) | undefined>;
|
|
19
|
+
readonly optionTemplate: import("@angular/core").InputSignal<TemplateRef<{
|
|
20
|
+
$implicit: T;
|
|
21
|
+
}> | undefined>;
|
|
22
|
+
readonly panelClass: import("@angular/core").InputSignal<string | string[]>;
|
|
23
|
+
readonly canRemoveValue: import("@angular/core").InputSignal<boolean>;
|
|
24
|
+
readonly selected: import("@angular/core").OutputEmitterRef<T | null>;
|
|
25
|
+
private static nextId;
|
|
26
|
+
protected readonly _input: import("@angular/core").Signal<ElementRef<HTMLInputElement> | undefined>;
|
|
27
|
+
protected readonly _panel: import("@angular/core").Signal<ElementRef<HTMLElement> | undefined>;
|
|
28
|
+
protected readonly _overlayDir: import("@angular/core").Signal<CdkConnectedOverlay | undefined>;
|
|
29
|
+
protected _errorStateTracker?: _ErrorStateTracker;
|
|
30
|
+
protected _required: boolean | null;
|
|
31
|
+
protected _focused: boolean;
|
|
32
|
+
protected _disabled: boolean;
|
|
33
|
+
protected _panelOpen: boolean;
|
|
34
|
+
protected _compareWith: (o1: T, o2: T) => boolean;
|
|
35
|
+
protected readonly _value: import("@angular/core").WritableSignal<T | null>;
|
|
36
|
+
protected readonly _empty: import("@angular/core").Signal<boolean>;
|
|
37
|
+
protected readonly _placeholder: import("@angular/core").WritableSignal<string>;
|
|
38
|
+
protected readonly _searchValue: import("@angular/core").WritableSignal<string>;
|
|
39
|
+
protected readonly _elementRef: ElementRef<any>;
|
|
40
|
+
protected readonly _destroyRef: DestroyRef;
|
|
41
|
+
protected readonly _changeDetectorRef: ChangeDetectorRef;
|
|
42
|
+
protected readonly _fb: FormBuilder;
|
|
43
|
+
protected readonly _searchControl: import("@angular/forms").FormControl<string>;
|
|
44
|
+
protected readonly _initialized: Subject<void>;
|
|
45
|
+
protected readonly _parentFormField: MatFormField | null;
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly controlType: string;
|
|
48
|
+
readonly stateChanges: Subject<void>;
|
|
49
|
+
readonly optionSelectionChanges: Observable<MatOptionSelectionChange>;
|
|
50
|
+
readonly ngControl: NgControl | null;
|
|
51
|
+
readonly _panelDoneAnimatingStream: Subject<string>;
|
|
52
|
+
_keyManager: ActiveDescendantKeyManager<MatOption>;
|
|
53
|
+
_preferredOverlayOrigin?: CdkOverlayOrigin | ElementRef;
|
|
54
|
+
_overlayWidth: string | number;
|
|
55
|
+
_selectionModel: SelectionModel<MatOption>;
|
|
56
|
+
_onChange?: (value: T | null) => void;
|
|
57
|
+
_onTouched?: () => void;
|
|
58
|
+
get placeholder(): string;
|
|
59
|
+
set placeholder(placeholder: string);
|
|
60
|
+
get focused(): boolean;
|
|
61
|
+
set focused(isFocused: boolean);
|
|
62
|
+
get required(): boolean;
|
|
63
|
+
set required(isRequired: boolean);
|
|
64
|
+
get disabled(): boolean;
|
|
65
|
+
set disabled(value: boolean);
|
|
66
|
+
get value(): T | null;
|
|
67
|
+
set value(value: T | null);
|
|
68
|
+
get empty(): boolean;
|
|
69
|
+
get shouldLabelFloat(): boolean;
|
|
70
|
+
get errorState(): boolean;
|
|
71
|
+
set errorState(value: boolean);
|
|
72
|
+
get panelOpen(): boolean;
|
|
73
|
+
constructor();
|
|
74
|
+
ngOnInit(): void;
|
|
75
|
+
ngAfterViewInit(): void;
|
|
76
|
+
ngDoCheck(): void;
|
|
77
|
+
ngOnDestroy(): void;
|
|
78
|
+
onContainerClick(event: MouseEvent): void;
|
|
79
|
+
setDescribedByIds(ids: string[]): void;
|
|
80
|
+
onFocusChanged(isFocused: boolean): void;
|
|
81
|
+
writeValue(value: T): void;
|
|
82
|
+
registerOnChange(fn: (value: T | null) => void): void;
|
|
83
|
+
registerOnTouched(fn: () => void): void;
|
|
84
|
+
setDisabledState(isDisabled: boolean): void;
|
|
85
|
+
formatLabel(item: T): string;
|
|
86
|
+
removeActiveValue(): void;
|
|
87
|
+
updateErrorState(): void;
|
|
88
|
+
open(): void;
|
|
89
|
+
close(): void;
|
|
90
|
+
focus(options?: FocusOptions): void;
|
|
91
|
+
_handleKeydown(event: KeyboardEvent): void;
|
|
92
|
+
_handleScrollEnd(): void;
|
|
93
|
+
protected _canOpen(): boolean;
|
|
94
|
+
protected _onAttached(): void;
|
|
95
|
+
protected _initKeyManager(): void;
|
|
96
|
+
protected _getOverlayWidth(preferredOrigin?: ElementRef<ElementRef> | CdkOverlayOrigin): string | number;
|
|
97
|
+
protected _skipPredicate: (option: MatOption) => boolean;
|
|
98
|
+
protected _positioningSettled(): void;
|
|
99
|
+
protected _scrollOptionIntoView(index: number): void;
|
|
100
|
+
protected _resetOptions(): void;
|
|
101
|
+
protected _onSelect(option: MatOption): void;
|
|
102
|
+
protected _initializeSelection(): void;
|
|
103
|
+
protected _setSelectionByValue(value: T | null): void;
|
|
104
|
+
protected _selectOptionByValue(value: T): MatOption | undefined;
|
|
105
|
+
protected _highlightCorrectOption(): void;
|
|
106
|
+
protected _handleClosedKeydown(event: KeyboardEvent): void;
|
|
107
|
+
protected _handleOpenKeydown(event: KeyboardEvent): void;
|
|
108
|
+
protected _assignValue(newValue: T | null): boolean;
|
|
109
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NiceTypeaheadBase<any>, never>;
|
|
110
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NiceTypeaheadBase<any>, never, never, { "noItemsFoundLabel": { "alias": "noItemsFoundLabel"; "required": false; "isSignal": true; }; "labelProperty": { "alias": "labelProperty"; "required": false; "isSignal": true; }; "formatLabelFn": { "alias": "formatLabelFn"; "required": false; "isSignal": true; }; "optionTemplate": { "alias": "optionTemplate"; "required": false; "isSignal": true; }; "panelClass": { "alias": "panelClass"; "required": false; "isSignal": true; }; "canRemoveValue": { "alias": "canRemoveValue"; "required": false; "isSignal": true; }; }, { "selected": "selected"; }, never, never, true, never>;
|
|
111
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NiceTypeaheadBase } from "./typeahead-base";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export type SearchFunction<T> = (search: string, item: T) => boolean;
|
|
4
|
+
export declare class NiceTypeahead<T> extends NiceTypeaheadBase<T> {
|
|
5
|
+
readonly values: import("@angular/core").InputSignal<T[]>;
|
|
6
|
+
readonly searchFn: import("@angular/core").InputSignal<SearchFunction<T> | undefined>;
|
|
7
|
+
readonly filteredValues: import("@angular/core").Signal<T[]>;
|
|
8
|
+
onFocusChanged(isFocused: boolean): void;
|
|
9
|
+
filterValuesFromSearch(searchValue: string, values: T[]): T[];
|
|
10
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NiceTypeahead<any>, never>;
|
|
11
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NiceTypeahead<any>, "nice-typeahead", never, { "values": { "alias": "values"; "required": true; "isSignal": true; }; "searchFn": { "alias": "searchFn"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
12
|
+
}
|