ui-core-abv 0.6.71 → 0.6.72

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.
@@ -1,7 +1,7 @@
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, uicFormValuesRecord } from '../form.models';
4
+ import { 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;
@@ -12,6 +12,7 @@ export declare class UicFormWrapperComponent implements OnInit, OnChanges, OnDes
12
12
  fields: FormField[];
13
13
  cols: number;
14
14
  externalData: Record<string, AppSelectOption[]>;
15
+ selectOptionsResolver?: SelectOptionsResolver;
15
16
  loading: boolean;
16
17
  disabled: boolean;
17
18
  showButtons: boolean;
@@ -22,7 +23,14 @@ export declare class UicFormWrapperComponent implements OnInit, OnChanges, OnDes
22
23
  fileUidResolverFn?: (fileUid: string) => void;
23
24
  formSubmit: EventEmitter<FormResult>;
24
25
  formChange: EventEmitter<uicFormValuesRecord>;
26
+ optionsSourceError: EventEmitter<{
27
+ field: FormField;
28
+ source: SelectOptionsSource;
29
+ error: unknown;
30
+ }>;
25
31
  private formValueSub;
32
+ private readonly optionSourceSubs;
33
+ private readonly optionSourceDependencyValueByField;
26
34
  private hasFocusedCurrentTrigger;
27
35
  ngOnInit(): void;
28
36
  ngOnChanges(changes: SimpleChanges): void;
@@ -36,6 +44,23 @@ export declare class UicFormWrapperComponent implements OnInit, OnChanges, OnDes
36
44
  handleSubmit(): FormResult;
37
45
  private handleFormChange;
38
46
  private updateFieldOptions;
47
+ private updateOptionsSources;
48
+ private updateDependentOptionsSources;
49
+ private resolveOptionsSourceField;
50
+ private handleOptionsSourceError;
51
+ private toObservable;
52
+ private mapOptionsSourceItems;
53
+ private mapOptionsSourceItem;
54
+ private renderOptionsSourceTemplate;
55
+ private updateFieldOptionsState;
56
+ private clearInvalidFieldValue;
57
+ private clearFieldValue;
58
+ private hasUsableOptionsSource;
59
+ private supportsOptions;
60
+ private isValidOptionId;
61
+ private getValueByPath;
62
+ private safeStringify;
63
+ private clearOptionSourceSubscriptions;
39
64
  private collectAllFields;
40
65
  updateFieldValue(name: string, value: any): void;
41
66
  updateFieldConfig(name: string, config: Omit<FormField, 'name' | 'type'>): void;
@@ -59,5 +84,5 @@ export declare class UicFormWrapperComponent implements OnInit, OnChanges, OnDes
59
84
  private setNestedValue;
60
85
  private syncEffectiveSchema;
61
86
  static ɵfac: i0.ɵɵFactoryDeclaration<UicFormWrapperComponent, never>;
62
- 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; }; "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"; }, never, never, true, never>;
87
+ 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>;
63
88
  }
@@ -17,6 +17,21 @@ export interface FormBlock {
17
17
  title?: string;
18
18
  fields: FormField[];
19
19
  }
