@sumaris-net/ngx-components 2.0.7 → 2.0.9

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.0.7",
4
+ "version": "2.0.9",
5
5
  "author": "contact@e-is.pro",
6
6
  "license": "AGPL-3.0",
7
7
  "readmeFilename": "README.md",
@@ -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
- patchValue(values: T[]): boolean;
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,23 @@ 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 AppFormArray<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
+ init(createControl: (value?: T) => C, equals: (v1: T, v2: T) => boolean, isEmpty: (value: T) => boolean, options?: FormArrayHelperOptions): this;
243
+ setHelper(helper: FormArrayHelper<T, C>): this;
244
+ /**
245
+ * WIll rebuild the array, using the given values
246
+ * @param values
247
+ * @param options
248
+ */
249
+ setValue(values: any[], options?: {
250
+ onlySelf?: boolean;
251
+ emitEvent?: boolean;
252
+ }): void;
253
+ resize(length: number): void;
254
+ }
237
255
  export declare class AppFormUtils {
238
256
  static copyEntity2Form: typeof copyEntity2Form;
239
257
  static getFormValueFromEntity: typeof getFormValueFromEntity;
@@ -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 patchValueInArray(arrayControl: UntypedFormArray, createControl: (value?: any) => AbstractControl, defaultValues: any[]): boolean;
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;