@sumaris-net/ngx-components 1.23.9 → 1.23.11

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 +450 -430
  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 +8 -0
  6. package/esm2015/src/app/admin/users/list/users.js +2 -2
  7. package/esm2015/src/app/core/form/editor.class.js +40 -37
  8. package/esm2015/src/app/core/services/account.service.js +2 -2
  9. package/esm2015/src/app/core/services/config.service.js +2 -2
  10. package/esm2015/src/app/core/services/network.service.js +6 -6
  11. package/esm2015/src/app/core/table/entities-table-datasource.class.js +2 -2
  12. package/esm2015/src/app/core/table/table.class.js +6 -4
  13. package/esm2015/src/app/core/table/testing/table.testing.js +2 -2
  14. package/esm2015/src/app/shared/directives/autofocus.directive.js +1 -1
  15. package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +2 -2
  16. package/esm2015/src/app/shared/services/entity-service.class.js +1 -10
  17. package/esm2015/src/app/shared/services/memory-entity-service.class.js +76 -33
  18. package/esm2015/src/app/shared/services/startable-service.class.js +21 -13
  19. package/fesm2015/sumaris-net.ngx-components.js +381 -348
  20. package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
  21. package/package.json +3 -3
  22. package/src/app/core/form/editor.class.d.ts +2 -1
  23. package/src/app/core/services/network.service.d.ts +1 -1
  24. package/src/app/shared/services/entity-service.class.d.ts +0 -8
  25. package/src/app/shared/services/memory-entity-service.class.d.ts +14 -7
  26. package/src/app/shared/services/startable-service.class.d.ts +4 -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.23.9",
4
+ "version": "1.23.11",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -27,8 +27,8 @@
27
27
  "url": "https://gitlab.ifremer.fr/sih-public/sumaris/ngx-sumaris-components/-/issues"
28
28
  },
29
29
  "engines": {
30
- "node": ">= 12.22.8",
31
- "npm": ">= 8.3.0",
30
+ "node": ">= 14.20.0",
31
+ "npm": ">= 8.17.0",
32
32
  "yarn": ">= 1.22.0"
33
33
  },
34
34
  "cordova": {
@@ -173,7 +173,8 @@ export declare abstract class AppEditor<T = any, ID = number, O = any> implement
173
173
  protected registerSubscription(sub: Subscription | TeardownLogic): void;
174
174
  protected unregisterSubscription(sub: Subscription): void;
175
175
  protected saveIfDirtyAndConfirm(event?: UIEvent, opts?: {
176
- emitEvent: boolean;
176
+ emitEvent?: boolean;
177
+ confirmed?: boolean;
177
178
  }): Promise<boolean>;
178
179
  protected showToast(opts: ShowToastOptions): Promise<void>;
179
180
  protected logChildrenFormErrors(c: IAppForm | AbstractControl, prefix?: string, path?: string): void;
@@ -89,7 +89,7 @@ export declare class NetworkService extends StartableService<Peer> {
89
89
  nocache?: boolean;
90
90
  }): Promise<AppManifest | undefined>;
91
91
  getAppVersion(peer?: string | Peer, opts?: {
92
- nocache?: boolean;
92
+ nocache: boolean;
93
93
  }): Promise<string | undefined>;
94
94
  computePeerPath(peer: string | Peer | undefined, path: string): string | undefined;
