@sumaris-net/ngx-components 1.19.1 → 1.20.0-rc1

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 (27) hide show
  1. package/bundles/sumaris-net.ngx-components.umd.js +292 -155
  2. package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
  3. package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
  4. package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
  5. package/doc/changelog.md +7 -0
  6. package/esm2015/src/app/admin/users/list/users.js +5 -1
  7. package/esm2015/src/app/core/auth/form/form-auth.js +26 -20
  8. package/esm2015/src/app/core/core.module.js +3 -1
  9. package/esm2015/src/app/core/form/form.class.js +27 -7
  10. package/esm2015/src/app/core/services/base-entity-service.class.js +6 -6
  11. package/esm2015/src/app/core/services/model/entity.model.js +5 -1
  12. package/esm2015/src/app/core/table/entities-table-datasource.class.js +136 -99
  13. package/esm2015/src/app/core/table/memory-table.class.js +3 -3
  14. package/esm2015/src/app/core/table/table.class.js +4 -5
  15. package/esm2015/src/app/shared/platforms.js +3 -3
  16. package/esm2015/src/app/shared/validator/validators.js +2 -2
  17. package/fesm2015/sumaris-net.ngx-components.js +203 -133
  18. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  19. package/package.json +2 -2
  20. package/src/app/core/auth/form/form-auth.d.ts +1 -1
  21. package/src/app/core/form/form.class.d.ts +8 -1
  22. package/src/app/core/services/model/entity.model.d.ts +1 -0
  23. package/src/app/core/table/entities-table-datasource.class.d.ts +20 -26
  24. package/src/assets/i18n/en-US.json +21 -2
  25. package/src/assets/i18n/en.json +19 -1
  26. package/src/assets/i18n/fr.json +2 -2
  27. 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": "1.19.1",
4
+ "version": "1.20.0-rc1",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "engines": {
29
29
  "node": ">= 12.22.8",
30
- "npm": ">= 8.3.0",
30
+ "npm": ">= 7.20.0",
31
31
  "yarn": ">= 1.22.0"
32
32
  },
