@sumaris-net/ngx-components 2.0.9 → 2.1.2
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/doc/changelog.md +9 -6
- package/esm2020/src/app/core/form/form.utils.mjs +74 -20
- package/fesm2015/sumaris-net.ngx-components.mjs +74 -19
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +73 -19
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.utils.d.ts +38 -10
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractControl, AbstractControlOptions,
|
|
1
|
+
import { AbstractControl, AbstractControlOptions, 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';
|
|
@@ -187,9 +187,6 @@ export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl
|
|
|
187
187
|
private equals;
|
|
188
188
|
private isEmpty;
|
|
189
189
|
static getOrCreateArray(formBuilder: UntypedFormBuilder, form: UntypedFormGroup, arrayName: string): UntypedFormArray;
|
|
190
|
-
static hasHelper(formArray: UntypedFormArray): formArray is UntypedFormArray & {
|
|
191
|
-
_helper: FormArrayHelper<any>;
|
|
192
|
-
};
|
|
193
190
|
private _allowEmptyArray;
|
|
194
191
|
private readonly _validators;
|
|
195
192
|
get allowEmptyArray(): boolean;
|
|
@@ -235,12 +232,18 @@ export declare class FormArrayHelper<T = Entity<any>, C extends AbstractControl
|
|
|
235
232
|
forEach(ite: (control: C) => void): void;
|
|
236
233
|
protected setAllowEmptyArray(value: boolean): void;
|
|
237
234
|
}
|
|
235
|
+
export interface AppFormArrayOptions extends AbstractControlOptions {
|
|
236
|
+
allowEmptyArray: boolean;
|
|
237
|
+
}
|
|
238
238
|
export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl> extends UntypedFormArray {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
239
|
+
private createControl;
|
|
240
|
+
private equals;
|
|
241
|
+
private isEmpty;
|
|
242
|
+
private options?;
|
|
243
|
+
private _allowEmptyArray;
|
|
244
|
+
get allowEmptyArray(): boolean;
|
|
245
|
+
set allowEmptyArray(value: boolean);
|
|
246
|
+
constructor(createControl: (value?: T) => C, equals: (v1: T, v2: T) => boolean, isEmpty: (value: T) => boolean, options?: AppFormArrayOptions | null);
|
|
244
247
|
/**
|
|
245
248
|
* WIll rebuild the array, using the given values
|
|
246
249
|
* @param values
|
|
@@ -250,7 +253,32 @@ export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl
|
|
|
250
253
|
onlySelf?: boolean;
|
|
251
254
|
emitEvent?: boolean;
|
|
252
255
|
}): void;
|
|
253
|
-
|
|
256
|
+
enable(opts?: {
|
|
257
|
+
onlySelf?: boolean;
|
|
258
|
+
emitEvent?: boolean;
|
|
259
|
+
}): void;
|
|
260
|
+
forEach(ite: (control: C) => void): void;
|
|
261
|
+
resize(length: number): boolean;
|
|
262
|
+
/**
|
|
263
|
+
* @param value
|
|
264
|
+
* @param options
|
|
265
|
+
* @deprecated Use push() instead
|
|
266
|
+
*/
|
|
267
|
+
add(value?: T, options?: {
|
|
268
|
+
emitEvent: boolean;
|
|
269
|
+
}): boolean;
|
|
270
|
+
push(value?: T, options?: {
|
|
271
|
+
emitEvent: boolean;
|
|
272
|
+
}): boolean;
|
|
273
|
+
removeAt(index: number): boolean;
|
|
274
|
+
clearAt(index: number): boolean;
|
|
275
|
+
isLast(index: number): boolean;
|
|
276
|
+
removeAllEmpty(): void;
|
|
277
|
+
disable(opts?: {
|
|
278
|
+
onlySelf?: boolean;
|
|
279
|
+
emitEvent?: boolean;
|
|
280
|
+
}): void;
|
|
281
|
+
protected setAllowEmptyArray(value: boolean): void;
|
|
254
282
|
}
|
|
255
283
|
export declare class AppFormUtils {
|
|
256
284
|
static copyEntity2Form: typeof copyEntity2Form;
|