@sumaris-net/ngx-components 18.12.6 → 18.12.7
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 +4 -0
- package/esm2022/src/app/core/form/form.utils.mjs +31 -4
- package/esm2022/src/app/shared/forms.mjs +76 -13
- package/esm2022/src/app/shared/validator/form-error-adapter.class.mjs +3 -2
- package/fesm2022/sumaris-net.ngx-components.mjs +106 -15
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/form.utils.d.ts +30 -3
- package/src/app/core/install/install-upgrade-card.component.d.ts +1 -1
- package/src/app/shared/forms.d.ts +28 -1
- package/src/assets/manifest.json +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractControl } from '@angular/forms';
|
|
2
2
|
import { filterNumberInput, selectInputContent, selectInputContentFromEvent } from '../../shared/inputs';
|
|
3
3
|
import { WaitForOptions } from '../../shared/observables';
|
|
4
|
-
import { addValueInArray, clearValueInArray, copyEntity2Form, disableAndClearControl, disableAndClearControls, disableControl, disableControls, enableControl, enableControls, filterFormErrors, filterFormErrorsByPath, filterFormErrorsByPrefix, getControlFromPath, getFormErrors, getFormValueFromEntity, logFormErrors, markAllAsTouched, markAsUntouched, removeValueInArray, resizeArray, setControlEnabled, setControlsEnabled, updateValueAndValidity, waitIdle, waitWhilePending } from '../../shared/forms';
|
|
4
|
+
import { addValueInArray, clearValueInArray, copyEntity2Form, disableAndClearControl, disableAndClearControls, disableControl, disableControls, enableControl, enableControls, filterFormErrors, filterFormErrorsByPath, filterFormErrorsByPrefix, getControlFromPath, getFormErrors, getFormValueFromEntity, logFormErrors, markAllAsTouched, markAsUntouched, removeValueInArray, resizeArray, setControlEnabled, setControlsEnabled, setFormErrors, updateValueAndValidity, waitIdle, waitWhilePending } from '../../shared/forms';
|
|
5
5
|
export declare type IAppFormGetter = () => IAppForm;
|
|
6
6
|
export declare interface OnReady {
|
|
7
7
|
ngOnReady(): any;
|
|
@@ -207,7 +207,15 @@ export declare class AppFormProvider<F extends IAppForm = IAppForm> implements I
|
|
|
207
207
|
export declare class AppFormUtils {
|
|
208
208
|
static copyEntity2Form: typeof copyEntity2Form;
|
|
209
209
|
static getFormValueFromEntity: typeof getFormValueFromEntity;
|
|
210
|
-
|
|
210
|
+
/**
|
|
211
|
+
* Retrieves a control from the provided form/control structure using a dot-separated path.
|
|
212
|
+
*
|
|
213
|
+
* @param {AbstractControl} form - The root form group, form array, or control to start searching from.
|
|
214
|
+
* @param {string} path - The dot-separated path specifying the control. For example, 'groupName.controlName' or 'arrayName.0.controlName'.
|
|
215
|
+
* @param {boolean} [strict=true] - If true, throws an error if the full path cannot be resolved; if false, returns the last valid control encountered.
|
|
216
|
+
* @return {AbstractControl} - The control at the specified path or the closest valid control if strict mode is disabled.
|
|
217
|
+
* @throws {Error} - Throws an error if the path cannot be resolved and strict mode is enabled.
|
|
218
|
+
*/
|
|
211
219
|
static getControlFromPath: typeof getControlFromPath;
|
|
212
220
|
static filterNumberInput: typeof filterNumberInput;
|
|
213
221
|
static enableControls: typeof enableControls;
|
|
@@ -234,7 +242,6 @@ export declare class AppFormUtils {
|
|
|
234
242
|
static waitWhilePending: typeof waitWhilePending;
|
|
235
243
|
static waitIdle: typeof waitIdle;
|
|
236
244
|
static updateValueAndValidity: typeof updateValueAndValidity;
|
|
237
|
-
static getFormErrors: typeof getFormErrors;
|
|
238
245
|
static isForm(object: any): object is IAppForm;
|
|
239
246
|
static canSave(object: any): object is IAppForm & CanSave;
|
|
240
247
|
static addValueInArray: typeof addValueInArray;
|
|
@@ -245,9 +252,29 @@ export declare class AppFormUtils {
|
|
|
245
252
|
static isControlHasInput: typeof isControlHasInput;
|
|
246
253
|
static setCalculatedValue: typeof setCalculatedValue;
|
|
247
254
|
static resetCalculatedValue: typeof resetCalculatedValue;
|
|
255
|
+
static logFormErrors: typeof logFormErrors;
|
|
248
256
|
static filterErrorsByPrefix: typeof filterFormErrorsByPrefix;
|
|
249
257
|
static filterErrorsByPath: typeof filterFormErrorsByPath;
|
|
250
258
|
static filterErrors: typeof filterFormErrors;
|
|
259
|
+
/**
|
|
260
|
+
* Retrieves all validation errors from a given form control, including its child controls if it is a form group or array.
|
|
261
|
+
*
|
|
262
|
+
* @param {AbstractControl} control - The form control to retrieve errors from. This can be a form group, a form array, or a simple form control.
|
|
263
|
+
* @param {Object} [opts] - Optional configurations for error retrieval.
|
|
264
|
+
* @param {string} [opts.controlName] - The name or path of the control being processed, used for structuring error keys in the result.
|
|
265
|
+
* @param {FormErrors} [opts.result] - The object to which errors will be added, allowing for aggregation and persistence between calls.
|
|
266
|
+
* @param {boolean} [opts.recursive=true] - Whether to recursively collect errors from child controls within a form group or array. Defaults to true.
|
|
267
|
+
* @return {FormErrors} The collected errors as a key-value object where keys represent control names or paths and values represent their respective errors. Returns `undefined` if the provided control is valid and has no errors.
|
|
268
|
+
*/
|
|
269
|
+
static getFormErrors: typeof getFormErrors;
|
|
270
|
+
/**
|
|
271
|
+
* Sets form errors on an AbstractControl, including nested controls within form groups or arrays.
|
|
272
|
+
*
|
|
273
|
+
* @param {AbstractControl} control - The form control, form group, or form array to apply the errors to.
|
|
274
|
+
* @param {FormErrors} errors - An object representing the errors to be set on the control or its children.
|
|
275
|
+
* @return {void} Does not return a value.
|
|
276
|
+
*/
|
|
277
|
+
static setFormErrors: typeof setFormErrors;
|
|
251
278
|
}
|
|
252
279
|
export declare function isControlHasInput(controls: {
|
|
253
280
|
[key: string]: AbstractControl;
|
|
@@ -46,7 +46,7 @@ export declare class AppInstallUpgradeCard implements OnInit, OnDestroy {
|
|
|
46
46
|
download(event: Event, link: InstallAppLink): Promise<void>;
|
|
47
47
|
openFile(event: Event, link: InstallAppLink): Promise<void>;
|
|
48
48
|
tryOnline(): Promise<void>;
|
|
49
|
-
getPlatformName(platform: 'android' | 'ios' | 'electron'): "" | "
|
|
49
|
+
getPlatformName(platform: 'android' | 'ios' | 'electron'): "" | "Android" | "iOS" | "desktop";
|
|
50
50
|
asLink(value: any): InstallAppLink;
|
|
51
51
|
private checkNeedInstallOrUpdate;
|
|
52
52
|
private getCompatibleInstallLinks;
|
|
@@ -27,12 +27,31 @@ export declare function getFormValueFromEntity(entity: any | undefined, form: Un
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function adaptValueToControl(source: any | undefined, control: AbstractControl, path?: string): any;
|
|
29
29
|
export declare function logFormErrors(control: AbstractControl, logPrefix?: string, path?: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves all validation errors from a given form control, including its child controls if it is a form group or array.
|
|
32
|
+
*
|
|
33
|
+
* @param {AbstractControl} control - The form control to retrieve errors from. This can be a form group, a form array, or a simple form control.
|
|
34
|
+
* @param {Object} [opts] - Optional configurations for error retrieval.
|
|
35
|
+
* @param {string} [opts.controlName] - The name or path of the control being processed, used for structuring error keys in the result.
|
|
36
|
+
* @param {FormErrors} [opts.result] - The object to which errors will be added, allowing for aggregation and persistence between calls.
|
|
37
|
+
* @param {boolean} [opts.recursive=true] - Whether to recursively collect errors from child controls within a form group or array. Defaults to true.
|
|
38
|
+
* @return {FormErrors} The collected errors as a key-value object where keys represent control names or paths and values represent their respective errors. Returns `undefined` if the provided control is valid and has no errors.
|
|
39
|
+
*/
|
|
30
40
|
export declare function getFormErrors(control: AbstractControl, opts?: {
|
|
31
41
|
controlName?: string;
|
|
32
42
|
result?: FormErrors;
|
|
33
43
|
recursive?: boolean;
|
|
34
44
|
}): FormErrors;
|
|
35
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves a control from the provided form/control structure using a dot-separated path.
|
|
47
|
+
*
|
|
48
|
+
* @param {AbstractControl} form - The root form group, form array, or control to start searching from.
|
|
49
|
+
* @param {string} path - The dot-separated path specifying the control. For example, 'groupName.controlName' or 'arrayName.0.controlName'.
|
|
50
|
+
* @param {boolean} [strict=true] - If true, throws an error if the full path cannot be resolved; if false, returns the last valid control encountered.
|
|
51
|
+
* @return {AbstractControl} - The control at the specified path or the closest valid control if strict mode is disabled.
|
|
52
|
+
* @throws {Error} - Throws an error if the path cannot be resolved and strict mode is enabled.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getControlFromPath(form: AbstractControl, path: string, strict?: boolean): AbstractControl;
|
|
36
55
|
export declare function disableControls(form: UntypedFormGroup, paths: string[], opts?: {
|
|
37
56
|
onlySelf?: boolean;
|
|
38
57
|
emitEvent?: boolean;
|
|
@@ -53,6 +72,14 @@ export declare function setControlsEnabled(form: UntypedFormGroup, enabled: bool
|
|
|
53
72
|
emitEvent?: boolean;
|
|
54
73
|
required?: boolean;
|
|
55
74
|
}): void;
|
|
75
|
+
/**
|
|
76
|
+
* Sets form errors on an AbstractControl, including nested controls within form groups or arrays.
|
|
77
|
+
*
|
|
78
|
+
* @param {AbstractControl} control - The form control, form group, or form array to apply the errors to.
|
|
79
|
+
* @param {FormErrors} errors - An object representing the errors to be set on the control or its children.
|
|
80
|
+
* @return {void} Does not return a value.
|
|
81
|
+
*/
|
|
82
|
+
export declare function setFormErrors(control: AbstractControl, errors: FormErrors): void;
|
|
56
83
|
export declare function enableControl(control: AbstractControl, opts?: {
|
|
57
84
|
onlySelf?: boolean;
|
|
58
85
|
emitEvent?: boolean;
|
package/src/assets/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ngx-sumaris-components",
|
|
3
3
|
"short_name": "ngx-sumaris-components",
|
|
4
4
|
"manifest_version": 1,
|
|
5
|
-
"version": "18.12.
|
|
5
|
+
"version": "18.12.7",
|
|
6
6
|
"default_locale": "fr",
|
|
7
7
|
"description": "Angular components for building beautiful and responsive Apps",
|
|
8
8
|
"icons": [{
|