33
33
  "cordova": {
@@ -27,7 +27,7 @@ export declare class AuthForm extends AppForm<AuthData> implements OnInit {
27
27
  constructor(injector: Injector, platform: PlatformService, formBuilder: FormBuilder, settings: LocalSettingsService, configService: ConfigService, modalCtrl: ModalController, network: NetworkService, cd: ChangeDetectorRef, environment: any);
28
28
  ngOnInit(): void;
29
29
  cancel(): void;
30
- doSubmit(event?: UIEvent): void;
30
+ doSubmit(event?: UIEvent): Promise<void>;
31
31
  register(): void;
32
32
  protected markForCheck(): void;
33
33
  }
@@ -60,7 +60,14 @@ export declare abstract class AppForm<T> implements IAppForm, OnInit, OnDestroy,
60
60
  ngOnInit(): void;
61
61
  ngOnDestroy(): void;
62
62
  cancel(): void;
63
- doSubmit(event: any): void;
63
+ /**
64
+ *
65
+ * @param event
66
+ * @param opts allow to skip validation check, using {checkValid: false}
67
+ */
68
+ doSubmit(event: any, opts?: {
69
+ checkValid?: boolean;
70
+ }): Promise<void>;
64
71
  setForm(form: FormGroup): void;
65
72
  setValue(data: T, opts?: {
66
73
  emitEvent?: boolean;
@@ -46,6 +46,7 @@ export declare abstract class Entity<T extends Entity<T, ID, AO, FO>, ID = numbe
46
46
  export declare function isInstanceOf<T>(obj: any, constructor: new (...args: any[]) => T): obj is T;
47
47
  export declare abstract class EntityUtils {
48
48
  static isEntity<T extends IEntity<any>>(obj: T | any): obj is T;
49
+ static isNotEntity<T extends IEntity<any>>(obj: T | any): boolean;
49
50
  static isNotEmpty<T extends IEntity<any> | any>(obj: T, checkedAttribute: keyof T): boolean;
50
51
  static isEmpty<T extends IEntity<any> | any>(obj: T, checkedAttribute: keyof T): boolean;
51
52
  static equals<T extends IEntity<any> | any>(o1: T, o2: T, checkAttribute?: keyof T): boolean;
@@ -1,7 +1,6 @@
1
1
  import { TableDataSource, TableElement, ValidatorService } from '@e-is/ngx-material-table';
2
2
  import { BehaviorSubject, Observable, Subject } from 'rxjs';
3
3
  import { Entity, IEntity } from '../services/model/entity.model';
4
- import { OnDestroy } from '@angular/core';
5
4
  import { SortDirection } from '@angular/material/sort';
6
5
  import { CollectionViewer } from '@angular/cdk/collections';
7
6
  import { TableDataSourceOptions } from '@e-is/ngx-material-table/src/app/ngx-material-table/table-data-source';
@@ -11,30 +10,24 @@ export declare interface AppTableDataServiceOptions<O extends EntitiesServiceWat
11
10
  saveOnlyDirtyRows?: boolean;
12
11
  readOnly?: boolean;
13
12
  }
14
- export declare class AppTableDataSourceOptions<T extends Entity<T, ID>, ID = number, O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions> implements TableDataSourceOptions {
15
- [key: string]: any;
16
- prependNewElements?: boolean;
17
- suppressErrors?: boolean;
18
- keepOriginalDataAfterConfirm?: boolean;
13
+ export interface AppTableDataSourceOptions<T extends Entity<T, ID>, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions> extends TableDataSourceOptions {
19
14
  onRowCreated?: (row: TableElement<T>) => Promise<void> | void;
20
- dataServiceOptions?: AppTableDataServiceOptions<O>;
15
+ dataServiceOptions?: AppTableDataServiceOptions<WO>;
21
16
  debug?: boolean;
17
+ [key: string]: any;
22
18
  }
23
- export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any, ID = number, O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions> extends TableDataSource<T> implements OnDestroy {
24
- readonly dataService: IEntitiesService<T, F, O>;
19
+ export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any, ID = number, V extends ValidatorService = ValidatorService, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions, O extends AppTableDataSourceOptions<T, ID, WO> = AppTableDataSourceOptions<T, ID, WO>> extends TableDataSource<T, V, O> {
20
+ readonly dataService: IEntitiesService<T, F, WO>;
25
21
  private readonly _logTypeName;
26
- private readonly _options;
27
22
  protected readonly _debug: boolean;
28
23
  protected _creating: boolean;
29
24
  protected _saving: boolean;
30
- protected _useValidator: boolean;
31
25
  protected _stopWatching$: Subject<any>;
32
26
  protected _editingRowCount: number;
33
27
  protected _fetchMoreFn: FetchMoreFn<LoadResult<T>>;
34
28
  loadingSubject: BehaviorSubject<boolean>;
35
- get serviceOptions(): AppTableDataServiceOptions<O>;
36
- set serviceOptions(value: AppTableDataServiceOptions<O>);
37
- get options(): AppTableDataSourceOptions<T, ID, O>;
29
+ get serviceOptions(): AppTableDataServiceOptions<WO>;
30
+ set serviceOptions(value: AppTableDataServiceOptions<WO>);
38
31
  get loaded(): boolean;
39
32
  get loading(): boolean;
40
33
  /**
@@ -42,28 +35,29 @@ export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any,
42
35
  *
43
36
  * @param dataService A service to load and save data
44
37
  * @param dataType Type of data contained by the Table. If not specified, then `data` with at least one element must be specified.
45
- * @param environment
46
38
  * @param validatorService Service that create instances of the FormGroup used to validate row fields.
47
39
  * @param config Additional configuration for table.
48
40
  */
49
- constructor(dataType: new () => T, dataService: IEntitiesService<T, F, O>, validatorService?: ValidatorService, config?: AppTableDataSourceOptions<T, ID, O>);
50
- ngOnDestroy(): void;
41
+ constructor(dataType: new () => T, dataService: IEntitiesService<T, F, WO>, validatorService?: V, config?: O);
42
+ disconnect(collectionViewer?: CollectionViewer): void;
51
43
  watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>): Observable<LoadResult<T>>;
52
44
  save(): Promise<boolean>;
45
+ protected getDataFromRows(rows: TableElement<T>[], options?: {
46
+ originalData: boolean;
47
+ toEntity: boolean;
48
+ }): T[];
49
+ toEntity(data: T | any): T;
53
50
  updateDatasource(data: T[], opts?: {
54
51
  emitEvent: boolean;
55
- }): void;
56
- createNew(insertAt?: number): void;
57
- connect(collectionViewer: CollectionViewer): Observable<TableElement<T>[] | ReadonlyArray<TableElement<T>>>;
58
- disconnect(collectionViewer?: CollectionViewer): void;
52
+ }): Promise<void>;
59
53
  waitIdle(debounceTimeMs?: number): Promise<any>;
60
- confirmCreate(row: TableElement<T>): boolean;
61
- confirmEdit(row: TableElement<T>): boolean;
62
- startEdit(row: TableElement<T>): void;
63
- cancelOrDelete(row: TableElement<T>): void;
54
+ confirmCreate(row: TableElement<T>): Promise<boolean>;
55
+ confirmEdit(row: TableElement<T>): Promise<boolean>;
56
+ startEdit(row: TableElement<T>): Promise<boolean>;
57
+ cancel(row: TableElement<T>): Promise<boolean>;
64
58
  handleError(error: any, message: string): Observable<LoadResult<T>>;
65
59
  handleErrorPromise(error: any): void;
66
- delete(id: number): void;
60
+ delete(id: number): Promise<boolean>;
67
61
  deleteAll(rows: TableElement<T>[]): Promise<any>;
68
62
  getRows(): Promise<TableElement<T>[]>;
69
63
  asyncCreateNew(insertAt?: number): Promise<void>;
@@ -396,12 +396,31 @@
396
396
  },
397
397
  "TYPE_ENUM": {
398
398
  "DEBUG_DATA": "Debug data",
399
- "INBOX_MESSAGE": "Inbox message"
399
+ "INBOX_MESSAGE": "Inbox message",
400
+ "FEED": "Feed"
401
+ }
402
+ },
403
+ "MESSAGE": {
404
+ "TYPE": "Message type",
405
+ "RECIPIENTS": "Recipients",
406
+ "SUBJECT": "Object",
407
+ "BODY_HELP": "Your message...",
408
+ "NEW": {
409
+ "TITLE": "New message"
410
+ },
411
+ "TYPE_ENUM": {
412
+ "INBOX_MESSAGE": "Internal message",
413
+ "EMAIL": "Email",
414
+ "FEED": "Feed"
400
415
  }
401
416
  },
402
417
  "ERROR": {
403
418
  "LOAD_USER_EVENTS_ERROR": "Error while loading notifications",
404
- "SAVE_USER_EVENT_ERROR": "Error while saving user message"
419
+ "SAVE_USER_EVENT_ERROR": "Error while saving user notification",
420
+ "SEND_MESSAGE_ERROR": "Error while sending message"
421
+ },
422
+ "INFO": {
423
+ "MESSAGE_SENT": "Message <b>sent</b>"
405
424
  }
406
425
  },
