@sumaris-net/ngx-components 2.0.8 → 2.1.1
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 +76 -14
- package/fesm2015/sumaris-net.ngx-components.mjs +76 -14
- package/fesm2015/sumaris-net.ngx-components.mjs.map +1 -1
- package/fesm2020/sumaris-net.ngx-components.mjs +76 -14
- package/fesm2020/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.utils.d.ts +39 -9
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,11 +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
|
}
|
|
238
|
-
export
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
235
|
+
export interface AppFormArrayOptions extends AbstractControlOptions {
|
|
236
|
+
allowEmptyArray: boolean;
|
|
237
|
+
}
|
|
238
|
+
export declare class AppFormArray<T extends Entity<T>, C extends AbstractControl> extends UntypedFormArray {
|
|
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);
|
|
243
247
|
/**
|
|
244
248
|
* WIll rebuild the array, using the given values
|
|
245
249
|
* @param values
|
|
@@ -249,6 +253,32 @@ export declare class FormArrayWithHelper<T extends Entity<T>, C extends Abstract
|
|
|
249
253
|
onlySelf?: boolean;
|
|
250
254
|
emitEvent?: boolean;
|
|
251
255
|
}): void;
|
|
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;
|
|
252
282
|
}
|
|
253
283
|
export declare class AppFormUtils {
|
|
254
284
|
static copyEntity2Form: typeof copyEntity2Form;
|