ui-core-abv 0.7.0 → 0.7.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/fesm2022/ui-core-abv.mjs +413 -109
- package/fesm2022/ui-core-abv.mjs.map +1 -1
- package/lib/components/dynamic-form/form-wrapper/form-wrapper.component.d.ts +22 -2
- package/lib/components/dynamic-form/form.models.d.ts +34 -0
- package/lib/components/excel-table/excel-table.component.d.ts +4 -0
- package/lib/components/inputs/select/select.component.d.ts +3 -0
- package/lib/components/inputs/time-picker/time-picker.component.d.ts +6 -0
- package/lib/components/user-formbuilder/block-editor/field-editor/field-editor.component.d.ts +7 -2
- package/lib/translate/dictionary.en.d.ts +5 -2
- package/lib/translate/dictionary.es.d.ts +5 -2
- package/package.json +1 -1
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
|
|
2
2
|
import { FormGroup } from '@angular/forms';
|
|
3
3
|
import { AppSelectOption } from '../../inputs/select/select.component';
|
|
4
|
-
import { FormField, FormResult, FormSchema, SelectOptionsResolver, SelectOptionsSource, uicFormValuesRecord } from '../form.models';
|
|
4
|
+
import { ComputedFieldResolver, FormField, FormResult, FormSchema, SelectOptionsResolver, SelectOptionsSource, uicFormValuesRecord } from '../form.models';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class UicFormWrapperComponent implements OnInit, OnChanges, OnDestroy {
|
|
7
7
|
private readonly fb;
|
|
8
8
|
private readonly elementRef;
|
|
9
|
+
private readonly titleLineHeightRatio;
|
|
10
|
+
private readonly subtitleLineHeightRatio;
|
|
9
11
|
form: FormGroup;
|
|
10
12
|
effectiveSchema: FormSchema;
|
|
13
|
+
private readonly blockTitleStyles;
|
|
14
|
+
private readonly blockSubtitleStyles;
|
|
11
15
|
schema?: FormSchema;
|
|
12
16
|
fields: FormField[];
|
|
13
17
|
cols: number;
|
|
14
18
|
externalData: Record<string, AppSelectOption[]>;
|
|
15
19
|
selectOptionsResolver?: SelectOptionsResolver;
|
|
20
|
+
computedFieldResolver?: ComputedFieldResolver;
|
|
16
21
|
loading: boolean;
|
|
17
22
|
disabled: boolean;
|
|
18
23
|
showButtons: boolean;
|
|
@@ -31,10 +36,17 @@ export declare class UicFormWrapperComponent implements OnInit, OnChanges, OnDes
|
|
|
31
36
|
private formValueSub;
|
|
32
37
|
private readonly optionSourceSubs;
|
|
33
38
|
private readonly optionSourceDependencyValueByField;
|
|
39
|
+
private readonly computedFieldSubs;
|
|
34
40
|
private hasFocusedCurrentTrigger;
|
|
35
41
|
ngOnInit(): void;
|
|
42
|
+
getBlockTitleStyles(index: number): Record<string, string> | null;
|
|
43
|
+
getBlockSubtitleStyles(index: number): Record<string, string> | null;
|
|
36
44
|
ngOnChanges(changes: SimpleChanges): void;
|
|
37
45
|
ngOnDestroy(): void;
|
|
46
|
+
private initializeTypographyStyles;
|
|
47
|
+
private buildTypographyStyles;
|
|
48
|
+
private toValidFontSize;
|
|
49
|
+
private toValidMargin;
|
|
38
50
|
private buildForm;
|
|
39
51
|
private buildRepeaterGroup;
|
|
40
52
|
private repeaterArrayValidator;
|
|
@@ -66,6 +78,14 @@ export declare class UicFormWrapperComponent implements OnInit, OnChanges, OnDes
|
|
|
66
78
|
private getValueByPath;
|
|
67
79
|
private safeStringify;
|
|
68
80
|
private clearOptionSourceSubscriptions;
|
|
81
|
+
private clearComputedFieldSubs;
|
|
82
|
+
/**
|
|
83
|
+
* Recalcula todos los campos autocalculados (computeFn o computedSource).
|
|
84
|
+
* Se llama en cada valueChanges y al inicializar el formulario.
|
|
85
|
+
* Usa emitEvent:false para evitar bucles infinitos.
|
|
86
|
+
*/
|
|
87
|
+
private resolveComputedFields;
|
|
88
|
+
private toComputedObservable;
|
|
69
89
|
private collectAllFields;
|
|
70
90
|
updateFieldValue(name: string, value: any): void;
|
|
71
91
|
updateFieldConfig(name: string, config: Omit<FormField, 'name' | 'type'>): void;
|
|
@@ -89,5 +109,5 @@ export declare class UicFormWrapperComponent implements OnInit, OnChanges, OnDes
|
|
|
89
109
|
private setNestedValue;
|
|
90
110
|
private syncEffectiveSchema;
|
|
91
111
|
static ɵfac: i0.ɵɵFactoryDeclaration<UicFormWrapperComponent, never>;
|
|
92
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<UicFormWrapperComponent, "ui-form-wrapper", never, { "schema": { "alias": "schema"; "required": false; }; "fields": { "alias": "fields"; "required": false; }; "cols": { "alias": "cols"; "required": false; }; "externalData": { "alias": "externalData"; "required": false; }; "selectOptionsResolver": { "alias": "selectOptionsResolver"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "showButtons": { "alias": "showButtons"; "required": false; }; "fillSelects": { "alias": "fillSelects"; "required": false; }; "initialValues": { "alias": "initialValues"; "required": false; }; "focusFieldName": { "alias": "focusFieldName"; "required": false; }; "focusFieldTrigger": { "alias": "focusFieldTrigger"; "required": false; }; "fileUidResolverFn": { "alias": "fileUidResolverFn"; "required": false; }; }, { "formSubmit": "formSubmit"; "formChange": "formChange"; "optionsSourceError": "optionsSourceError"; }, never, never, true, never>;
|
|
112
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UicFormWrapperComponent, "ui-form-wrapper", never, { "schema": { "alias": "schema"; "required": false; }; "fields": { "alias": "fields"; "required": false; }; "cols": { "alias": "cols"; "required": false; }; "externalData": { "alias": "externalData"; "required": false; }; "selectOptionsResolver": { "alias": "selectOptionsResolver"; "required": false; }; "computedFieldResolver": { "alias": "computedFieldResolver"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "showButtons": { "alias": "showButtons"; "required": false; }; "fillSelects": { "alias": "fillSelects"; "required": false; }; "initialValues": { "alias": "initialValues"; "required": false; }; "focusFieldName": { "alias": "focusFieldName"; "required": false; }; "focusFieldTrigger": { "alias": "focusFieldTrigger"; "required": false; }; "fileUidResolverFn": { "alias": "fileUidResolverFn"; "required": false; }; }, { "formSubmit": "formSubmit"; "formChange": "formChange"; "optionsSourceError": "optionsSourceError"; }, never, never, true, never>;
|
|
93
113
|
}
|
|
@@ -11,11 +11,20 @@ export interface FormStep {
|
|
|
11
11
|
export interface FormSchema {
|
|
12
12
|
cols: number;
|
|
13
13
|
blocks?: FormBlock[];
|
|
14
|
+
titleFontSize?: number;
|
|
15
|
+
subtitleFontSize?: number;
|
|
16
|
+
titleMargin?: number;
|
|
17
|
+
subtitleMargin?: number;
|
|
14
18
|
}
|
|
15
19
|
export interface FormBlock {
|
|
16
20
|
subtitle?: string;
|
|
17
21
|
title?: string;
|
|
22
|
+
message?: string;
|
|
18
23
|
fields: FormField[];
|
|
24
|
+
titleFontSize?: number;
|
|
25
|
+
subtitleFontSize?: number;
|
|
26
|
+
titleMargin?: number;
|
|
27
|
+
subtitleMargin?: number;
|
|
19
28
|
}
|
|
20
29
|
export interface SelectOptionsSource {
|
|
21
30
|
key: string;
|
|
@@ -33,6 +42,21 @@ export interface SelectOptionsContext {
|
|
|
33
42
|
query?: string;
|
|
34
43
|
}
|
|
35
44
|
export type SelectOptionsResolver = (source: SelectOptionsSource, context: SelectOptionsContext) => AppSelectOption[] | unknown[] | Promise<AppSelectOption[] | unknown[]> | Observable<AppSelectOption[] | unknown[]>;
|
|
45
|
+
export interface ComputedFieldSource {
|
|
46
|
+
/** Identificador del cálculo; lo recibe el ComputedFieldResolver del consumidor */
|
|
47
|
+
key: string;
|
|
48
|
+
/** Nombres de los campos del formulario cuyo cambio dispara el recálculo */
|
|
49
|
+
dependsOn: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface ComputedFieldContext {
|
|
52
|
+
field: FormField;
|
|
53
|
+
values: uicFormValuesRecord;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Función provista por el consumidor para resolver campos autocalculados declarativos.
|
|
57
|
+
* Puede retornar el valor directamente, una Promise o un Observable.
|
|
58
|
+
*/
|
|
59
|
+
export type ComputedFieldResolver = (source: ComputedFieldSource, context: ComputedFieldContext) => any | Promise<any> | Observable<any>;
|
|
36
60
|
export interface FormField {
|
|
37
61
|
name: string;
|
|
38
62
|
type: FieldType;
|
|
@@ -83,6 +107,16 @@ export interface FormField {
|
|
|
83
107
|
searchIsEnabledFn?: (item: any) => boolean;
|
|
84
108
|
pattern?: RegExp;
|
|
85
109
|
visibilityRules?: FieldVisibilityRule[] | null;
|
|
110
|
+
/**
|
|
111
|
+
* Opción A (declarativa/serializable): define la clave y dependencias del campo calculado.
|
|
112
|
+
* El wrapper llama a `computedFieldResolver` cuando algún campo de `dependsOn` cambia.
|
|
113
|
+
*/
|
|
114
|
+
computedSource?: ComputedFieldSource;
|
|
115
|
+
/**
|
|
116
|
+
* Opción B (inline): función síncrona que recibe todos los valores del formulario
|
|
117
|
+
* y retorna el valor calculado. No requiere `computedFieldResolver` en el wrapper.
|
|
118
|
+
*/
|
|
119
|
+
computeFn?: (values: uicFormValuesRecord) => any;
|
|
86
120
|
iaValidation?: boolean;
|
|
87
121
|
iaValidationPrompt?: string;
|
|
88
122
|
repeaterFields?: FormField[];
|
|
@@ -16,6 +16,10 @@ export declare class UicExcelTableComponent {
|
|
|
16
16
|
resetData(): void;
|
|
17
17
|
private normalizeHeaderFormat;
|
|
18
18
|
private formatHeader;
|
|
19
|
+
private normalizeImportedCellValue;
|
|
20
|
+
private isDateLikeCellFormat;
|
|
21
|
+
private formatParsedDate;
|
|
22
|
+
private formatDate;
|
|
19
23
|
static ɵfac: i0.ɵɵFactoryDeclaration<UicExcelTableComponent, never>;
|
|
20
24
|
static ɵcmp: i0.ɵɵComponentDeclaration<UicExcelTableComponent, "ui-excel-table", never, { "headerFormat": { "alias": "headerFormat"; "required": false; }; "title": { "alias": "title"; "required": false; }; "visibleRowsStep": { "alias": "visibleRowsStep"; "required": false; }; "record": { "alias": "record"; "required": false; }; }, { "recordChange": "recordChange"; }, never, never, true, never>;
|
|
21
25
|
}
|
|
@@ -61,6 +61,8 @@ export declare class UicSelectComponent extends base {
|
|
|
61
61
|
private setInitialActiveOption;
|
|
62
62
|
private resetActiveOption;
|
|
63
63
|
private moveActiveOption;
|
|
64
|
+
private findFirstEnabledOptionIndex;
|
|
65
|
+
private isKeyboardOptionEnabled;
|
|
64
66
|
private scrollActiveOptionIntoView;
|
|
65
67
|
private normalizeText;
|
|
66
68
|
private escapeHtml;
|
|
@@ -73,5 +75,6 @@ export interface AppSelectOption {
|
|
|
73
75
|
detail?: string;
|
|
74
76
|
icon?: string;
|
|
75
77
|
iconColor?: string;
|
|
78
|
+
disabled?: boolean;
|
|
76
79
|
}
|
|
77
80
|
export {};
|
|
@@ -39,6 +39,7 @@ export declare class UicTimePickerComponent extends base {
|
|
|
39
39
|
selectedHour12: number | null;
|
|
40
40
|
selectedMinute: number | null;
|
|
41
41
|
selectedMeridiem: 'am' | 'pm' | null;
|
|
42
|
+
isOverlayOpen: boolean;
|
|
42
43
|
ngOnInit(): void;
|
|
43
44
|
ngOnChanges(changes: SimpleChanges): void;
|
|
44
45
|
private rebuildMinutes;
|
|
@@ -47,6 +48,11 @@ export declare class UicTimePickerComponent extends base {
|
|
|
47
48
|
private syncSelectionFromValue;
|
|
48
49
|
openOverlay(): void;
|
|
49
50
|
closeOverlay(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Cierra explícitamente el overlay desde el botón confirmar.
|
|
53
|
+
* Comitea la selección actual antes de cerrar.
|
|
54
|
+
*/
|
|
55
|
+
confirmAndClose(): void;
|
|
50
56
|
pickHour(hour: number): void;
|
|
51
57
|
pickMinute(minute: number): void;
|
|
52
58
|
pickMeridiem(meridiem: 'am' | 'pm'): void;
|
package/lib/components/user-formbuilder/block-editor/field-editor/field-editor.component.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare class FieldEditorComponent {
|
|
|
15
15
|
isSubField: import("@angular/core").InputSignal<boolean>;
|
|
16
16
|
options: import("@angular/core").InputSignal<Record<string, AppSelectOption[]>>;
|
|
17
17
|
hiddenSections: import("@angular/core").WritableSignal<string[]>;
|
|
18
|
+
editingRuleIndex: import("@angular/core").WritableSignal<number>;
|
|
19
|
+
isAddingNewRule: import("@angular/core").WritableSignal<boolean>;
|
|
18
20
|
fieldChange: import("@angular/core").OutputEmitterRef<FormField>;
|
|
19
21
|
localField: import("@angular/core").WritableSignal<FormField>;
|
|
20
22
|
requiredFields: FormField[];
|
|
@@ -30,7 +32,11 @@ export declare class FieldEditorComponent {
|
|
|
30
32
|
private scrollPropertiesToTop;
|
|
31
33
|
updateRuleValue(fr: uicFormValuesRecord): void;
|
|
32
34
|
addRule(): void;
|
|
33
|
-
|
|
35
|
+
startEditingRule(index: number): void;
|
|
36
|
+
confirmEditingRule(): void;
|
|
37
|
+
cancelEditingRule(): void;
|
|
38
|
+
removeRule(index: number): void;
|
|
39
|
+
private clearDraftRule;
|
|
34
40
|
updateFieldValues(fr: uicFormValuesRecord): void;
|
|
35
41
|
updateOptions(options: AppSelectOption[]): void;
|
|
36
42
|
private getDependencyFieldLabel;
|
|
@@ -46,7 +52,6 @@ export declare class FieldEditorComponent {
|
|
|
46
52
|
private getDependencyFieldType;
|
|
47
53
|
private getBranchValueFieldType;
|
|
48
54
|
private ruleToBranchValues;
|
|
49
|
-
private clearCurrentVisibilityRule;
|
|
50
55
|
private isValueLessVisibilityOperator;
|
|
51
56
|
static ɵfac: i0.ɵɵFactoryDeclaration<FieldEditorComponent, never>;
|
|
52
57
|
static ɵcmp: i0.ɵɵComponentDeclaration<FieldEditorComponent, "lib-field-editor", never, { "config": { "alias": "config"; "required": true; "isSignal": true; }; "focusRequiredField": { "alias": "focusRequiredField"; "required": false; "isSignal": true; }; "isSubField": { "alias": "isSubField"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "fieldChange": "fieldChange"; }, never, never, true, never>;
|
|
@@ -56,6 +56,7 @@ export declare const DICTIONARY_EN: {
|
|
|
56
56
|
};
|
|
57
57
|
readonly time_picker: {
|
|
58
58
|
readonly placeholder: "hh:mm am/pm";
|
|
59
|
+
readonly confirm: "Confirm";
|
|
59
60
|
};
|
|
60
61
|
readonly excel_table: {
|
|
61
62
|
readonly load_file: "Upload excel";
|
|
@@ -213,7 +214,7 @@ export declare const DICTIONARY_EN: {
|
|
|
213
214
|
readonly monthMode: "Month mode";
|
|
214
215
|
readonly monthMode_tip: "Select a month date";
|
|
215
216
|
readonly monthDay: "Month day";
|
|
216
|
-
readonly monthDay_tip: "
|
|
217
|
+
readonly monthDay_tip: "To save in DB";
|
|
217
218
|
readonly minDate: "Minimum date";
|
|
218
219
|
readonly minDate_tip: "Earliest allowed date";
|
|
219
220
|
readonly maxDate: "Maximum date";
|
|
@@ -276,9 +277,11 @@ export declare const DICTIONARY_EN: {
|
|
|
276
277
|
};
|
|
277
278
|
readonly field_editor: {
|
|
278
279
|
readonly dependency_title: "Dependency";
|
|
279
|
-
readonly dependency_description: "This field is shown only if
|
|
280
|
+
readonly dependency_description: "This field is shown only if all rules are met:";
|
|
280
281
|
readonly add_relation: "Add relation";
|
|
281
282
|
readonly remove_relation: "Remove relation";
|
|
283
|
+
readonly cancel: "Cancel";
|
|
284
|
+
readonly save: "Save";
|
|
282
285
|
readonly basic: "Basic";
|
|
283
286
|
readonly parent: "Parent";
|
|
284
287
|
readonly operator: "Operator";
|
|
@@ -56,6 +56,7 @@ export declare const DICTIONARY_ES: {
|
|
|
56
56
|
};
|
|
57
57
|
readonly time_picker: {
|
|
58
58
|
readonly placeholder: "hh:mm am/pm";
|
|
59
|
+
readonly confirm: "Confirmar";
|
|
59
60
|
};
|
|
60
61
|
readonly excel_table: {
|
|
61
62
|
readonly load_file: "Cargar excel";
|
|
@@ -213,7 +214,7 @@ export declare const DICTIONARY_ES: {
|
|
|
213
214
|
readonly monthMode: "Modo mes";
|
|
214
215
|
readonly monthMode_tip: "Seleccionar fecha por mes";
|
|
215
216
|
readonly monthDay: "Día del mes";
|
|
216
|
-
readonly monthDay_tip: "Elegir
|
|
217
|
+
readonly monthDay_tip: "Elegir Para guardar en BBDD";
|
|
217
218
|
readonly minDate: "Fecha mínima";
|
|
218
219
|
readonly minDate_tip: "Fecha mínima permitida";
|
|
219
220
|
readonly maxDate: "Fecha máxima";
|
|
@@ -276,9 +277,11 @@ export declare const DICTIONARY_ES: {
|
|
|
276
277
|
};
|
|
277
278
|
readonly field_editor: {
|
|
278
279
|
readonly dependency_title: "Dependencia";
|
|
279
|
-
readonly dependency_description: "Este campo solo se muestra si se
|
|
280
|
+
readonly dependency_description: "Este campo solo se muestra si se cumplen todas las reglas:";
|
|
280
281
|
readonly add_relation: "Agregar relación";
|
|
281
282
|
readonly remove_relation: "Eliminar relación";
|
|
283
|
+
readonly cancel: "Cancelar";
|
|
284
|
+
readonly save: "Guardar";
|
|
282
285
|
readonly basic: "Básico";
|
|
283
286
|
readonly parent: "Padre";
|
|
284
287
|
readonly operator: "Operador";
|