ui-core-abv 0.11.4 → 0.11.5

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.
@@ -70,6 +70,11 @@ export declare class UicDynamicFormComponent implements OnDestroy {
70
70
  onFieldContainerFocusout(field: FormField, event: FocusEvent): void;
71
71
  private getValueByFieldName;
72
72
  private syncFieldEnabledState;
73
+ /**
74
+ * 'in' / 'notIn': el valor actual (opción única) es alguno de la lista. Comparación flexible como
75
+ * 'equals' (1 y '1' coinciden). Sin respuesta o con la lista vacía no coincide.
76
+ */
77
+ private isOneOfVisibilityValues;
73
78
  private getClearValue;
74
79
  private matchesVisibilityRule;
75
80
  private findFieldByName;
@@ -77,6 +77,7 @@ export interface FormField {
77
77
  tip?: string;
78
78
  newLine?: boolean;
79
79
  colSpan?: number;
80
+ samePage?: boolean;
80
81
  iconColor?: ButtonColor;
81
82
  tooltip?: string;
82
83
  disabled?: boolean;
@@ -174,7 +175,8 @@ export interface FieldVisibilityRule {
174
175
  operator: VisibilityOperators;
175
176
  value: any;
176
177
  }
177
- export type VisibilityOperators = 'equals' | 'notEquals' | 'greaterThan' | 'lessThan' | 'includes' | 'notIncludes' | 'isEmpty' | 'isNotEmpty';
178
+ export type VisibilityOperators = 'equals' | 'notEquals' | 'greaterThan' | 'lessThan' | 'includes' | 'notIncludes' | 'isEmpty' | 'isNotEmpty' | 'in' | // value: arreglo de ids; el valor actual es alguno de ellos (selects de opción única)
179
+ 'notIn';
178
180
  export interface FieldVisibilityConfig {
179
181
  outputType: string;
180
182
  operators: VisibilityOperators[];
@@ -191,8 +193,10 @@ export declare const VISIBILITY_OPERATOR_OPTIONS: {
191
193
  id: VisibilityOperators;
192
194
  text: string;
193
195
  }[];
196
+ /** Operadores cuyo valor es una lista de valores (FieldVisibilityRule.value es un arreglo). */
197
+ export declare const LIST_VISIBILITY_OPERATORS: VisibilityOperators[];
194
198
  export declare const FIELDS_CONFIG: FieldConfig[];
195
- export type FieldType = 'text' | 'number' | 'phone' | 'date' | 'time' | 'select' | 'radio' | 'checkbox' | 'switch' | 'textarea' | 'pool' | 'file' | 'multyselect' | 'searcher' | 'multisearcher' | 'slider' | 'repeater' | 'computed' | 'scale' | 'distribution';
199
+ export type FieldType = 'text' | 'number' | 'phone' | 'date' | 'time' | 'select' | 'radio' | 'checkbox' | 'switch' | 'textarea' | 'pool' | 'file' | 'multyselect' | 'searcher' | 'multisearcher' | 'slider' | 'repeater' | 'computed' | 'scale' | 'distribution' | 'chips';
196
200
  /**
197
201
  * Valor de una pregunta de distribución porcentual: un ítem por opción, en el orden de las opciones,
198
202
  * con el porcentaje asignado (enteros 0–100 que suman 100). Sin respuesta, el valor es null.
@@ -210,5 +214,7 @@ export declare const EXTERNAL_VALIDATION_FORM_FIELDS: FormField[];
210
214
  export declare const COMPUTED_FORM_FIELDS: FormField[];
211
215
  export declare const BASE_FORM_FIELDS: FormField[];
212
216
  export declare const LAYOUT_FORM_FIELDS: FormField[];
217
+ /** Propiedades que solo aplican cuando el formulario se muestra como encuesta (ui-survey). */
218
+ export declare const SURVEY_FORM_FIELDS: FormField[];
213
219
  export declare const EXTRA_FORM_FIELDS: FormField[];
214
220
  export declare const BRANCH_FORM_FIELDS: FormField[];
@@ -0,0 +1,55 @@
1
+ import { ButtonColor } from '../../button/button.component';
2
+ import * as i0 from "@angular/core";
3
+ declare const base: abstract new () => {
4
+ value: string[] | null;
5
+ valueChange: import("@angular/core").EventEmitter<string[] | null>;
6
+ onChange: (value: string[] | null) => void;
7
+ onTouched: () => void;
8
+ writeValue(obj: string[] | null): void;
9
+ registerOnChange(fn: any): void;
10
+ registerOnTouched(fn: any): void;
11
+ setDisabledState?(isDisabled: boolean): void;
12
+ notifyChange(value: string[] | null): void;
13
+ };
14
+ /**
15
+ * Lista de textos libres como chips (hobbies, etiquetas, palabras clave...).
16
+ * Enter o coma agregan el texto escrito; Retroceso con el campo vacío quita el último; al pegar
17
+ * texto con comas, punto y coma o saltos de línea se agrega un chip por parte. Al salir del campo
18
+ * se agrega lo que quedó escrito.
19
+ * Valor: string[] (sin repetidos, sin distinguir mayúsculas), o null si no hay ninguno.
20
+ */
21
+ export declare class UicChipsInputComponent extends base {
22
+ icon: string;
23
+ iconColor: ButtonColor;
24
+ label: string;
25
+ error: string;
26
+ tip: string;
27
+ disabled: boolean;
28
+ placeholder: string;
29
+ /** Máximo de chips (null = sin límite). Al alcanzarlo se oculta el campo de texto. */
30
+ maxItems: number | null;
31
+ /** Largo máximo de cada chip. */
32
+ maxLength: number | null;
33
+ private textInput?;
34
+ /** Texto que se está escribiendo (aún no es chip). */
35
+ draft: string;
36
+ /** Chip ya existente que se intentó repetir (se resalta un momento). */
37
+ duplicated: string | null;
38
+ private duplicatedTimer;
39
+ get items(): string[];
40
+ get isFull(): boolean;
41
+ focusInput(): void;
42
+ onDraftInput(event: Event): void;
43
+ onKeydown(event: KeyboardEvent): void;
44
+ onPaste(event: ClipboardEvent): void;
45
+ onBlur(): void;
46
+ remove(index: number): void;
47
+ private commitDraft;
48
+ /** Agrega los textos válidos (recortados, sin repetidos y hasta el máximo). Devuelve cuántos agregó. */
49
+ private addMany;
50
+ private setDraft;
51
+ private flagDuplicate;
52
+ static ɵfac: i0.ɵɵFactoryDeclaration<UicChipsInputComponent, never>;
53
+ static ɵcmp: i0.ɵɵComponentDeclaration<UicChipsInputComponent, "ui-chips-input", never, { "icon": { "alias": "icon"; "required": false; }; "iconColor": { "alias": "iconColor"; "required": false; }; "label": { "alias": "label"; "required": false; }; "error": { "alias": "error"; "required": false; }; "tip": { "alias": "tip"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "maxItems": { "alias": "maxItems"; "required": false; }; "maxLength": { "alias": "maxLength"; "required": false; }; }, {}, never, never, true, never>;
54
+ }
55
+ export {};
@@ -39,6 +39,13 @@ export declare class UicDistributionComponent extends base {
39
39
  get remaining(): number;
40
40
  amountOf(option: AppSelectOption): number;
41
41
  onInput(option: AppSelectOption, event: Event): void;
42
+ /** Máximo al que puede llegar la opción sin pasar de 100 (su valor + lo que falta). */
43
+ capOf(option: AppSelectOption): number;
44
+ /**
45
+ * Slider: el valor se detiene en lo disponible para no pasar de 100. Si ya se pasó (por el
46
+ * input numérico o un valor inicial), solo se puede bajar.
47
+ */
48
+ onSlide(option: AppSelectOption, event: Event): void;
42
49
  /** Asigna a esta opción todo lo que falta para llegar a 100. */
43
50
  fillRemaining(option: AppSelectOption): void;
44
51
  clear(): void;
@@ -5,6 +5,7 @@ import { UicOptionsSourceError } from '../dynamic-form/form-engine.service';
5
5
  import { ComputedFieldResolver, ExternalValidatorResolver, FormField, FormResult, FormSchema, SelectOptionsResolver, uicFormValuesRecord } from '../dynamic-form/form.models';
6
6
  import { UicSurveyFooterDirective, UicSurveyHeaderDirective } from './survey-templates.directive';
7
7
  import { SurveyAnimation, SurveyStartAt, SurveyFieldSaveEvent, SurveyNavigationDirection, SurveyPage, SurveyPageChangeEvent, SurveyPageMode, SurveySaveFn, SurveySaveState, SurveyTheme } from './survey.models';
8
+ import { ResolvedSurveyConfig, UicSurveyConfig } from './survey.config';
8
9
  import * as i0 from "@angular/core";
9
10
  /**
10
11
  * Encuesta paginada sobre un FormSchema: una pregunta o un bloque por pantalla, con progreso,
@@ -18,6 +19,7 @@ export declare class UicSurveyComponent implements OnInit, OnChanges, OnDestroy
18
19
  private readonly engine;
19
20
  private readonly host;
20
21
  private readonly cdr;
22
+ private readonly injector;
21
23
  set schema(value: FormSchema);
22
24
  get schema(): FormSchema;
23
25
  set initialValues(value: uicFormValuesRecord);
@@ -39,8 +41,17 @@ export declare class UicSurveyComponent implements OnInit, OnChanges, OnDestroy
39
41
  * hasta revisarlas; 'slide' y 'fade' siguen disponibles de forma experimental (solo entrada).
40
42
  */
41
43
  readonly animation: import("@angular/core").InputSignal<SurveyAnimation>;
42
- readonly showProgress: import("@angular/core").InputSignal<boolean>;
43
- readonly showBack: import("@angular/core").InputSignal<boolean>;
44
+ /**
45
+ * Configuración inicial (textos y opciones de navegación). Se combina con la global
46
+ * (provideUicSurveyConfig); los inputs sueltos de abajo tienen prioridad sobre ambas.
47
+ */
48
+ readonly config: import("@angular/core").InputSignal<UicSurveyConfig | null>;
49
+ /** Sobrescribe config.showProgress. */
50
+ readonly showProgress: import("@angular/core").InputSignal<boolean | undefined>;
51
+ /** Sobrescribe config.showBack. */
52
+ readonly showBack: import("@angular/core").InputSignal<boolean | undefined>;
53
+ /** Sobrescribe config.showBackOnFirstPage (ver UicSurveyConfig). */
54
+ readonly showBackOnFirstPage: import("@angular/core").InputSignal<boolean | undefined>;
44
55
  /**
45
56
  * Página en la que empieza (o se reanuda) la encuesta:
46
57
  * - 'first-unanswered': la primera página visible con alguna pregunta sin responder.
@@ -57,14 +68,24 @@ export declare class UicSurveyComponent implements OnInit, OnChanges, OnDestroy
57
68
  readonly autoAdvance: import("@angular/core").InputSignal<boolean>;
58
69
  /** Enfoca el primer campo de cada página al navegar. */
59
70
  readonly autoFocus: import("@angular/core").InputSignal<boolean>;
71
+ /**
72
+ * Sobrescribe config.disableNextWhenInvalid: deshabilita "Siguiente"/"Enviar" mientras la página
73
+ * tenga respuestas inválidas (por ejemplo, obligatorias vacías). Enter sigue intentando avanzar y
74
+ * marca los errores.
75
+ */
76
+ readonly disableNextWhenInvalid: import("@angular/core").InputSignal<boolean | undefined>;
60
77
  readonly loading: import("@angular/core").InputSignal<boolean>;
61
78
  /** Variables CSS aplicadas al host. Solo claves que empiecen con "--". */
62
79
  readonly theme: import("@angular/core").InputSignal<SurveyTheme | null>;
63
80
  readonly iconMode: import("@angular/core").InputSignal<"checklist" | undefined>;
64
81
  readonly fileUidResolverFn: import("@angular/core").InputSignal<((fileUid: string, fileName: string, fieldLabel: string) => void) | undefined>;
65
- readonly nextText: import("@angular/core").InputSignal<string>;
66
- readonly backText: import("@angular/core").InputSignal<string>;
67
- readonly submitText: import("@angular/core").InputSignal<string>;
82
+ /** Sobrescriben config.texts. */
83
+ readonly nextText: import("@angular/core").InputSignal<string | undefined>;
84
+ readonly backText: import("@angular/core").InputSignal<string | undefined>;
85
+ readonly submitText: import("@angular/core").InputSignal<string | undefined>;
86
+ private readonly globalConfig;
87
+ /** Configuración efectiva: inputs sueltos > config > global > valores por defecto. */
88
+ readonly settings: import("@angular/core").Signal<ResolvedSurveyConfig>;
68
89
  /**
69
90
  * Emite fieldSave por cada respuesta que cambia: al salir del campo (texto, número, teléfono,
70
91
  * repeater) o al cambiar el valor (selecciones, fechas, archivos, slider; con debounce).
@@ -76,6 +97,8 @@ export declare class UicSurveyComponent implements OnInit, OnChanges, OnDestroy
76
97
  readonly autoSaveDebounceMs: import("@angular/core").InputSignal<number>;
77
98
  surveySubmit: EventEmitter<FormResult>;
78
99
  pageChange: EventEmitter<SurveyPageChangeEvent>;
100
+ /** "Anterior" en la primera página (con showBackOnFirstPage): el consumidor decide a dónde volver. */
101
+ backFromStart: EventEmitter<void>;
79
102
  fieldSave: EventEmitter<SurveyFieldSaveEvent>;
80
103
  formChange: EventEmitter<uicFormValuesRecord>;
81
104
  optionsSourceError: EventEmitter<UicOptionsSourceError>;
@@ -99,6 +122,8 @@ export declare class UicSurveyComponent implements OnInit, OnChanges, OnDestroy
99
122
  }>;
100
123
  get form(): FormGroup;
101
124
  private readonly fieldPageFieldsCache;
125
+ /** Páginas con varias preguntas (samePage), por su primera pregunta. */
126
+ private readonly fieldGroupCache;
102
127
  readonly pages: import("@angular/core").Signal<SurveyPage[]>;
103
128
  /** En modo 'field', los campos ocultos (hidden) se montan aparte para conservar su estado. */
104
129
  readonly hiddenFields: import("@angular/core").Signal<FormField[]>;
@@ -109,8 +134,16 @@ export declare class UicSurveyComponent implements OnInit, OnChanges, OnDestroy
109
134
  readonly position: import("@angular/core").Signal<number>;
110
135
  readonly total: import("@angular/core").Signal<number>;
111
136
  readonly progress: import("@angular/core").Signal<number>;
137
+ /** true si "Anterior" hace algo: hay una página previa o, en la primera, showBackOnFirstPage. */
112
138
  readonly canGoBack: import("@angular/core").Signal<boolean>;
113
139
  readonly isLast: import("@angular/core").Signal<boolean>;
140
+ /**
141
+ * true si las preguntas visibles de la página actual son válidas. Se recalcula con cada cambio
142
+ * de valor: si una respuesta muestra una pregunta obligatoria en la misma página (samePage +
143
+ * visibilityRules), vuelve a false hasta que se conteste.
144
+ */
145
+ readonly canAdvance: import("@angular/core").Signal<boolean>;
146
+ readonly nextDisabled: import("@angular/core").Signal<boolean>;
114
147
  private readonly lastSavedValue;
115
148
  private readonly saveTimers;
116
149
  private pendingSaves;
@@ -123,6 +156,7 @@ export declare class UicSurveyComponent implements OnInit, OnChanges, OnDestroy
123
156
  ngOnDestroy(): void;
124
157
  /** Valida la página actual y avanza a la siguiente visible; en la última, envía. */
125
158
  next(): void;
159
+ /** Vuelve a la página anterior visible; en la primera, con showBackOnFirstPage, emite backFromStart. */
126
160
  back(): void;
127
161
  /** Va a una página por su posición en `pages()` (sin validar la actual). */
128
162
  goToPage(index: number): void;
@@ -142,11 +176,28 @@ export declare class UicSurveyComponent implements OnInit, OnChanges, OnDestroy
142
176
  private applyStartAt;
143
177
  private resolveStartPage;
144
178
  private findAdjacentPage;
179
+ /** Primera pregunta visible de la página (en una página samePage la primera puede estar oculta por reglas). */
180
+ private firstVisibleQuestion;
181
+ /**
182
+ * Validez de un control para canAdvance. Una pregunta que se acaba de mostrar puede seguir
183
+ * deshabilitada un instante (ui-dynamic-form la habilita en un effect sin emitir eventos), así
184
+ * que en ese caso se evalúan sus validadores directamente.
185
+ */
186
+ private isPendingInvalid;
187
+ /** Preguntas visibles de la página activa en el último cálculo (para detectar las que aparecen). */
188
+ private revealTracking;
189
+ /** Anima las preguntas que aparecen en la página activa al contestar otra (samePage + visibilityRules). */
190
+ private trackRevealedQuestions;
191
+ private revealQuestions;
145
192
  private validatePage;
146
193
  private findFirstInvalidPage;
147
194
  private focusActivePage;
148
- /** Campos de una página de una sola pregunta: la pregunta y, si tiene "Otros", su texto acompañante. */
149
- private fieldsForSingleFieldPage;
195
+ /**
196
+ * Campos de una página en modo 'field': cada pregunta del grupo y, si tiene "Otros", su texto
197
+ * acompañante. Se cachea por pregunta para que el array no cambie de referencia entre cálculos
198
+ * (si cambiara, ui-dynamic-form recrearía los campos).
199
+ */
200
+ private fieldsForFieldPage;
150
201
  private onFormBuilt;
151
202
  private scheduleImmediateSaves;
152
203
  /** Guarda de inmediato todo lo pendiente (al avanzar y antes de enviar). */
@@ -161,5 +212,5 @@ export declare class UicSurveyComponent implements OnInit, OnChanges, OnDestroy
161
212
  private isEmptyValue;
162
213
  private stringify;
163
214
  static ɵfac: i0.ɵɵFactoryDeclaration<UicSurveyComponent, never>;
164
- static ɵcmp: i0.ɵɵComponentDeclaration<UicSurveyComponent, "ui-survey", never, { "schema": { "alias": "schema"; "required": true; }; "initialValues": { "alias": "initialValues"; "required": false; }; "externalData": { "alias": "externalData"; "required": false; }; "selectOptionsResolver": { "alias": "selectOptionsResolver"; "required": false; }; "computedFieldResolver": { "alias": "computedFieldResolver"; "required": false; }; "externalValidatorResolver": { "alias": "externalValidatorResolver"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "pageMode": { "alias": "pageMode"; "required": false; "isSignal": true; }; "animation": { "alias": "animation"; "required": false; "isSignal": true; }; "showProgress": { "alias": "showProgress"; "required": false; "isSignal": true; }; "showBack": { "alias": "showBack"; "required": false; "isSignal": true; }; "startAt": { "alias": "startAt"; "required": false; "isSignal": true; }; "autoAdvance": { "alias": "autoAdvance"; "required": false; "isSignal": true; }; "autoFocus": { "alias": "autoFocus"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "iconMode": { "alias": "iconMode"; "required": false; "isSignal": true; }; "fileUidResolverFn": { "alias": "fileUidResolverFn"; "required": false; "isSignal": true; }; "nextText": { "alias": "nextText"; "required": false; "isSignal": true; }; "backText": { "alias": "backText"; "required": false; "isSignal": true; }; "submitText": { "alias": "submitText"; "required": false; "isSignal": true; }; "autoSave": { "alias": "autoSave"; "required": false; "isSignal": true; }; "saveFn": { "alias": "saveFn"; "required": false; "isSignal": true; }; "autoSaveDebounceMs": { "alias": "autoSaveDebounceMs"; "required": false; "isSignal": true; }; }, { "surveySubmit": "surveySubmit"; "pageChange": "pageChange"; "fieldSave": "fieldSave"; "formChange": "formChange"; "optionsSourceError": "optionsSourceError"; }, ["headerTpl", "footerTpl"], never, true, never>;
215
+ static ɵcmp: i0.ɵɵComponentDeclaration<UicSurveyComponent, "ui-survey", never, { "schema": { "alias": "schema"; "required": true; }; "initialValues": { "alias": "initialValues"; "required": false; }; "externalData": { "alias": "externalData"; "required": false; }; "selectOptionsResolver": { "alias": "selectOptionsResolver"; "required": false; }; "computedFieldResolver": { "alias": "computedFieldResolver"; "required": false; }; "externalValidatorResolver": { "alias": "externalValidatorResolver"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "pageMode": { "alias": "pageMode"; "required": false; "isSignal": true; }; "animation": { "alias": "animation"; "required": false; "isSignal": true; }; "config": { "alias": "config"; "required": false; "isSignal": true; }; "showProgress": { "alias": "showProgress"; "required": false; "isSignal": true; }; "showBack": { "alias": "showBack"; "required": false; "isSignal": true; }; "showBackOnFirstPage": { "alias": "showBackOnFirstPage"; "required": false; "isSignal": true; }; "startAt": { "alias": "startAt"; "required": false; "isSignal": true; }; "autoAdvance": { "alias": "autoAdvance"; "required": false; "isSignal": true; }; "autoFocus": { "alias": "autoFocus"; "required": false; "isSignal": true; }; "disableNextWhenInvalid": { "alias": "disableNextWhenInvalid"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "iconMode": { "alias": "iconMode"; "required": false; "isSignal": true; }; "fileUidResolverFn": { "alias": "fileUidResolverFn"; "required": false; "isSignal": true; }; "nextText": { "alias": "nextText"; "required": false; "isSignal": true; }; "backText": { "alias": "backText"; "required": false; "isSignal": true; }; "submitText": { "alias": "submitText"; "required": false; "isSignal": true; }; "autoSave": { "alias": "autoSave"; "required": false; "isSignal": true; }; "saveFn": { "alias": "saveFn"; "required": false; "isSignal": true; }; "autoSaveDebounceMs": { "alias": "autoSaveDebounceMs"; "required": false; "isSignal": true; }; }, { "surveySubmit": "surveySubmit"; "pageChange": "pageChange"; "backFromStart": "backFromStart"; "fieldSave": "fieldSave"; "formChange": "formChange"; "optionsSourceError": "optionsSourceError"; }, ["headerTpl", "footerTpl"], never, true, never>;
165
216
  }
@@ -0,0 +1,52 @@
1
+ import { InjectionToken, Provider } from '@angular/core';
2
+ /**
3
+ * Configuración inicial de ui-survey (serializable a JSON).
4
+ *
5
+ * Orden de prioridad: input suelto del componente (`nextText`, `showBack`, ...) > input `config` >
6
+ * configuración global (provideUicSurveyConfig) > valores por defecto.
7
+ * Los textos pueden ser claves de traducción o texto literal.
8
+ *
9
+ * @example
10
+ * {
11
+ * "texts": { "next": "Continuar", "back": "Volver", "submit": "Terminar" },
12
+ * "showBackOnFirstPage": true
13
+ * }
14
+ */
15
+ export interface UicSurveyConfig {
16
+ texts?: {
17
+ /** Botón para avanzar. Por defecto: 'survey.next'. */
18
+ next?: string;
19
+ /** Botón para volver. Por defecto: 'survey.back'. */
20
+ back?: string;
21
+ /** Botón de la última página. Por defecto: 'survey.submit'. */
22
+ submit?: string;
23
+ };
24
+ /** Barra de progreso. Por defecto: true. */
25
+ showProgress?: boolean;
26
+ /** Botón para volver. Por defecto: true. */
27
+ showBack?: boolean;
28
+ /**
29
+ * Muestra "Anterior" también en la primera página. Al pulsarlo se emite `backFromStart`, para que
30
+ * el consumidor vuelva a lo que mostró antes (por ejemplo, una página de instrucciones).
31
+ * Por defecto: false.
32
+ */
33
+ showBackOnFirstPage?: boolean;
34
+ /** Deshabilita "Siguiente"/"Enviar" mientras la página tenga respuestas inválidas. Por defecto: true. */
35
+ disableNextWhenInvalid?: boolean;
36
+ }
37
+ export interface ResolvedSurveyConfig {
38
+ texts: {
39
+ next: string;
40
+ back: string;
41
+ submit: string;
42
+ };
43
+ showProgress: boolean;
44
+ showBack: boolean;
45
+ showBackOnFirstPage: boolean;
46
+ disableNextWhenInvalid: boolean;
47
+ }
48
+ /** Configuración global (p. ej. por cliente). La entrada `config` del componente la sobrescribe por clave. */
49
+ export declare const UIC_SURVEY_CONFIG: InjectionToken<UicSurveyConfig>;
50
+ export declare function provideUicSurveyConfig(config: UicSurveyConfig): Provider;
51
+ /** Combina configuraciones (las últimas ganan, por clave; `texts` se combina por texto). */
52
+ export declare function resolveSurveyConfig(...configs: (UicSurveyConfig | null | undefined)[]): ResolvedSurveyConfig;
@@ -7,7 +7,10 @@ export type SurveyStartAt = 'first-unanswered' | number | string;
7
7
  export type SurveyAnimation = 'slide' | 'fade' | 'none';
8
8
  export type SurveyNavigationDirection = 'forward' | 'back';
9
9
  export interface SurveyPage {
10
- /** Identificador estable de la página ('b0', 'f:nombreCampo'). */
10
+ /**
11
+ * Identificador estable de la página ('b0', 'f:nombreCampo'). En modo 'field', una página con
12
+ * varias preguntas (samePage) usa el nombre de la primera.
13
+ */
11
14
  key: string;
12
15
  /** Posición en la lista completa de páginas (incluye las ocultas por reglas). */
13
16
  index: number;
@@ -52,5 +55,7 @@ export interface SurveyFooterContext {
52
55
  back: () => void;
53
56
  canGoBack: boolean;
54
57
  isLast: boolean;
58
+ /** true si las preguntas visibles de la página son válidas (para deshabilitar "Siguiente"). */
59
+ canAdvance: boolean;
55
60
  saveState: SurveySaveState;
56
61
  }
@@ -1,12 +1,19 @@
1
1
  import { ConnectedPosition } from '@angular/cdk/overlay';
2
2
  import { EventEmitter, TemplateRef } from '@angular/core';
3
- import { ButtonSize } from '../button/button.component';
3
+ import { ButtonColor, ButtonSize, ButtonType } from '../button/button.component';
4
4
  import * as i0 from "@angular/core";
5
5
  export declare class UicActionButtonComponent {
6
6
  icon: string;
7
7
  options: ActionMenuOption[];
8
8
  multiselect: boolean;
9
9
  size: ButtonSize;
10
+ /** Texto del disparador. Si se indica, el botón deja de ser solo icono. */
11
+ text: string;
12
+ /** Icono a la derecha del texto (solo se muestra con `text`). */
13
+ rightIcon: string;
14
+ color: ButtonColor;
15
+ type: ButtonType;
16
+ disabled: boolean;
10
17
  optionSelected: EventEmitter<ActionMenuOption>;
11
18
  optionsApplied: EventEmitter<ActionMenuOption[]>;
12
19
  menuTemplate: TemplateRef<any>;
@@ -27,7 +34,7 @@ export declare class UicActionButtonComponent {
27
34
  updateAllSelected(): void;
28
35
  closeMenu(): void;
29
36
  static ɵfac: i0.ɵɵFactoryDeclaration<UicActionButtonComponent, never>;
30
- static ɵcmp: i0.ɵɵComponentDeclaration<UicActionButtonComponent, "ui-action-button", never, { "icon": { "alias": "icon"; "required": false; }; "options": { "alias": "options"; "required": false; }; "multiselect": { "alias": "multiselect"; "required": false; }; "size": { "alias": "size"; "required": false; }; }, { "optionSelected": "optionSelected"; "optionsApplied": "optionsApplied"; }, never, never, true, never>;
37
+ static ɵcmp: i0.ɵɵComponentDeclaration<UicActionButtonComponent, "ui-action-button", never, { "icon": { "alias": "icon"; "required": false; }; "options": { "alias": "options"; "required": false; }; "multiselect": { "alias": "multiselect"; "required": false; }; "size": { "alias": "size"; "required": false; }; "text": { "alias": "text"; "required": false; }; "rightIcon": { "alias": "rightIcon"; "required": false; }; "color": { "alias": "color"; "required": false; }; "type": { "alias": "type"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "optionSelected": "optionSelected"; "optionsApplied": "optionsApplied"; }, never, never, true, never>;
31
38
  }
32
39
  export interface ActionMenuOption {
33
40
  id: string;
@@ -33,6 +33,8 @@ export declare class FieldEditorComponent {
33
33
  visibilityRulesEnabled: import("@angular/core").InputSignal<boolean>;
34
34
  /** Sección "Estilo". */
35
35
  styleEnabled: import("@angular/core").InputSignal<boolean>;
36
+ /** El formulario se muestra como encuesta con una pregunta por página: agrega "samePage" a la sección de estilo. */
37
+ surveyFieldMode: import("@angular/core").InputSignal<boolean>;
36
38
  showDependencySection: import("@angular/core").Signal<boolean>;
37
39
  /** Tipos con opciones que no admiten origen externo (el motor solo lo resuelve para selectores, pool y radio). */
38
40
  private readonly manualOptionsOnly;
@@ -88,6 +90,9 @@ export declare class FieldEditorComponent {
88
90
  private prepareOptionsSourceField;
89
91
  private buildBranchFields;
90
92
  private prepareBranchField;
93
+ private isListVisibilityOperator;
94
+ /** Arreglo de valores sin vacíos ni repetidos; null si queda vacío. */
95
+ private normalizeListValue;
91
96
  private getAllowedVisibilityOperators;
92
97
  private getDependencyFieldType;
93
98
  private getBranchValueFieldType;
@@ -96,5 +101,5 @@ export declare class FieldEditorComponent {
96
101
  private buildComputedSourceFields;
97
102
  private buildExternalValidationFields;
98
103
  static ɵfac: i0.ɵɵFactoryDeclaration<FieldEditorComponent, never>;
99
- 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; }; "enableNameModify": { "alias": "enableNameModify"; "required": false; "isSignal": true; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "externalSources": { "alias": "externalSources"; "required": false; "isSignal": true; }; "visibilityRulesEnabled": { "alias": "visibilityRulesEnabled"; "required": false; "isSignal": true; }; "styleEnabled": { "alias": "styleEnabled"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "fieldChange": "fieldChange"; }, never, never, true, never>;
104
+ 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; }; "enableNameModify": { "alias": "enableNameModify"; "required": false; "isSignal": true; }; "readOnly": { "alias": "readOnly"; "required": false; "isSignal": true; }; "externalSources": { "alias": "externalSources"; "required": false; "isSignal": true; }; "visibilityRulesEnabled": { "alias": "visibilityRulesEnabled"; "required": false; "isSignal": true; }; "styleEnabled": { "alias": "styleEnabled"; "required": false; "isSignal": true; }; "surveyFieldMode": { "alias": "surveyFieldMode"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; }, { "fieldChange": "fieldChange"; }, never, never, true, never>;
100
105
  }
@@ -1,5 +1,6 @@
1
1
  import { ComputedFieldResolver, ExternalValidatorResolver, FormResult, FormSchema, SelectOptionsResolver } from '../../dynamic-form/form.models';
2
2
  import { SurveyAnimation, SurveyPageMode, SurveyTheme } from '../../survey/survey.models';
3
+ import { UicSurveyConfig } from '../../survey/survey.config';
3
4
  import * as i0 from "@angular/core";
4
5
  /** Cómo se muestra la vista previa del builder. */
5
6
  export type FormBuilderPreviewMode = 'form' | 'survey';
@@ -10,6 +11,8 @@ export interface FormBuilderSurveyPreviewOptions {
10
11
  /** @deprecated Sin efecto: la encuesta ya no avanza sola. */
11
12
  autoAdvance?: boolean;
12
13
  animation?: SurveyAnimation;
14
+ /** Textos y opciones de navegación (se combina con la configuración global de ui-survey). */
15
+ config?: UicSurveyConfig | null;
13
16
  }
14
17
  export interface FormPreviewData {
15
18
  schema: FormSchema;
@@ -19,7 +19,7 @@ import type { FormBuilderPreviewMode, FormBuilderSurveyPreviewOptions } from './
19
19
  * "visibilityRules": false,
20
20
  * "styleSection": false,
21
21
  * "limits": { "maxBlocks": 3, "maxFields": 20, "maxRepeaterFields": 5 },
22
- * "preview": { "mode": "survey", "survey": { "pageMode": "field" } }
22
+ * "preview": { "showButton": true, "mode": "survey", "survey": { "pageMode": "field" } }
23
23
  * }
24
24
  */
25
25
  export interface UicFormBuilderConfig {
@@ -74,6 +74,8 @@ export interface UicFormBuilderConfig {
74
74
  * (útiles si el modo debe cambiar en tiempo de ejecución, porque la config se lee una sola vez).
75
75
  */
76
76
  preview?: {
77
+ /** Muestra el botón "Vista previa" en la cabecera. Por defecto: true. */
78
+ showButton?: boolean;
77
79
  mode?: FormBuilderPreviewMode;
78
80
  survey?: FormBuilderSurveyPreviewOptions;
79
81
  };
@@ -99,6 +101,7 @@ export interface ResolvedFormBuilderConfig {
99
101
  limits: FormBuilderLimits;
100
102
  /** null = no definido en la config (se usan las entradas `previewMode` / `surveyPreviewOptions`). */
101
103
  preview: {
104
+ showButton: boolean;
102
105
  mode: FormBuilderPreviewMode | null;
103
106
  survey: FormBuilderSurveyPreviewOptions | null;
104
107
  };
@@ -60,6 +60,7 @@ export declare class UicUserFormbuilderComponent implements OnInit {
60
60
  private readonly modalService;
61
61
  private readonly host;
62
62
  private readonly tinyAlertService;
63
+ private readonly pushAlertService;
63
64
  private readonly translateService;
64
65
  disabled: boolean;
65
66
  /**
@@ -84,6 +85,8 @@ export declare class UicUserFormbuilderComponent implements OnInit {
84
85
  previewMode: import("@angular/core").InputSignal<FormBuilderPreviewMode>;
85
86
  /** Ajustes de la vista previa en modo encuesta. `config.preview.survey` tiene prioridad (ver previewMode). */
86
87
  surveyPreviewOptions: import("@angular/core").InputSignal<FormBuilderSurveyPreviewOptions | null>;
88
+ /** Vista previa como encuesta de una pregunta por página: habilita "samePage" en los campos. */
89
+ readonly surveyFieldMode: import("@angular/core").Signal<boolean>;
87
90
  editableFormInput: import("@angular/core").InputSignal<EditableForm>;
88
91
  submitFormRequest: import("@angular/core").OutputEmitterRef<EditableForm>;
89
92
  nextBlockId: number;
@@ -173,6 +176,9 @@ export declare class UicUserFormbuilderComponent implements OnInit {
173
176
  */
174
177
  private fingerprint;
175
178
  onSubFieldChange(updatedFieldData: FormField): void;
179
+ /** Tras limpiar reglas, la selección apunta a los objetos actualizados (mismo code). */
180
+ private syncSelectionAfterPruning;
181
+ private warnPrunedRules;
176
182
  startPropertiesResize(event: MouseEvent): void;
177
183
  onPropertiesResize(event: MouseEvent): void;
178
184
  stopPropertiesResize(): void;
@@ -0,0 +1,34 @@
1
+ import { FormField } from '../dynamic-form/form.models';
2
+ import { AppSelectOption } from '../inputs/select/select.component';
3
+ import type { EditableBlock } from './user-formbuilder.component';
4
+ /**
5
+ * Opciones manuales de un campo del que se puede depender: el editor de reglas las usa para
6
+ * mostrar un selector de valor (y su texto) en vez de pedir el id a mano. Con origen externo no hay lista fija.
7
+ */
8
+ export declare const dependencyValueOptions: (fieldData: FormField) => AppSelectOption[] | undefined;
9
+ /** Ids de opciones que tenía `before` y ya no tiene `after`. Vacío si `after` no tiene opciones manuales. */
10
+ export declare function removedOptionIds(before: FormField, after: FormField): Set<string>;
11
+ /** Qué campo cambió: uno raíz (por code) o un subcampo de un repetidor (code del padre + code del subcampo). */
12
+ export type PrunedFieldRef = {
13
+ kind: 'field';
14
+ code: string;
15
+ } | {
16
+ kind: 'subfield';
17
+ parentCode: string;
18
+ code: string;
19
+ };
20
+ export interface RulePruningResult {
21
+ blocks: EditableBlock[];
22
+ /** Reglas modificadas o eliminadas. */
23
+ changed: number;
24
+ }
25
+ /**
26
+ * Quita de las reglas de visibilidad las referencias a opciones eliminadas de un campo.
27
+ * - in / notIn: se quitan los ids eliminados del arreglo; si queda vacío, se elimina la regla.
28
+ * - equals / notEquals (e includes / notIncludes si el campo es multyselect): se elimina la regla
29
+ * si su valor era una opción eliminada.
30
+ * Alcance: un campo raíz puede ser referenciado por campos raíz y subcampos; un subcampo, solo por
31
+ * sus hermanos del mismo repetidor (los codes de subcampo se repiten entre repetidores).
32
+ * Devuelve los mismos objetos para lo que no cambió.
33
+ */
34
+ export declare function pruneRulesForRemovedOptions(blocks: EditableBlock[], ref: PrunedFieldRef, removedIds: Set<string>, changedFieldType: string | undefined): RulePruningResult;
@@ -279,6 +279,8 @@ export declare const DICTIONARY_EN: {
279
279
  readonly new_line: "New line";
280
280
  readonly col_span: "Column span";
281
281
  readonly col_span_tip: "How many columns the field occupies";
282
+ readonly same_page: "Same page as the previous one";
283
+ readonly same_page_tip: "Only in one-question-per-page surveys";
282
284
  };
283
285
  readonly extra: {
284
286
  readonly iconColor: "Icon color";
@@ -440,6 +442,7 @@ export declare const DICTIONARY_EN: {
440
442
  readonly operator: "Operator";
441
443
  readonly value: "Value";
442
444
  readonly expected_value: "Expected value";
445
+ readonly values: "Values";
443
446
  readonly style: "Style";
444
447
  readonly advanced: "Advanced";
445
448
  readonly duplicate: "Duplicate";
@@ -449,6 +452,7 @@ export declare const DICTIONARY_EN: {
449
452
  readonly subfields: "Sub-fields";
450
453
  readonly external_validation_title: "External validation";
451
454
  };
455
+ readonly rules_pruned: "{{count}} dependency rules were updated because they used removed options.";
452
456
  readonly visibility_operators: {
453
457
  readonly equals: "Equals";
454
458
  readonly notEquals: "Does not equal";
@@ -458,6 +462,8 @@ export declare const DICTIONARY_EN: {
458
462
  readonly notIncludes: "Does not include";
459
463
  readonly isEmpty: "Is empty";
460
464
  readonly isNotEmpty: "Is not empty";
465
+ readonly in: "Is any of";
466
+ readonly notIn: "Is none of";
461
467
  };
462
468
  readonly validation: {
463
469
  readonly duplicate_identifier: "The identifier \"{{identifier}}\" is used more than once.";
@@ -487,6 +493,11 @@ export declare const DICTIONARY_EN: {
487
493
  readonly label: "Other";
488
494
  readonly placeholder: "Please specify...";
489
495
  };
496
+ readonly chips_input: {
497
+ readonly placeholder: "Type and press Enter";
498
+ readonly remove: "Remove {{item}}";
499
+ readonly max_reached: "Maximum {{max}}";
500
+ };
490
501
  readonly distribution: {
491
502
  readonly total: "Total";
492
503
  readonly complete: "Complete";
@@ -279,6 +279,8 @@ export declare const DICTIONARY_ES: {
279
279
  readonly new_line: "Saltar línea";
280
280
  readonly col_span: "Ancho";
281
281
  readonly col_span_tip: "Cuantas columnas ocupa el campo";
282
+ readonly same_page: "Misma página que la anterior";
283
+ readonly same_page_tip: "Solo en encuestas de una pregunta por página";
282
284
  };
283
285
  readonly extra: {
284
286
  readonly iconColor: "Color de ícono externo";
@@ -440,6 +442,7 @@ export declare const DICTIONARY_ES: {
440
442
  readonly operator: "Operador";
441
443
  readonly value: "Valor";
442
444
  readonly expected_value: "Valor esperado";
445
+ readonly values: "Valores";
443
446
  readonly style: "Estilo";
444
447
  readonly advanced: "Avanzado";
445
448
  readonly duplicate: "Duplicar";
@@ -449,6 +452,7 @@ export declare const DICTIONARY_ES: {
449
452
  readonly subfields: "Sub-campos";
450
453
  readonly external_validation_title: "Validación externa";
451
454
  };
455
+ readonly rules_pruned: "Se actualizaron {{count}} reglas de dependencia porque usaban opciones eliminadas.";
452
456
  readonly visibility_operators: {
453
457
  readonly equals: "Es igual a";
454
458
  readonly notEquals: "No es igual a";
@@ -458,6 +462,8 @@ export declare const DICTIONARY_ES: {
458
462
  readonly notIncludes: "No incluye";
459
463
  readonly isEmpty: "Está vacío";
460
464
  readonly isNotEmpty: "No está vacío";
465
+ readonly in: "Es alguno de";
466
+ readonly notIn: "No es ninguno de";
461
467
  };
462
468
  readonly validation: {
463
469
  readonly duplicate_identifier: "El identificador \"{{identifier}}\" se está usando más de una vez.";
@@ -487,6 +493,11 @@ export declare const DICTIONARY_ES: {
487
493
  readonly label: "Otros";
488
494
  readonly placeholder: "Especifica...";
489
495
  };
496
+ readonly chips_input: {
497
+ readonly placeholder: "Escribe y presiona Enter";
498
+ readonly remove: "Quitar {{item}}";
499
+ readonly max_reached: "Máximo {{max}}";
500
+ };
490
501
  readonly distribution: {
491
502
  readonly total: "Total";
492
503
  readonly complete: "Completo";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui-core-abv",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "peerDependencies": {
5
5
  "@angular/common": ">=19.2.0 <22.0.0",
6
6
  "@angular/core": ">=19.2.0 <22.0.0",
package/public-api.d.ts CHANGED
@@ -25,6 +25,7 @@ export * from './lib/components/push-alerts/alert-container/alert-container.comp
25
25
  export * from './lib/components/inputs/ui-slider/ui-slider.component';
26
26
  export * from './lib/components/inputs/ui-scale/ui-scale.component';
27
27
  export * from './lib/components/inputs/ui-distribution/ui-distribution.component';
28
+ export * from './lib/components/inputs/ui-chips-input/ui-chips-input.component';
28
29
  export * from './lib/components/uic-action-button/uic-action-button.component';
29
30
  export * from './lib/components/signature-pad/signature-pad.component';
30
31
  export * from './lib/components/dropdown-container/dropdown-container.component';
@@ -65,6 +66,7 @@ export * from './lib/helpers';
65
66
  export * from './lib/components/survey/survey.component';
66
67
  export * from './lib/components/survey/survey.models';
67
68
  export * from './lib/components/survey/survey-templates.directive';
69
+ export * from './lib/components/survey/survey.config';
68
70
  export * from './lib/components/dynamic-form/form-engine.service';
69
71
  export * from './lib/components/dynamic-form/form-state.service';
70
72
  export * from './lib/components/dynamic-form/form-validators';