407
426
  "FILE": {
@@ -400,9 +400,27 @@
400
400
  "FEED": "Feed"
401
401
  }
402
402
  },
403
+ "MESSAGE": {
404
+ "TYPE": "Message type",
405
+ "RECIPIENTS": "Recipients",
406
+ "SUBJECT": "Object",
407
+ "BODY_HELP": "Your message...",
408
+ "NEW": {
409
+ "TITLE": "New message"
410
+ },
411
+ "TYPE_ENUM": {
412
+ "INBOX_MESSAGE": "Internal message",
413
+ "EMAIL": "Email",
414
+ "FEED": "Feed"
415
+ }
416
+ },
403
417
  "ERROR": {
404
418
  "LOAD_USER_EVENTS_ERROR": "Error while loading notifications",
405
- "SAVE_USER_EVENT_ERROR": "Error while saving user message"
419
+ "SAVE_USER_EVENT_ERROR": "Error while saving user notification",
420
+ "SEND_MESSAGE_ERROR": "Error while sending message"
421
+ },
422
+ "INFO": {
423
+ "MESSAGE_SENT": "Message <b>sent</b>"
406
424
  }
407
425
  },
408
426
  "FILE": {
@@ -175,7 +175,7 @@
175
175
  },
176
176
  "TESTING": "Mode développeur ?",
177
177
  "ENTITY_TRASH": "Activer la corbeille du pod ?",
178
- "UPDATE_TECHNICAL_TABLES": "Mise à jour auto des tables techniques ?",
178
+ "UPDATE_TECHNICAL_TABLES": "Pod > Tables techniques : mise à jour auto ?",
179
179
  "ANALYTIC_REFERENCES_ENABLE": "Stratégie > Références analytiques : Activer ?",
180
180
  "AUTH_TOKEN_TYPE_PLACEHOLDER": "Securité > Type d'authentification",
181
181
  "AUTH_TOKEN_TYPE": {
@@ -421,7 +421,7 @@
421
421
  "SEND_MESSAGE_ERROR": "Erreur lors de l'envoi du message"
422
422
  },
423
423
  "INFO": {
424
- "MESSAGE_SENT": "Message envoyé"
424
+ "MESSAGE_SENT": "Message <b>envoyé</b>"
425
425
  }
426
426
  },
427
427
  "FILE": {