@sumaris-net/ngx-components 0.27.2 → 0.27.3
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/bundles/sumaris-net.ngx-components.umd.js +555 -431
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/form/editor.class.js +174 -127
- package/esm2015/src/app/core/form/entity-editor.class.js +1 -1
- package/esm2015/src/app/core/form/form.class.js +17 -1
- package/esm2015/src/app/core/form/form.utils.js +14 -1
- package/esm2015/src/app/core/table/table.class.js +14 -2
- package/esm2015/src/app/shared/pipes/number-format.pipe.js +1 -1
- package/fesm2015/sumaris-net.ngx-components.js +483 -382
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +2 -2
- package/src/app/core/form/editor.class.d.ts +43 -26
- package/src/app/core/form/form.class.d.ts +10 -0
- package/src/app/core/form/form.utils.d.ts +16 -0
- package/src/app/core/table/table.class.d.ts +5 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sumaris-net/ngx-components",
|
|
3
3
|
"description": "SUMARiS Angular components",
|
|
4
|
-
"version": "0.27.
|
|
4
|
+
"version": "0.27.3",
|
|
5
5
|
"author": "contact@e-is.pro",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
7
7
|
"readmeFilename": "README.md",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"tslib": "^2.2.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
|
-
"@apollo/client": "
|
|
17
|
+
"@apollo/client": "^3.4.17"
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
@@ -3,7 +3,7 @@ import { ActivatedRoute, Params, Router } from '@angular/router';
|
|
|
3
3
|
import { MatTabChangeEvent, MatTabGroup } from '@angular/material/tabs';
|
|
4
4
|
import { AlertController, IonContent, ToastController } from '@ionic/angular';
|
|
5
5
|
import { TranslateService } from '@ngx-translate/core';
|
|
6
|
-
import { Subscription, TeardownLogic } from 'rxjs';
|
|
6
|
+
import { BehaviorSubject, Subscription, TeardownLogic } from 'rxjs';
|
|
7
7
|
import { AppTable } from '../table/table.class';
|
|
8
8
|
import { FormButtonsBarToken } from './form-buttons-bar.component';
|
|
9
9
|
import { IAppForm, IAppFormGetter } from './form.utils';
|
|
@@ -31,7 +31,7 @@ export declare class AppTabEditorOptions {
|
|
|
31
31
|
*/
|
|
32
32
|
enableSwipe?: boolean;
|
|
33
33
|
}
|
|
34
|
-
export declare abstract class
|
|
34
|
+
export declare abstract class AppEditor<T = any, ID = number, O = any> implements IAppEditor, OnInit, OnDestroy, AfterViewInit {
|
|
35
35
|
protected route: ActivatedRoute;
|
|
36
36
|
protected router: Router;
|
|
37
37
|
protected alertCtrl: AlertController;
|
|
@@ -41,11 +41,8 @@ export declare abstract class AppTabEditor<T = any, ID = number, O = any> implem
|
|
|
41
41
|
protected _enabled: boolean;
|
|
42
42
|
protected _dirty: boolean;
|
|
43
43
|
protected _loading: boolean;
|
|
44
|
-
protected
|
|
44
|
+
protected _$ready: BehaviorSubject<boolean>;
|
|
45
45
|
protected toastController: ToastController;
|
|
46
|
-
tabCount: number;
|
|
47
|
-
enableSwipe: boolean;
|
|
48
|
-
tabGroupAnimationDuration: string;
|
|
49
46
|
debug: boolean;
|
|
50
47
|
previousDataId: ID;
|
|
51
48
|
submitted: boolean;
|
|
@@ -55,8 +52,6 @@ export declare abstract class AppTabEditor<T = any, ID = number, O = any> implem
|
|
|
55
52
|
prefix: string;
|
|
56
53
|
suffix: string;
|
|
57
54
|
};
|
|
58
|
-
queryTabIndexParamName: string;
|
|
59
|
-
tabGroup: MatTabGroup;
|
|
60
55
|
toolbar: ToolbarToken | null;
|
|
61
56
|
formButtonsBar: FormButtonsBarToken | null;
|
|
62
57
|
content: IonContent;
|
|
@@ -73,16 +68,13 @@ export declare abstract class AppTabEditor<T = any, ID = number, O = any> implem
|
|
|
73
68
|
get disabled(): boolean;
|
|
74
69
|
get children(): IAppForm[];
|
|
75
70
|
get empty(): boolean;
|
|
76
|
-
get selectedTabIndex(): number;
|
|
77
|
-
set selectedTabIndex(value: number);
|
|
78
|
-
readonly selectedTabIndexChange: EventEmitter<number>;
|
|
79
71
|
abstract get isNewData(): boolean;
|
|
80
|
-
protected constructor(route: ActivatedRoute, router: Router, alertCtrl: AlertController, translate: TranslateService
|
|
72
|
+
protected constructor(route: ActivatedRoute, router: Router, alertCtrl: AlertController, translate: TranslateService);
|
|
81
73
|
ngOnInit(): void;
|
|
82
74
|
ngAfterViewInit(): void;
|
|
83
75
|
ngOnDestroy(): void;
|
|
84
|
-
addChildForm(form: IAppForm | IAppFormGetter):
|
|
85
|
-
addChildForms(forms: (IAppForm | IAppFormGetter)[]):
|
|
76
|
+
addChildForm(form: IAppForm | IAppFormGetter): AppEditor<T, ID, O>;
|
|
77
|
+
addChildForms(forms: (IAppForm | IAppFormGetter)[]): AppEditor<T, ID, O>;
|
|
86
78
|
disable(opts?: {
|
|
87
79
|
onlySelf?: boolean;
|
|
88
80
|
emitEvent?: boolean;
|
|
@@ -122,12 +114,11 @@ export declare abstract class AppTabEditor<T = any, ID = number, O = any> implem
|
|
|
122
114
|
onlySelf?: boolean;
|
|
123
115
|
emitEvent?: boolean;
|
|
124
116
|
}): void;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
onSubTabChange(event: MatTabChangeEvent): void;
|
|
117
|
+
markAsReady(opts?: {
|
|
118
|
+
emitEvent?: boolean;
|
|
119
|
+
}): void;
|
|
120
|
+
ready(opts?: WaitForOptions): Promise<any>;
|
|
121
|
+
waitIdle(opts?: WaitForOptions): Promise<any>;
|
|
131
122
|
cancel(event?: Event): Promise<void>;
|
|
132
123
|
/**
|
|
133
124
|
* Unload the page (remove all data). Useful when reusing angular cache a cancelled page
|
|
@@ -139,14 +130,10 @@ export declare abstract class AppTabEditor<T = any, ID = number, O = any> implem
|
|
|
139
130
|
}): Promise<void>;
|
|
140
131
|
reloadWithConfirmation(confirm?: boolean): Promise<void>;
|
|
141
132
|
goBack(event?: Event): Promise<void | boolean>;
|
|
142
|
-
setSelectedTabIndex(value: number, opts?: {
|
|
143
|
-
emitEvent?: boolean;
|
|
144
|
-
realignInkBar?: boolean;
|
|
145
|
-
}): void;
|
|
146
|
-
waitIdle(opts?: WaitForOptions): Promise<any>;
|
|
147
133
|
abstract load(id?: ID, options?: O): Promise<void>;
|
|
148
134
|
abstract save(event?: Event, options?: any): Promise<boolean>;
|
|
149
135
|
abstract reload(): Promise<void>;
|
|
136
|
+
logFormErrors(): void;
|
|
150
137
|
protected scrollToTop(duration?: number): Promise<void>;
|
|
151
138
|
protected registerSubscription(sub: Subscription | TeardownLogic): void;
|
|
152
139
|
protected unregisterSubscription(sub: Subscription): void;
|
|
@@ -154,7 +141,37 @@ export declare abstract class AppTabEditor<T = any, ID = number, O = any> implem
|
|
|
154
141
|
emitEvent: boolean;
|
|
155
142
|
}): Promise<boolean>;
|
|
156
143
|
protected showToast(opts: ShowToastOptions): Promise<void>;
|
|
157
|
-
protected logFormErrors(): void;
|
|
158
144
|
protected logChildrenFormErrors(c: IAppForm | AbstractControl, prefix?: string, path?: string): void;
|
|
159
145
|
protected markForCheck(): void;
|
|
160
146
|
}
|
|
147
|
+
export declare abstract class AppTabEditor<T = any, ID = number, O = any> extends AppEditor<T, ID, O> {
|
|
148
|
+
protected route: ActivatedRoute;
|
|
149
|
+
protected router: Router;
|
|
150
|
+
protected alertCtrl: AlertController;
|
|
151
|
+
protected translate: TranslateService;
|
|
152
|
+
protected _selectedTabIndex: number;
|
|
153
|
+
tabCount: number;
|
|
154
|
+
enableSwipe: boolean;
|
|
155
|
+
tabGroupAnimationDuration: string;
|
|
156
|
+
queryTabIndexParamName: string;
|
|
157
|
+
set selectedTabIndex(value: number);
|
|
158
|
+
get selectedTabIndex(): number;
|
|
159
|
+
readonly selectedTabIndexChange: EventEmitter<number>;
|
|
160
|
+
tabGroup: MatTabGroup;
|
|
161
|
+
protected constructor(route: ActivatedRoute, router: Router, alertCtrl: AlertController, translate: TranslateService, options?: AppTabEditorOptions);
|
|
162
|
+
ngOnInit(): void;
|
|
163
|
+
ngOnDestroy(): void;
|
|
164
|
+
setSelectedTabIndex(value: number, opts?: {
|
|
165
|
+
emitEvent?: boolean;
|
|
166
|
+
realignInkBar?: boolean;
|
|
167
|
+
}): void;
|
|
168
|
+
onTabChange(event: MatTabChangeEvent, queryTabIndexParamName?: string): boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Action triggered when user swipes
|
|
171
|
+
*/
|
|
172
|
+
onSwipeTab(event: HammerSwipeEvent): boolean;
|
|
173
|
+
onSubTabChange(event: MatTabChangeEvent): void;
|
|
174
|
+
unload(opts?: {
|
|
175
|
+
emitEvent?: boolean;
|
|
176
|
+
}): Promise<void>;
|
|
177
|
+
}
|
|
@@ -16,6 +16,7 @@ export declare abstract class AppForm<T> implements IAppForm, OnInit, OnDestroy,
|
|
|
16
16
|
protected errorTranslator: FormErrorTranslator;
|
|
17
17
|
protected _enable: boolean;
|
|
18
18
|
protected _loading: boolean;
|
|
19
|
+
protected _ready: boolean;
|
|
19
20
|
protected i18nFieldPrefix: string;
|
|
20
21
|
private _subscription;
|
|
21
22
|
private _form;
|
|
@@ -89,6 +90,15 @@ export declare abstract class AppForm<T> implements IAppForm, OnInit, OnDestroy,
|
|
|
89
90
|
onlySelf?: boolean;
|
|
90
91
|
emitEvent?: boolean;
|
|
91
92
|
}): void;
|
|
93
|
+
markAsReady(opts?: {
|
|
94
|
+
onlySelf?: boolean;
|
|
95
|
+
emitEvent?: boolean;
|
|
96
|
+
}): void;
|
|
97
|
+
/**
|
|
98
|
+
* Wait form is ready
|
|
99
|
+
* @param opts
|
|
100
|
+
*/
|
|
101
|
+
ready(opts?: WaitForOptions): Promise<boolean>;
|
|
92
102
|
/**
|
|
93
103
|
* Wait form is idle (not loading)
|
|
94
104
|
* @param opts
|
|
@@ -13,6 +13,7 @@ export interface IAppForm {
|
|
|
13
13
|
disabled: boolean;
|
|
14
14
|
empty?: boolean;
|
|
15
15
|
loading?: boolean;
|
|
16
|
+
ready(): Promise<any>;
|
|
16
17
|
disable(opts?: {
|
|
17
18
|
onlySelf?: boolean;
|
|
18
19
|
emitEvent?: boolean;
|
|
@@ -48,6 +49,10 @@ export interface IAppForm {
|
|
|
48
49
|
onlySelf?: boolean;
|
|
49
50
|
emitEvent?: boolean;
|
|
50
51
|
}): any;
|
|
52
|
+
markAsReady(opts?: {
|
|
53
|
+
onlySelf?: boolean;
|
|
54
|
+
emitEvent?: boolean;
|
|
55
|
+
}): any;
|
|
51
56
|
}
|
|
52
57
|
/**
|
|
53
58
|
* A form that do nothing
|
|
@@ -97,6 +102,12 @@ export declare class AppNullForm implements IAppForm {
|
|
|
97
102
|
onlySelf?: boolean;
|
|
98
103
|
emitEvent?: boolean;
|
|
99
104
|
}): void;
|
|
105
|
+
markAsReady(opts?: {
|
|
106
|
+
onlySelf?: boolean;
|
|
107
|
+
emitEvent?: boolean;
|
|
108
|
+
}): void;
|
|
109
|
+
waitIdle(opts?: WaitForOptions): Promise<any>;
|
|
110
|
+
ready(): Promise<any>;
|
|
100
111
|
}
|
|
101
112
|
export declare class AppFormProvider<F extends IAppForm = IAppForm> implements IAppForm {
|
|
102
113
|
private getterFn;
|
|
@@ -113,6 +124,7 @@ export declare class AppFormProvider<F extends IAppForm = IAppForm> implements I
|
|
|
113
124
|
get empty(): boolean;
|
|
114
125
|
get pending(): boolean;
|
|
115
126
|
get loading(): boolean;
|
|
127
|
+
ready(): Promise<any>;
|
|
116
128
|
disable(opts?: {
|
|
117
129
|
onlySelf?: boolean;
|
|
118
130
|
emitEvent?: boolean;
|
|
@@ -148,6 +160,10 @@ export declare class AppFormProvider<F extends IAppForm = IAppForm> implements I
|
|
|
148
160
|
onlySelf?: boolean;
|
|
149
161
|
emitEvent?: boolean;
|
|
150
162
|
}): any;
|
|
163
|
+
markAsReady(opts?: {
|
|
164
|
+
onlySelf?: boolean;
|
|
165
|
+
emitEvent?: boolean;
|
|
166
|
+
}): any;
|
|
151
167
|
}
|
|
152
168
|
export declare class AppFormUtils {
|
|
153
169
|
static copyEntity2Form: typeof copyEntity2Form;
|
|
@@ -71,6 +71,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
71
71
|
totalRowCount: number | null;
|
|
72
72
|
visibleRowCount: number;
|
|
73
73
|
errorTranslatorOptions: FormErrorTranslatorOptions;
|
|
74
|
+
readySubject: BehaviorSubject<boolean>;
|
|
74
75
|
loadingSubject: BehaviorSubject<boolean>;
|
|
75
76
|
savingSubject: BehaviorSubject<boolean>;
|
|
76
77
|
dirtySubject: BehaviorSubject<boolean>;
|
|
@@ -199,6 +200,9 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
199
200
|
onlySelf?: boolean;
|
|
200
201
|
emitEVent?: boolean;
|
|
201
202
|
}): void;
|
|
203
|
+
markAsReady(opts?: {
|
|
204
|
+
emitEvent?: boolean;
|
|
205
|
+
}): void;
|
|
202
206
|
get loading(): boolean;
|
|
203
207
|
get loaded(): boolean;
|
|
204
208
|
enableSort(): void;
|
|
@@ -286,6 +290,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
286
290
|
selectRowByData(data: T): Promise<boolean>;
|
|
287
291
|
clickRow(event: UIEvent | undefined, row: TableElement<T>): boolean;
|
|
288
292
|
moveRow(id: number, direction: number): void;
|
|
293
|
+
ready(): Promise<any>;
|
|
289
294
|
waitIdle(): Promise<any>;
|
|
290
295
|
openSelectColumnsModal(event?: Event): Promise<any>;
|
|
291
296
|
trackByFn(index: number, row: TableElement<T>): number;
|