@sumaris-net/ngx-components 18.9.0 → 18.9.2
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/doc/changelog.md +7 -0
- package/esm2022/src/app/core/services/base-entity-service.class.mjs +4 -1
- package/esm2022/src/app/core/table/entities-async-table-datasource.class.mjs +29 -9
- package/esm2022/src/app/core/table/entities-table-datasource.class.mjs +42 -38
- package/esm2022/src/app/shared/services/entity-service.class.mjs +1 -1
- package/esm2022/src/app/shared/services/memory-entity-service.class.mjs +4 -1
- package/fesm2022/sumaris-net.ngx-components.mjs +73 -43
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/services/base-entity-service.class.d.ts +2 -1
- package/src/app/core/table/entities-async-table-datasource.class.d.ts +22 -3
- package/src/app/core/table/entities-table-datasource.class.d.ts +22 -14
- package/src/app/shared/services/entity-service.class.d.ts +1 -0
- package/src/app/shared/services/memory-entity-service.class.d.ts +1 -0
- package/src/assets/manifest.json +1 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { ApolloCache, InternalRefetchQueriesInclude, MutationUpdaterFn, MutationUpdaterFunction } from '@apollo/client/core';
|
|
2
|
+
import { ApolloCache, InternalRefetchQueriesInclude, MutationUpdaterFn, MutationUpdaterFunction, WatchQueryFetchPolicy } from '@apollo/client/core';
|
|
3
3
|
import { SortDirection } from '@angular/material/sort';
|
|
4
4
|
import { BaseGraphqlService } from './base-graphql-service.class';
|
|
5
5
|
import { EntitiesServiceLoadOptions, EntitiesServiceWatchOptions, EntityServiceListenChangesOptions, IEntitiesService, IEntityService, LoadResult } from '../../shared/services/entity-service.class';
|
|
@@ -72,6 +72,7 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
|
|
|
72
72
|
protected readonly defaultSortBy: keyof T;
|
|
73
73
|
protected readonly defaultSortDirection: SortDirection;
|
|
74
74
|
protected readonly watchQueriesUpdatePolicy: MutableWatchQueriesUpdatePolicy;
|
|
75
|
+
get defaultFetchPolicy(): WatchQueryFetchPolicy;
|
|
75
76
|
protected constructor(graphql: GraphqlService, platform: PlatformService, dataType: new () => T, filterType: new () => F, options: BaseEntityServiceOptions<T, ID, Q, M, S>);
|
|
76
77
|
watch(id: number, opts?: WO): Observable<T>;
|
|
77
78
|
load(id: ID, opts?: LO): Promise<T>;
|
|
@@ -5,6 +5,7 @@ import { OnDestroy } from '@angular/core';
|
|
|
5
5
|
import { SortDirection } from '@angular/material/sort';
|
|
6
6
|
import { CollectionViewer } from '@angular/cdk/collections';
|
|
7
7
|
import { EntitiesServiceWatchOptions, FetchMoreFn, IEntitiesService, LoadResult } from '../../shared/services/entity-service.class';
|
|
8
|
+
import { FirstOptions } from '../../shared/observables';
|
|
8
9
|
import { IEntitiesTableDataSource } from './table.model';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
export interface EntitiesAsyncTableDataSourceConfig<T extends IEntity<T, ID>, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions, SO = any> extends TableDataSourceConfig {
|
|
@@ -26,6 +27,7 @@ export declare class EntitiesAsyncTableDataSource<T extends IEntity<T, ID>, F =
|
|
|
26
27
|
protected _creating: boolean;
|
|
27
28
|
protected _saving: boolean;
|
|
28
29
|
protected _fetchMoreFn: FetchMoreFn<LoadResult<T>>;
|
|
30
|
+
protected _waitingNetworkResult: boolean;
|
|
29
31
|
protected _stopWatchSubject: Subject<void>;
|
|
30
32
|
loadingSubject: BehaviorSubject<boolean>;
|
|
31
33
|
get watchAllOptions(): WO;
|
|
@@ -39,9 +41,8 @@ export declare class EntitiesAsyncTableDataSource<T extends IEntity<T, ID>, F =
|
|
|
39
41
|
*
|
|
40
42
|
* @param dataService A service to load and save data
|
|
41
43
|
* @param dataType Type of data contained by the Table. If not specified, then `data` with at least one element must be specified.
|
|
42
|
-
* @param environment
|
|
43
44
|
* @param validatorService Service that create instances of the FormGroup used to validate row fields.
|
|
44
|
-
* @param
|
|
45
|
+
* @param options Additional options
|
|
45
46
|
*/
|
|
46
47
|
constructor(dataType: new () => T, dataService: IEntitiesService<T, F, WO>, validatorService?: V, options?: C);
|
|
47
48
|
ngOnDestroy(): void;
|
|
@@ -52,8 +53,26 @@ export declare class EntitiesAsyncTableDataSource<T extends IEntity<T, ID>, F =
|
|
|
52
53
|
emitEvent: boolean;
|
|
53
54
|
}): void;
|
|
54
55
|
connect(collectionViewer: CollectionViewer): Observable<R[] | ReadonlyArray<R>>;
|
|
56
|
+
/**
|
|
57
|
+
* Disconnects the data source, cleaning up any resources and subscriptions.
|
|
58
|
+
*
|
|
59
|
+
* @param {CollectionViewer} [collectionViewer] - Optional parameter representing the collection viewer to disconnect from.
|
|
60
|
+
* @return {void} - This method does not return a value.
|
|
61
|
+
*/
|
|
55
62
|
disconnect(collectionViewer?: CollectionViewer): void;
|
|
56
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Waits for the idle state based on the provided options.
|
|
65
|
+
*
|
|
66
|
+
* @param {number | { debounceTimeMs?: number } & FirstOptions} [opts] Options for controlling the wait behavior.
|
|
67
|
+
* - If a number is provided, it is treated as the debounce time in milliseconds.
|
|
68
|
+
* - If an object is provided, it can include the following properties:
|
|
69
|
+
* - debounceTimeMs: The debounce time in milliseconds. Defaults to 100 if not specified.
|
|
70
|
+
* - Additional options from `FirstOptions` interface.
|
|
71
|
+
* @return {Promise<any>} A Promise that resolves when the idle state is reached.
|
|
72
|
+
*/
|
|
73
|
+
waitIdle(opts?: number | ({
|
|
74
|
+
debounceTimeMs?: number;
|
|
75
|
+
} & FirstOptions)): Promise<any>;
|
|
57
76
|
confirmCreate(row: R): Promise<boolean>;
|
|
58
77
|
confirmEdit(row: R): Promise<boolean>;
|
|
59
78
|
startEdit(row: R): Promise<boolean>;
|
|
@@ -5,6 +5,7 @@ import { OnDestroy } from '@angular/core';
|
|
|
5
5
|
import { SortDirection } from '@angular/material/sort';
|
|
6
6
|
import { CollectionViewer } from '@angular/cdk/collections';
|
|
7
7
|
import { EntitiesServiceWatchOptions, FetchMoreFn, IEntitiesService, LoadResult } from '../../shared/services/entity-service.class';
|
|
8
|
+
import { FirstOptions } from '../../shared/observables';
|
|
8
9
|
import { IEntitiesTableDataSource } from './table.model';
|
|
9
10
|
import * as i0 from "@angular/core";
|
|
10
11
|
export interface EntitiesTableDataSourceConfig<T extends IEntity<T, ID>, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions, SO = any> extends TableDataSourceConfig {
|
|
@@ -27,16 +28,9 @@ export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any,
|
|
|
27
28
|
protected _creating: boolean;
|
|
28
29
|
protected _saving: boolean;
|
|
29
30
|
protected _fetchMoreFn: FetchMoreFn<LoadResult<T>>;
|
|
31
|
+
protected _waitingNetworkResult: boolean;
|
|
30
32
|
protected _stopWatchSubject: Subject<void>;
|
|
31
33
|
loadingSubject: BehaviorSubject<boolean>;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated Use watchAllOptions or saveAllOptions
|
|
34
|
-
*/
|
|
35
|
-
get serviceOptions(): WO & SO;
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated Use watchAllOptions or saveAllOptions
|
|
38
|
-
*/
|
|
39
|
-
set serviceOptions(value: WO & SO);
|
|
40
34
|
get watchAllOptions(): WO;
|
|
41
35
|
set watchAllOptions(value: WO);
|
|
42
36
|
get saveAllOptions(): SO;
|
|
@@ -48,14 +42,10 @@ export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any,
|
|
|
48
42
|
*
|
|
49
43
|
* @param dataService A service to load and save data
|
|
50
44
|
* @param dataType Type of data contained by the Table. If not specified, then `data` with at least one element must be specified.
|
|
51
|
-
* @param environment
|
|
52
45
|
* @param validatorService Service that create instances of the FormGroup used to validate row fields.
|
|
53
|
-
* @param
|
|
46
|
+
* @param options Additional options
|
|
54
47
|
*/
|
|
55
48
|
constructor(dataType: new () => T, dataService: IEntitiesService<T, F, WO>, validatorService?: V, options?: C);
|
|
56
|
-
/**
|
|
57
|
-
* @deprecated use disconnect
|
|
58
|
-
*/
|
|
59
49
|
ngOnDestroy(): void;
|
|
60
50
|
/**
|
|
61
51
|
* @deprecated use disconnect
|
|
@@ -68,8 +58,26 @@ export declare class EntitiesTableDataSource<T extends IEntity<T, ID>, F = any,
|
|
|
68
58
|
emitEvent: boolean;
|
|
69
59
|
}): void;
|
|
70
60
|
connect(collectionViewer: CollectionViewer): Observable<R[] | ReadonlyArray<R>>;
|
|
61
|
+
/**
|
|
62
|
+
* Disconnects the data source, cleaning up any resources and subscriptions.
|
|
63
|
+
*
|
|
64
|
+
* @param {CollectionViewer} [collectionViewer] - Optional parameter representing the collection viewer to disconnect from.
|
|
65
|
+
* @return {void} - This method does not return a value.
|
|
66
|
+
*/
|
|
71
67
|
disconnect(collectionViewer?: CollectionViewer): void;
|
|
72
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Waits for the idle state based on the provided options.
|
|
70
|
+
*
|
|
71
|
+
* @param {number | { debounceTimeMs?: number } & FirstOptions} [opts] Options for controlling the wait behavior.
|
|
72
|
+
* - If a number is provided, it is treated as the debounce time in milliseconds.
|
|
73
|
+
* - If an object is provided, it can include the following properties:
|
|
74
|
+
* - debounceTimeMs: The debounce time in milliseconds. Defaults to 100 if not specified.
|
|
75
|
+
* - Additional options from `FirstOptions` interface.
|
|
76
|
+
* @return {Promise<any>} A Promise that resolves when the idle state is reached.
|
|
77
|
+
*/
|
|
78
|
+
waitIdle(opts?: number | ({
|
|
79
|
+
debounceTimeMs?: number;
|
|
80
|
+
} & FirstOptions)): Promise<any>;
|
|
73
81
|
confirmCreate(row: R): boolean;
|
|
74
82
|
confirmEdit(row: R): boolean;
|
|
75
83
|
startEdit(row: R): boolean;
|
|
@@ -62,6 +62,7 @@ export declare interface EntitiesServiceWatchOptions<T = any> extends EntityServ
|
|
|
62
62
|
withTotal?: boolean;
|
|
63
63
|
}
|
|
64
64
|
export declare interface IEntitiesService<T, F, O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions<T>> {
|
|
65
|
+
readonly defaultFetchPolicy?: WatchQueryFetchPolicy;
|
|
65
66
|
watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>, options?: O): Observable<LoadResult<T>>;
|
|
66
67
|
saveAll(data: T[], opts?: any): Promise<T[]>;
|
|
67
68
|
deleteAll(data: T[], opts?: any): Promise<any>;
|
|
@@ -33,6 +33,7 @@ export declare class InMemoryEntitiesService<T extends IEntity<T, ID>, F = any,
|
|
|
33
33
|
private readonly _onSaveFn;
|
|
34
34
|
private readonly _equalsFn;
|
|
35
35
|
private readonly _filterFnFactory;
|
|
36
|
+
get defaultFetchPolicy(): 'cache-only';
|
|
36
37
|
set value(data: T[]);
|
|
37
38
|
get value(): T[];
|
|
38
39
|
get saving(): boolean;
|
package/src/assets/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ngx-sumaris-components",
|
|
3
3
|
"short_name": "ngx-sumaris-components",
|
|
4
4
|
"manifest_version": 1,
|
|
5
|
-
"version": "18.9.
|
|
5
|
+
"version": "18.9.2",
|
|
6
6
|
"default_locale": "fr",
|
|
7
7
|
"description": "Angular components for building beautiful and responsive Apps",
|
|
8
8
|
"icons": [{
|