20
+ export interface SelectOptionsSource {
21
+ key: string;
22
+ idField?: string;
23
+ textField?: string;
24
+ textTemplate?: string;
25
+ dependsOn?: string;
26
+ paramName?: string;
27
+ params?: Record<string, any>;
28
+ }
29
+ export interface SelectOptionsContext {
30
+ field: FormField;
31
+ values: uicFormValuesRecord;
32
+ dependencyValue?: any;
33
+ }
34
+ export type SelectOptionsResolver = (source: SelectOptionsSource, context: SelectOptionsContext) => AppSelectOption[] | unknown[] | Promise<AppSelectOption[] | unknown[]> | Observable<AppSelectOption[] | unknown[]>;
20
35
  export interface FormField {
21
36
  name: string;
22
37
  type: FieldType;
@@ -59,6 +74,7 @@ export interface FormField {
59
74
  poolEnabledListView?: boolean;
60
75
  poolTitle?: string;
61
76
  options?: AppSelectOption[];
77
+ optionsSource?: SelectOptionsSource;
62
78
  multyEnabled?: boolean;
63
79
  searchApi?: string;
64
80
  searchFn?: (query: string) => Observable<any[]>;
@@ -64,6 +64,7 @@ export declare class UicUserFormbuilderComponent {
64
64
  private getNextCodeId;
65
65
  private hydrateBlocks;
66
66
  private removeNullProperties;
67
+ private prepareFieldDataForSubmit;
67
68
  private deepClone;
68
69
  static ɵfac: i0.ɵɵFactoryDeclaration<UicUserFormbuilderComponent, never>;
69
70
  static ɵcmp: i0.ɵɵComponentDeclaration<UicUserFormbuilderComponent, "ui-user-formbuilder", never, { "disabled": { "alias": "disabled"; "required": false; }; "formTitle": { "alias": "formTitle"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "editableFormInput": { "alias": "editableForm"; "required": false; "isSignal": true; }; }, { "submitFormRequest": "submitFormRequest"; }, never, never, true, never>;
@@ -240,6 +240,18 @@ export declare const DICTIONARY_EN: {
240
240
  readonly iaValidationPrompt: "IA Validation Prompt";
241
241
  readonly searchApi: "Search API";
242
242
  readonly searchApi_tip: "URL to fetch search options";
243
+ readonly optionsSourceKey: "Options source";
244
+ readonly optionsSourceKey_tip: "Logical key registered by the consuming application";
245
+ readonly optionsSourceIdField: "Option ID field";
246
+ readonly optionsSourceIdField_tip: "Path used as the option id. Example: id";
247
+ readonly optionsSourceTextField: "Option text field";
248
+ readonly optionsSourceTextField_tip: "Path used as the option text. Example: name";
249
+ readonly optionsSourceTextTemplate: "Text template";
250
+ readonly optionsSourceTextTemplate_tip: "Example: {{name}} ({{id}})";
251
+ readonly optionsSourceDependsOn: "Depends on";
252
+ readonly optionsSourceDependsOn_tip: "Parent field identifier that triggers reloads";
253
+ readonly optionsSourceParamName: "Parameter name";
254
+ readonly optionsSourceParamName_tip: "Name used to send the dependent value";
243
255
  readonly selectNullable_tip: "Allows selecting an empty option";
244
256
  readonly selectSearchEnabled_tip: "Enables search among options";
245
257
  readonly selectNullable: "Allow empty option";
@@ -240,6 +240,18 @@ export declare const DICTIONARY_ES: {
240
240
  readonly iaValidation: "Validación IA";
241
241
  readonly iaValidationPrompt: "Prompt de validación IA";
242
242
  readonly searchApi_tip: "URL para obtener opciones de búsqueda";
243
+ readonly optionsSourceKey: "Fuente de opciones";
244
+ readonly optionsSourceKey_tip: "Clave lógica registrada por la aplicación consumidora";
245
+ readonly optionsSourceIdField: "Campo ID de opción";
246
+ readonly optionsSourceIdField_tip: "Ruta del valor usado como id. Ejemplo: id";
247
+ readonly optionsSourceTextField: "Campo texto de opción";
248
+ readonly optionsSourceTextField_tip: "Ruta del valor usado como texto. Ejemplo: name";
249
+ readonly optionsSourceTextTemplate: "Plantilla de texto";
250
+ readonly optionsSourceTextTemplate_tip: "Ejemplo: {{name}} ({{id}})";
251
+ readonly optionsSourceDependsOn: "Depende de";
252
+ readonly optionsSourceDependsOn_tip: "Identificador del campo padre que dispara la recarga";
253
+ readonly optionsSourceParamName: "Nombre del parámetro";
254
+ readonly optionsSourceParamName_tip: "Nombre con el que se envía el valor dependiente";
243
255
  readonly selectNullable_tip: "Permite seleccionar una opción vacía";
244
256
  readonly selectSearchEnabled_tip: "Habilita búsqueda entre opciones";
245
257
  readonly selectNullable: "Permitir opción vacía";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-core-abv",
3
- "version": "0.6.71",
3
+ "version": "0.6.72",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=19.2.0 <21.0.0",
6
6
  "@angular/core": ">=19.2.0 <21.0.0",