@ecodev/natural 63.9.1 → 64.0.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/fesm2022/ecodev-natural-vanilla.mjs +3 -3
- package/fesm2022/ecodev-natural-vanilla.mjs.map +1 -1
- package/fesm2022/ecodev-natural.mjs +520 -650
- package/fesm2022/ecodev-natural.mjs.map +1 -1
- package/index.d.ts +4264 -3
- package/package.json +9 -9
- package/src/lib/modules/sidenav/_sidenav.theme.scss +1 -1
- package/vanilla/index.d.ts +418 -3
- package/lib/classes/abstract-detail.d.ts +0 -108
- package/lib/classes/abstract-editable-list.d.ts +0 -70
- package/lib/classes/abstract-list.d.ts +0 -191
- package/lib/classes/abstract-navigable-list.d.ts +0 -54
- package/lib/classes/apollo-utils.d.ts +0 -18
- package/lib/classes/crypto.d.ts +0 -8
- package/lib/classes/cumulative-changes.d.ts +0 -27
- package/lib/classes/data-source.d.ts +0 -32
- package/lib/classes/network-activity.service.d.ts +0 -54
- package/lib/classes/providers.d.ts +0 -5
- package/lib/classes/query-variable-manager-utils.d.ts +0 -2
- package/lib/classes/query-variable-manager.d.ts +0 -91
- package/lib/classes/rxjs.d.ts +0 -42
- package/lib/classes/signing.d.ts +0 -7
- package/lib/classes/tld.d.ts +0 -10
- package/lib/classes/utility.d.ts +0 -85
- package/lib/classes/validators.d.ts +0 -72
- package/lib/directives/http-prefix.directive.d.ts +0 -15
- package/lib/modules/alert/alert.service.d.ts +0 -21
- package/lib/modules/alert/confirm.component.d.ts +0 -12
- package/lib/modules/alert/public-api.d.ts +0 -2
- package/lib/modules/avatar/component/avatar.component.d.ts +0 -37
- package/lib/modules/avatar/public-api.d.ts +0 -2
- package/lib/modules/avatar/service/avatar.service.d.ts +0 -24
- package/lib/modules/avatar/sources/gravatar.d.ts +0 -8
- package/lib/modules/avatar/sources/image.d.ts +0 -8
- package/lib/modules/avatar/sources/initials.d.ts +0 -8
- package/lib/modules/avatar/sources/source.d.ts +0 -23
- package/lib/modules/columns-picker/columns-picker.component.d.ts +0 -45
- package/lib/modules/columns-picker/public-api.d.ts +0 -2
- package/lib/modules/columns-picker/types.d.ts +0 -84
- package/lib/modules/common/directives/background-density.directive.d.ts +0 -37
- package/lib/modules/common/directives/linkable-tab.directive.d.ts +0 -29
- package/lib/modules/common/directives/src-density.directive.d.ts +0 -33
- package/lib/modules/common/pipes/capitalize.pipe.d.ts +0 -10
- package/lib/modules/common/pipes/ellipsis.pipe.d.ts +0 -7
- package/lib/modules/common/pipes/enum.pipe.d.ts +0 -14
- package/lib/modules/common/pipes/time-ago.pipe.d.ts +0 -18
- package/lib/modules/common/public-api.d.ts +0 -11
- package/lib/modules/common/services/memory-storage.d.ts +0 -46
- package/lib/modules/common/services/seo.provider.d.ts +0 -6
- package/lib/modules/common/services/seo.service.d.ts +0 -148
- package/lib/modules/detail-header/detail-header.component.d.ts +0 -43
- package/lib/modules/detail-header/public-api.d.ts +0 -1
- package/lib/modules/dialog-trigger/dialog-trigger.component.d.ts +0 -37
- package/lib/modules/dialog-trigger/public-api.d.ts +0 -1
- package/lib/modules/dropdown-components/abstract-association-select-component.directive.d.ts +0 -34
- package/lib/modules/dropdown-components/public-api.d.ts +0 -10
- package/lib/modules/dropdown-components/type-boolean/type-boolean.component.d.ts +0 -12
- package/lib/modules/dropdown-components/type-date/type-date.component.d.ts +0 -36
- package/lib/modules/dropdown-components/type-date-range/type-date-range.component.d.ts +0 -43
- package/lib/modules/dropdown-components/type-hierarchic-selector/type-hierarchic-selector.component.d.ts +0 -31
- package/lib/modules/dropdown-components/type-natural-select/type-natural-select.component.d.ts +0 -18
- package/lib/modules/dropdown-components/type-number/type-number.component.d.ts +0 -36
- package/lib/modules/dropdown-components/type-options/type-options.component.d.ts +0 -29
- package/lib/modules/dropdown-components/type-select/type-select.component.d.ts +0 -59
- package/lib/modules/dropdown-components/type-text/type-text.component.d.ts +0 -26
- package/lib/modules/dropdown-components/types.d.ts +0 -13
- package/lib/modules/dropdown-components/utils.d.ts +0 -14
- package/lib/modules/file/abstract-file.d.ts +0 -95
- package/lib/modules/file/component/file.component.d.ts +0 -58
- package/lib/modules/file/file-drop.directive.d.ts +0 -32
- package/lib/modules/file/file-select.directive.d.ts +0 -15
- package/lib/modules/file/file.service.d.ts +0 -19
- package/lib/modules/file/public-api.d.ts +0 -6
- package/lib/modules/file/types.d.ts +0 -7
- package/lib/modules/file/utils.d.ts +0 -8
- package/lib/modules/fixed-button/fixed-button.component.d.ts +0 -11
- package/lib/modules/fixed-button/public-api.d.ts +0 -1
- package/lib/modules/fixed-button-detail/fixed-button-detail.component.d.ts +0 -24
- package/lib/modules/fixed-button-detail/public-api.d.ts +0 -1
- package/lib/modules/hierarchic-selector/classes/flat-node.d.ts +0 -11
- package/lib/modules/hierarchic-selector/classes/hierarchic-configuration.d.ts +0 -56
- package/lib/modules/hierarchic-selector/classes/hierarchic-filters-configuration.d.ts +0 -7
- package/lib/modules/hierarchic-selector/classes/model-node.d.ts +0 -13
- package/lib/modules/hierarchic-selector/hierarchic-selector/hierarchic-selector.component.d.ts +0 -161
- package/lib/modules/hierarchic-selector/hierarchic-selector/hierarchic-selector.service.d.ts +0 -76
- package/lib/modules/hierarchic-selector/hierarchic-selector-dialog/hierarchic-selector-dialog.component.d.ts +0 -59
- package/lib/modules/hierarchic-selector/hierarchic-selector-dialog/hierarchic-selector-dialog.service.d.ts +0 -9
- package/lib/modules/hierarchic-selector/public-api.d.ts +0 -6
- package/lib/modules/icon/icon.directive.d.ts +0 -39
- package/lib/modules/icon/icon.module.d.ts +0 -9
- package/lib/modules/icon/public-api.d.ts +0 -2
- package/lib/modules/logger/error-handler.d.ts +0 -52
- package/lib/modules/logger/error.module.d.ts +0 -3
- package/lib/modules/logger/public-api.d.ts +0 -3
- package/lib/modules/matomo/matomo.service.d.ts +0 -42
- package/lib/modules/matomo/public-api.d.ts +0 -1
- package/lib/modules/panels/abstract-panel.d.ts +0 -37
- package/lib/modules/panels/fallback-if-no-opened-panels.urlmatcher.d.ts +0 -6
- package/lib/modules/panels/panels.component.d.ts +0 -9
- package/lib/modules/panels/panels.module.d.ts +0 -3
- package/lib/modules/panels/panels.service.d.ts +0 -121
- package/lib/modules/panels/panels.urlmatcher.d.ts +0 -8
- package/lib/modules/panels/public-api.d.ts +0 -7
- package/lib/modules/panels/types.d.ts +0 -61
- package/lib/modules/relations/public-api.d.ts +0 -1
- package/lib/modules/relations/relations.component.d.ts +0 -123
- package/lib/modules/search/classes/graphql-doctrine.d.ts +0 -4
- package/lib/modules/search/classes/graphql-doctrine.types.d.ts +0 -83
- package/lib/modules/search/classes/transformers.d.ts +0 -78
- package/lib/modules/search/classes/url.d.ts +0 -18
- package/lib/modules/search/classes/utils.d.ts +0 -17
- package/lib/modules/search/dropdown-container/dropdown-container.component.d.ts +0 -31
- package/lib/modules/search/dropdown-container/dropdown-ref.d.ts +0 -13
- package/lib/modules/search/dropdown-container/dropdown.service.d.ts +0 -24
- package/lib/modules/search/facet-selector/facet-selector.component.d.ts +0 -32
- package/lib/modules/search/group/group.component.d.ts +0 -21
- package/lib/modules/search/input/input.component.d.ts +0 -110
- package/lib/modules/search/public-api.d.ts +0 -11
- package/lib/modules/search/search/search.component.d.ts +0 -44
- package/lib/modules/search/types/dropdown-component.d.ts +0 -20
- package/lib/modules/search/types/facet.d.ts +0 -75
- package/lib/modules/search/types/values.d.ts +0 -32
- package/lib/modules/select/abstract-select.component.d.ts +0 -127
- package/lib/modules/select/public-api.d.ts +0 -3
- package/lib/modules/select/select/select.component.d.ts +0 -135
- package/lib/modules/select/select-enum/select-enum.component.d.ts +0 -32
- package/lib/modules/select/select-hierarchic/select-hierarchic.component.d.ts +0 -65
- package/lib/modules/sidenav/public-api.d.ts +0 -5
- package/lib/modules/sidenav/sidenav/sidenav.component.d.ts +0 -5
- package/lib/modules/sidenav/sidenav-container/sidenav-container.component.d.ts +0 -45
- package/lib/modules/sidenav/sidenav-content/sidenav-content.component.d.ts +0 -5
- package/lib/modules/sidenav/sidenav-stack.service.d.ts +0 -28
- package/lib/modules/sidenav/sidenav.service.d.ts +0 -86
- package/lib/modules/stamp/public-api.d.ts +0 -1
- package/lib/modules/stamp/stamp.component.d.ts +0 -15
- package/lib/modules/table-button/public-api.d.ts +0 -1
- package/lib/modules/table-button/table-button.component.d.ts +0 -32
- package/lib/services/abstract-model.service.d.ts +0 -244
- package/lib/services/debounce.service.d.ts +0 -52
- package/lib/services/enum.service.d.ts +0 -19
- package/lib/services/link-mutation.service.d.ts +0 -51
- package/lib/services/persistence.service.d.ts +0 -50
- package/lib/services/swiss-parsing-date-adapter.service.d.ts +0 -16
- package/lib/types/types.d.ts +0 -100
- package/public-api.d.ts +0 -44
- package/vanilla/public-api.d.ts +0 -11
- package/vanilla/src/lib/classes/crypto.d.ts +0 -8
- package/vanilla/src/lib/classes/data-source.d.ts +0 -32
- package/vanilla/src/lib/classes/query-variable-manager-utils.d.ts +0 -2
- package/vanilla/src/lib/classes/query-variable-manager.d.ts +0 -91
- package/vanilla/src/lib/classes/signing.d.ts +0 -7
- package/vanilla/src/lib/classes/utility.d.ts +0 -85
- package/vanilla/src/lib/modules/search/classes/graphql-doctrine.types.d.ts +0 -83
- package/vanilla/src/lib/modules/search/classes/utils.d.ts +0 -17
- package/vanilla/src/lib/modules/search/types/dropdown-component.d.ts +0 -20
- package/vanilla/src/lib/modules/search/types/facet.d.ts +0 -75
- package/vanilla/src/lib/modules/search/types/values.d.ts +0 -32
- package/vanilla/src/lib/services/abstract-model.service.d.ts +0 -244
- package/vanilla/src/lib/services/debounce.service.d.ts +0 -52
- package/vanilla/src/lib/types/types.d.ts +0 -100
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4266 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Injector, InjectionToken, DestroyRef, OnInit, Type, OnChanges, SimpleChanges, AfterViewInit, PipeTransform, Provider, EnvironmentProviders, OnDestroy, EmbeddedViewRef, ComponentRef, StaticProvider, TemplateRef, DoCheck, ErrorHandler, ApplicationConfig } from '@angular/core';
|
|
3
|
+
import { ValidatorFn, AsyncValidatorFn, AbstractControl, UntypedFormGroup, UntypedFormArray, ValidationErrors, FormControl, FormGroup, FormGroupDirective, NgForm, ControlValueAccessor, NgControl } from '@angular/forms';
|
|
4
|
+
import * as _angular_router from '@angular/router';
|
|
5
|
+
import { ActivatedRoute, ResolveData, UrlSegment, Router, NavigationExtras, RouterLink, Data as Data$1, NavigationEnd, UrlMatcher, Params, QueryParamsHandling, UrlTree } from '@angular/router';
|
|
6
|
+
import { MatSnackBarRef, SimpleSnackBar } from '@angular/material/snack-bar';
|
|
7
|
+
import * as rxjs from 'rxjs';
|
|
8
|
+
import { Observable, Subject, BehaviorSubject, OperatorFunction, ObservedValueOf, MonoTypeOperatorFunction } from 'rxjs';
|
|
9
|
+
import { ComponentType, BasePortalOutlet, CdkPortalOutlet, TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
|
|
10
|
+
import { DataSource, SelectionModel } from '@angular/cdk/collections';
|
|
11
|
+
import { Apollo, MutationResult } from 'apollo-angular';
|
|
12
|
+
import { WatchQueryFetchPolicy, FetchResult, ApolloLink } from '@apollo/client/core';
|
|
13
|
+
import { DocumentNode, GraphQLFormattedError } from 'graphql';
|
|
14
|
+
import * as _angular_material_paginator from '@angular/material/paginator';
|
|
15
|
+
import { PageEvent } from '@angular/material/paginator';
|
|
16
|
+
import { MatTableDataSource } from '@angular/material/table';
|
|
17
|
+
import { Sort } from '@angular/material/sort';
|
|
18
|
+
import { HttpLink, HttpBatchLink, Options } from 'apollo-angular/http';
|
|
19
|
+
import { ReadonlyDeep } from 'type-fest';
|
|
20
|
+
import { HttpInterceptorFn } from '@angular/common/http';
|
|
21
|
+
import { NativeDateAdapter, ThemePalette, ErrorStateMatcher } from '@angular/material/core';
|
|
22
|
+
import { MatSelectionList } from '@angular/material/list';
|
|
23
|
+
import { FlatTreeControl } from '@angular/cdk/tree';
|
|
24
|
+
import { MatTreeFlattener, MatTreeFlatDataSource } from '@angular/material/tree';
|
|
25
|
+
import { MatDialogConfig, MatDialogRef } from '@angular/material/dialog';
|
|
26
|
+
import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
|
|
27
|
+
import { MatSidenav, MatDrawerMode } from '@angular/material/sidenav';
|
|
28
|
+
import { MatButtonAppearance } from '@angular/material/button';
|
|
29
|
+
|
|
30
|
+
declare class NaturalAlertService {
|
|
31
|
+
private readonly dialog;
|
|
32
|
+
private readonly snackBar;
|
|
33
|
+
/**
|
|
34
|
+
* Show an informative message in a snack bar
|
|
35
|
+
*/
|
|
36
|
+
info(message: string, duration?: number | null): MatSnackBarRef<SimpleSnackBar>;
|
|
37
|
+
/**
|
|
38
|
+
* Show an error in a snack bar
|
|
39
|
+
*/
|
|
40
|
+
error(message: string, duration?: number | null, action?: string): MatSnackBarRef<SimpleSnackBar>;
|
|
41
|
+
/**
|
|
42
|
+
* Show a simple confirmation dialog and returns true if user confirmed it
|
|
43
|
+
*/
|
|
44
|
+
confirm(title: string, message: string, confirmText: string, cancelText?: string): Observable<boolean | undefined>;
|
|
45
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalAlertService, never>;
|
|
46
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalAlertService>;
|
|
47
|
+
}
|
|
48
|
+
|
|
1
49
|
/**
|
|
2
|
-
*
|
|
50
|
+
* TODO: implement route update when closing dialog with escape
|
|
51
|
+
* @dynamic
|
|
3
52
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
53
|
+
declare class NaturalPanelsService {
|
|
54
|
+
private readonly router;
|
|
55
|
+
private readonly dialog;
|
|
56
|
+
private readonly injector;
|
|
57
|
+
private hooksConfig;
|
|
58
|
+
private readonly panelWidth;
|
|
59
|
+
/**
|
|
60
|
+
* Because of this static property Panels are **not** compatible with SSR.
|
|
61
|
+
* And we cannot make it non-static, because `UrlMatcher` cannot be injected.
|
|
62
|
+
*/
|
|
63
|
+
private static _opened;
|
|
64
|
+
static get opened(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Stream that emits when all open dialog have finished closing
|
|
67
|
+
*/
|
|
68
|
+
readonly afterAllClosed: Subject<void>;
|
|
69
|
+
/**
|
|
70
|
+
* Cache for panels counter. Works more like an ID.
|
|
71
|
+
* Is used to give an unique identifier to multiple similar panels configurations
|
|
72
|
+
*/
|
|
73
|
+
private counter;
|
|
74
|
+
/**
|
|
75
|
+
* Class applied to dialog overlay related with panels
|
|
76
|
+
* If change, change CSS too
|
|
77
|
+
*/
|
|
78
|
+
private panelClass;
|
|
79
|
+
/**
|
|
80
|
+
* Cache for panels setup before navigation change.
|
|
81
|
+
* Used to detect panels openings/closings and adapt for new configuration
|
|
82
|
+
*/
|
|
83
|
+
private oldFullConfig;
|
|
84
|
+
/**
|
|
85
|
+
* Cache for subscription stop
|
|
86
|
+
*/
|
|
87
|
+
private routeSub?;
|
|
88
|
+
/**
|
|
89
|
+
* Cache for subscription stop
|
|
90
|
+
*/
|
|
91
|
+
private navSub?;
|
|
92
|
+
/**
|
|
93
|
+
* Horizontal gaps between panels
|
|
94
|
+
*/
|
|
95
|
+
private panelsOffsetH;
|
|
96
|
+
/**
|
|
97
|
+
* Vertical gaps between panels
|
|
98
|
+
*/
|
|
99
|
+
private panelsOffsetV;
|
|
100
|
+
/**
|
|
101
|
+
* Cache of previous screen size
|
|
102
|
+
* Used to change panels stack orientation on small screens
|
|
103
|
+
*/
|
|
104
|
+
private isVertical;
|
|
105
|
+
constructor();
|
|
106
|
+
/**
|
|
107
|
+
* Notify the service to start listening to route changes to open panels
|
|
108
|
+
*
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
start(route: ActivatedRoute): void;
|
|
112
|
+
/**
|
|
113
|
+
* Uses given configuration to add at the end of current url
|
|
114
|
+
*/
|
|
115
|
+
private appendConfigToCurrentUrl;
|
|
116
|
+
/**
|
|
117
|
+
* Notify the service that all panels were closed
|
|
118
|
+
*
|
|
119
|
+
* @internal
|
|
120
|
+
*/
|
|
121
|
+
stop(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Go to panel matching given component. Causes an url change.
|
|
124
|
+
*
|
|
125
|
+
* @internal
|
|
126
|
+
*/
|
|
127
|
+
goToPanelByComponent(component: NaturalAbstractPanel): void;
|
|
128
|
+
/**
|
|
129
|
+
* Go to panel matching given component. Causes an url change.
|
|
130
|
+
*/
|
|
131
|
+
goToPenultimatePanel(): void;
|
|
132
|
+
/**
|
|
133
|
+
* Calls the new url that only includes the segments from the panels we want to stay open
|
|
134
|
+
*/
|
|
135
|
+
private goToPanelByIndex;
|
|
136
|
+
/**
|
|
137
|
+
* Selecting a panel is equivalent to close all those that are in front of him
|
|
138
|
+
* @param index of panel in stack. The most behind (the first one) is 0.
|
|
139
|
+
*/
|
|
140
|
+
private selectPanelByIndex;
|
|
141
|
+
/**
|
|
142
|
+
* Open new panels if url has changed with new segments
|
|
143
|
+
*/
|
|
144
|
+
private updatePanels;
|
|
145
|
+
/**
|
|
146
|
+
* Resolve all services, then open panels
|
|
147
|
+
*/
|
|
148
|
+
private openPanels;
|
|
149
|
+
private getResolvedData;
|
|
150
|
+
private openPanel;
|
|
151
|
+
/**
|
|
152
|
+
* Return panel position (index) by searching matching component
|
|
153
|
+
*/
|
|
154
|
+
private getPanelIndex;
|
|
155
|
+
/**
|
|
156
|
+
* Whether the given panel is currently the top, visible, panel. If there are no panels opened at all, then any panel given is considered top, visible, panel.
|
|
157
|
+
*/
|
|
158
|
+
isTopPanel(component: NaturalAbstractPanel): boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Repositions panels from start until given index
|
|
161
|
+
*/
|
|
162
|
+
private updateComponentsPosition;
|
|
163
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalPanelsService, never>;
|
|
164
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalPanelsService>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
type PaginatedData<T> = {
|
|
168
|
+
readonly items: readonly T[];
|
|
169
|
+
readonly offset?: number | null;
|
|
170
|
+
readonly pageSize: number;
|
|
171
|
+
readonly pageIndex: number;
|
|
172
|
+
readonly length: number;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* A NaturalDataSource will connect immediately, in order to know as soon as possible if
|
|
176
|
+
* we need to show a template at all (as seen in my-ichtus)
|
|
177
|
+
*
|
|
178
|
+
* It also allow some extra data manipulation
|
|
179
|
+
*/
|
|
180
|
+
declare class NaturalDataSource<T extends PaginatedData<Literal> = PaginatedData<Literal>> extends DataSource<T['items'][0]> {
|
|
181
|
+
private readonly ngUnsubscribe;
|
|
182
|
+
private readonly internalData;
|
|
183
|
+
constructor(value: Observable<T> | T);
|
|
184
|
+
get internalDataObservable(): Observable<T | null>;
|
|
185
|
+
/**
|
|
186
|
+
* Array of data that should be rendered by the table, where each object represents one row.
|
|
187
|
+
*/
|
|
188
|
+
get data(): T | null;
|
|
189
|
+
set data(data: T | null);
|
|
190
|
+
connect(): Observable<T['items']>;
|
|
191
|
+
disconnect(): void;
|
|
192
|
+
push(item: T['items'][0]): void;
|
|
193
|
+
pop(): T['items'][0] | undefined;
|
|
194
|
+
remove(item: T['items'][0]): void;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
type QueryVariables = {
|
|
198
|
+
filter?: any | null;
|
|
199
|
+
pagination?: PaginationInput | null;
|
|
200
|
+
sorting?: Sorting[] | null;
|
|
201
|
+
};
|
|
202
|
+
type PaginationInput = {
|
|
203
|
+
offset?: number | null;
|
|
204
|
+
pageIndex?: number | null;
|
|
205
|
+
pageSize?: number | null;
|
|
206
|
+
};
|
|
207
|
+
type Sorting = {
|
|
208
|
+
field: any;
|
|
209
|
+
order?: SortingOrder | null;
|
|
210
|
+
nullAsHighest?: boolean | null;
|
|
211
|
+
emptyStringAsHighest?: boolean | null;
|
|
212
|
+
};
|
|
213
|
+
declare enum SortingOrder {
|
|
214
|
+
ASC = "ASC",
|
|
215
|
+
DESC = "DESC"
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Filter manager stores a set of channels that contain a variable object and exposes an observable "variables" that updates with the result
|
|
219
|
+
* of all channels merged together.
|
|
220
|
+
*
|
|
221
|
+
* A channel is supposed to be used by a given aspect of the GUI (pagination, sorting, search, others ?).
|
|
222
|
+
*
|
|
223
|
+
* ```ts
|
|
224
|
+
* const fm = new QueryVariablesManager();
|
|
225
|
+
* fm.merge('componentA-variables', {a : [1, 2, 3]});
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* Variables attributes is a BehaviorSubject. That mean it's not mandatory to subscribe, we can just call getValue or value attributes on
|
|
229
|
+
* it :
|
|
230
|
+
*
|
|
231
|
+
* ```ts
|
|
232
|
+
* console.log(fm.variables.value); // {a : [1, 2, 3]}
|
|
233
|
+
* ```
|
|
234
|
+
*
|
|
235
|
+
* Set new variables for 'componentA-variables':
|
|
236
|
+
*
|
|
237
|
+
* ```ts
|
|
238
|
+
* fm.merge('componentA-variables', {a : [1, 2]});
|
|
239
|
+
* console.log(fm.variables.value); // {a : [1, 2, 3]}
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* Set new variables for new channel:
|
|
243
|
+
*
|
|
244
|
+
* ```ts
|
|
245
|
+
* fm.merge('componentB-variables', {a : [3, 4]});
|
|
246
|
+
* console.log(fm.variables.value); // {a : [1, 2, 3, 4]}
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
declare class NaturalQueryVariablesManager<T extends QueryVariables = QueryVariables> {
|
|
250
|
+
readonly variables: BehaviorSubject<T | undefined>;
|
|
251
|
+
private readonly channels;
|
|
252
|
+
constructor(queryVariablesManager?: NaturalQueryVariablesManager<T>);
|
|
253
|
+
/**
|
|
254
|
+
* Set or override all the variables that may exist in the given channel
|
|
255
|
+
*/
|
|
256
|
+
set(channelName: string, variables: Partial<T> | null | undefined): void;
|
|
257
|
+
/**
|
|
258
|
+
* Return a deep clone of the variables for the given channel name.
|
|
259
|
+
*
|
|
260
|
+
* Avoid returning the same reference to prevent an attribute change, then another channel update that would
|
|
261
|
+
* used this changed attribute without having explicitly asked QueryVariablesManager to update it.
|
|
262
|
+
*/
|
|
263
|
+
get(channelName: string): Partial<T> | undefined;
|
|
264
|
+
/**
|
|
265
|
+
* Merge variable into a channel, overriding arrays in same channel / key
|
|
266
|
+
*/
|
|
267
|
+
merge(channelName: string, newVariables: Partial<T>): void;
|
|
268
|
+
/**
|
|
269
|
+
* Apply default values to a channel
|
|
270
|
+
* Note : lodash defaults only defines values on destinations keys that are undefined
|
|
271
|
+
*/
|
|
272
|
+
defaults(channelName: string, newVariables: Partial<T>): void;
|
|
273
|
+
private getChannelsCopy;
|
|
274
|
+
/**
|
|
275
|
+
* Merge channels in a single object
|
|
276
|
+
* Arrays are concatenated
|
|
277
|
+
* Filter groups are combined smartly (see mergeGroupList)
|
|
278
|
+
*/
|
|
279
|
+
private updateVariables;
|
|
280
|
+
/**
|
|
281
|
+
* Cross merge two filters
|
|
282
|
+
* Only accepts groups with same groupLogic (ignores the first one, because there is no groupLogic in this one)
|
|
283
|
+
* @throws In case two non-empty lists of groups are given and at one of them mix groupLogic value, throws an error
|
|
284
|
+
*/
|
|
285
|
+
private mergeGroupList;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Debounce subscriptions to update mutations, with the possibility to cancel one, flush one, or flush all of them.
|
|
290
|
+
*
|
|
291
|
+
* `modelService` is also used to separate objects by their types. So User with ID 1 is not confused with Product with ID 1.
|
|
292
|
+
*
|
|
293
|
+
* `id` must be the ID of the object that will be updated.
|
|
294
|
+
*/
|
|
295
|
+
declare class NaturalDebounceService {
|
|
296
|
+
/**
|
|
297
|
+
* Stores the debounced update function
|
|
298
|
+
*/
|
|
299
|
+
private readonly allDebouncedUpdateCache;
|
|
300
|
+
/**
|
|
301
|
+
* Debounce the `modelService.updateNow()` mutation for a short time. If called multiple times with the same
|
|
302
|
+
* modelService and id, it will postpone the subscription to the mutation.
|
|
303
|
+
*
|
|
304
|
+
* All input variables for the same object (same service and ID) will be cumulated over time. So it is possible
|
|
305
|
+
* to update `field1`, then `field2`, and they will be batched into a single XHR including `field1` and `field2`.
|
|
306
|
+
*
|
|
307
|
+
* But it will always keep the same debouncing timeline.
|
|
308
|
+
*/
|
|
309
|
+
debounce<T extends UntypedModelService>(modelService: UntypedModelService, id: string, object: Parameters<T['updateNow']>[0]): ReturnType<T['updateNow']>;
|
|
310
|
+
cancelOne(modelService: UntypedModelService, id: string): void;
|
|
311
|
+
/**
|
|
312
|
+
* Immediately execute the pending update, if any.
|
|
313
|
+
*
|
|
314
|
+
* It should typically be called before resolving the object, to mutate it before re-fetching it from server.
|
|
315
|
+
*
|
|
316
|
+
* The returned observable will complete when the update completes, even if it errors.
|
|
317
|
+
*/
|
|
318
|
+
flushOne(modelService: UntypedModelService, id: string): Observable<void>;
|
|
319
|
+
/**
|
|
320
|
+
* Immediately execute all pending updates.
|
|
321
|
+
*
|
|
322
|
+
* It should typically be called before login out.
|
|
323
|
+
*
|
|
324
|
+
* The returned observable will complete when all updates complete, even if some of them error.
|
|
325
|
+
*/
|
|
326
|
+
flush(): Observable<void>;
|
|
327
|
+
private internalFlush;
|
|
328
|
+
/**
|
|
329
|
+
* Count of pending updates
|
|
330
|
+
*/
|
|
331
|
+
get count(): number;
|
|
332
|
+
private getMap;
|
|
333
|
+
private delete;
|
|
334
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalDebounceService, never>;
|
|
335
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalDebounceService>;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
type FormValidators = Record<string, ValidatorFn[]>;
|
|
339
|
+
type FormAsyncValidators = Record<string, AsyncValidatorFn[]>;
|
|
340
|
+
type VariablesWithInput = {
|
|
341
|
+
input: Literal;
|
|
342
|
+
};
|
|
343
|
+
type FormControls = Record<string, AbstractControl>;
|
|
344
|
+
type WithId<T> = {
|
|
345
|
+
id: string;
|
|
346
|
+
} & T;
|
|
347
|
+
declare abstract class NaturalAbstractModelService<Tone, Vone extends {
|
|
348
|
+
id: string;
|
|
349
|
+
}, Tall extends PaginatedData<Literal>, Vall extends QueryVariables, Tcreate, Vcreate extends VariablesWithInput, Tupdate, Vupdate extends {
|
|
350
|
+
id: string;
|
|
351
|
+
input: Literal;
|
|
352
|
+
}, Tdelete, Vdelete extends {
|
|
353
|
+
ids: string[];
|
|
354
|
+
}> {
|
|
355
|
+
protected readonly name: string;
|
|
356
|
+
protected readonly oneQuery: DocumentNode | null;
|
|
357
|
+
protected readonly allQuery: DocumentNode | null;
|
|
358
|
+
protected readonly createMutation: DocumentNode | null;
|
|
359
|
+
protected readonly updateMutation: DocumentNode | null;
|
|
360
|
+
protected readonly deleteMutation: DocumentNode | null;
|
|
361
|
+
private readonly createName;
|
|
362
|
+
private readonly updateName;
|
|
363
|
+
private readonly deleteName;
|
|
364
|
+
/**
|
|
365
|
+
* Store the creation mutations that are pending
|
|
366
|
+
*/
|
|
367
|
+
private readonly creatingCache;
|
|
368
|
+
protected readonly apollo: Apollo;
|
|
369
|
+
protected readonly naturalDebounceService: NaturalDebounceService;
|
|
370
|
+
private readonly plural;
|
|
371
|
+
/**
|
|
372
|
+
*
|
|
373
|
+
* @param name service and single object query name (eg. userForFront or user).
|
|
374
|
+
* @param oneQuery GraphQL query to fetch a single object from ID (eg. userForCrudQuery).
|
|
375
|
+
* @param allQuery GraphQL query to fetch a filtered list of objects (eg. usersForCrudQuery).
|
|
376
|
+
* @param createMutation GraphQL mutation to create an object.
|
|
377
|
+
* @param updateMutation GraphQL mutation to update an object.
|
|
378
|
+
* @param deleteMutation GraphQL mutation to delete a list of objects.
|
|
379
|
+
* @param plural list query name (eg. usersForFront or users).
|
|
380
|
+
* @param createName create object mutation name (eg. createUser).
|
|
381
|
+
* @param updateName update object mutation name (eg. updateUser).
|
|
382
|
+
* @param deleteName delete object mutation name (eg. deleteUsers).
|
|
383
|
+
*/
|
|
384
|
+
constructor(name: string, oneQuery: DocumentNode | null, allQuery: DocumentNode | null, createMutation: DocumentNode | null, updateMutation: DocumentNode | null, deleteMutation: DocumentNode | null, plural?: string | null, createName?: string | null, updateName?: string | null, deleteName?: string | null);
|
|
385
|
+
/**
|
|
386
|
+
* List of individual fields validators
|
|
387
|
+
*/
|
|
388
|
+
getFormValidators(model?: Literal): FormValidators;
|
|
389
|
+
/**
|
|
390
|
+
* List of individual async fields validators
|
|
391
|
+
*/
|
|
392
|
+
getFormAsyncValidators(model?: Literal): FormAsyncValidators;
|
|
393
|
+
/**
|
|
394
|
+
* List of grouped fields validators (like password + confirm password)
|
|
395
|
+
*/
|
|
396
|
+
getFormGroupValidators(model?: Literal): ValidatorFn[];
|
|
397
|
+
/**
|
|
398
|
+
* List of async group fields validators (like unique constraint on multiple columns)
|
|
399
|
+
*/
|
|
400
|
+
getFormGroupAsyncValidators(model?: Literal): AsyncValidatorFn[];
|
|
401
|
+
getFormConfig(model: Literal): FormControls;
|
|
402
|
+
/**
|
|
403
|
+
* Create the final FormGroup for the object, including all validators
|
|
404
|
+
*
|
|
405
|
+
* This method should **not** be overridden, but instead `getFormConfig`,
|
|
406
|
+
* `getFormGroupValidators`, `getFormGroupAsyncValidators` might be.
|
|
407
|
+
*/
|
|
408
|
+
getFormGroup(model: Literal): UntypedFormGroup;
|
|
409
|
+
/**
|
|
410
|
+
* Get a single object
|
|
411
|
+
*
|
|
412
|
+
* If available it will emit object from cache immediately, then it
|
|
413
|
+
* will **always** fetch from network and then the observable will be completed.
|
|
414
|
+
*
|
|
415
|
+
* You must subscribe to start getting results (and fetch from network).
|
|
416
|
+
*/
|
|
417
|
+
getOne(id: string): Observable<Tone>;
|
|
418
|
+
/**
|
|
419
|
+
* Watch a single object
|
|
420
|
+
*
|
|
421
|
+
* If available it will emit object from cache immediately, then it
|
|
422
|
+
* will **always** fetch from network, and then keep watching the cache forever.
|
|
423
|
+
*
|
|
424
|
+
* You must subscribe to start getting results (and fetch from network).
|
|
425
|
+
*
|
|
426
|
+
* You **MUST** unsubscribe.
|
|
427
|
+
*/
|
|
428
|
+
watchOne(id: string, fetchPolicy?: WatchQueryFetchPolicy): Observable<Tone>;
|
|
429
|
+
private prepareOneQuery;
|
|
430
|
+
/**
|
|
431
|
+
* Get a collection of objects
|
|
432
|
+
*
|
|
433
|
+
* It will **always** fetch from network and then the observable will be completed.
|
|
434
|
+
* No cache is ever used, so it's slow but correct.
|
|
435
|
+
*/
|
|
436
|
+
getAll(queryVariablesManager: NaturalQueryVariablesManager<Vall>): Observable<Tall>;
|
|
437
|
+
/**
|
|
438
|
+
* Get a collection of objects
|
|
439
|
+
*
|
|
440
|
+
* Every time the observable variables change, and they are not undefined,
|
|
441
|
+
* it will return result from cache, then it will **always** fetch from network,
|
|
442
|
+
* and then keep watching the cache forever.
|
|
443
|
+
*
|
|
444
|
+
* You must subscribe to start getting results (and fetch from network).
|
|
445
|
+
*
|
|
446
|
+
* You **MUST** unsubscribe.
|
|
447
|
+
*/
|
|
448
|
+
watchAll(queryVariablesManager: NaturalQueryVariablesManager<Vall>, fetchPolicy?: WatchQueryFetchPolicy): Observable<Tall>;
|
|
449
|
+
/**
|
|
450
|
+
* This functions allow to quickly create or update objects.
|
|
451
|
+
*
|
|
452
|
+
* Manages a "creation is pending" status, and update when creation is ready.
|
|
453
|
+
* Uses regular update/updateNow and create methods.
|
|
454
|
+
* Used mainly when editing multiple objects in same controller (like in editable arrays)
|
|
455
|
+
*/
|
|
456
|
+
createOrUpdate(object: Vcreate['input'] | WithId<Vupdate['input']>, now?: boolean): Observable<Tcreate | Tupdate>;
|
|
457
|
+
/**
|
|
458
|
+
* Create an object in DB and then refetch the list of objects
|
|
459
|
+
*/
|
|
460
|
+
create(object: Vcreate['input']): Observable<Tcreate>;
|
|
461
|
+
/**
|
|
462
|
+
* Update an object, after a short debounce
|
|
463
|
+
*/
|
|
464
|
+
update(object: WithId<Vupdate['input']>): Observable<Tupdate>;
|
|
465
|
+
/**
|
|
466
|
+
* Update an object immediately when subscribing
|
|
467
|
+
*/
|
|
468
|
+
updateNow(object: WithId<Vupdate['input']>): Observable<Tupdate>;
|
|
469
|
+
/**
|
|
470
|
+
* Delete objects and then refetch the list of objects
|
|
471
|
+
*/
|
|
472
|
+
delete(objects: {
|
|
473
|
+
id: string;
|
|
474
|
+
}[]): Observable<Tdelete>;
|
|
475
|
+
/**
|
|
476
|
+
* If the id is provided, resolves an observable model. The observable model will only be emitted after we are sure
|
|
477
|
+
* that Apollo cache is fresh and warm. Then the component can subscribe to the observable model to get the model
|
|
478
|
+
* immediately from Apollo cache and any subsequents future mutations that may happen to Apollo cache.
|
|
479
|
+
*
|
|
480
|
+
* Without id, returns default values, in order to show a creation form.
|
|
481
|
+
*/
|
|
482
|
+
resolve(id: string | undefined): Observable<Observable<Tone | Vcreate['input']>>;
|
|
483
|
+
/**
|
|
484
|
+
* Return an object that match the GraphQL input type.
|
|
485
|
+
* It creates an object with manually filled data and add uncompleted data (like required attributes that can be empty strings)
|
|
486
|
+
*/
|
|
487
|
+
getInput(object: Literal, forCreation: boolean): Vcreate['input'] | Vupdate['input'];
|
|
488
|
+
/**
|
|
489
|
+
* Return the number of objects matching the query. It may never complete.
|
|
490
|
+
*
|
|
491
|
+
* This is used for the unique validator
|
|
492
|
+
*/
|
|
493
|
+
count(queryVariablesManager: NaturalQueryVariablesManager<Vall>): Observable<number>;
|
|
494
|
+
/**
|
|
495
|
+
* Return empty object with some default values from server perspective
|
|
496
|
+
*
|
|
497
|
+
* This is typically useful when showing a form for creation
|
|
498
|
+
*/
|
|
499
|
+
getDefaultForServer(): Vcreate['input'];
|
|
500
|
+
/**
|
|
501
|
+
* You probably **should not** use this.
|
|
502
|
+
*
|
|
503
|
+
* If you are trying to *call* this method, instead you probably want to call `getDefaultForServer()` to get default
|
|
504
|
+
* values for a model, or `getFormConfig()` to get a configured form that includes extra form fields.
|
|
505
|
+
*
|
|
506
|
+
* If you are trying to *override* this method, instead you probably want to override `getDefaultForServer()`.
|
|
507
|
+
*
|
|
508
|
+
* The only and **very rare** reason to override this method is if the client needs extra form fields that cannot be
|
|
509
|
+
* accepted by the server (not part of `XXXInput` type) and that are strictly for the client form needs. In that case,
|
|
510
|
+
* then you can return default values for those extra form fields, and the form returned by `getFormConfig()` will
|
|
511
|
+
* include those extra fields.
|
|
512
|
+
*/
|
|
513
|
+
protected getFormExtraFieldDefaultValues(): Literal;
|
|
514
|
+
/**
|
|
515
|
+
* This is used to extract only the array of fetched objects out of the entire fetched data
|
|
516
|
+
*/
|
|
517
|
+
protected mapAll(): OperatorFunction<FetchResult<unknown>, Tall>;
|
|
518
|
+
/**
|
|
519
|
+
* This is used to extract only the created object out of the entire fetched data
|
|
520
|
+
*/
|
|
521
|
+
protected mapCreation(result: MutationResult<unknown>): Tcreate;
|
|
522
|
+
/**
|
|
523
|
+
* This is used to extract only the updated object out of the entire fetched data
|
|
524
|
+
*/
|
|
525
|
+
protected mapUpdate(result: MutationResult<unknown>): Tupdate;
|
|
526
|
+
/**
|
|
527
|
+
* This is used to extract only flag when deleting an object
|
|
528
|
+
*/
|
|
529
|
+
protected mapDelete(result: MutationResult<unknown>): Tdelete;
|
|
530
|
+
/**
|
|
531
|
+
* Returns additional variables to be used when getting a single object
|
|
532
|
+
*
|
|
533
|
+
* This is typically a site or state ID, and is needed to get appropriate access rights
|
|
534
|
+
*/
|
|
535
|
+
protected getPartialVariablesForOne(): Observable<Partial<Vone>>;
|
|
536
|
+
/**
|
|
537
|
+
* Returns additional variables to be used when getting multiple objects
|
|
538
|
+
*
|
|
539
|
+
* This is typically a site or state ID, but it could be something else to further filter the query
|
|
540
|
+
*/
|
|
541
|
+
getPartialVariablesForAll(): Observable<Partial<Vall>>;
|
|
542
|
+
/**
|
|
543
|
+
* Returns additional variables to be used when creating an object
|
|
544
|
+
*
|
|
545
|
+
* This is typically a site or state ID
|
|
546
|
+
*/
|
|
547
|
+
protected getPartialVariablesForCreation(object: Literal): Partial<Vcreate>;
|
|
548
|
+
/**
|
|
549
|
+
* Returns additional variables to be used when updating an object
|
|
550
|
+
*
|
|
551
|
+
* This is typically a site or state ID
|
|
552
|
+
*/
|
|
553
|
+
protected getPartialVariablesForUpdate(object: Literal): Partial<Vupdate>;
|
|
554
|
+
/**
|
|
555
|
+
* Return additional variables to be used when deleting an object
|
|
556
|
+
*
|
|
557
|
+
* This is typically a site or state ID
|
|
558
|
+
*/
|
|
559
|
+
protected getPartialVariablesForDelete(objects: Literal[]): Partial<Vdelete>;
|
|
560
|
+
/**
|
|
561
|
+
* Throw exception to prevent executing queries with invalid variables
|
|
562
|
+
*/
|
|
563
|
+
protected throwIfObservable(value: unknown): void;
|
|
564
|
+
/**
|
|
565
|
+
* Merge given ID with additional partial variables if there is any
|
|
566
|
+
*/
|
|
567
|
+
private getVariablesForOne;
|
|
568
|
+
/**
|
|
569
|
+
* Throw exception to prevent executing null queries
|
|
570
|
+
*/
|
|
571
|
+
private throwIfNotQuery;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* An object literal with any keys and values
|
|
576
|
+
*/
|
|
577
|
+
type Literal = Record<string, any>;
|
|
578
|
+
/**
|
|
579
|
+
* An object with either a name or a fullName (or maybe both)
|
|
580
|
+
*/
|
|
581
|
+
type NameOrFullName = {
|
|
582
|
+
id: string;
|
|
583
|
+
name: string;
|
|
584
|
+
fullName?: string;
|
|
585
|
+
} | {
|
|
586
|
+
id: string;
|
|
587
|
+
name?: string;
|
|
588
|
+
fullName: string;
|
|
589
|
+
};
|
|
590
|
+
/**
|
|
591
|
+
* Extract the Tone type from a NaturalAbstractModelService
|
|
592
|
+
*/
|
|
593
|
+
type ExtractTone<P> = P extends NaturalAbstractModelService<infer Tone, any, any, any, any, any, any, any, any, any> ? Tone : never;
|
|
594
|
+
/**
|
|
595
|
+
* Extract the Vone type from a NaturalAbstractModelService
|
|
596
|
+
*/
|
|
597
|
+
type ExtractVone<P> = P extends NaturalAbstractModelService<any, infer Vone, any, any, any, any, any, any, any, any> ? Vone extends {
|
|
598
|
+
id: string;
|
|
599
|
+
} ? Vone : never : never;
|
|
600
|
+
/**
|
|
601
|
+
* Extract the Tall type from a NaturalAbstractModelService
|
|
602
|
+
*/
|
|
603
|
+
type ExtractTall<P> = P extends NaturalAbstractModelService<any, any, infer Tall, any, any, any, any, any, any, any> ? Tall extends PaginatedData<Literal> ? Tall : never : never;
|
|
604
|
+
/**
|
|
605
|
+
* Extract the TallOne type for a single item coming from a list of items from a NaturalAbstractModelService
|
|
606
|
+
*/
|
|
607
|
+
type ExtractTallOne<P> = P extends NaturalAbstractModelService<any, any, PaginatedData<infer TallOne extends Literal>, any, any, any, any, any, any, any> ? TallOne extends Literal ? TallOne : never : never;
|
|
608
|
+
/**
|
|
609
|
+
* Extract the Vall type from a NaturalAbstractModelService
|
|
610
|
+
*/
|
|
611
|
+
type ExtractVall<P> = P extends NaturalAbstractModelService<any, any, any, infer Vall, any, any, any, any, any, any> ? Vall extends QueryVariables ? Vall : never : never;
|
|
612
|
+
/**
|
|
613
|
+
* Extract the Tcreate type from a NaturalAbstractModelService
|
|
614
|
+
*/
|
|
615
|
+
type ExtractTcreate<P> = P extends NaturalAbstractModelService<any, any, any, any, infer Tcreate, any, any, any, any, any> ? Tcreate : never;
|
|
616
|
+
/**
|
|
617
|
+
* Extract the Vcreate type from a NaturalAbstractModelService
|
|
618
|
+
*/
|
|
619
|
+
type ExtractVcreate<P> = P extends NaturalAbstractModelService<any, any, any, any, any, infer Vcreate, any, any, any, any> ? Vcreate extends VariablesWithInput ? Vcreate : never : never;
|
|
620
|
+
/**
|
|
621
|
+
* Extract the Tupdate type from a NaturalAbstractModelService
|
|
622
|
+
*/
|
|
623
|
+
type ExtractTupdate<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, infer Tupdate, any, any, any> ? Tupdate : never;
|
|
624
|
+
/**
|
|
625
|
+
* Extract the Vupdate type from a NaturalAbstractModelService
|
|
626
|
+
*/
|
|
627
|
+
type ExtractVupdate<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, any, infer Vupdate, any, any> ? Vupdate extends {
|
|
628
|
+
id: string;
|
|
629
|
+
input: Literal;
|
|
630
|
+
} ? Vupdate : never : never;
|
|
631
|
+
/**
|
|
632
|
+
* Extract the Tdelete type from a NaturalAbstractModelService
|
|
633
|
+
*/
|
|
634
|
+
type ExtractTdelete<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, any, any, infer Tdelete, any> ? Tdelete : never;
|
|
635
|
+
/**
|
|
636
|
+
* Extract the Vdelete type from a NaturalAbstractModelService
|
|
637
|
+
*/
|
|
638
|
+
type ExtractVdelete<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, any, any, any, infer Vdelete> ? Vdelete extends {
|
|
639
|
+
ids: string[];
|
|
640
|
+
} ? Vdelete : never : never;
|
|
641
|
+
/**
|
|
642
|
+
* Extract the resolve type from a NaturalAbstractModelService
|
|
643
|
+
*/
|
|
644
|
+
type ExtractResolve<P> = P extends NaturalAbstractModelService<any, any, any, any, any, any, any, any, any, any> ? ObservedValueOf<ObservedValueOf<ReturnType<P['resolve']>>> : never;
|
|
645
|
+
/**
|
|
646
|
+
* This should be avoided if possible, and instead use a more precise type with some constraints on it to ensure that the model
|
|
647
|
+
* service is able to fulfill its requirements.
|
|
648
|
+
*/
|
|
649
|
+
type UntypedModelService = NaturalAbstractModelService<any, any, any, any, any, any, any, any, any, any>;
|
|
650
|
+
/**
|
|
651
|
+
* Returns the resolved data type, as available in components, from the given resolvers
|
|
652
|
+
*
|
|
653
|
+
* Eg:
|
|
654
|
+
*
|
|
655
|
+
* ```ts
|
|
656
|
+
* const actionResolvers = {
|
|
657
|
+
* model: resolveAction,
|
|
658
|
+
* statuses: () => inject(NaturalEnumService).get('Status'),
|
|
659
|
+
* } as const;
|
|
660
|
+
*
|
|
661
|
+
* // In action.component.ts
|
|
662
|
+
* const data: ResolvedData<typeof actionResolvers>;
|
|
663
|
+
* data.statuses.forEach(...);
|
|
664
|
+
* ```
|
|
665
|
+
*/
|
|
666
|
+
type ResolvedData<T extends ResolveData> = {
|
|
667
|
+
readonly [KeyType in keyof Pick<T, keyof T>]: ObservedValueOf<ReturnType<Pick<T, keyof T>[KeyType]>>;
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
type LinkableObject = {
|
|
671
|
+
id: string;
|
|
672
|
+
__typename: string;
|
|
673
|
+
};
|
|
674
|
+
declare class NaturalLinkMutationService {
|
|
675
|
+
private readonly apollo;
|
|
676
|
+
/**
|
|
677
|
+
* Receives the list of available mutations
|
|
678
|
+
*/
|
|
679
|
+
private allMutations?;
|
|
680
|
+
/**
|
|
681
|
+
* Link two objects together
|
|
682
|
+
*/
|
|
683
|
+
link(obj1: LinkableObject, obj2: LinkableObject, otherName?: string | null, variables?: Literal): Observable<FetchResult<{
|
|
684
|
+
id: string;
|
|
685
|
+
}>>;
|
|
686
|
+
/**
|
|
687
|
+
* Link many objects
|
|
688
|
+
*/
|
|
689
|
+
linkMany(obj1: LinkableObject, objects: LinkableObject[], otherName?: string | null, variables?: Literal): Observable<FetchResult<{
|
|
690
|
+
id: string;
|
|
691
|
+
}>[]>;
|
|
692
|
+
/**
|
|
693
|
+
* Unlink two objects
|
|
694
|
+
*/
|
|
695
|
+
unlink(obj1: LinkableObject, obj2: LinkableObject, otherName?: string | null): Observable<FetchResult<{
|
|
696
|
+
id: string;
|
|
697
|
+
}>>;
|
|
698
|
+
/**
|
|
699
|
+
* Return the list of all available mutation names
|
|
700
|
+
*/
|
|
701
|
+
private getAllMutationNames;
|
|
702
|
+
/**
|
|
703
|
+
* Generate mutation using patterns and replacing variables
|
|
704
|
+
*/
|
|
705
|
+
private getMutation;
|
|
706
|
+
/**
|
|
707
|
+
* Execute mutation
|
|
708
|
+
*/
|
|
709
|
+
private execute;
|
|
710
|
+
/**
|
|
711
|
+
* Build the actual mutation string
|
|
712
|
+
*/
|
|
713
|
+
private buildTemplate;
|
|
714
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalLinkMutationService, never>;
|
|
715
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalLinkMutationService>;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Kind of snapshot of the instance of a panel activated route
|
|
720
|
+
*/
|
|
721
|
+
type NaturalPanelsRouteConfig = {
|
|
722
|
+
segments: UrlSegment[];
|
|
723
|
+
path: string;
|
|
724
|
+
};
|
|
725
|
+
/**
|
|
726
|
+
* Config required to manage url and instantiate component correctly
|
|
727
|
+
*/
|
|
728
|
+
type NaturalPanelConfig = {
|
|
729
|
+
component: ComponentType<NaturalAbstractPanel>;
|
|
730
|
+
injector: Injector | null;
|
|
731
|
+
resolve: NaturalPanelResolves;
|
|
732
|
+
params: Literal;
|
|
733
|
+
rule: NaturalPanelsRouterRule;
|
|
734
|
+
route: NaturalPanelsRouteConfig;
|
|
735
|
+
};
|
|
736
|
+
/**
|
|
737
|
+
* Data provided to instantiated components in context of a panel/dialog
|
|
738
|
+
*/
|
|
739
|
+
type NaturalPanelData = {
|
|
740
|
+
config: NaturalPanelConfig;
|
|
741
|
+
data: Literal;
|
|
742
|
+
/**
|
|
743
|
+
* Related objects that should be linked to the object shown in the panel after its creation
|
|
744
|
+
*/
|
|
745
|
+
linkableObjects: LinkableObject[];
|
|
746
|
+
};
|
|
747
|
+
/**
|
|
748
|
+
* Similar to Angular functional resolver interface, but simpler for our panels' needs
|
|
749
|
+
*/
|
|
750
|
+
type NaturalPanelResolve<T> = (route: NaturalPanelConfig) => Observable<T>;
|
|
751
|
+
type NaturalPanelResolves = Record<string, NaturalPanelResolve<unknown>>;
|
|
752
|
+
/**
|
|
753
|
+
* Configuration for a route
|
|
754
|
+
*/
|
|
755
|
+
type NaturalPanelsRouterRule = {
|
|
756
|
+
path: string;
|
|
757
|
+
component: ComponentType<NaturalAbstractPanel>;
|
|
758
|
+
resolve?: NaturalPanelResolves;
|
|
759
|
+
};
|
|
760
|
+
type NaturalPanelsBeforeOpenPanel = {
|
|
761
|
+
itemData: NaturalPanelData;
|
|
762
|
+
panelConfig: NaturalPanelConfig;
|
|
763
|
+
fullPanelsConfig: NaturalPanelConfig[];
|
|
764
|
+
resolvedResult: any;
|
|
765
|
+
};
|
|
766
|
+
type NaturalPanelsHooksConfig = {
|
|
767
|
+
beforeOpenPanel?: (injector: Injector, naturalPanelsBeforeOpenPanel: NaturalPanelsBeforeOpenPanel) => NaturalPanelData;
|
|
768
|
+
};
|
|
769
|
+
type NaturalPanelsRoutesConfig = NaturalPanelsRouterRule[];
|
|
770
|
+
declare const PanelsHooksConfig: InjectionToken<NaturalPanelsHooksConfig>;
|
|
771
|
+
|
|
772
|
+
declare class NaturalAbstractPanel {
|
|
773
|
+
protected readonly destroyRef: DestroyRef;
|
|
774
|
+
/**
|
|
775
|
+
* The data property is the container where the resolved content is stored
|
|
776
|
+
* When loading a component from a panel opening (dialog), receives the data provided by the service
|
|
777
|
+
*/
|
|
778
|
+
data: any;
|
|
779
|
+
/**
|
|
780
|
+
* Bind isFrontPanel style class on root component
|
|
781
|
+
*/
|
|
782
|
+
isFrontPanel: boolean;
|
|
783
|
+
/**
|
|
784
|
+
* Bind isPanel style class on root component
|
|
785
|
+
*/
|
|
786
|
+
isPanel: boolean;
|
|
787
|
+
/**
|
|
788
|
+
* Merging of data provided by the very root component (that is in a route context) and inherited data through panels
|
|
789
|
+
* TODO: provide type with available attributes
|
|
790
|
+
*/
|
|
791
|
+
panelData?: NaturalPanelData;
|
|
792
|
+
panelService?: NaturalPanelsService;
|
|
793
|
+
/**
|
|
794
|
+
* Bind click on panels, to allow the selection of those who are behind
|
|
795
|
+
*/
|
|
796
|
+
clickPanel(): void;
|
|
797
|
+
/**
|
|
798
|
+
* Called when panel opens and component is loaded
|
|
799
|
+
* Runs before ngOnInit()
|
|
800
|
+
*/
|
|
801
|
+
initPanel(panelData: NaturalPanelData): void;
|
|
802
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalAbstractPanel, never>;
|
|
803
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalAbstractPanel, never, never, {}, {}, never, never, true, never>;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* `Data` contains in `model` either the model fetched from DB or default values (without ID). And besides `model`,
|
|
808
|
+
* any other extra keys defined by Extra.
|
|
809
|
+
*/
|
|
810
|
+
type Data<TService, Extra> = {
|
|
811
|
+
model: {
|
|
812
|
+
id?: string;
|
|
813
|
+
} & ExtractResolve<TService>;
|
|
814
|
+
} & Extra;
|
|
815
|
+
declare class NaturalAbstractDetail<TService extends NaturalAbstractModelService<{
|
|
816
|
+
id: string;
|
|
817
|
+
}, any, PaginatedData<Literal>, QueryVariables, any, any, any, any, unknown, any>, ExtraResolve extends Literal = Record<never, never>> extends NaturalAbstractPanel implements OnInit {
|
|
818
|
+
#private;
|
|
819
|
+
protected readonly key: string;
|
|
820
|
+
readonly service: TService;
|
|
821
|
+
/**
|
|
822
|
+
* Data retrieved by the server via route resolvers.
|
|
823
|
+
*
|
|
824
|
+
* The key `model` is special. It is readonly and represents the model being updated
|
|
825
|
+
* as it exists on server. The value is kept up to date when Apollo mutates it on server.
|
|
826
|
+
*
|
|
827
|
+
* The only time when `model` is not readonly is during creation. Only then can we modify the model values directly.
|
|
828
|
+
*
|
|
829
|
+
* Other keys, if present, are whatever is returned from route resolvers as-is.
|
|
830
|
+
*/
|
|
831
|
+
data: Data<TService, ExtraResolve>;
|
|
832
|
+
/**
|
|
833
|
+
* Form that manages the data from the controller
|
|
834
|
+
*/
|
|
835
|
+
form: UntypedFormGroup;
|
|
836
|
+
/**
|
|
837
|
+
* Show / hides the bottom fab button (mostly to hide it when we are on other tabs where semantic of button can conflict with ...
|
|
838
|
+
* semantic of data on other tab, like relations that list other objects)
|
|
839
|
+
*/
|
|
840
|
+
showFabButton: boolean;
|
|
841
|
+
protected readonly alertService: NaturalAlertService;
|
|
842
|
+
protected readonly router: Router;
|
|
843
|
+
protected readonly route: ActivatedRoute;
|
|
844
|
+
private readonly _dialogData;
|
|
845
|
+
/**
|
|
846
|
+
* Once set, this must not change anymore, especially not right after the creation mutation,
|
|
847
|
+
* so the form does not switch from creation mode to update mode without an actual reload of
|
|
848
|
+
* model from DB (by navigating to update page).
|
|
849
|
+
*/
|
|
850
|
+
private _isUpdatePage;
|
|
851
|
+
private readonly changes;
|
|
852
|
+
constructor(key: string, service: TService);
|
|
853
|
+
/**
|
|
854
|
+
* You probably should not override this method. Instead, consider overriding `initForm()`.
|
|
855
|
+
*/
|
|
856
|
+
ngOnInit(): void;
|
|
857
|
+
changeTab(index: number): void;
|
|
858
|
+
/**
|
|
859
|
+
* Returns whether `data.model` was fetched from DB, so we are on an update page, or if it is a new object
|
|
860
|
+
* with (only) default values, so we are on a creation page.
|
|
861
|
+
*
|
|
862
|
+
* This should be used instead of checking `data.model.id` directly, in order to type guard and get proper typing
|
|
863
|
+
*/
|
|
864
|
+
protected isUpdatePage(): this is {
|
|
865
|
+
data: {
|
|
866
|
+
model: ExtractTone<TService>;
|
|
867
|
+
};
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* Update the object on the server with the values from the form fields that were modified since
|
|
871
|
+
* the initialization, or since the previous successful update.
|
|
872
|
+
*
|
|
873
|
+
* Form fields that are never modified are **not** sent to the server, unless if you specify `submitAllFields`.
|
|
874
|
+
*/
|
|
875
|
+
update(now?: boolean, submitAllFields?: boolean): void;
|
|
876
|
+
create(redirect?: boolean): void;
|
|
877
|
+
/**
|
|
878
|
+
* `confirmer` can be used to open a custom dialog, or anything else, to confirm the deletion, instead of the standard dialog
|
|
879
|
+
*/
|
|
880
|
+
delete(redirectionRoute?: unknown[] | {
|
|
881
|
+
commands: unknown[];
|
|
882
|
+
extras: NavigationExtras;
|
|
883
|
+
}, confirmer?: Observable<boolean | undefined>): void;
|
|
884
|
+
protected postUpdate(model: ExtractTupdate<TService>): void;
|
|
885
|
+
/**
|
|
886
|
+
* Returns an observable that will be subscribed to immediately and the
|
|
887
|
+
* redirect navigation will only happen after the observable completes.
|
|
888
|
+
*/
|
|
889
|
+
protected postCreate(model: ExtractTcreate<TService>): Observable<unknown>;
|
|
890
|
+
protected preDelete(model: ExtractTone<TService>): void;
|
|
891
|
+
/**
|
|
892
|
+
* Initialize the form whenever it is needed.
|
|
893
|
+
*
|
|
894
|
+
* You should override this method, and not `ngOnInit()` if you need to customize the form. Because this will
|
|
895
|
+
* correctly be called more than one time per component instance if needed, when the route changes. But `ngOnInit()`
|
|
896
|
+
* will incorrectly be called exactly 1 time per component instance, even if the object changes via route navigation.
|
|
897
|
+
*/
|
|
898
|
+
protected initForm(): void;
|
|
899
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalAbstractDetail<any, any>, never>;
|
|
900
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalAbstractDetail<any, any>, never, never, {}, {}, never, never, true, never>;
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
/**
|
|
904
|
+
* This class helps managing non-paginated rows of items that can be edited in-place, typically in a <mat-table>.
|
|
905
|
+
* But it does **not** mutate anything to persist the edits on the server. It is up to the consuming component to implement
|
|
906
|
+
* custom mutation mechanism.
|
|
907
|
+
*
|
|
908
|
+
* To access data of this component from a parent component, use:
|
|
909
|
+
*
|
|
910
|
+
* ```ts
|
|
911
|
+
* private readonly cmp = viewChildren(ComponentType);
|
|
912
|
+
*
|
|
913
|
+
* this.cmp.getItems();
|
|
914
|
+
* ```
|
|
915
|
+
*
|
|
916
|
+
* To add empty line, call:
|
|
917
|
+
*
|
|
918
|
+
* ```
|
|
919
|
+
* this.cmp.addEmpty();
|
|
920
|
+
* ```
|
|
921
|
+
*
|
|
922
|
+
* @dynamic
|
|
923
|
+
*/
|
|
924
|
+
declare class NaturalAbstractEditableList<TService extends NaturalAbstractModelService<any, any, PaginatedData<Literal>, QueryVariables, any, any, any, any, any, any>, T extends Literal = ExtractTallOne<TService>> {
|
|
925
|
+
protected readonly service: TService;
|
|
926
|
+
readonly form: UntypedFormGroup;
|
|
927
|
+
readonly formArray: UntypedFormArray;
|
|
928
|
+
readonly variablesManager: NaturalQueryVariablesManager<ExtractVall<TService>>;
|
|
929
|
+
readonly dataSource: MatTableDataSource<AbstractControl<any, any, any>, _angular_material_paginator.MatPaginator>;
|
|
930
|
+
constructor(service: TService);
|
|
931
|
+
/**
|
|
932
|
+
* Set the list of items (overwriting what may have existed)
|
|
933
|
+
*/
|
|
934
|
+
setItems(items: readonly T[]): void;
|
|
935
|
+
/**
|
|
936
|
+
* Add given items to the list
|
|
937
|
+
* Reproduces the model data loading the same way as it would be on a detail page (via AbstractDetail controller) but without resolving
|
|
938
|
+
*/
|
|
939
|
+
addItems(items: readonly T[]): void;
|
|
940
|
+
removeAt(index: number): void;
|
|
941
|
+
/**
|
|
942
|
+
* Add empty item at the end of the list
|
|
943
|
+
*/
|
|
944
|
+
addEmpty(): void;
|
|
945
|
+
/**
|
|
946
|
+
* Return a list of models without any treatment.
|
|
947
|
+
*
|
|
948
|
+
* To mutate models, it would be required to map them using :
|
|
949
|
+
* - AbstractModelService.getInput()
|
|
950
|
+
* - AbstractModelService.getPartialVariablesForCreation()
|
|
951
|
+
* - AbstractModelService.getPartialVariablesForUpdate()
|
|
952
|
+
* - some other required treatment.
|
|
953
|
+
*
|
|
954
|
+
* 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.
|
|
955
|
+
*/
|
|
956
|
+
getItems(): T[];
|
|
957
|
+
/**
|
|
958
|
+
* Force the form validation.
|
|
959
|
+
*
|
|
960
|
+
* The valid state can then be read via `this.form.valid`
|
|
961
|
+
*/
|
|
962
|
+
validateForm(): void;
|
|
963
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalAbstractEditableList<any, any>, never>;
|
|
964
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalAbstractEditableList<any, any>, never, never, {}, {}, never, never, true, never>;
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
type AvailableColumn = {
|
|
968
|
+
/**
|
|
969
|
+
* This must be the column ID as defined in `matColumnDef`
|
|
970
|
+
*
|
|
971
|
+
* Implementation details:
|
|
972
|
+
*
|
|
973
|
+
* Unfortunately, we cannot use a `Record<AvailableColumn>` where keys would implicitly be unique and would replace
|
|
974
|
+
* this ID property, because only ES2020 guarantee the order of object keys, and we must still support ES2015 for
|
|
975
|
+
* iPhone 6. So, instead of `Record<AvailableColumn>`, we use `AvailableColumn[]` for now. But this could be
|
|
976
|
+
* revisited once we drop support of ES2015.
|
|
977
|
+
*
|
|
978
|
+
* @see https://stackoverflow.com/questions/30076219/does-es6-introduce-a-well-defined-order-of-enumeration-for-object-properties
|
|
979
|
+
*/
|
|
980
|
+
id: string;
|
|
981
|
+
/**
|
|
982
|
+
* Localized label of column for human
|
|
983
|
+
*/
|
|
984
|
+
label: string;
|
|
985
|
+
/**
|
|
986
|
+
* Initial checked state, defaults to `true`.
|
|
987
|
+
*/
|
|
988
|
+
checked?: boolean;
|
|
989
|
+
/**
|
|
990
|
+
* Initial visibility state, defaults to `false`.
|
|
991
|
+
*
|
|
992
|
+
* A column that is hidden will not appear in the list of choice,
|
|
993
|
+
* but it will be included in the result of selected columns.
|
|
994
|
+
*/
|
|
995
|
+
hidden?: boolean;
|
|
996
|
+
};
|
|
997
|
+
/**
|
|
998
|
+
* A button that will be shown as an icon on desktop, or as a menu entry on mobile
|
|
999
|
+
*/
|
|
1000
|
+
type Button = {
|
|
1001
|
+
/**
|
|
1002
|
+
* On desktop will be shown as tooltip, or as menu entry on mobile
|
|
1003
|
+
*/
|
|
1004
|
+
label: string;
|
|
1005
|
+
/**
|
|
1006
|
+
* The icon name to be used on desktop
|
|
1007
|
+
*/
|
|
1008
|
+
icon: string;
|
|
1009
|
+
/**
|
|
1010
|
+
* Whether to show the button at all. Defaults to `true`.
|
|
1011
|
+
*/
|
|
1012
|
+
show?: boolean;
|
|
1013
|
+
/**
|
|
1014
|
+
* Whether the button is disabled. Defaults to `false`.
|
|
1015
|
+
*/
|
|
1016
|
+
disabled?: boolean;
|
|
1017
|
+
/**
|
|
1018
|
+
* A checked button will have a highlight color as an icon, or a check mark as menu entry. Defaults to `false`.
|
|
1019
|
+
*/
|
|
1020
|
+
checked?: boolean;
|
|
1021
|
+
/**
|
|
1022
|
+
* The callback to call when button was clicked.
|
|
1023
|
+
*/
|
|
1024
|
+
click?: (button: Button, event: Event) => void;
|
|
1025
|
+
/**
|
|
1026
|
+
* Rarely used, only for OKpilot where we want to show proper URL, but click is actually intercepted to show dialog
|
|
1027
|
+
*/
|
|
1028
|
+
href?: string;
|
|
1029
|
+
/**
|
|
1030
|
+
* A non-empty list of sub-buttons (only 2 levels is supported).
|
|
1031
|
+
*/
|
|
1032
|
+
buttons?: SubButton[];
|
|
1033
|
+
};
|
|
1034
|
+
/**
|
|
1035
|
+
* A sub-button that will (always) be shown as a sub-menu entry
|
|
1036
|
+
*/
|
|
1037
|
+
type SubButton = {
|
|
1038
|
+
/**
|
|
1039
|
+
* Label for menu entry
|
|
1040
|
+
*/
|
|
1041
|
+
label: string;
|
|
1042
|
+
/**
|
|
1043
|
+
* Whether the button is disabled. Defaults to `false`.
|
|
1044
|
+
*/
|
|
1045
|
+
disabled?: boolean;
|
|
1046
|
+
/**
|
|
1047
|
+
* The callback to call when button was clicked.
|
|
1048
|
+
*/
|
|
1049
|
+
click: (subButton: SubButton, event: Event) => void;
|
|
1050
|
+
};
|
|
1051
|
+
|
|
1052
|
+
type Filter = {
|
|
1053
|
+
groups?: FilterGroup[] | null;
|
|
1054
|
+
};
|
|
1055
|
+
type FilterGroup = {
|
|
1056
|
+
groupLogic?: LogicalOperator | null;
|
|
1057
|
+
conditionsLogic?: LogicalOperator | null;
|
|
1058
|
+
joins?: FilterGroupJoin | null;
|
|
1059
|
+
conditions?: FilterGroupCondition[] | null;
|
|
1060
|
+
};
|
|
1061
|
+
type FilterGroupJoin = Record<string, JoinOn>;
|
|
1062
|
+
type JoinOn = {
|
|
1063
|
+
type?: JoinType | null;
|
|
1064
|
+
joins?: FilterGroupJoin | null;
|
|
1065
|
+
conditions?: FilterGroupCondition[] | null;
|
|
1066
|
+
};
|
|
1067
|
+
declare enum LogicalOperator {
|
|
1068
|
+
AND = "AND",
|
|
1069
|
+
OR = "OR"
|
|
1070
|
+
}
|
|
1071
|
+
declare enum JoinType {
|
|
1072
|
+
innerJoin = "innerJoin",
|
|
1073
|
+
leftJoin = "leftJoin"
|
|
1074
|
+
}
|
|
1075
|
+
type FilterGroupCondition = Record<string, FilterGroupConditionField>;
|
|
1076
|
+
type FilterGroupConditionField = {
|
|
1077
|
+
between?: BetweenOperator | null;
|
|
1078
|
+
equal?: EqualOperator | null;
|
|
1079
|
+
greater?: GreaterOperator | null;
|
|
1080
|
+
greaterOrEqual?: GreaterOrEqualOperator | null;
|
|
1081
|
+
in?: InOperator | null;
|
|
1082
|
+
less?: LessOperator | null;
|
|
1083
|
+
lessOrEqual?: LessOrEqualOperator | null;
|
|
1084
|
+
like?: LikeOperator | null;
|
|
1085
|
+
null?: NullOperator | null;
|
|
1086
|
+
have?: HaveOperator | null;
|
|
1087
|
+
empty?: EmptyOperator | null;
|
|
1088
|
+
[key: string]: Literal | undefined | null;
|
|
1089
|
+
};
|
|
1090
|
+
type Scalar = number | string | boolean;
|
|
1091
|
+
type HaveOperator = {
|
|
1092
|
+
values: string[];
|
|
1093
|
+
not?: boolean | null;
|
|
1094
|
+
};
|
|
1095
|
+
type EmptyOperator = {
|
|
1096
|
+
not?: boolean | null;
|
|
1097
|
+
};
|
|
1098
|
+
type BetweenOperator = {
|
|
1099
|
+
from: Scalar;
|
|
1100
|
+
to: Scalar;
|
|
1101
|
+
not?: boolean | null;
|
|
1102
|
+
};
|
|
1103
|
+
type EqualOperator = {
|
|
1104
|
+
value: Scalar;
|
|
1105
|
+
not?: boolean | null;
|
|
1106
|
+
};
|
|
1107
|
+
type GreaterOperator = {
|
|
1108
|
+
value: Scalar;
|
|
1109
|
+
not?: boolean | null;
|
|
1110
|
+
};
|
|
1111
|
+
type GreaterOrEqualOperator = {
|
|
1112
|
+
value: Scalar;
|
|
1113
|
+
not?: boolean | null;
|
|
1114
|
+
};
|
|
1115
|
+
type InOperator = {
|
|
1116
|
+
values: Scalar[];
|
|
1117
|
+
not?: boolean | null;
|
|
1118
|
+
};
|
|
1119
|
+
type LessOperator = {
|
|
1120
|
+
value: Scalar;
|
|
1121
|
+
not?: boolean | null;
|
|
1122
|
+
};
|
|
1123
|
+
type LessOrEqualOperator = {
|
|
1124
|
+
value: Scalar;
|
|
1125
|
+
not?: boolean | null;
|
|
1126
|
+
};
|
|
1127
|
+
type LikeOperator = {
|
|
1128
|
+
value: Scalar;
|
|
1129
|
+
not?: boolean | null;
|
|
1130
|
+
};
|
|
1131
|
+
type NullOperator = {
|
|
1132
|
+
not?: boolean | null;
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1135
|
+
type DropdownComponent = {
|
|
1136
|
+
/**
|
|
1137
|
+
* Observable of current value as string
|
|
1138
|
+
*/
|
|
1139
|
+
readonly renderedValue: BehaviorSubject<string>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Get condition, including rich object types
|
|
1142
|
+
*/
|
|
1143
|
+
getCondition(): FilterGroupConditionField;
|
|
1144
|
+
/**
|
|
1145
|
+
* Returns true if dropdown value is valid
|
|
1146
|
+
*/
|
|
1147
|
+
isValid(): boolean;
|
|
1148
|
+
/**
|
|
1149
|
+
* Returns true if the dropdown value has change
|
|
1150
|
+
*/
|
|
1151
|
+
isDirty(): boolean;
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Type for a search selection
|
|
1156
|
+
*/
|
|
1157
|
+
type NaturalSearchSelection = {
|
|
1158
|
+
field: string;
|
|
1159
|
+
/**
|
|
1160
|
+
* This is required if the facet also have a `name`.
|
|
1161
|
+
*
|
|
1162
|
+
* See BasicFacet.name
|
|
1163
|
+
*/
|
|
1164
|
+
name?: string;
|
|
1165
|
+
condition: FilterGroupConditionField;
|
|
1166
|
+
};
|
|
1167
|
+
/**
|
|
1168
|
+
* Groups are a list of values, that should be interpreted with AND condition
|
|
1169
|
+
*/
|
|
1170
|
+
type GroupSelections = NaturalSearchSelection[];
|
|
1171
|
+
/**
|
|
1172
|
+
* List of groups, that should be interpreted with OR condition
|
|
1173
|
+
* Final input / output format
|
|
1174
|
+
*/
|
|
1175
|
+
type NaturalSearchSelections = GroupSelections[];
|
|
1176
|
+
/**
|
|
1177
|
+
* Consolidated type for a selection and it's matching facet
|
|
1178
|
+
* Used internally for dropdown
|
|
1179
|
+
*/
|
|
1180
|
+
type DropdownResult = {
|
|
1181
|
+
condition: FilterGroupConditionField;
|
|
1182
|
+
facet?: Facet;
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
type BasicFacet = {
|
|
1186
|
+
/**
|
|
1187
|
+
* The label to be used in the GUI
|
|
1188
|
+
*/
|
|
1189
|
+
display: string;
|
|
1190
|
+
/**
|
|
1191
|
+
* The field this facet should apply to.
|
|
1192
|
+
*
|
|
1193
|
+
* In most cases it should be the property name of the model. Something like:
|
|
1194
|
+
*
|
|
1195
|
+
* - name
|
|
1196
|
+
* - description
|
|
1197
|
+
* - artist.name
|
|
1198
|
+
*/
|
|
1199
|
+
field: string;
|
|
1200
|
+
/**
|
|
1201
|
+
* This is required only if there are duplicated `field` in all facets.
|
|
1202
|
+
*
|
|
1203
|
+
* If `name` exists it will be used as an alternative identifier for facet, instead of `field`, to match
|
|
1204
|
+
* a selection with its facet (in `getFacetFromSelection()`). So a selection must be given with the `name`,
|
|
1205
|
+
* instead of `field`. And it will also be present in the URL. But it will never appear in the GraphQL selection.
|
|
1206
|
+
*
|
|
1207
|
+
* https://github.com/Ecodev/natural-search/issues/16
|
|
1208
|
+
*/
|
|
1209
|
+
name?: string;
|
|
1210
|
+
/**
|
|
1211
|
+
* A function to transform the selection before it is applied onto the filter.
|
|
1212
|
+
*
|
|
1213
|
+
* This would typically be useful to do unit conversion so the GUI has some user
|
|
1214
|
+
* friendly values, but the API works with a "low-level" unit.
|
|
1215
|
+
*/
|
|
1216
|
+
transform?: (s: NaturalSearchSelection) => NaturalSearchSelection;
|
|
1217
|
+
};
|
|
1218
|
+
/**
|
|
1219
|
+
* Facet that is only a flag (set or unset)
|
|
1220
|
+
*/
|
|
1221
|
+
type FlagFacet<Condition> = {
|
|
1222
|
+
/**
|
|
1223
|
+
* The value to be returned when the flag is set
|
|
1224
|
+
*/
|
|
1225
|
+
condition: Condition;
|
|
1226
|
+
/**
|
|
1227
|
+
* If true the value is set when the flag does NOT exist and the
|
|
1228
|
+
* value is unset when the flag exists.
|
|
1229
|
+
*
|
|
1230
|
+
* Defaults to `false`.
|
|
1231
|
+
*/
|
|
1232
|
+
inversed?: boolean;
|
|
1233
|
+
} & BasicFacet;
|
|
1234
|
+
/**
|
|
1235
|
+
* Facet that uses a component in a dropdown
|
|
1236
|
+
*/
|
|
1237
|
+
type DropdownFacet<C> = {
|
|
1238
|
+
component: Type<DropdownComponent>;
|
|
1239
|
+
/**
|
|
1240
|
+
* Show a button into the dropdown container to validate value. Gives alternative to "click out" and incoming "tab/esc" key.
|
|
1241
|
+
*/
|
|
1242
|
+
showValidateButton?: boolean;
|
|
1243
|
+
/**
|
|
1244
|
+
* Anything that could be useful for the dropdown component
|
|
1245
|
+
*/
|
|
1246
|
+
configuration?: C;
|
|
1247
|
+
} & BasicFacet;
|
|
1248
|
+
/**
|
|
1249
|
+
* A facet
|
|
1250
|
+
*/
|
|
1251
|
+
type Facet = DropdownFacet<any> | FlagFacet<any>;
|
|
1252
|
+
/**
|
|
1253
|
+
* Exhaustive list of facets
|
|
1254
|
+
*/
|
|
1255
|
+
type NaturalSearchFacets = Facet[];
|
|
1256
|
+
|
|
1257
|
+
/**
|
|
1258
|
+
* Validator for persisted values retrieved from NaturalPersistenceService. If returns false, the persisted value
|
|
1259
|
+
* will be ignored, and instead `null` will be returned.
|
|
1260
|
+
*
|
|
1261
|
+
* `storageKey` is only given if the value is coming from session storage (and not from URL).
|
|
1262
|
+
*/
|
|
1263
|
+
type PersistenceValidator = (key: string, storageKey: string | null, value: unknown) => boolean;
|
|
1264
|
+
declare const NATURAL_PERSISTENCE_VALIDATOR: InjectionToken<PersistenceValidator>;
|
|
1265
|
+
declare class NaturalPersistenceService {
|
|
1266
|
+
private readonly router;
|
|
1267
|
+
private readonly sessionStorage;
|
|
1268
|
+
private readonly isValid;
|
|
1269
|
+
/**
|
|
1270
|
+
* Persist in url and local storage the given value with the given key.
|
|
1271
|
+
* When stored in storage, we need more "key" to identify the controller.
|
|
1272
|
+
*/
|
|
1273
|
+
persist(key: string, value: unknown, route: ActivatedRoute, storageKey: string, navigationExtras?: NavigationExtras): Promise<boolean>;
|
|
1274
|
+
/**
|
|
1275
|
+
* Return object with persisted data in url or in session storage
|
|
1276
|
+
* Url has priority over session storage because of url sharing. When url is provided, session storage is ignored.
|
|
1277
|
+
* Url and storage are synced when arriving in a component :
|
|
1278
|
+
* - When loading with url parameters, storage is updated to stay synced
|
|
1279
|
+
* - When loading without url, but with storage data, the url is updated
|
|
1280
|
+
*/
|
|
1281
|
+
get(key: string, route: ActivatedRoute, storageKey: string): any | null;
|
|
1282
|
+
/**
|
|
1283
|
+
* Get given key from the url parameters
|
|
1284
|
+
*/
|
|
1285
|
+
getFromUrl(key: string, route: ActivatedRoute): any | null;
|
|
1286
|
+
/**
|
|
1287
|
+
* Add/override given pair key-value in the url
|
|
1288
|
+
* Always JSON.stringify() the given value
|
|
1289
|
+
* If the value is falsey, the pair key-value is removed from the url.
|
|
1290
|
+
*/
|
|
1291
|
+
persistInUrl(key: string, value: unknown, route: ActivatedRoute, navigationExtras?: NavigationExtras): Promise<boolean>;
|
|
1292
|
+
getFromStorage(key: string, storageKey: string): any | null;
|
|
1293
|
+
/**
|
|
1294
|
+
* Store value in session storage.
|
|
1295
|
+
* If value is falsy, the entry is removed
|
|
1296
|
+
*/
|
|
1297
|
+
persistInStorage(key: string, value: unknown, storageKey: string): void;
|
|
1298
|
+
private getStorageKey;
|
|
1299
|
+
private isFalseyValue;
|
|
1300
|
+
private deserialize;
|
|
1301
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalPersistenceService, never>;
|
|
1302
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalPersistenceService>;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
type BreadcrumbItem = {
|
|
1306
|
+
id: string;
|
|
1307
|
+
name: string;
|
|
1308
|
+
} & Literal;
|
|
1309
|
+
type NavigableItem<T> = {
|
|
1310
|
+
item: T;
|
|
1311
|
+
hasNavigation: boolean;
|
|
1312
|
+
};
|
|
1313
|
+
/**
|
|
1314
|
+
* This class helps managing a list of paginated items that can be filtered,
|
|
1315
|
+
* selected, and then bulk actions can be performed on selection.
|
|
1316
|
+
*
|
|
1317
|
+
* @dynamic
|
|
1318
|
+
*/
|
|
1319
|
+
declare class NaturalAbstractNavigableList<TService extends NaturalAbstractModelService<any, any, PaginatedData<{
|
|
1320
|
+
id: string;
|
|
1321
|
+
}>, QueryVariables, any, any, any, any, any, any>> extends NaturalAbstractList<TService, PaginatedData<NavigableItem<ExtractTall<TService>['items'][0]>>> implements OnInit {
|
|
1322
|
+
/**
|
|
1323
|
+
* Name of filter for child items to access ancestor item
|
|
1324
|
+
*/
|
|
1325
|
+
readonly ancestorRelationName: i0.InputSignal<string>;
|
|
1326
|
+
private oldAncertorId;
|
|
1327
|
+
breadcrumbs: BreadcrumbItem[];
|
|
1328
|
+
constructor(service: TService);
|
|
1329
|
+
ngOnInit(): void;
|
|
1330
|
+
protected getDataObservable(): Observable<PaginatedData<NavigableItem<ExtractTallOne<TService>>>>;
|
|
1331
|
+
protected translateSearchAndRefreshList(naturalSearchSelections: NaturalSearchSelections): void;
|
|
1332
|
+
clearSearch(resetPagination?: boolean): void;
|
|
1333
|
+
search(naturalSearchSelections: NaturalSearchSelections, navigationExtras?: NavigationExtras, resetPagination?: boolean): void;
|
|
1334
|
+
/**
|
|
1335
|
+
* Return an array for router link usage
|
|
1336
|
+
*/
|
|
1337
|
+
getChildLink(ancestor: {
|
|
1338
|
+
id: string;
|
|
1339
|
+
} | null): RouterLink['routerLink'];
|
|
1340
|
+
/**
|
|
1341
|
+
* Depth is limited by queries
|
|
1342
|
+
* @param item with an ancestor relation (must match ancestorRelationName attribute)
|
|
1343
|
+
*/
|
|
1344
|
+
protected getBreadcrumb(item: BreadcrumbItem): BreadcrumbItem[];
|
|
1345
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalAbstractNavigableList<any>, never>;
|
|
1346
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalAbstractNavigableList<any>, never, never, { "ancestorRelationName": { "alias": "ancestorRelationName"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
type MaybeNavigable = Literal | NavigableItem<Literal>;
|
|
1350
|
+
/**
|
|
1351
|
+
* This class helps managing a list of paginated items that can be filtered,
|
|
1352
|
+
* selected, and then bulk actions can be performed on selection.
|
|
1353
|
+
*
|
|
1354
|
+
* Components inheriting from this class can be used as standalone with input attributes.
|
|
1355
|
+
*
|
|
1356
|
+
* Usage :
|
|
1357
|
+
*
|
|
1358
|
+
* ```html
|
|
1359
|
+
* <natural-my-listing [forcedVariables]="{filter:...}" [selectedColumns]="['col1']" [persistSearch]="false">
|
|
1360
|
+
* ```
|
|
1361
|
+
*/
|
|
1362
|
+
declare class NaturalAbstractList<TService extends NaturalAbstractModelService<any, any, PaginatedData<Literal>, QueryVariables, any, any, any, any, any, any>, Tall extends PaginatedData<MaybeNavigable> = ExtractTall<TService>> extends NaturalAbstractPanel implements OnInit {
|
|
1363
|
+
readonly service: TService;
|
|
1364
|
+
/**
|
|
1365
|
+
* Whether search should be loaded from url/storage and persisted in it too.
|
|
1366
|
+
*/
|
|
1367
|
+
persistSearch: boolean;
|
|
1368
|
+
/**
|
|
1369
|
+
* List of columns that are available to the end-user to select from, via `<natural-columns-picker>`
|
|
1370
|
+
*/
|
|
1371
|
+
availableColumns: AvailableColumn[];
|
|
1372
|
+
/**
|
|
1373
|
+
* Columns list after interaction with `<natural-columns-picker>`
|
|
1374
|
+
*/
|
|
1375
|
+
columnsForTable: string[];
|
|
1376
|
+
/**
|
|
1377
|
+
* The default column selection that automatically happened after `<natural-columns-picker>` initialization
|
|
1378
|
+
*/
|
|
1379
|
+
private defaultSelectedColumns;
|
|
1380
|
+
/**
|
|
1381
|
+
* Visible (checked) columns
|
|
1382
|
+
*
|
|
1383
|
+
* Instead of using this, you should consider correctly configuring `AvailableColumn.checked`.
|
|
1384
|
+
*/
|
|
1385
|
+
selectedColumns?: string[];
|
|
1386
|
+
/**
|
|
1387
|
+
* Source of the list
|
|
1388
|
+
*/
|
|
1389
|
+
dataSource: NaturalDataSource<Tall> | undefined;
|
|
1390
|
+
/**
|
|
1391
|
+
* Selection for bulk actions
|
|
1392
|
+
*/
|
|
1393
|
+
readonly selection: SelectionModel<ExtractTall<TService>["items"][0]>;
|
|
1394
|
+
/**
|
|
1395
|
+
* Next executed action from bulk menu
|
|
1396
|
+
*/
|
|
1397
|
+
bulkActionSelected: string | null;
|
|
1398
|
+
/**
|
|
1399
|
+
* Centralisation of query variables
|
|
1400
|
+
*/
|
|
1401
|
+
variablesManager: NaturalQueryVariablesManager<ExtractVall<TService>>;
|
|
1402
|
+
/**
|
|
1403
|
+
* Configuration for natural-search facets
|
|
1404
|
+
*/
|
|
1405
|
+
naturalSearchFacets: NaturalSearchFacets;
|
|
1406
|
+
/**
|
|
1407
|
+
* Result of a search (can be provided as input for initialisation)
|
|
1408
|
+
*/
|
|
1409
|
+
naturalSearchSelections: NaturalSearchSelections;
|
|
1410
|
+
/**
|
|
1411
|
+
* Data attribute provided by activated route snapshot
|
|
1412
|
+
*/
|
|
1413
|
+
routeData?: Data$1;
|
|
1414
|
+
/**
|
|
1415
|
+
* List of page sizes
|
|
1416
|
+
*/
|
|
1417
|
+
readonly pageSizeOptions: number[];
|
|
1418
|
+
/**
|
|
1419
|
+
* Initial pagination setup
|
|
1420
|
+
*/
|
|
1421
|
+
protected defaultPagination: Required<PaginationInput>;
|
|
1422
|
+
/**
|
|
1423
|
+
* Initial sorting
|
|
1424
|
+
*/
|
|
1425
|
+
protected defaultSorting?: Sorting[];
|
|
1426
|
+
protected readonly router: Router;
|
|
1427
|
+
protected readonly route: ActivatedRoute;
|
|
1428
|
+
protected readonly alertService: NaturalAlertService;
|
|
1429
|
+
protected readonly persistenceService: NaturalPersistenceService;
|
|
1430
|
+
constructor(service: TService);
|
|
1431
|
+
/**
|
|
1432
|
+
* Variables that are always forced on a list, in addition to whatever the end-user might select
|
|
1433
|
+
*/
|
|
1434
|
+
set forcedVariables(variables: QueryVariables | null | undefined);
|
|
1435
|
+
/**
|
|
1436
|
+
* If change, check DocumentsComponent that overrides this function without calling super.ngOnInit().
|
|
1437
|
+
*/
|
|
1438
|
+
ngOnInit(): void;
|
|
1439
|
+
protected handleHistoryNavigation(): void;
|
|
1440
|
+
/**
|
|
1441
|
+
* Persist search and then launch whatever is required to refresh the list
|
|
1442
|
+
*/
|
|
1443
|
+
search(naturalSearchSelections: NaturalSearchSelections, navigationExtras?: NavigationExtras, resetPagination?: boolean): void;
|
|
1444
|
+
/**
|
|
1445
|
+
* Change sorting variables for query and persist the new value in url and local storage
|
|
1446
|
+
* The default value is not persisted
|
|
1447
|
+
* @param sortingEvents List of material sorting events
|
|
1448
|
+
*/
|
|
1449
|
+
sorting(sortingEvents: (Sort & Partial<Pick<Sorting, 'nullAsHighest' | 'emptyStringAsHighest'>>)[]): void;
|
|
1450
|
+
/**
|
|
1451
|
+
* Return current pagination, either the user defined one, or the default one
|
|
1452
|
+
*/
|
|
1453
|
+
protected getPagination(): PaginationInput;
|
|
1454
|
+
/**
|
|
1455
|
+
* Change pagination variables for query and persist in url and local storage the new value
|
|
1456
|
+
* The default value not persisted
|
|
1457
|
+
*
|
|
1458
|
+
* @param event Natural or Paginator PageEvent
|
|
1459
|
+
* @param defer Promise (usually a route promise) that defers the redirection from this call to prevent route navigation collision
|
|
1460
|
+
* @param navigationExtras Angular router navigation options. Is relevant only if persistSearch is true
|
|
1461
|
+
*/
|
|
1462
|
+
pagination(event: PaginationInput | PageEvent, defer?: Promise<unknown>, navigationExtras?: NavigationExtras): void;
|
|
1463
|
+
protected persistPagination(pagination: PaginationInput | null, defer?: Promise<unknown>, navigationExtras?: NavigationExtras): void;
|
|
1464
|
+
/**
|
|
1465
|
+
* Selects all rows if they are not all selected; otherwise clear selection
|
|
1466
|
+
*/
|
|
1467
|
+
masterToggle(): void;
|
|
1468
|
+
/**
|
|
1469
|
+
* Whether the number of selected elements matches the total number of rows
|
|
1470
|
+
*/
|
|
1471
|
+
isAllSelected(): boolean;
|
|
1472
|
+
/**
|
|
1473
|
+
* Called when a bulk action is selected
|
|
1474
|
+
*/
|
|
1475
|
+
bulkAction(): void;
|
|
1476
|
+
/**
|
|
1477
|
+
* In non-panel context, header is always visible.
|
|
1478
|
+
* In panel context, header is hidden when no results.
|
|
1479
|
+
*/
|
|
1480
|
+
showHeader(): boolean;
|
|
1481
|
+
/**
|
|
1482
|
+
* Search is visible in most cases, but hidden on a panel
|
|
1483
|
+
*/
|
|
1484
|
+
showSearch(): boolean;
|
|
1485
|
+
/**
|
|
1486
|
+
* Table should be shown only when there is data
|
|
1487
|
+
*/
|
|
1488
|
+
showTable(): boolean;
|
|
1489
|
+
/**
|
|
1490
|
+
* No results is shown when there is no items, but only in non-panel context only.
|
|
1491
|
+
* In panels we want discrete mode, there is no search and no "no-results"
|
|
1492
|
+
*/
|
|
1493
|
+
showNoResults(): boolean;
|
|
1494
|
+
/**
|
|
1495
|
+
* Initialize from route.
|
|
1496
|
+
*
|
|
1497
|
+
* Uses data provided by router such as:
|
|
1498
|
+
*
|
|
1499
|
+
* - `route.data.forcedVariables`
|
|
1500
|
+
* - `route.data.availableColumns`
|
|
1501
|
+
* - `route.data.selectedColumns`
|
|
1502
|
+
*/
|
|
1503
|
+
protected initFromRoute(): void;
|
|
1504
|
+
protected getDataObservable(): Observable<Tall>;
|
|
1505
|
+
protected initFromPersisted(): void;
|
|
1506
|
+
protected translateSearchAndRefreshList(naturalSearchSelections: NaturalSearchSelections, ignoreEmptyFilter?: boolean): void;
|
|
1507
|
+
/**
|
|
1508
|
+
* Return current url excluding last route parameters;
|
|
1509
|
+
*/
|
|
1510
|
+
protected getStorageKey(): string;
|
|
1511
|
+
protected bulkdDeleteConfirmation(): Observable<boolean | undefined>;
|
|
1512
|
+
/**
|
|
1513
|
+
* Delete multiple items at once
|
|
1514
|
+
*/
|
|
1515
|
+
protected bulkDelete(): Observable<void>;
|
|
1516
|
+
private applyForcedVariables;
|
|
1517
|
+
selectColumns(columns: string[]): void;
|
|
1518
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalAbstractList<any, any>, never>;
|
|
1519
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalAbstractList<any, any>, never, never, { "persistSearch": { "alias": "persistSearch"; "required": false; }; "availableColumns": { "alias": "availableColumns"; "required": false; }; "selectedColumns": { "alias": "selectedColumns"; "required": false; }; "forcedVariables": { "alias": "forcedVariables"; "required": false; }; }, {}, never, never, true, never>;
|
|
1520
|
+
}
|
|
1521
|
+
|
|
1522
|
+
/**
|
|
1523
|
+
* Detect if the given variables have a file to be uploaded or not, and
|
|
1524
|
+
* also convert date to be serialized with their timezone.
|
|
1525
|
+
*/
|
|
1526
|
+
declare function hasFilesAndProcessDate(variables: unknown): boolean;
|
|
1527
|
+
/**
|
|
1528
|
+
* Create an Apollo link that supports batched queries and file uploads.
|
|
1529
|
+
*
|
|
1530
|
+
* File uploads and mutations are never batched.
|
|
1531
|
+
*/
|
|
1532
|
+
declare function createHttpLink(httpLink: HttpLink, httpBatchLink: HttpBatchLink, options: Options): ApolloLink;
|
|
1533
|
+
|
|
1534
|
+
/**
|
|
1535
|
+
* Behave like setTimeout(), but with a mandatory cancel mechanism.
|
|
1536
|
+
*
|
|
1537
|
+
* This is typically useful to replace setTimeout() in components where the callback
|
|
1538
|
+
* would crash if executed after the component destruction. That can easily happen
|
|
1539
|
+
* when the user navigates quickly between pages.
|
|
1540
|
+
*
|
|
1541
|
+
* Typical usage in a component would be:
|
|
1542
|
+
*
|
|
1543
|
+
* ```ts
|
|
1544
|
+
* cancellableTimeout(inject(DestroyRef)).subscribe(myCallback);
|
|
1545
|
+
* ```
|
|
1546
|
+
*
|
|
1547
|
+
* or
|
|
1548
|
+
*
|
|
1549
|
+
* ```ts
|
|
1550
|
+
* cancellableTimeout(this.ngUnsubscribe).subscribe(myCallback);
|
|
1551
|
+
* ```
|
|
1552
|
+
*
|
|
1553
|
+
* Instead of the more error-prone:
|
|
1554
|
+
*
|
|
1555
|
+
* ```ts
|
|
1556
|
+
* public foo(): void {
|
|
1557
|
+
* this.timeout = setTimeout(myCallBack);
|
|
1558
|
+
* }
|
|
1559
|
+
*
|
|
1560
|
+
* public ngOnDestroy(): void {
|
|
1561
|
+
* if (this.timeout) {
|
|
1562
|
+
* clearTimeout(this.timeout);
|
|
1563
|
+
* this.timeout = null;
|
|
1564
|
+
* }
|
|
1565
|
+
* }
|
|
1566
|
+
* ```
|
|
1567
|
+
*/
|
|
1568
|
+
declare function cancellableTimeout(canceller: Observable<unknown> | DestroyRef, milliSeconds?: number): Observable<void>;
|
|
1569
|
+
/**
|
|
1570
|
+
* For debugging purpose only, will dump in console everything that happen to
|
|
1571
|
+
* the observable
|
|
1572
|
+
*/
|
|
1573
|
+
declare function debug<T>(debugName: string): MonoTypeOperatorFunction<T>;
|
|
1574
|
+
|
|
1575
|
+
/**
|
|
1576
|
+
* Very basic formatting to get only date, without time and ignoring entirely the timezone
|
|
1577
|
+
*
|
|
1578
|
+
* So something like: "2021-09-23"
|
|
1579
|
+
*/
|
|
1580
|
+
declare function formatIsoDate(date: null): null;
|
|
1581
|
+
declare function formatIsoDate(date: Date): string;
|
|
1582
|
+
declare function formatIsoDate(date: Date | null): string | null;
|
|
1583
|
+
/**
|
|
1584
|
+
* Format a date and time in a way that will preserve the local time zone.
|
|
1585
|
+
* This allows the server side to know the day (without time) that was selected on client side.
|
|
1586
|
+
*
|
|
1587
|
+
* So something like: "2021-09-23T17:57:16+09:00"
|
|
1588
|
+
*/
|
|
1589
|
+
declare function formatIsoDateTime(date: Date): string;
|
|
1590
|
+
/**
|
|
1591
|
+
* Relations to full objects are converted to their IDs only.
|
|
1592
|
+
*
|
|
1593
|
+
* So {user: {id: 123}} becomes {user: 123}
|
|
1594
|
+
*/
|
|
1595
|
+
declare function relationsToIds(object: Literal): Literal;
|
|
1596
|
+
/**
|
|
1597
|
+
* Returns the plural form of the given name
|
|
1598
|
+
*
|
|
1599
|
+
* This is **not** necessarily valid english grammar. Its only purpose is for internal usage, not for humans.
|
|
1600
|
+
*
|
|
1601
|
+
* This **MUST** be kept in sync with `\Ecodev\Felix\Api\Plural:make()`.
|
|
1602
|
+
*
|
|
1603
|
+
* This is a bit performance-sensitive, so we should keep it fast and only cover cases that we actually need.
|
|
1604
|
+
*/
|
|
1605
|
+
declare function makePlural(name: string): string;
|
|
1606
|
+
/**
|
|
1607
|
+
* Returns the string with the first letter as capital
|
|
1608
|
+
*/
|
|
1609
|
+
declare function upperCaseFirstLetter(term: string): string;
|
|
1610
|
+
/**
|
|
1611
|
+
* Replace all attributes of first object with the ones provided by the second, but keeps the reference
|
|
1612
|
+
*/
|
|
1613
|
+
declare function replaceObjectKeepingReference(obj: Literal | null, newObj: Literal | null): void;
|
|
1614
|
+
/**
|
|
1615
|
+
* Get contrasted color for text in the slider thumb
|
|
1616
|
+
* @param hexBgColor string in hexadecimals representing the background color
|
|
1617
|
+
*/
|
|
1618
|
+
declare function getForegroundColor(hexBgColor: string): 'black' | 'white';
|
|
1619
|
+
/**
|
|
1620
|
+
* Convert RGB color to hexadecimal color
|
|
1621
|
+
*
|
|
1622
|
+
* ```ts
|
|
1623
|
+
* rgbToHex('rgb(255, 00, 255)'); // '#FF00FF'
|
|
1624
|
+
* ```
|
|
1625
|
+
*/
|
|
1626
|
+
declare function rgbToHex(rgb: string): string;
|
|
1627
|
+
/**
|
|
1628
|
+
* Deep clone given values except for `File` that will be referencing the original value
|
|
1629
|
+
*/
|
|
1630
|
+
declare function cloneDeepButSkipFile<T>(value: T): T;
|
|
1631
|
+
declare function isFile(value: unknown): boolean;
|
|
1632
|
+
/**
|
|
1633
|
+
* During lodash.mergeWith, overrides arrays
|
|
1634
|
+
*/
|
|
1635
|
+
declare function mergeOverrideArray(destValue: unknown, source: unknown): unknown;
|
|
1636
|
+
/**
|
|
1637
|
+
* Copy text to clipboard.
|
|
1638
|
+
* Accepts line breaks `\n` as textarea do.
|
|
1639
|
+
*/
|
|
1640
|
+
declare function copyToClipboard(document: Document, text: string): void;
|
|
1641
|
+
declare function deepFreeze<T extends Literal>(o: T): ReadonlyDeep<T>;
|
|
1642
|
+
/**
|
|
1643
|
+
* Return a valid PaginationInput from whatever is available from data. Invalid properties/types will be dropped.
|
|
1644
|
+
*/
|
|
1645
|
+
declare function validatePagination(data: unknown): PaginationInput | null;
|
|
1646
|
+
/**
|
|
1647
|
+
* Return a valid Sortings from whatever is available from data. Invalid properties/types will be dropped.
|
|
1648
|
+
*/
|
|
1649
|
+
declare function validateSorting(data: unknown): Sorting[] | null;
|
|
1650
|
+
/**
|
|
1651
|
+
* Return valid columns from whatever is available from data. Invalid properties/types will be dropped.
|
|
1652
|
+
*/
|
|
1653
|
+
declare function validateColumns(data: unknown): string[] | null;
|
|
1654
|
+
declare function onHistoryEvent(router: Router): Observable<NavigationEnd>;
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* Returns an async validator function that checks that the form control value is unique
|
|
1658
|
+
*/
|
|
1659
|
+
declare function unique(fieldName: string, excludedId: string | null | undefined, modelService: UntypedModelService): AsyncValidatorFn;
|
|
1660
|
+
/**
|
|
1661
|
+
* Returns an async validator function that checks that the form control value is available
|
|
1662
|
+
*
|
|
1663
|
+
* Similar to `unique` validator, but allows to use a custom query for when the client does
|
|
1664
|
+
* not have permissions for `modelService.count()`.
|
|
1665
|
+
*/
|
|
1666
|
+
declare function available(getAvailableQuery: (value: string, excludedId: string | null) => Observable<boolean>, excludedId?: string | null): AsyncValidatorFn;
|
|
1667
|
+
/**
|
|
1668
|
+
* Return all errors recursively for the given Form or control
|
|
1669
|
+
*/
|
|
1670
|
+
declare function collectErrors(control: AbstractControl<unknown>): ValidationErrors | null;
|
|
1671
|
+
/**
|
|
1672
|
+
* Force validation of all form controls recursively.
|
|
1673
|
+
*
|
|
1674
|
+
* Recursively mark descending form tree as dirty and touched in order to show all invalid fields on demand.
|
|
1675
|
+
* Typically used when creating a new object and user clicked on create button but several fields were not
|
|
1676
|
+
* touched and are invalid.
|
|
1677
|
+
*/
|
|
1678
|
+
declare function validateAllFormControls(control: AbstractControl<unknown>): void;
|
|
1679
|
+
/**
|
|
1680
|
+
* Emits exactly 0 or 1 time:
|
|
1681
|
+
*
|
|
1682
|
+
* - if the form is VALID, emits immediately
|
|
1683
|
+
* - if the form is PENDING emits if it changes from PENDING to VALID
|
|
1684
|
+
* - any other cases will **never** emit
|
|
1685
|
+
*/
|
|
1686
|
+
declare function ifValid(control: AbstractControl): Observable<'VALID'>;
|
|
1687
|
+
/**
|
|
1688
|
+
* Validate an email address according to RFC, and also that it is publicly deliverable (not "root@localhost" or "root@127.0.0.1")
|
|
1689
|
+
*
|
|
1690
|
+
* This is meant to replace **all** usages of Angular too permissive `Validators.email`
|
|
1691
|
+
*/
|
|
1692
|
+
declare function deliverableEmail(control: AbstractControl): ValidationErrors | null;
|
|
1693
|
+
/**
|
|
1694
|
+
* Naive URL validator for "normal" web links, that is a bit too permissive
|
|
1695
|
+
*
|
|
1696
|
+
* It enforces:
|
|
1697
|
+
*
|
|
1698
|
+
* - http/https protocol
|
|
1699
|
+
* - one domain
|
|
1700
|
+
* - one tld
|
|
1701
|
+
*
|
|
1702
|
+
* It allows:
|
|
1703
|
+
*
|
|
1704
|
+
* - any number of subdomains
|
|
1705
|
+
* - any parameters
|
|
1706
|
+
* - any fragments
|
|
1707
|
+
* - any characters for any parts (does not conform to rfc1738)
|
|
1708
|
+
*/
|
|
1709
|
+
declare const urlValidator: ValidatorFn;
|
|
1710
|
+
/**
|
|
1711
|
+
* Validates that the value is an integer (non-float)
|
|
1712
|
+
*/
|
|
1713
|
+
declare function integer(control: AbstractControl): ValidationErrors | null;
|
|
1714
|
+
/**
|
|
1715
|
+
* Validate that the value is a decimal number with up to `scale` digits
|
|
1716
|
+
*
|
|
1717
|
+
* The error contains the expected scale, so that the error message can explain
|
|
1718
|
+
* it to the end-user.
|
|
1719
|
+
*/
|
|
1720
|
+
declare function decimal(scale: number): ValidatorFn;
|
|
1721
|
+
/**
|
|
1722
|
+
* Validate that the value is an amount of money, meaning a number with at most 2 decimals
|
|
1723
|
+
*/
|
|
1724
|
+
declare function money(control: AbstractControl): ValidationErrors | null;
|
|
1725
|
+
|
|
1726
|
+
type ProgressBar = {
|
|
1727
|
+
start: () => void;
|
|
1728
|
+
complete: () => void;
|
|
1729
|
+
};
|
|
1730
|
+
/**
|
|
1731
|
+
* Intercept HTTP request from Angular to show them as activity
|
|
1732
|
+
*/
|
|
1733
|
+
declare const activityInterceptor: HttpInterceptorFn;
|
|
1734
|
+
/**
|
|
1735
|
+
* Singleton to track pending XHR and XHR errors in the whole application.
|
|
1736
|
+
*
|
|
1737
|
+
* You must:
|
|
1738
|
+
*
|
|
1739
|
+
* - start the tracking by calling `setProgressRef()`
|
|
1740
|
+
* - provide the HTTP interceptor `activityInterceptor`
|
|
1741
|
+
*
|
|
1742
|
+
* The tracking will be entirely disabled for SSR.
|
|
1743
|
+
*/
|
|
1744
|
+
declare class NetworkActivityService {
|
|
1745
|
+
private progress;
|
|
1746
|
+
private readonly isBrowser;
|
|
1747
|
+
/**
|
|
1748
|
+
* Count pending requests
|
|
1749
|
+
*/
|
|
1750
|
+
private pending;
|
|
1751
|
+
private readonly writableErrors;
|
|
1752
|
+
/**
|
|
1753
|
+
* GraphQL errors that happened recently
|
|
1754
|
+
*/
|
|
1755
|
+
readonly errors: i0.Signal<GraphQLFormattedError[]>;
|
|
1756
|
+
setProgressRef(progressBar: ProgressBar): void;
|
|
1757
|
+
/**
|
|
1758
|
+
* Notify an XHR started
|
|
1759
|
+
*/
|
|
1760
|
+
increase(): void;
|
|
1761
|
+
/**
|
|
1762
|
+
* Notify an XHR ended (even if unsuccessful)
|
|
1763
|
+
*/
|
|
1764
|
+
decrease(): void;
|
|
1765
|
+
/**
|
|
1766
|
+
* Add new GraphQL errors
|
|
1767
|
+
*/
|
|
1768
|
+
addErrors(errors: readonly GraphQLFormattedError[]): void;
|
|
1769
|
+
/**
|
|
1770
|
+
* Clear all GraphQL errors
|
|
1771
|
+
*/
|
|
1772
|
+
clearErrors(): void;
|
|
1773
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NetworkActivityService, never>;
|
|
1774
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NetworkActivityService>;
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
/**
|
|
1778
|
+
* Array of valid top-level-domains
|
|
1779
|
+
* IanaVersion 2020033100
|
|
1780
|
+
*
|
|
1781
|
+
* This should ideally be kept in sync with \Laminas\Validator\Hostname
|
|
1782
|
+
*
|
|
1783
|
+
* See ftp://data.iana.org/TLD/tlds-alpha-by-domain.txt List of all TLDs by domain
|
|
1784
|
+
* See http://www.iana.org/domains/root/db/ Official list of supported TLDs
|
|
1785
|
+
*/
|
|
1786
|
+
declare const validTlds: readonly string[];
|
|
1787
|
+
|
|
1788
|
+
type IEnum = {
|
|
1789
|
+
value: string;
|
|
1790
|
+
name: string;
|
|
1791
|
+
};
|
|
1792
|
+
declare class NaturalEnumService {
|
|
1793
|
+
private readonly apollo;
|
|
1794
|
+
/**
|
|
1795
|
+
* Return a list of observable enumerables considering the given name
|
|
1796
|
+
*/
|
|
1797
|
+
get(name: string): Observable<IEnum[]>;
|
|
1798
|
+
/**
|
|
1799
|
+
* Returns the enum user-friendly name, instead of its value.
|
|
1800
|
+
*/
|
|
1801
|
+
getValueName(value: string, enumName: string): Observable<string>;
|
|
1802
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalEnumService, never>;
|
|
1803
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalEnumService>;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
declare class NaturalSwissParsingDateAdapter extends NativeDateAdapter {
|
|
1807
|
+
/**
|
|
1808
|
+
* Parse commonly accepted swiss format, such as:
|
|
1809
|
+
*
|
|
1810
|
+
* - 24.12.2018
|
|
1811
|
+
* - 1.4.18
|
|
1812
|
+
* - 2018-12-24
|
|
1813
|
+
*/
|
|
1814
|
+
parse(value: unknown): Date | null;
|
|
1815
|
+
private createDateIfValid;
|
|
1816
|
+
getFirstDayOfWeek(): number;
|
|
1817
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSwissParsingDateAdapter, never>;
|
|
1818
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalSwissParsingDateAdapter>;
|
|
1819
|
+
}
|
|
1820
|
+
|
|
1821
|
+
type NaturalConfirmData = {
|
|
1822
|
+
title: string;
|
|
1823
|
+
message: string;
|
|
1824
|
+
confirmText: string;
|
|
1825
|
+
cancelText: string;
|
|
1826
|
+
};
|
|
1827
|
+
declare class NaturalConfirmComponent {
|
|
1828
|
+
readonly data: NaturalConfirmData;
|
|
1829
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalConfirmComponent, never>;
|
|
1830
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalConfirmComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1833
|
+
declare class NaturalColumnsPickerComponent implements OnChanges {
|
|
1834
|
+
private readonly destroyRef;
|
|
1835
|
+
private readonly breakpointObserver;
|
|
1836
|
+
private _selections?;
|
|
1837
|
+
private _availableColumns;
|
|
1838
|
+
readonly buttons: i0.InputSignal<readonly Readonly<Button>[] | null>;
|
|
1839
|
+
/**
|
|
1840
|
+
* Set all the columns that are available.
|
|
1841
|
+
*/
|
|
1842
|
+
set availableColumns(columns: readonly Readonly<AvailableColumn>[] | undefined);
|
|
1843
|
+
/**
|
|
1844
|
+
* Set the columns that we would like to select but might be unavailable.
|
|
1845
|
+
*
|
|
1846
|
+
* If a column is unavailable it will be ignored silently. To know what columns were actually applied
|
|
1847
|
+
* you should use `selectionChange`.
|
|
1848
|
+
*
|
|
1849
|
+
* It is often set once on component initialization, but it can also be set again later in the lifespan of the component.
|
|
1850
|
+
*/
|
|
1851
|
+
set selections(columns: string[] | undefined);
|
|
1852
|
+
/**
|
|
1853
|
+
* Emit a list of valid and selected column keys whenever the selection changes
|
|
1854
|
+
*/
|
|
1855
|
+
readonly selectionChange: i0.OutputEmitterRef<string[]>;
|
|
1856
|
+
/**
|
|
1857
|
+
* Displayed options in the dropdown menu
|
|
1858
|
+
*/
|
|
1859
|
+
displayedColumns: Required<AvailableColumn>[];
|
|
1860
|
+
readonly isMobile: rxjs.Observable<boolean>;
|
|
1861
|
+
private initColumns;
|
|
1862
|
+
updateColumns(): void;
|
|
1863
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
1864
|
+
defaultTrue(value: boolean | undefined): boolean;
|
|
1865
|
+
color(button: Button): ThemePalette | null;
|
|
1866
|
+
useCheckbox(button: Button): boolean;
|
|
1867
|
+
needMargin(button?: Button | null): string;
|
|
1868
|
+
someVisibleButtons(): boolean;
|
|
1869
|
+
protected menuItemClicked($event: MouseEvent, column: Required<AvailableColumn>): void;
|
|
1870
|
+
protected checkboxClicked($event: MouseEvent, column: Required<AvailableColumn>): void;
|
|
1871
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalColumnsPickerComponent, never>;
|
|
1872
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalColumnsPickerComponent, "natural-columns-picker", never, { "buttons": { "alias": "buttons"; "required": false; "isSignal": true; }; "availableColumns": { "alias": "availableColumns"; "required": false; }; "selections": { "alias": "selections"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* Usage :
|
|
1877
|
+
*
|
|
1878
|
+
* ```html
|
|
1879
|
+
* <mat-tab-group [naturalLinkableTab]="!isPanel">
|
|
1880
|
+
* <mat-tab label="Tab 1">Tab 1</mat-tab> // First tab doesn't need id. This keeps url clean on default one
|
|
1881
|
+
* <mat-tab label="Tab 2" id="second-tab">Tab 2</mat-tab>
|
|
1882
|
+
* ...
|
|
1883
|
+
* </mat-tab-group>
|
|
1884
|
+
* ```
|
|
1885
|
+
*/
|
|
1886
|
+
declare class NaturalLinkableTabDirective implements AfterViewInit {
|
|
1887
|
+
private readonly destroyRef;
|
|
1888
|
+
private readonly component;
|
|
1889
|
+
private readonly route;
|
|
1890
|
+
private readonly router;
|
|
1891
|
+
/**
|
|
1892
|
+
* If false, disables the persistent navigation
|
|
1893
|
+
*/
|
|
1894
|
+
readonly naturalLinkableTab: i0.InputSignal<boolean | "">;
|
|
1895
|
+
private isLoadingRouteConfig;
|
|
1896
|
+
constructor();
|
|
1897
|
+
ngAfterViewInit(): void;
|
|
1898
|
+
private getTabIndex;
|
|
1899
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalLinkableTabDirective, never>;
|
|
1900
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalLinkableTabDirective, "mat-tab-group[naturalLinkableTab]", never, { "naturalLinkableTab": { "alias": "naturalLinkableTab"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* Returns the string with the first letter as capital
|
|
1905
|
+
*/
|
|
1906
|
+
declare class NaturalCapitalizePipe implements PipeTransform {
|
|
1907
|
+
transform(value: string | null): string | null;
|
|
1908
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalCapitalizePipe, never>;
|
|
1909
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<NaturalCapitalizePipe, "capitalize", true>;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
declare class NaturalEllipsisPipe implements PipeTransform {
|
|
1913
|
+
transform(value: string, limit: number): string;
|
|
1914
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalEllipsisPipe, never>;
|
|
1915
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<NaturalEllipsisPipe, "ellipsis", true>;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
/**
|
|
1919
|
+
* A pipe to output an enum user-friendly name, instead of its value.
|
|
1920
|
+
*
|
|
1921
|
+
* Usage would be: {{ element.priority | enum: 'Priority' | async }}
|
|
1922
|
+
*/
|
|
1923
|
+
declare class NaturalEnumPipe implements PipeTransform {
|
|
1924
|
+
private readonly enumService;
|
|
1925
|
+
transform(value: any, enumName: string): Observable<string>;
|
|
1926
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalEnumPipe, never>;
|
|
1927
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<NaturalEnumPipe, "enum", true>;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1930
|
+
/**
|
|
1931
|
+
* Returns a string to approximately describe the date.
|
|
1932
|
+
*
|
|
1933
|
+
* Eg:
|
|
1934
|
+
*
|
|
1935
|
+
* - "il y a quelques minutes"
|
|
1936
|
+
* - "dans 3 jours"
|
|
1937
|
+
* - "dans 3 ans"
|
|
1938
|
+
*/
|
|
1939
|
+
declare class NaturalTimeAgoPipe implements PipeTransform {
|
|
1940
|
+
fakedNow: number | null;
|
|
1941
|
+
private getNow;
|
|
1942
|
+
transform(date: Date | string | null | undefined): string;
|
|
1943
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalTimeAgoPipe, never>;
|
|
1944
|
+
static ɵpipe: i0.ɵɵPipeDeclaration<NaturalTimeAgoPipe, "timeAgo", true>;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
declare const SESSION_STORAGE: InjectionToken<NaturalStorage>;
|
|
1948
|
+
declare const LOCAL_STORAGE: InjectionToken<NaturalStorage>;
|
|
1949
|
+
/**
|
|
1950
|
+
* Normal `Storage` type, but without array access
|
|
1951
|
+
*/
|
|
1952
|
+
type NaturalStorage = Pick<Storage, 'length' | 'clear' | 'getItem' | 'key' | 'removeItem' | 'setItem'>;
|
|
1953
|
+
/**
|
|
1954
|
+
* Memory storage to keep store volatile things in memory
|
|
1955
|
+
*
|
|
1956
|
+
* Should be used to shim sessionStorage when running on server or in our tests
|
|
1957
|
+
*/
|
|
1958
|
+
declare class NaturalMemoryStorage implements NaturalStorage {
|
|
1959
|
+
private readonly data;
|
|
1960
|
+
get length(): number;
|
|
1961
|
+
clear(): void;
|
|
1962
|
+
getItem(key: string): string | null;
|
|
1963
|
+
key(index: number): string | null;
|
|
1964
|
+
removeItem(key: string): void;
|
|
1965
|
+
setItem(key: string, value: string): void;
|
|
1966
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalMemoryStorage, never>;
|
|
1967
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalMemoryStorage>;
|
|
1968
|
+
}
|
|
1969
|
+
declare function sessionStorageFactory(): NaturalStorage;
|
|
1970
|
+
/**
|
|
1971
|
+
* Standard `sessionStorage` provider that is compatible with SSR.
|
|
1972
|
+
*
|
|
1973
|
+
* In SSR environment, or when `sessionStorage` is not available, will return a `NaturalMemoryStorage`
|
|
1974
|
+
*/
|
|
1975
|
+
declare const sessionStorageProvider: Provider;
|
|
1976
|
+
/**
|
|
1977
|
+
* Provide in-memory session storage to be used only in tests or SSR
|
|
1978
|
+
*/
|
|
1979
|
+
declare const memorySessionStorageProvider: Provider;
|
|
1980
|
+
declare function localStorageFactory(): NaturalStorage;
|
|
1981
|
+
/**
|
|
1982
|
+
* Standard `localStorage` provider that is compatible with SSR.
|
|
1983
|
+
*
|
|
1984
|
+
* In SSR environment, or when `localStorage` is not available, will return a `NaturalMemoryStorage`
|
|
1985
|
+
*/
|
|
1986
|
+
declare const localStorageProvider: Provider;
|
|
1987
|
+
/**
|
|
1988
|
+
* Provide in-memory local storage to be used only in tests or SSR
|
|
1989
|
+
*/
|
|
1990
|
+
declare const memoryLocalStorageProvider: Provider;
|
|
1991
|
+
|
|
1992
|
+
declare class NaturalSrcDensityDirective {
|
|
1993
|
+
private readonly elementRef;
|
|
1994
|
+
/**
|
|
1995
|
+
* Automatically apply image selection based on screen density.
|
|
1996
|
+
*
|
|
1997
|
+
* The given URL **MUST** be the normal density URL. And it **MUST** include
|
|
1998
|
+
* the size as last path segment. That size will automatically be changed
|
|
1999
|
+
* for other screen densities. That means that the server **MUST** be able to
|
|
2000
|
+
* serve an image of the given size.
|
|
2001
|
+
*
|
|
2002
|
+
* Usage:
|
|
2003
|
+
*
|
|
2004
|
+
* ```html
|
|
2005
|
+
* <img naturalSrcDensity="/api/image/123/200" />
|
|
2006
|
+
* ```
|
|
2007
|
+
*
|
|
2008
|
+
* Will generate something like:
|
|
2009
|
+
*
|
|
2010
|
+
* ```html
|
|
2011
|
+
* <img
|
|
2012
|
+
* src="/api/image/123/200"
|
|
2013
|
+
* srcset="/api/image/123/200, /api/image/123/300 1.5x, /api/image/123/400 2x, /api/image/123/600 3x, /api/image/123/800 4x"
|
|
2014
|
+
* />
|
|
2015
|
+
* ```
|
|
2016
|
+
*
|
|
2017
|
+
* See https://web.dev/codelab-density-descriptors/
|
|
2018
|
+
*/
|
|
2019
|
+
readonly naturalSrcDensity: i0.InputSignal<string>;
|
|
2020
|
+
constructor();
|
|
2021
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSrcDensityDirective, never>;
|
|
2022
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalSrcDensityDirective, "img[naturalSrcDensity]", never, { "naturalSrcDensity": { "alias": "naturalSrcDensity"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
declare class NaturalBackgroundDensityDirective {
|
|
2026
|
+
private readonly elementRef;
|
|
2027
|
+
/**
|
|
2028
|
+
* Automatically apply background image selection based on screen density.
|
|
2029
|
+
*
|
|
2030
|
+
* The given URL **MUST** be the normal density URL. And it **MUST** include
|
|
2031
|
+
* the size as last path segment. That size will automatically be changed
|
|
2032
|
+
* for other screen densities. That means that the server **MUST** be able to
|
|
2033
|
+
* serve an image of the given size.
|
|
2034
|
+
*
|
|
2035
|
+
* If the given URL starts with `url(`, or is not ending with a number, then
|
|
2036
|
+
* it will be set as-is, without any processing. This allows using url data,
|
|
2037
|
+
* such as `url(data:image/png;base64,aabbcc)`.
|
|
2038
|
+
*
|
|
2039
|
+
* Usage:
|
|
2040
|
+
*
|
|
2041
|
+
* ```html
|
|
2042
|
+
* <div naturalBackgroundDensity="/api/image/123/200"></div>
|
|
2043
|
+
* <div naturalBackgroundDensity="/non-responsive.jpg"></div>
|
|
2044
|
+
* <div naturalBackgroundDensity="url(data:image/png;base64,aabbcc)"></div>
|
|
2045
|
+
* ```
|
|
2046
|
+
*
|
|
2047
|
+
* Will generate something like:
|
|
2048
|
+
*
|
|
2049
|
+
* ```html
|
|
2050
|
+
* <div style="background-image: image-set(url("/api/image/123/200") 1x, url("/api/image/123/300") 1.5x, url("/api/image/123/400") 2x, url("/api/image/123/600") 3x, url("/api/image/123/800") 4x);"></div>
|
|
2051
|
+
* <div style="background-image: url("/non-responsive.jpg");"></div>
|
|
2052
|
+
* <div style="background-image: url(data:image/png;base64,aabbcc)"></div>
|
|
2053
|
+
* ```
|
|
2054
|
+
*
|
|
2055
|
+
* See https://developer.mozilla.org/en-US/docs/Web/CSS/image/image-set
|
|
2056
|
+
*/
|
|
2057
|
+
readonly naturalBackgroundDensity: i0.InputSignal<string>;
|
|
2058
|
+
constructor();
|
|
2059
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalBackgroundDensityDirective, never>;
|
|
2060
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalBackgroundDensityDirective, "[naturalBackgroundDensity]", never, { "naturalBackgroundDensity": { "alias": "naturalBackgroundDensity"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
2063
|
+
type NaturalSeo = NaturalSeoBasic | NaturalSeoCallback | NaturalSeoResolve;
|
|
2064
|
+
/**
|
|
2065
|
+
* Typically used for "static" pages where there is not a single resolved object. So
|
|
2066
|
+
* all pages such as "About", or list of objects (list of risks, etc.).
|
|
2067
|
+
*
|
|
2068
|
+
* This should be the most common used variant.
|
|
2069
|
+
*/
|
|
2070
|
+
type NaturalSeoBasic = Robots & {
|
|
2071
|
+
/**
|
|
2072
|
+
* The page title, that will be concatenated with application name
|
|
2073
|
+
*/
|
|
2074
|
+
title: string;
|
|
2075
|
+
/**
|
|
2076
|
+
* If given will be used as page description, otherwise fallback on default value
|
|
2077
|
+
*/
|
|
2078
|
+
description?: string;
|
|
2079
|
+
/**
|
|
2080
|
+
* List of parameters included in the canonical tag's url
|
|
2081
|
+
*/
|
|
2082
|
+
canonicalQueryParamsWhitelist?: string[];
|
|
2083
|
+
};
|
|
2084
|
+
/**
|
|
2085
|
+
* Typically used for a "dynamic" page where a single object is resolved. So a detail page, such
|
|
2086
|
+
* as the detail of a risk and so on.
|
|
2087
|
+
*/
|
|
2088
|
+
type NaturalSeoResolve = Robots & {
|
|
2089
|
+
/**
|
|
2090
|
+
* The key `model` will be used in the resolved data to find the resolved object. The fullName
|
|
2091
|
+
* or name of the object will be used for page title, and the object description, if any,
|
|
2092
|
+
* will be used for page description.
|
|
2093
|
+
*/
|
|
2094
|
+
resolve: true;
|
|
2095
|
+
};
|
|
2096
|
+
/**
|
|
2097
|
+
* Rarely used for a page that has very specific needs and need to build title and description in a custom way.
|
|
2098
|
+
* The callback back will be given the resolved data, and it is up to the callback to find whatever it needs.
|
|
2099
|
+
*/
|
|
2100
|
+
type NaturalSeoCallback = (routeData: Data$1) => NaturalSeoBasic | Observable<NaturalSeoBasic>;
|
|
2101
|
+
/**
|
|
2102
|
+
* Typically used to type the routing data received in the component, eg:
|
|
2103
|
+
*
|
|
2104
|
+
* ```ts
|
|
2105
|
+
* class MyComponent extends NaturalAbstractDetail<MyService, NaturalSeoResolveData> {}
|
|
2106
|
+
* ```
|
|
2107
|
+
*/
|
|
2108
|
+
type NaturalSeoResolveData = {
|
|
2109
|
+
seo: NaturalSeoBasic;
|
|
2110
|
+
};
|
|
2111
|
+
type Robots = {
|
|
2112
|
+
/**
|
|
2113
|
+
* If given will be used as robots meta tag, otherwise fallback on default value
|
|
2114
|
+
*/
|
|
2115
|
+
robots?: string;
|
|
2116
|
+
};
|
|
2117
|
+
type NaturalSeoConfigPlain = {
|
|
2118
|
+
/**
|
|
2119
|
+
* The name of the application that will always appear in the page title
|
|
2120
|
+
*/
|
|
2121
|
+
readonly applicationName: string;
|
|
2122
|
+
/**
|
|
2123
|
+
* Default value for description meta that is used for pages without value
|
|
2124
|
+
*/
|
|
2125
|
+
readonly defaultDescription?: string;
|
|
2126
|
+
/**
|
|
2127
|
+
* Default value for robots meta that is used for pages without value
|
|
2128
|
+
*/
|
|
2129
|
+
readonly defaultRobots?: string;
|
|
2130
|
+
/**
|
|
2131
|
+
* If given, the callback will be called for each route and must return a string that will
|
|
2132
|
+
* be inserted between the page title and the application name.
|
|
2133
|
+
*
|
|
2134
|
+
* It should be used to complete the title with info that are often, but not necessarily always,
|
|
2135
|
+
* available throughout the entire application. Typically used for the site/state in OKpilot.
|
|
2136
|
+
*/
|
|
2137
|
+
readonly extraPart?: (routeData: Data$1) => string;
|
|
2138
|
+
/**
|
|
2139
|
+
* Used to generate alternative tags
|
|
2140
|
+
* <link rel="alternate" hreflang="en" href="https://www.example.com/en/page">
|
|
2141
|
+
*/
|
|
2142
|
+
readonly languages?: readonly string[];
|
|
2143
|
+
};
|
|
2144
|
+
type NaturalSeoConfig = NaturalSeoConfigPlain | Observable<NaturalSeoConfigPlain>;
|
|
2145
|
+
declare const NATURAL_SEO_CONFIG: InjectionToken<NaturalSeoConfig>;
|
|
2146
|
+
/**
|
|
2147
|
+
* This service is responsible to keep up to date the page title and page description according
|
|
2148
|
+
* to what is configured in routing or default values.
|
|
2149
|
+
*
|
|
2150
|
+
* It **must** be injected in the root module of the application to have effects in all modules. And it
|
|
2151
|
+
* must be provided a configuration.
|
|
2152
|
+
*
|
|
2153
|
+
* The full title has the following structure:
|
|
2154
|
+
*
|
|
2155
|
+
* dialog title - page title - extra part - app name
|
|
2156
|
+
*
|
|
2157
|
+
* `dialog title` only exists if a `NaturalDialogTriggerComponent` is currently open, and that some SEO is
|
|
2158
|
+
* configured for it in the routing.
|
|
2159
|
+
*/
|
|
2160
|
+
declare class NaturalSeoService {
|
|
2161
|
+
private readonly router;
|
|
2162
|
+
private readonly titleService;
|
|
2163
|
+
private readonly metaTagService;
|
|
2164
|
+
private readonly document;
|
|
2165
|
+
private locale;
|
|
2166
|
+
private routeData?;
|
|
2167
|
+
private config;
|
|
2168
|
+
constructor();
|
|
2169
|
+
/**
|
|
2170
|
+
* Update the SEO with given info. The extra part and app name will be appended automatically.
|
|
2171
|
+
*
|
|
2172
|
+
* In most cases, this should not be used. And instead, the SEO should be configured in the routing,
|
|
2173
|
+
* possibly with the callback variant for some dynamism.
|
|
2174
|
+
*
|
|
2175
|
+
* But in rare cases, only the Component is able to build a proper page title, after it gathered everything it
|
|
2176
|
+
* needed. For those cases, the Component can inject this service and update the SEO directly.
|
|
2177
|
+
*/
|
|
2178
|
+
update(seo: NaturalSeoBasic): void;
|
|
2179
|
+
private updateAlternates;
|
|
2180
|
+
private getUrlParts;
|
|
2181
|
+
/**
|
|
2182
|
+
* Add language between domain and uri https://example.com/fr/folder/page
|
|
2183
|
+
*/
|
|
2184
|
+
private getUrl;
|
|
2185
|
+
private addLanguageSegment;
|
|
2186
|
+
private join;
|
|
2187
|
+
private updateTag;
|
|
2188
|
+
private updateLinkTag;
|
|
2189
|
+
/**
|
|
2190
|
+
* Returns selector to use in querySelector to get the given link
|
|
2191
|
+
*/
|
|
2192
|
+
private parseSelector;
|
|
2193
|
+
/**
|
|
2194
|
+
* Returns the data from the most deep/specific activated route
|
|
2195
|
+
*/
|
|
2196
|
+
private getRouteData;
|
|
2197
|
+
/**
|
|
2198
|
+
* Returns the data from the `NaturalDialogTriggerComponent` if one is open
|
|
2199
|
+
*/
|
|
2200
|
+
private getDialogRouteData;
|
|
2201
|
+
private toBasic;
|
|
2202
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSeoService, never>;
|
|
2203
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalSeoService>;
|
|
2204
|
+
}
|
|
2205
|
+
|
|
2206
|
+
/**
|
|
2207
|
+
* Configure and starts `NaturalSeoService`
|
|
2208
|
+
*/
|
|
2209
|
+
declare function provideSeo(config: NaturalSeoConfig): (EnvironmentProviders | Provider)[];
|
|
2210
|
+
|
|
2211
|
+
declare class NaturalDetailHeaderComponent {
|
|
2212
|
+
/**
|
|
2213
|
+
* Base URL used to build links, defaults to '/'
|
|
2214
|
+
*/
|
|
2215
|
+
readonly currentBaseUrl: i0.InputSignal<string | undefined>;
|
|
2216
|
+
/**
|
|
2217
|
+
* Must be set to get proper links when used in panels
|
|
2218
|
+
*/
|
|
2219
|
+
readonly isPanel: i0.InputSignal<boolean>;
|
|
2220
|
+
/**
|
|
2221
|
+
* If given will show icon before title
|
|
2222
|
+
*/
|
|
2223
|
+
icon: string;
|
|
2224
|
+
/**
|
|
2225
|
+
* Title shown if model has no name, or empty name.
|
|
2226
|
+
*
|
|
2227
|
+
* Typically should be the human name for the object type, eg: 'Product'
|
|
2228
|
+
*/
|
|
2229
|
+
label: string;
|
|
2230
|
+
/**
|
|
2231
|
+
* Label of the root of the breadcrumb, defaults to the value of `label`.
|
|
2232
|
+
*
|
|
2233
|
+
* Typically should be the plural form of the object type, eg: 'Products'
|
|
2234
|
+
*/
|
|
2235
|
+
rootLabel: string;
|
|
2236
|
+
/**
|
|
2237
|
+
* Title shown if model has no id.
|
|
2238
|
+
*
|
|
2239
|
+
* Typically should be similar to 'New product'.
|
|
2240
|
+
*/
|
|
2241
|
+
readonly newLabel: i0.InputSignal<string>;
|
|
2242
|
+
model: Literal;
|
|
2243
|
+
readonly breadcrumbs: i0.InputSignal<NameOrFullName[]>;
|
|
2244
|
+
readonly listRoute: i0.InputSignal<any[]>;
|
|
2245
|
+
readonly listFragment: i0.InputSignal<string | undefined>;
|
|
2246
|
+
readonly link: i0.InputSignal<((id: string) => any[]) | undefined>;
|
|
2247
|
+
getRootLink(): string[];
|
|
2248
|
+
getLink(id: string): any[];
|
|
2249
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalDetailHeaderComponent, never>;
|
|
2250
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalDetailHeaderComponent, "natural-detail-header", never, { "currentBaseUrl": { "alias": "currentBaseUrl"; "required": false; "isSignal": true; }; "isPanel": { "alias": "isPanel"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; }; "label": { "alias": "label"; "required": false; }; "rootLabel": { "alias": "rootLabel"; "required": false; }; "newLabel": { "alias": "newLabel"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": true; }; "breadcrumbs": { "alias": "breadcrumbs"; "required": false; "isSignal": true; }; "listRoute": { "alias": "listRoute"; "required": false; "isSignal": true; }; "listFragment": { "alias": "listFragment"; "required": false; "isSignal": true; }; "link": { "alias": "link"; "required": false; "isSignal": true; }; }, {}, never, ["*"], true, never>;
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
type PossibleComparableOpertorKeys = keyof Pick<FilterGroupConditionField, 'less' | 'lessOrEqual' | 'equal' | 'greaterOrEqual' | 'greater'>;
|
|
2254
|
+
type PossibleComparableOperator = {
|
|
2255
|
+
key: PossibleComparableOpertorKeys;
|
|
2256
|
+
label: string;
|
|
2257
|
+
};
|
|
2258
|
+
declare const possibleComparableOperators: readonly PossibleComparableOperator[];
|
|
2259
|
+
type PossibleDiscreteOperatorKeys = 'is' | 'isnot' | 'any' | 'none';
|
|
2260
|
+
type PossibleDiscreteOperator = {
|
|
2261
|
+
key: PossibleDiscreteOperatorKeys;
|
|
2262
|
+
label: string;
|
|
2263
|
+
};
|
|
2264
|
+
|
|
2265
|
+
type TypeSelectItem = Scalar | {
|
|
2266
|
+
id: Scalar;
|
|
2267
|
+
name: Scalar;
|
|
2268
|
+
} | {
|
|
2269
|
+
value: Scalar;
|
|
2270
|
+
name: Scalar;
|
|
2271
|
+
};
|
|
2272
|
+
type TypeSelectConfiguration = {
|
|
2273
|
+
items: TypeSelectItem[] | Observable<TypeSelectItem[]>;
|
|
2274
|
+
multiple?: boolean;
|
|
2275
|
+
/**
|
|
2276
|
+
* If true (default) a selectbox allows to choose an operator. Otherwise, the selectbox is hidden and the operator will always be `is`.
|
|
2277
|
+
*/
|
|
2278
|
+
operators?: boolean;
|
|
2279
|
+
};
|
|
2280
|
+
declare class TypeSelectComponent implements DropdownComponent, AfterViewInit {
|
|
2281
|
+
private readonly destroyRef;
|
|
2282
|
+
readonly renderedValue: BehaviorSubject<string>;
|
|
2283
|
+
readonly list: i0.Signal<MatSelectionList | undefined>;
|
|
2284
|
+
requireValueCtrl: boolean;
|
|
2285
|
+
readonly operators: readonly PossibleDiscreteOperator[];
|
|
2286
|
+
readonly operatorCtrl: FormControl<PossibleDiscreteOperatorKeys>;
|
|
2287
|
+
readonly valueCtrl: FormControl<any>;
|
|
2288
|
+
readonly form: FormGroup<{
|
|
2289
|
+
operator: FormControl<PossibleDiscreteOperatorKeys>;
|
|
2290
|
+
value: FormControl<any>;
|
|
2291
|
+
}>;
|
|
2292
|
+
items: TypeSelectItem[];
|
|
2293
|
+
readonly configuration: Required<TypeSelectConfiguration>;
|
|
2294
|
+
private readonly defaults;
|
|
2295
|
+
constructor();
|
|
2296
|
+
ngAfterViewInit(): void;
|
|
2297
|
+
getId(item: TypeSelectItem): Scalar;
|
|
2298
|
+
getDisplay(item: TypeSelectItem): Scalar;
|
|
2299
|
+
getCondition(): FilterGroupConditionField;
|
|
2300
|
+
isValid(): boolean;
|
|
2301
|
+
isDirty(): boolean;
|
|
2302
|
+
private initValidators;
|
|
2303
|
+
private isMultiple;
|
|
2304
|
+
private getItemById;
|
|
2305
|
+
private reloadCondition;
|
|
2306
|
+
/**
|
|
2307
|
+
* Reload the value from API (`operatorCtrl` should not be touched)
|
|
2308
|
+
*/
|
|
2309
|
+
private reloadValue;
|
|
2310
|
+
private getRenderedValue;
|
|
2311
|
+
private conditionToOperatorKey;
|
|
2312
|
+
private operatorKeyToCondition;
|
|
2313
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TypeSelectComponent, never>;
|
|
2314
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TypeSelectComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
declare abstract class AbstractAssociationSelectComponent<C> implements DropdownComponent {
|
|
2318
|
+
readonly configuration: C;
|
|
2319
|
+
readonly renderedValue: BehaviorSubject<string>;
|
|
2320
|
+
requireValueCtrl: boolean;
|
|
2321
|
+
readonly operators: readonly PossibleDiscreteOperator[];
|
|
2322
|
+
readonly operatorCtrl: FormControl<PossibleDiscreteOperatorKeys>;
|
|
2323
|
+
readonly valueCtrl: FormControl<any>;
|
|
2324
|
+
readonly form: FormGroup<{
|
|
2325
|
+
operator: FormControl<PossibleDiscreteOperatorKeys>;
|
|
2326
|
+
value: FormControl<any>;
|
|
2327
|
+
}>;
|
|
2328
|
+
constructor();
|
|
2329
|
+
/**
|
|
2330
|
+
* Reload the value from API (`operatorCtrl` should not be touched)
|
|
2331
|
+
*/
|
|
2332
|
+
protected abstract reloadValue(condition: FilterGroupConditionField): Observable<unknown>;
|
|
2333
|
+
protected abstract renderValueWithoutOperator(): string;
|
|
2334
|
+
abstract getCondition(): FilterGroupConditionField;
|
|
2335
|
+
isValid(): boolean;
|
|
2336
|
+
isDirty(): boolean;
|
|
2337
|
+
private initValidators;
|
|
2338
|
+
private reloadCondition;
|
|
2339
|
+
protected getRenderedValue(): string;
|
|
2340
|
+
protected conditionToOperatorKey(condition: FilterGroupConditionField): PossibleDiscreteOperatorKeys;
|
|
2341
|
+
protected operatorKeyToCondition(key: PossibleDiscreteOperatorKeys, values: string[]): FilterGroupConditionField;
|
|
2342
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AbstractAssociationSelectComponent<any>, never>;
|
|
2343
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractAssociationSelectComponent<any>, never, never, {}, {}, never, never, true, never>;
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
type TypeSelectNaturalConfiguration<TService extends UntypedModelService> = {
|
|
2347
|
+
service: TService;
|
|
2348
|
+
placeholder: string;
|
|
2349
|
+
filter?: ExtractVall<TService>['filter'];
|
|
2350
|
+
pageSize?: number;
|
|
2351
|
+
};
|
|
2352
|
+
declare class TypeNaturalSelectComponent<TService extends UntypedModelService> extends AbstractAssociationSelectComponent<TypeSelectNaturalConfiguration<TService>> {
|
|
2353
|
+
getCondition(): FilterGroupConditionField;
|
|
2354
|
+
protected reloadValue(condition: FilterGroupConditionField): Observable<ExtractTone<TService>>;
|
|
2355
|
+
protected renderValueWithoutOperator(): string;
|
|
2356
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TypeNaturalSelectComponent<any>, never>;
|
|
2357
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TypeNaturalSelectComponent<any>, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
type NaturalDropdownContainerData = {
|
|
2361
|
+
showValidateButton: boolean;
|
|
2362
|
+
};
|
|
2363
|
+
declare class NaturalDropdownContainerComponent extends BasePortalOutlet implements OnDestroy {
|
|
2364
|
+
private readonly elementRef;
|
|
2365
|
+
private readonly focusTrapFactory;
|
|
2366
|
+
readonly data: NaturalDropdownContainerData;
|
|
2367
|
+
readonly portalOutlet: i0.Signal<CdkPortalOutlet>;
|
|
2368
|
+
readonly closed: Subject<void>;
|
|
2369
|
+
/** Current state of the panel animation. */
|
|
2370
|
+
protected panelAnimationState: 'void' | 'enter';
|
|
2371
|
+
private focusTrap;
|
|
2372
|
+
private elementFocusedBeforeDialogWasOpened;
|
|
2373
|
+
ngOnDestroy(): void;
|
|
2374
|
+
close(): void;
|
|
2375
|
+
attachTemplatePortal<C>(portal: TemplatePortal<C>): EmbeddedViewRef<C>;
|
|
2376
|
+
attachComponentPortal<T>(portal: ComponentPortal<T>): ComponentRef<T>;
|
|
2377
|
+
/** Callback that is invoked when the panel animation completes. */
|
|
2378
|
+
protected onAnimationDone(state: string): void;
|
|
2379
|
+
private trapFocus;
|
|
2380
|
+
/** Restores focus to the element that was focused before the dialog opened. */
|
|
2381
|
+
private restoreFocus;
|
|
2382
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalDropdownContainerComponent, never>;
|
|
2383
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalDropdownContainerComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
declare class NaturalDropdownRef {
|
|
2387
|
+
private readonly dropdownContainer;
|
|
2388
|
+
readonly componentInstance: DropdownComponent;
|
|
2389
|
+
readonly closed: Subject<DropdownResult | undefined>;
|
|
2390
|
+
constructor(dropdownContainer: NaturalDropdownContainerComponent, component: ComponentType<DropdownComponent>, customProviders: StaticProvider[], parentInjector: Injector, containerRef: ComponentRef<NaturalDropdownContainerComponent>);
|
|
2391
|
+
close(result?: DropdownResult): void;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2394
|
+
/**
|
|
2395
|
+
* Show an error message if the control has a value and an error, even if control is not dirty and not touched.
|
|
2396
|
+
*/
|
|
2397
|
+
declare class InvalidWithValueStateMatcher$1 implements ErrorStateMatcher {
|
|
2398
|
+
isErrorState(control: FormControl | null): boolean;
|
|
2399
|
+
}
|
|
2400
|
+
declare class TypeTextComponent implements DropdownComponent {
|
|
2401
|
+
protected dropdownRef: NaturalDropdownRef;
|
|
2402
|
+
readonly renderedValue: BehaviorSubject<string>;
|
|
2403
|
+
readonly formCtrl: FormControl<string>;
|
|
2404
|
+
readonly matcher: InvalidWithValueStateMatcher$1;
|
|
2405
|
+
constructor();
|
|
2406
|
+
getCondition(): FilterGroupConditionField;
|
|
2407
|
+
isValid(): boolean;
|
|
2408
|
+
isDirty(): boolean;
|
|
2409
|
+
close(): void;
|
|
2410
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TypeTextComponent, never>;
|
|
2411
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TypeTextComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
type TypeNumberConfiguration = {
|
|
2415
|
+
min?: number | null;
|
|
2416
|
+
max?: number | null;
|
|
2417
|
+
step?: number | null;
|
|
2418
|
+
};
|
|
2419
|
+
declare class TypeNumberComponent implements DropdownComponent {
|
|
2420
|
+
protected dropdownRef: NaturalDropdownRef;
|
|
2421
|
+
readonly renderedValue: BehaviorSubject<string>;
|
|
2422
|
+
readonly configuration: Required<TypeNumberConfiguration>;
|
|
2423
|
+
readonly operatorCtrl: FormControl<"equal" | "greater" | "greaterOrEqual" | "less" | "lessOrEqual">;
|
|
2424
|
+
readonly valueCtrl: FormControl<any>;
|
|
2425
|
+
readonly matcher: InvalidWithValueStateMatcher$1;
|
|
2426
|
+
readonly form: FormGroup<{
|
|
2427
|
+
operator: FormControl<"equal" | "greater" | "greaterOrEqual" | "less" | "lessOrEqual">;
|
|
2428
|
+
value: FormControl<any>;
|
|
2429
|
+
}>;
|
|
2430
|
+
readonly operators: readonly PossibleComparableOperator[];
|
|
2431
|
+
private readonly defaults;
|
|
2432
|
+
constructor();
|
|
2433
|
+
getCondition(): FilterGroupConditionField;
|
|
2434
|
+
isValid(): boolean;
|
|
2435
|
+
isDirty(): boolean;
|
|
2436
|
+
close(): void;
|
|
2437
|
+
private initValidators;
|
|
2438
|
+
private reloadCondition;
|
|
2439
|
+
private getRenderedValue;
|
|
2440
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TypeNumberComponent, never>;
|
|
2441
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TypeNumberComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2442
|
+
}
|
|
2443
|
+
|
|
2444
|
+
type NaturalHierarchicConfiguration<T extends UntypedModelService = UntypedModelService> = {
|
|
2445
|
+
/**
|
|
2446
|
+
* An AbstractModelService to be used to fetch items
|
|
2447
|
+
*/
|
|
2448
|
+
service: Type<T>;
|
|
2449
|
+
/**
|
|
2450
|
+
* A list of FilterConditionField name to filter items
|
|
2451
|
+
*
|
|
2452
|
+
* Those will be used directly to build filter to fetch items, so they must be
|
|
2453
|
+
* valid API FilterConditionField names for the given service.
|
|
2454
|
+
*
|
|
2455
|
+
* Eg: given the QuestionService, possible names would be:
|
|
2456
|
+
*
|
|
2457
|
+
* - "chapter" to filter by the question's chapter
|
|
2458
|
+
* - "parent" to filter by the question's parent question
|
|
2459
|
+
*/
|
|
2460
|
+
parentsRelationNames?: string[];
|
|
2461
|
+
/**
|
|
2462
|
+
* A list of FilterConditionField name to declare hierarchy
|
|
2463
|
+
*
|
|
2464
|
+
* Those must be the `parentsRelationNames` name, that correspond to this service,
|
|
2465
|
+
* of all children services.
|
|
2466
|
+
*
|
|
2467
|
+
* Eg: given the QuestionService, possible names would be:
|
|
2468
|
+
*
|
|
2469
|
+
* - "questions" coming from ChapterService
|
|
2470
|
+
* - "questions" coming from QuestionService
|
|
2471
|
+
*/
|
|
2472
|
+
childrenRelationNames?: string[];
|
|
2473
|
+
/**
|
|
2474
|
+
* Additional filters applied in the query sent by getList function
|
|
2475
|
+
*/
|
|
2476
|
+
filter?: QueryVariables['filter'];
|
|
2477
|
+
/**
|
|
2478
|
+
* Key of the returned literal container models by config / service
|
|
2479
|
+
*/
|
|
2480
|
+
selectableAtKey?: string;
|
|
2481
|
+
/**
|
|
2482
|
+
* Displayed icon for items retrieved for that config
|
|
2483
|
+
*/
|
|
2484
|
+
icon?: string;
|
|
2485
|
+
/**
|
|
2486
|
+
* Callback function that returns boolean. If true the item is selectable, if false, it's not.
|
|
2487
|
+
* If missing, item is selectable.
|
|
2488
|
+
*/
|
|
2489
|
+
isSelectableCallback?: (item: any) => boolean;
|
|
2490
|
+
/**
|
|
2491
|
+
* Functions that receives a model and returns a string for display value
|
|
2492
|
+
*
|
|
2493
|
+
* If missing, fallback on global `NaturalHierarchicSelectorComponent.displayWith`
|
|
2494
|
+
*/
|
|
2495
|
+
displayWith?: (item: any) => string;
|
|
2496
|
+
};
|
|
2497
|
+
|
|
2498
|
+
type HierarchicModel = {
|
|
2499
|
+
__typename: string;
|
|
2500
|
+
} & NameOrFullName;
|
|
2501
|
+
declare class HierarchicModelNode {
|
|
2502
|
+
readonly model: HierarchicModel;
|
|
2503
|
+
readonly config: NaturalHierarchicConfiguration;
|
|
2504
|
+
readonly childrenChange: BehaviorSubject<HierarchicModelNode[]>;
|
|
2505
|
+
constructor(model: HierarchicModel, config: NaturalHierarchicConfiguration);
|
|
2506
|
+
get children(): HierarchicModelNode[];
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
declare class HierarchicFlatNode {
|
|
2510
|
+
readonly node: HierarchicModelNode;
|
|
2511
|
+
readonly name: string;
|
|
2512
|
+
readonly level: number;
|
|
2513
|
+
expandable: boolean;
|
|
2514
|
+
readonly selectable: boolean;
|
|
2515
|
+
deselectable: boolean;
|
|
2516
|
+
loading: boolean;
|
|
2517
|
+
constructor(node: HierarchicModelNode, name: string, level?: number, expandable?: boolean, selectable?: boolean, deselectable?: boolean);
|
|
2518
|
+
}
|
|
2519
|
+
|
|
2520
|
+
type HierarchicFilterConfiguration$1<T = Literal> = {
|
|
2521
|
+
service: NaturalHierarchicConfiguration['service'];
|
|
2522
|
+
filter: T;
|
|
2523
|
+
};
|
|
2524
|
+
type HierarchicFiltersConfiguration$1<T = Literal> = HierarchicFilterConfiguration$1<T>[];
|
|
2525
|
+
|
|
2526
|
+
type OrganizedModelSelection = Record<string, any[]>;
|
|
2527
|
+
declare class NaturalHierarchicSelectorService {
|
|
2528
|
+
private readonly injector;
|
|
2529
|
+
/**
|
|
2530
|
+
* Stores the global result of the tree
|
|
2531
|
+
* This observable contains Node.
|
|
2532
|
+
* When it's updated, the TreeController and TreeFlattener process the new array to generate the flat tree.
|
|
2533
|
+
*/
|
|
2534
|
+
readonly dataChange: BehaviorSubject<HierarchicModelNode[]>;
|
|
2535
|
+
/**
|
|
2536
|
+
* Configuration for relations and selection constraints
|
|
2537
|
+
*
|
|
2538
|
+
* The list should be sorted in the order of the hierarchic (list first parent rules, then child rules)
|
|
2539
|
+
*/
|
|
2540
|
+
private configuration;
|
|
2541
|
+
/**
|
|
2542
|
+
* Init component by saving the complete configuration, and then retrieving root elements.
|
|
2543
|
+
* Updates **another** observable (this.dataChange) when data is retrieved.
|
|
2544
|
+
*/
|
|
2545
|
+
init(config: NaturalHierarchicConfiguration[], contextFilter?: HierarchicFiltersConfiguration$1 | null, searchVariables?: QueryVariables | null): Observable<unknown>;
|
|
2546
|
+
/**
|
|
2547
|
+
* Get list of children, considering given FlatNode id as a parent.
|
|
2548
|
+
* Mark loading status individually on nodes.
|
|
2549
|
+
*/
|
|
2550
|
+
loadChildren(flatNode: HierarchicFlatNode, contextFilter?: HierarchicFiltersConfiguration$1 | null): void;
|
|
2551
|
+
search(searchVariables: QueryVariables, contextFilter?: HierarchicFiltersConfiguration$1 | null): void;
|
|
2552
|
+
/**
|
|
2553
|
+
* Retrieve elements from the server
|
|
2554
|
+
* Get root elements if node is null, or child elements if node is given
|
|
2555
|
+
*/
|
|
2556
|
+
private getList;
|
|
2557
|
+
countItems(node: HierarchicFlatNode, contextFilters?: HierarchicFiltersConfiguration$1 | null): void;
|
|
2558
|
+
private getContextualizedConfigs;
|
|
2559
|
+
/**
|
|
2560
|
+
* Return models matching given FlatNodes
|
|
2561
|
+
* Returns a Literal of models grouped by their configuration attribute "selectableAtKey"
|
|
2562
|
+
*/
|
|
2563
|
+
toOrganizedSelection(nodes: HierarchicModelNode[]): OrganizedModelSelection;
|
|
2564
|
+
/**
|
|
2565
|
+
* Transforms an OrganizedModelSelection into a list of ModelNodes
|
|
2566
|
+
*/
|
|
2567
|
+
fromOrganizedSelection(organizedModelSelection: OrganizedModelSelection): HierarchicModelNode[];
|
|
2568
|
+
/**
|
|
2569
|
+
* Checks that each configuration.selectableAtKey attribute is unique
|
|
2570
|
+
*/
|
|
2571
|
+
private validateConfiguration;
|
|
2572
|
+
/**
|
|
2573
|
+
* Return configurations setup in the list after the given one
|
|
2574
|
+
*/
|
|
2575
|
+
private getNextConfigs;
|
|
2576
|
+
/**
|
|
2577
|
+
* Builds queryVariables filter for children query
|
|
2578
|
+
*/
|
|
2579
|
+
private getServiceFilter;
|
|
2580
|
+
/**
|
|
2581
|
+
* Return a context filter applicable to the service for given config
|
|
2582
|
+
*
|
|
2583
|
+
* @param config Applicable config
|
|
2584
|
+
* @param contextFilters List of context filters
|
|
2585
|
+
*/
|
|
2586
|
+
private getFilterByService;
|
|
2587
|
+
/**
|
|
2588
|
+
* Search in configurations.selectableAtKey attribute to find given key and return the configuration
|
|
2589
|
+
*/
|
|
2590
|
+
private getConfigurationBySelectableKey;
|
|
2591
|
+
private getOrCreateModelNode;
|
|
2592
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalHierarchicSelectorService, never>;
|
|
2593
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalHierarchicSelectorService>;
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
type HierarchicFilterConfiguration<T = Literal> = {
|
|
2597
|
+
service: NaturalHierarchicConfiguration['service'];
|
|
2598
|
+
filter: T;
|
|
2599
|
+
};
|
|
2600
|
+
type HierarchicFiltersConfiguration<T = Literal> = HierarchicFilterConfiguration<T>[];
|
|
2601
|
+
type TypeHierarchicSelectorConfiguration = {
|
|
2602
|
+
key: string;
|
|
2603
|
+
service: UntypedModelService;
|
|
2604
|
+
config: NaturalHierarchicConfiguration[];
|
|
2605
|
+
filters?: HierarchicFiltersConfiguration;
|
|
2606
|
+
};
|
|
2607
|
+
declare class TypeHierarchicSelectorComponent extends AbstractAssociationSelectComponent<TypeHierarchicSelectorConfiguration> {
|
|
2608
|
+
getCondition(): FilterGroupConditionField;
|
|
2609
|
+
protected reloadValue(condition: FilterGroupConditionField): Observable<unknown | null>;
|
|
2610
|
+
protected renderValueWithoutOperator(): string;
|
|
2611
|
+
selectionChange(selection: OrganizedModelSelection): void;
|
|
2612
|
+
/**
|
|
2613
|
+
* We need to keep `null` in our valueCtrl so the required validator works properly, so
|
|
2614
|
+
* filter here
|
|
2615
|
+
*/
|
|
2616
|
+
private noEmptySelection;
|
|
2617
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TypeHierarchicSelectorComponent, never>;
|
|
2618
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TypeHierarchicSelectorComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2619
|
+
}
|
|
2620
|
+
|
|
2621
|
+
type TypeDateConfiguration<D = Date> = {
|
|
2622
|
+
min?: D | null;
|
|
2623
|
+
max?: D | null;
|
|
2624
|
+
};
|
|
2625
|
+
declare class TypeDateComponent<D = any> implements DropdownComponent {
|
|
2626
|
+
private dateAdapter;
|
|
2627
|
+
private dateFormats;
|
|
2628
|
+
readonly renderedValue: BehaviorSubject<string>;
|
|
2629
|
+
readonly configuration: Required<TypeDateConfiguration<D>>;
|
|
2630
|
+
readonly operatorCtrl: FormControl<"equal" | "greater" | "greaterOrEqual" | "less" | "lessOrEqual">;
|
|
2631
|
+
readonly valueCtrl: FormControl<D | null>;
|
|
2632
|
+
readonly todayCtrl: FormControl<boolean | null>;
|
|
2633
|
+
readonly operators: readonly PossibleComparableOperator[];
|
|
2634
|
+
readonly form: FormGroup<{
|
|
2635
|
+
operator: FormControl<"equal" | "greater" | "greaterOrEqual" | "less" | "lessOrEqual">;
|
|
2636
|
+
value: FormControl<D | null>;
|
|
2637
|
+
today: FormControl<boolean | null>;
|
|
2638
|
+
}>;
|
|
2639
|
+
private readonly defaults;
|
|
2640
|
+
constructor();
|
|
2641
|
+
getCondition(): FilterGroupConditionField;
|
|
2642
|
+
isValid(): boolean;
|
|
2643
|
+
isDirty(): boolean;
|
|
2644
|
+
private reloadCondition;
|
|
2645
|
+
private setTodayOrDate;
|
|
2646
|
+
private initValidators;
|
|
2647
|
+
private getDayAfter;
|
|
2648
|
+
private getRenderedValue;
|
|
2649
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TypeDateComponent<any>, never>;
|
|
2650
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TypeDateComponent<any>, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
type TypeDateRangeConfiguration<D = any> = {
|
|
2654
|
+
min?: D | null;
|
|
2655
|
+
max?: D | null;
|
|
2656
|
+
};
|
|
2657
|
+
declare class InvalidWithValueStateMatcher implements ErrorStateMatcher {
|
|
2658
|
+
isErrorState(control: FormControl<unknown> | null, form: FormGroupDirective | NgForm | null): boolean;
|
|
2659
|
+
}
|
|
2660
|
+
/**
|
|
2661
|
+
* Date range with mandatory bounding dates.
|
|
2662
|
+
*
|
|
2663
|
+
* If you need optional bounding date, then use `TypeDateComponent` instead.
|
|
2664
|
+
*/
|
|
2665
|
+
declare class TypeDateRangeComponent<D = any> implements DropdownComponent {
|
|
2666
|
+
private dateAdapter;
|
|
2667
|
+
private dateFormats;
|
|
2668
|
+
readonly renderedValue: BehaviorSubject<string>;
|
|
2669
|
+
readonly configuration: Required<TypeDateRangeConfiguration<D>>;
|
|
2670
|
+
readonly matcher: InvalidWithValueStateMatcher;
|
|
2671
|
+
readonly fromCtrl: FormControl<D | null>;
|
|
2672
|
+
readonly toCtrl: FormControl<D | null>;
|
|
2673
|
+
readonly form: FormGroup<{
|
|
2674
|
+
from: FormControl<D | null>;
|
|
2675
|
+
to: FormControl<D | null>;
|
|
2676
|
+
}>;
|
|
2677
|
+
private readonly defaults;
|
|
2678
|
+
constructor();
|
|
2679
|
+
getCondition(): FilterGroupConditionField;
|
|
2680
|
+
isValid(): boolean;
|
|
2681
|
+
isDirty(): boolean;
|
|
2682
|
+
private reloadCondition;
|
|
2683
|
+
private initValidators;
|
|
2684
|
+
render(value: D | null): string;
|
|
2685
|
+
private getRenderedValue;
|
|
2686
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TypeDateRangeComponent<any>, never>;
|
|
2687
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TypeDateRangeComponent<any>, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
type NaturalDropdownData<C = any> = {
|
|
2691
|
+
condition: FilterGroupConditionField | null;
|
|
2692
|
+
configuration: C;
|
|
2693
|
+
title?: string;
|
|
2694
|
+
};
|
|
2695
|
+
declare const NATURAL_DROPDOWN_DATA: InjectionToken<NaturalDropdownData<any>>;
|
|
2696
|
+
|
|
2697
|
+
type TypeOption = {
|
|
2698
|
+
display: string;
|
|
2699
|
+
condition: Literal;
|
|
2700
|
+
};
|
|
2701
|
+
type TypeOptionsConfiguration = {
|
|
2702
|
+
options: TypeOption[];
|
|
2703
|
+
};
|
|
2704
|
+
declare class TypeOptionsComponent implements DropdownComponent {
|
|
2705
|
+
readonly data: NaturalDropdownData<TypeOptionsConfiguration>;
|
|
2706
|
+
readonly renderedValue: BehaviorSubject<string>;
|
|
2707
|
+
readonly formControl: FormControl<TypeOption>;
|
|
2708
|
+
readonly configuration: Required<TypeOptionsConfiguration>;
|
|
2709
|
+
private readonly defaults;
|
|
2710
|
+
protected readonly dropdownRef: NaturalDropdownRef;
|
|
2711
|
+
constructor(data: NaturalDropdownData<TypeOptionsConfiguration>);
|
|
2712
|
+
getCondition(): FilterGroupConditionField;
|
|
2713
|
+
isValid(): boolean;
|
|
2714
|
+
isDirty(): boolean;
|
|
2715
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TypeOptionsComponent, never>;
|
|
2716
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TypeOptionsComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
type TypeBooleanConfiguration = {
|
|
2720
|
+
displayWhenActive: string;
|
|
2721
|
+
displayWhenInactive: string;
|
|
2722
|
+
};
|
|
2723
|
+
declare class TypeBooleanComponent extends TypeOptionsComponent implements DropdownComponent {
|
|
2724
|
+
constructor();
|
|
2725
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TypeBooleanComponent, never>;
|
|
2726
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TypeBooleanComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
type FileModel = {
|
|
2730
|
+
__typename?: 'File' | 'AccountingDocument' | 'Image';
|
|
2731
|
+
id?: string;
|
|
2732
|
+
file?: File;
|
|
2733
|
+
mime?: string;
|
|
2734
|
+
src?: string;
|
|
2735
|
+
};
|
|
2736
|
+
|
|
2737
|
+
declare class NaturalFileService {
|
|
2738
|
+
private readonly document;
|
|
2739
|
+
/**
|
|
2740
|
+
* Allow to subscribe to selected files in the entire application. So a
|
|
2741
|
+
* child component is able to receive a file that was dropped on a parent
|
|
2742
|
+
* component.
|
|
2743
|
+
*
|
|
2744
|
+
* Typically useful to drop a file on the entire screen, instead of a precise
|
|
2745
|
+
* component.
|
|
2746
|
+
*/
|
|
2747
|
+
readonly filesChanged: Subject<FileSelection>;
|
|
2748
|
+
getDownloadLink(model: FileModel | null): null | string;
|
|
2749
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalFileService, never>;
|
|
2750
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalFileService>;
|
|
2751
|
+
}
|
|
2752
|
+
|
|
2753
|
+
type InvalidFile = {
|
|
2754
|
+
file: File;
|
|
2755
|
+
error: string;
|
|
2756
|
+
};
|
|
2757
|
+
type FileSelection = {
|
|
2758
|
+
/**
|
|
2759
|
+
* The list of files that have been selected.
|
|
2760
|
+
*/
|
|
2761
|
+
valid: File[];
|
|
2762
|
+
/**
|
|
2763
|
+
* The list of files that have been selected but are invalid according to validators.
|
|
2764
|
+
*/
|
|
2765
|
+
invalid: InvalidFile[];
|
|
2766
|
+
};
|
|
2767
|
+
/**
|
|
2768
|
+
* A master base set of logic intended to support file select/drag/drop operations
|
|
2769
|
+
*
|
|
2770
|
+
* In most cases you probably want click-to-select and drag-to-select, so you should use:
|
|
2771
|
+
*
|
|
2772
|
+
* <div naturalFileDrop [selectable]="true"></div>
|
|
2773
|
+
*
|
|
2774
|
+
* @dynamic
|
|
2775
|
+
*/
|
|
2776
|
+
declare abstract class NaturalAbstractFile implements OnInit, OnDestroy, OnChanges {
|
|
2777
|
+
private fileElement?;
|
|
2778
|
+
/**
|
|
2779
|
+
* Whether we should accept a single file or multiple files
|
|
2780
|
+
*/
|
|
2781
|
+
readonly multiple: i0.InputSignal<boolean>;
|
|
2782
|
+
/**
|
|
2783
|
+
* Comma-separated list of unique file type specifiers. Like the native element,
|
|
2784
|
+
* it can be a mix of mime-type and file extensions.
|
|
2785
|
+
*
|
|
2786
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept
|
|
2787
|
+
*/
|
|
2788
|
+
readonly accept: i0.InputSignal<string>;
|
|
2789
|
+
/**
|
|
2790
|
+
* Maximum file size in bytes. 0 means no validation at all.
|
|
2791
|
+
*/
|
|
2792
|
+
readonly maxSize: i0.InputSignal<number>;
|
|
2793
|
+
/**
|
|
2794
|
+
* Disable the file selection entirely
|
|
2795
|
+
*/
|
|
2796
|
+
readonly fileSelectionDisabled: i0.InputSignal<boolean>;
|
|
2797
|
+
/**
|
|
2798
|
+
* Whether the user can click on the element to select something
|
|
2799
|
+
*
|
|
2800
|
+
* This has only effect during initialization. Subsequent changes will have
|
|
2801
|
+
* no effect.
|
|
2802
|
+
*/
|
|
2803
|
+
readonly selectable: i0.InputSignal<boolean>;
|
|
2804
|
+
/**
|
|
2805
|
+
* If true, the file selection will be broadcast through `NaturalFileService.filesChanged`.
|
|
2806
|
+
*
|
|
2807
|
+
* It is useful to set this to false if there are two uploads on a page with different purposes,
|
|
2808
|
+
* and the second upload should not be confused with the first one.
|
|
2809
|
+
*/
|
|
2810
|
+
broadcast: boolean;
|
|
2811
|
+
private readonly fileChange$;
|
|
2812
|
+
/**
|
|
2813
|
+
* The single valid file that has been selected.
|
|
2814
|
+
*
|
|
2815
|
+
* It is for convenience of use, and will only emit if there is at least one
|
|
2816
|
+
* valid file. See `filesChange` for a more complete output.
|
|
2817
|
+
*/
|
|
2818
|
+
readonly fileChange: i0.OutputRef<File>;
|
|
2819
|
+
private readonly filesChange$;
|
|
2820
|
+
/**
|
|
2821
|
+
* The list of files that have been selected.
|
|
2822
|
+
*/
|
|
2823
|
+
readonly filesChange: i0.OutputRef<FileSelection>;
|
|
2824
|
+
private readonly element;
|
|
2825
|
+
protected readonly naturalFileService: NaturalFileService;
|
|
2826
|
+
private readonly document;
|
|
2827
|
+
ngOnDestroy(): void;
|
|
2828
|
+
ngOnInit(): void;
|
|
2829
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
2830
|
+
private getFileElement;
|
|
2831
|
+
private enableSelecting;
|
|
2832
|
+
protected handleFiles(files: File[]): void;
|
|
2833
|
+
/**
|
|
2834
|
+
* Called when input has files
|
|
2835
|
+
*/
|
|
2836
|
+
private changeFn;
|
|
2837
|
+
private clickHandler;
|
|
2838
|
+
private beforeSelect;
|
|
2839
|
+
onChange(event: Event): void;
|
|
2840
|
+
private validate;
|
|
2841
|
+
protected hasObservers(): boolean;
|
|
2842
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalAbstractFile, never>;
|
|
2843
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalAbstractFile, never, never, { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "maxSize": { "alias": "maxSize"; "required": false; "isSignal": true; }; "fileSelectionDisabled": { "alias": "fileSelectionDisabled"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "broadcast": { "alias": "broadcast"; "required": false; }; }, { "fileChange": "fileChange"; "filesChange": "filesChange"; }, never, never, true, never>;
|
|
2844
|
+
}
|
|
2845
|
+
|
|
2846
|
+
/**
|
|
2847
|
+
* This directive has all options to select files, and adds support for drag'n'drop.
|
|
2848
|
+
*
|
|
2849
|
+
* It will add the CSS class `natural-file-over` on the component when a file is
|
|
2850
|
+
* dragged over. It is up to the component to have some specific styling by using
|
|
2851
|
+
* this class.
|
|
2852
|
+
*
|
|
2853
|
+
* In most cases you probably also want click-to-select, so you should use:
|
|
2854
|
+
*
|
|
2855
|
+
* ```html
|
|
2856
|
+
* <div naturalFileDrop [selectable]="true"></div>
|
|
2857
|
+
* ```
|
|
2858
|
+
*/
|
|
2859
|
+
declare class NaturalFileDropDirective extends NaturalAbstractFile implements OnInit {
|
|
2860
|
+
private readonly destroyRef;
|
|
2861
|
+
fileOverClass: boolean;
|
|
2862
|
+
/**
|
|
2863
|
+
* Emits whenever files are being dragged over
|
|
2864
|
+
*/
|
|
2865
|
+
readonly fileOver: i0.OutputEmitterRef<boolean>;
|
|
2866
|
+
private readonly rawFileOver;
|
|
2867
|
+
ngOnInit(): void;
|
|
2868
|
+
onDrop(event: DragEvent): void;
|
|
2869
|
+
onDragOver(event: DragEvent): void;
|
|
2870
|
+
private closeDrags;
|
|
2871
|
+
onDragLeave(event: DragEvent): void;
|
|
2872
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalFileDropDirective, never>;
|
|
2873
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalFileDropDirective, ":not([naturalFileSelect])[naturalFileDrop]", never, {}, { "fileOver": "fileOver"; }, never, never, true, never>;
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
/**
|
|
2877
|
+
* This directive has all options to select files, except drag'n'drop.
|
|
2878
|
+
*/
|
|
2879
|
+
declare class NaturalFileSelectDirective extends NaturalAbstractFile {
|
|
2880
|
+
/**
|
|
2881
|
+
* Whether the user can click on the element to select something
|
|
2882
|
+
*
|
|
2883
|
+
* Override parent to enable it by default
|
|
2884
|
+
*/
|
|
2885
|
+
readonly selectable: i0.InputSignal<boolean>;
|
|
2886
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalFileSelectDirective, never>;
|
|
2887
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalFileSelectDirective, ":not([naturalFileDrop])[naturalFileSelect]", never, { "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
2888
|
+
}
|
|
2889
|
+
|
|
2890
|
+
declare class NaturalFileComponent implements OnInit, OnChanges {
|
|
2891
|
+
private readonly naturalFileService;
|
|
2892
|
+
private readonly alertService;
|
|
2893
|
+
private readonly document;
|
|
2894
|
+
readonly height: i0.InputSignal<number>;
|
|
2895
|
+
readonly iconHeight: i0.Signal<number>;
|
|
2896
|
+
readonly fontSize: i0.Signal<number>;
|
|
2897
|
+
readonly action: i0.InputSignal<"download" | "upload" | null>;
|
|
2898
|
+
readonly backgroundSize: i0.InputSignal<string>;
|
|
2899
|
+
/**
|
|
2900
|
+
* Comma-separated list of unique file type specifiers. Like the native element,
|
|
2901
|
+
* it can be a mix of mime-type and file extensions.
|
|
2902
|
+
*
|
|
2903
|
+
* See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#accept
|
|
2904
|
+
*/
|
|
2905
|
+
readonly accept: i0.InputSignal<string>;
|
|
2906
|
+
/**
|
|
2907
|
+
* If given, it will be called when a new file is selected. The callback should typically upload the file
|
|
2908
|
+
* to the server and link the newly uploaded file to the existing related object.
|
|
2909
|
+
*
|
|
2910
|
+
* The callback **must** be able to run even if the calling component has been destroyed. That means in most
|
|
2911
|
+
* cases you **must** `bind()` the callback explicitly, like so:
|
|
2912
|
+
*
|
|
2913
|
+
* ```html
|
|
2914
|
+
* <natural-file [uploader]="myCallback.bind(this)" />
|
|
2915
|
+
* ```
|
|
2916
|
+
*
|
|
2917
|
+
* Also, you probably **should** set a `[formCtrl]` so that the form is updated automatically, instead of doing
|
|
2918
|
+
* it manually within the callback.
|
|
2919
|
+
*/
|
|
2920
|
+
readonly uploader: i0.InputSignal<((file: File) => Observable<FileModel>) | undefined>;
|
|
2921
|
+
model: FileModel | null;
|
|
2922
|
+
/**
|
|
2923
|
+
* If provided, its value will get updated when the model changes.
|
|
2924
|
+
* But its value is never read, so if you want to set a value use `[model]` instead.
|
|
2925
|
+
*/
|
|
2926
|
+
readonly formCtrl: i0.InputSignal<AbstractControl<any, any, any> | null | undefined>;
|
|
2927
|
+
/**
|
|
2928
|
+
* This **must not** be used to mutate the server, because it is very likely it will never be called if the
|
|
2929
|
+
* human navigates away from the page before the upload is finished. Instead, you should use `[uploader]`.
|
|
2930
|
+
*/
|
|
2931
|
+
readonly modelChange: i0.OutputEmitterRef<FileModel>;
|
|
2932
|
+
imagePreview: string;
|
|
2933
|
+
filePreview: string | null;
|
|
2934
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
2935
|
+
ngOnInit(): void;
|
|
2936
|
+
upload(file: File): void;
|
|
2937
|
+
getDownloadLink(): null | string;
|
|
2938
|
+
private updateImage;
|
|
2939
|
+
private getBase64;
|
|
2940
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalFileComponent, never>;
|
|
2941
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalFileComponent, "natural-file", never, { "height": { "alias": "height"; "required": false; "isSignal": true; }; "action": { "alias": "action"; "required": false; "isSignal": true; }; "backgroundSize": { "alias": "backgroundSize"; "required": false; "isSignal": true; }; "accept": { "alias": "accept"; "required": false; "isSignal": true; }; "uploader": { "alias": "uploader"; "required": false; "isSignal": true; }; "model": { "alias": "model"; "required": false; }; "formCtrl": { "alias": "formCtrl"; "required": false; "isSignal": true; }; }, { "modelChange": "modelChange"; }, never, never, true, never>;
|
|
2942
|
+
}
|
|
2943
|
+
|
|
2944
|
+
declare class NaturalFixedButtonComponent {
|
|
2945
|
+
readonly icon: i0.InputSignal<string>;
|
|
2946
|
+
readonly link: i0.InputSignal<string | readonly any[] | _angular_router.UrlTree | null | undefined>;
|
|
2947
|
+
readonly color: i0.InputSignal<ThemePalette>;
|
|
2948
|
+
readonly disabled: i0.InputSignal<boolean>;
|
|
2949
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalFixedButtonComponent, never>;
|
|
2950
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalFixedButtonComponent, "natural-fixed-button", never, { "icon": { "alias": "icon"; "required": true; "isSignal": true; }; "link": { "alias": "link"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
type Model = {
|
|
2954
|
+
id?: string;
|
|
2955
|
+
permissions?: {
|
|
2956
|
+
delete: boolean;
|
|
2957
|
+
};
|
|
2958
|
+
};
|
|
2959
|
+
declare class NaturalFixedButtonDetailComponent {
|
|
2960
|
+
private canChange;
|
|
2961
|
+
isCreation: boolean;
|
|
2962
|
+
get model(): Model;
|
|
2963
|
+
set model(value: Model);
|
|
2964
|
+
private _model;
|
|
2965
|
+
form: FormGroup;
|
|
2966
|
+
readonly create: i0.OutputEmitterRef<void>;
|
|
2967
|
+
readonly delete: i0.OutputEmitterRef<void>;
|
|
2968
|
+
constructor();
|
|
2969
|
+
clickCreate(): void;
|
|
2970
|
+
clickDelete(): void;
|
|
2971
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalFixedButtonDetailComponent, never>;
|
|
2972
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalFixedButtonDetailComponent, "natural-fixed-button-detail", never, { "model": { "alias": "model"; "required": true; }; "form": { "alias": "form"; "required": true; }; }, { "create": "create"; "delete": "delete"; }, never, never, true, never>;
|
|
2973
|
+
}
|
|
2974
|
+
|
|
2975
|
+
declare class NaturalHierarchicSelectorComponent implements OnInit, OnChanges {
|
|
2976
|
+
private readonly destroyRef;
|
|
2977
|
+
private readonly hierarchicSelectorService;
|
|
2978
|
+
/**
|
|
2979
|
+
* Function that receives a model and returns a string for display value
|
|
2980
|
+
*/
|
|
2981
|
+
readonly displayWith: i0.InputSignal<((item: any) => string) | undefined>;
|
|
2982
|
+
/**
|
|
2983
|
+
* Config for items and relations arrangement
|
|
2984
|
+
*/
|
|
2985
|
+
readonly config: i0.InputSignal<NaturalHierarchicConfiguration[]>;
|
|
2986
|
+
/**
|
|
2987
|
+
* If multiple or single item selection
|
|
2988
|
+
*/
|
|
2989
|
+
readonly multiple: i0.InputSignal<boolean>;
|
|
2990
|
+
/**
|
|
2991
|
+
* Selected items
|
|
2992
|
+
* Organized by key, containing each an array of selected items of same type
|
|
2993
|
+
*/
|
|
2994
|
+
readonly selected: i0.InputSignal<OrganizedModelSelection>;
|
|
2995
|
+
/**
|
|
2996
|
+
* Whether selectable elements can be unselected
|
|
2997
|
+
*/
|
|
2998
|
+
readonly allowUnselect: i0.InputSignal<boolean>;
|
|
2999
|
+
/**
|
|
3000
|
+
* Filters that apply to each query
|
|
3001
|
+
*/
|
|
3002
|
+
readonly filters: i0.InputSignal<HierarchicFiltersConfiguration$1 | null | undefined>;
|
|
3003
|
+
/**
|
|
3004
|
+
* Search facets
|
|
3005
|
+
*/
|
|
3006
|
+
readonly searchFacets: i0.InputSignal<NaturalSearchFacets>;
|
|
3007
|
+
/**
|
|
3008
|
+
* Selections to apply on natural-search on component initialisation
|
|
3009
|
+
*/
|
|
3010
|
+
readonly searchSelections: i0.InputSignal<NaturalSearchSelections>;
|
|
3011
|
+
/**
|
|
3012
|
+
* Select all fetched items of the current search result
|
|
3013
|
+
*
|
|
3014
|
+
* Use very carefully as recursivity is ignored. The selection includes children (if any) even if the child list has been closed
|
|
3015
|
+
*
|
|
3016
|
+
* Should be used __only__ for non-recursive use cases. Avoid with recursive because it's not intuitive for end user
|
|
3017
|
+
*/
|
|
3018
|
+
readonly allowSelectAll: i0.InputSignal<boolean>;
|
|
3019
|
+
/**
|
|
3020
|
+
* Emits when natural-search selections change
|
|
3021
|
+
*/
|
|
3022
|
+
readonly searchSelectionChange: i0.OutputEmitterRef<NaturalSearchSelections>;
|
|
3023
|
+
/**
|
|
3024
|
+
* Inner representation of selected @Input() to allow flat listing as mat-chip.
|
|
3025
|
+
*/
|
|
3026
|
+
selectedNodes: HierarchicModelNode[];
|
|
3027
|
+
/**
|
|
3028
|
+
* Emits selection change
|
|
3029
|
+
* Returns a Literal where selected models are organized by key
|
|
3030
|
+
*/
|
|
3031
|
+
readonly selectionChange: i0.OutputEmitterRef<OrganizedModelSelection>;
|
|
3032
|
+
/**
|
|
3033
|
+
* Controller for nodes selection
|
|
3034
|
+
*/
|
|
3035
|
+
flatNodesSelection: SelectionModel<HierarchicFlatNode>;
|
|
3036
|
+
treeControl: FlatTreeControl<HierarchicFlatNode>;
|
|
3037
|
+
treeFlattener: MatTreeFlattener<HierarchicModelNode, HierarchicFlatNode>;
|
|
3038
|
+
dataSource: MatTreeFlatDataSource<HierarchicModelNode, HierarchicFlatNode>;
|
|
3039
|
+
loading: boolean;
|
|
3040
|
+
/**
|
|
3041
|
+
* Cache for transformed nodes
|
|
3042
|
+
*/
|
|
3043
|
+
private readonly flatNodeMap;
|
|
3044
|
+
protected readonly tooBig: i0.Signal<boolean>;
|
|
3045
|
+
/**
|
|
3046
|
+
* Angular OnChange implementation
|
|
3047
|
+
*/
|
|
3048
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
3049
|
+
/**
|
|
3050
|
+
* Angular OnInit implementation
|
|
3051
|
+
*/
|
|
3052
|
+
ngOnInit(): void;
|
|
3053
|
+
/**
|
|
3054
|
+
* Toggle selection of a FlatNode, considering if multiple selection is activated or not
|
|
3055
|
+
*/
|
|
3056
|
+
toggleFlatNode(flatNode: HierarchicFlatNode): void;
|
|
3057
|
+
protected selectAll(): void;
|
|
3058
|
+
/**
|
|
3059
|
+
* When unselecting an element from the mat-chips, it can be deep in the hierarchy, and the tree element may not exist...
|
|
3060
|
+
* ... but we still need to remove the element from the mat-chips list.
|
|
3061
|
+
*/
|
|
3062
|
+
unselectModelNode(node: HierarchicModelNode): void;
|
|
3063
|
+
isNodeTogglable(flatNode: HierarchicFlatNode): boolean;
|
|
3064
|
+
private getDisplayFn;
|
|
3065
|
+
loadChildren(flatNode: HierarchicFlatNode): void;
|
|
3066
|
+
/**
|
|
3067
|
+
* Created to collapse all children when closing a parent, but not sure it's good.
|
|
3068
|
+
*/
|
|
3069
|
+
private getChildren;
|
|
3070
|
+
/**
|
|
3071
|
+
* Transforms a HierarchicModelNode into a FlatNode
|
|
3072
|
+
*/
|
|
3073
|
+
private transformer;
|
|
3074
|
+
/**
|
|
3075
|
+
* Return deep of the node in the tree
|
|
3076
|
+
*/
|
|
3077
|
+
private getLevel;
|
|
3078
|
+
/**
|
|
3079
|
+
* Is always expandable because we load on demand, we don't know if there are children yet
|
|
3080
|
+
*/
|
|
3081
|
+
private isExpandable;
|
|
3082
|
+
private getOrCreateFlatNode;
|
|
3083
|
+
search(selections: NaturalSearchSelections): void;
|
|
3084
|
+
private loadRoots;
|
|
3085
|
+
/**
|
|
3086
|
+
* Sync inner selection (tree and mat-chips) according to selected input attribute
|
|
3087
|
+
*/
|
|
3088
|
+
private updateInnerSelection;
|
|
3089
|
+
/**
|
|
3090
|
+
* Unselect a node, keeping the rest of the selected untouched
|
|
3091
|
+
*/
|
|
3092
|
+
private unselectFlatNode;
|
|
3093
|
+
/**
|
|
3094
|
+
* Remove a node from chip lists
|
|
3095
|
+
*/
|
|
3096
|
+
private removeModelNode;
|
|
3097
|
+
/**
|
|
3098
|
+
* Select a node, keeping th rest of the selected untouched
|
|
3099
|
+
*/
|
|
3100
|
+
private selectFlatNode;
|
|
3101
|
+
/**
|
|
3102
|
+
* Clear all selected and select the given node
|
|
3103
|
+
*/
|
|
3104
|
+
private selectSingleFlatNode;
|
|
3105
|
+
/**
|
|
3106
|
+
* Clear all selected and select the given node
|
|
3107
|
+
*/
|
|
3108
|
+
private unselectSingleFlatNode;
|
|
3109
|
+
/**
|
|
3110
|
+
* Transform the given elements into the organized selection that is emitted to output
|
|
3111
|
+
*/
|
|
3112
|
+
private updateSelection;
|
|
3113
|
+
private isNodeSelected;
|
|
3114
|
+
private getFlatNode;
|
|
3115
|
+
private createFlatNode;
|
|
3116
|
+
/**
|
|
3117
|
+
* Returns an identifier key for map cache
|
|
3118
|
+
* As many object types can be used, this function considers typename and ID to return something like document-123
|
|
3119
|
+
*/
|
|
3120
|
+
private getMapKey;
|
|
3121
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalHierarchicSelectorComponent, never>;
|
|
3122
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalHierarchicSelectorComponent, "natural-hierarchic-selector", never, { "displayWith": { "alias": "displayWith"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": true; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "selected": { "alias": "selected"; "required": false; "isSignal": true; }; "allowUnselect": { "alias": "allowUnselect"; "required": false; "isSignal": true; }; "filters": { "alias": "filters"; "required": false; "isSignal": true; }; "searchFacets": { "alias": "searchFacets"; "required": false; "isSignal": true; }; "searchSelections": { "alias": "searchSelections"; "required": false; "isSignal": true; }; "allowSelectAll": { "alias": "allowSelectAll"; "required": false; "isSignal": true; }; }, { "searchSelectionChange": "searchSelectionChange"; "selectionChange": "selectionChange"; }, never, never, true, never>;
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
type HierarchicDialogResult = {
|
|
3126
|
+
hierarchicSelection?: OrganizedModelSelection;
|
|
3127
|
+
searchSelections?: NaturalSearchSelections | null;
|
|
3128
|
+
};
|
|
3129
|
+
type HierarchicDialogConfig = {
|
|
3130
|
+
/**
|
|
3131
|
+
* Configuration to setup rules of hierarchy
|
|
3132
|
+
*/
|
|
3133
|
+
hierarchicConfig: NaturalHierarchicConfiguration[];
|
|
3134
|
+
/**
|
|
3135
|
+
* Selected items when HierarchicComponent initializes
|
|
3136
|
+
*/
|
|
3137
|
+
hierarchicSelection?: OrganizedModelSelection;
|
|
3138
|
+
/**
|
|
3139
|
+
* Filters to apply on queries (when opening new level of hierarchy)
|
|
3140
|
+
*/
|
|
3141
|
+
hierarchicFilters?: HierarchicFiltersConfiguration$1 | null;
|
|
3142
|
+
/**
|
|
3143
|
+
* Multiple selection if true or single selection if false
|
|
3144
|
+
*/
|
|
3145
|
+
multiple?: boolean;
|
|
3146
|
+
/**
|
|
3147
|
+
* Allow to validate selection with no items checked
|
|
3148
|
+
*/
|
|
3149
|
+
allowUnselect?: boolean;
|
|
3150
|
+
/**
|
|
3151
|
+
* Allow to select all items with dedicated button
|
|
3152
|
+
*/
|
|
3153
|
+
allowSelectAll?: boolean;
|
|
3154
|
+
/**
|
|
3155
|
+
* Facets for natural-search in HierarchicComponent
|
|
3156
|
+
*/
|
|
3157
|
+
searchFacets?: NaturalSearchFacets;
|
|
3158
|
+
/**
|
|
3159
|
+
* Selections of natural search to initialize on HierarchicComponent initialisation
|
|
3160
|
+
*/
|
|
3161
|
+
searchSelections?: NaturalSearchSelections | null;
|
|
3162
|
+
};
|
|
3163
|
+
declare class NaturalHierarchicSelectorDialogComponent {
|
|
3164
|
+
private dialogRef;
|
|
3165
|
+
/**
|
|
3166
|
+
* Set of hierarchic configurations to pass as attribute to HierarchicComponent
|
|
3167
|
+
*/
|
|
3168
|
+
config: HierarchicDialogConfig;
|
|
3169
|
+
/**
|
|
3170
|
+
* Natural search selections after initialisation
|
|
3171
|
+
*/
|
|
3172
|
+
searchSelectionsOutput: NaturalSearchSelections | undefined | null;
|
|
3173
|
+
constructor();
|
|
3174
|
+
close(selected: OrganizedModelSelection | undefined): void;
|
|
3175
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalHierarchicSelectorDialogComponent, never>;
|
|
3176
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalHierarchicSelectorDialogComponent, "ng-component", never, {}, {}, never, never, true, never>;
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
declare class NaturalHierarchicSelectorDialogService {
|
|
3180
|
+
private readonly dialog;
|
|
3181
|
+
open(hierarchicConfig: HierarchicDialogConfig, dialogConfig?: MatDialogConfig): MatDialogRef<NaturalHierarchicSelectorDialogComponent, HierarchicDialogResult>;
|
|
3182
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalHierarchicSelectorDialogService, never>;
|
|
3183
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalHierarchicSelectorDialogService>;
|
|
3184
|
+
}
|
|
3185
|
+
|
|
3186
|
+
type NaturalIconType = {
|
|
3187
|
+
name: string;
|
|
3188
|
+
svg?: string;
|
|
3189
|
+
font?: string;
|
|
3190
|
+
class?: 'negative' | 'neutral' | 'positive';
|
|
3191
|
+
};
|
|
3192
|
+
type NaturalIconConfig = {
|
|
3193
|
+
svg?: string;
|
|
3194
|
+
font?: string;
|
|
3195
|
+
class?: 'negative' | 'neutral' | 'positive';
|
|
3196
|
+
};
|
|
3197
|
+
type NaturalIconsConfig = Record<string, NaturalIconConfig>;
|
|
3198
|
+
declare const NATURAL_ICONS_CONFIG: InjectionToken<NaturalIconsConfig>;
|
|
3199
|
+
/**
|
|
3200
|
+
* Allows to use `<mat-icon>` without knowing where an icon comes from (SVG or font) or with aliases for Material font.
|
|
3201
|
+
*
|
|
3202
|
+
* SVG icons and Material font aliases must be configured ahead of time, via `NATURAL_ICONS_CONFIG`.
|
|
3203
|
+
*
|
|
3204
|
+
* It also make it easy to give a specific size to the icon via `[size]`.
|
|
3205
|
+
*
|
|
3206
|
+
* Usage:
|
|
3207
|
+
*
|
|
3208
|
+
* ```html
|
|
3209
|
+
* <mat-icon naturalIcon="search"></mat-icon>
|
|
3210
|
+
* <mat-icon naturalIcon="my-svg-icon-name"></mat-icon>
|
|
3211
|
+
* <mat-icon naturalIcon="my-alias-for-search"></mat-icon>
|
|
3212
|
+
* <mat-icon naturalIcon="search" [size]="150"></mat-icon>
|
|
3213
|
+
* ```
|
|
3214
|
+
*/
|
|
3215
|
+
declare class NaturalIconDirective {
|
|
3216
|
+
private readonly matIconRegistry;
|
|
3217
|
+
private readonly domSanitizer;
|
|
3218
|
+
private readonly config;
|
|
3219
|
+
private readonly matIconComponent;
|
|
3220
|
+
readonly naturalIcon: i0.InputSignal<string>;
|
|
3221
|
+
readonly size: i0.InputSignal<number | null | undefined>;
|
|
3222
|
+
protected readonly icon: i0.Signal<NaturalIconType>;
|
|
3223
|
+
constructor();
|
|
3224
|
+
private registerIcons;
|
|
3225
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalIconDirective, never>;
|
|
3226
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalIconDirective, "mat-icon[naturalIcon]", never, { "naturalIcon": { "alias": "naturalIcon"; "required": true; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
/**
|
|
3230
|
+
* Configure Material Symbols, instead of Material Icons, and configure custom Natural icons.
|
|
3231
|
+
*
|
|
3232
|
+
* This means that `https://fonts.googleapis.com/icon?family=Material+Icons` must be
|
|
3233
|
+
* replaced by `https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@1`.
|
|
3234
|
+
*/
|
|
3235
|
+
declare function provideIcons(config: NaturalIconsConfig): (EnvironmentProviders | Provider)[];
|
|
3236
|
+
|
|
3237
|
+
declare function providePanels(hooks: NaturalPanelsHooksConfig): Provider[];
|
|
3238
|
+
|
|
3239
|
+
declare class NaturalPanelsComponent implements OnDestroy {
|
|
3240
|
+
private readonly panelsService;
|
|
3241
|
+
constructor();
|
|
3242
|
+
ngOnDestroy(): void;
|
|
3243
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalPanelsComponent, never>;
|
|
3244
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalPanelsComponent, "natural-panels", never, {}, {}, never, never, true, never>;
|
|
3245
|
+
}
|
|
3246
|
+
|
|
3247
|
+
declare const naturalPanelsUrlMatcher: UrlMatcher;
|
|
3248
|
+
|
|
3249
|
+
/**
|
|
3250
|
+
* Url fallback matcher to be used instead of `path: '**'` when Panel system
|
|
3251
|
+
* is used in the project.
|
|
3252
|
+
*/
|
|
3253
|
+
declare const fallbackIfNoOpenedPanels: UrlMatcher;
|
|
3254
|
+
|
|
3255
|
+
/**
|
|
3256
|
+
* Custom template usage :
|
|
3257
|
+
*
|
|
3258
|
+
* ```html
|
|
3259
|
+
* <natural-relations [main]="owner" [service]="svc" [filter]="{}" placeholder="Select an item">
|
|
3260
|
+
* <ng-template let-item="item">
|
|
3261
|
+
* <span>{{ item.xxx }}</span>
|
|
3262
|
+
* </ng-template>
|
|
3263
|
+
* </natural-relations>
|
|
3264
|
+
* ```
|
|
3265
|
+
*/
|
|
3266
|
+
declare class NaturalRelationsComponent<TService extends NaturalAbstractModelService<unknown, any, PaginatedData<LinkableObject>, QueryVariables, unknown, any, unknown, any, unknown, any>> implements OnInit, OnChanges {
|
|
3267
|
+
private readonly destroyRef;
|
|
3268
|
+
private readonly linkMutationService;
|
|
3269
|
+
private readonly hierarchicSelectorDialog;
|
|
3270
|
+
private readonly select;
|
|
3271
|
+
readonly itemTemplate: i0.Signal<TemplateRef<unknown> | undefined>;
|
|
3272
|
+
private _service;
|
|
3273
|
+
get service(): TService;
|
|
3274
|
+
set service(service: TService);
|
|
3275
|
+
/**
|
|
3276
|
+
* The placeholder used in the button to add a new relation
|
|
3277
|
+
*/
|
|
3278
|
+
readonly placeholder: i0.InputSignal<string>;
|
|
3279
|
+
/**
|
|
3280
|
+
* Filter for autocomplete selector
|
|
3281
|
+
*/
|
|
3282
|
+
readonly autocompleteSelectorFilter: i0.InputSignal<ExtractVall<TService>["filter"] | null | undefined>;
|
|
3283
|
+
/**
|
|
3284
|
+
* Function to customize the rendering of the selected item as text in input
|
|
3285
|
+
*/
|
|
3286
|
+
readonly displayWith: i0.InputSignal<((item: ExtractTallOne<TService> | null) => string) | undefined>;
|
|
3287
|
+
/**
|
|
3288
|
+
* Whether the relations can be changed
|
|
3289
|
+
*/
|
|
3290
|
+
disabled: boolean;
|
|
3291
|
+
/**
|
|
3292
|
+
* The main object to which all relations belong to
|
|
3293
|
+
*/
|
|
3294
|
+
main: LinkableObject & {
|
|
3295
|
+
permissions?: {
|
|
3296
|
+
update: boolean;
|
|
3297
|
+
};
|
|
3298
|
+
};
|
|
3299
|
+
/**
|
|
3300
|
+
* Emits after relations were successfully added on the server
|
|
3301
|
+
*/
|
|
3302
|
+
readonly selectionChange: i0.OutputEmitterRef<void>;
|
|
3303
|
+
/**
|
|
3304
|
+
* Filters for hierarchic selector
|
|
3305
|
+
*/
|
|
3306
|
+
readonly hierarchicSelectorFilters: i0.InputSignal<HierarchicFiltersConfiguration$1 | null | undefined>;
|
|
3307
|
+
/**
|
|
3308
|
+
* Configuration in case we prefer hierarchic selection over autocomplete selection
|
|
3309
|
+
*/
|
|
3310
|
+
readonly hierarchicSelectorConfig: i0.InputSignal<NaturalHierarchicConfiguration[] | undefined>;
|
|
3311
|
+
/**
|
|
3312
|
+
* Link mutation semantic
|
|
3313
|
+
*/
|
|
3314
|
+
otherName?: string | null;
|
|
3315
|
+
/**
|
|
3316
|
+
* Listing service instance
|
|
3317
|
+
*/
|
|
3318
|
+
dataSource: NaturalDataSource<PaginatedData<LinkableObject>>;
|
|
3319
|
+
loading: boolean;
|
|
3320
|
+
/**
|
|
3321
|
+
* Table columns
|
|
3322
|
+
*/
|
|
3323
|
+
displayedColumns: string[];
|
|
3324
|
+
readonly pageSizeOptions: number[];
|
|
3325
|
+
protected readonly defaultPagination: {
|
|
3326
|
+
pageIndex: number;
|
|
3327
|
+
pageSize: number;
|
|
3328
|
+
};
|
|
3329
|
+
/**
|
|
3330
|
+
* Observable variables/options for listing service usage and apollo watchQuery
|
|
3331
|
+
*/
|
|
3332
|
+
private variablesManager;
|
|
3333
|
+
readonly removing: Set<LinkableObject>;
|
|
3334
|
+
/**
|
|
3335
|
+
* The filter used to filter relations
|
|
3336
|
+
*
|
|
3337
|
+
* So if the relations are from one action -> to many objectives, then the filter must filter
|
|
3338
|
+
* the objectives that have indeed a relation to the particular action.
|
|
3339
|
+
*/
|
|
3340
|
+
set filter(filter: ExtractVall<TService>['filter']);
|
|
3341
|
+
/**
|
|
3342
|
+
* The sorting used to sort relations
|
|
3343
|
+
*
|
|
3344
|
+
* So if the relations are from one action -> to many objectives, then the sorting must sort
|
|
3345
|
+
* the objectives that have indeed a relation to the particular action.
|
|
3346
|
+
*/
|
|
3347
|
+
set sorting(sorting: ExtractVall<TService>['sorting']);
|
|
3348
|
+
ngOnChanges(): void;
|
|
3349
|
+
ngOnInit(): void;
|
|
3350
|
+
/**
|
|
3351
|
+
* Unlink action
|
|
3352
|
+
* Refetch result to display it in table
|
|
3353
|
+
*/
|
|
3354
|
+
removeRelation(relation: LinkableObject): void;
|
|
3355
|
+
/**
|
|
3356
|
+
* Link action
|
|
3357
|
+
* Refetch result to display it in table
|
|
3358
|
+
* TODO : could maybe use "update" attribute of apollo.mutate function to update table faster (but hard to do it here)
|
|
3359
|
+
*/
|
|
3360
|
+
addRelations(relations: (LinkableObject | ExtractTallOne<TService> | string | null)[]): void;
|
|
3361
|
+
pagination(event?: PageEvent): void;
|
|
3362
|
+
getDisplayFn(): (item: ExtractTallOne<TService> | null) => string;
|
|
3363
|
+
openNaturalHierarchicSelector(): void;
|
|
3364
|
+
private getSelectKey;
|
|
3365
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalRelationsComponent<any>, never>;
|
|
3366
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalRelationsComponent<any>, "natural-relations", never, { "service": { "alias": "service"; "required": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "autocompleteSelectorFilter": { "alias": "autocompleteSelectorFilter"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; }; "main": { "alias": "main"; "required": true; }; "hierarchicSelectorFilters": { "alias": "hierarchicSelectorFilters"; "required": false; "isSignal": true; }; "hierarchicSelectorConfig": { "alias": "hierarchicSelectorConfig"; "required": false; "isSignal": true; }; "otherName": { "alias": "otherName"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "sorting": { "alias": "sorting"; "required": false; }; }, { "selectionChange": "selectionChange"; }, ["itemTemplate"], never, true, never>;
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
declare function toGraphQLDoctrineFilter(facets: NaturalSearchFacets | null, selections: NaturalSearchSelections | null): Filter;
|
|
3370
|
+
|
|
3371
|
+
/**
|
|
3372
|
+
* Returns a string representation of the selection that can be used in URL.
|
|
3373
|
+
*
|
|
3374
|
+
* The string can be parsed back with `fromUrl()`
|
|
3375
|
+
*/
|
|
3376
|
+
declare function toUrl(selections: NaturalSearchSelections | null): string | null;
|
|
3377
|
+
/**
|
|
3378
|
+
* Parse a string, probably coming from URL, into a selection
|
|
3379
|
+
*/
|
|
3380
|
+
declare function fromUrl(selections: string | null): NaturalSearchSelections;
|
|
3381
|
+
/**
|
|
3382
|
+
* Transform a search selection to navigation parameters to be used in URL.
|
|
3383
|
+
*
|
|
3384
|
+
* This is typically useful to craft URL to pre-filtered lists.
|
|
3385
|
+
*/
|
|
3386
|
+
declare function toNavigationParameters(selections: NaturalSearchSelections): Params;
|
|
3387
|
+
|
|
3388
|
+
/**
|
|
3389
|
+
* Wrap the searched value by `%` SQL wildcard
|
|
3390
|
+
*
|
|
3391
|
+
* So:
|
|
3392
|
+
*
|
|
3393
|
+
* {field: 'myFieldName', condition: {like: {value: 'foo'}}}
|
|
3394
|
+
*
|
|
3395
|
+
* will become
|
|
3396
|
+
*
|
|
3397
|
+
* {field: 'myFieldName', condition: {like: {value: '%foo%'}}}
|
|
3398
|
+
*/
|
|
3399
|
+
declare function wrapLike(selection: NaturalSearchSelection): NaturalSearchSelection;
|
|
3400
|
+
/**
|
|
3401
|
+
* Search by prefix using `%' SQL wildcard
|
|
3402
|
+
*
|
|
3403
|
+
* So:
|
|
3404
|
+
*
|
|
3405
|
+
* {field: 'myFieldName', condition: {like: {value: 'foo'}}}
|
|
3406
|
+
*
|
|
3407
|
+
* will become
|
|
3408
|
+
*
|
|
3409
|
+
* {field: 'myFieldName', condition: {like: {value: 'foo%'}}}
|
|
3410
|
+
*/
|
|
3411
|
+
declare function wrapPrefix(selection: NaturalSearchSelection): NaturalSearchSelection;
|
|
3412
|
+
/**
|
|
3413
|
+
* Search by suffix using `%' SQL wildcard
|
|
3414
|
+
*
|
|
3415
|
+
* So:
|
|
3416
|
+
*
|
|
3417
|
+
* {field: 'myFieldName', condition: {like: {value: 'foo'}}}
|
|
3418
|
+
*
|
|
3419
|
+
* will become
|
|
3420
|
+
*
|
|
3421
|
+
* {field: 'myFieldName', condition: {like: {value: '%foo'}}}
|
|
3422
|
+
*/
|
|
3423
|
+
declare function wrapSuffix(selection: NaturalSearchSelection): NaturalSearchSelection;
|
|
3424
|
+
/**
|
|
3425
|
+
* Replace the operator name (usually "like", "in" or "between") with the
|
|
3426
|
+
* attribute "field" defined in the configuration
|
|
3427
|
+
*
|
|
3428
|
+
* So:
|
|
3429
|
+
*
|
|
3430
|
+
* {field: 'myFieldName', condition: {in: {values: [1, 2, 3]}}}
|
|
3431
|
+
*
|
|
3432
|
+
* will become
|
|
3433
|
+
*
|
|
3434
|
+
* {field: 'myFieldName', condition: {myFieldName: {values: [1, 2, 3]}}}
|
|
3435
|
+
*/
|
|
3436
|
+
declare function replaceOperatorByField(selection: NaturalSearchSelection): NaturalSearchSelection;
|
|
3437
|
+
/**
|
|
3438
|
+
* Replace the operator name (usually "like", "in" or "between") with the
|
|
3439
|
+
* attribute "name" defined in the configuration
|
|
3440
|
+
*
|
|
3441
|
+
* So:
|
|
3442
|
+
*
|
|
3443
|
+
* {field: 'myFieldName', name:'myConfigName', condition: {in: {values: [1, 2, 3]}}}
|
|
3444
|
+
*
|
|
3445
|
+
* will become
|
|
3446
|
+
*
|
|
3447
|
+
* {field: 'myFieldName', name:'myConfigName', condition: {myConfigName: {values: [1, 2, 3]}}}
|
|
3448
|
+
*/
|
|
3449
|
+
declare function replaceOperatorByName(selection: NaturalSearchSelection): NaturalSearchSelection;
|
|
3450
|
+
|
|
3451
|
+
declare class NaturalSearchComponent implements OnChanges {
|
|
3452
|
+
#private;
|
|
3453
|
+
private readonly breakpointObserver;
|
|
3454
|
+
/**
|
|
3455
|
+
* Placeholder for last input (the free search input)
|
|
3456
|
+
*/
|
|
3457
|
+
readonly placeholder: i0.InputSignal<string>;
|
|
3458
|
+
/**
|
|
3459
|
+
* Exhaustive list of facets to be used in this <natural-search>
|
|
3460
|
+
*/
|
|
3461
|
+
facets: NaturalSearchFacets;
|
|
3462
|
+
/**
|
|
3463
|
+
* Whether to allow end-user to create multiple `OR` groups
|
|
3464
|
+
*/
|
|
3465
|
+
readonly multipleGroups: i0.InputSignal<boolean>;
|
|
3466
|
+
/**
|
|
3467
|
+
* Text display in the dropdown to select the facet
|
|
3468
|
+
*/
|
|
3469
|
+
readonly dropdownTitle: i0.InputSignal<string>;
|
|
3470
|
+
/**
|
|
3471
|
+
* Emits when some selection has been setted by the user
|
|
3472
|
+
*/
|
|
3473
|
+
readonly selectionChange: i0.OutputEmitterRef<NaturalSearchSelections>;
|
|
3474
|
+
/**
|
|
3475
|
+
* Cleaned inputted selections. This public API is useful because `selectionChange` does not emit changes made via `[selections]`
|
|
3476
|
+
*/
|
|
3477
|
+
readonly innerSelections: i0.Signal<NaturalSearchSelections>;
|
|
3478
|
+
/**
|
|
3479
|
+
* Input to display at component initialisation
|
|
3480
|
+
*/
|
|
3481
|
+
set selections(selections: NaturalSearchSelections);
|
|
3482
|
+
readonly isMobile: rxjs.Observable<boolean>;
|
|
3483
|
+
ngOnChanges(): void;
|
|
3484
|
+
updateGroup(groupSelections: GroupSelections, groupIndex: number): void;
|
|
3485
|
+
addGroup(): void;
|
|
3486
|
+
removeGroup(index: number): void;
|
|
3487
|
+
clear(): void;
|
|
3488
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSearchComponent, never>;
|
|
3489
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSearchComponent, "natural-search", never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "facets": { "alias": "facets"; "required": false; }; "multipleGroups": { "alias": "multipleGroups"; "required": false; "isSignal": true; }; "dropdownTitle": { "alias": "dropdownTitle"; "required": false; "isSignal": true; }; "selections": { "alias": "selections"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
|
|
3490
|
+
}
|
|
3491
|
+
|
|
3492
|
+
/**
|
|
3493
|
+
* This will completely ignore internal formControl and instead use the one from the component
|
|
3494
|
+
* which comes from outside of this component. This basically allows us to **not** depend on
|
|
3495
|
+
* touched status propagation between outside and inside world, and thus get rid of our legacy
|
|
3496
|
+
* custom FormControl class ("NaturalFormControl").
|
|
3497
|
+
*/
|
|
3498
|
+
declare class ExternalFormControlMatcher<TValue, TInput> extends ErrorStateMatcher {
|
|
3499
|
+
private readonly component;
|
|
3500
|
+
constructor(component: AbstractSelect<TValue, TInput>);
|
|
3501
|
+
isErrorState(): boolean;
|
|
3502
|
+
}
|
|
3503
|
+
declare abstract class AbstractSelect<TValue, TInput> implements OnInit, ControlValueAccessor, DoCheck {
|
|
3504
|
+
readonly placeholder: i0.InputSignal<string | undefined>;
|
|
3505
|
+
/**
|
|
3506
|
+
* Mat-hint, if given, and it is non-empty, then `subscriptSizing` will
|
|
3507
|
+
* automatically be set to `dynamic` to allow for long, wrapping text.
|
|
3508
|
+
*/
|
|
3509
|
+
readonly hint: i0.InputSignal<string | null | undefined>;
|
|
3510
|
+
protected readonly subscriptSizing: i0.Signal<"dynamic" | "fixed">;
|
|
3511
|
+
/**
|
|
3512
|
+
* If given an error message, it will be displayed in a `<mat-error>`, but only if the control
|
|
3513
|
+
* is actually in an error state via one of its validators.
|
|
3514
|
+
*
|
|
3515
|
+
* This is not needed for the special case of the required validator, because the message is hardcoded.
|
|
3516
|
+
*/
|
|
3517
|
+
error: string | null;
|
|
3518
|
+
/**
|
|
3519
|
+
* If the field is required
|
|
3520
|
+
*/
|
|
3521
|
+
set required(value: boolean);
|
|
3522
|
+
get required(): boolean;
|
|
3523
|
+
private _required;
|
|
3524
|
+
/**
|
|
3525
|
+
* Add a suffix button that is a link to given destination
|
|
3526
|
+
*/
|
|
3527
|
+
navigateTo?: any[] | string | null;
|
|
3528
|
+
/**
|
|
3529
|
+
* If provided cause a new clear button to appear
|
|
3530
|
+
*/
|
|
3531
|
+
readonly clearLabel: i0.InputSignal<string | undefined>;
|
|
3532
|
+
/**
|
|
3533
|
+
* Whether to show the search icon
|
|
3534
|
+
*/
|
|
3535
|
+
readonly showIcon: i0.InputSignal<boolean>;
|
|
3536
|
+
/**
|
|
3537
|
+
* Icon name
|
|
3538
|
+
*/
|
|
3539
|
+
readonly icon: i0.InputSignal<string>;
|
|
3540
|
+
/**
|
|
3541
|
+
* Function to customize the rendering of the selected item as text in input
|
|
3542
|
+
*/
|
|
3543
|
+
readonly displayWith: i0.InputSignal<((item: TValue | null) => string) | undefined>;
|
|
3544
|
+
/**
|
|
3545
|
+
* Emit the selected value whenever it changes
|
|
3546
|
+
*/
|
|
3547
|
+
readonly selectionChange: i0.OutputEmitterRef<TValue | null>;
|
|
3548
|
+
/**
|
|
3549
|
+
* Emits when internal input is blurred
|
|
3550
|
+
*/
|
|
3551
|
+
readonly blur: i0.OutputEmitterRef<void>;
|
|
3552
|
+
/**
|
|
3553
|
+
* Contains internal representation for current selection AND searched text (for autocomplete)
|
|
3554
|
+
*
|
|
3555
|
+
* It is **not** necessarily `TValue | null`.
|
|
3556
|
+
*
|
|
3557
|
+
* - NaturalSelectComponent: `string | TValue | null`. We allow `string`
|
|
3558
|
+
* only when `optionRequired` is false, so most of the time it is `TValue | null`.
|
|
3559
|
+
* - NaturalSelectHierarchicComponent: `string | null`.
|
|
3560
|
+
* - NaturalSelectEnumComponent: `TValue | null`.
|
|
3561
|
+
*
|
|
3562
|
+
* In natural-select context, we use pristine and dirty to identify if the displayed value is search or committed model :
|
|
3563
|
+
* - Pristine status (unchanged value) means the model is displayed and propagated = the selection is committed
|
|
3564
|
+
* - Dirty status (changed value) means we are in search/autocomplete mode
|
|
3565
|
+
*/
|
|
3566
|
+
readonly internalCtrl: FormControl<TInput | null>;
|
|
3567
|
+
/**
|
|
3568
|
+
* Interface with ControlValueAccessor
|
|
3569
|
+
* Notifies parent model / form controller
|
|
3570
|
+
*/
|
|
3571
|
+
onChange?: (item: TValue | null) => void;
|
|
3572
|
+
/**
|
|
3573
|
+
* Interface with ControlValueAccessor
|
|
3574
|
+
* Notifies parent model / form controller
|
|
3575
|
+
*/
|
|
3576
|
+
onTouched?: () => void;
|
|
3577
|
+
readonly matcher: ExternalFormControlMatcher<TValue, TInput>;
|
|
3578
|
+
readonly ngControl: NgControl | null;
|
|
3579
|
+
constructor();
|
|
3580
|
+
ngDoCheck(): void;
|
|
3581
|
+
writeValue(value: TInput | null): void;
|
|
3582
|
+
ngOnInit(): void;
|
|
3583
|
+
/**
|
|
3584
|
+
* Whether the value can be changed
|
|
3585
|
+
*/
|
|
3586
|
+
set disabled(disabled: boolean);
|
|
3587
|
+
registerOnChange(fn: (item: TValue | null) => void): void;
|
|
3588
|
+
registerOnTouched(fn: () => void): void;
|
|
3589
|
+
abstract getDisplayFn(): (item: TValue | null) => string;
|
|
3590
|
+
/**
|
|
3591
|
+
* Commit the model to null
|
|
3592
|
+
* Emit and event to update the model
|
|
3593
|
+
*/
|
|
3594
|
+
clear(): void;
|
|
3595
|
+
/**
|
|
3596
|
+
* If input is dirty (search running) restore to model value
|
|
3597
|
+
*/
|
|
3598
|
+
onBlur(): void;
|
|
3599
|
+
/**
|
|
3600
|
+
* Commit the model change
|
|
3601
|
+
*/
|
|
3602
|
+
propagateValue(value: TValue | null): void;
|
|
3603
|
+
setDisabledState(isDisabled: boolean): void;
|
|
3604
|
+
showClearButton(): boolean;
|
|
3605
|
+
touch(): void;
|
|
3606
|
+
hasRequiredError(): boolean;
|
|
3607
|
+
/**
|
|
3608
|
+
* Apply Validators.required on the internal form, based on ngControl or [required] attribute, giving priority to attribute.
|
|
3609
|
+
*/
|
|
3610
|
+
private applyRequired;
|
|
3611
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AbstractSelect<any, any>, never>;
|
|
3612
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AbstractSelect<any, any>, never, never, { "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "hint": { "alias": "hint"; "required": false; "isSignal": true; }; "error": { "alias": "error"; "required": false; }; "required": { "alias": "required"; "required": false; }; "navigateTo": { "alias": "navigateTo"; "required": false; }; "clearLabel": { "alias": "clearLabel"; "required": false; "isSignal": true; }; "showIcon": { "alias": "showIcon"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "selectionChange": "selectionChange"; "blur": "blur"; }, never, never, true, never>;
|
|
3613
|
+
}
|
|
3614
|
+
|
|
3615
|
+
type Value = IEnum['value'] | IEnum['value'][];
|
|
3616
|
+
declare class NaturalSelectEnumComponent extends AbstractSelect<Value, Value> implements OnInit, ControlValueAccessor {
|
|
3617
|
+
private readonly enumService;
|
|
3618
|
+
/**
|
|
3619
|
+
* The name of the enum type, eg: `"ActionStatus"`
|
|
3620
|
+
*/
|
|
3621
|
+
readonly enumName: i0.InputSignal<string>;
|
|
3622
|
+
/**
|
|
3623
|
+
* If given an extra option is added to select `null` with given label
|
|
3624
|
+
*/
|
|
3625
|
+
nullLabel?: string;
|
|
3626
|
+
/**
|
|
3627
|
+
* Functions that receives an enum value and returns whether that value is disabled
|
|
3628
|
+
*/
|
|
3629
|
+
optionDisabled?: (item: IEnum) => boolean;
|
|
3630
|
+
/**
|
|
3631
|
+
* Whether the user should be allowed to select multiple options
|
|
3632
|
+
*/
|
|
3633
|
+
readonly multiple: i0.InputSignal<boolean>;
|
|
3634
|
+
items?: Observable<IEnum[]>;
|
|
3635
|
+
ngOnInit(): void;
|
|
3636
|
+
getDisplayFn(): (item: Value | null) => string;
|
|
3637
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSelectEnumComponent, never>;
|
|
3638
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSelectEnumComponent, "natural-select-enum", never, { "enumName": { "alias": "enumName"; "required": true; "isSignal": true; }; "nullLabel": { "alias": "nullLabel"; "required": false; }; "optionDisabled": { "alias": "optionDisabled"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
/**
|
|
3642
|
+
* Default usage:
|
|
3643
|
+
*
|
|
3644
|
+
* ```html
|
|
3645
|
+
* <natural-select
|
|
3646
|
+
* [config]="myConfig"
|
|
3647
|
+
* [(ngModel)]="amazingModel"
|
|
3648
|
+
* (ngModelChange)=amazingChangeFn($event)
|
|
3649
|
+
* />
|
|
3650
|
+
* ```
|
|
3651
|
+
*
|
|
3652
|
+
* `[(ngModel)]` and `(ngModelChange)` are optional.
|
|
3653
|
+
*
|
|
3654
|
+
* Placeholder :
|
|
3655
|
+
*
|
|
3656
|
+
* ```html
|
|
3657
|
+
* <natural-select placeholder="amazing placeholder" />
|
|
3658
|
+
* ```
|
|
3659
|
+
*/
|
|
3660
|
+
declare class NaturalSelectHierarchicComponent extends AbstractSelect<Literal, string> implements OnInit, ControlValueAccessor {
|
|
3661
|
+
private readonly hierarchicSelectorDialogService;
|
|
3662
|
+
/**
|
|
3663
|
+
* If provided cause a new select button to appear
|
|
3664
|
+
*/
|
|
3665
|
+
selectLabel?: string;
|
|
3666
|
+
/**
|
|
3667
|
+
* Configuration for hierarchic relations
|
|
3668
|
+
*
|
|
3669
|
+
* It should be an array with at least one element with `selectableAtKey` configured, otherwise the selector will never open.
|
|
3670
|
+
*/
|
|
3671
|
+
config: NaturalHierarchicConfiguration[] | null;
|
|
3672
|
+
/**
|
|
3673
|
+
* Filters formatted for hierarchic selector
|
|
3674
|
+
*/
|
|
3675
|
+
readonly filters: i0.InputSignal<HierarchicFiltersConfiguration$1 | undefined>;
|
|
3676
|
+
/**
|
|
3677
|
+
* The selected value as an object. The internal value is `internalCtrl.value`, and that is a string.
|
|
3678
|
+
*/
|
|
3679
|
+
private value;
|
|
3680
|
+
/**
|
|
3681
|
+
* On Firefox, the combination of <input (focus)> event and dialog opening cause some strange bug where focus event is called multiple
|
|
3682
|
+
* times This prevents it.
|
|
3683
|
+
*/
|
|
3684
|
+
private lockOpenDialog;
|
|
3685
|
+
/**
|
|
3686
|
+
* Very important to return something, above all if [select]='displayedValue' attribute value is used
|
|
3687
|
+
*/
|
|
3688
|
+
getDisplayFn(): (item: Literal | null) => string;
|
|
3689
|
+
/**
|
|
3690
|
+
* Override parent because our internalCtrl store the textual representation as string instead of raw Literal
|
|
3691
|
+
*/
|
|
3692
|
+
writeValue(value: Literal | string | null): void;
|
|
3693
|
+
openDialog(): void;
|
|
3694
|
+
showSelectButton(): boolean;
|
|
3695
|
+
private getSelectKey;
|
|
3696
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSelectHierarchicComponent, never>;
|
|
3697
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSelectHierarchicComponent, "natural-select-hierarchic", never, { "selectLabel": { "alias": "selectLabel"; "required": false; }; "config": { "alias": "config"; "required": false; }; "filters": { "alias": "filters"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
type ValueTypeFor<TService> = string | ExtractTallOne<TService>;
|
|
3701
|
+
/**
|
|
3702
|
+
* Default usage:
|
|
3703
|
+
* ```html
|
|
3704
|
+
* <natural-select [service]="myServiceInstance" [(model)]="myModel" (modelChange)=myChangeFn($event) />
|
|
3705
|
+
* ```
|
|
3706
|
+
*
|
|
3707
|
+
* Custom template usage :
|
|
3708
|
+
* ```html
|
|
3709
|
+
* <natural-select [service]="svc" [(ngModel)]="model">
|
|
3710
|
+
* <ng-template let-item="item">
|
|
3711
|
+
* <span>{{ item.xxx }}</span>
|
|
3712
|
+
* </ng-template>
|
|
3713
|
+
* </natural-select>
|
|
3714
|
+
* ```
|
|
3715
|
+
*
|
|
3716
|
+
* `[(ngModel)]` and `(ngModelChange)` are optional.
|
|
3717
|
+
*
|
|
3718
|
+
* Placeholder :
|
|
3719
|
+
* ```html
|
|
3720
|
+
* <natural-select placeholder="my placeholder" />
|
|
3721
|
+
* ```
|
|
3722
|
+
*
|
|
3723
|
+
* Search with like %xxx% on specified field `name` instead of custom filter on whole object
|
|
3724
|
+
* ```html
|
|
3725
|
+
* <natural-select searchField="name" />
|
|
3726
|
+
* ```
|
|
3727
|
+
*
|
|
3728
|
+
* Allows to input free string without selecting an option from autocomplete suggestions
|
|
3729
|
+
* ```html
|
|
3730
|
+
* <natural-select [optionRequired]="false" />
|
|
3731
|
+
* ```
|
|
3732
|
+
*/
|
|
3733
|
+
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 {
|
|
3734
|
+
private readonly destroyRef;
|
|
3735
|
+
readonly autoTrigger: i0.Signal<MatAutocompleteTrigger>;
|
|
3736
|
+
readonly itemTemplate: i0.Signal<TemplateRef<any> | undefined>;
|
|
3737
|
+
/**
|
|
3738
|
+
* Service with watchAll function that accepts queryVariables.
|
|
3739
|
+
*/
|
|
3740
|
+
readonly service: i0.InputSignal<TService>;
|
|
3741
|
+
/**
|
|
3742
|
+
* If false, allows to input free string without selecting an option from autocomplete suggestions
|
|
3743
|
+
*/
|
|
3744
|
+
readonly optionRequired: i0.InputSignal<boolean>;
|
|
3745
|
+
/**
|
|
3746
|
+
* The field on which to search for, default to 'custom'.
|
|
3747
|
+
*/
|
|
3748
|
+
searchField: 'custom' | string;
|
|
3749
|
+
/**
|
|
3750
|
+
* The operator with which to search for, default to 'search' if `searchField` is 'custom', else 'like'.
|
|
3751
|
+
*/
|
|
3752
|
+
searchOperator: 'search' | string | null;
|
|
3753
|
+
/**
|
|
3754
|
+
* Cache the committed value during search mode.
|
|
3755
|
+
* It's used to be restored in case we cancel the selection
|
|
3756
|
+
*/
|
|
3757
|
+
private lastValidValue;
|
|
3758
|
+
/**
|
|
3759
|
+
* Additional filter for query
|
|
3760
|
+
*/
|
|
3761
|
+
set filter(filter: ExtractVall<TService>['filter'] | null | undefined);
|
|
3762
|
+
/**
|
|
3763
|
+
* Items returned by server to show in listing
|
|
3764
|
+
*/
|
|
3765
|
+
items: null | Observable<readonly any[]>;
|
|
3766
|
+
/**
|
|
3767
|
+
* Whether we are searching something
|
|
3768
|
+
*/
|
|
3769
|
+
loading: boolean;
|
|
3770
|
+
/**
|
|
3771
|
+
* If some items are not shown in result list
|
|
3772
|
+
* Shows a message after list if true
|
|
3773
|
+
*/
|
|
3774
|
+
hasMoreItems: boolean;
|
|
3775
|
+
nbTotal: number;
|
|
3776
|
+
/**
|
|
3777
|
+
* Default page size
|
|
3778
|
+
*/
|
|
3779
|
+
readonly pageSize: i0.InputSignal<number>;
|
|
3780
|
+
/**
|
|
3781
|
+
* Init search options
|
|
3782
|
+
*/
|
|
3783
|
+
private readonly variablesManager;
|
|
3784
|
+
/**
|
|
3785
|
+
* Whether the value can be changed
|
|
3786
|
+
*/
|
|
3787
|
+
set disabled(disabled: boolean);
|
|
3788
|
+
ngOnInit(): void;
|
|
3789
|
+
ngAfterViewInit(): void;
|
|
3790
|
+
onInternalFormChange(): void;
|
|
3791
|
+
onBlur(): void;
|
|
3792
|
+
/**
|
|
3793
|
+
* Reset form to it's initial value
|
|
3794
|
+
* Discard searched text (in autocomplete use case)
|
|
3795
|
+
* Doest not commit the change to the model (no change event is emitted)
|
|
3796
|
+
*/
|
|
3797
|
+
reset(): void;
|
|
3798
|
+
/**
|
|
3799
|
+
* Enter semantic means we want to validate something.
|
|
3800
|
+
* If we hit ENTER while typing a text, the stroke is ignored because the value is invalid (it's accepted in free text mode)
|
|
3801
|
+
* If we hit ENTER while the input field is empty, we validate the unselection (empty is a valid value)
|
|
3802
|
+
*/
|
|
3803
|
+
onKeyEnter(): void;
|
|
3804
|
+
writeValue(value: ValueTypeFor<TService> | null): void;
|
|
3805
|
+
private initService;
|
|
3806
|
+
startSearch(): void;
|
|
3807
|
+
/**
|
|
3808
|
+
* Commit the model change
|
|
3809
|
+
* Set internal form as pristine to reflect that the visible value match the model
|
|
3810
|
+
*/
|
|
3811
|
+
propagateValue(value: ValueTypeFor<TService> | null): void;
|
|
3812
|
+
/**
|
|
3813
|
+
* Very important to return something, above all if [select]='displayedValue' attribute value is used
|
|
3814
|
+
*/
|
|
3815
|
+
getDisplayFn(): (item: ValueTypeFor<TService> | null) => string;
|
|
3816
|
+
clear(): void;
|
|
3817
|
+
search(term: ValueTypeFor<TService> | null): void;
|
|
3818
|
+
showClearButton(): boolean;
|
|
3819
|
+
private getSearchFilter;
|
|
3820
|
+
getVariablesForDebug(): Readonly<QueryVariables> | undefined;
|
|
3821
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSelectComponent<any>, never>;
|
|
3822
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSelectComponent<any>, "natural-select", never, { "service": { "alias": "service"; "required": true; "isSignal": true; }; "optionRequired": { "alias": "optionRequired"; "required": false; "isSignal": true; }; "searchField": { "alias": "searchField"; "required": false; }; "searchOperator": { "alias": "searchOperator"; "required": false; }; "filter": { "alias": "filter"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; }; }, {}, ["itemTemplate"], never, true, never>;
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
declare class NaturalSidenavContainerComponent implements OnInit, OnDestroy {
|
|
3826
|
+
readonly sidenavService: NaturalSidenavService;
|
|
3827
|
+
/**
|
|
3828
|
+
* Unique identifier used for the local storage
|
|
3829
|
+
*/
|
|
3830
|
+
readonly name: i0.InputSignal<string>;
|
|
3831
|
+
/**
|
|
3832
|
+
* The side that the drawer is attached to
|
|
3833
|
+
*/
|
|
3834
|
+
readonly position: i0.InputSignal<"start" | "end">;
|
|
3835
|
+
/**
|
|
3836
|
+
* If true listens to route changes to close side nav after a route change if mobile view is active
|
|
3837
|
+
* Actually a navigation to current route does not emit a route change, and the sidenav don't close.
|
|
3838
|
+
*/
|
|
3839
|
+
readonly mobileAutoClose: i0.InputSignal<boolean>;
|
|
3840
|
+
/**
|
|
3841
|
+
* Width of the minimized menu
|
|
3842
|
+
*/
|
|
3843
|
+
readonly minimizedWidth: i0.InputSignal<number>;
|
|
3844
|
+
/**
|
|
3845
|
+
* If true, prevents "native" material sidenav to scroll at container level and delegates the scroll responsability to the transcluded
|
|
3846
|
+
* content
|
|
3847
|
+
*/
|
|
3848
|
+
noScroll: boolean;
|
|
3849
|
+
/**
|
|
3850
|
+
* Inner "native" material sidenav
|
|
3851
|
+
*/
|
|
3852
|
+
readonly menuSidenav: i0.Signal<MatSidenav>;
|
|
3853
|
+
get isMinimized(): boolean;
|
|
3854
|
+
get isMobileView(): boolean;
|
|
3855
|
+
ngOnInit(): void;
|
|
3856
|
+
ngOnDestroy(): void;
|
|
3857
|
+
toggle(): void;
|
|
3858
|
+
close(): void;
|
|
3859
|
+
open(): void;
|
|
3860
|
+
minimize(): void;
|
|
3861
|
+
expand(): void;
|
|
3862
|
+
toggleMinimized(): void;
|
|
3863
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSidenavContainerComponent, never>;
|
|
3864
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSidenavContainerComponent, "natural-sidenav-container", never, { "name": { "alias": "name"; "required": true; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "mobileAutoClose": { "alias": "mobileAutoClose"; "required": false; "isSignal": true; }; "minimizedWidth": { "alias": "minimizedWidth"; "required": false; "isSignal": true; }; "noScroll": { "alias": "noScroll"; "required": false; }; }, {}, never, ["natural-sidenav", "natural-sidenav-content"], true, never>;
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3867
|
+
/**
|
|
3868
|
+
* TODO: Fix nav minimize and maximize resize
|
|
3869
|
+
* Since Material 2 beta 10, when nav is resized the body is not resized
|
|
3870
|
+
* https://github.com/angular/material2/issues/6743
|
|
3871
|
+
* Maybe the better is to wait next release
|
|
3872
|
+
*/
|
|
3873
|
+
declare class NaturalSidenavService {
|
|
3874
|
+
private readonly destroyRef;
|
|
3875
|
+
private readonly breakpointObserver;
|
|
3876
|
+
private readonly router;
|
|
3877
|
+
private readonly sessionStorage;
|
|
3878
|
+
private readonly naturalSidenavStackService;
|
|
3879
|
+
/**
|
|
3880
|
+
* Navigation modes
|
|
3881
|
+
* First is for desktop view
|
|
3882
|
+
* Second is for mobile view
|
|
3883
|
+
*/
|
|
3884
|
+
private modes;
|
|
3885
|
+
/**
|
|
3886
|
+
* Activated mode
|
|
3887
|
+
* Default to desktop view
|
|
3888
|
+
*/
|
|
3889
|
+
private mode;
|
|
3890
|
+
/**
|
|
3891
|
+
* Whether nav is opened or not
|
|
3892
|
+
*/
|
|
3893
|
+
private opened;
|
|
3894
|
+
/**
|
|
3895
|
+
* Stores the opened status during mobile view, to restore if we come back to desktop view
|
|
3896
|
+
*/
|
|
3897
|
+
private tmpOpened;
|
|
3898
|
+
/**
|
|
3899
|
+
* Whether nav is minimized or not
|
|
3900
|
+
*/
|
|
3901
|
+
private minimized;
|
|
3902
|
+
/**
|
|
3903
|
+
* LocalStorage key that stores the minimized status
|
|
3904
|
+
*/
|
|
3905
|
+
private readonly minimizedStorageKey;
|
|
3906
|
+
/**
|
|
3907
|
+
* LocalStorage key that stores the opened status
|
|
3908
|
+
*/
|
|
3909
|
+
private readonly openedStorageKey;
|
|
3910
|
+
private minimizedStorageKeyWithName;
|
|
3911
|
+
private openedStorageKeyWithName;
|
|
3912
|
+
private _isMobileView;
|
|
3913
|
+
get activeMode(): MatDrawerMode;
|
|
3914
|
+
get isOpened(): boolean;
|
|
3915
|
+
get isMinimized(): boolean;
|
|
3916
|
+
destroy(component: NaturalSidenavContainerComponent): void;
|
|
3917
|
+
init(name: string, component: NaturalSidenavContainerComponent, autoClose?: boolean): void;
|
|
3918
|
+
isMobileView(): boolean;
|
|
3919
|
+
/**
|
|
3920
|
+
* Close nav on mobile view after a click
|
|
3921
|
+
*/
|
|
3922
|
+
navItemClicked(): void;
|
|
3923
|
+
/**
|
|
3924
|
+
* Change minimized status and stores the new value
|
|
3925
|
+
*/
|
|
3926
|
+
setMinimized(value: boolean): void;
|
|
3927
|
+
minimize(): void;
|
|
3928
|
+
expand(): void;
|
|
3929
|
+
toggleMinimized(): void;
|
|
3930
|
+
/**
|
|
3931
|
+
* Get the stored minimized status
|
|
3932
|
+
*/
|
|
3933
|
+
getMinimizedStatus(): boolean;
|
|
3934
|
+
/**
|
|
3935
|
+
* Get the stored opened status
|
|
3936
|
+
* Default on an opened status if nothing is stored
|
|
3937
|
+
*/
|
|
3938
|
+
getMenuOpenedStatus(): boolean;
|
|
3939
|
+
/**
|
|
3940
|
+
* Toggle menu but expand it if mobile mode is activated
|
|
3941
|
+
* Stores the status in local storage
|
|
3942
|
+
*/
|
|
3943
|
+
toggle(): void;
|
|
3944
|
+
close(): void;
|
|
3945
|
+
open(): void;
|
|
3946
|
+
setOpened(value: boolean): void;
|
|
3947
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSidenavService, never>;
|
|
3948
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalSidenavService>;
|
|
3949
|
+
}
|
|
3950
|
+
|
|
3951
|
+
declare class NaturalSidenavStackService {
|
|
3952
|
+
/**
|
|
3953
|
+
* The stack of all currently living sidenavs
|
|
3954
|
+
*/
|
|
3955
|
+
private readonly sidenavs;
|
|
3956
|
+
/**
|
|
3957
|
+
* Emits the most recent living SidenavContainer whenever it changes. So it's
|
|
3958
|
+
* either the SidenavContainer that was just added, or the one "before" the
|
|
3959
|
+
* SidenavContainer that was just removed
|
|
3960
|
+
*/
|
|
3961
|
+
readonly currentSidenav: Subject<NaturalSidenavContainerComponent | undefined>;
|
|
3962
|
+
/**
|
|
3963
|
+
* For internal use only
|
|
3964
|
+
* @internal
|
|
3965
|
+
*/
|
|
3966
|
+
register(sidenav: NaturalSidenavContainerComponent): void;
|
|
3967
|
+
/**
|
|
3968
|
+
* For internal use only
|
|
3969
|
+
* @internal
|
|
3970
|
+
*/
|
|
3971
|
+
unregister(sidenav: NaturalSidenavContainerComponent): void;
|
|
3972
|
+
private next;
|
|
3973
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSidenavStackService, never>;
|
|
3974
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalSidenavStackService>;
|
|
3975
|
+
}
|
|
3976
|
+
|
|
3977
|
+
declare class NaturalSidenavComponent {
|
|
3978
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSidenavComponent, never>;
|
|
3979
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSidenavComponent, "natural-sidenav", never, {}, {}, never, ["*"], true, never>;
|
|
3980
|
+
}
|
|
3981
|
+
|
|
3982
|
+
declare class NaturalSidenavContentComponent {
|
|
3983
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalSidenavContentComponent, never>;
|
|
3984
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalSidenavContentComponent, "natural-sidenav-content", never, {}, {}, never, ["*"], true, never>;
|
|
3985
|
+
}
|
|
3986
|
+
|
|
3987
|
+
type Stamped = {
|
|
3988
|
+
creator: NameOrFullName | null;
|
|
3989
|
+
updater: NameOrFullName | null;
|
|
3990
|
+
creationDate: string | null;
|
|
3991
|
+
updateDate: string | null;
|
|
3992
|
+
};
|
|
3993
|
+
declare class NaturalStampComponent {
|
|
3994
|
+
readonly item: i0.InputSignal<Stamped>;
|
|
3995
|
+
protected readonly showUpdate: i0.Signal<boolean>;
|
|
3996
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalStampComponent, never>;
|
|
3997
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalStampComponent, "natural-stamp", never, { "item": { "alias": "item"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
3998
|
+
}
|
|
3999
|
+
|
|
4000
|
+
/**
|
|
4001
|
+
* Button that fits well in a `<mat-table>` and support either
|
|
4002
|
+
* route navigation via `navigate`, or external URL via `href`,
|
|
4003
|
+
* or callback via `buttonClick`.
|
|
4004
|
+
*
|
|
4005
|
+
* If neither `navigate` nor `href` nor `buttonClick` have a meaningful value, then
|
|
4006
|
+
* it will show the icon and/or label in a `<span>` instead of a button.
|
|
4007
|
+
*
|
|
4008
|
+
* External URL will always be opened in new tab.
|
|
4009
|
+
*/
|
|
4010
|
+
declare class NaturalTableButtonComponent {
|
|
4011
|
+
readonly queryParams: i0.InputSignal<Params>;
|
|
4012
|
+
readonly queryParamsHandling: i0.InputSignal<QueryParamsHandling>;
|
|
4013
|
+
readonly label: i0.InputSignal<string | null | undefined>;
|
|
4014
|
+
readonly icon: i0.InputSignal<string | null | undefined>;
|
|
4015
|
+
readonly href: i0.InputSignal<string | null | undefined>;
|
|
4016
|
+
readonly navigate: i0.InputSignal<string | readonly any[] | UrlTree | null | undefined>;
|
|
4017
|
+
readonly fragment: i0.InputSignal<string | undefined>;
|
|
4018
|
+
readonly preserveFragment: i0.InputSignal<boolean>;
|
|
4019
|
+
readonly disabled: i0.InputSignal<boolean>;
|
|
4020
|
+
readonly raised: i0.InputSignal<boolean>;
|
|
4021
|
+
protected readonly appearance: i0.Signal<MatButtonAppearance>;
|
|
4022
|
+
protected readonly iconClass: i0.Signal<"" | "mat-elevation-z4">;
|
|
4023
|
+
readonly color: i0.InputSignal<ThemePalette>;
|
|
4024
|
+
protected readonly buttonClick$: Subject<MouseEvent>;
|
|
4025
|
+
readonly buttonClick: i0.OutputRef<MouseEvent>;
|
|
4026
|
+
protected readonly type: i0.Signal<"none" | "href" | "routerLinkOrClick">;
|
|
4027
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalTableButtonComponent, never>;
|
|
4028
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalTableButtonComponent, "natural-table-button", never, { "queryParams": { "alias": "queryParams"; "required": false; "isSignal": true; }; "queryParamsHandling": { "alias": "queryParamsHandling"; "required": false; "isSignal": true; }; "label": { "alias": "label"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "href": { "alias": "href"; "required": false; "isSignal": true; }; "navigate": { "alias": "navigate"; "required": false; "isSignal": true; }; "fragment": { "alias": "fragment"; "required": false; "isSignal": true; }; "preserveFragment": { "alias": "preserveFragment"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "raised": { "alias": "raised"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; }, { "buttonClick": "buttonClick"; }, never, never, true, never>;
|
|
4029
|
+
}
|
|
4030
|
+
|
|
4031
|
+
type NaturalDialogTriggerRoutingData<T, D> = {
|
|
4032
|
+
component: ComponentType<T>;
|
|
4033
|
+
afterClosedRoute?: RouterLink['routerLink'];
|
|
4034
|
+
dialogConfig: MatDialogConfig<D>;
|
|
4035
|
+
};
|
|
4036
|
+
type NaturalDialogTriggerProvidedData<D> = {
|
|
4037
|
+
data?: Readonly<D> | null;
|
|
4038
|
+
activatedRoute: ActivatedRoute;
|
|
4039
|
+
};
|
|
4040
|
+
type NaturalDialogTriggerRedirectionValues = RouterLink['routerLink'] | null | undefined | '' | -1;
|
|
4041
|
+
declare class NaturalDialogTriggerComponent<T, D> implements OnDestroy {
|
|
4042
|
+
private readonly dialog;
|
|
4043
|
+
private readonly route;
|
|
4044
|
+
private readonly router;
|
|
4045
|
+
private readonly dialogRef;
|
|
4046
|
+
private readonly triggerConfig;
|
|
4047
|
+
constructor();
|
|
4048
|
+
/**
|
|
4049
|
+
* Called when router leaves route, and so on, closes the modal with undefined value to prevent a new redirection
|
|
4050
|
+
*/
|
|
4051
|
+
ngOnDestroy(): void;
|
|
4052
|
+
/**
|
|
4053
|
+
* Redirects on modal closing under following rules/conditions
|
|
4054
|
+
*
|
|
4055
|
+
* If -1 : no redirection
|
|
4056
|
+
* If undefined, null or empty string : uses the router provided redirection route or fallbacks on parent route if router don't provide
|
|
4057
|
+
* If a value is provided, should be of type any[] and it's used for redirection.
|
|
4058
|
+
*/
|
|
4059
|
+
redirect(exitValue: NaturalDialogTriggerRedirectionValues): void;
|
|
4060
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalDialogTriggerComponent<any, any>, never>;
|
|
4061
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalDialogTriggerComponent<any, any>, "ng-component", never, {}, {}, never, never, true, never>;
|
|
4062
|
+
}
|
|
4063
|
+
|
|
4064
|
+
/**
|
|
4065
|
+
* A creator interface used to instantiate source implementation
|
|
4066
|
+
*/
|
|
4067
|
+
type SourceCreator = new (sourceValue: string) => Source;
|
|
4068
|
+
/**
|
|
4069
|
+
* Contract of all Sources.
|
|
4070
|
+
* Every source must implements the fetch method
|
|
4071
|
+
* in order to provide the avatar source.
|
|
4072
|
+
*/
|
|
4073
|
+
declare abstract class Source {
|
|
4074
|
+
private readonly value;
|
|
4075
|
+
constructor(value: string);
|
|
4076
|
+
getValue(): string;
|
|
4077
|
+
/**
|
|
4078
|
+
* Gets the avatar that usually is a URL, but,
|
|
4079
|
+
* for example it can also be a string of initials from the name.
|
|
4080
|
+
*/
|
|
4081
|
+
abstract getAvatar(size: number): Promise<string>;
|
|
4082
|
+
/**
|
|
4083
|
+
* Whether the avatar is purely textual or an URL for an image
|
|
4084
|
+
*/
|
|
4085
|
+
abstract isTextual(): boolean;
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
/**
|
|
4089
|
+
* Show an avatar from different sources
|
|
4090
|
+
*/
|
|
4091
|
+
declare class NaturalAvatarComponent {
|
|
4092
|
+
private readonly avatarService;
|
|
4093
|
+
readonly image: i0.InputSignal<string | null | undefined>;
|
|
4094
|
+
readonly initials: i0.InputSignal<string | null | undefined>;
|
|
4095
|
+
readonly gravatar: i0.InputSignal<string | null | undefined>;
|
|
4096
|
+
readonly size: i0.InputSignal<number>;
|
|
4097
|
+
readonly decorated: i0.InputSignal<boolean>;
|
|
4098
|
+
readonly textSizeRatio: i0.InputSignal<number>;
|
|
4099
|
+
readonly bgColor: i0.InputSignal<string | undefined>;
|
|
4100
|
+
readonly fgColor: i0.InputSignal<string>;
|
|
4101
|
+
readonly borderRadius: i0.InputSignal<string>;
|
|
4102
|
+
readonly textMaximumLength: i0.InputSignal<number>;
|
|
4103
|
+
private readonly sources;
|
|
4104
|
+
protected readonly currentSource: i0.Signal<Source | undefined>;
|
|
4105
|
+
protected readonly imageAvatar: i0.Signal<Promise<string> | undefined>;
|
|
4106
|
+
protected readonly textAvatar: i0.Signal<Promise<string> | undefined>;
|
|
4107
|
+
/**
|
|
4108
|
+
* Try to use the next available avatar source that has not already failed in the past
|
|
4109
|
+
*/
|
|
4110
|
+
tryNextSource(): void;
|
|
4111
|
+
private findNextNonFailingIndex;
|
|
4112
|
+
/**
|
|
4113
|
+
* Returns initials style
|
|
4114
|
+
*/
|
|
4115
|
+
protected readonly textualStyle: i0.Signal<Partial<CSSStyleDeclaration>>;
|
|
4116
|
+
/**
|
|
4117
|
+
* Returns image style
|
|
4118
|
+
*/
|
|
4119
|
+
protected readonly imageStyle: i0.Signal<Partial<CSSStyleDeclaration>>;
|
|
4120
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalAvatarComponent, never>;
|
|
4121
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalAvatarComponent, "natural-avatar", never, { "image": { "alias": "image"; "required": false; "isSignal": true; }; "initials": { "alias": "initials"; "required": false; "isSignal": true; }; "gravatar": { "alias": "gravatar"; "required": false; "isSignal": true; }; "size": { "alias": "size"; "required": false; "isSignal": true; }; "decorated": { "alias": "decorated"; "required": false; "isSignal": true; }; "textSizeRatio": { "alias": "textSizeRatio"; "required": false; "isSignal": true; }; "bgColor": { "alias": "bgColor"; "required": false; "isSignal": true; }; "fgColor": { "alias": "fgColor"; "required": false; "isSignal": true; }; "borderRadius": { "alias": "borderRadius"; "required": false; "isSignal": true; }; "textMaximumLength": { "alias": "textMaximumLength"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
4122
|
+
}
|
|
4123
|
+
|
|
4124
|
+
type SourceType = 'gravatar' | 'image' | 'initials';
|
|
4125
|
+
/**
|
|
4126
|
+
* Provides utilities methods related to Avatar component
|
|
4127
|
+
*/
|
|
4128
|
+
declare class AvatarService {
|
|
4129
|
+
/**
|
|
4130
|
+
* Ordered pairs of possible sources. First in the list is the highest priority.
|
|
4131
|
+
* And key must match one the input of AvatarComponent.
|
|
4132
|
+
*/
|
|
4133
|
+
private readonly sourceCreators;
|
|
4134
|
+
private readonly avatarColors;
|
|
4135
|
+
private readonly failedSources;
|
|
4136
|
+
getRandomColor(avatarText: string): string;
|
|
4137
|
+
getCreators(): IterableIterator<[SourceType, SourceCreator]>;
|
|
4138
|
+
private getSourceKey;
|
|
4139
|
+
sourceHasFailedBefore(source: Source): boolean;
|
|
4140
|
+
markSourceAsFailed(source: Source): void;
|
|
4141
|
+
private calculateAsciiCode;
|
|
4142
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AvatarService, never>;
|
|
4143
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<AvatarService>;
|
|
4144
|
+
}
|
|
4145
|
+
|
|
4146
|
+
/**
|
|
4147
|
+
* Incomplete list of Matomo functions. But it should be enough
|
|
4148
|
+
* for our basic needs.
|
|
4149
|
+
*
|
|
4150
|
+
* To complete this list, maybe see https://developer.matomo.org/guides/tracking-javascript-guide
|
|
4151
|
+
*/
|
|
4152
|
+
type MatomoFunction = 'setCustomUrl' | 'setCustomDimension' | 'setDocumentTitle' | 'setReferrerUrl' | 'setSiteId' | 'setTrackerUrl' | 'trackPageView';
|
|
4153
|
+
type PaqItem = [MatomoFunction, ...(number | string | null)[]];
|
|
4154
|
+
/**
|
|
4155
|
+
* Service to track visitors via Matomo.
|
|
4156
|
+
*
|
|
4157
|
+
* @dynamic
|
|
4158
|
+
*/
|
|
4159
|
+
declare class NaturalMatomoService {
|
|
4160
|
+
private readonly router;
|
|
4161
|
+
private readonly document;
|
|
4162
|
+
private readonly titleService;
|
|
4163
|
+
private readonly isBrowser;
|
|
4164
|
+
private readonly window;
|
|
4165
|
+
private subscription;
|
|
4166
|
+
private referrerUrl;
|
|
4167
|
+
constructor();
|
|
4168
|
+
/**
|
|
4169
|
+
* Inject Matomo script and start tracking all page navigation
|
|
4170
|
+
*/
|
|
4171
|
+
startTracking(url: string | null, site: number | null): void;
|
|
4172
|
+
stopTracking(): void;
|
|
4173
|
+
/**
|
|
4174
|
+
* Push a Matomo command on the stack
|
|
4175
|
+
*
|
|
4176
|
+
* It can be called at any time, including before Matomo is even loaded.
|
|
4177
|
+
*
|
|
4178
|
+
* Also see https://developer.matomo.org/guides/tracking-javascript-guide
|
|
4179
|
+
*/
|
|
4180
|
+
push(functionName: PaqItem[0], ...args: PaqItem[1][]): void;
|
|
4181
|
+
private injectTrackingCode;
|
|
4182
|
+
private listenForRouteChanges;
|
|
4183
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalMatomoService, never>;
|
|
4184
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalMatomoService>;
|
|
4185
|
+
}
|
|
4186
|
+
|
|
4187
|
+
type NaturalLoggerType = {
|
|
4188
|
+
message: string;
|
|
4189
|
+
stacktrace?: string;
|
|
4190
|
+
href?: string;
|
|
4191
|
+
host?: string;
|
|
4192
|
+
path?: string;
|
|
4193
|
+
agent?: string;
|
|
4194
|
+
status?: number;
|
|
4195
|
+
referrer?: string;
|
|
4196
|
+
url?: string;
|
|
4197
|
+
userId?: string;
|
|
4198
|
+
user?: string;
|
|
4199
|
+
[key: string]: any;
|
|
4200
|
+
};
|
|
4201
|
+
type NaturalLoggerExtra = {
|
|
4202
|
+
/**
|
|
4203
|
+
* Return an observable of extra data that will be logged. Those data will be merged into
|
|
4204
|
+
* the original data, and so it can override things.
|
|
4205
|
+
*
|
|
4206
|
+
* Only the first emitted value will be used.
|
|
4207
|
+
*/
|
|
4208
|
+
getExtras(error: unknown): Observable<Partial<NaturalLoggerType>>;
|
|
4209
|
+
};
|
|
4210
|
+
declare const NaturalLoggerConfigUrl: InjectionToken<string>;
|
|
4211
|
+
declare const NaturalLoggerConfigExtra: InjectionToken<NaturalLoggerExtra>;
|
|
4212
|
+
/**
|
|
4213
|
+
* Replace Angular's error handler to also send the log to a remote server via HTTP POST.
|
|
4214
|
+
*
|
|
4215
|
+
* Usage is automatic as soon as we provide it via:
|
|
4216
|
+
*
|
|
4217
|
+
* ```ts
|
|
4218
|
+
* provideErrorHandler('http://example.com', ExtraService),
|
|
4219
|
+
* ```
|
|
4220
|
+
*/
|
|
4221
|
+
declare class NaturalErrorHandler extends ErrorHandler {
|
|
4222
|
+
private readonly http;
|
|
4223
|
+
private readonly document;
|
|
4224
|
+
private readonly url;
|
|
4225
|
+
private readonly loggerExtra;
|
|
4226
|
+
constructor();
|
|
4227
|
+
handleError(error: any): void;
|
|
4228
|
+
private toMessage;
|
|
4229
|
+
/**
|
|
4230
|
+
* Send parameters to remote log
|
|
4231
|
+
*/
|
|
4232
|
+
private postLog;
|
|
4233
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalErrorHandler, never>;
|
|
4234
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<NaturalErrorHandler>;
|
|
4235
|
+
}
|
|
4236
|
+
|
|
4237
|
+
declare function provideErrorHandler(url: string | null, extraService?: Type<NaturalLoggerExtra>): Provider[];
|
|
4238
|
+
|
|
4239
|
+
/**
|
|
4240
|
+
* Need to add http:// prefix if we don't have prefix already AND we don't have part of it
|
|
4241
|
+
*/
|
|
4242
|
+
declare function ensureHttpPrefix(value: string | null): string | null;
|
|
4243
|
+
/**
|
|
4244
|
+
* This directive only supports ReactiveForms due to ngModel/ngControl encapsulation and changes emissions.
|
|
4245
|
+
*/
|
|
4246
|
+
declare class NaturalHttpPrefixDirective {
|
|
4247
|
+
readonly naturalHttpPrefix: i0.InputSignal<AbstractControl<any, any, any> | null>;
|
|
4248
|
+
httpize($event: string): void;
|
|
4249
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalHttpPrefixDirective, never>;
|
|
4250
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalHttpPrefixDirective, "[naturalHttpPrefix]", never, { "naturalHttpPrefix": { "alias": "naturalHttpPrefix"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
4251
|
+
}
|
|
4252
|
+
|
|
4253
|
+
/**
|
|
4254
|
+
* Minimal, global providers for Natural to work
|
|
4255
|
+
*/
|
|
4256
|
+
declare const naturalProviders: ApplicationConfig['providers'];
|
|
4257
|
+
|
|
4258
|
+
/**
|
|
4259
|
+
* Sign all HTTP POST requests that are GraphQL queries against `/graphql` endpoint with a custom signature.
|
|
4260
|
+
*
|
|
4261
|
+
* The server will validate the signature before executing the GraphQL query.
|
|
4262
|
+
*/
|
|
4263
|
+
declare function graphqlQuerySigner(key: string): HttpInterceptorFn;
|
|
4264
|
+
|
|
4265
|
+
export { AvatarService, InvalidWithValueStateMatcher$1 as InvalidWithValueStateMatcher, LOCAL_STORAGE, NATURAL_DROPDOWN_DATA, NATURAL_ICONS_CONFIG, NATURAL_PERSISTENCE_VALIDATOR, NATURAL_SEO_CONFIG, NaturalAbstractDetail, NaturalAbstractEditableList, NaturalAbstractList, NaturalAbstractModelService, NaturalAbstractNavigableList, NaturalAbstractPanel, NaturalAlertService, NaturalAvatarComponent, NaturalBackgroundDensityDirective, NaturalCapitalizePipe, NaturalColumnsPickerComponent, NaturalConfirmComponent, NaturalDataSource, NaturalDebounceService, NaturalDetailHeaderComponent, NaturalDialogTriggerComponent, NaturalDropdownRef, NaturalEllipsisPipe, NaturalEnumPipe, NaturalEnumService, NaturalErrorHandler, NaturalFileComponent, NaturalFileDropDirective, NaturalFileSelectDirective, NaturalFileService, NaturalFixedButtonComponent, NaturalFixedButtonDetailComponent, NaturalHierarchicSelectorComponent, NaturalHierarchicSelectorDialogComponent, NaturalHierarchicSelectorDialogService, NaturalHierarchicSelectorService, NaturalHttpPrefixDirective, NaturalIconDirective, NaturalLinkMutationService, NaturalLinkableTabDirective, NaturalLoggerConfigExtra, NaturalLoggerConfigUrl, NaturalMatomoService, NaturalMemoryStorage, NaturalPanelsComponent, NaturalPanelsService, NaturalPersistenceService, NaturalQueryVariablesManager, NaturalRelationsComponent, NaturalSearchComponent, NaturalSelectComponent, NaturalSelectEnumComponent, NaturalSelectHierarchicComponent, NaturalSeoService, NaturalSidenavComponent, NaturalSidenavContainerComponent, NaturalSidenavContentComponent, NaturalSidenavService, NaturalSidenavStackService, NaturalSrcDensityDirective, NaturalStampComponent, NaturalSwissParsingDateAdapter, NaturalTableButtonComponent, NaturalTimeAgoPipe, NetworkActivityService, PanelsHooksConfig, SESSION_STORAGE, SortingOrder, TypeBooleanComponent, TypeDateComponent, TypeDateRangeComponent, TypeHierarchicSelectorComponent, TypeNaturalSelectComponent, TypeNumberComponent, TypeOptionsComponent, TypeSelectComponent, TypeTextComponent, activityInterceptor, available, cancellableTimeout, cloneDeepButSkipFile, collectErrors, copyToClipboard, createHttpLink, debug, decimal, deepFreeze, deliverableEmail, ensureHttpPrefix, fallbackIfNoOpenedPanels, formatIsoDate, formatIsoDateTime, fromUrl, getForegroundColor, graphqlQuerySigner, hasFilesAndProcessDate, ifValid, integer, isFile, localStorageFactory, localStorageProvider, makePlural, memoryLocalStorageProvider, memorySessionStorageProvider, mergeOverrideArray, money, naturalPanelsUrlMatcher, naturalProviders, onHistoryEvent, possibleComparableOperators, provideErrorHandler, provideIcons, providePanels, provideSeo, relationsToIds, replaceObjectKeepingReference, replaceOperatorByField, replaceOperatorByName, rgbToHex, sessionStorageFactory, sessionStorageProvider, toGraphQLDoctrineFilter, toNavigationParameters, toUrl, unique, upperCaseFirstLetter, urlValidator, validTlds, validateAllFormControls, validateColumns, validatePagination, validateSorting, wrapLike, wrapPrefix, wrapSuffix };
|
|
4266
|
+
export type { AvailableColumn, Button, DropdownComponent, DropdownFacet, ExtractResolve, ExtractTall, ExtractTallOne, ExtractTcreate, ExtractTdelete, ExtractTone, ExtractTupdate, ExtractVall, ExtractVcreate, ExtractVdelete, ExtractVone, ExtractVupdate, Facet, FileModel, FileSelection, Filter, FilterGroupConditionField, FlagFacet, FormAsyncValidators, FormControls, FormValidators, HierarchicDialogConfig, HierarchicDialogResult, HierarchicFilterConfiguration$1 as HierarchicFilterConfiguration, HierarchicFiltersConfiguration$1 as HierarchicFiltersConfiguration, IEnum, InvalidFile, LinkableObject, Literal, NameOrFullName, NaturalConfirmData, NaturalDialogTriggerProvidedData, NaturalDialogTriggerRedirectionValues, NaturalDialogTriggerRoutingData, NaturalDropdownData, NaturalHierarchicConfiguration, NaturalIconConfig, NaturalIconsConfig, NaturalLoggerExtra, NaturalLoggerType, NaturalPanelConfig, NaturalPanelData, NaturalPanelResolves, NaturalPanelsBeforeOpenPanel, NaturalPanelsHooksConfig, NaturalPanelsRouteConfig, NaturalPanelsRouterRule, NaturalPanelsRoutesConfig, NaturalSearchFacets, NaturalSearchSelection, NaturalSearchSelections, NaturalSeo, NaturalSeoBasic, NaturalSeoCallback, NaturalSeoConfig, NaturalSeoResolve, NaturalSeoResolveData, NaturalStorage, NavigableItem, OrganizedModelSelection, PaginatedData, PaginationInput, PersistenceValidator, PossibleComparableOpertorKeys, QueryVariables, ResolvedData, Sorting, SubButton, TypeBooleanConfiguration, TypeDateConfiguration, TypeDateRangeConfiguration, TypeHierarchicSelectorConfiguration, TypeNumberConfiguration, TypeOption, TypeOptionsConfiguration, TypeSelectConfiguration, TypeSelectItem, TypeSelectNaturalConfiguration, VariablesWithInput, WithId };
|