95
95
  /**
@@ -1,7 +1,6 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { FetchPolicy, WatchQueryFetchPolicy } from '@apollo/client/core';
3
3
  import { SortDirection } from '@angular/material/sort';
4
- import { OnDestroy } from '@angular/core';
5
4
  import { EmptyObject } from 'apollo-angular/types';
6
5
  export declare interface Page {
7
6
  offset: number;
@@ -62,10 +61,3 @@ export declare type LoadResultByPageFn<T> = (offset: number, size: number) => Pr
62
61
  export interface IEntityFullService<T, ID, F, O extends EntitiesServiceWatchOptions & EntityServiceLoadOptions> extends IEntityService<T, ID, O>, IEntitiesService<T, F, O> {
63
62
  }
64
63
  export declare function mergeLoadResult<T>(res1: LoadResult<T>, res2: LoadResult<T>): LoadResult<T>;
65
- export declare abstract class EntitiesService<T, F, O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions> implements IEntitiesService<T, F, O>, OnDestroy {
66
- ngOnDestroy(): void;
67
- abstract watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>, options?: O): Observable<LoadResult<T>>;
68
- abstract saveAll(data: T[], options?: any): Promise<T[]>;
69
- abstract deleteAll(data: T[], options?: any): Promise<any>;
70
- abstract asFilter(filter: Partial<F>): F;
71
- }
@@ -1,8 +1,9 @@
1
1
  import { Observable } from 'rxjs';
2
- import { EntitiesService, EntitiesServiceLoadOptions, EntitiesServiceWatchOptions, FilterFn, FilterFnFactory, IEntitiesService, LoadResult } from './entity-service.class';
2
+ import { EntitiesServiceLoadOptions, EntitiesServiceWatchOptions, FilterFn, FilterFnFactory, IEntitiesService, LoadResult } from './entity-service.class';
3
3
  import { SortDirection } from '@angular/material/sort';
4
- import { OnDestroy } from '@angular/core';
5
4
  import { IEntity } from '../../core/services/model/entity.model';
5
+ import { WaitForOptions } from '../observables';
6
+ import { StartableService } from './startable-service.class';
6
7
  export interface InMemoryEntitiesServiceOptions<T, F> {
7
8
  onSort?: (data: T[], sortBy?: string, sortDirection?: SortDirection) => T[];
8
9
  onLoad?: (data: T[]) => T[] | Promise<T[]>;
@@ -14,14 +15,14 @@ export interface InMemoryEntitiesServiceOptions<T, F> {
14
15
  [key: string]: string;
15
16
  };
16
17
  }
17
- export declare class InMemoryEntitiesService<T extends IEntity<T, ID>, F = any, ID = number, O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions> extends EntitiesService<T, F, ID> implements IEntitiesService<T, F, O>, OnDestroy {
18
+ export declare class InMemoryEntitiesService<T extends IEntity<T, ID>, F = any, ID = number, O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions> extends StartableService<T[]> implements IEntitiesService<T, F, O> {
18
19
  protected dataType: new () => T;
19
20
  protected filterType: new () => F;
20
21
  debug: boolean;
21
- dirty: boolean;
22
22
  private _hiddenData;
23
- private _saving;
24
- private readonly dataSubject;
23
+ private dataSubject;
24
+ private readonly dirtySubject;
25
+ private readonly savingSubject;
25
26
  private readonly _sortFn;
26
27
  private readonly _onLoad;
27
28
  private readonly _onSaveFn;
@@ -30,8 +31,11 @@ export declare class InMemoryEntitiesService<T extends IEntity<T, ID>, F = any,
30
31
  private readonly _sortByReplacement;
31
32
  set value(data: T[]);
32
33
  get value(): T[];
34
+ get saving(): boolean;
35
+ get dirty(): boolean;
33
36
  constructor(dataType: new () => T, filterType: new () => F, options?: InMemoryEntitiesServiceOptions<T, F>);
34
- ngOnDestroy(): void;
37
+ protected ngOnStart(): Promise<T[]>;
38
+ protected ngOnStop(): Promise<void>;
35
39
  setValue(data: T[]): void;
36
40
  loadAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: F, opts?: EntitiesServiceLoadOptions): Promise<LoadResult<T>>;
37
41
  watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filterData?: F, options?: any): Observable<LoadResult<T>>;
@@ -49,6 +53,9 @@ export declare class InMemoryEntitiesService<T extends IEntity<T, ID>, F = any,
49
53
  get hiddenCount(): number;
50
54
  protected filter(data: T[], _filter: F, hiddenData: T[]): T[];
51
55
  protected connect(): Observable<LoadResult<T>>;
56
+ waitWhileSaving(opts?: WaitForOptions): Promise<void>;
52
57
  protected markAsSaving(): void;
53
58
  protected markAsSaved(): void;
59
+ protected markAsDirty(): void;
60
+ protected markAsPristine(): void;
54
61
  }
@@ -6,7 +6,8 @@ export interface IStartableService<T = any> {
6
6
  ready(): Promise<T>;
7
7
  }
8
8
  export declare abstract class StartableService<T = any> implements IStartableService<T> {
9
- onStart: Subject<T>;
9
+ startSubject: Subject<T>;
10
+ stopSubject: Subject<void>;
10
11
  protected _debug: boolean;
11
12
  protected _startByReadyFunction: boolean;
12
13
  protected _data: T;
@@ -14,7 +15,7 @@ export declare abstract class StartableService<T = any> implements IStartableSer
14
15
  private _startPromise;
15
16
  private _startPrerequisite;
16
17
  private _subscription;
17
- protected constructor(prerequisiteService: {
18
+ protected constructor(prerequisiteService?: {
18
19
  ready: () => Promise<any>;
19
20
  });
20
21
  start(): Promise<T>;
@@ -25,6 +26,7 @@ export declare abstract class StartableService<T = any> implements IStartableSer
25
26
  ready(): Promise<T>;
26
27
  protected registerSubscription(sub: Subscription): Subscription;
27
28
  protected unregisterSubscription(sub: Subscription): void;
29
+ protected unsubscribe(): void;
28
30
  protected ngOnStop(): Promise<void>;
29
31
  protected abstract ngOnStart(): Promise<T>;
30
32
  }