@sumaris-net/ngx-components 2.6.6-rc2 → 2.6.6-rc4

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.
Files changed (30) hide show
  1. package/esm2020/src/app/admin/services/person.service.mjs +23 -22
  2. package/esm2020/src/app/admin/services/validator/person.validator.mjs +58 -21
  3. package/esm2020/src/app/admin/users/users.mjs +26 -7
  4. package/esm2020/src/app/core/account/account.page.mjs +28 -29
  5. package/esm2020/src/app/core/form/properties/properties.table.mjs +7 -4
  6. package/esm2020/src/app/core/graphql/graphql.service.mjs +14 -6
  7. package/esm2020/src/app/core/menu/menu.service.mjs +2 -2
  8. package/esm2020/src/app/core/services/base-entity-service.class.mjs +43 -19
  9. package/esm2020/src/app/core/services/base-graphql-service.class.mjs +6 -2
  10. package/esm2020/src/app/core/services/errors.mjs +2 -1
  11. package/esm2020/src/app/core/services/model/person.model.mjs +10 -1
  12. package/esm2020/src/app/core/services/validator/account.validator.mjs +26 -41
  13. package/esm2020/src/app/core/services/validator/base.validator.class.mjs +2 -2
  14. package/fesm2015/sumaris-net.ngx-components.mjs +221 -142
  15. package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
  16. package/fesm2020/sumaris-net.ngx-components.mjs +231 -143
  17. package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
  18. package/package.json +1 -1
  19. package/src/app/admin/services/validator/person.validator.d.ts +20 -11
  20. package/src/app/core/account/account.page.d.ts +3 -3
  21. package/src/app/core/form/properties/properties.table.d.ts +2 -1
  22. package/src/app/core/graphql/graphql.service.d.ts +1 -1
  23. package/src/app/core/services/base-entity-service.class.d.ts +22 -3
  24. package/src/app/core/services/errors.d.ts +1 -0
  25. package/src/app/core/services/model/person.model.d.ts +1 -0
  26. package/src/app/core/services/validator/account.validator.d.ts +16 -9
  27. package/src/app/core/services/validator/base.validator.class.d.ts +1 -1
  28. package/src/assets/i18n/en-US.json +1 -0
  29. package/src/assets/i18n/en.json +1 -0
  30. package/src/assets/manifest.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": "2.6.6-rc2",
4
+ "version": "2.6.6-rc4",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -1,14 +1,23 @@
1
- import { ValidatorService } from '@e-is/ngx-material-table';
2
- import { UntypedFormGroup, UntypedFormBuilder } from '@angular/forms';
1
+ import { UntypedFormBuilder, ValidatorFn } from '@angular/forms';
3
2
  import { Person } from '../../../core/services/model/person.model';
4
- import { AccountValidatorService } from '../../../core/services/validator/account.validator';
3
+ import { AccountService } from '../../../core/services/account.service';
4
+ import { FormFieldDefinition } from '../../../shared/form/field.model';
5
+ import { AppValidatorService } from '../../../core/services/validator/base.validator.class';
6
+ import { TranslateService } from '@ngx-translate/core';
5
7
  import * as i0 from "@angular/core";
