@sumaris-net/ngx-components 2.1.4-rc3 → 2.1.4

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sumaris-net/ngx-components",
3
3
  "description": "SUMARiS Angular components",
4
- "version": "2.1.4-rc3",
4
+ "version": "2.1.4",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -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, pushValueInArray, removeValueInArray, resizeArray, updateValueAndValidity, waitIdle, waitWhilePending } from '../../shared/forms';
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
- * Patch a FormArray, using default values
213
- * @param values default values to apply.
214
- * @param opts
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
- }): boolean;
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,16 @@ 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;
267
+ disable(opts?: {
268
+ onlySelf?: boolean;
269
+ emitEvent?: boolean;
270
+ }): void;
257
271
  enable(opts?: {
258
272
  onlySelf?: boolean;
259
273
  emitEvent?: boolean;
260
274
  }): void;
261
275
  forEach(ite: (control: C) => void): void;
262
- resize(length: number): boolean;
263
276
  /**
264
277
  * @param value
265
278
  * @param options
@@ -267,7 +280,7 @@ export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl
267
280
  */
268
281
  add(value?: T, options?: {
269
282
  emitEvent: boolean;
270
- }): boolean;
283
+ }): void;
271
284
  removeAt(index: number, options?: {
272
285
  emitEvent: boolean;
273
286
  }): void;
@@ -276,10 +289,6 @@ export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl
276
289
  }): void;
277
290
  isLast(index: number): boolean;
278
291
  removeAllEmpty(): void;
279
- disable(opts?: {
280
- onlySelf?: boolean;
281
- emitEvent?: boolean;
282
- }): void;
283
292
  protected setAllowEmptyArray(value: boolean): void;
284
293
  }
285
294
  export declare class AppFormUtils {
@@ -306,7 +315,7 @@ export declare class AppFormUtils {
306
315
  static updateValueAndValidity: typeof updateValueAndValidity;
307
316
  static getFormErrors: typeof getFormErrors;
308
317
  static isForm(object: any): object is IAppForm;
309
- static pushValueInArray: typeof pushValueInArray;
318
+ static addValueInArray: typeof addValueInArray;
310
319
  static removeValueInArray: typeof removeValueInArray;
311
320
  static resizeArray: typeof resizeArray;
312
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 pushValueInArray(arrayControl: UntypedFormArray, createControl: (value?: any) => AbstractControl, equals: (v1: any, v2: any) => boolean, isEmpty: (value: any) => boolean, value: any, options?: {
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 arrayControl
44
+ * @param formArray
45
45
  * @param createControl
46
46
  * @param values
47
47
  */
48
- export declare function setValueInArray(arrayControl: UntypedFormArray, createControl: (value?: any) => AbstractControl, defaultValues: any[], options?: {
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;