@sumaris-net/ngx-components 2.0.6 → 2.0.8
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/esm2020/src/app/core/form/form.utils.mjs +29 -10
- package/esm2020/src/app/core/graphql/graphql.service.mjs +12 -17
- package/esm2020/src/app/shared/forms.mjs +4 -4
- package/fesm2015/sumaris-net.ngx-components.mjs +40 -27
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +40 -27
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.utils.d.ts +20 -4
- package/src/app/core/graphql/graphql.service.d.ts +1 -0
- package/src/app/shared/forms.d.ts +3 -1
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractControl, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, ValidatorFn } from '@angular/forms';
|
|
1
|
+
import { AbstractControl, AbstractControlOptions, AsyncValidatorFn, UntypedFormArray, UntypedFormBuilder, UntypedFormGroup, ValidatorFn } from '@angular/forms';
|
|
2
2
|
import { Entity } from '../services/model/entity.model';
|
|
3
3
|
import { filterNumberInput, selectInputContent } from '../../shared/inputs';
|
|
4
4
|
import { WaitForOptions } from '../../shared/observables';
|
|
@@ -180,14 +180,12 @@ export declare class AppFormProvider<F extends IAppForm = IAppForm> implements I
|
|
|
180
180
|
export interface FormArrayHelperOptions {
|
|
181
181
|
allowEmptyArray: boolean;
|
|
182
182
|
validators?: ValidatorFn[];
|
|
183
|
-
helperProperty?: boolean;
|
|
184
183
|
}
|
|
185
184
|
export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl = AbstractControl> {
|
|
186
185
|
private readonly _formArray;
|
|
187
186
|
private createControl;
|
|
188
187
|
private equals;
|
|
189
188
|
private isEmpty;
|
|
190
|
-
static FORMA_HELPER_PROPERTY: string;
|
|
191
189
|
static getOrCreateArray(formBuilder: UntypedFormBuilder, form: UntypedFormGroup, arrayName: string): UntypedFormArray;
|
|
192
190
|
static hasHelper(formArray: UntypedFormArray): formArray is UntypedFormArray & {
|
|
193
191
|
_helper: FormArrayHelper<any>;
|
|
@@ -222,7 +220,10 @@ export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl
|
|
|
222
220
|
* @param opts
|
|
223
221
|
* @return true if form arry has been changed
|
|
224
222
|
*/
|
|
225
|
-
|
|
223
|
+
setValue(values: T[], options?: {
|
|
224
|
+
onlySelf?: boolean;
|
|
225
|
+
emitEvent?: boolean;
|
|
226
|
+
}): boolean;
|
|
226
227
|
disable(opts?: {
|
|
227
228
|
onlySelf?: boolean;
|
|
228
229
|
emitEvent?: boolean;
|
|
@@ -234,6 +235,21 @@ export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl
|
|
|
234
235
|
forEach(ite: (control: C) => void): void;
|
|
235
236
|
protected setAllowEmptyArray(value: boolean): void;
|
|
236
237
|
}
|
|
238
|
+
export declare class FormArrayWithHelper<T extends Entity<T>, C extends AbstractControl> extends UntypedFormArray {
|
|
239
|
+
static HELPER_PROPERTY: string;
|
|
240
|
+
_helper: FormArrayHelper;
|
|
241
|
+
constructor(controls: AbstractControl[], validatorOrOpts?: ValidatorFn | ValidatorFn[] | AbstractControlOptions | null, asyncValidator?: AsyncValidatorFn | AsyncValidatorFn[] | null);
|
|
242
|
+
addHelper(createControl: (value?: T) => C, equals: (v1: T, v2: T) => boolean, isEmpty: (value: T) => boolean, options?: FormArrayHelperOptions): FormArrayWithHelper<T, C>;
|
|
243
|
+
/**
|
|
244
|
+
* WIll rebuild the array, using the given values
|
|
245
|
+
* @param values
|
|
246
|
+
* @param options
|
|
247
|
+
*/
|
|
248
|
+
setValue(values: any[], options?: {
|
|
249
|
+
onlySelf?: boolean;
|
|
250
|
+
emitEvent?: boolean;
|
|
251
|
+
}): void;
|
|
252
|
+
}
|
|
237
253
|
export declare class AppFormUtils {
|
|
238
254
|
static copyEntity2Form: typeof copyEntity2Form;
|
|
239
255
|
static getFormValueFromEntity: typeof getFormValueFromEntity;
|
|
@@ -57,6 +57,7 @@ export declare class GraphqlService extends StartableService<ApolloClient<any>>
|
|
|
57
57
|
private readonly _defaultFetchPolicy;
|
|
58
58
|
private onNetworkError;
|
|
59
59
|
private customErrors;
|
|
60
|
+
private onResetAuth;
|
|
60
61
|
get client(): ApolloClient<any>;
|
|
61
62
|
get cache(): ApolloCache<any>;
|
|
62
63
|
get defaultFetchPolicy(): WatchQueryFetchPolicy;
|
|
@@ -45,7 +45,9 @@ export declare function pushValueInArray(arrayControl: UntypedFormArray, createC
|
|
|
45
45
|
* @param createControl
|
|
46
46
|
* @param values
|
|
47
47
|
*/
|
|
48
|
-
export declare function
|
|
48
|
+
export declare function setValueInArray(arrayControl: UntypedFormArray, createControl: (value?: any) => AbstractControl, defaultValues: any[], options?: {
|
|
49
|
+
emitEvent?: boolean;
|
|
50
|
+
}): boolean;
|
|
49
51
|
export declare function resizeArray(arrayControl: UntypedFormArray, createControl: () => AbstractControl, length: number): boolean;
|
|
50
52
|
export declare function removeValueInArray(arrayControl: UntypedFormArray, isEmpty: (value: any) => boolean, index: number): boolean;
|
|
51
53
|
export declare function clearValueInArray(arrayControl: UntypedFormArray, isEmpty: (value: any) => boolean, index: number): boolean;
|