@sumaris-net/ngx-components 1.23.37 → 1.23.40

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": "1.23.37",
4
+ "version": "1.23.40",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -2,7 +2,7 @@ import { AbstractControl, FormArray, FormBuilder, FormGroup, ValidatorFn } from
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 { addValueInArray, clearValueInArray, copyEntity2Form, disableControls, getControlFromPath, getFormErrors, getFormValueFromEntity, logFormErrors, markAllAsTouched, markAsUntouched, removeValueInArray, resizeArray, updateValueAndValidity, waitIdle, waitWhilePending } from '../../shared/forms';
5
+ import { pushValueInArray, 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;
@@ -180,22 +180,35 @@ 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;
183
184
  }
184
185
  export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl = AbstractControl> {
185
186
  private readonly _formArray;
186
187
  private createControl;
187
188
  private equals;
188
189
  private isEmpty;
190
+ static FORMA_HELPER_PROPERTY: string;
189
191
  static getOrCreateArray(formBuilder: FormBuilder, form: FormGroup, arrayName: string): FormArray;
192
+ static hasHelper(formArray: FormArray): formArray is FormArray & {
193
+ _helper: FormArrayHelper<any>;
194
+ };
190
195
  private _allowEmptyArray;
191
196
  private readonly _validators;
192
197
  get allowEmptyArray(): boolean;
193
198
  set allowEmptyArray(value: boolean);
194
199
  get formArray(): FormArray;
195
200
  constructor(_formArray: FormArray, createControl: (value?: T) => C, equals: (v1: T, v2: T) => boolean, isEmpty: (value: T) => boolean, options?: FormArrayHelperOptions);
201
+ /**
202
+ * @param value
203
+ * @param options
204
+ * @deprecated Use push() instead
205
+ */
196
206
  add(value?: T, options?: {
197
207
  emitEvent: boolean;
198
208
  }): boolean;
209
+ push(value?: T, options?: {
210
+ emitEvent: boolean;
211
+ }): boolean;
199
212
  removeAt(index: number): boolean;
200
213
  resize(length: number): boolean;
201
214
  clearAt(index: number): boolean;
@@ -204,21 +217,12 @@ export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl
204
217
  size(): number;
205
218
  at(index: number): C;
206
219
  /**
207
- * Resize the FormArray, then set values
208
- * @param values
220
+ * Patch a FormArray, using default values
221
+ * @param values default values to apply.
209
222
  * @param opts
223
+ * @return true if form arry has been changed
210
224
  */
211
- setValue(values: T[], opts?: {
212
- emitEvent?: boolean;
213
- }): void;
214
- /**
215
- * Resize the FormArray, then patch values
216
- * @param data
217
- * @param opts
218
- */
219
- patchValue(data: T[], opts?: {
220
- emitEvent?: boolean;
221
- }): void;
225
+ patchValue(values: T[]): boolean;
222
226
  disable(opts?: {
223
227
  onlySelf?: boolean;
224
228
  emitEvent?: boolean;
@@ -254,7 +258,7 @@ export declare class AppFormUtils {
254
258
  static updateValueAndValidity: typeof updateValueAndValidity;
255
259
  static getFormErrors: typeof getFormErrors;
256
260
  static isForm(object: any): object is IAppForm;
257
- static addValueInArray: typeof addValueInArray;
261
+ static addValueInArray: typeof pushValueInArray;
258
262
  static removeValueInArray: typeof removeValueInArray;
259
263
  static resizeArray: typeof resizeArray;
260
264
  static clearValueInArray: typeof clearValueInArray;
@@ -36,9 +36,16 @@ export declare function disableControls(form: FormGroup, paths: string[], opts?:
36
36
  onlySelf?: boolean;
37
37
  emitEvent?: boolean;
38
38
  }): void;
39
- export declare function addValueInArray(arrayControl: FormArray, createControl: (value?: any) => AbstractControl, equals: (v1: any, v2: any) => boolean, isEmpty: (value: any) => boolean, value: any, options?: {
39
+ export declare function pushValueInArray(arrayControl: FormArray, 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
+ /**
43
+ * Patch an array using given default values. Each default value will be pass to the 'createControl()' function
44
+ * @param arrayControl
45
+ * @param createControl
46
+ * @param values
47
+ */
48
+ export declare function patchValueInArray(arrayControl: FormArray, createControl: (value?: any) => AbstractControl, defaultValues: any[]): boolean;
42
49
  export declare function resizeArray(arrayControl: FormArray, createControl: () => AbstractControl, length: number): boolean;
43
50
  export declare function removeValueInArray(arrayControl: FormArray, isEmpty: (value: any) => boolean, index: number): boolean;
44
51
  export declare function clearValueInArray(arrayControl: FormArray, isEmpty: (value: any) => boolean, index: number): boolean;