@sumaris-net/ngx-components 1.20.18 → 1.20.19
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 +528 -6
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/doc/changelog.md +3 -0
- package/esm2015/public_api.js +2 -2
- package/esm2015/src/app/core/form/editor.class.js +8 -7
- package/esm2015/src/app/core/form/entity-editor-modal.class.js +417 -0
- package/fesm2015/sumaris-net.ngx-components.js +408 -7
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +1 -1
- package/src/app/core/form/editor.class.d.ts +2 -1
- package/src/app/core/form/entity-editor-modal.class.d.ts +118 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
package/package.json
CHANGED
package/public_api.d.ts
CHANGED
|
@@ -135,6 +135,7 @@ export * from './src/app/core/services/storage/entity-store.class';
|
|
|
135
135
|
export * from './src/app/core/services/validator/base.validator.class';
|
|
136
136
|
export * from './src/app/core/form/editor.class';
|
|
137
137
|
export * from './src/app/core/form/entity-editor.class';
|
|
138
|
+
export * from './src/app/core/form/entity-editor-modal.class';
|
|
138
139
|
export * from './src/app/core/form/entity-metadata.component';
|
|
139
140
|
export * from './src/app/core/form/form.class';
|
|
140
141
|
export * from './src/app/core/form/form.utils';
|
|
@@ -195,4 +196,3 @@ export * from './src/app/core/table/testing/table.testing.module';
|
|
|
195
196
|
export * from './src/app/core/table/testing/table.testing';
|
|
196
197
|
export * from './src/app/core/text-popover/testing/text-popover.testing.module';
|
|
197
198
|
export * from './src/app/core/text-popover/testing/text-popover.testing';
|
|
198
|
-
export { UriUtils } from './src/app/shared/file/uri.utils';
|
|
@@ -168,7 +168,8 @@ export declare abstract class AppTabEditor<T = any, ID = number, O = any> extend
|
|
|
168
168
|
get selectedTabIndex(): number;
|
|
169
169
|
readonly selectedTabIndexChange: EventEmitter<number>;
|
|
170
170
|
tabGroup: MatTabGroup;
|
|
171
|
-
protected constructor(route: ActivatedRoute,
|
|
171
|
+
protected constructor(route: ActivatedRoute, // Modal editor give 'null'
|
|
172
|
+
router: Router, alertCtrl: AlertController, translate: TranslateService, options?: AppTabEditorOptions);
|
|
172
173
|
ngOnInit(): void;
|
|
173
174
|
ngOnDestroy(): void;
|
|
174
175
|
setSelectedTabIndex(value: number, opts?: {
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { AfterViewInit, ChangeDetectorRef, Injector, OnDestroy, OnInit } from '@angular/core';
|
|
2
|
+
import { ModalController } from '@ionic/angular';
|
|
3
|
+
import { Subject } from 'rxjs';
|
|
4
|
+
import { LocalSettingsService } from '../services/local-settings.service';
|
|
5
|
+
import { Entity } from '../services/model/entity.model';
|
|
6
|
+
import { UsageMode } from '../services/model/settings.model';
|
|
7
|
+
import { FormGroup } from '@angular/forms';
|
|
8
|
+
import { AppTabEditor, AppTabEditorOptions } from './editor.class';
|
|
9
|
+
import { DateFormatPipe } from '../../shared/pipes/date-format.pipe';
|
|
10
|
+
import { Environment } from '../../../environments/environment.class';
|
|
11
|
+
import { WaitForOptions } from '../../shared/observables';
|
|
12
|
+
import { FormErrorTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
13
|
+
import { AppErrorWithDetails } from './entity-editor.class';
|
|
14
|
+
export interface IEntityEditorModalOptions<T extends Entity<T, ID> = Entity<any, any>, ID = number> {
|
|
15
|
+
usageMode: UsageMode;
|
|
16
|
+
data: T;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
onAfterModalInit?: <M extends AppEntityEditorModal<T, ID>>(modal: M) => void | Promise<void>;
|
|
19
|
+
onDelete?: (event: UIEvent, data: T) => Promise<boolean>;
|
|
20
|
+
mobile: boolean;
|
|
21
|
+
i18nSuffix?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class AppEntityEditorModalOptions extends AppTabEditorOptions {
|
|
24
|
+
i18nPrefix?: string;
|
|
25
|
+
}
|
|
26
|
+
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> {
|
|
27
|
+
protected dataType: new () => T;
|
|
28
|
+
private _usageMode;
|
|
29
|
+
protected _logPrefix: any;
|
|
30
|
+
protected _isNewData: boolean;
|
|
31
|
+
protected readonly dateFormat: DateFormatPipe;
|
|
32
|
+
protected readonly cd: ChangeDetectorRef;
|
|
33
|
+
protected readonly settings: LocalSettingsService;
|
|
34
|
+
protected readonly modalCtrl: ModalController;
|
|
35
|
+
protected errorTranslator: FormErrorTranslator;
|
|
36
|
+
protected readonly environement: Environment;
|
|
37
|
+
saving: boolean;
|
|
38
|
+
$title: Subject<string>;
|
|
39
|
+
data: T;
|
|
40
|
+
mobile: boolean;
|
|
41
|
+
usageMode: UsageMode;
|
|
42
|
+
onAfterModalInit: <M extends AppEntityEditorModal<T, ID>>(modal: M) => void | Promise<void>;
|
|
43
|
+
onDelete: (event: UIEvent, data: T) => Promise<boolean>;
|
|
44
|
+
i18nSuffix: string;
|
|
45
|
+
set isNewData(value: boolean);
|
|
46
|
+
get isNewData(): boolean;
|
|
47
|
+
set disabled(value: boolean);
|
|
48
|
+
get disabled(): boolean;
|
|
49
|
+
get isOnFieldMode(): boolean;
|
|
50
|
+
markAsSaving(opts?: {
|
|
51
|
+
emitEvent?: boolean;
|
|
52
|
+
}): void;
|
|
53
|
+
markAsSaved(opts?: {
|
|
54
|
+
emitEvent?: boolean;
|
|
55
|
+
}): void;
|
|
56
|
+
protected constructor(injector: Injector, dataType: new () => T, options?: O);
|
|
57
|
+
ngOnInit(): Promise<void>;
|
|
58
|
+
ngAfterViewInit(): void;
|
|
59
|
+
ngOnDestroy(): void;
|
|
60
|
+
waitIdle(opts?: WaitForOptions): Promise<void>;
|
|
61
|
+
load(): Promise<void>;
|
|
62
|
+
reload(): Promise<void>;
|
|
63
|
+
unload(opts?: {
|
|
64
|
+
emitEvent?: boolean;
|
|
65
|
+
}): Promise<void>;
|
|
66
|
+
updateView(data: T | null, opts?: {
|
|
67
|
+
emitEvent?: boolean;
|
|
68
|
+
openTabIndex?: number;
|
|
69
|
+
}): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Enable or disable state
|
|
72
|
+
*/
|
|
73
|
+
updateViewState(data: T, opts?: {
|
|
74
|
+
onlySelf?: boolean;
|
|
75
|
+
emitEvent?: boolean;
|
|
76
|
+
}): void;
|
|
77
|
+
saveAndClose(event?: Event): Promise<boolean>;
|
|
78
|
+
close(event: UIEvent): Promise<void>;
|
|
79
|
+
/**
|
|
80
|
+
* Save the editor, by calling the dataService.save().
|
|
81
|
+
* Ensure that editor if valid. If not, display an error
|
|
82
|
+
* @param event
|
|
83
|
+
* @param opts
|
|
84
|
+
*/
|
|
85
|
+
save(event?: Event, opts?: any): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Save data (if dirty and valid), and return it. Otherwise, return nil value.
|
|
88
|
+
*/
|
|
89
|
+
saveAndGetDataIfValid(): Promise<T | undefined>;
|
|
90
|
+
delete(event?: UIEvent): Promise<boolean>;
|
|
91
|
+
resetError(opts?: {
|
|
92
|
+
emitEvent?: boolean;
|
|
93
|
+
}): void;
|
|
94
|
+
setError(err: string | AppErrorWithDetails, opts?: {
|
|
95
|
+
emitEvent?: boolean;
|
|
96
|
+
detailsCssClass?: string;
|
|
97
|
+
}): void;
|
|
98
|
+
protected abstract registerForms(): any;
|
|
99
|
+
protected abstract computeTitle(data: T): Promise<string>;
|
|
100
|
+
protected abstract setValue(data: T): Promise<void> | void;
|
|
101
|
+
protected abstract get form(): FormGroup;
|
|
102
|
+
protected abstract getFirstInvalidTabIndex(): number;
|
|
103
|
+
protected waitWhilePending(opts?: WaitForOptions): Promise<void>;
|
|
104
|
+
protected getValue(): Promise<T>;
|
|
105
|
+
protected getJsonValueToSave(): Promise<any>;
|
|
106
|
+
/**
|
|
107
|
+
* Compute the title
|
|
108
|
+
*
|
|
109
|
+
* @param data
|
|
110
|
+
*/
|
|
111
|
+
protected updateTitle(data?: T): Promise<void>;
|
|
112
|
+
protected scrollToTop(duration?: number): Promise<void>;
|
|
113
|
+
protected markForCheck(): void;
|
|
114
|
+
/**
|
|
115
|
+
* Open the first tab that is invalid
|
|
116
|
+
*/
|
|
117
|
+
private openFirstInvalidTab;
|
|
118
|
+
}
|