6
- export declare class PersonValidatorService implements ValidatorService {
7
- protected formBuilder: UntypedFormBuilder;
8
- protected accountValidatorService: AccountValidatorService;
9
- constructor(formBuilder: UntypedFormBuilder, accountValidatorService: AccountValidatorService);
10
- getRowValidator(): UntypedFormGroup;
11
- getFormGroup(data?: Person): UntypedFormGroup;
12
- static ɵfac: i0.ɵɵFactoryDeclaration<PersonValidatorService, never>;
13
- static ɵprov: i0.ɵɵInjectableDeclaration<PersonValidatorService>;
8
+ export interface PersonValidatorOptions {
9
+ withAvatar?: boolean;
10
+ withUsername?: boolean;
11
+ withUsernameExtranet?: boolean;
12
+ }
13
+ export declare class PersonValidatorService<T extends Person = Person, O extends PersonValidatorOptions = PersonValidatorOptions> extends AppValidatorService<T> {
14
+ protected accountService: AccountService;
15
+ constructor(formBuilder: UntypedFormBuilder, translate: TranslateService, accountService: AccountService);
16
+ getFormGroupConfig(data?: T, opts?: O): {
17
+ [key: string]: any;
18
+ };
19
+ getValidators(field: FormFieldDefinition): ValidatorFn | ValidatorFn[];
20
+ protected fillDefaultOptions(opts?: O): O;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<PersonValidatorService<any, any>, never>;
22
+ static ɵprov: i0.ɵɵInjectableDeclaration<PersonValidatorService<any, any>>;
14
23
  }
@@ -42,7 +42,7 @@ export declare class AccountPage extends AppForm<Account> implements OnInit, OnD
42
42
  readonly mobile: boolean;
43
43
  get valid(): boolean;
44
44
  protected authTokenEnabled: boolean;
45
- constructor(injector: Injector, formBuilder: UntypedFormBuilder, accountService: AccountService, network: NetworkService, navController: NavController, validatorService: AccountValidatorService, configService: ConfigService, cd: ChangeDetectorRef, locales: any);
45
+ constructor(injector: Injector, formBuilder: UntypedFormBuilder, accountService: AccountService, network: NetworkService, navController: NavController, validatorService: AccountValidatorService, configService: ConfigService, cd: ChangeDetectorRef, locales: LocaleConfig[]);
46
46
  ngOnInit(): void;
47
47
  ngOnDestroy(): void;
48
48
  onLogin(account: Account): void;
@@ -51,7 +51,7 @@ export declare class AccountPage extends AppForm<Account> implements OnInit, OnD
51
51
  emitEvent?: boolean;
52
52
  onlySelf?: boolean;
53
53
  }): Promise<void>;
54
- refresh(event?: Event): Promise<Account>;
54
+ refresh(_?: Event): Promise<Account>;
55
55
  startListenChanges(): void;
56
56
  stopListenChanges(): void;
57
57
  sendConfirmationEmail(event: MouseEvent): Promise<boolean>;
@@ -62,7 +62,7 @@ export declare class AccountPage extends AppForm<Account> implements OnInit, OnD
62
62
  emitEvent?: boolean;
63
63
  }): void;
64
64
  cancel(): Promise<void>;
65
- close(event?: Event): Promise<boolean>;
65
+ close(_?: Event): Promise<boolean>;
66
66
  protected markForCheck(): void;
67
67
  static ɵfac: i0.ɵɵFactoryDeclaration<AccountPage, never>;
68
68
  static ɵcmp: i0.ɵɵComponentDeclaration<AccountPage, "app-account-page", never, {}, {}, never, never, false>;
@@ -45,6 +45,7 @@ export declare class AppPropertiesTable extends AppInMemoryTable<PropertyEntity,
45
45
  protected validatorService: PropertyEntityValidator;
46
46
  definitions: FormFieldDefinition[];
47
47
  showToolbar: boolean;
48
+ debug: boolean;
48
49
  filterExpansionPanel: MatExpansionPanel;
49
50
  definitionsMapByKey: FormFieldDefinitionMap;
50
51
  translationsByKey: ObjectMap<string>;
@@ -73,6 +74,6 @@ export declare class AppPropertiesTable extends AppInMemoryTable<PropertyEntity,
73
74
  resetProperty(event: UIEvent, row: TableElement<PropertyEntity>): void;
74
75
  protected toValue(values: PropertyEntity[], definition: FormFieldDefinition): any;
75
76
  static ɵfac: i0.ɵɵFactoryDeclaration<AppPropertiesTable, never>;
76
- static ɵcmp: i0.ɵɵComponentDeclaration<AppPropertiesTable, "app-properties-table", never, { "definitions": "definitions"; "showToolbar": "showToolbar"; }, {}, never, never, false>;
77
+ static ɵcmp: i0.ɵɵComponentDeclaration<AppPropertiesTable, "app-properties-table", never, { "definitions": "definitions"; "showToolbar": "showToolbar"; "debug": "debug"; }, {}, never, never, false>;
77
78
  }
78
79
  export {};
