@ecodev/natural 47.2.0 → 47.3.1
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/esm2020/lib/classes/abstract-editable-list.mjs +3 -1
- package/esm2020/lib/modules/dropdown-components/type-natural-select/type-natural-select.component.mjs +1 -1
- package/esm2020/lib/modules/relations/relations.component.mjs +11 -6
- package/esm2020/lib/modules/select/select/select.component.mjs +52 -18
- package/fesm2015/ecodev-natural.mjs +64 -22
- package/fesm2015/ecodev-natural.mjs.map +1 -1
- package/fesm2020/ecodev-natural.mjs +63 -22
- package/fesm2020/ecodev-natural.mjs.map +1 -1
- package/lib/classes/abstract-editable-list.d.ts +2 -0
- package/lib/modules/relations/relations.component.d.ts +9 -10
- package/lib/modules/select/select/select.component.d.ts +27 -10
- package/package.json +1 -1
|
@@ -55,6 +55,8 @@ export declare class NaturalAbstractEditableList<TService extends NaturalAbstrac
|
|
|
55
55
|
* - AbstractModelService.getPartialVariablesForCreation()
|
|
56
56
|
* - AbstractModelService.getPartialVariablesForUpdate()
|
|
57
57
|
* - some other required treatment.
|
|
58
|
+
*
|
|
59
|
+
* TODO return type is incorrect and should be closer to `Partial<T>[]` or an even looser type, because we don't really know what fields exists in the form. When we fix this, we should also remove type coercing in unit tests.
|
|
58
60
|
*/
|
|
59
61
|
getItems(): T[];
|
|
60
62
|
/**
|
|
@@ -7,9 +7,8 @@ import { HierarchicFiltersConfiguration } from '../../modules/hierarchic-selecto
|
|
|
7
7
|
import { LinkableObject, NaturalLinkMutationService } from '../../services/link-mutation.service';
|
|
8
8
|
import { NaturalHierarchicConfiguration } from '../hierarchic-selector/classes/hierarchic-configuration';
|
|
9
9
|
import { NaturalHierarchicSelectorDialogService } from '../hierarchic-selector/hierarchic-selector-dialog/hierarchic-selector-dialog.service';
|
|
10
|
-
import { Filter } from '../search/classes/graphql-doctrine.types';
|
|
11
10
|
import { NaturalAbstractModelService } from '../../services/abstract-model.service';
|
|
12
|
-
import {
|
|
11
|
+
import { ExtractTallOne, ExtractVall } from '../../types/types';
|
|
13
12
|
import * as i0 from "@angular/core";
|
|
14
13
|
/**
|
|
15
14
|
* Custom template usage :
|
|
@@ -19,11 +18,11 @@ import * as i0 from "@angular/core";
|
|
|
19
18
|
* </ng-template>
|
|
20
19
|
* </natural-relations>
|
|
21
20
|
*/
|
|
22
|
-
export declare class NaturalRelationsComponent<TService extends NaturalAbstractModelService<
|
|
21
|
+
export declare class NaturalRelationsComponent<TService extends NaturalAbstractModelService<unknown, any, PaginatedData<LinkableObject>, QueryVariables, unknown, any, unknown, any, unknown, any>> extends NaturalAbstractController implements OnInit, OnChanges, OnDestroy {
|
|
23
22
|
private readonly linkMutationService;
|
|
24
23
|
private readonly hierarchicSelectorDialog;
|
|
25
24
|
private select?;
|
|
26
|
-
itemTemplate?: TemplateRef<
|
|
25
|
+
itemTemplate?: TemplateRef<unknown>;
|
|
27
26
|
service?: TService;
|
|
28
27
|
/**
|
|
29
28
|
* The placeholder used in the button to add a new relation
|
|
@@ -32,11 +31,11 @@ export declare class NaturalRelationsComponent<TService extends NaturalAbstractM
|
|
|
32
31
|
/**
|
|
33
32
|
* Filter for autocomplete selector
|
|
34
33
|
*/
|
|
35
|
-
autocompleteSelectorFilter?:
|
|
34
|
+
autocompleteSelectorFilter?: ExtractVall<TService>['filter'] | null | undefined;
|
|
36
35
|
/**
|
|
37
36
|
* Function to customize the rendering of the selected item as text in input
|
|
38
37
|
*/
|
|
39
|
-
displayWith?: (item:
|
|
38
|
+
displayWith?: (item: ExtractTallOne<TService> | null) => string;
|
|
40
39
|
/**
|
|
41
40
|
* Whether the relations can be changed
|
|
42
41
|
*/
|
|
@@ -65,7 +64,7 @@ export declare class NaturalRelationsComponent<TService extends NaturalAbstractM
|
|
|
65
64
|
/**
|
|
66
65
|
* Listing service instance
|
|
67
66
|
*/
|
|
68
|
-
dataSource?: NaturalDataSource
|
|
67
|
+
dataSource?: NaturalDataSource<PaginatedData<LinkableObject>>;
|
|
69
68
|
loading: boolean;
|
|
70
69
|
/**
|
|
71
70
|
* Table columns
|
|
@@ -88,7 +87,7 @@ export declare class NaturalRelationsComponent<TService extends NaturalAbstractM
|
|
|
88
87
|
* So if the relations are from one action -> to many objectives, then the filter must filter
|
|
89
88
|
* the objectives that have indeed a relation to the particular action.
|
|
90
89
|
*/
|
|
91
|
-
set filter(filter:
|
|
90
|
+
set filter(filter: ExtractVall<TService>['filter']);
|
|
92
91
|
ngOnInit(): void;
|
|
93
92
|
ngOnChanges(): void;
|
|
94
93
|
/**
|
|
@@ -101,9 +100,9 @@ export declare class NaturalRelationsComponent<TService extends NaturalAbstractM
|
|
|
101
100
|
* Refetch result to display it in table
|
|
102
101
|
* TODO : could maybe use "update" attribute of apollo.mutate function to update table faster (but hard to do it here)
|
|
103
102
|
*/
|
|
104
|
-
addRelations(relations: LinkableObject[]): void;
|
|
103
|
+
addRelations(relations: (LinkableObject | ExtractTallOne<TService> | string | null)[]): void;
|
|
105
104
|
pagination(event?: PageEvent): void;
|
|
106
|
-
getDisplayFn(): (item:
|
|
105
|
+
getDisplayFn(): (item: ExtractTallOne<TService> | null) => string;
|
|
107
106
|
openNaturalHierarchicSelector(): void;
|
|
108
107
|
/**
|
|
109
108
|
* Get list from database
|
|
@@ -11,28 +11,40 @@ import * as i0 from "@angular/core";
|
|
|
11
11
|
type V<TService> = string | ExtractTallOne<TService>;
|
|
12
12
|
/**
|
|
13
13
|
* Default usage:
|
|
14
|
-
*
|
|
14
|
+
* ```html
|
|
15
|
+
* <natural-select [service]="myServiceInstance" [(model)]="myModel" (modelChange)=myChangeFn($event)></natural-select>
|
|
16
|
+
* ```
|
|
15
17
|
*
|
|
16
18
|
* Custom template usage :
|
|
19
|
+
* ```html
|
|
17
20
|
* <natural-select [service]="svc" [(ngModel)]="model">
|
|
18
21
|
* <ng-template let-item="item">
|
|
19
22
|
* <span>{{ item.xxx }}</span>
|
|
20
23
|
* </ng-template>
|
|
21
24
|
* </natural-select>
|
|
25
|
+
* ```
|
|
22
26
|
*
|
|
23
|
-
* [(ngModel)] and (ngModelChange) are optional
|
|
27
|
+
* `[(ngModel)]` and `(ngModelChange)` are optional.
|
|
24
28
|
*
|
|
25
29
|
* Placeholder :
|
|
26
|
-
*
|
|
30
|
+
* ```html
|
|
31
|
+
* <natural-select placeholder="my placeholder"></natural-select>
|
|
32
|
+
* ```
|
|
27
33
|
*
|
|
28
34
|
* Never float placeholder :
|
|
29
|
-
*
|
|
35
|
+
* ```html
|
|
36
|
+
* <natural-select placeholder="my placeholder" floatPlaceholder="never"></natural-select>
|
|
37
|
+
* ```
|
|
30
38
|
*
|
|
31
|
-
* Search with like %xxx% on specified
|
|
32
|
-
*
|
|
39
|
+
* Search with like %xxx% on specified field `name` instead of custom filter on whole object
|
|
40
|
+
* ```html
|
|
41
|
+
* <natural-select searchField="name"></natural-select>
|
|
42
|
+
* ```
|
|
33
43
|
*
|
|
34
44
|
* Allows to input free string without selecting an option from autocomplete suggestions
|
|
35
|
-
*
|
|
45
|
+
* ```html
|
|
46
|
+
* <natural-select [optionRequired]="false"></natural-select>
|
|
47
|
+
* ```
|
|
36
48
|
*/
|
|
37
49
|
export declare class NaturalSelectComponent<TService extends NaturalAbstractModelService<any, any, PaginatedData<Literal>, QueryVariables, any, any, any, any, any, any>> extends AbstractSelect<V<TService>, V<TService>> implements OnInit, OnDestroy, ControlValueAccessor, AfterViewInit {
|
|
38
50
|
autoTrigger: MatAutocompleteTrigger;
|
|
@@ -46,9 +58,13 @@ export declare class NaturalSelectComponent<TService extends NaturalAbstractMode
|
|
|
46
58
|
*/
|
|
47
59
|
optionRequired: boolean;
|
|
48
60
|
/**
|
|
49
|
-
* The
|
|
61
|
+
* The field on which to search for, default to 'custom'.
|
|
50
62
|
*/
|
|
51
63
|
searchField: 'custom' | string;
|
|
64
|
+
/**
|
|
65
|
+
* The operator with which to search for, default to 'search' if `searchField` is 'custom', else 'like'.
|
|
66
|
+
*/
|
|
67
|
+
searchOperator: 'search' | string | null;
|
|
52
68
|
/**
|
|
53
69
|
* Additional filter for query
|
|
54
70
|
*/
|
|
@@ -58,7 +74,7 @@ export declare class NaturalSelectComponent<TService extends NaturalAbstractMode
|
|
|
58
74
|
*/
|
|
59
75
|
items: null | Observable<readonly any[]>;
|
|
60
76
|
/**
|
|
61
|
-
* Whether
|
|
77
|
+
* Whether we are searching something
|
|
62
78
|
*/
|
|
63
79
|
loading: boolean;
|
|
64
80
|
/**
|
|
@@ -92,7 +108,8 @@ export declare class NaturalSelectComponent<TService extends NaturalAbstractMode
|
|
|
92
108
|
search(term: V<TService> | null): void;
|
|
93
109
|
showClearButton(): boolean;
|
|
94
110
|
private getSearchFilter;
|
|
111
|
+
getVariablesForDebug(): Readonly<QueryVariables> | undefined;
|
|
95
112
|
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSelectComponent<any>, never>;
|
|
96
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSelectComponent<any>, "natural-select", never, { "service": "service"; "optionRequired": "optionRequired"; "searchField": "searchField"; "filter": "filter"; "disabled": "disabled"; }, {}, ["itemTemplate"], never, false, never>;
|
|
113
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSelectComponent<any>, "natural-select", never, { "service": "service"; "optionRequired": "optionRequired"; "searchField": "searchField"; "searchOperator": "searchOperator"; "filter": "filter"; "disabled": "disabled"; }, {}, ["itemTemplate"], never, false, never>;
|
|
97
114
|
}
|
|
98
115
|
export {};
|