@sumaris-net/ngx-components 0.25.20 → 0.26.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/bundles/sumaris-net.ngx-components.umd.js +53 -34
- 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 +6 -0
- package/esm2015/src/app/core/account/account.js +5 -7
- package/esm2015/src/app/core/auth/form/form-auth.js +6 -7
- package/esm2015/src/app/core/form/entity-editor.class.js +12 -5
- package/esm2015/src/app/core/form/form.class.js +29 -12
- package/esm2015/src/app/core/form/list.form.js +2 -2
- package/esm2015/src/app/core/form/properties.form.js +2 -3
- package/esm2015/src/app/core/settings/settings.page.js +5 -7
- package/esm2015/src/app/core/table/table.class.js +4 -4
- package/esm2015/src/app/shared/pipes/form.pipes.js +1 -1
- package/esm2015/src/app/shared/validator/form-error-adapter.class.js +3 -3
- package/fesm2015/sumaris-net.ngx-components.js +52 -34
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/account/account.d.ts +2 -5
- package/src/app/core/auth/form/form-auth.d.ts +2 -4
- package/src/app/core/form/entity-editor.class.d.ts +9 -2
- package/src/app/core/form/form.class.d.ts +15 -12
- package/src/app/core/form/properties.form.d.ts +0 -1
- package/src/app/core/settings/settings.page.d.ts +2 -5
- package/src/app/core/table/table.class.d.ts +4 -7
- package/src/app/shared/pipes/form.pipes.d.ts +2 -2
- package/src/app/shared/validator/form-error-adapter.class.d.ts +6 -6
- package/sumaris-net.ngx-components.metadata.json +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChangeDetectorRef, OnDestroy } from '@angular/core';
|
|
1
|
+
import { ChangeDetectorRef, Injector, OnDestroy } from '@angular/core';
|
|
2
2
|
import { Subscription } from 'rxjs';
|
|
3
3
|
import { AccountService } from '../services/account.service';
|
|
4
4
|
import { Account } from '../services/model/account.model';
|
|
@@ -6,15 +6,12 @@ import { UserSettingsValidatorService } from '../services/validator/user-setting
|
|
|
6
6
|
import { FormBuilder, FormGroup } from '@angular/forms';
|
|
7
7
|
import { AccountValidatorService } from '../services/validator/account.validator';
|
|
8
8
|
import { AppForm } from '../form/form.class';
|
|
9
|
-
import { Moment } from 'moment';
|
|
10
|
-
import { DateAdapter } from '@angular/material/core';
|
|
11
9
|
import { TranslateService } from '@ngx-translate/core';
|
|
12
10
|
import { FormFieldDefinition } from '../../shared/form/field.model';
|
|
13
11
|
import { LocalSettingsService } from '../services/local-settings.service';
|
|
14
12
|
import { LocaleConfig } from '../services/model/settings.model';
|
|
15
13
|
import { Router } from '@angular/router';
|
|
16
14
|
export declare class AccountPage extends AppForm<Account> implements OnDestroy {
|
|
17
|
-
protected dateAdapter: DateAdapter<Moment>;
|
|
18
15
|
protected router: Router;
|
|
19
16
|
formBuilder: FormBuilder;
|
|
20
17
|
accountService: AccountService;
|
|
@@ -35,7 +32,7 @@ export declare class AccountPage extends AppForm<Account> implements OnDestroy {
|
|
|
35
32
|
latLongFormats: ("DD" | "DDMM" | "DDMMSS")[];
|
|
36
33
|
saving: boolean;
|
|
37
34
|
submitted: boolean;
|
|
38
|
-
constructor(
|
|
35
|
+
constructor(injector: Injector, router: Router, formBuilder: FormBuilder, accountService: AccountService, validatorService: AccountValidatorService, settingsValidatorService: UserSettingsValidatorService, translate: TranslateService, settings: LocalSettingsService, cd: ChangeDetectorRef, locales: any);
|
|
39
36
|
ngOnDestroy(): void;
|
|
40
37
|
onLogin(account: Account): void;
|
|
41
38
|
onLogout(): void;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { ChangeDetectorRef, EventEmitter, OnInit } from '@angular/core';
|
|
1
|
+
import { ChangeDetectorRef, EventEmitter, Injector, OnInit } from '@angular/core';
|
|
2
2
|
import { FormBuilder } from '@angular/forms';
|
|
3
3
|
import { ModalController } from '@ionic/angular';
|
|
4
4
|
import { AuthData } from '../../services/account.service';
|
|
5
5
|
import { NetworkService } from '../../services/network.service';
|
|
6
6
|
import { LocalSettingsService } from '../../services/local-settings.service';
|
|
7
7
|
import { PlatformService } from '../../services/platform.service';
|
|
8
|
-
import { DateAdapter } from '@angular/material/core';
|
|
9
|
-
import { Moment } from 'moment';
|
|
10
8
|
import { AppForm } from '../../form/form.class';
|
|
11
9
|
import { ConfigService } from '../../services/config.service';
|
|
12
10
|
export declare class AuthForm extends AppForm<AuthData> implements OnInit {
|
|
@@ -27,7 +25,7 @@ export declare class AuthForm extends AppForm<AuthData> implements OnInit {
|
|
|
27
25
|
onlySelf?: boolean;
|
|
28
26
|
emitEvent?: boolean;
|
|
29
27
|
}): void;
|
|
30
|
-
constructor(
|
|
28
|
+
constructor(injector: Injector, platform: PlatformService, formBuilder: FormBuilder, settings: LocalSettingsService, configService: ConfigService, modalCtrl: ModalController, network: NetworkService, cd: ChangeDetectorRef, environment: any);
|
|
31
29
|
ngOnInit(): void;
|
|
32
30
|
cancel(): void;
|
|
33
31
|
doSubmit(event?: UIEvent): void;
|
|
@@ -9,6 +9,7 @@ import { EntityServiceLoadOptions, IEntityService } from '../../shared/services/
|
|
|
9
9
|
import { DateFormatPipe } from '../../shared/pipes/date-format.pipe';
|
|
10
10
|
import { HistoryPageReference } from '../services/model/history.model';
|
|
11
11
|
import { WaitForOptions } from '../../shared/observables';
|
|
12
|
+
import { FormErrorAdapter } from '../../shared/validator/form-error-adapter.class';
|
|
12
13
|
export declare class AppEditorOptions extends AppTabEditorOptions {
|
|
13
14
|
autoLoad?: boolean;
|
|
14
15
|
autoLoadDelay?: number;
|
|
@@ -37,6 +38,7 @@ export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends
|
|
|
37
38
|
protected dateFormat: DateFormatPipe;
|
|
38
39
|
protected cd: ChangeDetectorRef;
|
|
39
40
|
protected settings: LocalSettingsService;
|
|
41
|
+
protected formErrorAdapter: FormErrorAdapter;
|
|
40
42
|
data: T;
|
|
41
43
|
saving: boolean;
|
|
42
44
|
hasRemoteListener: boolean;
|
|
@@ -66,7 +68,6 @@ export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends
|
|
|
66
68
|
/**
|
|
67
69
|
* Load data from the snapshot route
|
|
68
70
|
*
|
|
69
|
-
* @param route
|
|
70
71
|
* @protected
|
|
71
72
|
*/
|
|
72
73
|
protected loadFromRoute(): Promise<void>;
|
|
@@ -107,7 +108,13 @@ export declare abstract class AppEntityEditor<T extends Entity<T, ID>, S extends
|
|
|
107
108
|
updateTabIndex(tabIndex?: number): void;
|
|
108
109
|
saveAndClose(event: Event, options?: any): Promise<boolean>;
|
|
109
110
|
close(event: Event): Promise<boolean | void>;
|
|
110
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Save the editor, by calling the dataService.save().
|
|
113
|
+
* Ensure that editor if valid. If not, display an error
|
|
114
|
+
* @param event
|
|
115
|
+
* @param opts
|
|
116
|
+
*/
|
|
117
|
+
save(event?: Event, opts?: any): Promise<boolean>;
|
|
111
118
|
/**
|
|
112
119
|
* Save data (if dirty and valid), and return it. Otherwise, return nil value.
|
|
113
120
|
*/
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { EventEmitter, OnDestroy, OnInit } from '@angular/core';
|
|
1
|
+
import { EventEmitter, Injector, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import { Moment } from 'moment';
|
|
4
|
-
import { DateAdapter } from '@angular/material/core';
|
|
5
3
|
import { Subscription } from 'rxjs';
|
|
6
|
-
import { DateFormatPipe } from '../../shared/pipes/date-format.pipe';
|
|
7
4
|
import { IAppForm } from './form.utils';
|
|
8
5
|
import { LocalSettingsService } from '../services/local-settings.service';
|
|
9
6
|
import { MatAutocompleteConfigHolder, MatAutocompleteFieldAddOptions, MatAutocompleteFieldConfig } from '../../shared/material/autocomplete/material.autocomplete';
|
|
10
7
|
import { WaitForOptions } from '../../shared/observables';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
protected settings?: LocalSettingsService;
|
|
14
|
-
private _subscription;
|
|
15
|
-
private _form;
|
|
16
|
-
protected _enable: boolean;
|
|
17
|
-
protected _loading: boolean;
|
|
8
|
+
import { FormErrorAdapter, FormErrorTranslatorOptions, IFormControlPathTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
9
|
+
export declare abstract class AppForm<T> implements IAppForm, OnInit, OnDestroy, IFormControlPathTranslator {
|
|
18
10
|
autocompleteHelper: MatAutocompleteConfigHolder;
|
|
19
11
|
autocompleteFields: {
|
|
20
12
|
[key: string]: MatAutocompleteFieldConfig;
|
|
21
13
|
};
|
|
22
14
|
error: string;
|
|
15
|
+
protected settings: LocalSettingsService;
|
|
16
|
+
protected errorTranslator: FormErrorAdapter;
|
|
17
|
+
protected _enable: boolean;
|
|
18
|
+
protected _loading: boolean;
|
|
19
|
+
protected i18nFieldPrefix: string;
|
|
20
|
+
private _subscription;
|
|
21
|
+
private _form;
|
|
23
22
|
debug: boolean;
|
|
24
23
|
tabindex: number;
|
|
24
|
+
errorTranslatorOptions: FormErrorTranslatorOptions;
|
|
25
25
|
get value(): any;
|
|
26
26
|
set value(data: any);
|
|
27
27
|
get dirty(): boolean;
|
|
@@ -44,7 +44,7 @@ export declare abstract class AppForm<T> implements IAppForm, OnInit, OnDestroy
|
|
|
44
44
|
get form(): FormGroup;
|
|
45
45
|
onCancel: EventEmitter<any>;
|
|
46
46
|
onSubmit: EventEmitter<any>;
|
|
47
|
-
protected constructor(
|
|
47
|
+
protected constructor(injector: Injector, form?: FormGroup);
|
|
48
48
|
ngOnInit(): void;
|
|
49
49
|
ngOnDestroy(): void;
|
|
50
50
|
cancel(): void;
|
|
@@ -98,6 +98,9 @@ export declare abstract class AppForm<T> implements IAppForm, OnInit, OnDestroy
|
|
|
98
98
|
onlySelf?: boolean;
|
|
99
99
|
emitEvent?: boolean;
|
|
100
100
|
}): void;
|
|
101
|
+
translateControlPath(path: string): string;
|
|
102
|
+
protected getFormError(form: FormGroup, opts?: FormErrorTranslatorOptions): string;
|
|
103
|
+
protected getFieldName(path: string): string;
|
|
101
104
|
protected registerSubscription(sub: Subscription): Subscription;
|
|
102
105
|
protected registerAutocompleteField<T = any, F = any>(fieldName: string, opts?: MatAutocompleteFieldAddOptions<T, F>): MatAutocompleteFieldConfig<T, F>;
|
|
103
106
|
protected markForCheck(): void;
|
|
@@ -8,7 +8,6 @@ import { AppForm } from './form.class';
|
|
|
8
8
|
import { FormArrayHelper, FormArrayHelperOptions } from './form.utils';
|
|
9
9
|
import { Property } from '../../shared/types';
|
|
10
10
|
export declare class AppPropertiesForm<T = Property> extends AppForm<T[]> implements OnInit {
|
|
11
|
-
protected injector: Injector;
|
|
12
11
|
protected formBuilder: FormBuilder;
|
|
13
12
|
protected dateAdapter: DateAdapter<Moment>;
|
|
14
13
|
protected settings: LocalSettingsService;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { ChangeDetectorRef, OnDestroy, OnInit } from '@angular/core';
|
|
1
|
+
import { ChangeDetectorRef, Injector, OnDestroy, OnInit } from '@angular/core';
|
|
2
2
|
import { AccountService } from '../services/account.service';
|
|
3
3
|
import { LocaleConfig, LocalSettings, UsageMode } from '../services/model/settings.model';
|
|
4
4
|
import { FormArray, FormBuilder } from '@angular/forms';
|
|
5
5
|
import { AppForm } from '../form/form.class';
|
|
6
|
-
import { Moment } from 'moment';
|
|
7
|
-
import { DateAdapter } from '@angular/material/core';
|
|
8
6
|
import { FormArrayHelper } from '../form/form.utils';
|
|
9
7
|
import { TranslateService } from '@ngx-translate/core';
|
|
10
8
|
import { LocalSettingsValidatorService } from '../services/validator/local-settings.validator';
|
|
@@ -17,7 +15,6 @@ import { Property } from '../../shared/types';
|
|
|
17
15
|
import { Router } from '@angular/router';
|
|
18
16
|
import { CanLeave } from '../../shared/guard/component-dirty.guard';
|
|
19
17
|
export declare class SettingsPage extends AppForm<LocalSettings> implements OnInit, OnDestroy, CanLeave {
|
|
20
|
-
protected dateAdapter: DateAdapter<Moment>;
|
|
21
18
|
protected platform: PlatformService;
|
|
22
19
|
protected router: Router;
|
|
23
20
|
protected validatorService: LocalSettingsValidatorService;
|
|
@@ -44,7 +41,7 @@ export declare class SettingsPage extends AppForm<LocalSettings> implements OnIn
|
|
|
44
41
|
get accountInheritance(): boolean;
|
|
45
42
|
get isLogin(): boolean;
|
|
46
43
|
get propertiesForm(): FormArray;
|
|
47
|
-
constructor(
|
|
44
|
+
constructor(injector: Injector, platform: PlatformService, router: Router, validatorService: LocalSettingsValidatorService, alertCtrl: AlertController, translate: TranslateService, formBuilder: FormBuilder, accountService: AccountService, settings: LocalSettingsService, cd: ChangeDetectorRef, network: NetworkService, locales: LocaleConfig[]);
|
|
48
45
|
ngOnInit(): Promise<void>;
|
|
49
46
|
getPropertyDefinition(index: number): FormFieldDefinition;
|
|
50
47
|
updatePropertyDefinition(index: number): FormFieldDefinition;
|
|
@@ -20,7 +20,7 @@ import { CompletableEvent } from '../../shared/events';
|
|
|
20
20
|
import { ShowToastOptions } from '../../shared/toasts';
|
|
21
21
|
import { CdkColumnDef } from '@angular/cdk/table';
|
|
22
22
|
import { LoadResult } from '../../shared/services/entity-service.class';
|
|
23
|
-
import { FormErrorAdapter,
|
|
23
|
+
import { FormErrorAdapter, FormErrorTranslatorOptions, IFormControlPathTranslator } from '../../shared/validator/form-error-adapter.class';
|
|
24
24
|
export declare const SETTINGS_DISPLAY_COLUMNS = "displayColumns";
|
|
25
25
|
export declare const SETTINGS_SORTED_COLUMN = "sortedColumn";
|
|
26
26
|
export declare const SETTINGS_FILTER = "filter";
|
|
@@ -43,7 +43,7 @@ export interface IModalDetailOptions<T = any> {
|
|
|
43
43
|
onDelete: (event: UIEvent, data: T) => Promise<boolean>;
|
|
44
44
|
}
|
|
45
45
|
export declare type SaveActionType = 'delete' | 'sort' | 'filter';
|
|
46
|
-
export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = number> implements OnInit, OnDestroy, AfterViewInit, IAppForm,
|
|
46
|
+
export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = number> implements OnInit, OnDestroy, AfterViewInit, IAppForm, IFormControlPathTranslator {
|
|
47
47
|
protected route: ActivatedRoute;
|
|
48
48
|
protected router: Router;
|
|
49
49
|
protected platform: Platform | PlatformService;
|
|
@@ -70,7 +70,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
70
70
|
displayedColumns: string[];
|
|
71
71
|
totalRowCount: number | null;
|
|
72
72
|
visibleRowCount: number;
|
|
73
|
-
|
|
73
|
+
errorTranslatorOptions: FormErrorTranslatorOptions;
|
|
74
74
|
loadingSubject: BehaviorSubject<boolean>;
|
|
75
75
|
savingSubject: BehaviorSubject<boolean>;
|
|
76
76
|
dirtySubject: BehaviorSubject<boolean>;
|
|
@@ -354,10 +354,7 @@ export declare abstract class AppTable<T extends IEntity<T, ID>, F = any, ID = n
|
|
|
354
354
|
protected resetError(opts?: {
|
|
355
355
|
emitEvent?: boolean;
|
|
356
356
|
}): void;
|
|
357
|
-
protected getRowError(row?: TableElement<T>, opts?:
|
|
358
|
-
separator?: string;
|
|
359
|
-
recursive?: boolean;
|
|
360
|
-
}): string;
|
|
357
|
+
protected getRowError(row?: TableElement<T>, opts?: FormErrorTranslatorOptions): string;
|
|
361
358
|
protected setError(value: string, opts?: {
|
|
362
359
|
emitEvent?: boolean;
|
|
363
360
|
}): void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PipeTransform } from '@angular/core';
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
|
-
import { FormErrorAdapter,
|
|
3
|
+
import { FormErrorAdapter, FormErrorTranslatorOptions } from '../validator/form-error-adapter.class';
|
|
4
4
|
export declare class FormErrorTranslatePipe implements PipeTransform {
|
|
5
5
|
private adapter;
|
|
6
6
|
constructor(adapter: FormErrorAdapter);
|
|
7
|
-
transform(form: FormGroup, opts?:
|
|
7
|
+
transform(form: FormGroup, opts?: FormErrorTranslatorOptions): string;
|
|
8
8
|
}
|
|
@@ -3,20 +3,20 @@ import { TranslateService } from '@ngx-translate/core';
|
|
|
3
3
|
import { AbstractControl } from '@angular/forms';
|
|
4
4
|
import { ObjectMap } from '../types';
|
|
5
5
|
export declare const APP_FORM_ERROR_I18N_KEYS: InjectionToken<ObjectMap<string>>;
|
|
6
|
-
export interface
|
|
6
|
+
export interface IFormControlPathTranslator {
|
|
7
7
|
translateControlPath: (controlPath: string) => string;
|
|
8
8
|
}
|
|
9
|
-
export interface
|
|
9
|
+
export interface FormErrorTranslatorOptions {
|
|
10
10
|
i18nPrefix?: string;
|
|
11
|
-
|
|
11
|
+
controlPathTranslator?: IFormControlPathTranslator;
|
|
12
12
|
separator?: string;
|
|
13
13
|
recursive?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export declare class FormErrorAdapter implements
|
|
15
|
+
export declare class FormErrorAdapter implements IFormControlPathTranslator {
|
|
16
16
|
private translate;
|
|
17
17
|
private readonly errorI18nKeys;
|
|
18
18
|
constructor(translate: TranslateService, errorI18nKeys: ObjectMap<string>);
|
|
19
|
-
translateErrors(control: AbstractControl, opts?:
|
|
20
|
-
translateControlPath(path: string, opts?:
|
|
19
|
+
translateErrors(control: AbstractControl, opts?: FormErrorTranslatorOptions): string;
|
|
20
|
+
translateControlPath(path: string, opts?: FormErrorTranslatorOptions): string;
|
|
21
21
|
translateError(errorKey: string, errorContent?: any): any;
|
|
22
22
|
}
|