ui-core-abv 0.11.3 → 0.11.4
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 +421 -74
- package/fesm2022/ui-core-abv.mjs.map +1 -1
- package/lib/components/dynamic-form/form/dynamic-form.component.d.ts +9 -0
- package/lib/components/dynamic-form/form-engine.service.d.ts +6 -0
- package/lib/components/dynamic-form/form-validators.d.ts +12 -0
- package/lib/components/dynamic-form/form.models.d.ts +25 -1
- package/lib/components/dynamic-form/other-option.d.ts +34 -0
- package/lib/components/inputs/ui-distribution/ui-distribution.component.d.ts +55 -0
- package/lib/components/survey/survey.component.d.ts +1 -0
- package/lib/components/user-formbuilder/block-editor/field-editor/field-editor.component.d.ts +7 -1
- package/lib/translate/dictionary.en.d.ts +21 -0
- package/lib/translate/dictionary.es.d.ts +21 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -0
package/fesm2022/ui-core-abv.mjs
CHANGED
|
@@ -124,8 +124,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
124
124
|
type: Input
|
|
125
125
|
}] } });
|
|
126
126
|
|
|
127
|
-
const base$
|
|
128
|
-
class UicCheckboxComponent extends base$
|
|
127
|
+
const base$f = createValueAccessor();
|
|
128
|
+
class UicCheckboxComponent extends base$f {
|
|
129
129
|
icon = ''; // Icono externo
|
|
130
130
|
iconColor = 'black';
|
|
131
131
|
label = '';
|
|
@@ -465,6 +465,13 @@ const DICTIONARY_EN = {
|
|
|
465
465
|
visibility_summary: 'Visible if {{field}} {{operator}} {{value}}',
|
|
466
466
|
yes: 'Yes',
|
|
467
467
|
no: 'No',
|
|
468
|
+
other_option: {
|
|
469
|
+
enable: 'Include an "Other" (please specify) option',
|
|
470
|
+
enable_tip: 'Adds an Other option with a text to specify. The text is saved as <identifier>__other.',
|
|
471
|
+
label: 'Option text',
|
|
472
|
+
placeholder: 'Field placeholder',
|
|
473
|
+
required: 'Specifying is required when Other is chosen',
|
|
474
|
+
},
|
|
468
475
|
limits: {
|
|
469
476
|
fields_reached: 'The form already has the maximum of {{max}} fields',
|
|
470
477
|
blocks_reached: 'The maximum of {{max}} blocks has been reached',
|
|
@@ -706,6 +713,19 @@ const DICTIONARY_EN = {
|
|
|
706
713
|
subtitle_margin: 'Subtitle margin',
|
|
707
714
|
}
|
|
708
715
|
},
|
|
716
|
+
other_option: {
|
|
717
|
+
label: 'Other',
|
|
718
|
+
placeholder: 'Please specify...',
|
|
719
|
+
},
|
|
720
|
+
distribution: {
|
|
721
|
+
total: 'Total',
|
|
722
|
+
complete: 'Complete',
|
|
723
|
+
missing: '{{amount}}% left',
|
|
724
|
+
over: '{{amount}}% over',
|
|
725
|
+
clear: 'Clear',
|
|
726
|
+
fill_remaining: 'Assign the remaining {{remaining}}% to {{option}}',
|
|
727
|
+
no_options: 'This question has no options yet.',
|
|
728
|
+
},
|
|
709
729
|
validation: {
|
|
710
730
|
invalid: '{{field}} is invalid.',
|
|
711
731
|
required: '{{field}} is required.',
|
|
@@ -717,6 +737,7 @@ const DICTIONARY_EN = {
|
|
|
717
737
|
external_invalid: '{{field}} is not valid.',
|
|
718
738
|
min_selections: '{{field}}: choose at least {{min}} options.',
|
|
719
739
|
max_selections: '{{field}}: choose at most {{max}} options.',
|
|
740
|
+
distribution_total: '{{field}} must add up to {{expected}}% (currently {{total}}%).',
|
|
720
741
|
},
|
|
721
742
|
clipboard: {
|
|
722
743
|
copy_error: 'Could not copy:',
|
|
@@ -960,6 +981,13 @@ const DICTIONARY_ES = {
|
|
|
960
981
|
visibility_summary: 'Visible si {{field}} {{operator}} {{value}}',
|
|
961
982
|
yes: 'Sí',
|
|
962
983
|
no: 'No',
|
|
984
|
+
other_option: {
|
|
985
|
+
enable: 'Incluir opción «Otros» (especifica)',
|
|
986
|
+
enable_tip: 'Agrega la opción Otros con un texto para especificar. El texto se guarda en <identificador>__other.',
|
|
987
|
+
label: 'Texto de la opción',
|
|
988
|
+
placeholder: 'Texto de ayuda del campo',
|
|
989
|
+
required: 'Especificar es obligatorio al elegir Otros',
|
|
990
|
+
},
|
|
963
991
|
limits: {
|
|
964
992
|
fields_reached: 'Se alcanzó el máximo de {{max}} campos del formulario',
|
|
965
993
|
blocks_reached: 'Se alcanzó el máximo de {{max}} bloques',
|
|
@@ -1201,6 +1229,19 @@ const DICTIONARY_ES = {
|
|
|
1201
1229
|
subtitle_margin: 'Margen subtítulo',
|
|
1202
1230
|
}
|
|
1203
1231
|
},
|
|
1232
|
+
other_option: {
|
|
1233
|
+
label: 'Otros',
|
|
1234
|
+
placeholder: 'Especifica...',
|
|
1235
|
+
},
|
|
1236
|
+
distribution: {
|
|
1237
|
+
total: 'Total',
|
|
1238
|
+
complete: 'Completo',
|
|
1239
|
+
missing: 'Faltan {{amount}}%',
|
|
1240
|
+
over: 'Sobran {{amount}}%',
|
|
1241
|
+
clear: 'Limpiar',
|
|
1242
|
+
fill_remaining: 'Asignar el {{remaining}}% restante a {{option}}',
|
|
1243
|
+
no_options: 'Esta pregunta aún no tiene opciones.',
|
|
1244
|
+
},
|
|
1204
1245
|
validation: {
|
|
1205
1246
|
invalid: '{{field}} es invalido.',
|
|
1206
1247
|
required: '{{field}} es obligatorio.',
|
|
@@ -1212,6 +1253,7 @@ const DICTIONARY_ES = {
|
|
|
1212
1253
|
external_invalid: '{{field}} no es válido.',
|
|
1213
1254
|
min_selections: '{{field}}: elige al menos {{min}} opciones.',
|
|
1214
1255
|
max_selections: '{{field}}: elige como máximo {{max}} opciones.',
|
|
1256
|
+
distribution_total: '{{field}} debe sumar {{expected}}% (ahora suma {{total}}%).',
|
|
1215
1257
|
},
|
|
1216
1258
|
clipboard: {
|
|
1217
1259
|
copy_error: 'No se pudo copiar:',
|
|
@@ -1525,8 +1567,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1525
1567
|
args: [{ providedIn: 'root' }]
|
|
1526
1568
|
}] });
|
|
1527
1569
|
|
|
1528
|
-
const base$
|
|
1529
|
-
class UicDatePickerComponent extends base$
|
|
1570
|
+
const base$e = createValueAccessor();
|
|
1571
|
+
class UicDatePickerComponent extends base$e {
|
|
1530
1572
|
icon = ''; // Icono externo
|
|
1531
1573
|
iconColor = 'black';
|
|
1532
1574
|
internalIcon = ''; //Icono interno
|
|
@@ -2000,10 +2042,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2000
2042
|
args: ['calendarTemplate']
|
|
2001
2043
|
}] } });
|
|
2002
2044
|
|
|
2003
|
-
let nextId$
|
|
2045
|
+
let nextId$2 = 1;
|
|
2004
2046
|
function createSuccessAlert(message, options) {
|
|
2005
2047
|
return {
|
|
2006
|
-
id: nextId$
|
|
2048
|
+
id: nextId$2++,
|
|
2007
2049
|
message,
|
|
2008
2050
|
icon: 'ri-check-line',
|
|
2009
2051
|
showProgressBar: true,
|
|
@@ -2014,7 +2056,7 @@ function createSuccessAlert(message, options) {
|
|
|
2014
2056
|
}
|
|
2015
2057
|
function createErrorAlert(message, options) {
|
|
2016
2058
|
return {
|
|
2017
|
-
id: nextId$
|
|
2059
|
+
id: nextId$2++,
|
|
2018
2060
|
message,
|
|
2019
2061
|
showProgressBar: true,
|
|
2020
2062
|
type: 'error',
|
|
@@ -2025,7 +2067,7 @@ function createErrorAlert(message, options) {
|
|
|
2025
2067
|
}
|
|
2026
2068
|
function createWarningAlert(message, options) {
|
|
2027
2069
|
return {
|
|
2028
|
-
id: nextId$
|
|
2070
|
+
id: nextId$2++,
|
|
2029
2071
|
message,
|
|
2030
2072
|
showProgressBar: true,
|
|
2031
2073
|
type: 'warning',
|
|
@@ -2036,7 +2078,7 @@ function createWarningAlert(message, options) {
|
|
|
2036
2078
|
}
|
|
2037
2079
|
function createInfoAlert(message, options) {
|
|
2038
2080
|
return {
|
|
2039
|
-
id: nextId$
|
|
2081
|
+
id: nextId$2++,
|
|
2040
2082
|
showProgressBar: true,
|
|
2041
2083
|
message,
|
|
2042
2084
|
icon: 'ri-information-2-line',
|
|
@@ -2076,8 +2118,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2076
2118
|
}]
|
|
2077
2119
|
}] });
|
|
2078
2120
|
|
|
2079
|
-
const base$
|
|
2080
|
-
class UicFileInputComponent extends base$
|
|
2121
|
+
const base$d = createValueAccessor();
|
|
2122
|
+
class UicFileInputComponent extends base$d {
|
|
2081
2123
|
icon = ''; // Icono externo
|
|
2082
2124
|
iconColor = 'black';
|
|
2083
2125
|
internalIcon = ''; //Icono interno
|
|
@@ -2405,8 +2447,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2405
2447
|
type: Input
|
|
2406
2448
|
}] } });
|
|
2407
2449
|
|
|
2408
|
-
const base$
|
|
2409
|
-
class UicMultySelectComponent extends base$
|
|
2450
|
+
const base$c = createValueAccessor();
|
|
2451
|
+
class UicMultySelectComponent extends base$c {
|
|
2410
2452
|
icon = ''; // Icono externo
|
|
2411
2453
|
iconColor = 'black'; //color de ícono externo
|
|
2412
2454
|
internalIcon = ''; //Icono interno
|
|
@@ -2632,8 +2674,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2632
2674
|
args: [{ providedIn: 'root' }]
|
|
2633
2675
|
}] });
|
|
2634
2676
|
|
|
2635
|
-
const base$
|
|
2636
|
-
class UicMultySearcherComponent extends base$
|
|
2677
|
+
const base$b = createValueAccessor();
|
|
2678
|
+
class UicMultySearcherComponent extends base$b {
|
|
2637
2679
|
icon = ''; // Icono externo
|
|
2638
2680
|
iconColor = 'black'; //color de ícono externo
|
|
2639
2681
|
internalIcon = 'ri-search-2-line'; //Icono interno
|
|
@@ -2809,8 +2851,8 @@ const PHONE_COUNTRIES = [
|
|
|
2809
2851
|
{ name: 'Venezuela', iso2: 've', dialCode: '58' }
|
|
2810
2852
|
];
|
|
2811
2853
|
|
|
2812
|
-
const base$
|
|
2813
|
-
class UicPhoneInputComponent extends base$
|
|
2854
|
+
const base$a = createValueAccessor();
|
|
2855
|
+
class UicPhoneInputComponent extends base$a {
|
|
2814
2856
|
icon = '';
|
|
2815
2857
|
iconColor = 'black';
|
|
2816
2858
|
internalIcon = '';
|
|
@@ -3226,8 +3268,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3226
3268
|
args: ['pointerdown']
|
|
3227
3269
|
}] } });
|
|
3228
3270
|
|
|
3229
|
-
const base$
|
|
3230
|
-
class UicSearcherComponent extends base$
|
|
3271
|
+
const base$9 = createValueAccessor();
|
|
3272
|
+
class UicSearcherComponent extends base$9 {
|
|
3231
3273
|
icon = ''; // Icono externo
|
|
3232
3274
|
iconColor = 'black'; //color de ícono externo
|
|
3233
3275
|
internalIcon = 'ri-search-2-line'; //Icono interno
|
|
@@ -3378,8 +3420,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3378
3420
|
args: ['dropdownTemplate']
|
|
3379
3421
|
}] } });
|
|
3380
3422
|
|
|
3381
|
-
const base$
|
|
3382
|
-
class UicSelectComponent extends base$
|
|
3423
|
+
const base$8 = createValueAccessor();
|
|
3424
|
+
class UicSelectComponent extends base$8 {
|
|
3383
3425
|
icon = ''; // Icono externo
|
|
3384
3426
|
iconColor = 'black';
|
|
3385
3427
|
internalIcon = ''; //Icono interno
|
|
@@ -3701,8 +3743,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3701
3743
|
args: ['dropdownTemplate']
|
|
3702
3744
|
}] } });
|
|
3703
3745
|
|
|
3704
|
-
const base$
|
|
3705
|
-
class UicSliderComponent extends base$
|
|
3746
|
+
const base$7 = createValueAccessor();
|
|
3747
|
+
class UicSliderComponent extends base$7 {
|
|
3706
3748
|
icon = ''; // Icono externo
|
|
3707
3749
|
iconColor = 'black';
|
|
3708
3750
|
label = '';
|
|
@@ -3802,8 +3844,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3802
3844
|
args: ['document:mouseup']
|
|
3803
3845
|
}] } });
|
|
3804
3846
|
|
|
3805
|
-
const base$
|
|
3806
|
-
class UicRadioComponent extends base$
|
|
3847
|
+
const base$6 = createValueAccessor();
|
|
3848
|
+
class UicRadioComponent extends base$6 {
|
|
3807
3849
|
icon = '';
|
|
3808
3850
|
iconColor = 'black';
|
|
3809
3851
|
label = '';
|
|
@@ -3871,7 +3913,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3871
3913
|
type: Input
|
|
3872
3914
|
}] } });
|
|
3873
3915
|
|
|
3874
|
-
const base$
|
|
3916
|
+
const base$5 = createValueAccessor();
|
|
3875
3917
|
/** Máximo de puntos de una escala, para que siga siendo usable. */
|
|
3876
3918
|
const MAX_POINTS = 21;
|
|
3877
3919
|
/**
|
|
@@ -3879,7 +3921,7 @@ const MAX_POINTS = 21;
|
|
|
3879
3921
|
* Valor: el número elegido, o null. Se maneja con teclado como un grupo de radios
|
|
3880
3922
|
* (flechas, Inicio, Fin) y anuncia cada punto con su leyenda.
|
|
3881
3923
|
*/
|
|
3882
|
-
class UicScaleComponent extends base$
|
|
3924
|
+
class UicScaleComponent extends base$5 {
|
|
3883
3925
|
host = inject(ElementRef);
|
|
3884
3926
|
icon = '';
|
|
3885
3927
|
iconColor = 'black';
|
|
@@ -4010,6 +4052,184 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
4010
4052
|
type: Input
|
|
4011
4053
|
}] } });
|
|
4012
4054
|
|
|
4055
|
+
/** Tipos cuyo valor es una lista de opciones elegidas. */
|
|
4056
|
+
const MULTI_SELECTION_TYPES = new Set(['multyselect', 'pool']);
|
|
4057
|
+
/**
|
|
4058
|
+
* Valida la cantidad de opciones elegidas (multyselect y pool múltiple).
|
|
4059
|
+
* Un valor vacío no falla por mínimo: para exigir al menos una respuesta se usa `required`.
|
|
4060
|
+
* Errores: { minSelections: { min, actual } } y { maxSelections: { max, actual } }.
|
|
4061
|
+
*/
|
|
4062
|
+
function uicSelectionCountValidator(min, max) {
|
|
4063
|
+
return (control) => {
|
|
4064
|
+
const value = control.value;
|
|
4065
|
+
const actual = Array.isArray(value) ? value.length : 0;
|
|
4066
|
+
if (actual === 0)
|
|
4067
|
+
return null;
|
|
4068
|
+
if (typeof min === 'number' && min > 0 && actual < min) {
|
|
4069
|
+
return { minSelections: { min, actual } };
|
|
4070
|
+
}
|
|
4071
|
+
if (typeof max === 'number' && max > 0 && actual > max) {
|
|
4072
|
+
return { maxSelections: { max, actual } };
|
|
4073
|
+
}
|
|
4074
|
+
return null;
|
|
4075
|
+
};
|
|
4076
|
+
}
|
|
4077
|
+
/** Validadores de selección que corresponden al campo (vacío si no aplica). */
|
|
4078
|
+
function uicSelectionValidatorsFor(field) {
|
|
4079
|
+
if (!MULTI_SELECTION_TYPES.has(field.type))
|
|
4080
|
+
return [];
|
|
4081
|
+
if (field.type === 'pool' && !field.multyEnabled)
|
|
4082
|
+
return [];
|
|
4083
|
+
const hasMin = typeof field.minSelections === 'number' && field.minSelections > 0;
|
|
4084
|
+
const hasMax = typeof field.maxSelections === 'number' && field.maxSelections > 0;
|
|
4085
|
+
return hasMin || hasMax ? [uicSelectionCountValidator(field.minSelections, field.maxSelections)] : [];
|
|
4086
|
+
}
|
|
4087
|
+
/** Total que debe sumar una pregunta de distribución porcentual. */
|
|
4088
|
+
const UIC_DISTRIBUTION_TOTAL = 100;
|
|
4089
|
+
/** Suma de los porcentajes de un valor de distribución (ignora ítems inválidos). */
|
|
4090
|
+
function uicDistributionSum(value) {
|
|
4091
|
+
if (!Array.isArray(value))
|
|
4092
|
+
return 0;
|
|
4093
|
+
return value.reduce((sum, item) => {
|
|
4094
|
+
const amount = Number(item?.value);
|
|
4095
|
+
return Number.isFinite(amount) ? sum + amount : sum;
|
|
4096
|
+
}, 0);
|
|
4097
|
+
}
|
|
4098
|
+
/**
|
|
4099
|
+
* Distribución porcentual: si hay respuesta, debe sumar exactamente 100.
|
|
4100
|
+
* Un valor vacío (null o todo en 0) no falla: para exigir respuesta se usa `required`.
|
|
4101
|
+
* Error: { distributionTotal: { total, expected } }.
|
|
4102
|
+
*/
|
|
4103
|
+
function uicDistributionTotalValidator(expected = UIC_DISTRIBUTION_TOTAL) {
|
|
4104
|
+
return (control) => {
|
|
4105
|
+
const total = uicDistributionSum(control.value);
|
|
4106
|
+
if (total === 0 || total === expected)
|
|
4107
|
+
return null;
|
|
4108
|
+
return { distributionTotal: { total, expected } };
|
|
4109
|
+
};
|
|
4110
|
+
}
|
|
4111
|
+
/** Validadores de distribución que corresponden al campo (vacío si no aplica). */
|
|
4112
|
+
function uicDistributionValidatorsFor(field) {
|
|
4113
|
+
return field.type === 'distribution' ? [uicDistributionTotalValidator()] : [];
|
|
4114
|
+
}
|
|
4115
|
+
|
|
4116
|
+
const base$4 = createValueAccessor();
|
|
4117
|
+
let nextId$1 = 0;
|
|
4118
|
+
/**
|
|
4119
|
+
* Distribución porcentual: el usuario reparte el 100% entre las opciones.
|
|
4120
|
+
* Valor: [{ id, value }] con un ítem por opción (en su orden), o null si no asignó nada.
|
|
4121
|
+
* Los porcentajes son enteros entre 0 y 100; la validación de que sumen 100 está en el formulario
|
|
4122
|
+
* (uicDistributionTotalValidator), este componente solo muestra el total y cuánto falta o sobra.
|
|
4123
|
+
*/
|
|
4124
|
+
class UicDistributionComponent extends base$4 {
|
|
4125
|
+
host = inject(ElementRef);
|
|
4126
|
+
uid = `uic-distribution-${nextId$1++}`;
|
|
4127
|
+
expected = UIC_DISTRIBUTION_TOTAL;
|
|
4128
|
+
icon = '';
|
|
4129
|
+
iconColor = 'black';
|
|
4130
|
+
label = '';
|
|
4131
|
+
error = '';
|
|
4132
|
+
tip = '';
|
|
4133
|
+
disabled = false;
|
|
4134
|
+
options = [];
|
|
4135
|
+
/** Opciones con id utilizable (una opción sin id no se puede guardar en el valor). */
|
|
4136
|
+
get validOptions() {
|
|
4137
|
+
return (this.options ?? []).filter((opt) => opt?.id !== null && opt?.id !== undefined && opt.id !== '');
|
|
4138
|
+
}
|
|
4139
|
+
get total() {
|
|
4140
|
+
return uicDistributionSum(this.value);
|
|
4141
|
+
}
|
|
4142
|
+
/** Lo que falta para llegar a 100 (negativo si se pasó). */
|
|
4143
|
+
get remaining() {
|
|
4144
|
+
return this.expected - this.total;
|
|
4145
|
+
}
|
|
4146
|
+
amountOf(option) {
|
|
4147
|
+
const item = this.value?.find(entry => String(entry.id) === String(option.id));
|
|
4148
|
+
const amount = Number(item?.value);
|
|
4149
|
+
return Number.isFinite(amount) ? amount : 0;
|
|
4150
|
+
}
|
|
4151
|
+
onInput(option, event) {
|
|
4152
|
+
const input = event.target;
|
|
4153
|
+
const parsed = Math.round(Number(input.value));
|
|
4154
|
+
const amount = Number.isFinite(parsed) ? Math.min(Math.max(parsed, 0), this.expected) : 0;
|
|
4155
|
+
// Si se corrigió (fuera de rango o decimal), se refleja en el input.
|
|
4156
|
+
if (input.value !== '' && String(amount) !== input.value)
|
|
4157
|
+
input.value = String(amount);
|
|
4158
|
+
this.setAmount(option, amount);
|
|
4159
|
+
}
|
|
4160
|
+
/** Asigna a esta opción todo lo que falta para llegar a 100. */
|
|
4161
|
+
fillRemaining(option) {
|
|
4162
|
+
if (this.disabled || this.remaining <= 0)
|
|
4163
|
+
return;
|
|
4164
|
+
this.setAmount(option, this.amountOf(option) + this.remaining);
|
|
4165
|
+
}
|
|
4166
|
+
clear() {
|
|
4167
|
+
if (this.disabled || this.value === null)
|
|
4168
|
+
return;
|
|
4169
|
+
this.notifyChange(null);
|
|
4170
|
+
}
|
|
4171
|
+
/** Foco dentro del grupo: mientras se reparte, el total ya indica cuánto falta y no se muestra el error. */
|
|
4172
|
+
hasFocus = false;
|
|
4173
|
+
get displayedError() {
|
|
4174
|
+
return this.hasFocus ? '' : this.error;
|
|
4175
|
+
}
|
|
4176
|
+
onFocusIn() {
|
|
4177
|
+
this.hasFocus = true;
|
|
4178
|
+
}
|
|
4179
|
+
onFocusOut(event) {
|
|
4180
|
+
const next = event.relatedTarget;
|
|
4181
|
+
if (!next || !this.host.nativeElement.contains(next)) {
|
|
4182
|
+
this.hasFocus = false;
|
|
4183
|
+
this.onTouched();
|
|
4184
|
+
}
|
|
4185
|
+
}
|
|
4186
|
+
inputId(index) {
|
|
4187
|
+
return `${this.uid}-${index}`;
|
|
4188
|
+
}
|
|
4189
|
+
setAmount(option, amount) {
|
|
4190
|
+
if (this.disabled)
|
|
4191
|
+
return;
|
|
4192
|
+
const next = this.validOptions.map(opt => ({
|
|
4193
|
+
id: opt.id,
|
|
4194
|
+
value: String(opt.id) === String(option.id) ? amount : this.amountOf(opt)
|
|
4195
|
+
}));
|
|
4196
|
+
// Sin nada asignado equivale a sin respuesta (así `required` funciona como en el resto de tipos).
|
|
4197
|
+
this.notifyChange(next.some(item => item.value > 0) ? next : null);
|
|
4198
|
+
}
|
|
4199
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicDistributionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4200
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: UicDistributionComponent, isStandalone: true, selector: "ui-distribution", inputs: { icon: "icon", iconColor: "iconColor", label: "label", error: "error", tip: "tip", disabled: "disabled", options: "options" }, providers: [
|
|
4201
|
+
{
|
|
4202
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4203
|
+
useExisting: forwardRef(() => UicDistributionComponent),
|
|
4204
|
+
multi: true
|
|
4205
|
+
}
|
|
4206
|
+
], usesInheritance: true, ngImport: i0, template: "<ui-input-wrapper\n [icon]=\"icon\"\n [iconColor]=\"iconColor\"\n [label]=\"label\"\n [error]=\"displayedError\"\n [tip]=\"tip\"\n [disabled]=\"disabled\">\n <div\n class=\"dist\"\n role=\"group\"\n [class.dist--disabled]=\"disabled\"\n [class.dist--error]=\"!!displayedError\"\n [attr.aria-label]=\"label || null\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\">\n @for (option of validOptions; track option.id; let i = $index) {\n @let amount = amountOf(option);\n <div class=\"dist-row\" [class.has-value]=\"amount > 0\">\n <label class=\"dist-label\" [for]=\"inputId(i)\">\n @if (option.icon) {\n <i class=\"dist-option-icon {{ option.icon }} f-{{ option.iconColor || 'black' }}\" aria-hidden=\"true\"></i>\n }\n <span>{{ option.text | uicTranslate }}</span>\n </label>\n <div class=\"dist-bar\" aria-hidden=\"true\">\n <span class=\"dist-bar-fill\" [style.width.%]=\"amount\"></span>\n </div>\n <div class=\"dist-input\">\n <input\n type=\"number\"\n inputmode=\"numeric\"\n min=\"0\"\n [max]=\"expected\"\n step=\"1\"\n placeholder=\"0\"\n [id]=\"inputId(i)\"\n [value]=\"amount || ''\"\n [disabled]=\"disabled\"\n (input)=\"onInput(option, $event)\">\n <span class=\"dist-unit\" aria-hidden=\"true\">%</span>\n </div>\n @if (!disabled && remaining > 0) {\n <button\n type=\"button\"\n class=\"dist-fill\"\n [attr.aria-label]=\"'distribution.fill_remaining' | uicTranslate: { remaining: remaining, option: (option.text | uicTranslate) }\"\n [title]=\"'distribution.fill_remaining' | uicTranslate: { remaining: remaining, option: (option.text | uicTranslate) }\"\n (click)=\"fillRemaining(option)\">+{{ remaining }}</button>\n } @else {\n <span class=\"dist-fill-spacer\" aria-hidden=\"true\"></span>\n }\n </div>\n } @empty {\n <p class=\"dist-empty\">{{ 'distribution.no_options' | uicTranslate }}</p>\n }\n\n @if (validOptions.length) {\n <div\n class=\"dist-total\"\n aria-live=\"polite\"\n [class.is-complete]=\"total === expected\"\n [class.is-over]=\"total > expected\">\n <span class=\"dist-total-label\">{{ 'distribution.total' | uicTranslate }}</span>\n <b class=\"dist-total-value\">{{ total }}%</b>\n <span class=\"dist-total-status\">\n @if (total === expected) {\n <i class=\"ri-checkbox-circle-fill\" aria-hidden=\"true\"></i>\n {{ 'distribution.complete' | uicTranslate }}\n } @else if (total > expected) {\n {{ 'distribution.over' | uicTranslate: { amount: total - expected } }}\n } @else {\n {{ 'distribution.missing' | uicTranslate: { amount: remaining } }}\n }\n </span>\n @if (!disabled && total > 0) {\n <button type=\"button\" class=\"dist-clear\" (click)=\"clear()\">{{ 'distribution.clear' | uicTranslate }}</button>\n }\n </div>\n }\n </div>\n</ui-input-wrapper>\n", styles: [".dist{display:flex;flex-direction:column;gap:var(--uic-distribution-gap, 8px);width:100%;padding:2px 0}.dist-row{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(40px,1fr) var(--uic-distribution-input-width, 72px) 44px;align-items:center;gap:10px}.dist-label{display:flex;align-items:center;gap:6px;min-width:0;font-size:.875rem;color:var(--uic-neutral-800, var(--grey-800));cursor:pointer}.dist-label span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dist-option-icon{flex:0 0 auto;font-size:16px}.dist-bar{height:8px;border-radius:4px;background-color:var(--uic-distribution-bar-bg, var(--uic-neutral-100, var(--grey-100)));overflow:hidden}.dist-bar-fill{display:block;height:100%;border-radius:inherit;background-color:var(--uic-distribution-bar-fill, var(--primary-500));transition:width .2s ease}.dist-input{position:relative;display:flex;align-items:center}.dist-input input{width:100%;height:calc(4 * var(--form-ref));padding:0 22px 0 8px;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:var(--input-radius);background-color:var(--uic-surface, var(--white));color:var(--uic-neutral-800, var(--grey-800));font:inherit;text-align:right;-moz-appearance:textfield;appearance:textfield}.dist-input input::-webkit-outer-spin-button,.dist-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.dist-input input:focus{outline:none;border-color:var(--primary-500)}.dist-input input:disabled{background-color:var(--uic-neutral-50, var(--grey-50));color:var(--uic-neutral-500, var(--grey-500));cursor:not-allowed}.dist-unit{position:absolute;right:8px;font-size:.875rem;color:var(--uic-neutral-500, var(--grey-500));pointer-events:none}.dist-fill{height:26px;padding:0 6px;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:13px;background:var(--uic-surface, var(--white));color:var(--primary-600);font-size:11px;font-weight:600;cursor:pointer;opacity:0;transition:opacity .15s ease}.dist-fill:hover{border-color:var(--primary-400)}.dist-fill:focus-visible{opacity:1;outline:solid 2px var(--primary-400);outline-offset:1px}.dist-row:hover .dist-fill,.dist-row:focus-within .dist-fill{opacity:1}@media (hover: none){.dist-fill{opacity:1}}.dist-total{display:flex;align-items:center;gap:8px;padding-top:8px;border-top:solid 1px var(--uic-neutral-200, var(--grey-200));font-size:.875rem;color:var(--uic-neutral-500, var(--grey-500))}.dist-total-value{font-size:15px;color:var(--uic-neutral-800, var(--grey-800))}.dist-total-status{display:inline-flex;align-items:center;gap:4px}.dist-total.is-complete .dist-total-value,.dist-total.is-complete .dist-total-status{color:var(--uic-distribution-complete-color, var(--green-600))}.dist-total.is-over .dist-total-value,.dist-total.is-over .dist-total-status{color:var(--uic-distribution-over-color, var(--red-600))}.dist-clear{margin-left:auto;border:none;background:none;color:var(--uic-neutral-500, var(--grey-500));font-size:12px;text-decoration:underline;cursor:pointer}.dist-clear:hover{color:var(--uic-neutral-800, var(--grey-800))}.dist--error .dist-total:not(.is-complete) .dist-total-value{color:var(--uic-distribution-over-color, var(--red-600))}.dist-empty{font-size:.875rem;color:var(--uic-neutral-500, var(--grey-500))}@media (max-width: 480px){.dist-row{grid-template-columns:minmax(0,1fr) var(--uic-distribution-input-width, 72px) 44px;grid-template-areas:\"label input fill\" \"bar bar bar\";row-gap:4px}.dist-label{grid-area:label}.dist-input{grid-area:input}.dist-fill,.dist-fill-spacer{grid-area:fill}.dist-bar{grid-area:bar}}.f-primary{color:var(--primary-500)}.f-secondary{color:var(--secondary-500)}.f-red{color:var(--red-500)}.f-yellow{color:var(--yellow-500)}.f-blue{color:var(--blue-500)}.f-green{color:var(--green-500)}.f-grey{color:var(--uic-neutral-400, var(--grey-400))}.f-black{color:var(--uic-neutral-900, var(--grey-900))}.f-dark-green{color:var(--dark-green-500)}.f-light-blue{color:var(--light-blue-500)}.f-pink{color:var(--pink-500)}.f-dark-red{color:var(--dark-red-500)}.f-orange{color:var(--orange-500)}.f-teal{color:var(--teal-500)}\n", ":host{width:100%}.input-container{flex:1 1;overflow:hidden}.f-extralight{font-weight:300;color:var(--uic-neutral-500, var(--grey-500))}.input-options{border-radius:var(--input-radius);background-color:var(--uic-overlay-bg, var(--uic-surface, var(--white)));box-shadow:var(--uic-overlay-shadow, var(--uic-shadow-sm, 0 1px 1px 0 rgba(0, 0, 0, .1254901961), 0 2px 5px 0 rgba(0, 0, 0, .3137254902)));width:100%;top:100%;font-size:var(--uic-option-font-size, .875rem);z-index:500;overflow:hidden;display:flex;flex-direction:column}.option-divider{width:98%;margin:auto;border-bottom:1px solid var(--uic-neutral-200, var(--grey-200))}.option-group-header{padding:.25rem .5rem 2px;font-size:.75rem;font-weight:600;color:var(--uic-neutral-500, var(--grey-500));text-transform:uppercase;letter-spacing:.05em;pointer-events:none;-webkit-user-select:none;user-select:none}.option-group-header:not(:first-child){border-top:1px solid var(--uic-neutral-200, var(--grey-200));margin-top:.25rem}.input-option{display:flex;align-items:center;padding:6px 12px;line-height:1rem;-webkit-user-select:none;user-select:none;transition:ease .3s;border-radius:.25rem}.input-option-focused{background-color:var(--uic-option-hover-bg, var(--uic-surface-hover, var(--secondary-100)))}.input-option:hover{background-color:var(--uic-option-hover-bg, var(--uic-surface-hover, var(--secondary-100)));cursor:pointer}.input-option-disabled{opacity:.55;cursor:not-allowed}.input-option-disabled:hover{background-color:transparent;cursor:not-allowed}.input-option-scroll{padding:.25rem;max-height:180px;overflow:auto}.input-option-scroll-line{border-bottom:solid 1px var(--uic-neutral-200, var(--grey-200));width:100%;margin-top:2px}.input-option-scroll-focused{background-color:var(--primary-300)}.input-option-scroll-btns{border-top:solid 1px var(--uic-neutral-200, var(--grey-200));padding-top:5px;display:flex;justify-content:space-around}.input-option-scroll-btns button{background-color:var(--uic-surface, var(--white));border:solid 1px var(--uic-neutral-200, var(--grey-200));padding:4px 10px;border-radius:10px}.input-option-scroll app-checkbox{width:100%}.input-wrapper{display:flex;align-items:center;width:100%;max-width:100%}.input-externalicon{margin-right:.5rem;font-size:1.625rem;height:1.625rem;width:1.625rem}.input-elements{flex-grow:1;display:flex;flex-direction:column;width:100%}.input-internalicon{color:var(--uic-neutral-700, var(--grey-700));margin-right:calc(var(--form-ref) * .6);font-size:calc(2.5 * var(--form-ref))}.label{font-size:var(--uic-label-font-size, max(var(--form-ref) + 4px, 14px));line-height:var(--uic-label-line-height, 1.125rem);min-height:var(--uic-label-line-height, 1.125rem);font-weight:var(--uic-label-font-weight, 400);color:var(--uic-label-color, var(--uic-neutral-950, var(--grey-950)));margin-bottom:var(--input-label-space)}.disabled-placeholder{color:var(--disabled-color-placeholder)}.fakeinput{min-height:calc(4 * var(--form-ref));border-radius:var(--input-radius);overflow:hidden;border:solid var(--uic-input-border-width, 1px) var(--uic-input-border-color, var(--uic-neutral-200, var(--grey-200)));display:flex;align-items:center;font-size:.875rem;-webkit-user-select:none;user-select:none;background-color:var(--uic-input-bg, var(--uic-surface, var(--white)));transition:ease .3s;padding:0 var(--form-ref)}.fakeinput-wrapp{position:relative}.fakeinput-emptytext{margin:0 5px;flex:1 1;overflow:hidden;font-size:var(--uic-input-font-size, max(var(--form-ref) + 4px, 14px));white-space:nowrap}.fakeinput-emptytext i{font-size:20px}.fakeinput ::ng-deep textarea{padding:10px 0}.fakeinput ::ng-deep input{height:calc(4 * var(--form-ref));padding:0}.fakeinput ::ng-deep input,.fakeinput ::ng-deep textarea{font-size:var(--uic-input-font-size, max(var(--form-ref) + 4px, 14px));flex-grow:1;outline:none;width:100%;background-color:transparent;border:none!important}.fakeinput ::ng-deep input:disabled,.fakeinput ::ng-deep textarea:disabled{color:var(--disabled-color)}.fakeinput ::ng-deep input:disabled~.fakeinput,.fakeinput ::ng-deep textarea:disabled~.fakeinput{background-color:var(--disabled-background);color:var(--disabled-color)}.fakeinput ::ng-deep input:disabled::placeholder,.fakeinput ::ng-deep textarea:disabled::placeholder{color:var(--disabled-color-placeholder)}.fakeinput-button{margin:0;border:none;display:flex;justify-content:center;align-items:center;padding:4px 5px 5px;transition:ease .3s;background-color:var(--uic-neutral-200, var(--grey-200))}.fakeinput-button:disabled{background-color:var(--disabled-background);color:var(--disabled-color)}.fakeinput-button:enabled:hover{cursor:pointer;background-color:var(--primary-300);color:var(--white)}.fakeinput-button:enabled:active{background-color:var(--primary-700)}.fakeinput app-checkbox{width:100%}.fakeinput-alert{font-size:13px;line-height:15px;padding:1px 4px}.fakeinput button{color:var(--uic-neutral-200, var(--grey-200))}.fakeinput:focus-within{box-shadow:var(--uic-focus-shadow, 0 0 0 3px var(--secondary-alpha))}.fakeinput:hover{border-color:var(--uic-input-border-color-hover, var(--uic-neutral-400, var(--grey-400)));cursor:text}.activeselect{border-color:var(--uic-input-border-color-active, var(--primary-600))}.errorinput{border-color:var(--uic-error-color, var(--red-500))!important}.t-disabled{color:var(--disabled-color);padding:5px;text-align:center}.disabledinput{background-color:var(--disabled-background);color:var(--disabled-color)}.disabledinput ::ng-deep input{color:var(--disabled-color)}.inputlabel{display:flex;align-items:center}.f-primary{color:var(--primary-500)}.f-secondary{color:var(--secondary-500)}.f-red{color:var(--red-500)}.f-yellow{color:var(--yellow-500)}.f-blue{color:var(--blue-500)}.f-green{color:var(--green-500)}.f-grey{color:var(--uic-neutral-400, var(--grey-400))}.f-black{color:var(--uic-neutral-900, var(--grey-900))}.f-white{color:var(--white)}.tip{color:var(--uic-tip-color, var(--uic-neutral-500, var(--grey-500)))}.item-disabled{color:var(--uic-neutral-400, var(--grey-400))}.item-disabled:hover{background-color:var(--uic-surface, var(--white));cursor:not-allowed}.loading-input{background:linear-gradient(-45deg,var(--uic-loading-base, var(--uic-neutral-100, #f2f2f2)) 40%,var(--uic-loading-highlight, var(--uic-neutral-200, #dee1e2)) 50%,var(--uic-loading-base, var(--uic-neutral-100, #f2f2f2)) 60%);background-size:300%;background-position-x:100%;animation:shimmer 1s infinite linear}.select-searcher{width:100%;display:flex;gap:5px;padding:.25rem;border-bottom:1px solid var(--uic-neutral-200, var(--grey-200));background-color:var(--uic-surface, var(--white))}.select-searcher>input{flex:1 1;padding:3px 5px;border:solid 1px var(--uic-neutral-200, var(--grey-200));margin:0 auto;border-radius:4px}.select-searcher>input:focus{outline:none;box-shadow:var(--uic-focus-shadow, 0 0 0 3px var(--secondary-alpha));border-color:var(--primary-500)}.option-text-highlight ::ng-deep mark{background-color:var(--secondary-200);color:inherit;padding:0;border-radius:2px}@keyframes shimmer{to{background-position-x:0%}}.char-counter{width:100%;display:flex;justify-content:flex-end;font-size:10px;color:var(--uic-neutral-400, var(--grey-400))}.f-dark-green{color:var(--dark-green-500)}.f-light-blue{color:var(--light-blue-500)}.f-pink{color:var(--pink-500)}.f-dark-red{color:var(--dark-red-500)}.f-orange{color:var(--orange-500)}.f-teal{color:var(--teal-500)}\n"], dependencies: [{ kind: "component", type: InputWrapperComponent, selector: "ui-input-wrapper", inputs: ["icon", "iconColor", "label", "error", "tip", "disabled"] }, { kind: "pipe", type: UicTranslatePipe, name: "uicTranslate" }] });
|
|
4207
|
+
}
|
|
4208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicDistributionComponent, decorators: [{
|
|
4209
|
+
type: Component,
|
|
4210
|
+
args: [{ selector: 'ui-distribution', imports: [InputWrapperComponent, UicTranslatePipe], providers: [
|
|
4211
|
+
{
|
|
4212
|
+
provide: NG_VALUE_ACCESSOR,
|
|
4213
|
+
useExisting: forwardRef(() => UicDistributionComponent),
|
|
4214
|
+
multi: true
|
|
4215
|
+
}
|
|
4216
|
+
], template: "<ui-input-wrapper\n [icon]=\"icon\"\n [iconColor]=\"iconColor\"\n [label]=\"label\"\n [error]=\"displayedError\"\n [tip]=\"tip\"\n [disabled]=\"disabled\">\n <div\n class=\"dist\"\n role=\"group\"\n [class.dist--disabled]=\"disabled\"\n [class.dist--error]=\"!!displayedError\"\n [attr.aria-label]=\"label || null\"\n (focusin)=\"onFocusIn()\"\n (focusout)=\"onFocusOut($event)\">\n @for (option of validOptions; track option.id; let i = $index) {\n @let amount = amountOf(option);\n <div class=\"dist-row\" [class.has-value]=\"amount > 0\">\n <label class=\"dist-label\" [for]=\"inputId(i)\">\n @if (option.icon) {\n <i class=\"dist-option-icon {{ option.icon }} f-{{ option.iconColor || 'black' }}\" aria-hidden=\"true\"></i>\n }\n <span>{{ option.text | uicTranslate }}</span>\n </label>\n <div class=\"dist-bar\" aria-hidden=\"true\">\n <span class=\"dist-bar-fill\" [style.width.%]=\"amount\"></span>\n </div>\n <div class=\"dist-input\">\n <input\n type=\"number\"\n inputmode=\"numeric\"\n min=\"0\"\n [max]=\"expected\"\n step=\"1\"\n placeholder=\"0\"\n [id]=\"inputId(i)\"\n [value]=\"amount || ''\"\n [disabled]=\"disabled\"\n (input)=\"onInput(option, $event)\">\n <span class=\"dist-unit\" aria-hidden=\"true\">%</span>\n </div>\n @if (!disabled && remaining > 0) {\n <button\n type=\"button\"\n class=\"dist-fill\"\n [attr.aria-label]=\"'distribution.fill_remaining' | uicTranslate: { remaining: remaining, option: (option.text | uicTranslate) }\"\n [title]=\"'distribution.fill_remaining' | uicTranslate: { remaining: remaining, option: (option.text | uicTranslate) }\"\n (click)=\"fillRemaining(option)\">+{{ remaining }}</button>\n } @else {\n <span class=\"dist-fill-spacer\" aria-hidden=\"true\"></span>\n }\n </div>\n } @empty {\n <p class=\"dist-empty\">{{ 'distribution.no_options' | uicTranslate }}</p>\n }\n\n @if (validOptions.length) {\n <div\n class=\"dist-total\"\n aria-live=\"polite\"\n [class.is-complete]=\"total === expected\"\n [class.is-over]=\"total > expected\">\n <span class=\"dist-total-label\">{{ 'distribution.total' | uicTranslate }}</span>\n <b class=\"dist-total-value\">{{ total }}%</b>\n <span class=\"dist-total-status\">\n @if (total === expected) {\n <i class=\"ri-checkbox-circle-fill\" aria-hidden=\"true\"></i>\n {{ 'distribution.complete' | uicTranslate }}\n } @else if (total > expected) {\n {{ 'distribution.over' | uicTranslate: { amount: total - expected } }}\n } @else {\n {{ 'distribution.missing' | uicTranslate: { amount: remaining } }}\n }\n </span>\n @if (!disabled && total > 0) {\n <button type=\"button\" class=\"dist-clear\" (click)=\"clear()\">{{ 'distribution.clear' | uicTranslate }}</button>\n }\n </div>\n }\n </div>\n</ui-input-wrapper>\n", styles: [".dist{display:flex;flex-direction:column;gap:var(--uic-distribution-gap, 8px);width:100%;padding:2px 0}.dist-row{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(40px,1fr) var(--uic-distribution-input-width, 72px) 44px;align-items:center;gap:10px}.dist-label{display:flex;align-items:center;gap:6px;min-width:0;font-size:.875rem;color:var(--uic-neutral-800, var(--grey-800));cursor:pointer}.dist-label span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dist-option-icon{flex:0 0 auto;font-size:16px}.dist-bar{height:8px;border-radius:4px;background-color:var(--uic-distribution-bar-bg, var(--uic-neutral-100, var(--grey-100)));overflow:hidden}.dist-bar-fill{display:block;height:100%;border-radius:inherit;background-color:var(--uic-distribution-bar-fill, var(--primary-500));transition:width .2s ease}.dist-input{position:relative;display:flex;align-items:center}.dist-input input{width:100%;height:calc(4 * var(--form-ref));padding:0 22px 0 8px;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:var(--input-radius);background-color:var(--uic-surface, var(--white));color:var(--uic-neutral-800, var(--grey-800));font:inherit;text-align:right;-moz-appearance:textfield;appearance:textfield}.dist-input input::-webkit-outer-spin-button,.dist-input input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.dist-input input:focus{outline:none;border-color:var(--primary-500)}.dist-input input:disabled{background-color:var(--uic-neutral-50, var(--grey-50));color:var(--uic-neutral-500, var(--grey-500));cursor:not-allowed}.dist-unit{position:absolute;right:8px;font-size:.875rem;color:var(--uic-neutral-500, var(--grey-500));pointer-events:none}.dist-fill{height:26px;padding:0 6px;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:13px;background:var(--uic-surface, var(--white));color:var(--primary-600);font-size:11px;font-weight:600;cursor:pointer;opacity:0;transition:opacity .15s ease}.dist-fill:hover{border-color:var(--primary-400)}.dist-fill:focus-visible{opacity:1;outline:solid 2px var(--primary-400);outline-offset:1px}.dist-row:hover .dist-fill,.dist-row:focus-within .dist-fill{opacity:1}@media (hover: none){.dist-fill{opacity:1}}.dist-total{display:flex;align-items:center;gap:8px;padding-top:8px;border-top:solid 1px var(--uic-neutral-200, var(--grey-200));font-size:.875rem;color:var(--uic-neutral-500, var(--grey-500))}.dist-total-value{font-size:15px;color:var(--uic-neutral-800, var(--grey-800))}.dist-total-status{display:inline-flex;align-items:center;gap:4px}.dist-total.is-complete .dist-total-value,.dist-total.is-complete .dist-total-status{color:var(--uic-distribution-complete-color, var(--green-600))}.dist-total.is-over .dist-total-value,.dist-total.is-over .dist-total-status{color:var(--uic-distribution-over-color, var(--red-600))}.dist-clear{margin-left:auto;border:none;background:none;color:var(--uic-neutral-500, var(--grey-500));font-size:12px;text-decoration:underline;cursor:pointer}.dist-clear:hover{color:var(--uic-neutral-800, var(--grey-800))}.dist--error .dist-total:not(.is-complete) .dist-total-value{color:var(--uic-distribution-over-color, var(--red-600))}.dist-empty{font-size:.875rem;color:var(--uic-neutral-500, var(--grey-500))}@media (max-width: 480px){.dist-row{grid-template-columns:minmax(0,1fr) var(--uic-distribution-input-width, 72px) 44px;grid-template-areas:\"label input fill\" \"bar bar bar\";row-gap:4px}.dist-label{grid-area:label}.dist-input{grid-area:input}.dist-fill,.dist-fill-spacer{grid-area:fill}.dist-bar{grid-area:bar}}.f-primary{color:var(--primary-500)}.f-secondary{color:var(--secondary-500)}.f-red{color:var(--red-500)}.f-yellow{color:var(--yellow-500)}.f-blue{color:var(--blue-500)}.f-green{color:var(--green-500)}.f-grey{color:var(--uic-neutral-400, var(--grey-400))}.f-black{color:var(--uic-neutral-900, var(--grey-900))}.f-dark-green{color:var(--dark-green-500)}.f-light-blue{color:var(--light-blue-500)}.f-pink{color:var(--pink-500)}.f-dark-red{color:var(--dark-red-500)}.f-orange{color:var(--orange-500)}.f-teal{color:var(--teal-500)}\n", ":host{width:100%}.input-container{flex:1 1;overflow:hidden}.f-extralight{font-weight:300;color:var(--uic-neutral-500, var(--grey-500))}.input-options{border-radius:var(--input-radius);background-color:var(--uic-overlay-bg, var(--uic-surface, var(--white)));box-shadow:var(--uic-overlay-shadow, var(--uic-shadow-sm, 0 1px 1px 0 rgba(0, 0, 0, .1254901961), 0 2px 5px 0 rgba(0, 0, 0, .3137254902)));width:100%;top:100%;font-size:var(--uic-option-font-size, .875rem);z-index:500;overflow:hidden;display:flex;flex-direction:column}.option-divider{width:98%;margin:auto;border-bottom:1px solid var(--uic-neutral-200, var(--grey-200))}.option-group-header{padding:.25rem .5rem 2px;font-size:.75rem;font-weight:600;color:var(--uic-neutral-500, var(--grey-500));text-transform:uppercase;letter-spacing:.05em;pointer-events:none;-webkit-user-select:none;user-select:none}.option-group-header:not(:first-child){border-top:1px solid var(--uic-neutral-200, var(--grey-200));margin-top:.25rem}.input-option{display:flex;align-items:center;padding:6px 12px;line-height:1rem;-webkit-user-select:none;user-select:none;transition:ease .3s;border-radius:.25rem}.input-option-focused{background-color:var(--uic-option-hover-bg, var(--uic-surface-hover, var(--secondary-100)))}.input-option:hover{background-color:var(--uic-option-hover-bg, var(--uic-surface-hover, var(--secondary-100)));cursor:pointer}.input-option-disabled{opacity:.55;cursor:not-allowed}.input-option-disabled:hover{background-color:transparent;cursor:not-allowed}.input-option-scroll{padding:.25rem;max-height:180px;overflow:auto}.input-option-scroll-line{border-bottom:solid 1px var(--uic-neutral-200, var(--grey-200));width:100%;margin-top:2px}.input-option-scroll-focused{background-color:var(--primary-300)}.input-option-scroll-btns{border-top:solid 1px var(--uic-neutral-200, var(--grey-200));padding-top:5px;display:flex;justify-content:space-around}.input-option-scroll-btns button{background-color:var(--uic-surface, var(--white));border:solid 1px var(--uic-neutral-200, var(--grey-200));padding:4px 10px;border-radius:10px}.input-option-scroll app-checkbox{width:100%}.input-wrapper{display:flex;align-items:center;width:100%;max-width:100%}.input-externalicon{margin-right:.5rem;font-size:1.625rem;height:1.625rem;width:1.625rem}.input-elements{flex-grow:1;display:flex;flex-direction:column;width:100%}.input-internalicon{color:var(--uic-neutral-700, var(--grey-700));margin-right:calc(var(--form-ref) * .6);font-size:calc(2.5 * var(--form-ref))}.label{font-size:var(--uic-label-font-size, max(var(--form-ref) + 4px, 14px));line-height:var(--uic-label-line-height, 1.125rem);min-height:var(--uic-label-line-height, 1.125rem);font-weight:var(--uic-label-font-weight, 400);color:var(--uic-label-color, var(--uic-neutral-950, var(--grey-950)));margin-bottom:var(--input-label-space)}.disabled-placeholder{color:var(--disabled-color-placeholder)}.fakeinput{min-height:calc(4 * var(--form-ref));border-radius:var(--input-radius);overflow:hidden;border:solid var(--uic-input-border-width, 1px) var(--uic-input-border-color, var(--uic-neutral-200, var(--grey-200)));display:flex;align-items:center;font-size:.875rem;-webkit-user-select:none;user-select:none;background-color:var(--uic-input-bg, var(--uic-surface, var(--white)));transition:ease .3s;padding:0 var(--form-ref)}.fakeinput-wrapp{position:relative}.fakeinput-emptytext{margin:0 5px;flex:1 1;overflow:hidden;font-size:var(--uic-input-font-size, max(var(--form-ref) + 4px, 14px));white-space:nowrap}.fakeinput-emptytext i{font-size:20px}.fakeinput ::ng-deep textarea{padding:10px 0}.fakeinput ::ng-deep input{height:calc(4 * var(--form-ref));padding:0}.fakeinput ::ng-deep input,.fakeinput ::ng-deep textarea{font-size:var(--uic-input-font-size, max(var(--form-ref) + 4px, 14px));flex-grow:1;outline:none;width:100%;background-color:transparent;border:none!important}.fakeinput ::ng-deep input:disabled,.fakeinput ::ng-deep textarea:disabled{color:var(--disabled-color)}.fakeinput ::ng-deep input:disabled~.fakeinput,.fakeinput ::ng-deep textarea:disabled~.fakeinput{background-color:var(--disabled-background);color:var(--disabled-color)}.fakeinput ::ng-deep input:disabled::placeholder,.fakeinput ::ng-deep textarea:disabled::placeholder{color:var(--disabled-color-placeholder)}.fakeinput-button{margin:0;border:none;display:flex;justify-content:center;align-items:center;padding:4px 5px 5px;transition:ease .3s;background-color:var(--uic-neutral-200, var(--grey-200))}.fakeinput-button:disabled{background-color:var(--disabled-background);color:var(--disabled-color)}.fakeinput-button:enabled:hover{cursor:pointer;background-color:var(--primary-300);color:var(--white)}.fakeinput-button:enabled:active{background-color:var(--primary-700)}.fakeinput app-checkbox{width:100%}.fakeinput-alert{font-size:13px;line-height:15px;padding:1px 4px}.fakeinput button{color:var(--uic-neutral-200, var(--grey-200))}.fakeinput:focus-within{box-shadow:var(--uic-focus-shadow, 0 0 0 3px var(--secondary-alpha))}.fakeinput:hover{border-color:var(--uic-input-border-color-hover, var(--uic-neutral-400, var(--grey-400)));cursor:text}.activeselect{border-color:var(--uic-input-border-color-active, var(--primary-600))}.errorinput{border-color:var(--uic-error-color, var(--red-500))!important}.t-disabled{color:var(--disabled-color);padding:5px;text-align:center}.disabledinput{background-color:var(--disabled-background);color:var(--disabled-color)}.disabledinput ::ng-deep input{color:var(--disabled-color)}.inputlabel{display:flex;align-items:center}.f-primary{color:var(--primary-500)}.f-secondary{color:var(--secondary-500)}.f-red{color:var(--red-500)}.f-yellow{color:var(--yellow-500)}.f-blue{color:var(--blue-500)}.f-green{color:var(--green-500)}.f-grey{color:var(--uic-neutral-400, var(--grey-400))}.f-black{color:var(--uic-neutral-900, var(--grey-900))}.f-white{color:var(--white)}.tip{color:var(--uic-tip-color, var(--uic-neutral-500, var(--grey-500)))}.item-disabled{color:var(--uic-neutral-400, var(--grey-400))}.item-disabled:hover{background-color:var(--uic-surface, var(--white));cursor:not-allowed}.loading-input{background:linear-gradient(-45deg,var(--uic-loading-base, var(--uic-neutral-100, #f2f2f2)) 40%,var(--uic-loading-highlight, var(--uic-neutral-200, #dee1e2)) 50%,var(--uic-loading-base, var(--uic-neutral-100, #f2f2f2)) 60%);background-size:300%;background-position-x:100%;animation:shimmer 1s infinite linear}.select-searcher{width:100%;display:flex;gap:5px;padding:.25rem;border-bottom:1px solid var(--uic-neutral-200, var(--grey-200));background-color:var(--uic-surface, var(--white))}.select-searcher>input{flex:1 1;padding:3px 5px;border:solid 1px var(--uic-neutral-200, var(--grey-200));margin:0 auto;border-radius:4px}.select-searcher>input:focus{outline:none;box-shadow:var(--uic-focus-shadow, 0 0 0 3px var(--secondary-alpha));border-color:var(--primary-500)}.option-text-highlight ::ng-deep mark{background-color:var(--secondary-200);color:inherit;padding:0;border-radius:2px}@keyframes shimmer{to{background-position-x:0%}}.char-counter{width:100%;display:flex;justify-content:flex-end;font-size:10px;color:var(--uic-neutral-400, var(--grey-400))}.f-dark-green{color:var(--dark-green-500)}.f-light-blue{color:var(--light-blue-500)}.f-pink{color:var(--pink-500)}.f-dark-red{color:var(--dark-red-500)}.f-orange{color:var(--orange-500)}.f-teal{color:var(--teal-500)}\n"] }]
|
|
4217
|
+
}], propDecorators: { icon: [{
|
|
4218
|
+
type: Input
|
|
4219
|
+
}], iconColor: [{
|
|
4220
|
+
type: Input
|
|
4221
|
+
}], label: [{
|
|
4222
|
+
type: Input
|
|
4223
|
+
}], error: [{
|
|
4224
|
+
type: Input
|
|
4225
|
+
}], tip: [{
|
|
4226
|
+
type: Input
|
|
4227
|
+
}], disabled: [{
|
|
4228
|
+
type: Input
|
|
4229
|
+
}], options: [{
|
|
4230
|
+
type: Input
|
|
4231
|
+
}] } });
|
|
4232
|
+
|
|
4013
4233
|
const base$3 = createValueAccessor();
|
|
4014
4234
|
class UicTimePickerComponent extends base$3 {
|
|
4015
4235
|
// Iconos y estado
|
|
@@ -4788,39 +5008,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
4788
5008
|
type: Injectable
|
|
4789
5009
|
}], ctorParameters: () => [] });
|
|
4790
5010
|
|
|
4791
|
-
/** Tipos cuyo valor es una lista de opciones elegidas. */
|
|
4792
|
-
const MULTI_SELECTION_TYPES = new Set(['multyselect', 'pool']);
|
|
4793
|
-
/**
|
|
4794
|
-
* Valida la cantidad de opciones elegidas (multyselect y pool múltiple).
|
|
4795
|
-
* Un valor vacío no falla por mínimo: para exigir al menos una respuesta se usa `required`.
|
|
4796
|
-
* Errores: { minSelections: { min, actual } } y { maxSelections: { max, actual } }.
|
|
4797
|
-
*/
|
|
4798
|
-
function uicSelectionCountValidator(min, max) {
|
|
4799
|
-
return (control) => {
|
|
4800
|
-
const value = control.value;
|
|
4801
|
-
const actual = Array.isArray(value) ? value.length : 0;
|
|
4802
|
-
if (actual === 0)
|
|
4803
|
-
return null;
|
|
4804
|
-
if (typeof min === 'number' && min > 0 && actual < min) {
|
|
4805
|
-
return { minSelections: { min, actual } };
|
|
4806
|
-
}
|
|
4807
|
-
if (typeof max === 'number' && max > 0 && actual > max) {
|
|
4808
|
-
return { maxSelections: { max, actual } };
|
|
4809
|
-
}
|
|
4810
|
-
return null;
|
|
4811
|
-
};
|
|
4812
|
-
}
|
|
4813
|
-
/** Validadores de selección que corresponden al campo (vacío si no aplica). */
|
|
4814
|
-
function uicSelectionValidatorsFor(field) {
|
|
4815
|
-
if (!MULTI_SELECTION_TYPES.has(field.type))
|
|
4816
|
-
return [];
|
|
4817
|
-
if (field.type === 'pool' && !field.multyEnabled)
|
|
4818
|
-
return [];
|
|
4819
|
-
const hasMin = typeof field.minSelections === 'number' && field.minSelections > 0;
|
|
4820
|
-
const hasMax = typeof field.maxSelections === 'number' && field.maxSelections > 0;
|
|
4821
|
-
return hasMin || hasMax ? [uicSelectionCountValidator(field.minSelections, field.maxSelections)] : [];
|
|
4822
|
-
}
|
|
4823
|
-
|
|
4824
5011
|
class UicRepeaterComponent {
|
|
4825
5012
|
fb = inject(FormBuilder);
|
|
4826
5013
|
formState = inject(UicFormStateService, { optional: true });
|
|
@@ -4969,6 +5156,83 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
4969
5156
|
type: Input
|
|
4970
5157
|
}] } });
|
|
4971
5158
|
|
|
5159
|
+
/**
|
|
5160
|
+
* Opción "Otros (especifica)".
|
|
5161
|
+
*
|
|
5162
|
+
* Una pregunta con `otherOption` suma la opción "Otros" (id UIC_OTHER_OPTION_ID) y un texto
|
|
5163
|
+
* acompañante que se guarda en `<name>__other`. El valor de la pregunta no cambia (sigue siendo
|
|
5164
|
+
* el id elegido, o la lista de ids), así que reglas, reportes y consumidores existentes no se afectan.
|
|
5165
|
+
*
|
|
5166
|
+
* El texto es un campo más del formulario, generado a partir del esquema: se muestra solo cuando
|
|
5167
|
+
* se elige "Otros" (regla de visibilidad automática), se limpia al dejar de elegirlo y se valida,
|
|
5168
|
+
* guarda y reanuda como cualquier otro campo.
|
|
5169
|
+
*/
|
|
5170
|
+
const UIC_OTHER_OPTION_ID = '__other__';
|
|
5171
|
+
const UIC_OTHER_FIELD_SUFFIX = '__other';
|
|
5172
|
+
/** Tipos que admiten "Otros": su valor es un id o una lista de ids. */
|
|
5173
|
+
const UIC_OTHER_OPTION_TYPES = ['radio', 'select', 'multyselect'];
|
|
5174
|
+
const UIC_OTHER_TEXT_MAX_LENGTH = 500;
|
|
5175
|
+
/** Nombre del campo que guarda el texto de "Otros" de una pregunta. */
|
|
5176
|
+
function uicOtherFieldName(name) {
|
|
5177
|
+
return `${name}${UIC_OTHER_FIELD_SUFFIX}`;
|
|
5178
|
+
}
|
|
5179
|
+
function uicSupportsOtherOption(field) {
|
|
5180
|
+
return UIC_OTHER_OPTION_TYPES.includes(field.type);
|
|
5181
|
+
}
|
|
5182
|
+
/** true si la pregunta muestra la opción "Otros". */
|
|
5183
|
+
function uicHasOtherOption(field) {
|
|
5184
|
+
return !!field.otherOption && uicSupportsOtherOption(field);
|
|
5185
|
+
}
|
|
5186
|
+
/** Opciones de la pregunta con "Otros" al final (si corresponde y no está ya). */
|
|
5187
|
+
function uicOptionsWithOther(options, field, label) {
|
|
5188
|
+
const base = options ?? [];
|
|
5189
|
+
if (!uicHasOtherOption(field) || base.some(option => option.id === UIC_OTHER_OPTION_ID))
|
|
5190
|
+
return base;
|
|
5191
|
+
return [...base, { id: UIC_OTHER_OPTION_ID, text: label }];
|
|
5192
|
+
}
|
|
5193
|
+
/** Campo de texto acompañante de una pregunta con "Otros". */
|
|
5194
|
+
function uicBuildOtherField(field, otherLabel, placeholder) {
|
|
5195
|
+
const config = field.otherOption ?? {};
|
|
5196
|
+
const showRule = {
|
|
5197
|
+
fieldName: field.name,
|
|
5198
|
+
operator: field.type === 'multyselect' ? 'includes' : 'equals',
|
|
5199
|
+
value: UIC_OTHER_OPTION_ID
|
|
5200
|
+
};
|
|
5201
|
+
return {
|
|
5202
|
+
name: uicOtherFieldName(field.name),
|
|
5203
|
+
type: 'text',
|
|
5204
|
+
// No se muestra como etiqueta (el input va pegado a la pregunta), pero nombra el campo en errores y reportes.
|
|
5205
|
+
label: `${field.label ?? field.name} (${config.label || otherLabel})`,
|
|
5206
|
+
placeholder: config.placeholder || placeholder,
|
|
5207
|
+
required: config.required ?? true,
|
|
5208
|
+
maxLength: UIC_OTHER_TEXT_MAX_LENGTH,
|
|
5209
|
+
colSpan: field.colSpan,
|
|
5210
|
+
// Hereda la visibilidad de la pregunta (si ella se oculta, el texto también) y suma "eligió Otros".
|
|
5211
|
+
visibilityRules: [...(field.visibilityRules ?? []), showRule],
|
|
5212
|
+
otherFor: field.name
|
|
5213
|
+
};
|
|
5214
|
+
}
|
|
5215
|
+
/** true si algún campo (o sub-campo de repetidor) usa "Otros". */
|
|
5216
|
+
function uicContainsOtherOption(fields) {
|
|
5217
|
+
return (fields ?? []).some(field => uicHasOtherOption(field) || uicContainsOtherOption(field.repeaterFields));
|
|
5218
|
+
}
|
|
5219
|
+
/**
|
|
5220
|
+
* Inserta, después de cada pregunta con "Otros", su campo de texto acompañante.
|
|
5221
|
+
* Si ningún campo usa "Otros" devuelve el mismo array (no copia el esquema).
|
|
5222
|
+
*/
|
|
5223
|
+
function uicExpandOtherFields(fields, otherLabel, placeholder) {
|
|
5224
|
+
if (!uicContainsOtherOption(fields))
|
|
5225
|
+
return fields;
|
|
5226
|
+
return fields.flatMap(field => {
|
|
5227
|
+
const withSubFields = field.repeaterFields?.length
|
|
5228
|
+
? { ...field, repeaterFields: uicExpandOtherFields(field.repeaterFields, otherLabel, placeholder) }
|
|
5229
|
+
: field;
|
|
5230
|
+
return uicHasOtherOption(field) && !field.hidden
|
|
5231
|
+
? [withSubFields, uicBuildOtherField(field, otherLabel, placeholder)]
|
|
5232
|
+
: [withSubFields];
|
|
5233
|
+
});
|
|
5234
|
+
}
|
|
5235
|
+
|
|
4972
5236
|
class UicDynamicFormComponent {
|
|
4973
5237
|
ngZone;
|
|
4974
5238
|
fieldsSignal = signal([]);
|
|
@@ -5049,6 +5313,29 @@ class UicDynamicFormComponent {
|
|
|
5049
5313
|
});
|
|
5050
5314
|
});
|
|
5051
5315
|
});
|
|
5316
|
+
// ---- Opción "Otros" (ver other-option.ts) ----
|
|
5317
|
+
otherTextMaxLength = UIC_OTHER_TEXT_MAX_LENGTH;
|
|
5318
|
+
otherOptionsCache = new WeakMap();
|
|
5319
|
+
/** Texto "especifica" visible de cada pregunta (por nombre de la pregunta). */
|
|
5320
|
+
visibleOtherStates = computed(() => new Map(this.visibleFieldStates()
|
|
5321
|
+
.filter(state => !!state.field.otherFor)
|
|
5322
|
+
.map(state => [state.field.otherFor, state])));
|
|
5323
|
+
/** Opciones de la pregunta, con "Otros" al final si la tiene. Cacheado para no recrear el array en cada ciclo. */
|
|
5324
|
+
optionsFor(field) {
|
|
5325
|
+
if (!uicHasOtherOption(field))
|
|
5326
|
+
return field.options || [];
|
|
5327
|
+
const label = this.i18n.translate(field.otherOption?.label || 'other_option.label');
|
|
5328
|
+
const cached = this.otherOptionsCache.get(field);
|
|
5329
|
+
if (cached && cached.source === field.options && cached.label === label)
|
|
5330
|
+
return cached.result;
|
|
5331
|
+
const result = uicOptionsWithOther(field.options, field, label);
|
|
5332
|
+
this.otherOptionsCache.set(field, { source: field.options, label, result });
|
|
5333
|
+
return result;
|
|
5334
|
+
}
|
|
5335
|
+
/** Estado del texto "especifica" de una pregunta, si está visible (eligió "Otros"). */
|
|
5336
|
+
otherStateFor(field) {
|
|
5337
|
+
return this.visibleOtherStates().get(field.name) ?? null;
|
|
5338
|
+
}
|
|
5052
5339
|
formSyncEffect = effect(() => {
|
|
5053
5340
|
const form = this.formSignal();
|
|
5054
5341
|
if (form && !this.isSubForm) {
|
|
@@ -5347,6 +5634,7 @@ class UicDynamicFormComponent {
|
|
|
5347
5634
|
}),
|
|
5348
5635
|
pattern: (_err, field) => this.i18n.translate('validation.pattern', { field: field.label ?? field.name }),
|
|
5349
5636
|
minSelections: (err, field) => this.i18n.translate('validation.min_selections', { field: field.label ?? field.name, min: err.min }),
|
|
5637
|
+
distributionTotal: (err, field) => this.i18n.translate('validation.distribution_total', { field: field.label ?? field.name, total: err.total, expected: err.expected }),
|
|
5350
5638
|
maxSelections: (err, field) => this.i18n.translate('validation.max_selections', { field: field.label ?? field.name, max: err.max }),
|
|
5351
5639
|
minLengthArray: (_err, field) => this.i18n.translate('validation.required', { field: field.label ?? field.name }),
|
|
5352
5640
|
externalValidation: (err, field) => typeof err === 'string'
|
|
@@ -5638,7 +5926,7 @@ class UicDynamicFormComponent {
|
|
|
5638
5926
|
recognition.start();
|
|
5639
5927
|
}
|
|
5640
5928
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicDynamicFormComponent, deps: [{ token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
5641
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: UicDynamicFormComponent, isStandalone: true, selector: "ui-dynamic-form", inputs: { fields: "fields", contextFields: "contextFields", isSubForm: "isSubForm", form: "form", disabled: "disabled", externalValidationStates: "externalValidationStates", voiceToTextSilenceMs: "voiceToTextSilenceMs", cols: "cols", iconMode: "iconMode", fileUidResolverFn: "fileUidResolverFn", selectOptionsResolver: "selectOptionsResolver", parentFormValues: "parentFormValues" }, outputs: { fieldBlur: "fieldBlur" }, ngImport: i0, template: "<div class=\"form\" [ngStyle]=\"{'--cols': cols, '--min': '180px'}\" [formGroup]=\"form\">\r\n @for (state of visibleFieldStates(); track state.field.name) {\r\n @let field = state.field;\r\n @let control = state.control;\r\n @let currentValue = state.value ?? '';\r\n @let error = getControlErrorMessages(control, field)[0];\r\n\r\n @if (!field.hidden) {\r\n <div [style.grid-column]=\"getGridColumn(field)\" (focusout)=\"onFieldContainerFocusout(field, $event)\">\r\n @if (['text', 'number'].includes(field.type)) {\r\n @let inputColor = getInputColor(field, currentValue);\r\n <ui-input\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [disabled]=\"!!control?.disabled\"\r\n [internalIconColor]=\"inputColor\"\r\n [internalIcon]=\"field.internalIcon || (currentValue !== '' ? getIconByColor(field, inputColor) : '')\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\">\r\n <input #inp\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [type]=\"field.type\"\r\n [step]=\"field.step\"\r\n [min]=\"field.min\"\r\n [max]=\"field.max\"\r\n [minLength]=\"field.minLength||null\"\r\n [maxlength]=\"field.maxLength||null\"\r\n [placeholder]=\"field.placeholder??field.label\"/>\r\n @if (field.maxLength && field.showCounter) {\r\n <span counter>{{inp.value.length}} /{{field.maxLength}}</span>\r\n }\r\n </ui-input>\r\n }\r\n @if (field.type === 'textarea') {\r\n <ui-input\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [disabled]=\"!!control?.disabled\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\">\r\n <textarea #ta\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [minLength]=\"field.minLength||null\"\r\n [maxlength]=\"field.maxLength||null\"\r\n [textareaAutoresize]=\"field.textareaResize\"\r\n [textareaAutoresizeMinRows]=\"field.resizeMinRows??1\"\r\n [textareaAutoresizeMaxRows]=\"field.resizeMaxRows??5\"\r\n [rows]=\"field.resizeMinRows??3\"\r\n [placeholder]=\"field.placeholder??field.label\"\r\n ></textarea>\r\n @if (field.voiceToTextEnabled && !control?.disabled) {\r\n @let listening = isListening(field.name);\r\n <div class=\"speak-icon\" (click)=\"ta.focus()\">\r\n <ui-button\r\n [disabled]=\"listening\"\r\n style=\"margin-bottom: 2px;\"\r\n (click)=\"voiceToText(ta, field.name)\"\r\n [icon]=\"listening?'ri-mic-fill':'ri-mic-line'\"\r\n [type]=\"listening?'filled':'bordered'\"\r\n size=\"s\"\r\n [iconOnly]=\"true\"\r\n ></ui-button>\r\n @if (listening) {\r\n <i class=\"ri-voiceprint-line\"></i>\r\n }\r\n </div>\r\n }\r\n @if (field.showCounter) {\r\n <span counter>\r\n {{ta.value.length}}\r\n @if (field.maxLength) {\r\n /{{field.maxLength}}\r\n }\r\n </span>\r\n }\r\n </ui-input>\r\n }\r\n @if (field.type === 'phone') {\r\n <ui-phone-input\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\"\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [placeholder]=\"field.placeholder||field.label||''\"\r\n >\r\n </ui-phone-input>\r\n }\r\n @else if (field.type === 'date') {\r\n <ui-date-picker\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [tip]=\"field.tip??''\"\r\n [justMonth]=\"!!field.monthMode\"\r\n [min]=\"field.minDate??''\"\r\n [max]=\"field.maxDate??''\"\r\n [monthDay]=\"field.monthDay||'first'\"\r\n [formControlName]=\"field.name\"\r\n ></ui-date-picker>\r\n }\r\n @else if (field.type === 'time') {\r\n <ui-time-picker\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [tip]=\"field.tip??''\"\r\n [interval]=\"field.timeInterval??5\"\r\n [formControlName]=\"field.name\"\r\n ></ui-time-picker>\r\n }\r\n @else if (field.type === 'select') {\r\n <ui-select\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [loading]=\"field.loading??false\"\r\n [nullable]=\"field.selectNullable??false\"\r\n [showSubtitle]=\"field.showSubtitle??false\"\r\n [searcherEnabled]=\"field.selectSearchEnabled??false\"\r\n [tip]=\"field.tip??''\"\r\n [formControlName]=\"field.name\"\r\n [options]=\"field.options || []\"\r\n ></ui-select>\r\n }\r\n @else if (field.type === 'multyselect') {\r\n <ui-multy-select\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [tip]=\"field.tip??''\"\r\n [formControlName]=\"field.name\"\r\n [maxSelections]=\"field.maxSelections ?? null\"\r\n [options]=\"field.options || []\"\r\n ></ui-multy-select>\r\n }\r\n @else if (field.type === 'searcher') {\r\n <ui-searcher\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\"\r\n [searchFn]=\"getSearcherFn(field)\"\r\n [itemDisplayFn]=\"getSearcherDisplayFn(field)\"\r\n [itemIsEnabledFn]=\"getSearcherIsEnabledFn(field)\"\r\n [placeholder]=\"field.placeholder??'common.search_ellipsis'\"\r\n [error]=\"error\"\r\n ></ui-searcher>\r\n }\r\n @else if (field.type === 'multisearcher') {\r\n <ui-multy-searcher\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\"\r\n [searchFn]=\"getSearcherFn(field)\"\r\n [itemDisplayFn]=\"getSearcherDisplayFn(field)\"\r\n [itemIsEnabledFn]=\"getSearcherIsEnabledFn(field)\"\r\n [placeholder]=\"field.placeholder??'common.search_ellipsis'\"\r\n [error]=\"error\"\r\n ></ui-multy-searcher>\r\n }\r\n @else if (field.type === 'file') {\r\n <ui-file-input\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [multy]=\"field.multyEnabled??false\"\r\n [tip]=\"field.tip??''\"\r\n [fileTypes]=\"field.fileTypes??null\"\r\n [templateUrl]=\"field.templateUrl??''\"\r\n [templateText]=\"field.templateText??'Descarga el formato haciendo'\"\r\n [templateLinkLabel]=\"field.templateLinkLabel??'click aqu\u00ED'\"\r\n [fileUidResolverFn]=\"fileUidResolverFn\"\r\n [formControlName]=\"field.name\"\r\n ></ui-file-input>\r\n }\r\n @else if (['checkbox', 'switch'].includes(field.type)) {\r\n <ui-checkbox\r\n [label]=\"(field.label??'') + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [placeholder]=\"field.placeholder??''\"\r\n [tip]=\"field.tip??''\"\r\n [type]=\"field.type === 'checkbox' ? 'checkbox' : 'switch'\"\r\n ></ui-checkbox>\r\n }\r\n @else if (field.type === 'radio') {\r\n <ui-radio\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [tip]=\"field.tip??''\"\r\n [loading]=\"field.loading??false\"\r\n [error]=\"error\"\r\n [options]=\"field.options || []\"\r\n ></ui-radio>\r\n }\r\n @else if (field.type === 'slider') {\r\n <ui-slider\r\n [min]=\"field.min??0\"\r\n [max]=\"field.max??100\"\r\n [step]=\"field.sliderInterval??1\"\r\n [markerCount]=\"field.sliderMarks??5\"\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [tip]=\"field.tip??''\"\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n ></ui-slider>\r\n }\r\n @else if (field.type === 'scale') {\r\n <ui-scale\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [tip]=\"field.tip??''\"\r\n [error]=\"error\"\r\n [min]=\"field.scaleMin ?? 1\"\r\n [max]=\"field.scaleMax ?? 5\"\r\n [mode]=\"field.scaleMode ?? 'number'\"\r\n [scaleIcon]=\"field.scaleIcon || 'ri-star-fill'\"\r\n [labels]=\"field.scaleLabels ?? []\"\r\n ></ui-scale>\r\n }\r\n @else if (field.type === 'pool') {\r\n <ui-pool-options\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [multy]=\"field.multyEnabled??false\"\r\n [tip]=\"field.tip??''\"\r\n [listViewTitle]=\"field.poolTitle??'common.selected'\"\r\n [enabledListView]=\"field.poolEnabledListView||false\"\r\n [displayMode]=\"field.poolDisplayMode ?? 'flex'\"\r\n [gridColumns]=\"field.poolGridColumns ?? 2\"\r\n [maxSelections]=\"field.maxSelections ?? null\"\r\n [formControlName]=\"field.name\"\r\n [options]=\"field.options || []\"\r\n ></ui-pool-options>\r\n }\r\n @else if (field.type === 'repeater') {\r\n <ui-repeater\r\n [formArray]=\"asFormArray(control)\"\r\n [field]=\"field\"\r\n [cols]=\"cols\"\r\n [error]=\"error\"\r\n [fileUidResolverFn]=\"fileUidResolverFn\"\r\n [selectOptionsResolver]=\"selectOptionsResolver\"\r\n [parentForm]=\"form\"\r\n ></ui-repeater>\r\n }\r\n </div>\r\n }\r\n }\r\n</div>\r\n", styles: [".form{width:100%;display:grid;align-items:stretch;gap:var(--uic-form-gap, 1rem);padding-bottom:.75rem}@media (max-width: 479px){.form{grid-template-columns:1fr}}@media (min-width: 768px){.form{grid-template-columns:repeat(var(--cols),minmax(0,1fr))}}@media (min-width: 480px) and (max-width: 767px){.form{grid-template-columns:repeat(min(var(--cols),2),minmax(0,1fr))}}.form>*{min-width:0}h2{margin-top:1.5rem}.speak-icon{display:flex;width:100%;align-items:center;gap:10px}.speak-icon i{font-size:20px;color:var(--primary-500)}textarea{resize:none}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: UicDatePickerComponent, selector: "ui-date-picker", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "disabled", "label", "error", "tip", "max", "min", "justMonth", "monthDay"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: UicSliderComponent, selector: "ui-slider", inputs: ["icon", "iconColor", "label", "error", "tip", "min", "max", "step", "markerCount", "disabled", "loading"] }, { kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "component", type: UicPoolOptionsComponent, selector: "ui-pool-options", inputs: ["icon", "iconColor", "size", "label", "error", "tip", "disabled", "loading", "multy", "enabledListView", "listViewTitle", "options", "displayMode", "gridColumns", "maxSelections"] }, { kind: "component", type: UicTimePickerComponent, selector: "ui-time-picker", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "disabled", "label", "error", "tip", "interval"] }, { kind: "component", type: UicRadioComponent, selector: "ui-radio", inputs: ["icon", "iconColor", "label", "error", "tip", "disabled", "loading", "options", "emptyText", "direction"] }, { kind: "component", type: UicScaleComponent, selector: "ui-scale", inputs: ["icon", "iconColor", "label", "error", "tip", "disabled", "min", "max", "mode", "scaleIcon", "labels"] }, { kind: "component", type: UicSearcherComponent, selector: "ui-searcher", inputs: ["icon", "iconColor", "internalIcon", "size", "label", "error", "tip", "showSubtitle", "disabled", "loading", "minimumSearchLength", "showSelected", "placeholder", "searchFn", "itemDisplayFn", "itemIsEnabledFn", "manualSearch", "stateless"], outputs: ["pickedItem"] }, { kind: "component", type: UicMultySelectComponent, selector: "ui-multy-select", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "showSubtitle", "disabled", "nonSelectedText", "allSelectedText", "loading", "options", "maxSelections"] }, { kind: "component", type: UicMultySearcherComponent, selector: "ui-multy-searcher", inputs: ["icon", "iconColor", "internalIcon", "label", "error", "tip", "disabled", "loading", "minimumSearchLength", "placeholder", "searchFn", "itemDisplayFn", "itemIsEnabledFn", "manualSearch"] }, { kind: "component", type: UicFileInputComponent, selector: "ui-file-input", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "disabled", "loading", "multy", "fileTypes", "fileUidResolverFn", "templateUrl", "templateText", "templateLinkLabel"] }, { kind: "component", type: UicSelectComponent, selector: "ui-select", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "showSubtitle", "disabled", "nonSelectedText", "noneText", "emptyText", "searcherEnabled", "loading", "nullable", "options"] }, { kind: "directive", type: UicTextareaAutoresizeDirective, selector: "[textareaAutoresize]", inputs: ["minRows", "maxRows", "textareaAutoresize"] }, { kind: "directive", type: UicTextareaAutoresizeMinRowsDirective, selector: "[textareaAutoresizeMinRows]", inputs: ["textareaAutoresizeMinRows"] }, { kind: "directive", type: UicTextareaAutoresizeMaxRowsDirective, selector: "[textareaAutoresizeMaxRows]", inputs: ["textareaAutoresizeMaxRows"] }, { kind: "component", type: UicInputComponent, selector: "ui-input", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "disabled", "loading"] }, { kind: "component", type: UicCheckboxComponent, selector: "ui-checkbox", inputs: ["icon", "iconColor", "label", "tip", "type", "placeholder", "loading", "noPadding", "disabled"] }, { kind: "component", type: UicPhoneInputComponent, selector: "ui-phone-input", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "placeholder", "disabled", "loading", "preferredCountries", "flagPath", "countries"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: UicRepeaterComponent, selector: "ui-repeater", inputs: ["formArray", "field", "cols", "error", "fileUidResolverFn", "selectOptionsResolver", "parentForm"] }] });
|
|
5929
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: UicDynamicFormComponent, isStandalone: true, selector: "ui-dynamic-form", inputs: { fields: "fields", contextFields: "contextFields", isSubForm: "isSubForm", form: "form", disabled: "disabled", externalValidationStates: "externalValidationStates", voiceToTextSilenceMs: "voiceToTextSilenceMs", cols: "cols", iconMode: "iconMode", fileUidResolverFn: "fileUidResolverFn", selectOptionsResolver: "selectOptionsResolver", parentFormValues: "parentFormValues" }, outputs: { fieldBlur: "fieldBlur" }, ngImport: i0, template: "<div class=\"form\" [ngStyle]=\"{'--cols': cols, '--min': '180px'}\" [formGroup]=\"form\">\n @for (state of visibleFieldStates(); track state.field.name) {\n @let field = state.field;\n @let control = state.control;\n @let currentValue = state.value ?? '';\n @let error = getControlErrorMessages(control, field)[0];\n\n @if (!field.hidden && !field.otherFor) {\n <div [style.grid-column]=\"getGridColumn(field)\" (focusout)=\"onFieldContainerFocusout(field, $event)\">\n @if (['text', 'number'].includes(field.type)) {\n @let inputColor = getInputColor(field, currentValue);\n <ui-input\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [disabled]=\"!!control?.disabled\"\n [internalIconColor]=\"inputColor\"\n [internalIcon]=\"field.internalIcon || (currentValue !== '' ? getIconByColor(field, inputColor) : '')\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\">\n <input #inp\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [type]=\"field.type\"\n [step]=\"field.step\"\n [min]=\"field.min\"\n [max]=\"field.max\"\n [minLength]=\"field.minLength||null\"\n [maxlength]=\"field.maxLength||null\"\n [placeholder]=\"field.placeholder??field.label\"/>\n @if (field.maxLength && field.showCounter) {\n <span counter>{{inp.value.length}} /{{field.maxLength}}</span>\n }\n </ui-input>\n }\n @if (field.type === 'textarea') {\n <ui-input\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [disabled]=\"!!control?.disabled\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [internalIcon]=\"field.internalIcon??''\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\">\n <textarea #ta\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [minLength]=\"field.minLength||null\"\n [maxlength]=\"field.maxLength||null\"\n [textareaAutoresize]=\"field.textareaResize\"\n [textareaAutoresizeMinRows]=\"field.resizeMinRows??1\"\n [textareaAutoresizeMaxRows]=\"field.resizeMaxRows??5\"\n [rows]=\"field.resizeMinRows??3\"\n [placeholder]=\"field.placeholder??field.label\"\n ></textarea>\n @if (field.voiceToTextEnabled && !control?.disabled) {\n @let listening = isListening(field.name);\n <div class=\"speak-icon\" (click)=\"ta.focus()\">\n <ui-button\n [disabled]=\"listening\"\n style=\"margin-bottom: 2px;\"\n (click)=\"voiceToText(ta, field.name)\"\n [icon]=\"listening?'ri-mic-fill':'ri-mic-line'\"\n [type]=\"listening?'filled':'bordered'\"\n size=\"s\"\n [iconOnly]=\"true\"\n ></ui-button>\n @if (listening) {\n <i class=\"ri-voiceprint-line\"></i>\n }\n </div>\n }\n @if (field.showCounter) {\n <span counter>\n {{ta.value.length}}\n @if (field.maxLength) {\n /{{field.maxLength}}\n }\n </span>\n }\n </ui-input>\n }\n @if (field.type === 'phone') {\n <ui-phone-input\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\"\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [placeholder]=\"field.placeholder||field.label||''\"\n >\n </ui-phone-input>\n }\n @else if (field.type === 'date') {\n <ui-date-picker\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [tip]=\"field.tip??''\"\n [justMonth]=\"!!field.monthMode\"\n [min]=\"field.minDate??''\"\n [max]=\"field.maxDate??''\"\n [monthDay]=\"field.monthDay||'first'\"\n [formControlName]=\"field.name\"\n ></ui-date-picker>\n }\n @else if (field.type === 'time') {\n <ui-time-picker\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [tip]=\"field.tip??''\"\n [interval]=\"field.timeInterval??5\"\n [formControlName]=\"field.name\"\n ></ui-time-picker>\n }\n @else if (field.type === 'select') {\n <ui-select\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [loading]=\"field.loading??false\"\n [nullable]=\"field.selectNullable??false\"\n [showSubtitle]=\"field.showSubtitle??false\"\n [searcherEnabled]=\"field.selectSearchEnabled??false\"\n [tip]=\"field.tip??''\"\n [formControlName]=\"field.name\"\n [options]=\"optionsFor(field)\"\n ></ui-select>\n }\n @else if (field.type === 'multyselect') {\n <ui-multy-select\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [tip]=\"field.tip??''\"\n [formControlName]=\"field.name\"\n [maxSelections]=\"field.maxSelections ?? null\"\n [options]=\"optionsFor(field)\"\n ></ui-multy-select>\n }\n @else if (field.type === 'searcher') {\n <ui-searcher\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\"\n [searchFn]=\"getSearcherFn(field)\"\n [itemDisplayFn]=\"getSearcherDisplayFn(field)\"\n [itemIsEnabledFn]=\"getSearcherIsEnabledFn(field)\"\n [placeholder]=\"field.placeholder??'common.search_ellipsis'\"\n [error]=\"error\"\n ></ui-searcher>\n }\n @else if (field.type === 'multisearcher') {\n <ui-multy-searcher\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\"\n [searchFn]=\"getSearcherFn(field)\"\n [itemDisplayFn]=\"getSearcherDisplayFn(field)\"\n [itemIsEnabledFn]=\"getSearcherIsEnabledFn(field)\"\n [placeholder]=\"field.placeholder??'common.search_ellipsis'\"\n [error]=\"error\"\n ></ui-multy-searcher>\n }\n @else if (field.type === 'file') {\n <ui-file-input\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [multy]=\"field.multyEnabled??false\"\n [tip]=\"field.tip??''\"\n [fileTypes]=\"field.fileTypes??null\"\n [templateUrl]=\"field.templateUrl??''\"\n [templateText]=\"field.templateText??'Descarga el formato haciendo'\"\n [templateLinkLabel]=\"field.templateLinkLabel??'click aqu\u00ED'\"\n [fileUidResolverFn]=\"fileUidResolverFn\"\n [formControlName]=\"field.name\"\n ></ui-file-input>\n }\n @else if (['checkbox', 'switch'].includes(field.type)) {\n <ui-checkbox\n [label]=\"(field.label??'') + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [placeholder]=\"field.placeholder??''\"\n [tip]=\"field.tip??''\"\n [type]=\"field.type === 'checkbox' ? 'checkbox' : 'switch'\"\n ></ui-checkbox>\n }\n @else if (field.type === 'radio') {\n <ui-radio\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [tip]=\"field.tip??''\"\n [loading]=\"field.loading??false\"\n [error]=\"error\"\n [options]=\"optionsFor(field)\"\n ></ui-radio>\n }\n @else if (field.type === 'slider') {\n <ui-slider\n [min]=\"field.min??0\"\n [max]=\"field.max??100\"\n [step]=\"field.sliderInterval??1\"\n [markerCount]=\"field.sliderMarks??5\"\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [tip]=\"field.tip??''\"\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n ></ui-slider>\n }\n @else if (field.type === 'scale') {\n <ui-scale\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [tip]=\"field.tip??''\"\n [error]=\"error\"\n [min]=\"field.scaleMin ?? 1\"\n [max]=\"field.scaleMax ?? 5\"\n [mode]=\"field.scaleMode ?? 'number'\"\n [scaleIcon]=\"field.scaleIcon || 'ri-star-fill'\"\n [labels]=\"field.scaleLabels ?? []\"\n ></ui-scale>\n }\n @else if (field.type === 'distribution') {\n <ui-distribution\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [tip]=\"field.tip??''\"\n [error]=\"error\"\n [options]=\"field.options || []\"\n ></ui-distribution>\n }\n @else if (field.type === 'pool') {\n <ui-pool-options\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [multy]=\"field.multyEnabled??false\"\n [tip]=\"field.tip??''\"\n [listViewTitle]=\"field.poolTitle??'common.selected'\"\n [enabledListView]=\"field.poolEnabledListView||false\"\n [displayMode]=\"field.poolDisplayMode ?? 'flex'\"\n [gridColumns]=\"field.poolGridColumns ?? 2\"\n [maxSelections]=\"field.maxSelections ?? null\"\n [formControlName]=\"field.name\"\n [options]=\"field.options || []\"\n ></ui-pool-options>\n }\n @else if (field.type === 'repeater') {\n <ui-repeater\n [formArray]=\"asFormArray(control)\"\n [field]=\"field\"\n [cols]=\"cols\"\n [error]=\"error\"\n [fileUidResolverFn]=\"fileUidResolverFn\"\n [selectOptionsResolver]=\"selectOptionsResolver\"\n [parentForm]=\"form\"\n ></ui-repeater>\n }\n\n <!-- \"Otros (especifica)\": el texto va pegado a su pregunta y solo existe mientras se eligi\u00F3 \"Otros\" -->\n @if (otherStateFor(field); as other) {\n <div class=\"other-specify\" (focusout)=\"onFieldContainerFocusout(other.field, $event)\">\n <ui-input\n [error]=\"getControlErrorMessages(other.control, other.field)[0]\"\n [disabled]=\"!!other.control?.disabled\">\n <input\n type=\"text\"\n [id]=\"other.field.name\"\n [formControlName]=\"other.field.name\"\n [maxlength]=\"otherTextMaxLength\"\n [attr.aria-label]=\"other.field.label\"\n [placeholder]=\"(other.field.placeholder ?? '') + (other.field.required ? ' *' : '')\"/>\n </ui-input>\n </div>\n }\n </div>\n }\n }\n</div>\n", styles: [".form{width:100%;display:grid;align-items:stretch;gap:var(--uic-form-gap, 1rem);padding-bottom:.75rem}@media (max-width: 479px){.form{grid-template-columns:1fr}}@media (min-width: 768px){.form{grid-template-columns:repeat(var(--cols),minmax(0,1fr))}}@media (min-width: 480px) and (max-width: 767px){.form{grid-template-columns:repeat(min(var(--cols),2),minmax(0,1fr))}}.form>*{min-width:0}h2{margin-top:1.5rem}.speak-icon{display:flex;width:100%;align-items:center;gap:10px}.speak-icon i{font-size:20px;color:var(--primary-500)}textarea{resize:none}.other-specify{margin-top:6px;padding-left:12px;border-left:solid 2px var(--uic-other-specify-guide, var(--primary-200));animation:other-specify-in .15s ease-out}@keyframes other-specify-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}@media (prefers-reduced-motion: reduce){.other-specify{animation:none}}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: UicDatePickerComponent, selector: "ui-date-picker", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "disabled", "label", "error", "tip", "max", "min", "justMonth", "monthDay"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: UicSliderComponent, selector: "ui-slider", inputs: ["icon", "iconColor", "label", "error", "tip", "min", "max", "step", "markerCount", "disabled", "loading"] }, { kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "component", type: UicPoolOptionsComponent, selector: "ui-pool-options", inputs: ["icon", "iconColor", "size", "label", "error", "tip", "disabled", "loading", "multy", "enabledListView", "listViewTitle", "options", "displayMode", "gridColumns", "maxSelections"] }, { kind: "component", type: UicTimePickerComponent, selector: "ui-time-picker", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "disabled", "label", "error", "tip", "interval"] }, { kind: "component", type: UicRadioComponent, selector: "ui-radio", inputs: ["icon", "iconColor", "label", "error", "tip", "disabled", "loading", "options", "emptyText", "direction"] }, { kind: "component", type: UicScaleComponent, selector: "ui-scale", inputs: ["icon", "iconColor", "label", "error", "tip", "disabled", "min", "max", "mode", "scaleIcon", "labels"] }, { kind: "component", type: UicDistributionComponent, selector: "ui-distribution", inputs: ["icon", "iconColor", "label", "error", "tip", "disabled", "options"] }, { kind: "component", type: UicSearcherComponent, selector: "ui-searcher", inputs: ["icon", "iconColor", "internalIcon", "size", "label", "error", "tip", "showSubtitle", "disabled", "loading", "minimumSearchLength", "showSelected", "placeholder", "searchFn", "itemDisplayFn", "itemIsEnabledFn", "manualSearch", "stateless"], outputs: ["pickedItem"] }, { kind: "component", type: UicMultySelectComponent, selector: "ui-multy-select", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "showSubtitle", "disabled", "nonSelectedText", "allSelectedText", "loading", "options", "maxSelections"] }, { kind: "component", type: UicMultySearcherComponent, selector: "ui-multy-searcher", inputs: ["icon", "iconColor", "internalIcon", "label", "error", "tip", "disabled", "loading", "minimumSearchLength", "placeholder", "searchFn", "itemDisplayFn", "itemIsEnabledFn", "manualSearch"] }, { kind: "component", type: UicFileInputComponent, selector: "ui-file-input", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "disabled", "loading", "multy", "fileTypes", "fileUidResolverFn", "templateUrl", "templateText", "templateLinkLabel"] }, { kind: "component", type: UicSelectComponent, selector: "ui-select", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "showSubtitle", "disabled", "nonSelectedText", "noneText", "emptyText", "searcherEnabled", "loading", "nullable", "options"] }, { kind: "directive", type: UicTextareaAutoresizeDirective, selector: "[textareaAutoresize]", inputs: ["minRows", "maxRows", "textareaAutoresize"] }, { kind: "directive", type: UicTextareaAutoresizeMinRowsDirective, selector: "[textareaAutoresizeMinRows]", inputs: ["textareaAutoresizeMinRows"] }, { kind: "directive", type: UicTextareaAutoresizeMaxRowsDirective, selector: "[textareaAutoresizeMaxRows]", inputs: ["textareaAutoresizeMaxRows"] }, { kind: "component", type: UicInputComponent, selector: "ui-input", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "disabled", "loading"] }, { kind: "component", type: UicCheckboxComponent, selector: "ui-checkbox", inputs: ["icon", "iconColor", "label", "tip", "type", "placeholder", "loading", "noPadding", "disabled"] }, { kind: "component", type: UicPhoneInputComponent, selector: "ui-phone-input", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "placeholder", "disabled", "loading", "preferredCountries", "flagPath", "countries"] }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: UicRepeaterComponent, selector: "ui-repeater", inputs: ["formArray", "field", "cols", "error", "fileUidResolverFn", "selectOptionsResolver", "parentForm"] }] });
|
|
5642
5930
|
}
|
|
5643
5931
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicDynamicFormComponent, decorators: [{
|
|
5644
5932
|
type: Component,
|
|
@@ -5652,6 +5940,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5652
5940
|
UicTimePickerComponent,
|
|
5653
5941
|
UicRadioComponent,
|
|
5654
5942
|
UicScaleComponent,
|
|
5943
|
+
UicDistributionComponent,
|
|
5655
5944
|
UicSearcherComponent,
|
|
5656
5945
|
UicMultySelectComponent,
|
|
5657
5946
|
UicMultySearcherComponent,
|
|
@@ -5665,7 +5954,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5665
5954
|
UicPhoneInputComponent,
|
|
5666
5955
|
FormsModule,
|
|
5667
5956
|
UicRepeaterComponent
|
|
5668
|
-
], template: "<div class=\"form\" [ngStyle]=\"{'--cols': cols, '--min': '180px'}\" [formGroup]=\"form\">\r\n @for (state of visibleFieldStates(); track state.field.name) {\r\n @let field = state.field;\r\n @let control = state.control;\r\n @let currentValue = state.value ?? '';\r\n @let error = getControlErrorMessages(control, field)[0];\r\n\r\n @if (!field.hidden) {\r\n <div [style.grid-column]=\"getGridColumn(field)\" (focusout)=\"onFieldContainerFocusout(field, $event)\">\r\n @if (['text', 'number'].includes(field.type)) {\r\n @let inputColor = getInputColor(field, currentValue);\r\n <ui-input\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [disabled]=\"!!control?.disabled\"\r\n [internalIconColor]=\"inputColor\"\r\n [internalIcon]=\"field.internalIcon || (currentValue !== '' ? getIconByColor(field, inputColor) : '')\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\">\r\n <input #inp\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [type]=\"field.type\"\r\n [step]=\"field.step\"\r\n [min]=\"field.min\"\r\n [max]=\"field.max\"\r\n [minLength]=\"field.minLength||null\"\r\n [maxlength]=\"field.maxLength||null\"\r\n [placeholder]=\"field.placeholder??field.label\"/>\r\n @if (field.maxLength && field.showCounter) {\r\n <span counter>{{inp.value.length}} /{{field.maxLength}}</span>\r\n }\r\n </ui-input>\r\n }\r\n @if (field.type === 'textarea') {\r\n <ui-input\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [disabled]=\"!!control?.disabled\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\">\r\n <textarea #ta\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [minLength]=\"field.minLength||null\"\r\n [maxlength]=\"field.maxLength||null\"\r\n [textareaAutoresize]=\"field.textareaResize\"\r\n [textareaAutoresizeMinRows]=\"field.resizeMinRows??1\"\r\n [textareaAutoresizeMaxRows]=\"field.resizeMaxRows??5\"\r\n [rows]=\"field.resizeMinRows??3\"\r\n [placeholder]=\"field.placeholder??field.label\"\r\n ></textarea>\r\n @if (field.voiceToTextEnabled && !control?.disabled) {\r\n @let listening = isListening(field.name);\r\n <div class=\"speak-icon\" (click)=\"ta.focus()\">\r\n <ui-button\r\n [disabled]=\"listening\"\r\n style=\"margin-bottom: 2px;\"\r\n (click)=\"voiceToText(ta, field.name)\"\r\n [icon]=\"listening?'ri-mic-fill':'ri-mic-line'\"\r\n [type]=\"listening?'filled':'bordered'\"\r\n size=\"s\"\r\n [iconOnly]=\"true\"\r\n ></ui-button>\r\n @if (listening) {\r\n <i class=\"ri-voiceprint-line\"></i>\r\n }\r\n </div>\r\n }\r\n @if (field.showCounter) {\r\n <span counter>\r\n {{ta.value.length}}\r\n @if (field.maxLength) {\r\n /{{field.maxLength}}\r\n }\r\n </span>\r\n }\r\n </ui-input>\r\n }\r\n @if (field.type === 'phone') {\r\n <ui-phone-input\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\"\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [placeholder]=\"field.placeholder||field.label||''\"\r\n >\r\n </ui-phone-input>\r\n }\r\n @else if (field.type === 'date') {\r\n <ui-date-picker\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [tip]=\"field.tip??''\"\r\n [justMonth]=\"!!field.monthMode\"\r\n [min]=\"field.minDate??''\"\r\n [max]=\"field.maxDate??''\"\r\n [monthDay]=\"field.monthDay||'first'\"\r\n [formControlName]=\"field.name\"\r\n ></ui-date-picker>\r\n }\r\n @else if (field.type === 'time') {\r\n <ui-time-picker\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [tip]=\"field.tip??''\"\r\n [interval]=\"field.timeInterval??5\"\r\n [formControlName]=\"field.name\"\r\n ></ui-time-picker>\r\n }\r\n @else if (field.type === 'select') {\r\n <ui-select\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [loading]=\"field.loading??false\"\r\n [nullable]=\"field.selectNullable??false\"\r\n [showSubtitle]=\"field.showSubtitle??false\"\r\n [searcherEnabled]=\"field.selectSearchEnabled??false\"\r\n [tip]=\"field.tip??''\"\r\n [formControlName]=\"field.name\"\r\n [options]=\"field.options || []\"\r\n ></ui-select>\r\n }\r\n @else if (field.type === 'multyselect') {\r\n <ui-multy-select\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [tip]=\"field.tip??''\"\r\n [formControlName]=\"field.name\"\r\n [maxSelections]=\"field.maxSelections ?? null\"\r\n [options]=\"field.options || []\"\r\n ></ui-multy-select>\r\n }\r\n @else if (field.type === 'searcher') {\r\n <ui-searcher\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\"\r\n [searchFn]=\"getSearcherFn(field)\"\r\n [itemDisplayFn]=\"getSearcherDisplayFn(field)\"\r\n [itemIsEnabledFn]=\"getSearcherIsEnabledFn(field)\"\r\n [placeholder]=\"field.placeholder??'common.search_ellipsis'\"\r\n [error]=\"error\"\r\n ></ui-searcher>\r\n }\r\n @else if (field.type === 'multisearcher') {\r\n <ui-multy-searcher\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [tip]=\"field.tip??''\"\r\n [searchFn]=\"getSearcherFn(field)\"\r\n [itemDisplayFn]=\"getSearcherDisplayFn(field)\"\r\n [itemIsEnabledFn]=\"getSearcherIsEnabledFn(field)\"\r\n [placeholder]=\"field.placeholder??'common.search_ellipsis'\"\r\n [error]=\"error\"\r\n ></ui-multy-searcher>\r\n }\r\n @else if (field.type === 'file') {\r\n <ui-file-input\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [internalIcon]=\"field.internalIcon??''\"\r\n [internalIconColor]=\"field.internalIconColor??'grey'\"\r\n [multy]=\"field.multyEnabled??false\"\r\n [tip]=\"field.tip??''\"\r\n [fileTypes]=\"field.fileTypes??null\"\r\n [templateUrl]=\"field.templateUrl??''\"\r\n [templateText]=\"field.templateText??'Descarga el formato haciendo'\"\r\n [templateLinkLabel]=\"field.templateLinkLabel??'click aqu\u00ED'\"\r\n [fileUidResolverFn]=\"fileUidResolverFn\"\r\n [formControlName]=\"field.name\"\r\n ></ui-file-input>\r\n }\r\n @else if (['checkbox', 'switch'].includes(field.type)) {\r\n <ui-checkbox\r\n [label]=\"(field.label??'') + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [placeholder]=\"field.placeholder??''\"\r\n [tip]=\"field.tip??''\"\r\n [type]=\"field.type === 'checkbox' ? 'checkbox' : 'switch'\"\r\n ></ui-checkbox>\r\n }\r\n @else if (field.type === 'radio') {\r\n <ui-radio\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [tip]=\"field.tip??''\"\r\n [loading]=\"field.loading??false\"\r\n [error]=\"error\"\r\n [options]=\"field.options || []\"\r\n ></ui-radio>\r\n }\r\n @else if (field.type === 'slider') {\r\n <ui-slider\r\n [min]=\"field.min??0\"\r\n [max]=\"field.max??100\"\r\n [step]=\"field.sliderInterval??1\"\r\n [markerCount]=\"field.sliderMarks??5\"\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [tip]=\"field.tip??''\"\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n ></ui-slider>\r\n }\r\n @else if (field.type === 'scale') {\r\n <ui-scale\r\n [id]=\"field.name\"\r\n [formControlName]=\"field.name\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [tip]=\"field.tip??''\"\r\n [error]=\"error\"\r\n [min]=\"field.scaleMin ?? 1\"\r\n [max]=\"field.scaleMax ?? 5\"\r\n [mode]=\"field.scaleMode ?? 'number'\"\r\n [scaleIcon]=\"field.scaleIcon || 'ri-star-fill'\"\r\n [labels]=\"field.scaleLabels ?? []\"\r\n ></ui-scale>\r\n }\r\n @else if (field.type === 'pool') {\r\n <ui-pool-options\r\n [error]=\"error\"\r\n [label]=\"field.label + (field.required ? ' *' : '')\"\r\n [id]=\"field.name\"\r\n [icon]=\"getFieldIcon(field)\"\r\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\r\n [loading]=\"field.loading??false\"\r\n [multy]=\"field.multyEnabled??false\"\r\n [tip]=\"field.tip??''\"\r\n [listViewTitle]=\"field.poolTitle??'common.selected'\"\r\n [enabledListView]=\"field.poolEnabledListView||false\"\r\n [displayMode]=\"field.poolDisplayMode ?? 'flex'\"\r\n [gridColumns]=\"field.poolGridColumns ?? 2\"\r\n [maxSelections]=\"field.maxSelections ?? null\"\r\n [formControlName]=\"field.name\"\r\n [options]=\"field.options || []\"\r\n ></ui-pool-options>\r\n }\r\n @else if (field.type === 'repeater') {\r\n <ui-repeater\r\n [formArray]=\"asFormArray(control)\"\r\n [field]=\"field\"\r\n [cols]=\"cols\"\r\n [error]=\"error\"\r\n [fileUidResolverFn]=\"fileUidResolverFn\"\r\n [selectOptionsResolver]=\"selectOptionsResolver\"\r\n [parentForm]=\"form\"\r\n ></ui-repeater>\r\n }\r\n </div>\r\n }\r\n }\r\n</div>\r\n", styles: [".form{width:100%;display:grid;align-items:stretch;gap:var(--uic-form-gap, 1rem);padding-bottom:.75rem}@media (max-width: 479px){.form{grid-template-columns:1fr}}@media (min-width: 768px){.form{grid-template-columns:repeat(var(--cols),minmax(0,1fr))}}@media (min-width: 480px) and (max-width: 767px){.form{grid-template-columns:repeat(min(var(--cols),2),minmax(0,1fr))}}.form>*{min-width:0}h2{margin-top:1.5rem}.speak-icon{display:flex;width:100%;align-items:center;gap:10px}.speak-icon i{font-size:20px;color:var(--primary-500)}textarea{resize:none}\n"] }]
|
|
5957
|
+
], template: "<div class=\"form\" [ngStyle]=\"{'--cols': cols, '--min': '180px'}\" [formGroup]=\"form\">\n @for (state of visibleFieldStates(); track state.field.name) {\n @let field = state.field;\n @let control = state.control;\n @let currentValue = state.value ?? '';\n @let error = getControlErrorMessages(control, field)[0];\n\n @if (!field.hidden && !field.otherFor) {\n <div [style.grid-column]=\"getGridColumn(field)\" (focusout)=\"onFieldContainerFocusout(field, $event)\">\n @if (['text', 'number'].includes(field.type)) {\n @let inputColor = getInputColor(field, currentValue);\n <ui-input\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [disabled]=\"!!control?.disabled\"\n [internalIconColor]=\"inputColor\"\n [internalIcon]=\"field.internalIcon || (currentValue !== '' ? getIconByColor(field, inputColor) : '')\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\">\n <input #inp\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [type]=\"field.type\"\n [step]=\"field.step\"\n [min]=\"field.min\"\n [max]=\"field.max\"\n [minLength]=\"field.minLength||null\"\n [maxlength]=\"field.maxLength||null\"\n [placeholder]=\"field.placeholder??field.label\"/>\n @if (field.maxLength && field.showCounter) {\n <span counter>{{inp.value.length}} /{{field.maxLength}}</span>\n }\n </ui-input>\n }\n @if (field.type === 'textarea') {\n <ui-input\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [disabled]=\"!!control?.disabled\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [internalIcon]=\"field.internalIcon??''\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\">\n <textarea #ta\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [minLength]=\"field.minLength||null\"\n [maxlength]=\"field.maxLength||null\"\n [textareaAutoresize]=\"field.textareaResize\"\n [textareaAutoresizeMinRows]=\"field.resizeMinRows??1\"\n [textareaAutoresizeMaxRows]=\"field.resizeMaxRows??5\"\n [rows]=\"field.resizeMinRows??3\"\n [placeholder]=\"field.placeholder??field.label\"\n ></textarea>\n @if (field.voiceToTextEnabled && !control?.disabled) {\n @let listening = isListening(field.name);\n <div class=\"speak-icon\" (click)=\"ta.focus()\">\n <ui-button\n [disabled]=\"listening\"\n style=\"margin-bottom: 2px;\"\n (click)=\"voiceToText(ta, field.name)\"\n [icon]=\"listening?'ri-mic-fill':'ri-mic-line'\"\n [type]=\"listening?'filled':'bordered'\"\n size=\"s\"\n [iconOnly]=\"true\"\n ></ui-button>\n @if (listening) {\n <i class=\"ri-voiceprint-line\"></i>\n }\n </div>\n }\n @if (field.showCounter) {\n <span counter>\n {{ta.value.length}}\n @if (field.maxLength) {\n /{{field.maxLength}}\n }\n </span>\n }\n </ui-input>\n }\n @if (field.type === 'phone') {\n <ui-phone-input\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\"\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [placeholder]=\"field.placeholder||field.label||''\"\n >\n </ui-phone-input>\n }\n @else if (field.type === 'date') {\n <ui-date-picker\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [tip]=\"field.tip??''\"\n [justMonth]=\"!!field.monthMode\"\n [min]=\"field.minDate??''\"\n [max]=\"field.maxDate??''\"\n [monthDay]=\"field.monthDay||'first'\"\n [formControlName]=\"field.name\"\n ></ui-date-picker>\n }\n @else if (field.type === 'time') {\n <ui-time-picker\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [tip]=\"field.tip??''\"\n [interval]=\"field.timeInterval??5\"\n [formControlName]=\"field.name\"\n ></ui-time-picker>\n }\n @else if (field.type === 'select') {\n <ui-select\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [loading]=\"field.loading??false\"\n [nullable]=\"field.selectNullable??false\"\n [showSubtitle]=\"field.showSubtitle??false\"\n [searcherEnabled]=\"field.selectSearchEnabled??false\"\n [tip]=\"field.tip??''\"\n [formControlName]=\"field.name\"\n [options]=\"optionsFor(field)\"\n ></ui-select>\n }\n @else if (field.type === 'multyselect') {\n <ui-multy-select\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [tip]=\"field.tip??''\"\n [formControlName]=\"field.name\"\n [maxSelections]=\"field.maxSelections ?? null\"\n [options]=\"optionsFor(field)\"\n ></ui-multy-select>\n }\n @else if (field.type === 'searcher') {\n <ui-searcher\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\"\n [searchFn]=\"getSearcherFn(field)\"\n [itemDisplayFn]=\"getSearcherDisplayFn(field)\"\n [itemIsEnabledFn]=\"getSearcherIsEnabledFn(field)\"\n [placeholder]=\"field.placeholder??'common.search_ellipsis'\"\n [error]=\"error\"\n ></ui-searcher>\n }\n @else if (field.type === 'multisearcher') {\n <ui-multy-searcher\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [tip]=\"field.tip??''\"\n [searchFn]=\"getSearcherFn(field)\"\n [itemDisplayFn]=\"getSearcherDisplayFn(field)\"\n [itemIsEnabledFn]=\"getSearcherIsEnabledFn(field)\"\n [placeholder]=\"field.placeholder??'common.search_ellipsis'\"\n [error]=\"error\"\n ></ui-multy-searcher>\n }\n @else if (field.type === 'file') {\n <ui-file-input\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [internalIcon]=\"field.internalIcon??''\"\n [internalIconColor]=\"field.internalIconColor??'grey'\"\n [multy]=\"field.multyEnabled??false\"\n [tip]=\"field.tip??''\"\n [fileTypes]=\"field.fileTypes??null\"\n [templateUrl]=\"field.templateUrl??''\"\n [templateText]=\"field.templateText??'Descarga el formato haciendo'\"\n [templateLinkLabel]=\"field.templateLinkLabel??'click aqu\u00ED'\"\n [fileUidResolverFn]=\"fileUidResolverFn\"\n [formControlName]=\"field.name\"\n ></ui-file-input>\n }\n @else if (['checkbox', 'switch'].includes(field.type)) {\n <ui-checkbox\n [label]=\"(field.label??'') + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [placeholder]=\"field.placeholder??''\"\n [tip]=\"field.tip??''\"\n [type]=\"field.type === 'checkbox' ? 'checkbox' : 'switch'\"\n ></ui-checkbox>\n }\n @else if (field.type === 'radio') {\n <ui-radio\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [tip]=\"field.tip??''\"\n [loading]=\"field.loading??false\"\n [error]=\"error\"\n [options]=\"optionsFor(field)\"\n ></ui-radio>\n }\n @else if (field.type === 'slider') {\n <ui-slider\n [min]=\"field.min??0\"\n [max]=\"field.max??100\"\n [step]=\"field.sliderInterval??1\"\n [markerCount]=\"field.sliderMarks??5\"\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [tip]=\"field.tip??''\"\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n ></ui-slider>\n }\n @else if (field.type === 'scale') {\n <ui-scale\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [tip]=\"field.tip??''\"\n [error]=\"error\"\n [min]=\"field.scaleMin ?? 1\"\n [max]=\"field.scaleMax ?? 5\"\n [mode]=\"field.scaleMode ?? 'number'\"\n [scaleIcon]=\"field.scaleIcon || 'ri-star-fill'\"\n [labels]=\"field.scaleLabels ?? []\"\n ></ui-scale>\n }\n @else if (field.type === 'distribution') {\n <ui-distribution\n [id]=\"field.name\"\n [formControlName]=\"field.name\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [tip]=\"field.tip??''\"\n [error]=\"error\"\n [options]=\"field.options || []\"\n ></ui-distribution>\n }\n @else if (field.type === 'pool') {\n <ui-pool-options\n [error]=\"error\"\n [label]=\"field.label + (field.required ? ' *' : '')\"\n [id]=\"field.name\"\n [icon]=\"getFieldIcon(field)\"\n [iconColor]=\"getFieldIconColor(field, control, currentValue)\"\n [loading]=\"field.loading??false\"\n [multy]=\"field.multyEnabled??false\"\n [tip]=\"field.tip??''\"\n [listViewTitle]=\"field.poolTitle??'common.selected'\"\n [enabledListView]=\"field.poolEnabledListView||false\"\n [displayMode]=\"field.poolDisplayMode ?? 'flex'\"\n [gridColumns]=\"field.poolGridColumns ?? 2\"\n [maxSelections]=\"field.maxSelections ?? null\"\n [formControlName]=\"field.name\"\n [options]=\"field.options || []\"\n ></ui-pool-options>\n }\n @else if (field.type === 'repeater') {\n <ui-repeater\n [formArray]=\"asFormArray(control)\"\n [field]=\"field\"\n [cols]=\"cols\"\n [error]=\"error\"\n [fileUidResolverFn]=\"fileUidResolverFn\"\n [selectOptionsResolver]=\"selectOptionsResolver\"\n [parentForm]=\"form\"\n ></ui-repeater>\n }\n\n <!-- \"Otros (especifica)\": el texto va pegado a su pregunta y solo existe mientras se eligi\u00F3 \"Otros\" -->\n @if (otherStateFor(field); as other) {\n <div class=\"other-specify\" (focusout)=\"onFieldContainerFocusout(other.field, $event)\">\n <ui-input\n [error]=\"getControlErrorMessages(other.control, other.field)[0]\"\n [disabled]=\"!!other.control?.disabled\">\n <input\n type=\"text\"\n [id]=\"other.field.name\"\n [formControlName]=\"other.field.name\"\n [maxlength]=\"otherTextMaxLength\"\n [attr.aria-label]=\"other.field.label\"\n [placeholder]=\"(other.field.placeholder ?? '') + (other.field.required ? ' *' : '')\"/>\n </ui-input>\n </div>\n }\n </div>\n }\n }\n</div>\n", styles: [".form{width:100%;display:grid;align-items:stretch;gap:var(--uic-form-gap, 1rem);padding-bottom:.75rem}@media (max-width: 479px){.form{grid-template-columns:1fr}}@media (min-width: 768px){.form{grid-template-columns:repeat(var(--cols),minmax(0,1fr))}}@media (min-width: 480px) and (max-width: 767px){.form{grid-template-columns:repeat(min(var(--cols),2),minmax(0,1fr))}}.form>*{min-width:0}h2{margin-top:1.5rem}.speak-icon{display:flex;width:100%;align-items:center;gap:10px}.speak-icon i{font-size:20px;color:var(--primary-500)}textarea{resize:none}.other-specify{margin-top:6px;padding-left:12px;border-left:solid 2px var(--uic-other-specify-guide, var(--primary-200));animation:other-specify-in .15s ease-out}@keyframes other-specify-in{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:none}}@media (prefers-reduced-motion: reduce){.other-specify{animation:none}}\n"] }]
|
|
5669
5958
|
}], ctorParameters: () => [{ type: i0.NgZone }], propDecorators: { fields: [{
|
|
5670
5959
|
type: Input
|
|
5671
5960
|
}], contextFields: [{
|
|
@@ -5707,6 +5996,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5707
5996
|
class UicFormEngine {
|
|
5708
5997
|
fb = inject(FormBuilder);
|
|
5709
5998
|
formState = inject(UicFormStateService);
|
|
5999
|
+
i18n = inject(UicTranslateService);
|
|
5710
6000
|
// CONFIGURACIÓN
|
|
5711
6001
|
schema;
|
|
5712
6002
|
fields = [];
|
|
@@ -5920,6 +6210,7 @@ class UicFormEngine {
|
|
|
5920
6210
|
if (field.pattern instanceof RegExp)
|
|
5921
6211
|
validators.push(Validators.pattern(field.pattern));
|
|
5922
6212
|
validators.push(...uicSelectionValidatorsFor(field));
|
|
6213
|
+
validators.push(...uicDistributionValidatorsFor(field));
|
|
5923
6214
|
return validators;
|
|
5924
6215
|
}
|
|
5925
6216
|
submit() {
|
|
@@ -6895,7 +7186,7 @@ class UicFormEngine {
|
|
|
6895
7186
|
current[parts[parts.length - 1]] = value;
|
|
6896
7187
|
}
|
|
6897
7188
|
syncEffectiveSchema() {
|
|
6898
|
-
|
|
7189
|
+
const schema = this.schema ?? {
|
|
6899
7190
|
cols: this.cols ?? 2,
|
|
6900
7191
|
blocks: [
|
|
6901
7192
|
{
|
|
@@ -6903,8 +7194,24 @@ class UicFormEngine {
|
|
|
6903
7194
|
}
|
|
6904
7195
|
]
|
|
6905
7196
|
};
|
|
7197
|
+
this.effectiveSchema = this.expandOtherOptionFields(schema);
|
|
6906
7198
|
this.touch();
|
|
6907
7199
|
}
|
|
7200
|
+
/**
|
|
7201
|
+
* Agrega el campo de texto de cada pregunta con "Otros" (ver other-option.ts).
|
|
7202
|
+
* Sin preguntas con "Otros" devuelve el mismo esquema, sin copiarlo.
|
|
7203
|
+
*/
|
|
7204
|
+
expandOtherOptionFields(schema) {
|
|
7205
|
+
const blocks = schema.blocks ?? [];
|
|
7206
|
+
if (!blocks.some(block => uicContainsOtherOption(block.fields)))
|
|
7207
|
+
return schema;
|
|
7208
|
+
const label = this.i18n.translate('other_option.label');
|
|
7209
|
+
const placeholder = this.i18n.translate('other_option.placeholder');
|
|
7210
|
+
return {
|
|
7211
|
+
...schema,
|
|
7212
|
+
blocks: blocks.map(block => ({ ...block, fields: uicExpandOtherFields(block.fields ?? [], label, placeholder) }))
|
|
7213
|
+
};
|
|
7214
|
+
}
|
|
6908
7215
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicFormEngine, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6909
7216
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicFormEngine });
|
|
6910
7217
|
}
|
|
@@ -10781,6 +11088,7 @@ const FIELDS_CONFIG = [
|
|
|
10781
11088
|
{ value: 'searcher', icon: 'ri-seo-line', detail: 'Buscador con fuente de datos externa', label: 'Buscador', properties: ['placeholder', 'optionsSource.key', 'optionsSource.idField', 'optionsSource.textField', 'optionsSource.textTemplate', 'optionsSource.dependsOn', 'optionsSource.paramName'], visibility: { outputType: 'object', operators: ['isEmpty', 'isNotEmpty'] } },
|
|
10782
11089
|
{ value: 'multisearcher', icon: 'ri-user-add-line', detail: 'Buscador con selección múltiple y fuente de datos externa', label: 'Buscador múltiple', properties: ['placeholder', 'optionsSource.key', 'optionsSource.idField', 'optionsSource.textField', 'optionsSource.textTemplate', 'optionsSource.dependsOn', 'optionsSource.paramName'], visibility: { outputType: 'object[]', operators: ['isEmpty', 'isNotEmpty'] } },
|
|
10783
11090
|
{ value: 'scale', icon: 'ri-star-half-line', detail: 'Escala numérica o de íconos (NPS, Likert, estrellas)', label: 'Escala', properties: ['scaleMode', 'scaleIcon', 'scaleMin', 'scaleMax', 'scaleLabels'], visibility: { outputType: 'number', operators: ['equals', 'notEquals', 'greaterThan', 'lessThan', 'isEmpty', 'isNotEmpty'] } },
|
|
11091
|
+
{ value: 'distribution', icon: 'ri-pie-chart-2-line', detail: 'Reparte el 100% entre las opciones', label: 'Distribución porcentual', properties: ['options'], visibility: { outputType: 'UicDistributionValue', operators: ['isEmpty', 'isNotEmpty'] } },
|
|
10784
11092
|
{ value: 'slider', icon: 'ri-equalizer-2-line', detail: 'Control deslizante continuo', label: 'Deslizador', properties: ['min', 'max', 'sliderInterval', 'sliderMarks'], visibility: { outputType: 'number', operators: ['equals', 'notEquals', 'greaterThan', 'lessThan', 'isEmpty', 'isNotEmpty'] } },
|
|
10785
11093
|
{ value: 'repeater', icon: 'ri-stack-line', detail: 'Grupo de campos repetibles', label: 'Repetidor', properties: ['repeaterMinItems', 'repeaterMaxItems', 'repeaterAddLabel', 'repeaterRemoveLabel', 'repeaterItemTitle'], visibility: { outputType: 'object[]', operators: ['isEmpty', 'isNotEmpty'] } },
|
|
10786
11094
|
{ value: 'computed', icon: 'ri-calculator-line', detail: 'Campo calculado automáticamente desde otros campos', label: 'Campo calculado', properties: ['computedSource.key', 'computedSource.dependsOn', 'minLength', 'maxLength'], visibility: { outputType: 'string', operators: ['equals', 'notEquals', 'includes', 'notIncludes', 'isEmpty', 'isNotEmpty'] } }
|
|
@@ -11568,7 +11876,8 @@ class UicSurveyComponent {
|
|
|
11568
11876
|
const blocks = schema.blocks ?? [];
|
|
11569
11877
|
const pages = [];
|
|
11570
11878
|
blocks.forEach((block, blockIndex) => {
|
|
11571
|
-
|
|
11879
|
+
// El texto de "Otros" no es una pregunta aparte: va en la página de su pregunta.
|
|
11880
|
+
const askable = (block.fields ?? []).filter(field => !field.hidden && !field.otherFor);
|
|
11572
11881
|
if (!askable.length)
|
|
11573
11882
|
return;
|
|
11574
11883
|
if (this.pageMode() === 'block') {
|
|
@@ -11581,7 +11890,7 @@ class UicSurveyComponent {
|
|
|
11581
11890
|
index: pages.length,
|
|
11582
11891
|
blockIndex,
|
|
11583
11892
|
block,
|
|
11584
|
-
fields: this.fieldsForSingleFieldPage(field),
|
|
11893
|
+
fields: this.fieldsForSingleFieldPage(field, block.fields ?? []),
|
|
11585
11894
|
firstOfBlock: fieldIndex === 0
|
|
11586
11895
|
});
|
|
11587
11896
|
});
|
|
@@ -11856,10 +12165,12 @@ class UicSurveyComponent {
|
|
|
11856
12165
|
target?.focus({ preventScroll: true });
|
|
11857
12166
|
});
|
|
11858
12167
|
}
|
|
11859
|
-
|
|
12168
|
+
/** Campos de una página de una sola pregunta: la pregunta y, si tiene "Otros", su texto acompañante. */
|
|
12169
|
+
fieldsForSingleFieldPage(field, blockFields) {
|
|
11860
12170
|
let fields = this.fieldPageFieldsCache.get(field);
|
|
11861
12171
|
if (!fields) {
|
|
11862
|
-
|
|
12172
|
+
const otherText = blockFields.find(candidate => candidate.otherFor === field.name);
|
|
12173
|
+
fields = otherText ? [field, otherText] : [field];
|
|
11863
12174
|
this.fieldPageFieldsCache.set(field, fields);
|
|
11864
12175
|
}
|
|
11865
12176
|
return fields;
|
|
@@ -12343,7 +12654,9 @@ class FieldEditorComponent {
|
|
|
12343
12654
|
/** Sección "Estilo". */
|
|
12344
12655
|
styleEnabled = input(true);
|
|
12345
12656
|
showDependencySection = computed(() => this.visibilityRulesEnabled() || !!this.localField().visibilityRules?.length);
|
|
12346
|
-
|
|
12657
|
+
/** Tipos con opciones que no admiten origen externo (el motor solo lo resuelve para selectores, pool y radio). */
|
|
12658
|
+
manualOptionsOnly = computed(() => this.fieldType()?.value === 'distribution');
|
|
12659
|
+
showOptionsSourceConfig = computed(() => !this.manualOptionsOnly() && (this.externalSources().options || this.hasExternalOptionsSource()));
|
|
12347
12660
|
showExternalValidation = computed(() => this.hasExternalValidation() && (this.externalSources().validation || !!this.localField().externalValidation?.key));
|
|
12348
12661
|
options = input({});
|
|
12349
12662
|
hiddenSections = signal([]);
|
|
@@ -12630,6 +12943,26 @@ class FieldEditorComponent {
|
|
|
12630
12943
|
this.localField.set(updatedField);
|
|
12631
12944
|
this.fieldChange.emit(updatedField);
|
|
12632
12945
|
}
|
|
12946
|
+
// ---- Opción "Otros (especifica)" ----
|
|
12947
|
+
supportsOtherOption = computed(() => uicSupportsOtherOption({ type: this.localField().type }));
|
|
12948
|
+
toggleOtherOption(enabled) {
|
|
12949
|
+
this.patchField({ otherOption: enabled ? { required: true } : null });
|
|
12950
|
+
}
|
|
12951
|
+
updateOtherOption(patch) {
|
|
12952
|
+
const current = this.localField().otherOption;
|
|
12953
|
+
if (!current)
|
|
12954
|
+
return;
|
|
12955
|
+
const next = { ...current, ...patch };
|
|
12956
|
+
// Textos vacíos = valor por defecto (no se guardan).
|
|
12957
|
+
['label', 'placeholder'].forEach(key => { if (!next[key]?.trim())
|
|
12958
|
+
delete next[key]; });
|
|
12959
|
+
this.patchField({ otherOption: next });
|
|
12960
|
+
}
|
|
12961
|
+
patchField(patch) {
|
|
12962
|
+
const updatedField = { ...this.localField(), ...patch };
|
|
12963
|
+
this.localField.set(updatedField);
|
|
12964
|
+
this.fieldChange.emit(updatedField);
|
|
12965
|
+
}
|
|
12633
12966
|
updateOptions(options) {
|
|
12634
12967
|
const updatedField = {
|
|
12635
12968
|
...this.localField(),
|
|
@@ -12857,7 +13190,7 @@ class FieldEditorComponent {
|
|
|
12857
13190
|
});
|
|
12858
13191
|
}
|
|
12859
13192
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FieldEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
12860
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: FieldEditorComponent, isStandalone: true, selector: "lib-field-editor", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, focusRequiredField: { classPropertyName: "focusRequiredField", publicName: "focusRequiredField", isSignal: true, isRequired: false, transformFunction: null }, isSubField: { classPropertyName: "isSubField", publicName: "isSubField", isSignal: true, isRequired: false, transformFunction: null }, enableNameModify: { classPropertyName: "enableNameModify", publicName: "enableNameModify", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, externalSources: { classPropertyName: "externalSources", publicName: "externalSources", isSignal: true, isRequired: false, transformFunction: null }, visibilityRulesEnabled: { classPropertyName: "visibilityRulesEnabled", publicName: "visibilityRulesEnabled", isSignal: true, isRequired: false, transformFunction: null }, styleEnabled: { classPropertyName: "styleEnabled", publicName: "styleEnabled", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fieldChange: "fieldChange" }, ngImport: i0, template: "<ng-template #sectionHeader let-key=\"key\" let-label=\"label\" let-count=\"count\">\n <button\n type=\"button\"\n class=\"props-title\"\n [attr.aria-expanded]=\"!isSectionHidden(key)\"\n (click)=\"toggleSection(key)\">\n <span class=\"props-title-text\">{{ label | uicTranslate }}</span>\n @if (count) {\n <span class=\"props-count\" [attr.aria-label]=\"'form_builder.field_editor.configured_count' | uicTranslate: { count: count }\">{{ count }}</span>\n }\n <i [class]=\"isSectionHidden(key) ? 'ri-arrow-down-s-line' : 'ri-arrow-up-s-line'\" aria-hidden=\"true\"></i>\n </button>\n</ng-template>\n\n<ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'basic', label: 'form_builder.field_editor.basic' }\"></ng-container>\n<div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('basic')\">\n <ui-form-wrapper\n #basicFormWrapper\n [fields]=\"requiredFields()\"\n [initialValues]=\"initialValues()\"\n [focusFieldName]=\"focusRequiredField() ? 'label' : null\"\n [focusFieldTrigger]=\"focusRequiredField() ? config().code : null\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n @if (hasOptionsSourceConfig()) {\n @if (showOptionsSourceConfig()) {\n <ui-form-wrapper\n [fields]=\"optionsSourceFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n }\n @if (hasOptions() && !hasExternalOptionsSource()) {\n <ui-field-options-editor [disabled]=\"readOnly()\" [options]=\"localField().options ?? []\" (optionsChange)=\"updateOptions($event)\"></ui-field-options-editor>\n }\n }\n @if (isScale()) {\n <ui-field-options-editor\n title=\"form_builder.options_editor.scale_labels_title\"\n codeLabel=\"form_builder.options_editor.scale_value_label\"\n nameLabel=\"form_builder.options_editor.scale_text_label\"\n codePlaceholder=\"1\"\n namePlaceholder=\"form_builder.options_editor.scale_text_placeholder\"\n [showAdvanced]=\"false\"\n [disabled]=\"readOnly()\"\n [autoCode]=\"false\"\n [options]=\"localField().scaleLabels ?? []\"\n (optionsChange)=\"updateScaleLabels($event)\">\n </ui-field-options-editor>\n }\n @if (isComputed()) {\n <ui-form-wrapper\n [fields]=\"computedSourceFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n }\n</div>\n\n@if (advancedFields().length) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'advanced', label: 'form_builder.field_editor.advanced', count: sectionCounts()['advanced'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('advanced')\">\n <ui-form-wrapper\n [fields]=\"advancedFields()\"\n [initialValues]=\"initialValues()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (styleEnabled()) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'style', label: 'form_builder.field_editor.style', count: sectionCounts()['style'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('style')\">\n <ui-form-wrapper\n [fields]=\"styleFields()\"\n [initialValues]=\"initialValues()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (!isSubField() && showExternalValidation()) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'external_validation', label: 'form_builder.field_editor.external_validation_title', count: sectionCounts()['external_validation'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('external_validation')\">\n <ui-form-wrapper\n [fields]=\"externalValidationFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (showDependencySection()) {\n<ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'dependency', label: 'form_builder.field_editor.dependency_title', count: sectionCounts()['dependency'] }\"></ng-container>\n<div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('dependency')\">\n @if (localField().visibilityRules?.length || isAddingNewRule()) {\n <p class=\"dependency-hint\">{{'form_builder.field_editor.dependency_description' | uicTranslate}}</p>\n } @else {\n <p class=\"dependency-hint muted\">{{(readOnly() ? 'form_builder.field_editor.dependency_empty_read_only' : 'form_builder.field_editor.dependency_empty') | uicTranslate}}</p>\n }\n\n @if (localField().visibilityRules?.length) {\n <div class=\"rules-container\">\n @for (rule of localField().visibilityRules; track $index) {\n @if ($index > 0) {\n <div class=\"rule-joiner\">{{'form_builder.field_editor.and' | uicTranslate}}</div>\n }\n <div class=\"rule-card\" [class.editing]=\"editingRuleIndex() === $index && !isAddingNewRule()\">\n <div class=\"rule-content\">\n <div class=\"rule-text\">\n <strong>{{ rule.fieldLabel || rule.fieldName }}</strong>\n @if (rule.operator) {\n <span class=\"rule-operator\">{{ 'form_builder.visibility_operators.' + rule.operator | uicTranslate }}</span>\n }\n @if (rule.operator !== 'isEmpty' && rule.operator !== 'isNotEmpty' && rule.value !== null && rule.value !== undefined && rule.value !== '') {\n <span class=\"rule-value\">{{ ruleValueText(rule) }}</span>\n }\n </div>\n </div>\n @if (editingRuleIndex() === -1 && !readOnly()) {\n <div class=\"rule-actions\">\n <button type=\"button\" class=\"rule-btn edit\" (click)=\"startEditingRule($index)\" [attr.title]=\"'form_builder.field_editor.edit_rule' | uicTranslate\" [attr.aria-label]=\"'form_builder.field_editor.edit_rule' | uicTranslate\">\n <i class=\"ri-edit-line\" aria-hidden=\"true\"></i>\n </button>\n <button type=\"button\" class=\"rule-btn delete\" (click)=\"removeRule($index)\" [attr.title]=\"'form_builder.field_editor.remove_relation' | uicTranslate\" [attr.aria-label]=\"'form_builder.field_editor.remove_relation' | uicTranslate\">\n <i class=\"ri-delete-bin-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n </div>\n <!-- Inline edit form for existing rule -->\n @if (editingRuleIndex() === $index && !isAddingNewRule()) {\n <div class=\"rule-editor\">\n <ui-form-wrapper\n [fields]=\"branchFields()\"\n [initialValues]=\"branchInitialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateRuleValue($event)\">\n </ui-form-wrapper>\n <div class=\"editor-actions\">\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" (click)=\"cancelEditingRule()\">{{'form_builder.field_editor.cancel' | uicTranslate}}</ui-button>\n <ui-button color=\"black\" size=\"s\" icon=\"ri-check-line\" (click)=\"confirmEditingRule()\">{{'form_builder.field_editor.save' | uicTranslate}}</ui-button>\n </div>\n </div>\n }\n }\n </div>\n }\n\n <!-- New rule form (only while adding) -->\n @if (isAddingNewRule()) {\n @if (localField().visibilityRules?.length) {\n <div class=\"rule-joiner\">{{'form_builder.field_editor.and' | uicTranslate}}</div>\n }\n <div class=\"rule-editor new-rule\">\n <ui-form-wrapper\n [fields]=\"branchFields()\"\n [initialValues]=\"branchInitialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateRuleValue($event)\">\n </ui-form-wrapper>\n <div class=\"editor-actions\">\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" (click)=\"cancelEditingRule()\">{{'form_builder.field_editor.cancel' | uicTranslate}}</ui-button>\n <ui-button color=\"black\" size=\"s\" icon=\"ri-check-line\" (click)=\"confirmEditingRule()\">{{'form_builder.field_editor.save' | uicTranslate}}</ui-button>\n </div>\n </div>\n }\n\n <!-- Add button (hidden while editing) -->\n @if (editingRuleIndex() === -1 && !readOnly() && visibilityRulesEnabled()) {\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" icon=\"ri-add-line\" (click)=\"addRule()\">{{'form_builder.field_editor.add_relation' | uicTranslate}}</ui-button>\n }\n</div>\n}\n", styles: [".hidden{display:none}.props-title{width:100%;font-size:14px;font-weight:600;margin-bottom:8px;background:var(--uic-neutral-200, var(--grey-200));color:inherit;padding:5px 8px;border:none;border-radius:5px;display:flex;align-items:center;gap:6px;cursor:pointer;text-align:left}.props-title:hover{background:var(--uic-neutral-300, var(--grey-300))}.props-title:focus-visible{outline:solid 2px var(--primary-400);outline-offset:1px}.props-title-text{flex:1 1}.props-count{min-width:18px;padding:0 5px;border-radius:9px;font-size:11px;font-weight:600;text-align:center;background-color:var(--primary-100);color:var(--primary-700)}.props-inputs{padding-left:8px;margin-bottom:10px}.dependency-hint{font-size:13px;margin:6px 0 10px;color:var(--yellow-800)}.dependency-hint.muted{color:var(--uic-neutral-500, var(--grey-500))}.rule-joiner{align-self:flex-start;margin-left:10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-500, var(--grey-500))}.rules-container{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}.rule-card{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;border:1px solid var(--uic-neutral-300, var(--grey-300));border-radius:3px;background:var(--uic-surface-raised, var(--white));font-size:12px}.rule-card.editing{border-color:var(--primary-400, #6366f1);border-bottom:none;border-radius:3px 3px 0 0}.rule-card .rule-content{flex:1;min-width:0}.rule-card .rule-text{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.rule-card .rule-text strong{font-weight:600;color:var(--uic-neutral-800, var(--grey-800))}.rule-card .rule-text .rule-operator{font-style:italic;color:var(--uic-neutral-600, var(--grey-600))}.rule-card .rule-text .rule-value{background:var(--uic-neutral-100, var(--grey-100));padding:0 3px;border-radius:2px;color:var(--uic-neutral-800, var(--grey-800))}.rule-actions{display:flex;gap:4px;flex-shrink:0;margin-left:4px}.rule-btn{background:none;border:none;cursor:pointer;padding:2px 4px;display:flex;align-items:center;justify-content:center;font-size:14px;color:var(--uic-neutral-600, var(--grey-600));transition:color .2s}.rule-btn:hover{color:var(--uic-neutral-800, var(--grey-800))}.rule-btn.delete{color:var(--red-600)}.rule-btn.delete:hover{color:var(--red-800)}.rule-editor{padding:8px;border:1px solid var(--primary-400, #6366f1);border-radius:0 0 3px 3px;background:var(--uic-neutral-50, var(--grey-50));margin-bottom:6px}.rule-editor.new-rule{border-radius:3px;margin-top:4px}.editor-actions{display:flex;gap:4px;margin-top:6px}\n"], dependencies: [{ kind: "component", type: UicFormWrapperComponent, selector: "ui-form-wrapper", inputs: ["schema", "fields", "cols", "externalData", "selectOptionsResolver", "computedFieldResolver", "externalValidatorResolver", "disabled", "fillSelects", "initialValues", "loading", "showButtons", "iconMode", "focusFieldName", "focusFieldTrigger", "fileUidResolverFn"], outputs: ["formSubmit", "formChange", "optionsSourceError"] }, { kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "pipe", type: UicTranslatePipe, name: "uicTranslate" }, { kind: "component", type: UicFieldOptionsEditorComponent, selector: "ui-field-options-editor", inputs: ["title", "codeLabel", "nameLabel", "codePlaceholder", "namePlaceholder", "showAdvanced", "autoCode", "disabled", "options"], outputs: ["optionsChange"] }] });
|
|
13193
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: FieldEditorComponent, isStandalone: true, selector: "lib-field-editor", inputs: { config: { classPropertyName: "config", publicName: "config", isSignal: true, isRequired: true, transformFunction: null }, focusRequiredField: { classPropertyName: "focusRequiredField", publicName: "focusRequiredField", isSignal: true, isRequired: false, transformFunction: null }, isSubField: { classPropertyName: "isSubField", publicName: "isSubField", isSignal: true, isRequired: false, transformFunction: null }, enableNameModify: { classPropertyName: "enableNameModify", publicName: "enableNameModify", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, externalSources: { classPropertyName: "externalSources", publicName: "externalSources", isSignal: true, isRequired: false, transformFunction: null }, visibilityRulesEnabled: { classPropertyName: "visibilityRulesEnabled", publicName: "visibilityRulesEnabled", isSignal: true, isRequired: false, transformFunction: null }, styleEnabled: { classPropertyName: "styleEnabled", publicName: "styleEnabled", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { fieldChange: "fieldChange" }, ngImport: i0, template: "<ng-template #sectionHeader let-key=\"key\" let-label=\"label\" let-count=\"count\">\n <button\n type=\"button\"\n class=\"props-title\"\n [attr.aria-expanded]=\"!isSectionHidden(key)\"\n (click)=\"toggleSection(key)\">\n <span class=\"props-title-text\">{{ label | uicTranslate }}</span>\n @if (count) {\n <span class=\"props-count\" [attr.aria-label]=\"'form_builder.field_editor.configured_count' | uicTranslate: { count: count }\">{{ count }}</span>\n }\n <i [class]=\"isSectionHidden(key) ? 'ri-arrow-down-s-line' : 'ri-arrow-up-s-line'\" aria-hidden=\"true\"></i>\n </button>\n</ng-template>\n\n<ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'basic', label: 'form_builder.field_editor.basic' }\"></ng-container>\n<div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('basic')\">\n <ui-form-wrapper\n #basicFormWrapper\n [fields]=\"requiredFields()\"\n [initialValues]=\"initialValues()\"\n [focusFieldName]=\"focusRequiredField() ? 'label' : null\"\n [focusFieldTrigger]=\"focusRequiredField() ? config().code : null\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n @if (hasOptionsSourceConfig()) {\n @if (showOptionsSourceConfig()) {\n <ui-form-wrapper\n [fields]=\"optionsSourceFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n }\n @if (hasOptions() && !hasExternalOptionsSource()) {\n <ui-field-options-editor [disabled]=\"readOnly()\" [options]=\"localField().options ?? []\" (optionsChange)=\"updateOptions($event)\"></ui-field-options-editor>\n }\n @if (supportsOtherOption()) {\n @let other = localField().otherOption;\n <div class=\"other-config\" [class.is-on]=\"!!other\">\n <ui-checkbox\n type=\"switch\"\n [noPadding]=\"true\"\n [disabled]=\"readOnly()\"\n [placeholder]=\"'form_builder.other_option.enable' | uicTranslate\"\n [tip]=\"'form_builder.other_option.enable_tip' | uicTranslate\"\n [ngModel]=\"!!other\"\n (ngModelChange)=\"toggleOtherOption($event)\">\n </ui-checkbox>\n @if (other) {\n <div class=\"other-config-fields\">\n <ui-input [label]=\"'form_builder.other_option.label' | uicTranslate\" [disabled]=\"readOnly()\">\n <input type=\"text\"\n [disabled]=\"readOnly()\"\n [placeholder]=\"'other_option.label' | uicTranslate\"\n [value]=\"other.label ?? ''\"\n (change)=\"updateOtherOption({ label: $any($event.target).value })\">\n </ui-input>\n <ui-input [label]=\"'form_builder.other_option.placeholder' | uicTranslate\" [disabled]=\"readOnly()\">\n <input type=\"text\"\n [disabled]=\"readOnly()\"\n [placeholder]=\"'other_option.placeholder' | uicTranslate\"\n [value]=\"other.placeholder ?? ''\"\n (change)=\"updateOtherOption({ placeholder: $any($event.target).value })\">\n </ui-input>\n <ui-checkbox\n [noPadding]=\"true\"\n [disabled]=\"readOnly()\"\n [placeholder]=\"'form_builder.other_option.required' | uicTranslate\"\n [ngModel]=\"other.required ?? true\"\n (ngModelChange)=\"updateOtherOption({ required: $event })\">\n </ui-checkbox>\n </div>\n }\n </div>\n }\n }\n @if (isScale()) {\n <ui-field-options-editor\n title=\"form_builder.options_editor.scale_labels_title\"\n codeLabel=\"form_builder.options_editor.scale_value_label\"\n nameLabel=\"form_builder.options_editor.scale_text_label\"\n codePlaceholder=\"1\"\n namePlaceholder=\"form_builder.options_editor.scale_text_placeholder\"\n [showAdvanced]=\"false\"\n [disabled]=\"readOnly()\"\n [autoCode]=\"false\"\n [options]=\"localField().scaleLabels ?? []\"\n (optionsChange)=\"updateScaleLabels($event)\">\n </ui-field-options-editor>\n }\n @if (isComputed()) {\n <ui-form-wrapper\n [fields]=\"computedSourceFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n }\n</div>\n\n@if (advancedFields().length) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'advanced', label: 'form_builder.field_editor.advanced', count: sectionCounts()['advanced'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('advanced')\">\n <ui-form-wrapper\n [fields]=\"advancedFields()\"\n [initialValues]=\"initialValues()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (styleEnabled()) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'style', label: 'form_builder.field_editor.style', count: sectionCounts()['style'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('style')\">\n <ui-form-wrapper\n [fields]=\"styleFields()\"\n [initialValues]=\"initialValues()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (!isSubField() && showExternalValidation()) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'external_validation', label: 'form_builder.field_editor.external_validation_title', count: sectionCounts()['external_validation'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('external_validation')\">\n <ui-form-wrapper\n [fields]=\"externalValidationFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (showDependencySection()) {\n<ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'dependency', label: 'form_builder.field_editor.dependency_title', count: sectionCounts()['dependency'] }\"></ng-container>\n<div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('dependency')\">\n @if (localField().visibilityRules?.length || isAddingNewRule()) {\n <p class=\"dependency-hint\">{{'form_builder.field_editor.dependency_description' | uicTranslate}}</p>\n } @else {\n <p class=\"dependency-hint muted\">{{(readOnly() ? 'form_builder.field_editor.dependency_empty_read_only' : 'form_builder.field_editor.dependency_empty') | uicTranslate}}</p>\n }\n\n @if (localField().visibilityRules?.length) {\n <div class=\"rules-container\">\n @for (rule of localField().visibilityRules; track $index) {\n @if ($index > 0) {\n <div class=\"rule-joiner\">{{'form_builder.field_editor.and' | uicTranslate}}</div>\n }\n <div class=\"rule-card\" [class.editing]=\"editingRuleIndex() === $index && !isAddingNewRule()\">\n <div class=\"rule-content\">\n <div class=\"rule-text\">\n <strong>{{ rule.fieldLabel || rule.fieldName }}</strong>\n @if (rule.operator) {\n <span class=\"rule-operator\">{{ 'form_builder.visibility_operators.' + rule.operator | uicTranslate }}</span>\n }\n @if (rule.operator !== 'isEmpty' && rule.operator !== 'isNotEmpty' && rule.value !== null && rule.value !== undefined && rule.value !== '') {\n <span class=\"rule-value\">{{ ruleValueText(rule) }}</span>\n }\n </div>\n </div>\n @if (editingRuleIndex() === -1 && !readOnly()) {\n <div class=\"rule-actions\">\n <button type=\"button\" class=\"rule-btn edit\" (click)=\"startEditingRule($index)\" [attr.title]=\"'form_builder.field_editor.edit_rule' | uicTranslate\" [attr.aria-label]=\"'form_builder.field_editor.edit_rule' | uicTranslate\">\n <i class=\"ri-edit-line\" aria-hidden=\"true\"></i>\n </button>\n <button type=\"button\" class=\"rule-btn delete\" (click)=\"removeRule($index)\" [attr.title]=\"'form_builder.field_editor.remove_relation' | uicTranslate\" [attr.aria-label]=\"'form_builder.field_editor.remove_relation' | uicTranslate\">\n <i class=\"ri-delete-bin-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n </div>\n <!-- Inline edit form for existing rule -->\n @if (editingRuleIndex() === $index && !isAddingNewRule()) {\n <div class=\"rule-editor\">\n <ui-form-wrapper\n [fields]=\"branchFields()\"\n [initialValues]=\"branchInitialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateRuleValue($event)\">\n </ui-form-wrapper>\n <div class=\"editor-actions\">\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" (click)=\"cancelEditingRule()\">{{'form_builder.field_editor.cancel' | uicTranslate}}</ui-button>\n <ui-button color=\"black\" size=\"s\" icon=\"ri-check-line\" (click)=\"confirmEditingRule()\">{{'form_builder.field_editor.save' | uicTranslate}}</ui-button>\n </div>\n </div>\n }\n }\n </div>\n }\n\n <!-- New rule form (only while adding) -->\n @if (isAddingNewRule()) {\n @if (localField().visibilityRules?.length) {\n <div class=\"rule-joiner\">{{'form_builder.field_editor.and' | uicTranslate}}</div>\n }\n <div class=\"rule-editor new-rule\">\n <ui-form-wrapper\n [fields]=\"branchFields()\"\n [initialValues]=\"branchInitialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateRuleValue($event)\">\n </ui-form-wrapper>\n <div class=\"editor-actions\">\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" (click)=\"cancelEditingRule()\">{{'form_builder.field_editor.cancel' | uicTranslate}}</ui-button>\n <ui-button color=\"black\" size=\"s\" icon=\"ri-check-line\" (click)=\"confirmEditingRule()\">{{'form_builder.field_editor.save' | uicTranslate}}</ui-button>\n </div>\n </div>\n }\n\n <!-- Add button (hidden while editing) -->\n @if (editingRuleIndex() === -1 && !readOnly() && visibilityRulesEnabled()) {\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" icon=\"ri-add-line\" (click)=\"addRule()\">{{'form_builder.field_editor.add_relation' | uicTranslate}}</ui-button>\n }\n</div>\n}\n", styles: [".hidden{display:none}.props-title{width:100%;font-size:14px;font-weight:600;margin-bottom:8px;background:var(--uic-neutral-200, var(--grey-200));color:inherit;padding:5px 8px;border:none;border-radius:5px;display:flex;align-items:center;gap:6px;cursor:pointer;text-align:left}.props-title:hover{background:var(--uic-neutral-300, var(--grey-300))}.props-title:focus-visible{outline:solid 2px var(--primary-400);outline-offset:1px}.props-title-text{flex:1 1}.props-count{min-width:18px;padding:0 5px;border-radius:9px;font-size:11px;font-weight:600;text-align:center;background-color:var(--primary-100);color:var(--primary-700)}.props-inputs{padding-left:8px;margin-bottom:10px}.dependency-hint{font-size:13px;margin:6px 0 10px;color:var(--yellow-800)}.dependency-hint.muted{color:var(--uic-neutral-500, var(--grey-500))}.rule-joiner{align-self:flex-start;margin-left:10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-500, var(--grey-500))}.rules-container{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}.rule-card{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;border:1px solid var(--uic-neutral-300, var(--grey-300));border-radius:3px;background:var(--uic-surface-raised, var(--white));font-size:12px}.rule-card.editing{border-color:var(--primary-400, #6366f1);border-bottom:none;border-radius:3px 3px 0 0}.rule-card .rule-content{flex:1;min-width:0}.rule-card .rule-text{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.rule-card .rule-text strong{font-weight:600;color:var(--uic-neutral-800, var(--grey-800))}.rule-card .rule-text .rule-operator{font-style:italic;color:var(--uic-neutral-600, var(--grey-600))}.rule-card .rule-text .rule-value{background:var(--uic-neutral-100, var(--grey-100));padding:0 3px;border-radius:2px;color:var(--uic-neutral-800, var(--grey-800))}.rule-actions{display:flex;gap:4px;flex-shrink:0;margin-left:4px}.rule-btn{background:none;border:none;cursor:pointer;padding:2px 4px;display:flex;align-items:center;justify-content:center;font-size:14px;color:var(--uic-neutral-600, var(--grey-600));transition:color .2s}.rule-btn:hover{color:var(--uic-neutral-800, var(--grey-800))}.rule-btn.delete{color:var(--red-600)}.rule-btn.delete:hover{color:var(--red-800)}.rule-editor{padding:8px;border:1px solid var(--primary-400, #6366f1);border-radius:0 0 3px 3px;background:var(--uic-neutral-50, var(--grey-50));margin-bottom:6px}.rule-editor.new-rule{border-radius:3px;margin-top:4px}.editor-actions{display:flex;gap:4px;margin-top:6px}.other-config{margin:4px 0 12px;padding:8px 10px;border:solid 1px var(--uic-neutral-200, var(--grey-200));border-radius:8px}.other-config.is-on{border-color:var(--primary-200);background-color:var(--uic-neutral-50, var(--grey-50))}.other-config-fields{display:flex;flex-direction:column;gap:8px;margin-top:8px}\n"], dependencies: [{ kind: "component", type: UicFormWrapperComponent, selector: "ui-form-wrapper", inputs: ["schema", "fields", "cols", "externalData", "selectOptionsResolver", "computedFieldResolver", "externalValidatorResolver", "disabled", "fillSelects", "initialValues", "loading", "showButtons", "iconMode", "focusFieldName", "focusFieldTrigger", "fileUidResolverFn"], outputs: ["formSubmit", "formChange", "optionsSourceError"] }, { kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: UicCheckboxComponent, selector: "ui-checkbox", inputs: ["icon", "iconColor", "label", "tip", "type", "placeholder", "loading", "noPadding", "disabled"] }, { kind: "component", type: UicInputComponent, selector: "ui-input", inputs: ["icon", "iconColor", "internalIcon", "internalIconColor", "size", "label", "error", "tip", "disabled", "loading"] }, { kind: "pipe", type: UicTranslatePipe, name: "uicTranslate" }, { kind: "component", type: UicFieldOptionsEditorComponent, selector: "ui-field-options-editor", inputs: ["title", "codeLabel", "nameLabel", "codePlaceholder", "namePlaceholder", "showAdvanced", "autoCode", "disabled", "options"], outputs: ["optionsChange"] }] });
|
|
12861
13194
|
}
|
|
12862
13195
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FieldEditorComponent, decorators: [{
|
|
12863
13196
|
type: Component,
|
|
@@ -12865,9 +13198,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
12865
13198
|
UicFormWrapperComponent,
|
|
12866
13199
|
UicButtonComponent,
|
|
12867
13200
|
NgTemplateOutlet,
|
|
13201
|
+
FormsModule,
|
|
13202
|
+
UicCheckboxComponent,
|
|
13203
|
+
UicInputComponent,
|
|
12868
13204
|
UicTranslatePipe,
|
|
12869
13205
|
UicFieldOptionsEditorComponent
|
|
12870
|
-
], template: "<ng-template #sectionHeader let-key=\"key\" let-label=\"label\" let-count=\"count\">\n <button\n type=\"button\"\n class=\"props-title\"\n [attr.aria-expanded]=\"!isSectionHidden(key)\"\n (click)=\"toggleSection(key)\">\n <span class=\"props-title-text\">{{ label | uicTranslate }}</span>\n @if (count) {\n <span class=\"props-count\" [attr.aria-label]=\"'form_builder.field_editor.configured_count' | uicTranslate: { count: count }\">{{ count }}</span>\n }\n <i [class]=\"isSectionHidden(key) ? 'ri-arrow-down-s-line' : 'ri-arrow-up-s-line'\" aria-hidden=\"true\"></i>\n </button>\n</ng-template>\n\n<ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'basic', label: 'form_builder.field_editor.basic' }\"></ng-container>\n<div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('basic')\">\n <ui-form-wrapper\n #basicFormWrapper\n [fields]=\"requiredFields()\"\n [initialValues]=\"initialValues()\"\n [focusFieldName]=\"focusRequiredField() ? 'label' : null\"\n [focusFieldTrigger]=\"focusRequiredField() ? config().code : null\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n @if (hasOptionsSourceConfig()) {\n @if (showOptionsSourceConfig()) {\n <ui-form-wrapper\n [fields]=\"optionsSourceFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n }\n @if (hasOptions() && !hasExternalOptionsSource()) {\n <ui-field-options-editor [disabled]=\"readOnly()\" [options]=\"localField().options ?? []\" (optionsChange)=\"updateOptions($event)\"></ui-field-options-editor>\n }\n }\n @if (isScale()) {\n <ui-field-options-editor\n title=\"form_builder.options_editor.scale_labels_title\"\n codeLabel=\"form_builder.options_editor.scale_value_label\"\n nameLabel=\"form_builder.options_editor.scale_text_label\"\n codePlaceholder=\"1\"\n namePlaceholder=\"form_builder.options_editor.scale_text_placeholder\"\n [showAdvanced]=\"false\"\n [disabled]=\"readOnly()\"\n [autoCode]=\"false\"\n [options]=\"localField().scaleLabels ?? []\"\n (optionsChange)=\"updateScaleLabels($event)\">\n </ui-field-options-editor>\n }\n @if (isComputed()) {\n <ui-form-wrapper\n [fields]=\"computedSourceFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n }\n</div>\n\n@if (advancedFields().length) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'advanced', label: 'form_builder.field_editor.advanced', count: sectionCounts()['advanced'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('advanced')\">\n <ui-form-wrapper\n [fields]=\"advancedFields()\"\n [initialValues]=\"initialValues()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (styleEnabled()) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'style', label: 'form_builder.field_editor.style', count: sectionCounts()['style'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('style')\">\n <ui-form-wrapper\n [fields]=\"styleFields()\"\n [initialValues]=\"initialValues()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (!isSubField() && showExternalValidation()) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'external_validation', label: 'form_builder.field_editor.external_validation_title', count: sectionCounts()['external_validation'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('external_validation')\">\n <ui-form-wrapper\n [fields]=\"externalValidationFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (showDependencySection()) {\n<ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'dependency', label: 'form_builder.field_editor.dependency_title', count: sectionCounts()['dependency'] }\"></ng-container>\n<div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('dependency')\">\n @if (localField().visibilityRules?.length || isAddingNewRule()) {\n <p class=\"dependency-hint\">{{'form_builder.field_editor.dependency_description' | uicTranslate}}</p>\n } @else {\n <p class=\"dependency-hint muted\">{{(readOnly() ? 'form_builder.field_editor.dependency_empty_read_only' : 'form_builder.field_editor.dependency_empty') | uicTranslate}}</p>\n }\n\n @if (localField().visibilityRules?.length) {\n <div class=\"rules-container\">\n @for (rule of localField().visibilityRules; track $index) {\n @if ($index > 0) {\n <div class=\"rule-joiner\">{{'form_builder.field_editor.and' | uicTranslate}}</div>\n }\n <div class=\"rule-card\" [class.editing]=\"editingRuleIndex() === $index && !isAddingNewRule()\">\n <div class=\"rule-content\">\n <div class=\"rule-text\">\n <strong>{{ rule.fieldLabel || rule.fieldName }}</strong>\n @if (rule.operator) {\n <span class=\"rule-operator\">{{ 'form_builder.visibility_operators.' + rule.operator | uicTranslate }}</span>\n }\n @if (rule.operator !== 'isEmpty' && rule.operator !== 'isNotEmpty' && rule.value !== null && rule.value !== undefined && rule.value !== '') {\n <span class=\"rule-value\">{{ ruleValueText(rule) }}</span>\n }\n </div>\n </div>\n @if (editingRuleIndex() === -1 && !readOnly()) {\n <div class=\"rule-actions\">\n <button type=\"button\" class=\"rule-btn edit\" (click)=\"startEditingRule($index)\" [attr.title]=\"'form_builder.field_editor.edit_rule' | uicTranslate\" [attr.aria-label]=\"'form_builder.field_editor.edit_rule' | uicTranslate\">\n <i class=\"ri-edit-line\" aria-hidden=\"true\"></i>\n </button>\n <button type=\"button\" class=\"rule-btn delete\" (click)=\"removeRule($index)\" [attr.title]=\"'form_builder.field_editor.remove_relation' | uicTranslate\" [attr.aria-label]=\"'form_builder.field_editor.remove_relation' | uicTranslate\">\n <i class=\"ri-delete-bin-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n </div>\n <!-- Inline edit form for existing rule -->\n @if (editingRuleIndex() === $index && !isAddingNewRule()) {\n <div class=\"rule-editor\">\n <ui-form-wrapper\n [fields]=\"branchFields()\"\n [initialValues]=\"branchInitialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateRuleValue($event)\">\n </ui-form-wrapper>\n <div class=\"editor-actions\">\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" (click)=\"cancelEditingRule()\">{{'form_builder.field_editor.cancel' | uicTranslate}}</ui-button>\n <ui-button color=\"black\" size=\"s\" icon=\"ri-check-line\" (click)=\"confirmEditingRule()\">{{'form_builder.field_editor.save' | uicTranslate}}</ui-button>\n </div>\n </div>\n }\n }\n </div>\n }\n\n <!-- New rule form (only while adding) -->\n @if (isAddingNewRule()) {\n @if (localField().visibilityRules?.length) {\n <div class=\"rule-joiner\">{{'form_builder.field_editor.and' | uicTranslate}}</div>\n }\n <div class=\"rule-editor new-rule\">\n <ui-form-wrapper\n [fields]=\"branchFields()\"\n [initialValues]=\"branchInitialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateRuleValue($event)\">\n </ui-form-wrapper>\n <div class=\"editor-actions\">\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" (click)=\"cancelEditingRule()\">{{'form_builder.field_editor.cancel' | uicTranslate}}</ui-button>\n <ui-button color=\"black\" size=\"s\" icon=\"ri-check-line\" (click)=\"confirmEditingRule()\">{{'form_builder.field_editor.save' | uicTranslate}}</ui-button>\n </div>\n </div>\n }\n\n <!-- Add button (hidden while editing) -->\n @if (editingRuleIndex() === -1 && !readOnly() && visibilityRulesEnabled()) {\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" icon=\"ri-add-line\" (click)=\"addRule()\">{{'form_builder.field_editor.add_relation' | uicTranslate}}</ui-button>\n }\n</div>\n}\n", styles: [".hidden{display:none}.props-title{width:100%;font-size:14px;font-weight:600;margin-bottom:8px;background:var(--uic-neutral-200, var(--grey-200));color:inherit;padding:5px 8px;border:none;border-radius:5px;display:flex;align-items:center;gap:6px;cursor:pointer;text-align:left}.props-title:hover{background:var(--uic-neutral-300, var(--grey-300))}.props-title:focus-visible{outline:solid 2px var(--primary-400);outline-offset:1px}.props-title-text{flex:1 1}.props-count{min-width:18px;padding:0 5px;border-radius:9px;font-size:11px;font-weight:600;text-align:center;background-color:var(--primary-100);color:var(--primary-700)}.props-inputs{padding-left:8px;margin-bottom:10px}.dependency-hint{font-size:13px;margin:6px 0 10px;color:var(--yellow-800)}.dependency-hint.muted{color:var(--uic-neutral-500, var(--grey-500))}.rule-joiner{align-self:flex-start;margin-left:10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-500, var(--grey-500))}.rules-container{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}.rule-card{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;border:1px solid var(--uic-neutral-300, var(--grey-300));border-radius:3px;background:var(--uic-surface-raised, var(--white));font-size:12px}.rule-card.editing{border-color:var(--primary-400, #6366f1);border-bottom:none;border-radius:3px 3px 0 0}.rule-card .rule-content{flex:1;min-width:0}.rule-card .rule-text{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.rule-card .rule-text strong{font-weight:600;color:var(--uic-neutral-800, var(--grey-800))}.rule-card .rule-text .rule-operator{font-style:italic;color:var(--uic-neutral-600, var(--grey-600))}.rule-card .rule-text .rule-value{background:var(--uic-neutral-100, var(--grey-100));padding:0 3px;border-radius:2px;color:var(--uic-neutral-800, var(--grey-800))}.rule-actions{display:flex;gap:4px;flex-shrink:0;margin-left:4px}.rule-btn{background:none;border:none;cursor:pointer;padding:2px 4px;display:flex;align-items:center;justify-content:center;font-size:14px;color:var(--uic-neutral-600, var(--grey-600));transition:color .2s}.rule-btn:hover{color:var(--uic-neutral-800, var(--grey-800))}.rule-btn.delete{color:var(--red-600)}.rule-btn.delete:hover{color:var(--red-800)}.rule-editor{padding:8px;border:1px solid var(--primary-400, #6366f1);border-radius:0 0 3px 3px;background:var(--uic-neutral-50, var(--grey-50));margin-bottom:6px}.rule-editor.new-rule{border-radius:3px;margin-top:4px}.editor-actions{display:flex;gap:4px;margin-top:6px}\n"] }]
|
|
13206
|
+
], template: "<ng-template #sectionHeader let-key=\"key\" let-label=\"label\" let-count=\"count\">\n <button\n type=\"button\"\n class=\"props-title\"\n [attr.aria-expanded]=\"!isSectionHidden(key)\"\n (click)=\"toggleSection(key)\">\n <span class=\"props-title-text\">{{ label | uicTranslate }}</span>\n @if (count) {\n <span class=\"props-count\" [attr.aria-label]=\"'form_builder.field_editor.configured_count' | uicTranslate: { count: count }\">{{ count }}</span>\n }\n <i [class]=\"isSectionHidden(key) ? 'ri-arrow-down-s-line' : 'ri-arrow-up-s-line'\" aria-hidden=\"true\"></i>\n </button>\n</ng-template>\n\n<ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'basic', label: 'form_builder.field_editor.basic' }\"></ng-container>\n<div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('basic')\">\n <ui-form-wrapper\n #basicFormWrapper\n [fields]=\"requiredFields()\"\n [initialValues]=\"initialValues()\"\n [focusFieldName]=\"focusRequiredField() ? 'label' : null\"\n [focusFieldTrigger]=\"focusRequiredField() ? config().code : null\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n @if (hasOptionsSourceConfig()) {\n @if (showOptionsSourceConfig()) {\n <ui-form-wrapper\n [fields]=\"optionsSourceFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n }\n @if (hasOptions() && !hasExternalOptionsSource()) {\n <ui-field-options-editor [disabled]=\"readOnly()\" [options]=\"localField().options ?? []\" (optionsChange)=\"updateOptions($event)\"></ui-field-options-editor>\n }\n @if (supportsOtherOption()) {\n @let other = localField().otherOption;\n <div class=\"other-config\" [class.is-on]=\"!!other\">\n <ui-checkbox\n type=\"switch\"\n [noPadding]=\"true\"\n [disabled]=\"readOnly()\"\n [placeholder]=\"'form_builder.other_option.enable' | uicTranslate\"\n [tip]=\"'form_builder.other_option.enable_tip' | uicTranslate\"\n [ngModel]=\"!!other\"\n (ngModelChange)=\"toggleOtherOption($event)\">\n </ui-checkbox>\n @if (other) {\n <div class=\"other-config-fields\">\n <ui-input [label]=\"'form_builder.other_option.label' | uicTranslate\" [disabled]=\"readOnly()\">\n <input type=\"text\"\n [disabled]=\"readOnly()\"\n [placeholder]=\"'other_option.label' | uicTranslate\"\n [value]=\"other.label ?? ''\"\n (change)=\"updateOtherOption({ label: $any($event.target).value })\">\n </ui-input>\n <ui-input [label]=\"'form_builder.other_option.placeholder' | uicTranslate\" [disabled]=\"readOnly()\">\n <input type=\"text\"\n [disabled]=\"readOnly()\"\n [placeholder]=\"'other_option.placeholder' | uicTranslate\"\n [value]=\"other.placeholder ?? ''\"\n (change)=\"updateOtherOption({ placeholder: $any($event.target).value })\">\n </ui-input>\n <ui-checkbox\n [noPadding]=\"true\"\n [disabled]=\"readOnly()\"\n [placeholder]=\"'form_builder.other_option.required' | uicTranslate\"\n [ngModel]=\"other.required ?? true\"\n (ngModelChange)=\"updateOtherOption({ required: $event })\">\n </ui-checkbox>\n </div>\n }\n </div>\n }\n }\n @if (isScale()) {\n <ui-field-options-editor\n title=\"form_builder.options_editor.scale_labels_title\"\n codeLabel=\"form_builder.options_editor.scale_value_label\"\n nameLabel=\"form_builder.options_editor.scale_text_label\"\n codePlaceholder=\"1\"\n namePlaceholder=\"form_builder.options_editor.scale_text_placeholder\"\n [showAdvanced]=\"false\"\n [disabled]=\"readOnly()\"\n [autoCode]=\"false\"\n [options]=\"localField().scaleLabels ?? []\"\n (optionsChange)=\"updateScaleLabels($event)\">\n </ui-field-options-editor>\n }\n @if (isComputed()) {\n <ui-form-wrapper\n [fields]=\"computedSourceFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n }\n</div>\n\n@if (advancedFields().length) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'advanced', label: 'form_builder.field_editor.advanced', count: sectionCounts()['advanced'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('advanced')\">\n <ui-form-wrapper\n [fields]=\"advancedFields()\"\n [initialValues]=\"initialValues()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (styleEnabled()) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'style', label: 'form_builder.field_editor.style', count: sectionCounts()['style'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('style')\">\n <ui-form-wrapper\n [fields]=\"styleFields()\"\n [initialValues]=\"initialValues()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (!isSubField() && showExternalValidation()) {\n <ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'external_validation', label: 'form_builder.field_editor.external_validation_title', count: sectionCounts()['external_validation'] }\"></ng-container>\n <div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('external_validation')\">\n <ui-form-wrapper\n [fields]=\"externalValidationFields()\"\n [initialValues]=\"initialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateFieldValues($event)\">\n </ui-form-wrapper>\n </div>\n}\n\n@if (showDependencySection()) {\n<ng-container *ngTemplateOutlet=\"sectionHeader; context: { key: 'dependency', label: 'form_builder.field_editor.dependency_title', count: sectionCounts()['dependency'] }\"></ng-container>\n<div class=\"props-inputs\" [class.hidden]=\"isSectionHidden('dependency')\">\n @if (localField().visibilityRules?.length || isAddingNewRule()) {\n <p class=\"dependency-hint\">{{'form_builder.field_editor.dependency_description' | uicTranslate}}</p>\n } @else {\n <p class=\"dependency-hint muted\">{{(readOnly() ? 'form_builder.field_editor.dependency_empty_read_only' : 'form_builder.field_editor.dependency_empty') | uicTranslate}}</p>\n }\n\n @if (localField().visibilityRules?.length) {\n <div class=\"rules-container\">\n @for (rule of localField().visibilityRules; track $index) {\n @if ($index > 0) {\n <div class=\"rule-joiner\">{{'form_builder.field_editor.and' | uicTranslate}}</div>\n }\n <div class=\"rule-card\" [class.editing]=\"editingRuleIndex() === $index && !isAddingNewRule()\">\n <div class=\"rule-content\">\n <div class=\"rule-text\">\n <strong>{{ rule.fieldLabel || rule.fieldName }}</strong>\n @if (rule.operator) {\n <span class=\"rule-operator\">{{ 'form_builder.visibility_operators.' + rule.operator | uicTranslate }}</span>\n }\n @if (rule.operator !== 'isEmpty' && rule.operator !== 'isNotEmpty' && rule.value !== null && rule.value !== undefined && rule.value !== '') {\n <span class=\"rule-value\">{{ ruleValueText(rule) }}</span>\n }\n </div>\n </div>\n @if (editingRuleIndex() === -1 && !readOnly()) {\n <div class=\"rule-actions\">\n <button type=\"button\" class=\"rule-btn edit\" (click)=\"startEditingRule($index)\" [attr.title]=\"'form_builder.field_editor.edit_rule' | uicTranslate\" [attr.aria-label]=\"'form_builder.field_editor.edit_rule' | uicTranslate\">\n <i class=\"ri-edit-line\" aria-hidden=\"true\"></i>\n </button>\n <button type=\"button\" class=\"rule-btn delete\" (click)=\"removeRule($index)\" [attr.title]=\"'form_builder.field_editor.remove_relation' | uicTranslate\" [attr.aria-label]=\"'form_builder.field_editor.remove_relation' | uicTranslate\">\n <i class=\"ri-delete-bin-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n </div>\n <!-- Inline edit form for existing rule -->\n @if (editingRuleIndex() === $index && !isAddingNewRule()) {\n <div class=\"rule-editor\">\n <ui-form-wrapper\n [fields]=\"branchFields()\"\n [initialValues]=\"branchInitialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateRuleValue($event)\">\n </ui-form-wrapper>\n <div class=\"editor-actions\">\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" (click)=\"cancelEditingRule()\">{{'form_builder.field_editor.cancel' | uicTranslate}}</ui-button>\n <ui-button color=\"black\" size=\"s\" icon=\"ri-check-line\" (click)=\"confirmEditingRule()\">{{'form_builder.field_editor.save' | uicTranslate}}</ui-button>\n </div>\n </div>\n }\n }\n </div>\n }\n\n <!-- New rule form (only while adding) -->\n @if (isAddingNewRule()) {\n @if (localField().visibilityRules?.length) {\n <div class=\"rule-joiner\">{{'form_builder.field_editor.and' | uicTranslate}}</div>\n }\n <div class=\"rule-editor new-rule\">\n <ui-form-wrapper\n [fields]=\"branchFields()\"\n [initialValues]=\"branchInitialValues()\"\n [externalData]=\"options()\"\n [cols]=\"1\"\n [disabled]=\"readOnly()\"\n (formChange)=\"updateRuleValue($event)\">\n </ui-form-wrapper>\n <div class=\"editor-actions\">\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" (click)=\"cancelEditingRule()\">{{'form_builder.field_editor.cancel' | uicTranslate}}</ui-button>\n <ui-button color=\"black\" size=\"s\" icon=\"ri-check-line\" (click)=\"confirmEditingRule()\">{{'form_builder.field_editor.save' | uicTranslate}}</ui-button>\n </div>\n </div>\n }\n\n <!-- Add button (hidden while editing) -->\n @if (editingRuleIndex() === -1 && !readOnly() && visibilityRulesEnabled()) {\n <ui-button color=\"black\" type=\"bordered\" size=\"s\" icon=\"ri-add-line\" (click)=\"addRule()\">{{'form_builder.field_editor.add_relation' | uicTranslate}}</ui-button>\n }\n</div>\n}\n", styles: [".hidden{display:none}.props-title{width:100%;font-size:14px;font-weight:600;margin-bottom:8px;background:var(--uic-neutral-200, var(--grey-200));color:inherit;padding:5px 8px;border:none;border-radius:5px;display:flex;align-items:center;gap:6px;cursor:pointer;text-align:left}.props-title:hover{background:var(--uic-neutral-300, var(--grey-300))}.props-title:focus-visible{outline:solid 2px var(--primary-400);outline-offset:1px}.props-title-text{flex:1 1}.props-count{min-width:18px;padding:0 5px;border-radius:9px;font-size:11px;font-weight:600;text-align:center;background-color:var(--primary-100);color:var(--primary-700)}.props-inputs{padding-left:8px;margin-bottom:10px}.dependency-hint{font-size:13px;margin:6px 0 10px;color:var(--yellow-800)}.dependency-hint.muted{color:var(--uic-neutral-500, var(--grey-500))}.rule-joiner{align-self:flex-start;margin-left:10px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-500, var(--grey-500))}.rules-container{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}.rule-card{display:flex;align-items:center;justify-content:space-between;padding:6px 8px;border:1px solid var(--uic-neutral-300, var(--grey-300));border-radius:3px;background:var(--uic-surface-raised, var(--white));font-size:12px}.rule-card.editing{border-color:var(--primary-400, #6366f1);border-bottom:none;border-radius:3px 3px 0 0}.rule-card .rule-content{flex:1;min-width:0}.rule-card .rule-text{display:flex;align-items:center;gap:4px;flex-wrap:wrap}.rule-card .rule-text strong{font-weight:600;color:var(--uic-neutral-800, var(--grey-800))}.rule-card .rule-text .rule-operator{font-style:italic;color:var(--uic-neutral-600, var(--grey-600))}.rule-card .rule-text .rule-value{background:var(--uic-neutral-100, var(--grey-100));padding:0 3px;border-radius:2px;color:var(--uic-neutral-800, var(--grey-800))}.rule-actions{display:flex;gap:4px;flex-shrink:0;margin-left:4px}.rule-btn{background:none;border:none;cursor:pointer;padding:2px 4px;display:flex;align-items:center;justify-content:center;font-size:14px;color:var(--uic-neutral-600, var(--grey-600));transition:color .2s}.rule-btn:hover{color:var(--uic-neutral-800, var(--grey-800))}.rule-btn.delete{color:var(--red-600)}.rule-btn.delete:hover{color:var(--red-800)}.rule-editor{padding:8px;border:1px solid var(--primary-400, #6366f1);border-radius:0 0 3px 3px;background:var(--uic-neutral-50, var(--grey-50));margin-bottom:6px}.rule-editor.new-rule{border-radius:3px;margin-top:4px}.editor-actions{display:flex;gap:4px;margin-top:6px}.other-config{margin:4px 0 12px;padding:8px 10px;border:solid 1px var(--uic-neutral-200, var(--grey-200));border-radius:8px}.other-config.is-on{border-color:var(--primary-200);background-color:var(--uic-neutral-50, var(--grey-50))}.other-config-fields{display:flex;flex-direction:column;gap:8px;margin-top:8px}\n"] }]
|
|
12871
13207
|
}], ctorParameters: () => [] });
|
|
12872
13208
|
|
|
12873
13209
|
/** Agrupación solo de presentación: no altera FIELDS_CONFIG. Tipos no listados caen en "other". */
|
|
@@ -12883,6 +13219,7 @@ const GROUP_BY_TYPE = {
|
|
|
12883
13219
|
switch: 'choice',
|
|
12884
13220
|
pool: 'choice',
|
|
12885
13221
|
scale: 'choice',
|
|
13222
|
+
distribution: 'choice',
|
|
12886
13223
|
slider: 'choice',
|
|
12887
13224
|
date: 'datetime',
|
|
12888
13225
|
time: 'datetime',
|
|
@@ -13340,6 +13677,9 @@ class BlockEditorComponent {
|
|
|
13340
13677
|
if (typeof value === 'object')
|
|
13341
13678
|
return JSON.stringify(value);
|
|
13342
13679
|
const scalar = value;
|
|
13680
|
+
if (scalar === UIC_OTHER_OPTION_ID) {
|
|
13681
|
+
return this.translateService.translate(source?.fieldData.otherOption?.label || 'other_option.label');
|
|
13682
|
+
}
|
|
13343
13683
|
const option = source?.fieldData.options?.find(opt => String(opt.id) === String(scalar));
|
|
13344
13684
|
return option ? this.translateService.translate(option.text) : String(scalar);
|
|
13345
13685
|
};
|
|
@@ -13401,9 +13741,16 @@ const UNDO_TIMEOUT_MS = 6000;
|
|
|
13401
13741
|
* Opciones manuales de un campo del que se puede depender: el editor de reglas las usa para
|
|
13402
13742
|
* mostrar un selector de valor (y su texto) en vez de pedir el id a mano. Con origen externo no hay lista fija.
|
|
13403
13743
|
*/
|
|
13404
|
-
const dependencyValueOptions = (fieldData) =>
|
|
13405
|
-
|
|
13406
|
-
|
|
13744
|
+
const dependencyValueOptions = (fieldData) => {
|
|
13745
|
+
const manual = !fieldData.optionsSource?.key && fieldData.options?.length
|
|
13746
|
+
? fieldData.options.filter(opt => opt.id !== '' && opt.id !== null && opt.id !== undefined).map(opt => ({ id: opt.id, text: opt.text || String(opt.id) }))
|
|
13747
|
+
: undefined;
|
|
13748
|
+
// "Otros" también se puede usar como condición (p. ej., mostrar otra pregunta si eligió Otros).
|
|
13749
|
+
if (manual && uicHasOtherOption(fieldData)) {
|
|
13750
|
+
return [...manual, { id: UIC_OTHER_OPTION_ID, text: fieldData.otherOption?.label || 'other_option.label' }];
|
|
13751
|
+
}
|
|
13752
|
+
return manual;
|
|
13753
|
+
};
|
|
13407
13754
|
const DEFAULT_PROPERTIES_WIDTH = 320;
|
|
13408
13755
|
const clampPropertiesWidth = (width) => Math.min(Math.max(width, 250), 600);
|
|
13409
13756
|
class UicUserFormbuilderComponent {
|
|
@@ -15291,5 +15638,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
15291
15638
|
* Generated bundle index. Do not edit.
|
|
15292
15639
|
*/
|
|
15293
15640
|
|
|
15294
|
-
export { BASE_FORM_FIELDS, BRANCH_FORM_FIELDS, COMPUTED_FORM_FIELDS, DROPDOWN_OVERLAY_CONTROLS, EXTERNAL_VALIDATION_FORM_FIELDS, EXTRA_FORM_FIELDS, FIELDS_CONFIG, FirstCapitalPipe, LAYOUT_FORM_FIELDS, MODAL_CLOSE_EVENT, MODAL_CLOSE_REQUEST, MODAL_COMPONENT, MODAL_CONFIG, MODAL_DATA, UIC_BASE_COLORS, UIC_COLORS, UIC_COLOR_SCHEME_ATTR, UIC_EXTRA_COLORS, UIC_FORM_BUILDER_CONFIG, UIC_PALETTE_COLORS, UIC_THEME_SCOPE_ATTR, UIC_THEME_SCOPE_CLASS, UIC_THEME_TOKENS, UIC_TRANSLATE_CONFIG, UiDropdownCloseDirective, UiModalRef, UicAccordionComponent, UicActionButtonComponent, UicAlertContainerComponent, UicButtonComponent, UicCheckboxComponent, UicDatePickerComponent, UicDropdownContainerComponent, UicEditableTableComponent, UicExcelTableComponent, UicFileInputComponent, UicFormEngine, UicFormStateService, UicFormWrapperComponent, UicInputComponent, UicKpiCardComponent, UicModalService, UicMultySearcherComponent, UicMultySelectComponent, UicNameInitsPipe, UicOverlayCardComponent, UicPhoneInputComponent, UicPoolOptionsComponent, UicPortletCardComponent, UicProgressBarComponent, UicPushAlertService, UicRadioComponent, UicRepeaterComponent, UicRuleBuilderComponent, UicScaleComponent, UicSearcherComponent, UicSelectComponent, UicShortTableComponent, UicSignaturePadComponent, UicSkeletonCardsComponent, UicSkeletonLoaderComponent, UicSliderComponent, UicStepTabsComponent, UicStepsFormComponent, UicSurveyComponent, UicSurveyFooterDirective, UicSurveyHeaderDirective, UicSwichComponent, UicTableComponent, UicTabsButtonComponent, UicTagSelectorComponent, UicTextareaAutoresizeDirective, UicTextareaAutoresizeMaxRowsDirective, UicTextareaAutoresizeMinRowsDirective, UicTimePickerComponent, UicTinyAlertService, UicToolTipDirective, UicTranslatePipe, UicTranslateService, UicTreeAdminComponent, UicUserFormbuilderComponent, UicWizardComponent, UicWizardStepComponent, UicWorkPanelComponent, VISIBILITY_OPERATOR_OPTIONS, animatedRow, applyColorScheme, applyThemeScope, fadeAndRise, fadeBackdrop, findThemeScope, helperFormMapFormdataToObject, helperShowFormFromBuilder, helperTableMapDatoToColums, highlightRow, isLimitReached, isMobile, provideUicFormBuilderConfig, provideUicTranslateConfig, pushTop, resolveFormBuilderConfig, sideModal, simpleFade, uicColorOptions, uicColorSwatchOptions, uicSelectionCountValidator, uicSelectionValidatorsFor };
|
|
15641
|
+
export { BASE_FORM_FIELDS, BRANCH_FORM_FIELDS, COMPUTED_FORM_FIELDS, DROPDOWN_OVERLAY_CONTROLS, EXTERNAL_VALIDATION_FORM_FIELDS, EXTRA_FORM_FIELDS, FIELDS_CONFIG, FirstCapitalPipe, LAYOUT_FORM_FIELDS, MODAL_CLOSE_EVENT, MODAL_CLOSE_REQUEST, MODAL_COMPONENT, MODAL_CONFIG, MODAL_DATA, UIC_BASE_COLORS, UIC_COLORS, UIC_COLOR_SCHEME_ATTR, UIC_DISTRIBUTION_TOTAL, UIC_EXTRA_COLORS, UIC_FORM_BUILDER_CONFIG, UIC_OTHER_FIELD_SUFFIX, UIC_OTHER_OPTION_ID, UIC_OTHER_OPTION_TYPES, UIC_OTHER_TEXT_MAX_LENGTH, UIC_PALETTE_COLORS, UIC_THEME_SCOPE_ATTR, UIC_THEME_SCOPE_CLASS, UIC_THEME_TOKENS, UIC_TRANSLATE_CONFIG, UiDropdownCloseDirective, UiModalRef, UicAccordionComponent, UicActionButtonComponent, UicAlertContainerComponent, UicButtonComponent, UicCheckboxComponent, UicDatePickerComponent, UicDistributionComponent, UicDropdownContainerComponent, UicEditableTableComponent, UicExcelTableComponent, UicFileInputComponent, UicFormEngine, UicFormStateService, UicFormWrapperComponent, UicInputComponent, UicKpiCardComponent, UicModalService, UicMultySearcherComponent, UicMultySelectComponent, UicNameInitsPipe, UicOverlayCardComponent, UicPhoneInputComponent, UicPoolOptionsComponent, UicPortletCardComponent, UicProgressBarComponent, UicPushAlertService, UicRadioComponent, UicRepeaterComponent, UicRuleBuilderComponent, UicScaleComponent, UicSearcherComponent, UicSelectComponent, UicShortTableComponent, UicSignaturePadComponent, UicSkeletonCardsComponent, UicSkeletonLoaderComponent, UicSliderComponent, UicStepTabsComponent, UicStepsFormComponent, UicSurveyComponent, UicSurveyFooterDirective, UicSurveyHeaderDirective, UicSwichComponent, UicTableComponent, UicTabsButtonComponent, UicTagSelectorComponent, UicTextareaAutoresizeDirective, UicTextareaAutoresizeMaxRowsDirective, UicTextareaAutoresizeMinRowsDirective, UicTimePickerComponent, UicTinyAlertService, UicToolTipDirective, UicTranslatePipe, UicTranslateService, UicTreeAdminComponent, UicUserFormbuilderComponent, UicWizardComponent, UicWizardStepComponent, UicWorkPanelComponent, VISIBILITY_OPERATOR_OPTIONS, animatedRow, applyColorScheme, applyThemeScope, fadeAndRise, fadeBackdrop, findThemeScope, helperFormMapFormdataToObject, helperShowFormFromBuilder, helperTableMapDatoToColums, highlightRow, isLimitReached, isMobile, provideUicFormBuilderConfig, provideUicTranslateConfig, pushTop, resolveFormBuilderConfig, sideModal, simpleFade, uicBuildOtherField, uicColorOptions, uicColorSwatchOptions, uicContainsOtherOption, uicDistributionSum, uicDistributionTotalValidator, uicDistributionValidatorsFor, uicExpandOtherFields, uicHasOtherOption, uicOptionsWithOther, uicOtherFieldName, uicSelectionCountValidator, uicSelectionValidatorsFor, uicSupportsOtherOption };
|
|
15295
15642
|
//# sourceMappingURL=ui-core-abv.mjs.map
|