@sumaris-net/ngx-components 2.7.6 → 2.8.0-rc2
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/doc/changelog.md +8 -0
- package/esm2022/public_api.mjs +7 -3
- package/esm2022/src/app/admin/users/users.mjs +5 -3
- package/esm2022/src/app/core/account/new-token.modal.mjs +4 -4
- package/esm2022/src/app/core/auth/auth.form.mjs +2 -2
- package/esm2022/src/app/core/core.testing.module.mjs +2 -2
- package/esm2022/src/app/core/form/entity/editor.class.mjs +33 -487
- package/esm2022/src/app/core/form/entity/entity-editor-modal.class.mjs +14 -26
- package/esm2022/src/app/core/form/entity/entity-editor.class.mjs +5 -4
- package/esm2022/src/app/core/form/entity/tab-editor.class.mjs +194 -0
- package/esm2022/src/app/core/form/form-container.class.mjs +312 -0
- package/esm2022/src/app/core/form/form.class.mjs +27 -36
- package/esm2022/src/app/core/form/form.utils.mjs +1 -1
- package/esm2022/src/app/core/menu/testing/menu.testing.mjs +2 -2
- package/esm2022/src/app/core/services/model/settings.model.mjs +2 -1
- package/esm2022/src/app/core/settings/settings.page.mjs +5 -9
- package/esm2022/src/app/core/table/table.class.mjs +9 -5
- package/esm2022/src/app/core/table/table.module.mjs +16 -3
- package/esm2022/src/app/core/table/table.pipes.mjs +74 -0
- package/esm2022/src/app/core/table/testing/table.testing.mjs +39 -17
- package/esm2022/src/app/core/table/testing/table2.testing.mjs +40 -22
- package/esm2022/src/app/shared/material/boolean/material.boolean.mjs +3 -3
- package/esm2022/src/app/shared/pipes/form.pipes.mjs +10 -10
- package/esm2022/src/app/shared/pipes/pipes.module.mjs +28 -3
- package/esm2022/src/app/shared/pipes/selection.pipes.mjs +176 -0
- package/esm2022/src/app/shared/validator/validators.mjs +3 -2
- package/fesm2022/sumaris-net.ngx-components.mjs +655 -321
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +6 -2
- package/src/app/core/account/new-token.modal.d.ts +1 -1
- package/src/app/core/form/entity/editor.class.d.ts +18 -177
- package/src/app/core/form/entity/entity-editor-modal.class.d.ts +9 -12
- package/src/app/core/form/entity/entity-editor.class.d.ts +10 -6
- package/src/app/core/form/entity/tab-editor.class.d.ts +70 -0
- package/src/app/core/form/form-container.class.d.ts +123 -0
- package/src/app/core/form/form.class.d.ts +11 -21
- package/src/app/core/form/form.utils.d.ts +38 -23
- package/src/app/core/menu/testing/menu.testing.d.ts +1 -1
- package/src/app/core/services/model/settings.model.d.ts +1 -0
- package/src/app/core/settings/settings.page.d.ts +1 -2
- package/src/app/core/table/table.module.d.ts +4 -3
- package/src/app/core/table/table.pipes.d.ts +28 -0
- package/src/app/core/table/testing/table.testing.d.ts +9 -5
- package/src/app/core/table/testing/table2.testing.d.ts +10 -5
- package/src/app/shared/pipes/form.pipes.d.ts +1 -1
- package/src/app/shared/pipes/pipes.module.d.ts +5 -4
- package/src/app/shared/pipes/selection.pipes.d.ts +62 -0
- package/src/app/shared/validator/validators.d.ts +1 -0
- package/src/assets/manifest.json +1 -1
- package/src/theme/_ngx-components.scss +4 -0
- package/src/theme/_ngx-components.table.scss +4 -14
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -84,6 +84,7 @@ export * from './src/app/shared/pipes/form.pipes';
|
|
|
84
84
|
export * from './src/app/shared/pipes/colors.pipe';
|
|
85
85
|
export * from './src/app/shared/pipes/types.pipes';
|
|
86
86
|
export * from './src/app/shared/pipes/maskito.pipe';
|
|
87
|
+
export * from './src/app/shared/pipes/selection.pipes';
|
|
87
88
|
export * from './src/app/shared/services';
|
|
88
89
|
export * from './src/app/shared/audio/audio';
|
|
89
90
|
export * from './src/app/shared/file/file.service';
|
|
@@ -118,7 +119,7 @@ export * from './src/app/shared/file/uri.utils';
|
|
|
118
119
|
export * from './src/app/shared/hotkeys/shared-hotkeys.module';
|
|
119
120
|
export * from './src/app/shared/hotkeys/hotkeys.service';
|
|
120
121
|
export * from './src/app/shared/hotkeys/dialog/hotkeys-dialog.component';
|
|
121
|
-
export { Color, ColorName, ColorScale, ColorScaleLegend, ColorScaleOptions, ColorGradientOptions, ColorScaleLegendItem } from './src/app/shared/graph/graph-colors';
|
|
122
|
+
export { Color, ColorName, ColorScale, ColorScaleLegend, ColorScaleOptions, ColorGradientOptions, ColorScaleLegendItem, } from './src/app/shared/graph/graph-colors';
|
|
122
123
|
export * from './src/app/shared/graph/colors.utils';
|
|
123
124
|
export * from './src/app/shared/gesture/gesture-config';
|
|
124
125
|
export * from './src/app/shared/gesture/hammer.utils';
|
|
@@ -143,7 +144,7 @@ export * from './src/app/core/services/model/history.model';
|
|
|
143
144
|
export * from './src/app/core/services/model/model.enum';
|
|
144
145
|
export * from './src/app/core/services/model/peer.model';
|
|
145
146
|
export * from './src/app/core/services/model/person.model';
|
|
146
|
-
export { IReferentialRef, ReferentialRef, BaseReferential, Referential, ReferentialUtils, ReferentialAsObjectOptions, referentialToString, referentialsToString, IStatus, StatusList, StatusById, MINIFY_ENTITY_FOR_LOCAL_STORAGE, MINIFY_ENTITY_FOR_POD } from './src/app/core/services/model/referential.model';
|
|
147
|
+
export { IReferentialRef, ReferentialRef, BaseReferential, Referential, ReferentialUtils, ReferentialAsObjectOptions, referentialToString, referentialsToString, IStatus, StatusList, StatusById, MINIFY_ENTITY_FOR_LOCAL_STORAGE, MINIFY_ENTITY_FOR_POD, } from './src/app/core/services/model/referential.model';
|
|
147
148
|
export * from './src/app/core/services/model/settings.model';
|
|
148
149
|
export * from './src/app/core/graphql/graphql.module';
|
|
149
150
|
export * from './src/app/core/graphql/graphql.service';
|
|
@@ -170,10 +171,12 @@ export * from './src/app/core/services/storage/entity-store.class';
|
|
|
170
171
|
export * from './src/app/core/services/validator/base.validator.class';
|
|
171
172
|
export * from './src/app/core/form/form.class';
|
|
172
173
|
export * from './src/app/core/form/form.utils';
|
|
174
|
+
export * from './src/app/core/form/form-container.class';
|
|
173
175
|
export * from './src/app/core/form/form.module';
|
|
174
176
|
export * from './src/app/core/form/buttons/form-buttons-bar.component';
|
|
175
177
|
export * from './src/app/core/form/buttons/form-buttons-bar.module';
|
|
176
178
|
export * from './src/app/core/form/entity/editor.class';
|
|
179
|
+
export * from './src/app/core/form/entity/tab-editor.class';
|
|
177
180
|
export * from './src/app/core/form/entity/entity-editor.class';
|
|
178
181
|
export * from './src/app/core/form/entity/entity-editor-modal.class';
|
|
179
182
|
export * from './src/app/core/form/entity/entity-metadata.component';
|
|
@@ -189,6 +192,7 @@ export * from './src/app/core/table/table.model';
|
|
|
189
192
|
export * from './src/app/core/table/table.class';
|
|
190
193
|
export * from './src/app/core/table/async-table.class';
|
|
191
194
|
export * from './src/app/core/table/table.utils';
|
|
195
|
+
export * from './src/app/core/table/table.pipes';
|
|
192
196
|
export * from './src/app/core/table/table.module';
|
|
193
197
|
export * from './src/app/core/table/memory-table.class';
|
|
194
198
|
export * from './src/app/core/table/entities-table-datasource.class';
|
|
@@ -29,7 +29,7 @@ export declare class NewTokenModal extends AppEntityEditorModal<UserToken> imple
|
|
|
29
29
|
protected get form(): UntypedFormGroup;
|
|
30
30
|
protected getFirstInvalidTabIndex(): number;
|
|
31
31
|
protected registerForms(): void;
|
|
32
|
-
|
|
32
|
+
setValue(data: UserToken): Promise<void> | void;
|
|
33
33
|
protected getValue(): Promise<UserToken>;
|
|
34
34
|
generate(event: UIEvent): Promise<void>;
|
|
35
35
|
copy(event: UIEvent): Promise<void>;
|
|
@@ -1,168 +1,57 @@
|
|
|
1
|
-
import { AfterViewInit,
|
|
1
|
+
import { AfterViewInit, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { ActivatedRoute, Params, Router } from '@angular/router';
|
|
3
|
-
import { MatTabChangeEvent, MatTabGroup } from '@angular/material/tabs';
|
|
4
3
|
import { AlertController, IonContent, NavController, ToastController } from '@ionic/angular';
|
|
5
4
|
import { TranslateService } from '@ngx-translate/core';
|
|
6
|
-
import { BehaviorSubject
|
|
7
|
-
import { AppTable } from '../../table/table.class';
|
|
8
|
-
import { AppForm } from '../form.class';
|
|
5
|
+
import { BehaviorSubject } from 'rxjs';
|
|
9
6
|
import { FormButtonsBarToken } from '../buttons/form-buttons-bar.component';
|
|
10
7
|
import { IAppForm, IAppFormGetter } from '../form.utils';
|
|
11
8
|
import { ShowToastOptions } from '../../../shared/toast/toasts';
|
|
12
|
-
import { HammerSwipeEvent } from '../../../shared/gesture/hammer.utils';
|
|
13
9
|
import { ToolbarToken } from '../../../shared/toolbar/toolbar';
|
|
14
10
|
import { CanLeave } from '../../../shared/guard/component-dirty.guard';
|
|
15
|
-
import {
|
|
16
|
-
import { WaitForOptions } from '../../../shared/observables';
|
|
11
|
+
import { AppFormContainer, IAppFormContainer } from '../form-container.class';
|
|
17
12
|
import * as i0 from "@angular/core";
|
|
18
|
-
export interface IAppEditor extends CanLeave,
|
|
13
|
+
export interface IAppEditor<T> extends CanLeave, IAppFormContainer<T> {
|
|
19
14
|
save(event?: Event, options?: any): Promise<boolean>;
|
|
20
15
|
cancel(event?: Event): Promise<void>;
|
|
21
|
-
addChildForm(form: IAppForm | IAppFormGetter): void;
|
|
22
|
-
}
|
|
23
|
-
export interface IAppTabEditor extends IAppEditor {
|
|
24
|
-
selectedTabIndex: number;
|
|
25
|
-
setSelectedTabIndex(value: number, opts?: {
|
|
26
|
-
emitEvent?: boolean;
|
|
27
|
-
realignInkBar?: boolean;
|
|
28
|
-
}): void;
|
|
29
|
-
unload(opts?: {
|
|
30
|
-
emitEvent?: boolean;
|
|
31
|
-
}): Promise<void>;
|
|
32
|
-
realignInkBar(): any;
|
|
33
16
|
}
|
|
34
|
-
export declare class
|
|
35
|
-
/**
|
|
36
|
-
* Number of tab. 1 by default
|
|
37
|
-
*/
|
|
38
|
-
tabCount?: number;
|
|
39
|
-
/**
|
|
40
|
-
* '200ms' by default
|
|
41
|
-
*/
|
|
42
|
-
tabGroupAnimationDuration?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Should enable swipe between tab, on touch screen
|
|
45
|
-
*/
|
|
46
|
-
enableSwipe?: boolean;
|
|
47
|
-
}
|
|
48
|
-
export declare abstract class AppEditor<T = any, ID = number, O = any> implements IAppEditor, OnInit, OnDestroy, AfterViewInit {
|
|
17
|
+
export declare abstract class AppEditor<T = any, ID = number, O = any> extends AppFormContainer<T> implements IAppEditor<T>, OnInit, OnDestroy, AfterViewInit {
|
|
49
18
|
protected route: ActivatedRoute;
|
|
50
19
|
protected router: Router;
|
|
51
20
|
protected navController: NavController;
|
|
52
21
|
protected alertCtrl: AlertController;
|
|
53
22
|
protected translate: TranslateService;
|
|
54
|
-
private _children;
|
|
55
|
-
private _subscription;
|
|
56
|
-
protected _enabled: boolean;
|
|
57
23
|
protected toastController: ToastController;
|
|
58
|
-
protected readonly destroySubject: Subject<void>;
|
|
59
|
-
readonly readySubject: BehaviorSubject<boolean>;
|
|
60
|
-
readonly dirtySubject: BehaviorSubject<boolean>;
|
|
61
|
-
readonly loadingSubject: BehaviorSubject<boolean>;
|
|
62
|
-
readonly errorSubject: BehaviorSubject<string>;
|
|
63
24
|
readonly savingSubject: BehaviorSubject<boolean>;
|
|
64
|
-
readonly touchedSubject: BehaviorSubject<boolean>;
|
|
65
|
-
debug: boolean;
|
|
66
|
-
previousDataId: ID;
|
|
67
25
|
submitted: boolean;
|
|
68
26
|
queryParams: Params;
|
|
69
27
|
i18nContext: {
|
|
70
28
|
prefix: string;
|
|
71
29
|
suffix: string;
|
|
72
30
|
};
|
|
73
|
-
/**
|
|
74
|
-
* @deprecated
|
|
75
|
-
*/
|
|
76
|
-
protected set _loading(value: boolean);
|
|
77
|
-
/**
|
|
78
|
-
* @deprecated
|
|
79
|
-
*/
|
|
80
|
-
protected get _loading(): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* @deprecated
|
|
83
|
-
*/
|
|
84
|
-
protected get _$ready(): BehaviorSubject<boolean>;
|
|
85
|
-
/**
|
|
86
|
-
* @deprecated
|
|
87
|
-
*/
|
|
88
|
-
protected get _$loading(): BehaviorSubject<boolean>;
|
|
89
|
-
get error(): string;
|
|
90
|
-
set error(error: string);
|
|
91
31
|
get saving(): boolean;
|
|
92
|
-
get destroyed(): boolean;
|
|
93
32
|
toolbar: ToolbarToken | null;
|
|
94
33
|
formButtonsBar: FormButtonsBarToken | null;
|
|
95
34
|
content: IonContent;
|
|
96
|
-
get tables(): AppTable<any>[];
|
|
97
|
-
get forms(): AppForm<any>[];
|
|
98
|
-
get editors(): AppEditor<any>[];
|
|
99
|
-
get dirty(): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Is valid (tables and forms)
|
|
102
|
-
*/
|
|
103
|
-
get valid(): boolean;
|
|
104
|
-
get invalid(): boolean;
|
|
105
|
-
get pending(): boolean;
|
|
106
|
-
get loading(): boolean;
|
|
107
|
-
get loaded(): boolean;
|
|
108
|
-
get touched(): boolean;
|
|
109
|
-
get untouched(): boolean;
|
|
110
|
-
get enabled(): boolean;
|
|
111
|
-
get disabled(): boolean;
|
|
112
|
-
get children(): IAppForm[];
|
|
113
|
-
get empty(): boolean;
|
|
114
35
|
abstract get isNewData(): boolean;
|
|
115
36
|
protected constructor(route: ActivatedRoute, router: Router, navController: NavController, alertCtrl: AlertController, translate: TranslateService);
|
|
116
37
|
ngOnInit(): void;
|
|
117
38
|
ngAfterViewInit(): void;
|
|
118
39
|
ngOnDestroy(): void;
|
|
119
|
-
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use addForm(path, form)
|
|
42
|
+
* @param form
|
|
43
|
+
*/
|
|
44
|
+
addChildForm(form: IAppForm | IAppFormGetter): void;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use addForms()
|
|
47
|
+
* @param forms
|
|
48
|
+
*/
|
|
120
49
|
addChildForms(forms: (IAppForm | IAppFormGetter)[]): void;
|
|
121
|
-
removeChildForm(form: IAppForm | IAppFormGetter): IAppForm | IAppFormGetter;
|
|
122
|
-
disable(opts?: {
|
|
123
|
-
onlySelf?: boolean;
|
|
124
|
-
emitEvent?: boolean;
|
|
125
|
-
}): void;
|
|
126
|
-
enable(opts?: {
|
|
127
|
-
onlySelf?: boolean;
|
|
128
|
-
emitEvent?: boolean;
|
|
129
|
-
}): void;
|
|
130
|
-
markAsPristine(opts?: {
|
|
131
|
-
onlySelf?: boolean;
|
|
132
|
-
emitEvent?: boolean;
|
|
133
|
-
}): void;
|
|
134
|
-
markAsUntouched(opts?: {
|
|
135
|
-
onlySelf?: boolean;
|
|
136
|
-
emitEvent?: boolean;
|
|
137
|
-
}): void;
|
|
138
50
|
/**
|
|
139
|
-
* @deprecated
|
|
140
|
-
* @param
|
|
51
|
+
* @deprecated Use removeForm()
|
|
52
|
+
* @param form
|
|
141
53
|
*/
|
|
142
|
-
|
|
143
|
-
onlySelf?: boolean;
|
|
144
|
-
emitEvent?: boolean;
|
|
145
|
-
}): void;
|
|
146
|
-
markAllAsTouched(opts?: {
|
|
147
|
-
emitEvent?: boolean;
|
|
148
|
-
}): void;
|
|
149
|
-
markAsDirty(opts?: {
|
|
150
|
-
onlySelf?: boolean;
|
|
151
|
-
emitEvent?: boolean;
|
|
152
|
-
}): void;
|
|
153
|
-
markAsLoading(opts?: {
|
|
154
|
-
onlySelf?: boolean;
|
|
155
|
-
emitEvent?: boolean;
|
|
156
|
-
}): void;
|
|
157
|
-
markAsLoaded(opts?: {
|
|
158
|
-
onlySelf?: boolean;
|
|
159
|
-
emitEvent?: boolean;
|
|
160
|
-
}): void;
|
|
161
|
-
markAsReady(opts?: {
|
|
162
|
-
emitEvent?: boolean;
|
|
163
|
-
}): void;
|
|
164
|
-
ready(opts?: WaitForOptions): Promise<void>;
|
|
165
|
-
waitIdle(opts?: WaitForOptions): Promise<void>;
|
|
54
|
+
removeChildForm(form: IAppForm | IAppFormGetter): IAppForm | IAppFormGetter;
|
|
166
55
|
markAsSaving(opts?: {
|
|
167
56
|
emitEvent?: boolean;
|
|
168
57
|
}): void;
|
|
@@ -183,61 +72,13 @@ export declare abstract class AppEditor<T = any, ID = number, O = any> implement
|
|
|
183
72
|
abstract load(id?: ID, options?: O): Promise<void>;
|
|
184
73
|
abstract save(event?: Event, options?: any): Promise<boolean>;
|
|
185
74
|
abstract reload(): Promise<void>;
|
|
186
|
-
logFormErrors(prefix?: string): void;
|
|
187
75
|
protected scrollToTop(duration?: number): Promise<void>;
|
|
188
|
-
protected registerSubscription(sub: Subscription | TeardownLogic): void;
|
|
189
|
-
protected unregisterSubscription(sub: Subscription): void;
|
|
190
76
|
protected saveIfDirtyAndConfirm(event?: Event, opts?: {
|
|
191
77
|
emitEvent?: boolean;
|
|
192
78
|
confirmed?: boolean;
|
|
193
79
|
}): Promise<boolean>;
|
|
80
|
+
protected saveDirtyChildren(): Promise<boolean>;
|
|
194
81
|
protected showToast(opts: ShowToastOptions): Promise<void>;
|
|
195
|
-
protected logChildrenErrors(c: IAppForm | AbstractControl, prefix?: string, path?: string): void;
|
|
196
|
-
protected setError(value: string, opts?: {
|
|
197
|
-
emitEvent?: boolean;
|
|
198
|
-
}): void;
|
|
199
|
-
protected resetError(opts?: {
|
|
200
|
-
emitEvent?: boolean;
|
|
201
|
-
}): void;
|
|
202
|
-
protected markForCheck(): void;
|
|
203
82
|
static ɵfac: i0.ɵɵFactoryDeclaration<AppEditor<any, any, any>, never>;
|
|
204
83
|
static ɵdir: i0.ɵɵDirectiveDeclaration<AppEditor<any, any, any>, never, never, {}, {}, never, never, false, never>;
|
|
205
84
|
}
|
|
206
|
-
export declare abstract class AppTabEditor<T = any, ID = number, O = any> extends AppEditor<T, ID, O> implements IAppTabEditor, OnInit, OnDestroy {
|
|
207
|
-
protected route: ActivatedRoute;
|
|
208
|
-
protected router: Router;
|
|
209
|
-
protected navController: NavController;
|
|
210
|
-
protected alertCtrl: AlertController;
|
|
211
|
-
protected translate: TranslateService;
|
|
212
|
-
protected _selectedTabIndex: number;
|
|
213
|
-
tabCount: number;
|
|
214
|
-
enableSwipe: boolean;
|
|
215
|
-
tabGroupAnimationDuration: string;
|
|
216
|
-
queryTabIndexParamName: string;
|
|
217
|
-
set selectedTabIndex(value: number);
|
|
218
|
-
get selectedTabIndex(): number;
|
|
219
|
-
readonly selectedTabIndexChange: EventEmitter<number>;
|
|
220
|
-
tabGroup: MatTabGroup;
|
|
221
|
-
protected constructor(route: ActivatedRoute, // Modal editor give 'null'
|
|
222
|
-
router: Router, navController: NavController, alertCtrl: AlertController, translate: TranslateService, options?: AppTabEditorOptions);
|
|
223
|
-
ngOnInit(): void;
|
|
224
|
-
ngOnDestroy(): void;
|
|
225
|
-
setSelectedTabIndex(value: number, opts?: {
|
|
226
|
-
emitEvent?: boolean;
|
|
227
|
-
realignInkBar?: boolean;
|
|
228
|
-
}): void;
|
|
229
|
-
realignInkBar(): void;
|
|
230
|
-
onTabChange(event: MatTabChangeEvent, queryTabIndexParamName?: string): boolean;
|
|
231
|
-
/**
|
|
232
|
-
* Action triggered when user swipes
|
|
233
|
-
*/
|
|
234
|
-
onSwipeTab(event: HammerSwipeEvent): boolean;
|
|
235
|
-
onSubTabChange(event: MatTabChangeEvent): void;
|
|
236
|
-
unload(opts?: {
|
|
237
|
-
emitEvent?: boolean;
|
|
238
|
-
}): Promise<void>;
|
|
239
|
-
protected abstract getFirstInvalidTabIndex(): number;
|
|
240
|
-
protected saveDirtyChildren(): Promise<boolean>;
|
|
241
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<AppTabEditor<any, any, any>, [{ optional: true; }, null, null, null, null, { optional: true; }]>;
|
|
242
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<AppTabEditor<any, any, any>, never, never, { "queryTabIndexParamName": { "alias": "queryTabIndexParamName"; "required": false; }; "selectedTabIndex": { "alias": "selectedTabIndex"; "required": false; }; }, { "selectedTabIndexChange": "selectedTabIndexChange"; }, never, never, false, never>;
|
|
243
|
-
}
|
|
@@ -5,7 +5,7 @@ import { LocalSettingsService } from '../../services/local-settings.service';
|
|
|
5
5
|
import { Entity } from '../../services/model/entity.model';
|
|
6
6
|
import { UsageMode } from '../../services/model/settings.model';
|
|
7
7
|
import { FormGroup } from '@angular/forms';
|
|
8
|
-
import { AppTabEditor, AppTabEditorOptions } from './editor.class';
|
|
8
|
+
import { AppTabEditor, AppTabEditorOptions } from './tab-editor.class';
|
|
9
9
|
import { DateFormatService } from '../../../shared/pipes/date-format.pipe';
|
|
10
10
|
import { WaitForOptions } from '../../../shared/observables';
|
|
11
11
|
import { FormErrorTranslator } from '../../../shared/validator/form-error-adapter.class';
|
|
@@ -26,7 +26,7 @@ export declare class AppEntityEditorModalOptions extends AppTabEditorOptions {
|
|
|
26
26
|
}
|
|
27
27
|
export declare abstract class AppEntityEditorModal<T extends Entity<T, ID>, ID = number, O extends AppEntityEditorModalOptions = AppEntityEditorModalOptions> extends AppTabEditor<T, ID> implements OnInit, OnDestroy, AfterViewInit, IEntityEditorModalOptions<T, ID> {
|
|
28
28
|
protected dataType: new () => T;
|
|
29
|
-
protected _logPrefix:
|
|
29
|
+
protected _logPrefix: string;
|
|
30
30
|
protected _isNew: boolean;
|
|
31
31
|
protected readonly dateFormat: DateFormatService;
|
|
32
32
|
protected readonly cd: ChangeDetectorRef;
|
|
@@ -34,13 +34,17 @@ export declare abstract class AppEntityEditorModal<T extends Entity<T, ID>, ID =
|
|
|
34
34
|
protected readonly modalCtrl: ModalController;
|
|
35
35
|
protected errorTranslator: FormErrorTranslator;
|
|
36
36
|
readonly savingSubject: BehaviorSubject<boolean>;
|
|
37
|
-
|
|
37
|
+
readonly titleSubject: BehaviorSubject<string>;
|
|
38
38
|
data: T;
|
|
39
39
|
mobile: boolean;
|
|
40
40
|
usageMode: UsageMode;
|
|
41
41
|
onAfterModalInit: <M extends AppEntityEditorModal<T, ID>>(modal: M) => void | Promise<void>;
|
|
42
42
|
onDelete: (event: Event, data: T) => Promise<boolean>;
|
|
43
43
|
i18nSuffix: string;
|
|
44
|
+
/**
|
|
45
|
+
* @deprecated
|
|
46
|
+
*/
|
|
47
|
+
protected get $title(): Subject<string>;
|
|
44
48
|
set isNew(value: boolean);
|
|
45
49
|
get isNew(): boolean;
|
|
46
50
|
/**
|
|
@@ -54,13 +58,6 @@ export declare abstract class AppEntityEditorModal<T extends Entity<T, ID>, ID =
|
|
|
54
58
|
set disabled(value: boolean);
|
|
55
59
|
get disabled(): boolean;
|
|
56
60
|
get isOnFieldMode(): boolean;
|
|
57
|
-
get saving(): boolean;
|
|
58
|
-
markAsSaving(opts?: {
|
|
59
|
-
emitEvent?: boolean;
|
|
60
|
-
}): void;
|
|
61
|
-
markAsSaved(opts?: {
|
|
62
|
-
emitEvent?: boolean;
|
|
63
|
-
}): void;
|
|
64
61
|
protected constructor(injector: Injector, dataType: new () => T, options?: O);
|
|
65
62
|
ngOnInit(): void;
|
|
66
63
|
ngAfterViewInit(): void;
|
|
@@ -104,9 +101,9 @@ export declare abstract class AppEntityEditorModal<T extends Entity<T, ID>, ID =
|
|
|
104
101
|
emitEvent?: boolean;
|
|
105
102
|
detailsCssClass?: string;
|
|
106
103
|
}): void;
|
|
107
|
-
|
|
104
|
+
abstract setValue(data: T): Promise<void> | void;
|
|
105
|
+
protected abstract registerForms(): void;
|
|
108
106
|
protected abstract computeTitle(data: T): Promise<string>;
|
|
109
|
-
protected abstract setValue(data: T): Promise<void> | void;
|
|
110
107
|
protected abstract get form(): FormGroup;
|
|
111
108
|
protected abstract getFirstInvalidTabIndex(): number;
|
|
112
109
|
protected waitWhilePending(opts?: WaitForOptions): Promise<void>;
|
|
@@ -5,7 +5,7 @@ import { AddToPageHistoryOptions, LocalSettingsService } from '../../services/lo
|
|
|
5
5
|
import { Entity } from '../../services/model/entity.model';
|
|
6
6
|
import { UsageMode } from '../../services/model/settings.model';
|
|
7
7
|
import { FormGroup } from '@angular/forms';
|
|
8
|
-
import { AppTabEditor, AppTabEditorOptions, IAppTabEditor } from './editor.class';
|
|
8
|
+
import { AppTabEditor, AppTabEditorOptions, IAppTabEditor } from './tab-editor.class';
|
|
9
9
|
import { EntityServiceLoadOptions, IEntityService } from '../../../shared/services/entity-service.class';
|
|
10
10
|
import { DateFormatService } from '../../../shared/pipes/date-format.pipe';
|
|
11
11
|
import { Environment } from '../../../../environments/environment.class';
|
|
@@ -14,7 +14,7 @@ import { WaitForOptions } from '../../../shared/observables';
|
|
|
14
14
|
import { FormErrorTranslator } from '../../../shared/validator/form-error-adapter.class';
|
|
15
15
|
import { FormErrors } from '../../../shared/forms';
|
|
16
16
|
import * as i0 from "@angular/core";
|
|
17
|
-
export interface IAppEntityEditor extends IAppTabEditor {
|
|
17
|
+
export interface IAppEntityEditor<T> extends IAppTabEditor<T> {
|
|
18
18
|
usageMode: UsageMode;
|
|
19
19
|
isNewData: boolean;
|
|
20
20
|
}
|
|
@@ -43,10 +43,11 @@ export interface AppErrorWithDetails extends AppError {
|
|
|
43
43
|
errors?: FormErrors;
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends IEntityService<T, ID> = IEntityService<T, any>, ID = number, LO extends EntityServiceLoadOptions = EntityServiceLoadOptions> extends AppTabEditor<T, ID, LO> implements OnInit, OnDestroy, AfterViewInit, IAppEntityEditor {
|
|
46
|
+
export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends IEntityService<T, ID> = IEntityService<T, any>, ID = number, LO extends EntityServiceLoadOptions = EntityServiceLoadOptions> extends AppTabEditor<T, ID, LO> implements OnInit, OnDestroy, AfterViewInit, IAppEntityEditor<T> {
|
|
47
47
|
protected dataType: new () => T;
|
|
48
48
|
protected dataService?: S;
|
|
49
49
|
data: T;
|
|
50
|
+
previousDataId: ID;
|
|
50
51
|
defaultBackHref: string;
|
|
51
52
|
historyIcon: {
|
|
52
53
|
icon?: string;
|
|
@@ -170,7 +171,7 @@ export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends
|
|
|
170
171
|
protected onEntityDeleted(data: T): Promise<void>;
|
|
171
172
|
protected computeUsageMode(data: T): UsageMode;
|
|
172
173
|
protected waitWhilePending(opts?: WaitForOptions): Promise<void>;
|
|
173
|
-
|
|
174
|
+
getValue(): Promise<T>;
|
|
174
175
|
protected getJsonValueToSave(): Promise<any>;
|
|
175
176
|
/**
|
|
176
177
|
* Compute the title
|
|
@@ -199,11 +200,14 @@ export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends
|
|
|
199
200
|
* Open the first tab that is invalid
|
|
200
201
|
*/
|
|
201
202
|
private openFirstInvalidTab;
|
|
202
|
-
protected abstract registerForms(): any;
|
|
203
203
|
protected abstract computeTitle(data: T): Promise<string>;
|
|
204
|
-
protected abstract setValue(data: T): Promise<void> | void;
|
|
205
204
|
protected abstract get form(): FormGroup;
|
|
206
205
|
protected abstract getFirstInvalidTabIndex(): number;
|
|
206
|
+
protected abstract registerForms(): void;
|
|
207
|
+
abstract setValue(data: T, opts?: {
|
|
208
|
+
onlySelf?: boolean;
|
|
209
|
+
emitEvent?: boolean;
|
|
210
|
+
}): Promise<void> | void;
|
|
207
211
|
static ɵfac: i0.ɵɵFactoryDeclaration<AppEntityEditor<any, any, any, any>, never>;
|
|
208
212
|
static ɵdir: i0.ɵɵDirectiveDeclaration<AppEntityEditor<any, any, any, any>, never, never, {}, {}, never, never, false, never>;
|
|
209
213
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
|
+
import { MatTabChangeEvent, MatTabGroup } from '@angular/material/tabs';
|
|
4
|
+
import { AlertController, NavController } from '@ionic/angular';
|
|
5
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
6
|
+
import { HammerSwipeEvent } from '../../../shared/gesture/hammer.utils';
|
|
7
|
+
import { AppEditor, IAppEditor } from './editor.class';
|
|
8
|
+
import * as i0 from "@angular/core";
|
|
9
|
+
export interface IAppTabEditor<T = any> extends IAppEditor<T> {
|
|
10
|
+
selectedTabIndex: number;
|
|
11
|
+
setSelectedTabIndex(value: number, opts?: {
|
|
12
|
+
emitEvent?: boolean;
|
|
13
|
+
realignInkBar?: boolean;
|
|
14
|
+
}): void;
|
|
15
|
+
unload(opts?: {
|
|
16
|
+
emitEvent?: boolean;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
realignInkBar(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare class AppTabEditorOptions {
|
|
21
|
+
/**
|
|
22
|
+
* Number of tab. 1 by default
|
|
23
|
+
*/
|
|
24
|
+
tabCount?: number;
|
|
25
|
+
/**
|
|
26
|
+
* '200ms' by default
|
|
27
|
+
*/
|
|
28
|
+
tabGroupAnimationDuration?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Should enable swipe between tab, on touch screen
|
|
31
|
+
*/
|
|
32
|
+
enableSwipe?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export declare abstract class AppTabEditor<T = any, ID = number, O = any> extends AppEditor<T, ID, O> implements IAppTabEditor<T>, OnInit, OnDestroy {
|
|
35
|
+
protected route: ActivatedRoute;
|
|
36
|
+
protected router: Router;
|
|
37
|
+
protected navController: NavController;
|
|
38
|
+
protected alertCtrl: AlertController;
|
|
39
|
+
protected translate: TranslateService;
|
|
40
|
+
protected _selectedTabIndex: number;
|
|
41
|
+
protected tabCount: number;
|
|
42
|
+
protected enableSwipe: boolean;
|
|
43
|
+
protected tabGroupAnimationDuration: string;
|
|
44
|
+
queryTabIndexParamName: string;
|
|
45
|
+
set selectedTabIndex(value: number);
|
|
46
|
+
get selectedTabIndex(): number;
|
|
47
|
+
readonly selectedTabIndexChange: EventEmitter<number>;
|
|
48
|
+
tabGroup: MatTabGroup;
|
|
49
|
+
protected constructor(route: ActivatedRoute, // Modal editor give 'null'
|
|
50
|
+
router: Router, navController: NavController, alertCtrl: AlertController, translate: TranslateService, options?: AppTabEditorOptions);
|
|
51
|
+
ngOnInit(): void;
|
|
52
|
+
ngOnDestroy(): void;
|
|
53
|
+
setSelectedTabIndex(value: number, opts?: {
|
|
54
|
+
emitEvent?: boolean;
|
|
55
|
+
realignInkBar?: boolean;
|
|
56
|
+
}): void;
|
|
57
|
+
realignInkBar(): void;
|
|
58
|
+
onTabChange(event: MatTabChangeEvent, queryTabIndexParamName?: string): boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Action triggered when user swipes
|
|
61
|
+
*/
|
|
62
|
+
onSwipeTab(event: HammerSwipeEvent): boolean;
|
|
63
|
+
onSubTabChange(event: MatTabChangeEvent): void;
|
|
64
|
+
unload(opts?: {
|
|
65
|
+
emitEvent?: boolean;
|
|
66
|
+
}): Promise<void>;
|
|
67
|
+
protected abstract getFirstInvalidTabIndex(): number;
|
|
68
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AppTabEditor<any, any, any>, [{ optional: true; }, null, null, null, null, { optional: true; }]>;
|
|
69
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AppTabEditor<any, any, any>, never, never, { "queryTabIndexParamName": { "alias": "queryTabIndexParamName"; "required": false; }; "selectedTabIndex": { "alias": "selectedTabIndex"; "required": false; }; }, { "selectedTabIndexChange": "selectedTabIndexChange"; }, never, never, false, never>;
|
|
70
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject, Subject, Subscription } from 'rxjs';
|
|
3
|
+
import { IAppForm, IAppFormGetter } from './form.utils';
|
|
4
|
+
import { WaitForOptions } from '../../shared/observables';
|
|
5
|
+
import { AppTable } from '../table/table.class';
|
|
6
|
+
import { AppForm } from './form.class';
|
|
7
|
+
import { AppEditor } from './entity/editor.class';
|
|
8
|
+
import { AbstractControl } from '@angular/forms';
|
|
9
|
+
import * as i0 from "@angular/core";
|
|
10
|
+
export interface IAppFormContainer<T = any> extends IAppForm<T> {
|
|
11
|
+
children: IAppForm[];
|
|
12
|
+
tables: AppTable<any>[];
|
|
13
|
+
forms: AppForm<any>[];
|
|
14
|
+
editors: AppEditor<any>[];
|
|
15
|
+
addForm(path: string, form?: IAppForm | IAppFormGetter): void;
|
|
16
|
+
addForms(forms: (IAppForm | IAppFormGetter)[]): void;
|
|
17
|
+
removeForm(form: string | IAppForm | IAppFormGetter): IAppForm | IAppFormGetter;
|
|
18
|
+
}
|
|
19
|
+
export declare abstract class AppFormContainer<T = any> implements IAppFormContainer<T>, OnInit, OnDestroy {
|
|
20
|
+
private _children;
|
|
21
|
+
private _childrenPath;
|
|
22
|
+
private _subscription;
|
|
23
|
+
protected _logPrefix: string;
|
|
24
|
+
protected _enabled: boolean;
|
|
25
|
+
protected readonly destroySubject: Subject<void>;
|
|
26
|
+
readonly readySubject: BehaviorSubject<boolean>;
|
|
27
|
+
readonly loadingSubject: BehaviorSubject<boolean>;
|
|
28
|
+
readonly dirtySubject: BehaviorSubject<boolean>;
|
|
29
|
+
readonly touchedSubject: BehaviorSubject<boolean>;
|
|
30
|
+
readonly errorSubject: BehaviorSubject<string>;
|
|
31
|
+
get children(): IAppForm[];
|
|
32
|
+
get tables(): AppTable<any>[];
|
|
33
|
+
get forms(): AppForm<any>[];
|
|
34
|
+
get editors(): AppEditor<any>[];
|
|
35
|
+
get error(): string;
|
|
36
|
+
set error(error: string);
|
|
37
|
+
get loading(): boolean;
|
|
38
|
+
get loaded(): boolean;
|
|
39
|
+
get dirty(): boolean;
|
|
40
|
+
get valid(): boolean;
|
|
41
|
+
get invalid(): boolean;
|
|
42
|
+
get pending(): boolean;
|
|
43
|
+
get empty(): boolean;
|
|
44
|
+
get touched(): boolean;
|
|
45
|
+
get untouched(): boolean;
|
|
46
|
+
get enabled(): boolean;
|
|
47
|
+
get disabled(): boolean;
|
|
48
|
+
get destroyed(): boolean;
|
|
49
|
+
debug: boolean;
|
|
50
|
+
protected constructor();
|
|
51
|
+
ngOnInit(): void;
|
|
52
|
+
ngOnDestroy(): void;
|
|
53
|
+
addForm(path: string, form?: IAppForm | IAppFormGetter): void;
|
|
54
|
+
addForms(forms: (IAppForm | IAppFormGetter)[]): void;
|
|
55
|
+
removeForm(form: string | IAppForm | IAppFormGetter): IAppForm | IAppFormGetter;
|
|
56
|
+
disable(opts?: {
|
|
57
|
+
onlySelf?: boolean;
|
|
58
|
+
emitEvent?: boolean;
|
|
59
|
+
}): void;
|
|
60
|
+
enable(opts?: {
|
|
61
|
+
onlySelf?: boolean;
|
|
62
|
+
emitEvent?: boolean;
|
|
63
|
+
}): void;
|
|
64
|
+
markAsPristine(opts?: {
|
|
65
|
+
onlySelf?: boolean;
|
|
66
|
+
emitEvent?: boolean;
|
|
67
|
+
}): void;
|
|
68
|
+
markAsUntouched(opts?: {
|
|
69
|
+
onlySelf?: boolean;
|
|
70
|
+
emitEvent?: boolean;
|
|
71
|
+
}): void;
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated prefer to use markAllAsTouched()
|
|
74
|
+
* @param opts
|
|
75
|
+
*/
|
|
76
|
+
markAsTouched(opts?: {
|
|
77
|
+
onlySelf?: boolean;
|
|
78
|
+
emitEvent?: boolean;
|
|
79
|
+
}): void;
|
|
80
|
+
markAllAsTouched(opts?: {
|
|
81
|
+
emitEvent?: boolean;
|
|
82
|
+
}): void;
|
|
83
|
+
markAsDirty(opts?: {
|
|
84
|
+
onlySelf?: boolean;
|
|
85
|
+
emitEvent?: boolean;
|
|
86
|
+
}): void;
|
|
87
|
+
markAsLoading(opts?: {
|
|
88
|
+
emitEvent?: boolean;
|
|
89
|
+
}): void;
|
|
90
|
+
markAsLoaded(opts?: {
|
|
91
|
+
onlySelf?: boolean;
|
|
92
|
+
emitEvent?: boolean;
|
|
93
|
+
}): void;
|
|
94
|
+
markAsReady(opts?: {
|
|
95
|
+
onlySelf?: boolean;
|
|
96
|
+
emitEvent?: boolean;
|
|
97
|
+
}): void;
|
|
98
|
+
/**
|
|
99
|
+
* Wait form is ready
|
|
100
|
+
*
|
|
101
|
+
* @param opts
|
|
102
|
+
*/
|
|
103
|
+
ready(opts?: WaitForOptions): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Wait form is not busy (=loaded)
|
|
106
|
+
*
|
|
107
|
+
* @param opts
|
|
108
|
+
*/
|
|
109
|
+
waitIdle(opts?: WaitForOptions): Promise<void>;
|
|
110
|
+
logFormErrors(prefix?: string): void;
|
|
111
|
+
protected registerSubscription(sub: Subscription): void;
|
|
112
|
+
protected unregisterSubscription(sub: Subscription): void;
|
|
113
|
+
protected setError(value: string, opts?: {
|
|
114
|
+
emitEvent?: boolean;
|
|
115
|
+
}): void;
|
|
116
|
+
protected resetError(opts?: {
|
|
117
|
+
emitEvent?: boolean;
|
|
118
|
+
}): void;
|
|
119
|
+
protected markForCheck(): void;
|
|
120
|
+
protected logChildrenErrors(c: IAppForm | AbstractControl, prefix?: string, path?: string): void;
|
|
121
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AppFormContainer<any>, never>;
|
|
122
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<AppFormContainer<any>, never, never, { "debug": { "alias": "debug"; "required": false; }; }, {}, never, never, false, never>;
|
|
123
|
+
}
|