@@ -105,7 +105,7 @@ export declare class GraphqlService extends StartableService<ApolloClient<any>>
105
105
  data: T[];
106
106
  equalsFn?: (d1: T, d2: T) => boolean;
107
107
  sortFn?: (d1: T, d2: T) => number;
108
- }): void;
108
+ }): number;
109
109
  /**
110
110
  * Remove from cache, and return if removed or not
111
111
  *
@@ -30,7 +30,15 @@ export interface BaseEntityServiceOptions<T extends Entity<any, ID>, ID = number
30
30
  queries: Q;
31
31
  mutations?: Partial<M>;
32
32
  subscriptions?: Partial<S>;
33
+ equals?: (e1: T, e2: T) => boolean;
34
+ /**
35
+ * @deprecated Use 'equals' instead
36
+ */
33
37
  equalsFn?: (e1: T, e2: T) => boolean;
38
+ isNew?: (e: T) => boolean;
39
+ /**
40
+ * @deprecated Use 'isNew' instead
41
+ */
34
42
  isNewFn?: (e: T) => boolean;
35
43
  defaultSortBy?: keyof T;
36
44
  defaultSortDirection?: SortDirection;
@@ -55,15 +63,15 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
55
63
  protected readonly queries: Q;
56
64
  protected readonly mutations: Partial<M>;
57
65
  protected readonly subscriptions: Partial<S>;
58
- protected readonly equalsFn: (e1: T, e2: T) => boolean;
59
- protected readonly isNewFn: (e: T) => boolean;
66
+ protected readonly _equalsFn: (e1: T, e2: T) => boolean;
67
+ protected readonly _isNewFn: (e: T) => boolean;
60
68
  protected readonly defaultSortBy: keyof T;
61
69
  protected readonly defaultSortDirection: SortDirection;
62
70
  protected readonly watchQueriesUpdatePolicy: MutableWatchQueriesUpdatePolicy;
63
71
  protected constructor(graphql: GraphqlService, platform: PlatformService, dataType: new () => T, filterType: new () => F, options: BaseEntityServiceOptions<T, ID, Q, M, S>);
64
72
  watch(id: number, opts?: WO): Observable<T>;
65
73
  load(id: ID, opts?: LO): Promise<T>;
66
- watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: F, opts?: WO): Observable<LoadResult<T>>;
74
+ watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, dataFilter?: F, opts?: WO): Observable<LoadResult<T>>;
67
75
  loadAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>, opts?: LO & {
68
76
  debug?: boolean;
69
77
  }): Promise<LoadResult<T>>;
@@ -91,6 +99,17 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
91
99
  copyIdAndUpdateDate(source: T, target: T): void;
92
100
  fromObject(source: any): T;
93
101
  asFilter(source: any): F;
102
+ equals(d1: T, d2: T): boolean;
103
+ isNew(data: T): boolean;
104
+ /**
105
+ * @deprecated Use equals() instead
106
+ */
107
+ equalsFn(d1: T, d2: T): boolean;
108
+ /**
109
+ * @deprecated Use isNew() instead
110
+ * @param data
111
+ */
112
+ isNewFn(data: T): boolean;
94
113
  protected ngOnStart(): Promise<void>;
95
114
  protected fillDefaultProperties(source: T): void;
96
115
  protected asObject(entity: T, opts?: EntityAsObjectOptions): any;
@@ -27,6 +27,7 @@ export declare const ErrorCodes: {
27
27
  TABLE_INVALID_ROW_ERROR: number;
28
28
  TABLE_READ_ONLY: number;
29
29
  UNAUTHORIZED: number;
30
+ INTERNAL_SERVER_ERROR: number;
30
31
  AUTH_CHALLENGE_ERROR: number;
31
32
  AUTH_SERVER_ERROR: number;
32
33
  LOAD_CONFIG_ERROR: number;
@@ -21,6 +21,7 @@ export declare class Person<T extends Person<any> = Person<any>> extends Entity<
21
21
  constructor(__typename?: string);
22
22
  asObject(opts?: ReferentialAsObjectOptions): any;
23
23
  fromObject(source: any): void;
24
+ equals(other: T): boolean;
24
25
  }
