@sumaris-net/ngx-components 2.2.1-rc8 → 2.2.1
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 +1 -1
- package/esm2020/src/app/core/form/form.utils.mjs +30 -14
- package/esm2020/src/app/core/services/base-entity-service.class.mjs +21 -12
- package/esm2020/src/app/shared/forms.mjs +11 -5
- package/esm2020/src/app/shared/material/chips/material.chips.mjs +5 -4
- package/esm2020/src/app/shared/services/entity-service.class.mjs +1 -1
- package/esm2020/src/app/social/user-event/user-event.service.mjs +6 -3
- package/fesm2015/sumaris-net.ngx-components.mjs +59 -46
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +64 -30
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.utils.d.ts +5 -7
- package/src/app/core/services/base-entity-service.class.d.ts +7 -21
- package/src/app/shared/services/entity-service.class.d.ts +20 -10
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { AbstractControl, AbstractControlOptions, UntypedFormArray, UntypedFormB
|
|
|
2
2
|
import { Entity } from '../services/model/entity.model';
|
|
3
3
|
import { filterNumberInput, selectInputContent } from '../../shared/inputs';
|
|
4
4
|
import { WaitForOptions } from '../../shared/observables';
|
|
5
|
-
import { clearValueInArray, copyEntity2Form, disableControls, getControlFromPath, getFormErrors, getFormValueFromEntity, logFormErrors, markAllAsTouched, markAsUntouched,
|
|
5
|
+
import { addValueInArray, clearValueInArray, copyEntity2Form, disableControls, getControlFromPath, getFormErrors, getFormValueFromEntity, logFormErrors, markAllAsTouched, markAsUntouched, removeValueInArray, resizeArray, updateValueAndValidity, waitIdle, waitWhilePending } from '../../shared/forms';
|
|
6
6
|
export declare type IAppFormGetter = () => IAppForm;
|
|
7
7
|
export declare interface OnReady {
|
|
8
8
|
ngOnReady(): any;
|
|
@@ -239,19 +239,18 @@ export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl
|
|
|
239
239
|
forEach(ite: (control: C) => void): void;
|
|
240
240
|
protected setAllowEmptyArray(value: boolean): void;
|
|
241
241
|
}
|
|
242
|
-
export interface AppFormArrayOptions extends AbstractControlOptions {
|
|
243
|
-
allowEmptyArray
|
|
244
|
-
|
|
242
|
+
export declare interface AppFormArrayOptions extends AbstractControlOptions {
|
|
243
|
+
allowEmptyArray?: boolean;
|
|
244
|
+
allowReuseControls?: boolean;
|
|
245
245
|
}
|
|
246
246
|
export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl> extends UntypedFormArray {
|
|
247
247
|
private createControl;
|
|
248
248
|
private equals;
|
|
249
249
|
private isEmpty;
|
|
250
250
|
private options?;
|
|
251
|
-
private _allowEmptyArray;
|
|
252
251
|
get allowEmptyArray(): boolean;
|
|
253
252
|
set allowEmptyArray(value: boolean);
|
|
254
|
-
constructor(createControl: (value?: T) => C, equals: (v1: T, v2: T) => boolean, isEmpty: (value: T) => boolean, options?: AppFormArrayOptions | null);
|
|
253
|
+
constructor(createControl: (value?: T) => C, equals: (v1: T, v2: T) => boolean, isEmpty: (value: T) => boolean, options?: AppFormArrayOptions | undefined | null);
|
|
255
254
|
/**
|
|
256
255
|
* WIll rebuild the array, using the given values
|
|
257
256
|
* @param values
|
|
@@ -280,7 +279,6 @@ export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl
|
|
|
280
279
|
/**
|
|
281
280
|
* @param value
|
|
282
281
|
* @param options
|
|
283
|
-
* @deprecated Use push() instead
|
|
284
282
|
*/
|
|
285
283
|
add(value?: T, options?: {
|
|
286
284
|
emitEvent: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import {
|
|
2
|
+
import { InternalRefetchQueriesInclude, MutationUpdaterFn } from '@apollo/client/core';
|
|
3
3
|
import { SortDirection } from '@angular/material/sort';
|
|
4
4
|
import { BaseGraphqlService } from './base-graphql-service.class';
|
|
5
|
-
import { EntitiesServiceWatchOptions,
|
|
5
|
+
import { EntitiesServiceLoadOptions, EntitiesServiceWatchOptions, EntityServiceListenChangesOptions, IEntitiesService, IEntityService, LoadResult } from '../../shared/services/entity-service.class';
|
|
6
6
|
import { GraphqlService } from '../graphql/graphql.service';
|
|
7
7
|
import { PlatformService } from './platform.service';
|
|
8
8
|
import { Entity, EntityAsObjectOptions } from './model/entity.model';
|
|
@@ -45,7 +45,7 @@ export interface EntitySaveOptions {
|
|
|
45
45
|
data: any;
|
|
46
46
|
}>;
|
|
47
47
|
}
|
|
48
|
-
export declare abstract class BaseEntityService<T extends Entity<T, ID>, F extends EntityFilter<F, T, ID>, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions, LO extends
|
|
48
|
+
export declare abstract class BaseEntityService<T extends Entity<T, ID>, F extends EntityFilter<F, T, ID>, ID = number, WO extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions, LO extends EntitiesServiceLoadOptions = EntitiesServiceLoadOptions, Q extends BaseEntityGraphqlQueries = BaseEntityGraphqlQueries, M extends BaseEntityGraphqlMutations = BaseEntityGraphqlMutations, S extends BaseEntityGraphqlSubscriptions = BaseEntityGraphqlSubscriptions> extends BaseGraphqlService<T, F, ID> implements IEntitiesService<T, F, WO>, IEntityService<T, ID, LO> {
|
|
49
49
|
protected graphql: GraphqlService;
|
|
50
50
|
protected platform: PlatformService;
|
|
51
51
|
protected dataType: new () => T;
|
|
@@ -61,19 +61,11 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
|
|
|
61
61
|
protected readonly defaultSortDirection: SortDirection;
|
|
62
62
|
protected readonly watchQueriesUpdatePolicy: MutableWatchQueriesUpdatePolicy;
|
|
63
63
|
protected constructor(graphql: GraphqlService, platform: PlatformService, dataType: new () => T, filterType: new () => F, options: BaseEntityServiceOptions<T, ID, Q, M, S>);
|
|
64
|
-
watch(id: number, opts?: WO
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
load(id: ID, opts?: LO & {
|
|
68
|
-
query?: any;
|
|
69
|
-
}): Promise<T>;
|
|
70
|
-
watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: F, opts?: WO & {
|
|
71
|
-
query?: any;
|
|
72
|
-
}): Observable<LoadResult<T>>;
|
|
64
|
+
watch(id: number, opts?: WO): Observable<T>;
|
|
65
|
+
load(id: ID, opts?: LO): Promise<T>;
|
|
66
|
+
watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: F, opts?: WO): Observable<LoadResult<T>>;
|
|
73
67
|
loadAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>, opts?: LO & {
|
|
74
|
-
query?: any;
|
|
75
68
|
debug?: boolean;
|
|
76
|
-
withTotal?: boolean;
|
|
77
69
|
}): Promise<LoadResult<T>>;
|
|
78
70
|
countAll(filter?: Partial<F>, opts?: LO): Promise<number>;
|
|
79
71
|
canUserWrite(data: T, opts?: any): boolean;
|
|
@@ -95,13 +87,7 @@ export declare abstract class BaseEntityService<T extends Entity<T, ID>, F exten
|
|
|
95
87
|
* Delete a referential entity
|
|
96
88
|
*/
|
|
97
89
|
delete(entity: T, opts?: EntitySaveOptions | any): Promise<any>;
|
|
98
|
-
listenChanges(id: ID, opts?:
|
|
99
|
-
query?: any;
|
|
100
|
-
variables?: any;
|
|
101
|
-
interval?: number;
|
|
102
|
-
fetchPolicy?: FetchPolicy;
|
|
103
|
-
toEntity?: boolean;
|
|
104
|
-
}): Observable<T>;
|
|
90
|
+
listenChanges(id: ID, opts?: EntityServiceListenChangesOptions): Observable<T>;
|
|
105
91
|
copyIdAndUpdateDate(source: T, target: T): void;
|
|
106
92
|
fromObject(source: any): T;
|
|
107
93
|
asFilter(source: any): F;
|
|
@@ -28,6 +28,24 @@ export declare interface EntityServiceLoadOptions {
|
|
|
28
28
|
fetchPolicy?: FetchPolicy;
|
|
29
29
|
trash?: boolean;
|
|
30
30
|
toEntity?: boolean;
|
|
31
|
+
query?: any;
|
|
32
|
+
variables?: any;
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}
|
|
35
|
+
export declare interface EntityServiceWatchOptions {
|
|
36
|
+
fetchPolicy?: WatchQueryFetchPolicy;
|
|
37
|
+
trash?: boolean;
|
|
38
|
+
toEntity?: boolean;
|
|
39
|
+
query?: any;
|
|
40
|
+
variables?: any;
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
}
|
|
43
|
+
export declare interface EntityServiceListenChangesOptions {
|
|
44
|
+
interval?: number;
|
|
45
|
+
fetchPolicy?: FetchPolicy;
|
|
46
|
+
toEntity?: boolean;
|
|
47
|
+
query?: any;
|
|
48
|
+
variables?: any;
|
|
31
49
|
[key: string]: any;
|
|
32
50
|
}
|
|
33
51
|
export declare interface IEntityService<T, ID = any, LO = EntityServiceLoadOptions> {
|
|
@@ -37,19 +55,11 @@ export declare interface IEntityService<T, ID = any, LO = EntityServiceLoadOptio
|
|
|
37
55
|
delete(data: T, opts?: any): Promise<any>;
|
|
38
56
|
listenChanges(id: ID, opts?: any): Observable<T | undefined>;
|
|
39
57
|
}
|
|
40
|
-
export declare interface EntitiesServiceLoadOptions {
|
|
41
|
-
fetchPolicy?: FetchPolicy;
|
|
42
|
-
trash?: boolean;
|
|
58
|
+
export declare interface EntitiesServiceLoadOptions extends EntityServiceLoadOptions {
|
|
43
59
|
withTotal?: boolean;
|
|
44
|
-
toEntity?: boolean;
|
|
45
|
-
[key: string]: any;
|
|
46
60
|
}
|
|
47
|
-
export declare interface EntitiesServiceWatchOptions {
|
|
48
|
-
fetchPolicy?: WatchQueryFetchPolicy;
|
|
49
|
-
trash?: boolean;
|
|
61
|
+
export declare interface EntitiesServiceWatchOptions extends EntityServiceWatchOptions {
|
|
50
62
|
withTotal?: boolean;
|
|
51
|
-
toEntity?: boolean;
|
|
52
|
-
[key: string]: any;
|
|
53
63
|
}
|
|
54
64
|
export declare interface IEntitiesService<T, F, O extends EntitiesServiceWatchOptions = EntitiesServiceWatchOptions> {
|
|
55
65
|
watchAll(offset: number, size: number, sortBy?: string, sortDirection?: SortDirection, filter?: Partial<F>, options?: O): Observable<LoadResult<T>>;
|