@sumaris-net/ngx-components 2.1.4-rc2 → 2.1.4-rc4
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 +54 -26
- package/esm2020/src/app/shared/forms.mjs +7 -7
- package/fesm2015/sumaris-net.ngx-components.mjs +60 -30
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +58 -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 +23 -13
- package/src/app/shared/forms.d.ts +3 -3
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 { clearValueInArray, copyEntity2Form, disableControls, getControlFromPath, getFormErrors, getFormValueFromEntity, logFormErrors, markAllAsTouched, markAsUntouched, addValueInArray, 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;
|
|
@@ -209,15 +209,23 @@ export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl
|
|
|
209
209
|
size(): number;
|
|
210
210
|
at(index: number): C;
|
|
211
211
|
/**
|
|
212
|
-
*
|
|
213
|
-
* @param values
|
|
214
|
-
* @param
|
|
215
|
-
* @return true if form arry has been changed
|
|
212
|
+
* Resize the FormArray, then set values
|
|
213
|
+
* @param values
|
|
214
|
+
* @param options
|
|
216
215
|
*/
|
|
217
216
|
setValue(values: T[], options?: {
|
|
218
217
|
onlySelf?: boolean;
|
|
219
218
|
emitEvent?: boolean;
|
|
220
|
-
}):
|
|
219
|
+
}): void;
|
|
220
|
+
/**
|
|
221
|
+
* Resize the FormArray, then patch values
|
|
222
|
+
* @param values
|
|
223
|
+
* @param options
|
|
224
|
+
*/
|
|
225
|
+
patchValue(values: T[], options?: {
|
|
226
|
+
onlySelf?: boolean;
|
|
227
|
+
emitEvent?: boolean;
|
|
228
|
+
}): void;
|
|
221
229
|
disable(opts?: {
|
|
222
230
|
onlySelf?: boolean;
|
|
223
231
|
emitEvent?: boolean;
|
|
@@ -231,6 +239,7 @@ export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl
|
|
|
231
239
|
}
|
|
232
240
|
export interface AppFormArrayOptions extends AbstractControlOptions {
|
|
233
241
|
allowEmptyArray: boolean;
|
|
242
|
+
resizeStrategy: 'reuse' | 'recreate';
|
|
234
243
|
}
|
|
235
244
|
export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl> extends UntypedFormArray {
|
|
236
245
|
private createControl;
|
|
@@ -254,12 +263,12 @@ export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl
|
|
|
254
263
|
onlySelf?: boolean;
|
|
255
264
|
emitEvent?: boolean;
|
|
256
265
|
}): void;
|
|
266
|
+
resize(length: number): void;
|
|
257
267
|
enable(opts?: {
|
|
258
268
|
onlySelf?: boolean;
|
|
259
269
|
emitEvent?: boolean;
|
|
260
270
|
}): void;
|
|
261
271
|
forEach(ite: (control: C) => void): void;
|
|
262
|
-
resize(length: number): boolean;
|
|
263
272
|
/**
|
|
264
273
|
* @param value
|
|
265
274
|
* @param options
|
|
@@ -267,12 +276,13 @@ export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl
|
|
|
267
276
|
*/
|
|
268
277
|
add(value?: T, options?: {
|
|
269
278
|
emitEvent: boolean;
|
|
270
|
-
}):
|
|
271
|
-
|
|
279
|
+
}): void;
|
|
280
|
+
removeAt(index: number, options?: {
|
|
272
281
|
emitEvent: boolean;
|
|
273
|
-
}):
|
|
274
|
-
|
|
275
|
-
|
|
282
|
+
}): void;
|
|
283
|
+
clearAt(index: number, options?: {
|
|
284
|
+
emitEvent: boolean;
|
|
285
|
+
}): void;
|
|
276
286
|
isLast(index: number): boolean;
|
|
277
287
|
removeAllEmpty(): void;
|
|
278
288
|
disable(opts?: {
|
|
@@ -305,7 +315,7 @@ export declare class AppFormUtils {
|
|
|
305
315
|
static updateValueAndValidity: typeof updateValueAndValidity;
|
|
306
316
|
static getFormErrors: typeof getFormErrors;
|
|
307
317
|
static isForm(object: any): object is IAppForm;
|
|
308
|
-
static
|
|
318
|
+
static addValueInArray: typeof addValueInArray;
|
|
309
319
|
static removeValueInArray: typeof removeValueInArray;
|
|
310
320
|
static resizeArray: typeof resizeArray;
|
|
311
321
|
static clearValueInArray: typeof clearValueInArray;
|
|
@@ -36,16 +36,16 @@ export declare function disableControls(form: UntypedFormGroup, paths: string[],
|
|
|
36
36
|
onlySelf?: boolean;
|
|
37
37
|
emitEvent?: boolean;
|
|
38
38
|
}): void;
|
|
39
|
-
export declare function
|
|
39
|
+
export declare function addValueInArray(arrayControl: UntypedFormArray, createControl: (value?: any) => AbstractControl, equals: (v1: any, v2: any) => boolean, isEmpty: (value: any) => boolean, value: any, options?: {
|
|
40
40
|
emitEvent: boolean;
|
|
41
41
|
}): boolean;
|
|
42
42
|
/**
|
|
43
43
|
* Set an array using given default values. Each default value will be pass to the 'createControl()' function
|
|
44
|
-
* @param
|
|
44
|
+
* @param formArray
|
|
45
45
|
* @param createControl
|
|
46
46
|
* @param values
|
|
47
47
|
*/
|
|
48
|
-
export declare function
|
|
48
|
+
export declare function initArrayControlsFromValues(formArray: UntypedFormArray, createControl: (value?: any) => AbstractControl, defaultValues: any[], options?: {
|
|
49
49
|
emitEvent?: boolean;
|
|
50
50
|
}): boolean;
|
|
51
51
|
export declare function resizeArray(arrayControl: UntypedFormArray, createControl: () => AbstractControl, length: number): boolean;
|