25
26
  export declare class PersonUtils {
26
27
  static getMainProfile(profiles?: string[]): UserProfileLabel;
@@ -1,17 +1,24 @@
1
- import { UntypedFormBuilder, ValidatorFn } from '@angular/forms';
1
+ import { UntypedFormBuilder } from '@angular/forms';
2
2
  import { Account } from '../model/account.model';
3
3
  import { AccountService } from '../account.service';
4
- import { FormFieldDefinition } from '../../../shared/form/field.model';
5
- import { AppValidatorService } from './base.validator.class';
6
4
  import { UserSettingsValidatorService } from './user-settings.validator';
5
+ import { PersonValidatorOptions, PersonValidatorService } from '../../../admin/services/validator/person.validator';
6
+ import { TranslateService } from '@ngx-translate/core';
7
7
  import * as i0 from "@angular/core";
8
- export declare class AccountValidatorService extends AppValidatorService<Account> {
8
+ export interface AccountValidatorOptions extends PersonValidatorOptions {
9
+ withSettings?: boolean;
10
+ withTokens?: boolean;
11
+ }
12
+ export declare class AccountValidatorService<T extends Account = Account, O extends AccountValidatorOptions = AccountValidatorOptions> extends PersonValidatorService<T, O> {
9
13
  protected formBuilder: UntypedFormBuilder;
14
+ protected translate: TranslateService;
10
15
  protected accountService: AccountService;
11
16
  protected userSettingsValidatorService: UserSettingsValidatorService;
12
- constructor(formBuilder: UntypedFormBuilder, accountService: AccountService, userSettingsValidatorService: UserSettingsValidatorService);
13
- getFormGroupConfig(data?: Account): any;
14
- getValidators(field: FormFieldDefinition): ValidatorFn | ValidatorFn[];
15
- static ɵfac: i0.ɵɵFactoryDeclaration<AccountValidatorService, never>;
16
- static ɵprov: i0.ɵɵInjectableDeclaration<AccountValidatorService>;
17
+ constructor(formBuilder: UntypedFormBuilder, translate: TranslateService, accountService: AccountService, userSettingsValidatorService: UserSettingsValidatorService);
18
+ getFormGroupConfig(data?: T, opts?: O): {
19
+ [key: string]: any[];
20
+ };
21
+ protected fillDefaultOptions(opts?: O): O;
22
+ static ɵfac: i0.ɵɵFactoryDeclaration<AccountValidatorService<any, any>, never>;
23
+ static ɵprov: i0.ɵɵInjectableDeclaration<AccountValidatorService<any, any>>;
17
24
  }
@@ -11,7 +11,7 @@ export declare abstract class AppValidatorService<T = any> extends ValidatorServ
11
11
  getRowValidator(): UntypedFormGroup;
12
12
  getFormGroup(data?: T): UntypedFormGroup;
13
13
  getFormGroupConfig(data?: T): {
14
- [key: string]: any;
14
+ [key: string]: any[];
15
15
  };
16
16
  getI18nFormErrors(control: AbstractControl): string[];
17
17
  getI18nErrors(errors: FormErrors): string[];
@@ -420,6 +420,7 @@
420
420
  "LIST": {
421
421
  "TITLE": "Users",
422
422
  "BTN_SEND_MESSAGE": "Send a message",
423
+ "BTN_ACTIONS": "Actions",
423
424
  "FILTER": {
424
425
  "SEARCH": "Search"
425
426
  }
@@ -420,6 +420,7 @@
420
420
  "LIST": {
421
421
  "TITLE": "Users",
422
422
  "BTN_SEND_MESSAGE": "Send a message",
423
+ "BTN_ACTIONS": "Actions",
423
424
  "FILTER": {
424
425
  "SEARCH": "Search"
425
426
  }
@@ -2,7 +2,7 @@
2
2
  "name": "ngx-sumaris-components",
3
3
  "short_name": "ngx-sumaris-components",
4
4
  "manifest_version": 1,
5
- "version": "2.6.4",
5
+ "version": "2.6.6-rc4",
6
6
  "default_locale": "fr",
7
7
  "description": "Angular components for building beautiful and responsive Apps",
8
8
  "icons": [{