@ecodev/natural 61.1.2 → 61.2.0
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/esm2022/lib/classes/abstract-detail.mjs +3 -2
- package/esm2022/lib/modules/fixed-button/fixed-button.component.mjs +2 -2
- package/esm2022/lib/modules/select/abstract-select.component.mjs +5 -5
- package/esm2022/lib/modules/select/select/select.component.mjs +1 -1
- package/esm2022/lib/modules/select/select-enum/select-enum.component.mjs +1 -1
- package/fesm2022/ecodev-natural.mjs +7 -6
- package/fesm2022/ecodev-natural.mjs.map +1 -1
- package/lib/modules/fixed-button/fixed-button.component.d.ts +1 -1
- package/lib/modules/select/abstract-select.component.d.ts +16 -16
- package/lib/modules/select/select/select.component.d.ts +6 -6
- package/lib/modules/select/select-enum/select-enum.component.d.ts +3 -3
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { RouterLink } from '@angular/router';
|
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
export declare class NaturalFixedButtonComponent {
|
|
5
5
|
icon: string;
|
|
6
|
-
link: RouterLink['routerLink'];
|
|
6
|
+
link: RouterLink['routerLink'] | null;
|
|
7
7
|
color: ThemePalette;
|
|
8
8
|
disabled: boolean;
|
|
9
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalFixedButtonComponent, never>;
|
|
@@ -8,12 +8,12 @@ import * as i0 from "@angular/core";
|
|
|
8
8
|
* touched status propagation between outside and inside world, and thus get rid of our legacy
|
|
9
9
|
* custom FormControl class ("NaturalFormControl").
|
|
10
10
|
*/
|
|
11
|
-
declare class ExternalFormControlMatcher<
|
|
11
|
+
declare class ExternalFormControlMatcher<TValue, TInput> extends ErrorStateMatcher {
|
|
12
12
|
private readonly component;
|
|
13
|
-
constructor(component: AbstractSelect<
|
|
13
|
+
constructor(component: AbstractSelect<TValue, TInput>);
|
|
14
14
|
isErrorState(): boolean;
|
|
15
15
|
}
|
|
16
|
-
export declare abstract class AbstractSelect<
|
|
16
|
+
export declare abstract class AbstractSelect<TValue, TInput> implements OnInit, ControlValueAccessor, DoCheck {
|
|
17
17
|
placeholder?: string;
|
|
18
18
|
/**
|
|
19
19
|
* Mat-hint
|
|
@@ -44,11 +44,11 @@ export declare abstract class AbstractSelect<V, I> implements OnInit, ControlVal
|
|
|
44
44
|
/**
|
|
45
45
|
* Function to customize the rendering of the selected item as text in input
|
|
46
46
|
*/
|
|
47
|
-
displayWith?: (item:
|
|
47
|
+
displayWith?: (item: TValue | null) => string;
|
|
48
48
|
/**
|
|
49
49
|
* Emit the selected value whenever it changes
|
|
50
50
|
*/
|
|
51
|
-
readonly selectionChange: EventEmitter<
|
|
51
|
+
readonly selectionChange: EventEmitter<TValue | null>;
|
|
52
52
|
/**
|
|
53
53
|
* Emits when internal input is blurred
|
|
54
54
|
*/
|
|
@@ -56,41 +56,41 @@ export declare abstract class AbstractSelect<V, I> implements OnInit, ControlVal
|
|
|
56
56
|
/**
|
|
57
57
|
* Contains internal representation for current selection AND searched text (for autocomplete)
|
|
58
58
|
*
|
|
59
|
-
* It is **not** necessarily `
|
|
59
|
+
* It is **not** necessarily `TValue | null`.
|
|
60
60
|
*
|
|
61
|
-
* - NaturalSelectComponent: `string |
|
|
62
|
-
* only when `optionRequired` is false, so most of the time it is `
|
|
61
|
+
* - NaturalSelectComponent: `string | TValue | null`. We allow `string`
|
|
62
|
+
* only when `optionRequired` is false, so most of the time it is `TValue | null`.
|
|
63
63
|
* - NaturalSelectHierarchicComponent: `string | null`.
|
|
64
|
-
* - NaturalSelectEnumComponent: `
|
|
64
|
+
* - NaturalSelectEnumComponent: `TValue | null`.
|
|
65
65
|
*
|
|
66
66
|
* In natural-select context, we use pristine and dirty to identify if the displayed value is search or committed model :
|
|
67
67
|
* - Pristine status (unchanged value) means the model is displayed and propagated = the selection is committed
|
|
68
68
|
* - Dirty status (changed value) means we are in search/autocomplete mode
|
|
69
69
|
*/
|
|
70
|
-
readonly internalCtrl: FormControl<
|
|
70
|
+
readonly internalCtrl: FormControl<TInput | null>;
|
|
71
71
|
/**
|
|
72
72
|
* Interface with ControlValueAccessor
|
|
73
73
|
* Notifies parent model / form controller
|
|
74
74
|
*/
|
|
75
|
-
onChange?: (item:
|
|
75
|
+
onChange?: (item: TValue | null) => void;
|
|
76
76
|
/**
|
|
77
77
|
* Interface with ControlValueAccessor
|
|
78
78
|
* Notifies parent model / form controller
|
|
79
79
|
*/
|
|
80
80
|
onTouched?: () => void;
|
|
81
|
-
readonly matcher: ExternalFormControlMatcher<
|
|
81
|
+
readonly matcher: ExternalFormControlMatcher<TValue, TInput>;
|
|
82
82
|
readonly ngControl: NgControl | null;
|
|
83
83
|
constructor();
|
|
84
84
|
ngDoCheck(): void;
|
|
85
|
-
writeValue(value:
|
|
85
|
+
writeValue(value: TInput | null): void;
|
|
86
86
|
ngOnInit(): void;
|
|
87
87
|
/**
|
|
88
88
|
* Whether the value can be changed
|
|
89
89
|
*/
|
|
90
90
|
set disabled(disabled: boolean);
|
|
91
|
-
registerOnChange(fn: (item:
|
|
91
|
+
registerOnChange(fn: (item: TValue | null) => void): void;
|
|
92
92
|
registerOnTouched(fn: () => void): void;
|
|
93
|
-
abstract getDisplayFn(): (item:
|
|
93
|
+
abstract getDisplayFn(): (item: TValue | null) => string;
|
|
94
94
|
/**
|
|
95
95
|
* Commit the model to null
|
|
96
96
|
* Emit and event to update the model
|
|
@@ -103,7 +103,7 @@ export declare abstract class AbstractSelect<V, I> implements OnInit, ControlVal
|
|
|
103
103
|
/**
|
|
104
104
|
* Commit the model change
|
|
105
105
|
*/
|
|
106
|
-
propagateValue(value:
|
|
106
|
+
propagateValue(value: TValue | null): void;
|
|
107
107
|
setDisabledState(isDisabled: boolean): void;
|
|
108
108
|
showClearButton(): boolean;
|
|
109
109
|
touch(): void;
|
|
@@ -8,7 +8,7 @@ import { NaturalAbstractModelService } from '../../../services/abstract-model.se
|
|
|
8
8
|
import { ExtractTallOne, ExtractVall, Literal } from '../../../types/types';
|
|
9
9
|
import { AbstractSelect } from '../abstract-select.component';
|
|
10
10
|
import * as i0 from "@angular/core";
|
|
11
|
-
type
|
|
11
|
+
type ValueTypeFor<TService> = string | ExtractTallOne<TService>;
|
|
12
12
|
/**
|
|
13
13
|
* Default usage:
|
|
14
14
|
* ```html
|
|
@@ -41,7 +41,7 @@ type V<TService> = string | ExtractTallOne<TService>;
|
|
|
41
41
|
* <natural-select [optionRequired]="false" />
|
|
42
42
|
* ```
|
|
43
43
|
*/
|
|
44
|
-
export declare class NaturalSelectComponent<TService extends NaturalAbstractModelService<any, any, PaginatedData<Literal>, QueryVariables, any, any, any, any, any, any>> extends AbstractSelect<
|
|
44
|
+
export declare class NaturalSelectComponent<TService extends NaturalAbstractModelService<any, any, PaginatedData<Literal>, QueryVariables, any, any, any, any, any, any>> extends AbstractSelect<ValueTypeFor<TService>, ValueTypeFor<TService>> implements OnInit, ControlValueAccessor, AfterViewInit {
|
|
45
45
|
private readonly destroyRef;
|
|
46
46
|
autoTrigger: MatAutocompleteTrigger;
|
|
47
47
|
itemTemplate?: TemplateRef<any>;
|
|
@@ -112,20 +112,20 @@ export declare class NaturalSelectComponent<TService extends NaturalAbstractMode
|
|
|
112
112
|
* If we hit ENTER while the input field is empty, we validate the unselection (empty is a valid value)
|
|
113
113
|
*/
|
|
114
114
|
onKeyEnter(): void;
|
|
115
|
-
writeValue(value:
|
|
115
|
+
writeValue(value: ValueTypeFor<TService> | null): void;
|
|
116
116
|
private initService;
|
|
117
117
|
startSearch(): void;
|
|
118
118
|
/**
|
|
119
119
|
* Commit the model change
|
|
120
120
|
* Set internal form as pristine to reflect that the visible value match the model
|
|
121
121
|
*/
|
|
122
|
-
propagateValue(value:
|
|
122
|
+
propagateValue(value: ValueTypeFor<TService> | null): void;
|
|
123
123
|
/**
|
|
124
124
|
* Very important to return something, above all if [select]='displayedValue' attribute value is used
|
|
125
125
|
*/
|
|
126
|
-
getDisplayFn(): (item:
|
|
126
|
+
getDisplayFn(): (item: ValueTypeFor<TService> | null) => string;
|
|
127
127
|
clear(): void;
|
|
128
|
-
search(term:
|
|
128
|
+
search(term: ValueTypeFor<TService> | null): void;
|
|
129
129
|
showClearButton(): boolean;
|
|
130
130
|
private getSearchFilter;
|
|
131
131
|
getVariablesForDebug(): Readonly<QueryVariables> | undefined;
|
|
@@ -4,8 +4,8 @@ import { Observable } from 'rxjs';
|
|
|
4
4
|
import { IEnum } from '../../../services/enum.service';
|
|
5
5
|
import { AbstractSelect } from '../abstract-select.component';
|
|
6
6
|
import * as i0 from "@angular/core";
|
|
7
|
-
type
|
|
8
|
-
export declare class NaturalSelectEnumComponent extends AbstractSelect<
|
|
7
|
+
type Value = IEnum['value'] | IEnum['value'][];
|
|
8
|
+
export declare class NaturalSelectEnumComponent extends AbstractSelect<Value, Value> implements OnInit, ControlValueAccessor {
|
|
9
9
|
private readonly enumService;
|
|
10
10
|
/**
|
|
11
11
|
* The name of the enum type, eg: `"ActionStatus"`
|
|
@@ -25,7 +25,7 @@ export declare class NaturalSelectEnumComponent extends AbstractSelect<V, V> imp
|
|
|
25
25
|
multiple: boolean;
|
|
26
26
|
items?: Observable<IEnum[]>;
|
|
27
27
|
ngOnInit(): void;
|
|
28
|
-
getDisplayFn(): (item:
|
|
28
|
+
getDisplayFn(): (item: Value | null) => string;
|
|
29
29
|
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSelectEnumComponent, never>;
|
|
30
30
|
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSelectEnumComponent, "natural-select-enum", never, { "enumName": { "alias": "enumName"; "required": true; }; "nullLabel": { "alias": "nullLabel"; "required": false; }; "optionDisabled": { "alias": "optionDisabled"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; }, {}, never, never, true, never>;
|
|
31
31
|
}
|