ui-core-abv 0.11.2 → 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 +632 -96
- 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/block-editor.component.d.ts +14 -1
- package/lib/components/user-formbuilder/block-editor/field-editor/field-editor.component.d.ts +25 -2
- package/lib/components/user-formbuilder/block-editor/field-type-selector/field-type-selector.component.d.ts +6 -1
- package/lib/components/user-formbuilder/formbuilder.config.d.ts +111 -0
- package/lib/components/user-formbuilder/user-formbuilder.component.d.ts +28 -4
- package/lib/theme/colors.d.ts +10 -0
- package/lib/translate/dictionary.en.d.ts +30 -0
- package/lib/translate/dictionary.es.d.ts +30 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
- package/src/lib/styles/_default_colors.scss +228 -204
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,22 @@ 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
|
+
},
|
|
475
|
+
limits: {
|
|
476
|
+
fields_reached: 'The form already has the maximum of {{max}} fields',
|
|
477
|
+
blocks_reached: 'The maximum of {{max}} blocks has been reached',
|
|
478
|
+
repeater_fields_reached: 'The maximum of {{max}} sub-fields per repeater has been reached',
|
|
479
|
+
import_exceeds: 'The file exceeds the limits of this form: {{detail}}.',
|
|
480
|
+
detail_blocks: '{{count}} blocks (maximum {{max}})',
|
|
481
|
+
detail_fields: '{{count}} fields (maximum {{max}})',
|
|
482
|
+
detail_repeater_fields: 'a repeater with {{count}} sub-fields (maximum {{max}})',
|
|
483
|
+
},
|
|
468
484
|
undo: {
|
|
469
485
|
field_removed: 'Field "{{label}}" deleted',
|
|
470
486
|
subfield_removed: 'Sub-field "{{label}}" deleted',
|
|
@@ -697,6 +713,19 @@ const DICTIONARY_EN = {
|
|
|
697
713
|
subtitle_margin: 'Subtitle margin',
|
|
698
714
|
}
|
|
699
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
|
+
},
|
|
700
729
|
validation: {
|
|
701
730
|
invalid: '{{field}} is invalid.',
|
|
702
731
|
required: '{{field}} is required.',
|
|
@@ -708,6 +737,7 @@ const DICTIONARY_EN = {
|
|
|
708
737
|
external_invalid: '{{field}} is not valid.',
|
|
709
738
|
min_selections: '{{field}}: choose at least {{min}} options.',
|
|
710
739
|
max_selections: '{{field}}: choose at most {{max}} options.',
|
|
740
|
+
distribution_total: '{{field}} must add up to {{expected}}% (currently {{total}}%).',
|
|
711
741
|
},
|
|
712
742
|
clipboard: {
|
|
713
743
|
copy_error: 'Could not copy:',
|
|
@@ -951,6 +981,22 @@ const DICTIONARY_ES = {
|
|
|
951
981
|
visibility_summary: 'Visible si {{field}} {{operator}} {{value}}',
|
|
952
982
|
yes: 'Sí',
|
|
953
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
|
+
},
|
|
991
|
+
limits: {
|
|
992
|
+
fields_reached: 'Se alcanzó el máximo de {{max}} campos del formulario',
|
|
993
|
+
blocks_reached: 'Se alcanzó el máximo de {{max}} bloques',
|
|
994
|
+
repeater_fields_reached: 'Se alcanzó el máximo de {{max}} sub-campos por repetidor',
|
|
995
|
+
import_exceeds: 'El archivo supera los límites de este formulario: {{detail}}.',
|
|
996
|
+
detail_blocks: '{{count}} bloques (máximo {{max}})',
|
|
997
|
+
detail_fields: '{{count}} campos (máximo {{max}})',
|
|
998
|
+
detail_repeater_fields: 'un repetidor con {{count}} sub-campos (máximo {{max}})',
|
|
999
|
+
},
|
|
954
1000
|
undo: {
|
|
955
1001
|
field_removed: 'Campo "{{label}}" eliminado',
|
|
956
1002
|
subfield_removed: 'Sub-campo "{{label}}" eliminado',
|
|
@@ -1183,6 +1229,19 @@ const DICTIONARY_ES = {
|
|
|
1183
1229
|
subtitle_margin: 'Margen subtítulo',
|
|
1184
1230
|
}
|
|
1185
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
|
+
},
|
|
1186
1245
|
validation: {
|
|
1187
1246
|
invalid: '{{field}} es invalido.',
|
|
1188
1247
|
required: '{{field}} es obligatorio.',
|
|
@@ -1194,6 +1253,7 @@ const DICTIONARY_ES = {
|
|
|
1194
1253
|
external_invalid: '{{field}} no es válido.',
|
|
1195
1254
|
min_selections: '{{field}}: elige al menos {{min}} opciones.',
|
|
1196
1255
|
max_selections: '{{field}}: elige como máximo {{max}} opciones.',
|
|
1256
|
+
distribution_total: '{{field}} debe sumar {{expected}}% (ahora suma {{total}}%).',
|
|
1197
1257
|
},
|
|
1198
1258
|
clipboard: {
|
|
1199
1259
|
copy_error: 'No se pudo copiar:',
|
|
@@ -1310,6 +1370,15 @@ const UIC_PALETTE_COLORS = ['grey', 'primary', 'secondary', 'blue', 'red', 'gree
|
|
|
1310
1370
|
function uicColorOptions(colors = UIC_COLORS) {
|
|
1311
1371
|
return colors.map(color => ({ id: color, text: color }));
|
|
1312
1372
|
}
|
|
1373
|
+
/**
|
|
1374
|
+
* Opciones de color con una muestra (círculo del tono) delante del nombre, para selects de color.
|
|
1375
|
+
* El blanco se muestra como círculo con borde gris para que se vea sobre fondos claros.
|
|
1376
|
+
*/
|
|
1377
|
+
function uicColorSwatchOptions(colors = UIC_COLORS) {
|
|
1378
|
+
return colors.map(color => color === 'white'
|
|
1379
|
+
? { id: color, text: color, icon: 'ri-checkbox-blank-circle-line', iconColor: 'grey' }
|
|
1380
|
+
: { id: color, text: color, icon: 'ri-circle-fill', iconColor: color });
|
|
1381
|
+
}
|
|
1313
1382
|
|
|
1314
1383
|
/**
|
|
1315
1384
|
* Alcance de tema: un elemento marcado con el atributo `data-uic-theme-scope` cuyas variables CSS
|
|
@@ -1498,8 +1567,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1498
1567
|
args: [{ providedIn: 'root' }]
|
|
1499
1568
|
}] });
|
|
1500
1569
|
|
|
1501
|
-
const base$
|
|
1502
|
-
class UicDatePickerComponent extends base$
|
|
1570
|
+
const base$e = createValueAccessor();
|
|
1571
|
+
class UicDatePickerComponent extends base$e {
|
|
1503
1572
|
icon = ''; // Icono externo
|
|
1504
1573
|
iconColor = 'black';
|
|
1505
1574
|
internalIcon = ''; //Icono interno
|
|
@@ -1973,10 +2042,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
1973
2042
|
args: ['calendarTemplate']
|
|
1974
2043
|
}] } });
|
|
1975
2044
|
|
|
1976
|
-
let nextId$
|
|
2045
|
+
let nextId$2 = 1;
|
|
1977
2046
|
function createSuccessAlert(message, options) {
|
|
1978
2047
|
return {
|
|
1979
|
-
id: nextId$
|
|
2048
|
+
id: nextId$2++,
|
|
1980
2049
|
message,
|
|
1981
2050
|
icon: 'ri-check-line',
|
|
1982
2051
|
showProgressBar: true,
|
|
@@ -1987,7 +2056,7 @@ function createSuccessAlert(message, options) {
|
|
|
1987
2056
|
}
|
|
1988
2057
|
function createErrorAlert(message, options) {
|
|
1989
2058
|
return {
|
|
1990
|
-
id: nextId$
|
|
2059
|
+
id: nextId$2++,
|
|
1991
2060
|
message,
|
|
1992
2061
|
showProgressBar: true,
|
|
1993
2062
|
type: 'error',
|
|
@@ -1998,7 +2067,7 @@ function createErrorAlert(message, options) {
|
|
|
1998
2067
|
}
|
|
1999
2068
|
function createWarningAlert(message, options) {
|
|
2000
2069
|
return {
|
|
2001
|
-
id: nextId$
|
|
2070
|
+
id: nextId$2++,
|
|
2002
2071
|
message,
|
|
2003
2072
|
showProgressBar: true,
|
|
2004
2073
|
type: 'warning',
|
|
@@ -2009,7 +2078,7 @@ function createWarningAlert(message, options) {
|
|
|
2009
2078
|
}
|
|
2010
2079
|
function createInfoAlert(message, options) {
|
|
2011
2080
|
return {
|
|
2012
|
-
id: nextId$
|
|
2081
|
+
id: nextId$2++,
|
|
2013
2082
|
showProgressBar: true,
|
|
2014
2083
|
message,
|
|
2015
2084
|
icon: 'ri-information-2-line',
|
|
@@ -2049,8 +2118,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2049
2118
|
}]
|
|
2050
2119
|
}] });
|
|
2051
2120
|
|
|
2052
|
-
const base$
|
|
2053
|
-
class UicFileInputComponent extends base$
|
|
2121
|
+
const base$d = createValueAccessor();
|
|
2122
|
+
class UicFileInputComponent extends base$d {
|
|
2054
2123
|
icon = ''; // Icono externo
|
|
2055
2124
|
iconColor = 'black';
|
|
2056
2125
|
internalIcon = ''; //Icono interno
|
|
@@ -2378,8 +2447,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2378
2447
|
type: Input
|
|
2379
2448
|
}] } });
|
|
2380
2449
|
|
|
2381
|
-
const base$
|
|
2382
|
-
class UicMultySelectComponent extends base$
|
|
2450
|
+
const base$c = createValueAccessor();
|
|
2451
|
+
class UicMultySelectComponent extends base$c {
|
|
2383
2452
|
icon = ''; // Icono externo
|
|
2384
2453
|
iconColor = 'black'; //color de ícono externo
|
|
2385
2454
|
internalIcon = ''; //Icono interno
|
|
@@ -2605,8 +2674,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
2605
2674
|
args: [{ providedIn: 'root' }]
|
|
2606
2675
|
}] });
|
|
2607
2676
|
|
|
2608
|
-
const base$
|
|
2609
|
-
class UicMultySearcherComponent extends base$
|
|
2677
|
+
const base$b = createValueAccessor();
|
|
2678
|
+
class UicMultySearcherComponent extends base$b {
|
|
2610
2679
|
icon = ''; // Icono externo
|
|
2611
2680
|
iconColor = 'black'; //color de ícono externo
|
|
2612
2681
|
internalIcon = 'ri-search-2-line'; //Icono interno
|
|
@@ -2782,8 +2851,8 @@ const PHONE_COUNTRIES = [
|
|
|
2782
2851
|
{ name: 'Venezuela', iso2: 've', dialCode: '58' }
|
|
2783
2852
|
];
|
|
2784
2853
|
|
|
2785
|
-
const base$
|
|
2786
|
-
class UicPhoneInputComponent extends base$
|
|
2854
|
+
const base$a = createValueAccessor();
|
|
2855
|
+
class UicPhoneInputComponent extends base$a {
|
|
2787
2856
|
icon = '';
|
|
2788
2857
|
iconColor = 'black';
|
|
2789
2858
|
internalIcon = '';
|
|
@@ -3199,8 +3268,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3199
3268
|
args: ['pointerdown']
|
|
3200
3269
|
}] } });
|
|
3201
3270
|
|
|
3202
|
-
const base$
|
|
3203
|
-
class UicSearcherComponent extends base$
|
|
3271
|
+
const base$9 = createValueAccessor();
|
|
3272
|
+
class UicSearcherComponent extends base$9 {
|
|
3204
3273
|
icon = ''; // Icono externo
|
|
3205
3274
|
iconColor = 'black'; //color de ícono externo
|
|
3206
3275
|
internalIcon = 'ri-search-2-line'; //Icono interno
|
|
@@ -3351,8 +3420,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3351
3420
|
args: ['dropdownTemplate']
|
|
3352
3421
|
}] } });
|
|
3353
3422
|
|
|
3354
|
-
const base$
|
|
3355
|
-
class UicSelectComponent extends base$
|
|
3423
|
+
const base$8 = createValueAccessor();
|
|
3424
|
+
class UicSelectComponent extends base$8 {
|
|
3356
3425
|
icon = ''; // Icono externo
|
|
3357
3426
|
iconColor = 'black';
|
|
3358
3427
|
internalIcon = ''; //Icono interno
|
|
@@ -3674,8 +3743,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3674
3743
|
args: ['dropdownTemplate']
|
|
3675
3744
|
}] } });
|
|
3676
3745
|
|
|
3677
|
-
const base$
|
|
3678
|
-
class UicSliderComponent extends base$
|
|
3746
|
+
const base$7 = createValueAccessor();
|
|
3747
|
+
class UicSliderComponent extends base$7 {
|
|
3679
3748
|
icon = ''; // Icono externo
|
|
3680
3749
|
iconColor = 'black';
|
|
3681
3750
|
label = '';
|
|
@@ -3775,8 +3844,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3775
3844
|
args: ['document:mouseup']
|
|
3776
3845
|
}] } });
|
|
3777
3846
|
|
|
3778
|
-
const base$
|
|
3779
|
-
class UicRadioComponent extends base$
|
|
3847
|
+
const base$6 = createValueAccessor();
|
|
3848
|
+
class UicRadioComponent extends base$6 {
|
|
3780
3849
|
icon = '';
|
|
3781
3850
|
iconColor = 'black';
|
|
3782
3851
|
label = '';
|
|
@@ -3844,7 +3913,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3844
3913
|
type: Input
|
|
3845
3914
|
}] } });
|
|
3846
3915
|
|
|
3847
|
-
const base$
|
|
3916
|
+
const base$5 = createValueAccessor();
|
|
3848
3917
|
/** Máximo de puntos de una escala, para que siga siendo usable. */
|
|
3849
3918
|
const MAX_POINTS = 21;
|
|
3850
3919
|
/**
|
|
@@ -3852,7 +3921,7 @@ const MAX_POINTS = 21;
|
|
|
3852
3921
|
* Valor: el número elegido, o null. Se maneja con teclado como un grupo de radios
|
|
3853
3922
|
* (flechas, Inicio, Fin) y anuncia cada punto con su leyenda.
|
|
3854
3923
|
*/
|
|
3855
|
-
class UicScaleComponent extends base$
|
|
3924
|
+
class UicScaleComponent extends base$5 {
|
|
3856
3925
|
host = inject(ElementRef);
|
|
3857
3926
|
icon = '';
|
|
3858
3927
|
iconColor = 'black';
|
|
@@ -3983,6 +4052,184 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
3983
4052
|
type: Input
|
|
3984
4053
|
}] } });
|
|
3985
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
|
+
|
|
3986
4233
|
const base$3 = createValueAccessor();
|
|
3987
4234
|
class UicTimePickerComponent extends base$3 {
|
|
3988
4235
|
// Iconos y estado
|
|
@@ -4761,39 +5008,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
4761
5008
|
type: Injectable
|
|
4762
5009
|
}], ctorParameters: () => [] });
|
|
4763
5010
|
|
|
4764
|
-
/** Tipos cuyo valor es una lista de opciones elegidas. */
|
|
4765
|
-
const MULTI_SELECTION_TYPES = new Set(['multyselect', 'pool']);
|
|
4766
|
-
/**
|
|
4767
|
-
* Valida la cantidad de opciones elegidas (multyselect y pool múltiple).
|
|
4768
|
-
* Un valor vacío no falla por mínimo: para exigir al menos una respuesta se usa `required`.
|
|
4769
|
-
* Errores: { minSelections: { min, actual } } y { maxSelections: { max, actual } }.
|
|
4770
|
-
*/
|
|
4771
|
-
function uicSelectionCountValidator(min, max) {
|
|
4772
|
-
return (control) => {
|
|
4773
|
-
const value = control.value;
|
|
4774
|
-
const actual = Array.isArray(value) ? value.length : 0;
|
|
4775
|
-
if (actual === 0)
|
|
4776
|
-
return null;
|
|
4777
|
-
if (typeof min === 'number' && min > 0 && actual < min) {
|
|
4778
|
-
return { minSelections: { min, actual } };
|
|
4779
|
-
}
|
|
4780
|
-
if (typeof max === 'number' && max > 0 && actual > max) {
|
|
4781
|
-
return { maxSelections: { max, actual } };
|
|
4782
|
-
}
|
|
4783
|
-
return null;
|
|
4784
|
-
};
|
|
4785
|
-
}
|
|
4786
|
-
/** Validadores de selección que corresponden al campo (vacío si no aplica). */
|
|
4787
|
-
function uicSelectionValidatorsFor(field) {
|
|
4788
|
-
if (!MULTI_SELECTION_TYPES.has(field.type))
|
|
4789
|
-
return [];
|
|
4790
|
-
if (field.type === 'pool' && !field.multyEnabled)
|
|
4791
|
-
return [];
|
|
4792
|
-
const hasMin = typeof field.minSelections === 'number' && field.minSelections > 0;
|
|
4793
|
-
const hasMax = typeof field.maxSelections === 'number' && field.maxSelections > 0;
|
|
4794
|
-
return hasMin || hasMax ? [uicSelectionCountValidator(field.minSelections, field.maxSelections)] : [];
|
|
4795
|
-
}
|
|
4796
|
-
|
|
4797
5011
|
class UicRepeaterComponent {
|
|
4798
5012
|
fb = inject(FormBuilder);
|
|
4799
5013
|
formState = inject(UicFormStateService, { optional: true });
|
|
@@ -4942,6 +5156,83 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
4942
5156
|
type: Input
|
|
4943
5157
|
}] } });
|
|
4944
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
|
+
|
|
4945
5236
|
class UicDynamicFormComponent {
|
|
4946
5237
|
ngZone;
|
|
4947
5238
|
fieldsSignal = signal([]);
|
|
@@ -5022,6 +5313,29 @@ class UicDynamicFormComponent {
|
|
|
5022
5313
|
});
|
|
5023
5314
|
});
|
|
5024
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
|
+
}
|
|
5025
5339
|
formSyncEffect = effect(() => {
|
|
5026
5340
|
const form = this.formSignal();
|
|
5027
5341
|
if (form && !this.isSubForm) {
|
|
@@ -5320,6 +5634,7 @@ class UicDynamicFormComponent {
|
|
|
5320
5634
|
}),
|
|
5321
5635
|
pattern: (_err, field) => this.i18n.translate('validation.pattern', { field: field.label ?? field.name }),
|
|
5322
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 }),
|
|
5323
5638
|
maxSelections: (err, field) => this.i18n.translate('validation.max_selections', { field: field.label ?? field.name, max: err.max }),
|
|
5324
5639
|
minLengthArray: (_err, field) => this.i18n.translate('validation.required', { field: field.label ?? field.name }),
|
|
5325
5640
|
externalValidation: (err, field) => typeof err === 'string'
|
|
@@ -5611,7 +5926,7 @@ class UicDynamicFormComponent {
|
|
|
5611
5926
|
recognition.start();
|
|
5612
5927
|
}
|
|
5613
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 });
|
|
5614
|
-
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"] }] });
|
|
5615
5930
|
}
|
|
5616
5931
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicDynamicFormComponent, decorators: [{
|
|
5617
5932
|
type: Component,
|
|
@@ -5625,6 +5940,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5625
5940
|
UicTimePickerComponent,
|
|
5626
5941
|
UicRadioComponent,
|
|
5627
5942
|
UicScaleComponent,
|
|
5943
|
+
UicDistributionComponent,
|
|
5628
5944
|
UicSearcherComponent,
|
|
5629
5945
|
UicMultySelectComponent,
|
|
5630
5946
|
UicMultySearcherComponent,
|
|
@@ -5638,7 +5954,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5638
5954
|
UicPhoneInputComponent,
|
|
5639
5955
|
FormsModule,
|
|
5640
5956
|
UicRepeaterComponent
|
|
5641
|
-
], 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"] }]
|
|
5642
5958
|
}], ctorParameters: () => [{ type: i0.NgZone }], propDecorators: { fields: [{
|
|
5643
5959
|
type: Input
|
|
5644
5960
|
}], contextFields: [{
|
|
@@ -5680,6 +5996,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
5680
5996
|
class UicFormEngine {
|
|
5681
5997
|
fb = inject(FormBuilder);
|
|
5682
5998
|
formState = inject(UicFormStateService);
|
|
5999
|
+
i18n = inject(UicTranslateService);
|
|
5683
6000
|
// CONFIGURACIÓN
|
|
5684
6001
|
schema;
|
|
5685
6002
|
fields = [];
|
|
@@ -5893,6 +6210,7 @@ class UicFormEngine {
|
|
|
5893
6210
|
if (field.pattern instanceof RegExp)
|
|
5894
6211
|
validators.push(Validators.pattern(field.pattern));
|
|
5895
6212
|
validators.push(...uicSelectionValidatorsFor(field));
|
|
6213
|
+
validators.push(...uicDistributionValidatorsFor(field));
|
|
5896
6214
|
return validators;
|
|
5897
6215
|
}
|
|
5898
6216
|
submit() {
|
|
@@ -6868,7 +7186,7 @@ class UicFormEngine {
|
|
|
6868
7186
|
current[parts[parts.length - 1]] = value;
|
|
6869
7187
|
}
|
|
6870
7188
|
syncEffectiveSchema() {
|
|
6871
|
-
|
|
7189
|
+
const schema = this.schema ?? {
|
|
6872
7190
|
cols: this.cols ?? 2,
|
|
6873
7191
|
blocks: [
|
|
6874
7192
|
{
|
|
@@ -6876,8 +7194,24 @@ class UicFormEngine {
|
|
|
6876
7194
|
}
|
|
6877
7195
|
]
|
|
6878
7196
|
};
|
|
7197
|
+
this.effectiveSchema = this.expandOtherOptionFields(schema);
|
|
6879
7198
|
this.touch();
|
|
6880
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
|
+
}
|
|
6881
7215
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicFormEngine, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
6882
7216
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicFormEngine });
|
|
6883
7217
|
}
|
|
@@ -10754,6 +11088,7 @@ const FIELDS_CONFIG = [
|
|
|
10754
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'] } },
|
|
10755
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'] } },
|
|
10756
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'] } },
|
|
10757
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'] } },
|
|
10758
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'] } },
|
|
10759
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'] } }
|
|
@@ -10831,7 +11166,7 @@ const LAYOUT_FORM_FIELDS = [
|
|
|
10831
11166
|
label: 'form_builder.extra.iconColor',
|
|
10832
11167
|
internalIcon: 'ri-palette-line',
|
|
10833
11168
|
type: 'select',
|
|
10834
|
-
options:
|
|
11169
|
+
options: uicColorSwatchOptions()
|
|
10835
11170
|
},
|
|
10836
11171
|
{
|
|
10837
11172
|
name: 'internalIcon',
|
|
@@ -10846,7 +11181,7 @@ const LAYOUT_FORM_FIELDS = [
|
|
|
10846
11181
|
label: 'form_builder.extra.internalIconColor',
|
|
10847
11182
|
internalIcon: 'ri-palette-line',
|
|
10848
11183
|
type: 'select',
|
|
10849
|
-
options:
|
|
11184
|
+
options: uicColorSwatchOptions()
|
|
10850
11185
|
},
|
|
10851
11186
|
{
|
|
10852
11187
|
name: 'tip',
|
|
@@ -11541,7 +11876,8 @@ class UicSurveyComponent {
|
|
|
11541
11876
|
const blocks = schema.blocks ?? [];
|
|
11542
11877
|
const pages = [];
|
|
11543
11878
|
blocks.forEach((block, blockIndex) => {
|
|
11544
|
-
|
|
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);
|
|
11545
11881
|
if (!askable.length)
|
|
11546
11882
|
return;
|
|
11547
11883
|
if (this.pageMode() === 'block') {
|
|
@@ -11554,7 +11890,7 @@ class UicSurveyComponent {
|
|
|
11554
11890
|
index: pages.length,
|
|
11555
11891
|
blockIndex,
|
|
11556
11892
|
block,
|
|
11557
|
-
fields: this.fieldsForSingleFieldPage(field),
|
|
11893
|
+
fields: this.fieldsForSingleFieldPage(field, block.fields ?? []),
|
|
11558
11894
|
firstOfBlock: fieldIndex === 0
|
|
11559
11895
|
});
|
|
11560
11896
|
});
|
|
@@ -11829,10 +12165,12 @@ class UicSurveyComponent {
|
|
|
11829
12165
|
target?.focus({ preventScroll: true });
|
|
11830
12166
|
});
|
|
11831
12167
|
}
|
|
11832
|
-
|
|
12168
|
+
/** Campos de una página de una sola pregunta: la pregunta y, si tiene "Otros", su texto acompañante. */
|
|
12169
|
+
fieldsForSingleFieldPage(field, blockFields) {
|
|
11833
12170
|
let fields = this.fieldPageFieldsCache.get(field);
|
|
11834
12171
|
if (!fields) {
|
|
11835
|
-
|
|
12172
|
+
const otherText = blockFields.find(candidate => candidate.otherFor === field.name);
|
|
12173
|
+
fields = otherText ? [field, otherText] : [field];
|
|
11836
12174
|
this.fieldPageFieldsCache.set(field, fields);
|
|
11837
12175
|
}
|
|
11838
12176
|
return fields;
|
|
@@ -12076,12 +12414,7 @@ const OPTION_ICON_SUGGESTIONS = [
|
|
|
12076
12414
|
class UicOptionStyleEditorComponent {
|
|
12077
12415
|
modalRef = inject(UiModalRef);
|
|
12078
12416
|
/** Colores para el select: cada uno con un círculo de su tono. */
|
|
12079
|
-
colorOptions = OPTION_ICON_COLORS
|
|
12080
|
-
id: color,
|
|
12081
|
-
text: color,
|
|
12082
|
-
icon: 'ri-circle-fill',
|
|
12083
|
-
iconColor: color
|
|
12084
|
-
}));
|
|
12417
|
+
colorOptions = uicColorSwatchOptions(OPTION_ICON_COLORS);
|
|
12085
12418
|
suggestions = OPTION_ICON_SUGGESTIONS;
|
|
12086
12419
|
options;
|
|
12087
12420
|
/** Fila cuyo panel de sugerencias está abierto. */
|
|
@@ -12310,6 +12643,21 @@ class FieldEditorComponent {
|
|
|
12310
12643
|
enableNameModify = input(false);
|
|
12311
12644
|
/** Solo lectura: muestra las propiedades deshabilitadas y oculta las acciones sobre reglas. */
|
|
12312
12645
|
readOnly = input(false);
|
|
12646
|
+
/** Fuentes externas habilitadas por la configuración del builder. */
|
|
12647
|
+
externalSources = input({ options: true, computed: true, validation: true });
|
|
12648
|
+
/**
|
|
12649
|
+
* Una fuente deshabilitada se oculta, salvo que el campo ya la tenga configurada:
|
|
12650
|
+
* así un formulario existente se puede ver y limpiar sin perder datos.
|
|
12651
|
+
*/
|
|
12652
|
+
/** Sección "Dependencia". Deshabilitada se oculta, salvo que el campo ya tenga reglas (para verlas y quitarlas). */
|
|
12653
|
+
visibilityRulesEnabled = input(true);
|
|
12654
|
+
/** Sección "Estilo". */
|
|
12655
|
+
styleEnabled = input(true);
|
|
12656
|
+
showDependencySection = computed(() => this.visibilityRulesEnabled() || !!this.localField().visibilityRules?.length);
|
|
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()));
|
|
12660
|
+
showExternalValidation = computed(() => this.hasExternalValidation() && (this.externalSources().validation || !!this.localField().externalValidation?.key));
|
|
12313
12661
|
options = input({});
|
|
12314
12662
|
hiddenSections = signal([]);
|
|
12315
12663
|
editingRuleIndex = signal(-1); // -1 = no se está editando ninguna regla
|
|
@@ -12595,6 +12943,26 @@ class FieldEditorComponent {
|
|
|
12595
12943
|
this.localField.set(updatedField);
|
|
12596
12944
|
this.fieldChange.emit(updatedField);
|
|
12597
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
|
+
}
|
|
12598
12966
|
updateOptions(options) {
|
|
12599
12967
|
const updatedField = {
|
|
12600
12968
|
...this.localField(),
|
|
@@ -12822,7 +13190,7 @@ class FieldEditorComponent {
|
|
|
12822
13190
|
});
|
|
12823
13191
|
}
|
|
12824
13192
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FieldEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
12825
|
-
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 }, 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 <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 @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<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@if (!isSubField() && hasExternalValidation()) {\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<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()) {\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", 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"] }] });
|
|
12826
13194
|
}
|
|
12827
13195
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FieldEditorComponent, decorators: [{
|
|
12828
13196
|
type: Component,
|
|
@@ -12830,9 +13198,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
12830
13198
|
UicFormWrapperComponent,
|
|
12831
13199
|
UicButtonComponent,
|
|
12832
13200
|
NgTemplateOutlet,
|
|
13201
|
+
FormsModule,
|
|
13202
|
+
UicCheckboxComponent,
|
|
13203
|
+
UicInputComponent,
|
|
12833
13204
|
UicTranslatePipe,
|
|
12834
13205
|
UicFieldOptionsEditorComponent
|
|
12835
|
-
], 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 <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 @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<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@if (!isSubField() && hasExternalValidation()) {\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<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()) {\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", 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"] }]
|
|
12836
13207
|
}], ctorParameters: () => [] });
|
|
12837
13208
|
|
|
12838
13209
|
/** Agrupación solo de presentación: no altera FIELDS_CONFIG. Tipos no listados caen en "other". */
|
|
@@ -12848,6 +13219,7 @@ const GROUP_BY_TYPE = {
|
|
|
12848
13219
|
switch: 'choice',
|
|
12849
13220
|
pool: 'choice',
|
|
12850
13221
|
scale: 'choice',
|
|
13222
|
+
distribution: 'choice',
|
|
12851
13223
|
slider: 'choice',
|
|
12852
13224
|
date: 'datetime',
|
|
12853
13225
|
time: 'datetime',
|
|
@@ -12860,14 +13232,22 @@ const GROUP_BY_TYPE = {
|
|
|
12860
13232
|
const GROUP_ORDER = ['text', 'choice', 'datetime', 'advanced', 'other'];
|
|
12861
13233
|
class FieldTypeSelectorComponent {
|
|
12862
13234
|
translateService = inject(UicTranslateService);
|
|
13235
|
+
/** Tipos permitidos por la configuración del builder. null = todos. */
|
|
13236
|
+
allowedTypes = input(null);
|
|
12863
13237
|
excludeTypes = input([]);
|
|
12864
13238
|
/** Texto del botón disparador (clave de traducción o texto literal). */
|
|
12865
13239
|
label = input('form_builder.add_new_field');
|
|
12866
13240
|
size = input('s');
|
|
13241
|
+
/** Deshabilita el botón (p. ej., al alcanzar un máximo); `disabledReason` se muestra como tooltip. */
|
|
13242
|
+
disabled = input(false);
|
|
13243
|
+
disabledReason = input('');
|
|
12867
13244
|
selectType = output();
|
|
12868
13245
|
searchInput;
|
|
12869
13246
|
search = signal('');
|
|
12870
|
-
types = computed(() =>
|
|
13247
|
+
types = computed(() => {
|
|
13248
|
+
const allowed = this.allowedTypes();
|
|
13249
|
+
return FIELDS_CONFIG.filter(f => (!allowed || allowed.includes(f.value)) && !this.excludeTypes().includes(f.value));
|
|
13250
|
+
});
|
|
12871
13251
|
filteredTypes = computed(() => {
|
|
12872
13252
|
const term = this.normalize(this.search());
|
|
12873
13253
|
if (!term)
|
|
@@ -12907,11 +13287,11 @@ class FieldTypeSelectorComponent {
|
|
|
12907
13287
|
return value.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().trim();
|
|
12908
13288
|
}
|
|
12909
13289
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FieldTypeSelectorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
12910
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: FieldTypeSelectorComponent, isStandalone: true, selector: "lib-field-type-selector", inputs: { excludeTypes: { classPropertyName: "excludeTypes", publicName: "excludeTypes", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectType: "selectType" }, viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }], ngImport: i0, template: "<ui-dropdown-container #dropdown width=\"320px\" maxWidth=\"calc(100vw - 32px)\" (closed)=\"onClosed()\">\n <
|
|
13290
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: FieldTypeSelectorComponent, isStandalone: true, selector: "lib-field-type-selector", inputs: { allowedTypes: { classPropertyName: "allowedTypes", publicName: "allowedTypes", isSignal: true, isRequired: false, transformFunction: null }, excludeTypes: { classPropertyName: "excludeTypes", publicName: "excludeTypes", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, disabledReason: { classPropertyName: "disabledReason", publicName: "disabledReason", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectType: "selectType" }, viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }], ngImport: i0, template: "<ui-dropdown-container #dropdown width=\"320px\" maxWidth=\"calc(100vw - 32px)\" [disabled]=\"disabled()\" (closed)=\"onClosed()\">\n <!-- El tooltip va en el contenedor: un bot\u00F3n deshabilitado no recibe eventos del mouse -->\n <span button class=\"ftp-trigger\" [uiTooltip]=\"disabled() ? disabledReason() : ''\">\n <ui-button\n type=\"bordered\"\n color=\"black\"\n icon=\"ri-add-line\"\n [size]=\"size()\"\n [disabled]=\"disabled()\"\n [text]=\"label() | uicTranslate\"\n (click)=\"onOpen()\">\n </ui-button>\n </span>\n\n <div content class=\"ftp\">\n <div class=\"ftp-search\">\n <i class=\"ri-search-line\" aria-hidden=\"true\"></i>\n <input\n #searchInput\n type=\"text\"\n [attr.aria-label]=\"'form_builder.field_picker.search' | uicTranslate\"\n [placeholder]=\"'form_builder.field_picker.search' | uicTranslate\"\n [value]=\"search()\"\n (input)=\"search.set($any($event.target).value)\"\n (keydown.enter)=\"pickFirst(dropdown)\">\n </div>\n\n <div class=\"ftp-list\">\n @for (group of groups(); track group.key) {\n <div class=\"ftp-group-title\">{{ 'form_builder.field_picker.groups.' + group.key | uicTranslate }}</div>\n @for (type of group.types; track type.value) {\n <button type=\"button\" class=\"ftp-item\" uiDropdownClose (click)=\"pick(type)\">\n <span class=\"ftp-item-icon\"><i [class]=\"type.icon\" aria-hidden=\"true\"></i></span>\n <span class=\"ftp-item-text\">\n <b>{{ type.label | uicTranslate }}</b>\n @if (type.detail) {\n <small>{{ type.detail | uicTranslate }}</small>\n }\n </span>\n </button>\n }\n } @empty {\n <p class=\"ftp-empty\">{{ 'form_builder.field_picker.empty' | uicTranslate }}</p>\n }\n </div>\n </div>\n</ui-dropdown-container>\n", styles: [":host{display:inline-block}.ftp{display:flex;flex-direction:column;max-height:inherit}.ftp-search{display:flex;align-items:center;gap:6px;padding:8px 10px;border-bottom:solid 1px var(--uic-neutral-200, var(--grey-200));position:sticky;top:0;background-color:var(--uic-surface, white);z-index:1}.ftp-search i{color:var(--uic-neutral-400, var(--grey-400))}.ftp-search input{flex:1 1;min-width:0;border:none;outline:none;background:transparent;font-size:13px;color:var(--uic-neutral-800, var(--grey-800))}.ftp-list{padding:4px}.ftp-group-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400));padding:8px 8px 4px}.ftp-item{width:100%;display:flex;align-items:center;gap:10px;padding:6px 8px;border:none;border-radius:5px;background:none;cursor:pointer;text-align:left;color:inherit}.ftp-item:hover,.ftp-item:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));outline:none}.ftp-item-icon{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:5px;font-size:16px;background-color:var(--uic-neutral-200, var(--grey-200));color:var(--uic-neutral-600, var(--grey-600))}.ftp-item-text{display:flex;flex-direction:column;min-width:0}.ftp-item-text b{font-weight:500;font-size:13px}.ftp-item-text small{font-size:11px;color:var(--uic-neutral-500, var(--grey-500));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftp-empty{padding:12px;text-align:center;font-size:12px;color:var(--uic-neutral-400, var(--grey-400))}.ftp-trigger{display:inline-block}.ftp-trigger:has(button:disabled) ui-button{pointer-events:none}\n"], dependencies: [{ kind: "pipe", type: UicTranslatePipe, name: "uicTranslate" }, { kind: "component", type: UicDropdownContainerComponent, selector: "ui-dropdown-container", inputs: ["buttonLabel", "disabled", "positions", "matchTriggerWidth", "width", "minWidth", "maxWidth", "backdropClass", "hasBackdrop", "closeOnBackdropClick", "closeOnEscape", "closeOnContentClick", "offsetX", "offsetY", "push", "flexibleDimensions"], outputs: ["closed"] }, { kind: "directive", type: UiDropdownCloseDirective, selector: "[uiDropdownClose]" }, { kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "directive", type: UicToolTipDirective, selector: "[uiTooltip]", inputs: ["uiTooltip"] }] });
|
|
12911
13291
|
}
|
|
12912
13292
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: FieldTypeSelectorComponent, decorators: [{
|
|
12913
13293
|
type: Component,
|
|
12914
|
-
args: [{ selector: 'lib-field-type-selector', imports: [UicTranslatePipe, UicDropdownContainerComponent, UiDropdownCloseDirective, UicButtonComponent], template: "<ui-dropdown-container #dropdown width=\"320px\" maxWidth=\"calc(100vw - 32px)\" (closed)=\"onClosed()\">\n <
|
|
13294
|
+
args: [{ selector: 'lib-field-type-selector', imports: [UicTranslatePipe, UicDropdownContainerComponent, UiDropdownCloseDirective, UicButtonComponent, UicToolTipDirective], template: "<ui-dropdown-container #dropdown width=\"320px\" maxWidth=\"calc(100vw - 32px)\" [disabled]=\"disabled()\" (closed)=\"onClosed()\">\n <!-- El tooltip va en el contenedor: un bot\u00F3n deshabilitado no recibe eventos del mouse -->\n <span button class=\"ftp-trigger\" [uiTooltip]=\"disabled() ? disabledReason() : ''\">\n <ui-button\n type=\"bordered\"\n color=\"black\"\n icon=\"ri-add-line\"\n [size]=\"size()\"\n [disabled]=\"disabled()\"\n [text]=\"label() | uicTranslate\"\n (click)=\"onOpen()\">\n </ui-button>\n </span>\n\n <div content class=\"ftp\">\n <div class=\"ftp-search\">\n <i class=\"ri-search-line\" aria-hidden=\"true\"></i>\n <input\n #searchInput\n type=\"text\"\n [attr.aria-label]=\"'form_builder.field_picker.search' | uicTranslate\"\n [placeholder]=\"'form_builder.field_picker.search' | uicTranslate\"\n [value]=\"search()\"\n (input)=\"search.set($any($event.target).value)\"\n (keydown.enter)=\"pickFirst(dropdown)\">\n </div>\n\n <div class=\"ftp-list\">\n @for (group of groups(); track group.key) {\n <div class=\"ftp-group-title\">{{ 'form_builder.field_picker.groups.' + group.key | uicTranslate }}</div>\n @for (type of group.types; track type.value) {\n <button type=\"button\" class=\"ftp-item\" uiDropdownClose (click)=\"pick(type)\">\n <span class=\"ftp-item-icon\"><i [class]=\"type.icon\" aria-hidden=\"true\"></i></span>\n <span class=\"ftp-item-text\">\n <b>{{ type.label | uicTranslate }}</b>\n @if (type.detail) {\n <small>{{ type.detail | uicTranslate }}</small>\n }\n </span>\n </button>\n }\n } @empty {\n <p class=\"ftp-empty\">{{ 'form_builder.field_picker.empty' | uicTranslate }}</p>\n }\n </div>\n </div>\n</ui-dropdown-container>\n", styles: [":host{display:inline-block}.ftp{display:flex;flex-direction:column;max-height:inherit}.ftp-search{display:flex;align-items:center;gap:6px;padding:8px 10px;border-bottom:solid 1px var(--uic-neutral-200, var(--grey-200));position:sticky;top:0;background-color:var(--uic-surface, white);z-index:1}.ftp-search i{color:var(--uic-neutral-400, var(--grey-400))}.ftp-search input{flex:1 1;min-width:0;border:none;outline:none;background:transparent;font-size:13px;color:var(--uic-neutral-800, var(--grey-800))}.ftp-list{padding:4px}.ftp-group-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400));padding:8px 8px 4px}.ftp-item{width:100%;display:flex;align-items:center;gap:10px;padding:6px 8px;border:none;border-radius:5px;background:none;cursor:pointer;text-align:left;color:inherit}.ftp-item:hover,.ftp-item:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));outline:none}.ftp-item-icon{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:5px;font-size:16px;background-color:var(--uic-neutral-200, var(--grey-200));color:var(--uic-neutral-600, var(--grey-600))}.ftp-item-text{display:flex;flex-direction:column;min-width:0}.ftp-item-text b{font-weight:500;font-size:13px}.ftp-item-text small{font-size:11px;color:var(--uic-neutral-500, var(--grey-500));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ftp-empty{padding:12px;text-align:center;font-size:12px;color:var(--uic-neutral-400, var(--grey-400))}.ftp-trigger{display:inline-block}.ftp-trigger:has(button:disabled) ui-button{pointer-events:none}\n"] }]
|
|
12915
13295
|
}], propDecorators: { searchInput: [{
|
|
12916
13296
|
type: ViewChild,
|
|
12917
13297
|
args: ['searchInput']
|
|
@@ -12960,6 +13340,68 @@ function storePropertiesWidth(width) {
|
|
|
12960
13340
|
}
|
|
12961
13341
|
}
|
|
12962
13342
|
|
|
13343
|
+
/** Configuración global (p. ej. por cliente). La entrada `config` del componente la sobrescribe por clave. */
|
|
13344
|
+
const UIC_FORM_BUILDER_CONFIG = new InjectionToken('UIC_FORM_BUILDER_CONFIG');
|
|
13345
|
+
function provideUicFormBuilderConfig(config) {
|
|
13346
|
+
return { provide: UIC_FORM_BUILDER_CONFIG, useValue: config };
|
|
13347
|
+
}
|
|
13348
|
+
/** Tipos que no tienen sentido sin su fuente externa. */
|
|
13349
|
+
const OPTIONS_SOURCE_TYPES = ['searcher', 'multisearcher'];
|
|
13350
|
+
const COMPUTED_TYPES = ['computed'];
|
|
13351
|
+
function resolveFormBuilderConfig(...configs) {
|
|
13352
|
+
const merged = Object.assign({}, ...configs.filter(Boolean));
|
|
13353
|
+
const sources = merged.externalSources;
|
|
13354
|
+
const externalSources = typeof sources === 'object' && sources !== null
|
|
13355
|
+
? { options: sources.options ?? true, computed: sources.computed ?? true, validation: sources.validation ?? true }
|
|
13356
|
+
: { options: sources !== false, computed: sources !== false, validation: sources !== false };
|
|
13357
|
+
const known = new Set(FIELDS_CONFIG.map(type => type.value));
|
|
13358
|
+
const unknown = [...(merged.fieldTypes ?? []), ...(merged.excludeFieldTypes ?? [])].filter(type => !known.has(type));
|
|
13359
|
+
if (unknown.length) {
|
|
13360
|
+
console.warn(`ui-user-formbuilder: tipos de campo desconocidos en la configuración: ${unknown.join(', ')}`);
|
|
13361
|
+
}
|
|
13362
|
+
const excluded = new Set([
|
|
13363
|
+
...(merged.excludeFieldTypes ?? []),
|
|
13364
|
+
...(externalSources.options ? [] : OPTIONS_SOURCE_TYPES),
|
|
13365
|
+
...(externalSources.computed ? [] : COMPUTED_TYPES),
|
|
13366
|
+
]);
|
|
13367
|
+
const allowList = merged.fieldTypes?.length ? new Set(merged.fieldTypes) : null;
|
|
13368
|
+
const fieldTypes = FIELDS_CONFIG
|
|
13369
|
+
.map(type => type.value)
|
|
13370
|
+
.filter(type => (!allowList || allowList.has(type)) && !excluded.has(type));
|
|
13371
|
+
if (!fieldTypes.length) {
|
|
13372
|
+
console.warn('ui-user-formbuilder: la configuración no deja ningún tipo de campo disponible.');
|
|
13373
|
+
}
|
|
13374
|
+
return {
|
|
13375
|
+
fieldTypes,
|
|
13376
|
+
allowBlockCreation: merged.allowBlockCreation ?? true,
|
|
13377
|
+
externalSources,
|
|
13378
|
+
allowNameEdit: merged.allowNameEdit ?? null,
|
|
13379
|
+
visibilityRules: merged.visibilityRules ?? true,
|
|
13380
|
+
styleSection: merged.styleSection ?? true,
|
|
13381
|
+
limits: {
|
|
13382
|
+
maxBlocks: positiveIntOrNull(merged.limits?.maxBlocks, 'limits.maxBlocks'),
|
|
13383
|
+
maxFields: positiveIntOrNull(merged.limits?.maxFields, 'limits.maxFields'),
|
|
13384
|
+
maxRepeaterFields: positiveIntOrNull(merged.limits?.maxRepeaterFields, 'limits.maxRepeaterFields'),
|
|
13385
|
+
},
|
|
13386
|
+
preview: {
|
|
13387
|
+
mode: merged.preview?.mode ?? null,
|
|
13388
|
+
survey: merged.preview?.survey ?? null,
|
|
13389
|
+
},
|
|
13390
|
+
};
|
|
13391
|
+
}
|
|
13392
|
+
function positiveIntOrNull(value, key) {
|
|
13393
|
+
if (value === undefined || value === null)
|
|
13394
|
+
return null;
|
|
13395
|
+
if (typeof value === 'number' && Number.isInteger(value) && value > 0)
|
|
13396
|
+
return value;
|
|
13397
|
+
console.warn(`ui-user-formbuilder: "${key}" debe ser un entero positivo; se ignora el valor ${JSON.stringify(value)}.`);
|
|
13398
|
+
return null;
|
|
13399
|
+
}
|
|
13400
|
+
/** true si `count` ya alcanzó el máximo (sin máximo nunca se alcanza). */
|
|
13401
|
+
function isLimitReached(count, max) {
|
|
13402
|
+
return max !== null && count >= max;
|
|
13403
|
+
}
|
|
13404
|
+
|
|
12963
13405
|
const blockFieldListId = (blockCode) => `uic-fb-fields-${blockCode}`;
|
|
12964
13406
|
class BlockEditorComponent {
|
|
12965
13407
|
translateService = inject(UicTranslateService);
|
|
@@ -12992,6 +13434,19 @@ class BlockEditorComponent {
|
|
|
12992
13434
|
connectedFieldListIds = input([]);
|
|
12993
13435
|
/** Solo lectura: se puede navegar y seleccionar, pero no editar, mover, agregar ni eliminar. */
|
|
12994
13436
|
readOnly = input(false);
|
|
13437
|
+
/** Tipos de campo habilitados por la configuración del builder (null = todos). */
|
|
13438
|
+
availableFieldTypes = input(null);
|
|
13439
|
+
/** Falso cuando la configuración no permite crear bloques y este es el último. */
|
|
13440
|
+
canDelete = input(true);
|
|
13441
|
+
/** Máximos de la configuración (null = sin límite). */
|
|
13442
|
+
fieldLimitReached = input(false);
|
|
13443
|
+
maxFields = input(null);
|
|
13444
|
+
maxRepeaterFields = input(null);
|
|
13445
|
+
fieldLimitMessage = computed(() => this.translateService.translate('form_builder.limits.fields_reached', { max: this.maxFields() ?? 0 }));
|
|
13446
|
+
repeaterLimitMessage = computed(() => this.translateService.translate('form_builder.limits.repeater_fields_reached', { max: this.maxRepeaterFields() ?? 0 }));
|
|
13447
|
+
isRepeaterFull(field) {
|
|
13448
|
+
return isLimitReached(field.repeaterSubFields?.length ?? 0, this.maxRepeaterFields());
|
|
13449
|
+
}
|
|
12995
13450
|
fieldListId = computed(() => blockFieldListId(this.block().code));
|
|
12996
13451
|
/** Estado solo visual: plegar el bloque no altera el formulario. */
|
|
12997
13452
|
collapsed = signal(false);
|
|
@@ -13058,6 +13513,8 @@ class BlockEditorComponent {
|
|
|
13058
13513
|
addSubField(parentCode, type) {
|
|
13059
13514
|
const parentField = this.block().fields.find(f => f.code === parentCode);
|
|
13060
13515
|
const existing = parentField?.repeaterSubFields ?? [];
|
|
13516
|
+
if (parentField && this.isRepeaterFull(parentField))
|
|
13517
|
+
return;
|
|
13061
13518
|
const sfCode = this.generateSubFieldCode(existing);
|
|
13062
13519
|
const newSf = {
|
|
13063
13520
|
code: sfCode,
|
|
@@ -13098,7 +13555,7 @@ class BlockEditorComponent {
|
|
|
13098
13555
|
const parentField = this.block().fields.find(f => f.code === parentCode);
|
|
13099
13556
|
const existing = parentField?.repeaterSubFields ?? [];
|
|
13100
13557
|
const index = existing.findIndex(sf => sf.code === sfCode);
|
|
13101
|
-
if (index === -1)
|
|
13558
|
+
if (index === -1 || (parentField && this.isRepeaterFull(parentField)))
|
|
13102
13559
|
return;
|
|
13103
13560
|
const source = existing[index];
|
|
13104
13561
|
const newCode = this.generateSubFieldCode(existing);
|
|
@@ -13220,6 +13677,9 @@ class BlockEditorComponent {
|
|
|
13220
13677
|
if (typeof value === 'object')
|
|
13221
13678
|
return JSON.stringify(value);
|
|
13222
13679
|
const scalar = value;
|
|
13680
|
+
if (scalar === UIC_OTHER_OPTION_ID) {
|
|
13681
|
+
return this.translateService.translate(source?.fieldData.otherOption?.label || 'other_option.label');
|
|
13682
|
+
}
|
|
13223
13683
|
const option = source?.fieldData.options?.find(opt => String(opt.id) === String(scalar));
|
|
13224
13684
|
return option ? this.translateService.translate(option.text) : String(scalar);
|
|
13225
13685
|
};
|
|
@@ -13228,6 +13688,11 @@ class BlockEditorComponent {
|
|
|
13228
13688
|
lowerFirst(value) {
|
|
13229
13689
|
return value ? value.charAt(0).toLowerCase() + value.slice(1) : value;
|
|
13230
13690
|
}
|
|
13691
|
+
/** Duplicar crea un campo nuevo, así que solo se ofrece para tipos habilitados por la configuración. */
|
|
13692
|
+
isTypeAvailable(type) {
|
|
13693
|
+
const available = this.availableFieldTypes();
|
|
13694
|
+
return !available || available.includes(type);
|
|
13695
|
+
}
|
|
13231
13696
|
toggleCollapsed() {
|
|
13232
13697
|
this.collapsed.update(value => !value);
|
|
13233
13698
|
}
|
|
@@ -13253,7 +13718,7 @@ class BlockEditorComponent {
|
|
|
13253
13718
|
this.blockChange.emit({ ...this.block(), fields: nextFields });
|
|
13254
13719
|
}
|
|
13255
13720
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: BlockEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
13256
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: BlockEditorComponent, isStandalone: true, selector: "lib-block-editor", inputs: { block: { classPropertyName: "block", publicName: "block", isSignal: true, isRequired: false, transformFunction: null }, selectedFieldId: { classPropertyName: "selectedFieldId", publicName: "selectedFieldId", isSignal: true, isRequired: false, transformFunction: null }, selectedSubFieldCode: { classPropertyName: "selectedSubFieldCode", publicName: "selectedSubFieldCode", isSignal: true, isRequired: false, transformFunction: null }, selectedSubFieldParentCode: { classPropertyName: "selectedSubFieldParentCode", publicName: "selectedSubFieldParentCode", isSignal: true, isRequired: false, transformFunction: null }, visibilityParentFieldCodes: { classPropertyName: "visibilityParentFieldCodes", publicName: "visibilityParentFieldCodes", isSignal: false, isRequired: false, transformFunction: null }, fieldLookup: { classPropertyName: "fieldLookup", publicName: "fieldLookup", isSignal: false, isRequired: false, transformFunction: null }, showIdentifier: { classPropertyName: "showIdentifier", publicName: "showIdentifier", isSignal: true, isRequired: false, transformFunction: null }, connectedFieldListIds: { classPropertyName: "connectedFieldListIds", publicName: "connectedFieldListIds", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { blockChange: "blockChange", addFieldRequest: "addFieldRequest", deleteBlock: "deleteBlock", notifySelectedField: "notifySelectedField", notifySelectedSubField: "notifySelectedSubField", notifyNewSubField: "notifyNewSubField", itemRemoved: "itemRemoved", duplicateFieldRequest: "duplicateFieldRequest", moveFieldRequest: "moveFieldRequest" }, ngImport: i0, template: "<div class=\"form-block-card\" [class.collapsed]=\"collapsed()\">\n <div class=\"form-block-card-header\">\n @if (!readOnly()) {\n <i\n class=\"ri-draggable block-drag-handle\"\n cdkDragHandle\n [uiTooltip]=\"'form_builder.block.drag' | uicTranslate\"\n aria-hidden=\"true\"></i>\n }\n <div class=\"block-texts\">\n <input\n class=\"block-title-input\"\n [attr.aria-label]=\"'form_builder.block_title' | uicTranslate\"\n [placeholder]=\"'form_builder.block_title' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().title\"\n (ngModelChange)=\"changeTitle($event)\">\n @if (!collapsed() && (!readOnly() || block().subtitle || block().message)) {\n <input\n class=\"block-subtitle-input\"\n [attr.aria-label]=\"'form_builder.block_subtitle' | uicTranslate\"\n [placeholder]=\"'form_builder.block_subtitle' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().subtitle\"\n (ngModelChange)=\"changeSubtitle($event)\">\n <input\n class=\"block-message-input\"\n [attr.aria-label]=\"'form_builder.block_message' | uicTranslate\"\n [placeholder]=\"'form_builder.block_message' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().message\"\n (ngModelChange)=\"changeMessage($event)\">\n }\n </div>\n @if (collapsed()) {\n <span class=\"block-count\">{{'form_builder.block.field_count' | uicTranslate: { count: block().fields.length } }}</span>\n }\n <ui-button\n [uiTooltip]=\"(collapsed() ? 'form_builder.block.expand' : 'form_builder.block.collapse') | uicTranslate\"\n [attr.aria-expanded]=\"!collapsed()\"\n (click)=\"toggleCollapsed()\"\n size=\"s\"\n [icon]=\"collapsed() ? 'ri-arrow-down-s-line' : 'ri-arrow-up-s-line'\"\n color=\"black\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n @if (!readOnly()) {\n <ui-button\n [uiTooltip]=\"(isBlockVisibilityParent() ? 'form_builder.delete_block_dependency_blocked' : 'form_builder.delete_block') | uicTranslate\"\n [disabled]=\"isBlockVisibilityParent()\"\n (click)=\"requestDeleteBlock($event)\"\n size=\"s\"\n icon=\"ri-delete-bin-line\"\n color=\"red\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n </div>\n\n @if (!collapsed()) {\n <div\n class=\"form-block-card-body\"\n cdkDropList\n [id]=\"fieldListId()\"\n [cdkDropListData]=\"block().code\"\n [cdkDropListConnectedTo]=\"connectedFieldListIds()\"\n [cdkDropListDisabled]=\"readOnly()\"\n (cdkDropListDropped)=\"reorderFields($event)\">\n\n <!-- FIELDS -->\n @for(edtField of block().fields; track edtField.code; let i = $index) {\n <div class=\"field-with-subfields\">\n <div\n class=\"xfield-card\"\n cdkDrag\n [attr.data-field-code]=\"edtField.code\"\n [cdkDragDisabled]=\"readOnly()\"\n [class.selected-field]=\"isRepeaterParentSelected(edtField)\"\n (click)=\"selectField(edtField)\">\n @if (!readOnly()) {\n <i class=\"ri-draggable field-drag-handle\" cdkDragHandle></i>\n }\n\n <div class=\"xfield-card-icon\">\n <i [class]=\"edtField.field?.icon ?? ''\"></i>\n </div>\n <div class=\"xfield-card-body\">\n <b>\n <span class=\"field-label\">{{edtField.fieldData.label || edtField.fieldData.name}}</span>\n @if (edtField.fieldData.required) {\n <span class=\"required-mark\" [uiTooltip]=\"'form_builder.base.required' | uicTranslate\">*</span>\n }\n @if (edtField.fieldData.hidden) {\n <i class=\"hidden-field ri-eye-off-line\" [uiTooltip]=\"'form_builder.base.hidden' | uicTranslate\"></i>\n }\n </b>\n <p class=\"field-meta\">\n <span>{{(edtField.field?.label ?? edtField.type ?? edtField.fieldData.type) | uicTranslate}}</span>\n @if (showIdentifier()) {\n <code class=\"field-identifier\" [uiTooltip]=\"'form_builder.base.name' | uicTranslate\">{{edtField.fieldData.name}}</code>\n }\n </p>\n @let rootRule = visibilitySummary(edtField);\n @if (rootRule) {\n <p class=\"vs-rule\">\n <i class=\"branched-field ri-git-merge-line\" aria-hidden=\"true\"></i>\n <span>{{rootRule.text}}</span>\n @if (rootRule.extraRules > 0) {\n <span class=\"vs-rule-extra\">+{{rootRule.extraRules}}</span>\n }\n </p>\n }\n </div>\n <div class=\"xfield-card-actions\">\n @if (edtField.fieldData.type === 'repeater') {\n <ui-button\n [uiTooltip]=\"(isRepeaterExpanded(edtField.code) ? 'form_builder.repeater.hide_subfields' : 'form_builder.repeater.show_subfields') | uicTranslate\"\n [icon]=\"isRepeaterExpanded(edtField.code) ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'\"\n size=\"s\" color=\"black\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"toggleRepeater(edtField.code, $event)\">\n </ui-button>\n }\n @if (!readOnly()) {\n <ui-button\n [uiTooltip]=\"'form_builder.field_editor.duplicate' | uicTranslate\"\n (click)=\"requestDuplicateField(edtField.code, $event)\"\n size=\"s\"\n icon=\"ri-file-copy-2-line\"\n color=\"black\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n <ui-button\n [uiTooltip]=\"(isVisibilityParent(edtField.code) ? 'form_builder.delete_field_dependency_blocked' : 'form_builder.field_editor.delete') | uicTranslate\"\n [disabled]=\"isVisibilityParent(edtField.code)\"\n (click)=\"deleteField(edtField.code, $event)\"\n size=\"s\"\n icon=\"ri-delete-bin-line\"\n color=\"red\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n </div>\n </div>\n\n @if (edtField.fieldData.type === 'repeater' && isRepeaterExpanded(edtField.code)) {\n <div class=\"repeater-inline-panel\">\n <div\n class=\"repeater-subfields-list\"\n cdkDropList\n [cdkDropListData]=\"edtField.repeaterSubFields ?? []\"\n [cdkDropListDisabled]=\"readOnly()\"\n (cdkDropListDropped)=\"reorderSubFields(edtField.code, $event)\">\n @for (sf of edtField.repeaterSubFields ?? []; track sf.code) {\n <div\n class=\"xfield-card subfield-card\"\n cdkDrag\n [attr.data-subfield-code]=\"edtField.code + ':' + sf.code\"\n [class.selected-field]=\"selectedSubFieldCode() === sf.code && edtField.code === selectedSubFieldParentCode()\"\n [cdkDragDisabled]=\"readOnly()\"\n (click)=\"onSelectSubField(edtField.code, sf, $event)\">\n @if (!readOnly()) {\n <i class=\"ri-draggable field-drag-handle\" cdkDragHandle></i>\n }\n <div class=\"xfield-card-icon\">\n <i [class]=\"sf.field?.icon ?? 'ri-question-line'\"></i>\n </div>\n <div class=\"xfield-card-body\">\n <b>\n <span class=\"field-label\">{{ sf.fieldData.label || sf.fieldData.name }}</span>\n @if (sf.fieldData.required) {\n <span class=\"required-mark\" [uiTooltip]=\"'form_builder.base.required' | uicTranslate\">*</span>\n }\n @if (sf.fieldData.hidden) {\n <i class=\"hidden-field ri-eye-off-line\" [uiTooltip]=\"'form_builder.base.hidden' | uicTranslate\"></i>\n }\n </b>\n <p class=\"field-meta\">\n <span>{{ (sf.field?.label ?? sf.type ?? sf.fieldData.type) | uicTranslate }}</span>\n @if (showIdentifier()) {\n <code class=\"field-identifier\" [uiTooltip]=\"'form_builder.base.name' | uicTranslate\">{{sf.fieldData.name}}</code>\n }\n </p>\n @let subRule = visibilitySummary(sf, edtField.repeaterSubFields ?? []);\n @if (subRule) {\n <p class=\"vs-rule\">\n <i class=\"branched-field ri-git-merge-line\" aria-hidden=\"true\"></i>\n <span>{{subRule.text}}</span>\n @if (subRule.extraRules > 0) {\n <span class=\"vs-rule-extra\">+{{subRule.extraRules}}</span>\n }\n </p>\n }\n </div>\n @if (!readOnly()) {\n <div class=\"xfield-card-actions\">\n <ui-button\n [uiTooltip]=\"'form_builder.field_editor.duplicate' | uicTranslate\"\n size=\"s\" icon=\"ri-file-copy-2-line\" color=\"black\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"duplicateSubField(edtField.code, sf.code, $event)\">\n </ui-button>\n <ui-button\n [uiTooltip]=\"(isSubFieldVisibilityParent(edtField, sf.code) ? 'form_builder.delete_field_dependency_blocked' : 'form_builder.field_editor.delete') | uicTranslate\"\n [disabled]=\"isSubFieldVisibilityParent(edtField, sf.code)\"\n size=\"s\" icon=\"ri-delete-bin-line\" color=\"red\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"deleteSubField(edtField.code, sf.code, $event)\">\n </ui-button>\n </div>\n }\n </div>\n } @empty {\n <p class=\"empty-hint\">{{'form_builder.repeater.no_subfields' | uicTranslate}}</p>\n }\n </div>\n @if (!readOnly()) {\n <div class=\"new-subfield\">\n <lib-field-type-selector label=\"form_builder.repeater.add_subfield\" size=\"t\" [excludeTypes]=\"excludeSubFieldTypes\" (selectType)=\"addSubField(edtField.code, $event)\"></lib-field-type-selector>\n </div>\n }\n </div>\n }\n </div>\n\n } @empty {\n <div class=\"empty-block\">\n <i class=\"ri-layout-row-line\" aria-hidden=\"true\"></i>\n <p>{{(readOnly() ? 'form_builder.block.empty_read_only' : 'form_builder.no_fields_drop') | uicTranslate}}</p>\n </div>\n }\n\n </div>\n @if (!readOnly()) {\n <div class=\"new-field\">\n <lib-field-type-selector label=\"form_builder.add_new_field\" (selectType)=\"addField($event)\"></lib-field-type-selector>\n </div>\n }\n }\n</div>\n", styles: [":host{display:block}.form-block-card{border:solid 1px var(--blue-500);border-radius:5px;overflow:hidden}.form-block-card-header{display:flex;gap:5px;align-items:flex-start;background-color:var(--uic-surface-raised, white);padding:10px 10px 10px 6px;border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300))}.form-block-card.collapsed .form-block-card-header{border-bottom:none;align-items:center}.form-block-card-body{padding:15px;display:flex;flex-direction:column;background-color:var(--uic-neutral-50, var(--grey-50));gap:10px;min-height:40px}:host(.cdk-drag-preview) .form-block-card{box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18))}.block-drag-handle{cursor:grab;padding:4px 2px;color:var(--uic-neutral-400, var(--grey-400))}.block-drag-handle:hover{color:var(--uic-neutral-600, var(--grey-600))}.block-drag-handle:active{cursor:grabbing}.block-texts{flex:1 1;min-width:0;display:flex;flex-direction:column;gap:2px}.block-texts input{width:100%;border:solid 1px transparent;background:transparent;padding:2px 6px;border-radius:5px;color:var(--uic-neutral-800, var(--grey-800))}.block-texts input:hover{border-color:var(--uic-neutral-200, var(--grey-200))}.block-texts input:focus{border-color:var(--primary-500);background-color:var(--uic-surface, white);outline:none}.block-texts input::placeholder{color:var(--uic-neutral-400, var(--grey-400))}.block-texts input[readonly]{cursor:default}.block-texts input[readonly]:hover,.block-texts input[readonly]:focus{border-color:transparent;background:transparent}.block-texts .block-title-input{font-size:16px;font-weight:600}.block-texts .block-subtitle-input{font-size:13px;color:var(--uic-neutral-600, var(--grey-600))}.block-texts .block-message-input{font-size:12px;font-style:italic;color:var(--uic-neutral-500, var(--grey-500))}.block-count{flex:0 0 auto;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));padding:0 6px}.xfield-card{background-color:var(--uic-surface-raised, white);border-radius:5px;padding:10px;gap:10px;display:flex;align-items:center;border:solid 2px var(--uic-neutral-200, var(--grey-200));cursor:pointer;transition:border-color .3s ease}.xfield-card:hover{border-color:var(--uic-neutral-300, var(--grey-300))}.xfield-card-icon{display:flex;justify-content:center;align-items:center;border-radius:5px;width:30px;height:30px;font-size:20px;background-color:var(--uic-neutral-300, var(--grey-300));color:var(--uic-neutral-600, var(--grey-600))}.xfield-card-body{flex:1 1;min-width:0;display:flex;flex-direction:column;gap:2px}.xfield-card-body b{display:flex;align-items:center;gap:5px;min-width:0}.xfield-card-body p{color:var(--uic-neutral-400, var(--grey-400));font-size:12px}.field-drag-handle{cursor:grab;color:var(--uic-neutral-400, var(--grey-400));transition:color .2s ease}.field-drag-handle:active{cursor:grabbing}.xfield-card:hover .field-drag-handle{color:var(--uic-neutral-600, var(--grey-600))}.cdk-drag-preview{box-sizing:border-box;border-radius:5px;box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18))}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.field-with-subfields{display:flex;flex-direction:column;gap:0}.repeater-inline-panel{background-color:var(--uic-neutral-100, var(--grey-100));border:solid 1px var(--blue-300);border-top:none;border-radius:0 0 5px 5px;padding:10px 10px 8px 28px;display:flex;flex-direction:column;gap:8px}.repeater-subfields-list{display:flex;flex-direction:column;gap:6px;min-height:6px}.subfield-card{font-size:13px;border-radius:4px;padding:7px 8px!important}.subfield-card .xfield-card-icon{width:26px!important;height:26px!important;font-size:16px!important}.subfield-card b{font-size:13px}.subfield-card p{font-size:11px}.new-subfield{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));flex-wrap:wrap;padding-top:2px}.empty-hint{font-size:12px;color:var(--uic-neutral-400, var(--grey-400));text-align:center;padding:4px 0;margin:0}.form-block-card-body.cdk-drop-list-dragging .xfield-card:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.branched-field{color:var(--yellow-600)}.hidden-field{color:var(--uic-neutral-500, var(--grey-500))}.selected-field,.selected-field:hover{border-color:var(--primary-500)}.new-field{border-top:solid 1px var(--uic-neutral-300, var(--grey-300));padding:10px;background-color:var(--uic-surface-raised, white);display:flex;align-items:center;gap:5px;font-size:14px}.field-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.required-mark{color:var(--red-500);font-weight:700;cursor:default}.field-meta{display:flex;align-items:center;gap:6px;min-width:0}.field-identifier{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;padding:0 5px;border-radius:3px;background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-600, var(--grey-600));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.xfield-card-body .vs-rule{display:flex;align-items:center;gap:4px;min-width:0;font-size:12px;color:var(--uic-neutral-600, var(--grey-600))}.xfield-card-body .vs-rule>span:not(.vs-rule-extra){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vs-rule-extra{flex:0 0 auto;font-size:11px;padding:0 5px;border-radius:8px;background-color:var(--yellow-100);color:var(--yellow-600)}.empty-block{display:flex;flex-direction:column;align-items:center;gap:6px;padding:18px 10px;border:dashed 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;font-size:13px;color:var(--uic-neutral-400, var(--grey-400))}.empty-block i{font-size:22px}\n"], dependencies: [{ kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "directive", type: UicToolTipDirective, selector: "[uiTooltip]", inputs: ["uiTooltip"] }, { kind: "pipe", type: UicTranslatePipe, name: "uicTranslate" }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "ngmodule", type: FormsModule }, { 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FieldTypeSelectorComponent, selector: "lib-field-type-selector", inputs: ["excludeTypes", "label", "size"], outputs: ["selectType"] }] });
|
|
13721
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: BlockEditorComponent, isStandalone: true, selector: "lib-block-editor", inputs: { block: { classPropertyName: "block", publicName: "block", isSignal: true, isRequired: false, transformFunction: null }, selectedFieldId: { classPropertyName: "selectedFieldId", publicName: "selectedFieldId", isSignal: true, isRequired: false, transformFunction: null }, selectedSubFieldCode: { classPropertyName: "selectedSubFieldCode", publicName: "selectedSubFieldCode", isSignal: true, isRequired: false, transformFunction: null }, selectedSubFieldParentCode: { classPropertyName: "selectedSubFieldParentCode", publicName: "selectedSubFieldParentCode", isSignal: true, isRequired: false, transformFunction: null }, visibilityParentFieldCodes: { classPropertyName: "visibilityParentFieldCodes", publicName: "visibilityParentFieldCodes", isSignal: false, isRequired: false, transformFunction: null }, fieldLookup: { classPropertyName: "fieldLookup", publicName: "fieldLookup", isSignal: false, isRequired: false, transformFunction: null }, showIdentifier: { classPropertyName: "showIdentifier", publicName: "showIdentifier", isSignal: true, isRequired: false, transformFunction: null }, connectedFieldListIds: { classPropertyName: "connectedFieldListIds", publicName: "connectedFieldListIds", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, availableFieldTypes: { classPropertyName: "availableFieldTypes", publicName: "availableFieldTypes", isSignal: true, isRequired: false, transformFunction: null }, canDelete: { classPropertyName: "canDelete", publicName: "canDelete", isSignal: true, isRequired: false, transformFunction: null }, fieldLimitReached: { classPropertyName: "fieldLimitReached", publicName: "fieldLimitReached", isSignal: true, isRequired: false, transformFunction: null }, maxFields: { classPropertyName: "maxFields", publicName: "maxFields", isSignal: true, isRequired: false, transformFunction: null }, maxRepeaterFields: { classPropertyName: "maxRepeaterFields", publicName: "maxRepeaterFields", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { blockChange: "blockChange", addFieldRequest: "addFieldRequest", deleteBlock: "deleteBlock", notifySelectedField: "notifySelectedField", notifySelectedSubField: "notifySelectedSubField", notifyNewSubField: "notifyNewSubField", itemRemoved: "itemRemoved", duplicateFieldRequest: "duplicateFieldRequest", moveFieldRequest: "moveFieldRequest" }, ngImport: i0, template: "<div class=\"form-block-card\" [class.collapsed]=\"collapsed()\">\n <div class=\"form-block-card-header\">\n @if (!readOnly()) {\n <i\n class=\"ri-draggable block-drag-handle\"\n cdkDragHandle\n [uiTooltip]=\"'form_builder.block.drag' | uicTranslate\"\n aria-hidden=\"true\"></i>\n }\n <div class=\"block-texts\">\n <input\n class=\"block-title-input\"\n [attr.aria-label]=\"'form_builder.block_title' | uicTranslate\"\n [placeholder]=\"'form_builder.block_title' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().title\"\n (ngModelChange)=\"changeTitle($event)\">\n @if (!collapsed() && (!readOnly() || block().subtitle || block().message)) {\n <input\n class=\"block-subtitle-input\"\n [attr.aria-label]=\"'form_builder.block_subtitle' | uicTranslate\"\n [placeholder]=\"'form_builder.block_subtitle' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().subtitle\"\n (ngModelChange)=\"changeSubtitle($event)\">\n <input\n class=\"block-message-input\"\n [attr.aria-label]=\"'form_builder.block_message' | uicTranslate\"\n [placeholder]=\"'form_builder.block_message' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().message\"\n (ngModelChange)=\"changeMessage($event)\">\n }\n </div>\n @if (collapsed()) {\n <span class=\"block-count\">{{'form_builder.block.field_count' | uicTranslate: { count: block().fields.length } }}</span>\n }\n <ui-button\n [uiTooltip]=\"(collapsed() ? 'form_builder.block.expand' : 'form_builder.block.collapse') | uicTranslate\"\n [attr.aria-expanded]=\"!collapsed()\"\n (click)=\"toggleCollapsed()\"\n size=\"s\"\n [icon]=\"collapsed() ? 'ri-arrow-down-s-line' : 'ri-arrow-up-s-line'\"\n color=\"black\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n @if (!readOnly() && canDelete()) {\n <ui-button\n [uiTooltip]=\"(isBlockVisibilityParent() ? 'form_builder.delete_block_dependency_blocked' : 'form_builder.delete_block') | uicTranslate\"\n [disabled]=\"isBlockVisibilityParent()\"\n (click)=\"requestDeleteBlock($event)\"\n size=\"s\"\n icon=\"ri-delete-bin-line\"\n color=\"red\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n </div>\n\n @if (!collapsed()) {\n <div\n class=\"form-block-card-body\"\n cdkDropList\n [id]=\"fieldListId()\"\n [cdkDropListData]=\"block().code\"\n [cdkDropListConnectedTo]=\"connectedFieldListIds()\"\n [cdkDropListDisabled]=\"readOnly()\"\n (cdkDropListDropped)=\"reorderFields($event)\">\n\n <!-- FIELDS -->\n @for(edtField of block().fields; track edtField.code; let i = $index) {\n <div class=\"field-with-subfields\">\n <div\n class=\"xfield-card\"\n cdkDrag\n [attr.data-field-code]=\"edtField.code\"\n [cdkDragDisabled]=\"readOnly()\"\n [class.selected-field]=\"isRepeaterParentSelected(edtField)\"\n (click)=\"selectField(edtField)\">\n @if (!readOnly()) {\n <i class=\"ri-draggable field-drag-handle\" cdkDragHandle></i>\n }\n\n <div class=\"xfield-card-icon\">\n <i [class]=\"edtField.field?.icon ?? ''\"></i>\n </div>\n <div class=\"xfield-card-body\">\n <b>\n <span class=\"field-label\">{{edtField.fieldData.label || edtField.fieldData.name}}</span>\n @if (edtField.fieldData.required) {\n <span class=\"required-mark\" [uiTooltip]=\"'form_builder.base.required' | uicTranslate\">*</span>\n }\n @if (edtField.fieldData.hidden) {\n <i class=\"hidden-field ri-eye-off-line\" [uiTooltip]=\"'form_builder.base.hidden' | uicTranslate\"></i>\n }\n </b>\n <p class=\"field-meta\">\n <span>{{(edtField.field?.label ?? edtField.type ?? edtField.fieldData.type) | uicTranslate}}</span>\n @if (showIdentifier()) {\n <code class=\"field-identifier\" [uiTooltip]=\"'form_builder.base.name' | uicTranslate\">{{edtField.fieldData.name}}</code>\n }\n </p>\n @let rootRule = visibilitySummary(edtField);\n @if (rootRule) {\n <p class=\"vs-rule\">\n <i class=\"branched-field ri-git-merge-line\" aria-hidden=\"true\"></i>\n <span>{{rootRule.text}}</span>\n @if (rootRule.extraRules > 0) {\n <span class=\"vs-rule-extra\">+{{rootRule.extraRules}}</span>\n }\n </p>\n }\n </div>\n <div class=\"xfield-card-actions\">\n @if (edtField.fieldData.type === 'repeater') {\n <ui-button\n [uiTooltip]=\"(isRepeaterExpanded(edtField.code) ? 'form_builder.repeater.hide_subfields' : 'form_builder.repeater.show_subfields') | uicTranslate\"\n [icon]=\"isRepeaterExpanded(edtField.code) ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'\"\n size=\"s\" color=\"black\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"toggleRepeater(edtField.code, $event)\">\n </ui-button>\n }\n @if (!readOnly()) {\n @if (isTypeAvailable(edtField.fieldData.type) && !fieldLimitReached()) {\n <ui-button\n [uiTooltip]=\"'form_builder.field_editor.duplicate' | uicTranslate\"\n (click)=\"requestDuplicateField(edtField.code, $event)\"\n size=\"s\"\n icon=\"ri-file-copy-2-line\"\n color=\"black\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n <ui-button\n [uiTooltip]=\"(isVisibilityParent(edtField.code) ? 'form_builder.delete_field_dependency_blocked' : 'form_builder.field_editor.delete') | uicTranslate\"\n [disabled]=\"isVisibilityParent(edtField.code)\"\n (click)=\"deleteField(edtField.code, $event)\"\n size=\"s\"\n icon=\"ri-delete-bin-line\"\n color=\"red\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n </div>\n </div>\n\n @if (edtField.fieldData.type === 'repeater' && isRepeaterExpanded(edtField.code)) {\n <div class=\"repeater-inline-panel\">\n <div\n class=\"repeater-subfields-list\"\n cdkDropList\n [cdkDropListData]=\"edtField.repeaterSubFields ?? []\"\n [cdkDropListDisabled]=\"readOnly()\"\n (cdkDropListDropped)=\"reorderSubFields(edtField.code, $event)\">\n @for (sf of edtField.repeaterSubFields ?? []; track sf.code) {\n <div\n class=\"xfield-card subfield-card\"\n cdkDrag\n [attr.data-subfield-code]=\"edtField.code + ':' + sf.code\"\n [class.selected-field]=\"selectedSubFieldCode() === sf.code && edtField.code === selectedSubFieldParentCode()\"\n [cdkDragDisabled]=\"readOnly()\"\n (click)=\"onSelectSubField(edtField.code, sf, $event)\">\n @if (!readOnly()) {\n <i class=\"ri-draggable field-drag-handle\" cdkDragHandle></i>\n }\n <div class=\"xfield-card-icon\">\n <i [class]=\"sf.field?.icon ?? 'ri-question-line'\"></i>\n </div>\n <div class=\"xfield-card-body\">\n <b>\n <span class=\"field-label\">{{ sf.fieldData.label || sf.fieldData.name }}</span>\n @if (sf.fieldData.required) {\n <span class=\"required-mark\" [uiTooltip]=\"'form_builder.base.required' | uicTranslate\">*</span>\n }\n @if (sf.fieldData.hidden) {\n <i class=\"hidden-field ri-eye-off-line\" [uiTooltip]=\"'form_builder.base.hidden' | uicTranslate\"></i>\n }\n </b>\n <p class=\"field-meta\">\n <span>{{ (sf.field?.label ?? sf.type ?? sf.fieldData.type) | uicTranslate }}</span>\n @if (showIdentifier()) {\n <code class=\"field-identifier\" [uiTooltip]=\"'form_builder.base.name' | uicTranslate\">{{sf.fieldData.name}}</code>\n }\n </p>\n @let subRule = visibilitySummary(sf, edtField.repeaterSubFields ?? []);\n @if (subRule) {\n <p class=\"vs-rule\">\n <i class=\"branched-field ri-git-merge-line\" aria-hidden=\"true\"></i>\n <span>{{subRule.text}}</span>\n @if (subRule.extraRules > 0) {\n <span class=\"vs-rule-extra\">+{{subRule.extraRules}}</span>\n }\n </p>\n }\n </div>\n @if (!readOnly()) {\n <div class=\"xfield-card-actions\">\n @if (isTypeAvailable(sf.fieldData.type) && !isRepeaterFull(edtField)) {\n <ui-button\n [uiTooltip]=\"'form_builder.field_editor.duplicate' | uicTranslate\"\n size=\"s\" icon=\"ri-file-copy-2-line\" color=\"black\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"duplicateSubField(edtField.code, sf.code, $event)\">\n </ui-button>\n }\n <ui-button\n [uiTooltip]=\"(isSubFieldVisibilityParent(edtField, sf.code) ? 'form_builder.delete_field_dependency_blocked' : 'form_builder.field_editor.delete') | uicTranslate\"\n [disabled]=\"isSubFieldVisibilityParent(edtField, sf.code)\"\n size=\"s\" icon=\"ri-delete-bin-line\" color=\"red\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"deleteSubField(edtField.code, sf.code, $event)\">\n </ui-button>\n </div>\n }\n </div>\n } @empty {\n <p class=\"empty-hint\">{{'form_builder.repeater.no_subfields' | uicTranslate}}</p>\n }\n </div>\n @if (!readOnly()) {\n <div class=\"new-subfield\">\n <lib-field-type-selector label=\"form_builder.repeater.add_subfield\" size=\"t\" [allowedTypes]=\"availableFieldTypes()\" [disabled]=\"isRepeaterFull(edtField)\" [disabledReason]=\"repeaterLimitMessage()\" [excludeTypes]=\"excludeSubFieldTypes\" (selectType)=\"addSubField(edtField.code, $event)\"></lib-field-type-selector>\n </div>\n }\n </div>\n }\n </div>\n\n } @empty {\n <div class=\"empty-block\">\n <i class=\"ri-layout-row-line\" aria-hidden=\"true\"></i>\n <p>{{(readOnly() ? 'form_builder.block.empty_read_only' : 'form_builder.no_fields_drop') | uicTranslate}}</p>\n </div>\n }\n\n </div>\n @if (!readOnly()) {\n <div class=\"new-field\">\n <lib-field-type-selector label=\"form_builder.add_new_field\" [allowedTypes]=\"availableFieldTypes()\" [disabled]=\"fieldLimitReached()\" [disabledReason]=\"fieldLimitMessage()\" (selectType)=\"addField($event)\"></lib-field-type-selector>\n </div>\n }\n }\n</div>\n", styles: [":host{display:block}.form-block-card{border:solid 1px var(--blue-500);border-radius:5px;overflow:hidden}.form-block-card-header{display:flex;gap:5px;align-items:flex-start;background-color:var(--uic-surface-raised, white);padding:10px 10px 10px 6px;border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300))}.form-block-card.collapsed .form-block-card-header{border-bottom:none;align-items:center}.form-block-card-body{padding:15px;display:flex;flex-direction:column;background-color:var(--uic-neutral-50, var(--grey-50));gap:10px;min-height:40px}:host(.cdk-drag-preview) .form-block-card{box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18))}.block-drag-handle{cursor:grab;padding:4px 2px;color:var(--uic-neutral-400, var(--grey-400))}.block-drag-handle:hover{color:var(--uic-neutral-600, var(--grey-600))}.block-drag-handle:active{cursor:grabbing}.block-texts{flex:1 1;min-width:0;display:flex;flex-direction:column;gap:2px}.block-texts input{width:100%;border:solid 1px transparent;background:transparent;padding:2px 6px;border-radius:5px;color:var(--uic-neutral-800, var(--grey-800))}.block-texts input:hover{border-color:var(--uic-neutral-200, var(--grey-200))}.block-texts input:focus{border-color:var(--primary-500);background-color:var(--uic-surface, white);outline:none}.block-texts input::placeholder{color:var(--uic-neutral-400, var(--grey-400))}.block-texts input[readonly]{cursor:default}.block-texts input[readonly]:hover,.block-texts input[readonly]:focus{border-color:transparent;background:transparent}.block-texts .block-title-input{font-size:16px;font-weight:600}.block-texts .block-subtitle-input{font-size:13px;color:var(--uic-neutral-600, var(--grey-600))}.block-texts .block-message-input{font-size:12px;font-style:italic;color:var(--uic-neutral-500, var(--grey-500))}.block-count{flex:0 0 auto;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));padding:0 6px}.xfield-card{background-color:var(--uic-surface-raised, white);border-radius:5px;padding:10px;gap:10px;display:flex;align-items:center;border:solid 2px var(--uic-neutral-200, var(--grey-200));cursor:pointer;transition:border-color .3s ease}.xfield-card:hover{border-color:var(--uic-neutral-300, var(--grey-300))}.xfield-card-icon{display:flex;justify-content:center;align-items:center;border-radius:5px;width:30px;height:30px;font-size:20px;background-color:var(--uic-neutral-300, var(--grey-300));color:var(--uic-neutral-600, var(--grey-600))}.xfield-card-body{flex:1 1;min-width:0;display:flex;flex-direction:column;gap:2px}.xfield-card-body b{display:flex;align-items:center;gap:5px;min-width:0}.xfield-card-body p{color:var(--uic-neutral-400, var(--grey-400));font-size:12px}.field-drag-handle{cursor:grab;color:var(--uic-neutral-400, var(--grey-400));transition:color .2s ease}.field-drag-handle:active{cursor:grabbing}.xfield-card:hover .field-drag-handle{color:var(--uic-neutral-600, var(--grey-600))}.cdk-drag-preview{box-sizing:border-box;border-radius:5px;box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18))}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.field-with-subfields{display:flex;flex-direction:column;gap:0}.repeater-inline-panel{background-color:var(--uic-neutral-100, var(--grey-100));border:solid 1px var(--blue-300);border-top:none;border-radius:0 0 5px 5px;padding:10px 10px 8px 28px;display:flex;flex-direction:column;gap:8px}.repeater-subfields-list{display:flex;flex-direction:column;gap:6px;min-height:6px}.subfield-card{font-size:13px;border-radius:4px;padding:7px 8px!important}.subfield-card .xfield-card-icon{width:26px!important;height:26px!important;font-size:16px!important}.subfield-card b{font-size:13px}.subfield-card p{font-size:11px}.new-subfield{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));flex-wrap:wrap;padding-top:2px}.empty-hint{font-size:12px;color:var(--uic-neutral-400, var(--grey-400));text-align:center;padding:4px 0;margin:0}.form-block-card-body.cdk-drop-list-dragging .xfield-card:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.branched-field{color:var(--yellow-700)}.hidden-field{color:var(--uic-neutral-500, var(--grey-500))}.selected-field,.selected-field:hover{border-color:var(--primary-500)}.new-field{border-top:solid 1px var(--uic-neutral-300, var(--grey-300));padding:10px;background-color:var(--uic-surface-raised, white);display:flex;align-items:center;gap:5px;font-size:14px}.field-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.required-mark{color:var(--red-500);font-weight:700;cursor:default}.field-meta{display:flex;align-items:center;gap:6px;min-width:0}.field-identifier{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;padding:0 5px;border-radius:3px;background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-600, var(--grey-600));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.xfield-card-body .vs-rule{display:flex;align-items:center;gap:4px;min-width:0;font-size:12px;color:var(--uic-neutral-600, var(--grey-600))}.xfield-card-body .vs-rule>span:not(.vs-rule-extra){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vs-rule-extra{flex:0 0 auto;font-size:11px;padding:0 5px;border-radius:8px;background-color:var(--yellow-100);color:var(--yellow-700)}.empty-block{display:flex;flex-direction:column;align-items:center;gap:6px;padding:18px 10px;border:dashed 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;font-size:13px;color:var(--uic-neutral-400, var(--grey-400))}.empty-block i{font-size:22px}\n"], dependencies: [{ kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "directive", type: UicToolTipDirective, selector: "[uiTooltip]", inputs: ["uiTooltip"] }, { kind: "pipe", type: UicTranslatePipe, name: "uicTranslate" }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "directive", type: i2.CdkDragHandle, selector: "[cdkDragHandle]", inputs: ["cdkDragHandleDisabled"] }, { kind: "ngmodule", type: FormsModule }, { 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.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: FieldTypeSelectorComponent, selector: "lib-field-type-selector", inputs: ["allowedTypes", "excludeTypes", "label", "size", "disabled", "disabledReason"], outputs: ["selectType"] }] });
|
|
13257
13722
|
}
|
|
13258
13723
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: BlockEditorComponent, decorators: [{
|
|
13259
13724
|
type: Component,
|
|
@@ -13264,7 +13729,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
13264
13729
|
DragDropModule,
|
|
13265
13730
|
FormsModule,
|
|
13266
13731
|
FieldTypeSelectorComponent
|
|
13267
|
-
], template: "<div class=\"form-block-card\" [class.collapsed]=\"collapsed()\">\n <div class=\"form-block-card-header\">\n @if (!readOnly()) {\n <i\n class=\"ri-draggable block-drag-handle\"\n cdkDragHandle\n [uiTooltip]=\"'form_builder.block.drag' | uicTranslate\"\n aria-hidden=\"true\"></i>\n }\n <div class=\"block-texts\">\n <input\n class=\"block-title-input\"\n [attr.aria-label]=\"'form_builder.block_title' | uicTranslate\"\n [placeholder]=\"'form_builder.block_title' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().title\"\n (ngModelChange)=\"changeTitle($event)\">\n @if (!collapsed() && (!readOnly() || block().subtitle || block().message)) {\n <input\n class=\"block-subtitle-input\"\n [attr.aria-label]=\"'form_builder.block_subtitle' | uicTranslate\"\n [placeholder]=\"'form_builder.block_subtitle' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().subtitle\"\n (ngModelChange)=\"changeSubtitle($event)\">\n <input\n class=\"block-message-input\"\n [attr.aria-label]=\"'form_builder.block_message' | uicTranslate\"\n [placeholder]=\"'form_builder.block_message' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().message\"\n (ngModelChange)=\"changeMessage($event)\">\n }\n </div>\n @if (collapsed()) {\n <span class=\"block-count\">{{'form_builder.block.field_count' | uicTranslate: { count: block().fields.length } }}</span>\n }\n <ui-button\n [uiTooltip]=\"(collapsed() ? 'form_builder.block.expand' : 'form_builder.block.collapse') | uicTranslate\"\n [attr.aria-expanded]=\"!collapsed()\"\n (click)=\"toggleCollapsed()\"\n size=\"s\"\n [icon]=\"collapsed() ? 'ri-arrow-down-s-line' : 'ri-arrow-up-s-line'\"\n color=\"black\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n @if (!readOnly()) {\n <ui-button\n [uiTooltip]=\"(isBlockVisibilityParent() ? 'form_builder.delete_block_dependency_blocked' : 'form_builder.delete_block') | uicTranslate\"\n [disabled]=\"isBlockVisibilityParent()\"\n (click)=\"requestDeleteBlock($event)\"\n size=\"s\"\n icon=\"ri-delete-bin-line\"\n color=\"red\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n </div>\n\n @if (!collapsed()) {\n <div\n class=\"form-block-card-body\"\n cdkDropList\n [id]=\"fieldListId()\"\n [cdkDropListData]=\"block().code\"\n [cdkDropListConnectedTo]=\"connectedFieldListIds()\"\n [cdkDropListDisabled]=\"readOnly()\"\n (cdkDropListDropped)=\"reorderFields($event)\">\n\n <!-- FIELDS -->\n @for(edtField of block().fields; track edtField.code; let i = $index) {\n <div class=\"field-with-subfields\">\n <div\n class=\"xfield-card\"\n cdkDrag\n [attr.data-field-code]=\"edtField.code\"\n [cdkDragDisabled]=\"readOnly()\"\n [class.selected-field]=\"isRepeaterParentSelected(edtField)\"\n (click)=\"selectField(edtField)\">\n @if (!readOnly()) {\n <i class=\"ri-draggable field-drag-handle\" cdkDragHandle></i>\n }\n\n <div class=\"xfield-card-icon\">\n <i [class]=\"edtField.field?.icon ?? ''\"></i>\n </div>\n <div class=\"xfield-card-body\">\n <b>\n <span class=\"field-label\">{{edtField.fieldData.label || edtField.fieldData.name}}</span>\n @if (edtField.fieldData.required) {\n <span class=\"required-mark\" [uiTooltip]=\"'form_builder.base.required' | uicTranslate\">*</span>\n }\n @if (edtField.fieldData.hidden) {\n <i class=\"hidden-field ri-eye-off-line\" [uiTooltip]=\"'form_builder.base.hidden' | uicTranslate\"></i>\n }\n </b>\n <p class=\"field-meta\">\n <span>{{(edtField.field?.label ?? edtField.type ?? edtField.fieldData.type) | uicTranslate}}</span>\n @if (showIdentifier()) {\n <code class=\"field-identifier\" [uiTooltip]=\"'form_builder.base.name' | uicTranslate\">{{edtField.fieldData.name}}</code>\n }\n </p>\n @let rootRule = visibilitySummary(edtField);\n @if (rootRule) {\n <p class=\"vs-rule\">\n <i class=\"branched-field ri-git-merge-line\" aria-hidden=\"true\"></i>\n <span>{{rootRule.text}}</span>\n @if (rootRule.extraRules > 0) {\n <span class=\"vs-rule-extra\">+{{rootRule.extraRules}}</span>\n }\n </p>\n }\n </div>\n <div class=\"xfield-card-actions\">\n @if (edtField.fieldData.type === 'repeater') {\n <ui-button\n [uiTooltip]=\"(isRepeaterExpanded(edtField.code) ? 'form_builder.repeater.hide_subfields' : 'form_builder.repeater.show_subfields') | uicTranslate\"\n [icon]=\"isRepeaterExpanded(edtField.code) ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'\"\n size=\"s\" color=\"black\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"toggleRepeater(edtField.code, $event)\">\n </ui-button>\n }\n @if (!readOnly()) {\n <ui-button\n [uiTooltip]=\"'form_builder.field_editor.duplicate' | uicTranslate\"\n (click)=\"requestDuplicateField(edtField.code, $event)\"\n size=\"s\"\n icon=\"ri-file-copy-2-line\"\n color=\"black\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n <ui-button\n [uiTooltip]=\"(isVisibilityParent(edtField.code) ? 'form_builder.delete_field_dependency_blocked' : 'form_builder.field_editor.delete') | uicTranslate\"\n [disabled]=\"isVisibilityParent(edtField.code)\"\n (click)=\"deleteField(edtField.code, $event)\"\n size=\"s\"\n icon=\"ri-delete-bin-line\"\n color=\"red\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n </div>\n </div>\n\n @if (edtField.fieldData.type === 'repeater' && isRepeaterExpanded(edtField.code)) {\n <div class=\"repeater-inline-panel\">\n <div\n class=\"repeater-subfields-list\"\n cdkDropList\n [cdkDropListData]=\"edtField.repeaterSubFields ?? []\"\n [cdkDropListDisabled]=\"readOnly()\"\n (cdkDropListDropped)=\"reorderSubFields(edtField.code, $event)\">\n @for (sf of edtField.repeaterSubFields ?? []; track sf.code) {\n <div\n class=\"xfield-card subfield-card\"\n cdkDrag\n [attr.data-subfield-code]=\"edtField.code + ':' + sf.code\"\n [class.selected-field]=\"selectedSubFieldCode() === sf.code && edtField.code === selectedSubFieldParentCode()\"\n [cdkDragDisabled]=\"readOnly()\"\n (click)=\"onSelectSubField(edtField.code, sf, $event)\">\n @if (!readOnly()) {\n <i class=\"ri-draggable field-drag-handle\" cdkDragHandle></i>\n }\n <div class=\"xfield-card-icon\">\n <i [class]=\"sf.field?.icon ?? 'ri-question-line'\"></i>\n </div>\n <div class=\"xfield-card-body\">\n <b>\n <span class=\"field-label\">{{ sf.fieldData.label || sf.fieldData.name }}</span>\n @if (sf.fieldData.required) {\n <span class=\"required-mark\" [uiTooltip]=\"'form_builder.base.required' | uicTranslate\">*</span>\n }\n @if (sf.fieldData.hidden) {\n <i class=\"hidden-field ri-eye-off-line\" [uiTooltip]=\"'form_builder.base.hidden' | uicTranslate\"></i>\n }\n </b>\n <p class=\"field-meta\">\n <span>{{ (sf.field?.label ?? sf.type ?? sf.fieldData.type) | uicTranslate }}</span>\n @if (showIdentifier()) {\n <code class=\"field-identifier\" [uiTooltip]=\"'form_builder.base.name' | uicTranslate\">{{sf.fieldData.name}}</code>\n }\n </p>\n @let subRule = visibilitySummary(sf, edtField.repeaterSubFields ?? []);\n @if (subRule) {\n <p class=\"vs-rule\">\n <i class=\"branched-field ri-git-merge-line\" aria-hidden=\"true\"></i>\n <span>{{subRule.text}}</span>\n @if (subRule.extraRules > 0) {\n <span class=\"vs-rule-extra\">+{{subRule.extraRules}}</span>\n }\n </p>\n }\n </div>\n @if (!readOnly()) {\n <div class=\"xfield-card-actions\">\n <ui-button\n [uiTooltip]=\"'form_builder.field_editor.duplicate' | uicTranslate\"\n size=\"s\" icon=\"ri-file-copy-2-line\" color=\"black\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"duplicateSubField(edtField.code, sf.code, $event)\">\n </ui-button>\n <ui-button\n [uiTooltip]=\"(isSubFieldVisibilityParent(edtField, sf.code) ? 'form_builder.delete_field_dependency_blocked' : 'form_builder.field_editor.delete') | uicTranslate\"\n [disabled]=\"isSubFieldVisibilityParent(edtField, sf.code)\"\n size=\"s\" icon=\"ri-delete-bin-line\" color=\"red\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"deleteSubField(edtField.code, sf.code, $event)\">\n </ui-button>\n </div>\n }\n </div>\n } @empty {\n <p class=\"empty-hint\">{{'form_builder.repeater.no_subfields' | uicTranslate}}</p>\n }\n </div>\n @if (!readOnly()) {\n <div class=\"new-subfield\">\n <lib-field-type-selector label=\"form_builder.repeater.add_subfield\" size=\"t\" [excludeTypes]=\"excludeSubFieldTypes\" (selectType)=\"addSubField(edtField.code, $event)\"></lib-field-type-selector>\n </div>\n }\n </div>\n }\n </div>\n\n } @empty {\n <div class=\"empty-block\">\n <i class=\"ri-layout-row-line\" aria-hidden=\"true\"></i>\n <p>{{(readOnly() ? 'form_builder.block.empty_read_only' : 'form_builder.no_fields_drop') | uicTranslate}}</p>\n </div>\n }\n\n </div>\n @if (!readOnly()) {\n <div class=\"new-field\">\n <lib-field-type-selector label=\"form_builder.add_new_field\" (selectType)=\"addField($event)\"></lib-field-type-selector>\n </div>\n }\n }\n</div>\n", styles: [":host{display:block}.form-block-card{border:solid 1px var(--blue-500);border-radius:5px;overflow:hidden}.form-block-card-header{display:flex;gap:5px;align-items:flex-start;background-color:var(--uic-surface-raised, white);padding:10px 10px 10px 6px;border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300))}.form-block-card.collapsed .form-block-card-header{border-bottom:none;align-items:center}.form-block-card-body{padding:15px;display:flex;flex-direction:column;background-color:var(--uic-neutral-50, var(--grey-50));gap:10px;min-height:40px}:host(.cdk-drag-preview) .form-block-card{box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18))}.block-drag-handle{cursor:grab;padding:4px 2px;color:var(--uic-neutral-400, var(--grey-400))}.block-drag-handle:hover{color:var(--uic-neutral-600, var(--grey-600))}.block-drag-handle:active{cursor:grabbing}.block-texts{flex:1 1;min-width:0;display:flex;flex-direction:column;gap:2px}.block-texts input{width:100%;border:solid 1px transparent;background:transparent;padding:2px 6px;border-radius:5px;color:var(--uic-neutral-800, var(--grey-800))}.block-texts input:hover{border-color:var(--uic-neutral-200, var(--grey-200))}.block-texts input:focus{border-color:var(--primary-500);background-color:var(--uic-surface, white);outline:none}.block-texts input::placeholder{color:var(--uic-neutral-400, var(--grey-400))}.block-texts input[readonly]{cursor:default}.block-texts input[readonly]:hover,.block-texts input[readonly]:focus{border-color:transparent;background:transparent}.block-texts .block-title-input{font-size:16px;font-weight:600}.block-texts .block-subtitle-input{font-size:13px;color:var(--uic-neutral-600, var(--grey-600))}.block-texts .block-message-input{font-size:12px;font-style:italic;color:var(--uic-neutral-500, var(--grey-500))}.block-count{flex:0 0 auto;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));padding:0 6px}.xfield-card{background-color:var(--uic-surface-raised, white);border-radius:5px;padding:10px;gap:10px;display:flex;align-items:center;border:solid 2px var(--uic-neutral-200, var(--grey-200));cursor:pointer;transition:border-color .3s ease}.xfield-card:hover{border-color:var(--uic-neutral-300, var(--grey-300))}.xfield-card-icon{display:flex;justify-content:center;align-items:center;border-radius:5px;width:30px;height:30px;font-size:20px;background-color:var(--uic-neutral-300, var(--grey-300));color:var(--uic-neutral-600, var(--grey-600))}.xfield-card-body{flex:1 1;min-width:0;display:flex;flex-direction:column;gap:2px}.xfield-card-body b{display:flex;align-items:center;gap:5px;min-width:0}.xfield-card-body p{color:var(--uic-neutral-400, var(--grey-400));font-size:12px}.field-drag-handle{cursor:grab;color:var(--uic-neutral-400, var(--grey-400));transition:color .2s ease}.field-drag-handle:active{cursor:grabbing}.xfield-card:hover .field-drag-handle{color:var(--uic-neutral-600, var(--grey-600))}.cdk-drag-preview{box-sizing:border-box;border-radius:5px;box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18))}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.field-with-subfields{display:flex;flex-direction:column;gap:0}.repeater-inline-panel{background-color:var(--uic-neutral-100, var(--grey-100));border:solid 1px var(--blue-300);border-top:none;border-radius:0 0 5px 5px;padding:10px 10px 8px 28px;display:flex;flex-direction:column;gap:8px}.repeater-subfields-list{display:flex;flex-direction:column;gap:6px;min-height:6px}.subfield-card{font-size:13px;border-radius:4px;padding:7px 8px!important}.subfield-card .xfield-card-icon{width:26px!important;height:26px!important;font-size:16px!important}.subfield-card b{font-size:13px}.subfield-card p{font-size:11px}.new-subfield{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));flex-wrap:wrap;padding-top:2px}.empty-hint{font-size:12px;color:var(--uic-neutral-400, var(--grey-400));text-align:center;padding:4px 0;margin:0}.form-block-card-body.cdk-drop-list-dragging .xfield-card:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.branched-field{color:var(--yellow-600)}.hidden-field{color:var(--uic-neutral-500, var(--grey-500))}.selected-field,.selected-field:hover{border-color:var(--primary-500)}.new-field{border-top:solid 1px var(--uic-neutral-300, var(--grey-300));padding:10px;background-color:var(--uic-surface-raised, white);display:flex;align-items:center;gap:5px;font-size:14px}.field-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.required-mark{color:var(--red-500);font-weight:700;cursor:default}.field-meta{display:flex;align-items:center;gap:6px;min-width:0}.field-identifier{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;padding:0 5px;border-radius:3px;background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-600, var(--grey-600));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.xfield-card-body .vs-rule{display:flex;align-items:center;gap:4px;min-width:0;font-size:12px;color:var(--uic-neutral-600, var(--grey-600))}.xfield-card-body .vs-rule>span:not(.vs-rule-extra){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vs-rule-extra{flex:0 0 auto;font-size:11px;padding:0 5px;border-radius:8px;background-color:var(--yellow-100);color:var(--yellow-600)}.empty-block{display:flex;flex-direction:column;align-items:center;gap:6px;padding:18px 10px;border:dashed 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;font-size:13px;color:var(--uic-neutral-400, var(--grey-400))}.empty-block i{font-size:22px}\n"] }]
|
|
13732
|
+
], template: "<div class=\"form-block-card\" [class.collapsed]=\"collapsed()\">\n <div class=\"form-block-card-header\">\n @if (!readOnly()) {\n <i\n class=\"ri-draggable block-drag-handle\"\n cdkDragHandle\n [uiTooltip]=\"'form_builder.block.drag' | uicTranslate\"\n aria-hidden=\"true\"></i>\n }\n <div class=\"block-texts\">\n <input\n class=\"block-title-input\"\n [attr.aria-label]=\"'form_builder.block_title' | uicTranslate\"\n [placeholder]=\"'form_builder.block_title' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().title\"\n (ngModelChange)=\"changeTitle($event)\">\n @if (!collapsed() && (!readOnly() || block().subtitle || block().message)) {\n <input\n class=\"block-subtitle-input\"\n [attr.aria-label]=\"'form_builder.block_subtitle' | uicTranslate\"\n [placeholder]=\"'form_builder.block_subtitle' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().subtitle\"\n (ngModelChange)=\"changeSubtitle($event)\">\n <input\n class=\"block-message-input\"\n [attr.aria-label]=\"'form_builder.block_message' | uicTranslate\"\n [placeholder]=\"'form_builder.block_message' | uicTranslate\"\n [readOnly]=\"readOnly()\"\n [ngModel]=\"block().message\"\n (ngModelChange)=\"changeMessage($event)\">\n }\n </div>\n @if (collapsed()) {\n <span class=\"block-count\">{{'form_builder.block.field_count' | uicTranslate: { count: block().fields.length } }}</span>\n }\n <ui-button\n [uiTooltip]=\"(collapsed() ? 'form_builder.block.expand' : 'form_builder.block.collapse') | uicTranslate\"\n [attr.aria-expanded]=\"!collapsed()\"\n (click)=\"toggleCollapsed()\"\n size=\"s\"\n [icon]=\"collapsed() ? 'ri-arrow-down-s-line' : 'ri-arrow-up-s-line'\"\n color=\"black\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n @if (!readOnly() && canDelete()) {\n <ui-button\n [uiTooltip]=\"(isBlockVisibilityParent() ? 'form_builder.delete_block_dependency_blocked' : 'form_builder.delete_block') | uicTranslate\"\n [disabled]=\"isBlockVisibilityParent()\"\n (click)=\"requestDeleteBlock($event)\"\n size=\"s\"\n icon=\"ri-delete-bin-line\"\n color=\"red\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n </div>\n\n @if (!collapsed()) {\n <div\n class=\"form-block-card-body\"\n cdkDropList\n [id]=\"fieldListId()\"\n [cdkDropListData]=\"block().code\"\n [cdkDropListConnectedTo]=\"connectedFieldListIds()\"\n [cdkDropListDisabled]=\"readOnly()\"\n (cdkDropListDropped)=\"reorderFields($event)\">\n\n <!-- FIELDS -->\n @for(edtField of block().fields; track edtField.code; let i = $index) {\n <div class=\"field-with-subfields\">\n <div\n class=\"xfield-card\"\n cdkDrag\n [attr.data-field-code]=\"edtField.code\"\n [cdkDragDisabled]=\"readOnly()\"\n [class.selected-field]=\"isRepeaterParentSelected(edtField)\"\n (click)=\"selectField(edtField)\">\n @if (!readOnly()) {\n <i class=\"ri-draggable field-drag-handle\" cdkDragHandle></i>\n }\n\n <div class=\"xfield-card-icon\">\n <i [class]=\"edtField.field?.icon ?? ''\"></i>\n </div>\n <div class=\"xfield-card-body\">\n <b>\n <span class=\"field-label\">{{edtField.fieldData.label || edtField.fieldData.name}}</span>\n @if (edtField.fieldData.required) {\n <span class=\"required-mark\" [uiTooltip]=\"'form_builder.base.required' | uicTranslate\">*</span>\n }\n @if (edtField.fieldData.hidden) {\n <i class=\"hidden-field ri-eye-off-line\" [uiTooltip]=\"'form_builder.base.hidden' | uicTranslate\"></i>\n }\n </b>\n <p class=\"field-meta\">\n <span>{{(edtField.field?.label ?? edtField.type ?? edtField.fieldData.type) | uicTranslate}}</span>\n @if (showIdentifier()) {\n <code class=\"field-identifier\" [uiTooltip]=\"'form_builder.base.name' | uicTranslate\">{{edtField.fieldData.name}}</code>\n }\n </p>\n @let rootRule = visibilitySummary(edtField);\n @if (rootRule) {\n <p class=\"vs-rule\">\n <i class=\"branched-field ri-git-merge-line\" aria-hidden=\"true\"></i>\n <span>{{rootRule.text}}</span>\n @if (rootRule.extraRules > 0) {\n <span class=\"vs-rule-extra\">+{{rootRule.extraRules}}</span>\n }\n </p>\n }\n </div>\n <div class=\"xfield-card-actions\">\n @if (edtField.fieldData.type === 'repeater') {\n <ui-button\n [uiTooltip]=\"(isRepeaterExpanded(edtField.code) ? 'form_builder.repeater.hide_subfields' : 'form_builder.repeater.show_subfields') | uicTranslate\"\n [icon]=\"isRepeaterExpanded(edtField.code) ? 'ri-arrow-up-s-line' : 'ri-arrow-down-s-line'\"\n size=\"s\" color=\"black\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"toggleRepeater(edtField.code, $event)\">\n </ui-button>\n }\n @if (!readOnly()) {\n @if (isTypeAvailable(edtField.fieldData.type) && !fieldLimitReached()) {\n <ui-button\n [uiTooltip]=\"'form_builder.field_editor.duplicate' | uicTranslate\"\n (click)=\"requestDuplicateField(edtField.code, $event)\"\n size=\"s\"\n icon=\"ri-file-copy-2-line\"\n color=\"black\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n <ui-button\n [uiTooltip]=\"(isVisibilityParent(edtField.code) ? 'form_builder.delete_field_dependency_blocked' : 'form_builder.field_editor.delete') | uicTranslate\"\n [disabled]=\"isVisibilityParent(edtField.code)\"\n (click)=\"deleteField(edtField.code, $event)\"\n size=\"s\"\n icon=\"ri-delete-bin-line\"\n color=\"red\"\n type=\"ghost\"\n [iconOnly]=\"true\">\n </ui-button>\n }\n </div>\n </div>\n\n @if (edtField.fieldData.type === 'repeater' && isRepeaterExpanded(edtField.code)) {\n <div class=\"repeater-inline-panel\">\n <div\n class=\"repeater-subfields-list\"\n cdkDropList\n [cdkDropListData]=\"edtField.repeaterSubFields ?? []\"\n [cdkDropListDisabled]=\"readOnly()\"\n (cdkDropListDropped)=\"reorderSubFields(edtField.code, $event)\">\n @for (sf of edtField.repeaterSubFields ?? []; track sf.code) {\n <div\n class=\"xfield-card subfield-card\"\n cdkDrag\n [attr.data-subfield-code]=\"edtField.code + ':' + sf.code\"\n [class.selected-field]=\"selectedSubFieldCode() === sf.code && edtField.code === selectedSubFieldParentCode()\"\n [cdkDragDisabled]=\"readOnly()\"\n (click)=\"onSelectSubField(edtField.code, sf, $event)\">\n @if (!readOnly()) {\n <i class=\"ri-draggable field-drag-handle\" cdkDragHandle></i>\n }\n <div class=\"xfield-card-icon\">\n <i [class]=\"sf.field?.icon ?? 'ri-question-line'\"></i>\n </div>\n <div class=\"xfield-card-body\">\n <b>\n <span class=\"field-label\">{{ sf.fieldData.label || sf.fieldData.name }}</span>\n @if (sf.fieldData.required) {\n <span class=\"required-mark\" [uiTooltip]=\"'form_builder.base.required' | uicTranslate\">*</span>\n }\n @if (sf.fieldData.hidden) {\n <i class=\"hidden-field ri-eye-off-line\" [uiTooltip]=\"'form_builder.base.hidden' | uicTranslate\"></i>\n }\n </b>\n <p class=\"field-meta\">\n <span>{{ (sf.field?.label ?? sf.type ?? sf.fieldData.type) | uicTranslate }}</span>\n @if (showIdentifier()) {\n <code class=\"field-identifier\" [uiTooltip]=\"'form_builder.base.name' | uicTranslate\">{{sf.fieldData.name}}</code>\n }\n </p>\n @let subRule = visibilitySummary(sf, edtField.repeaterSubFields ?? []);\n @if (subRule) {\n <p class=\"vs-rule\">\n <i class=\"branched-field ri-git-merge-line\" aria-hidden=\"true\"></i>\n <span>{{subRule.text}}</span>\n @if (subRule.extraRules > 0) {\n <span class=\"vs-rule-extra\">+{{subRule.extraRules}}</span>\n }\n </p>\n }\n </div>\n @if (!readOnly()) {\n <div class=\"xfield-card-actions\">\n @if (isTypeAvailable(sf.fieldData.type) && !isRepeaterFull(edtField)) {\n <ui-button\n [uiTooltip]=\"'form_builder.field_editor.duplicate' | uicTranslate\"\n size=\"s\" icon=\"ri-file-copy-2-line\" color=\"black\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"duplicateSubField(edtField.code, sf.code, $event)\">\n </ui-button>\n }\n <ui-button\n [uiTooltip]=\"(isSubFieldVisibilityParent(edtField, sf.code) ? 'form_builder.delete_field_dependency_blocked' : 'form_builder.field_editor.delete') | uicTranslate\"\n [disabled]=\"isSubFieldVisibilityParent(edtField, sf.code)\"\n size=\"s\" icon=\"ri-delete-bin-line\" color=\"red\" type=\"ghost\" [iconOnly]=\"true\"\n (click)=\"deleteSubField(edtField.code, sf.code, $event)\">\n </ui-button>\n </div>\n }\n </div>\n } @empty {\n <p class=\"empty-hint\">{{'form_builder.repeater.no_subfields' | uicTranslate}}</p>\n }\n </div>\n @if (!readOnly()) {\n <div class=\"new-subfield\">\n <lib-field-type-selector label=\"form_builder.repeater.add_subfield\" size=\"t\" [allowedTypes]=\"availableFieldTypes()\" [disabled]=\"isRepeaterFull(edtField)\" [disabledReason]=\"repeaterLimitMessage()\" [excludeTypes]=\"excludeSubFieldTypes\" (selectType)=\"addSubField(edtField.code, $event)\"></lib-field-type-selector>\n </div>\n }\n </div>\n }\n </div>\n\n } @empty {\n <div class=\"empty-block\">\n <i class=\"ri-layout-row-line\" aria-hidden=\"true\"></i>\n <p>{{(readOnly() ? 'form_builder.block.empty_read_only' : 'form_builder.no_fields_drop') | uicTranslate}}</p>\n </div>\n }\n\n </div>\n @if (!readOnly()) {\n <div class=\"new-field\">\n <lib-field-type-selector label=\"form_builder.add_new_field\" [allowedTypes]=\"availableFieldTypes()\" [disabled]=\"fieldLimitReached()\" [disabledReason]=\"fieldLimitMessage()\" (selectType)=\"addField($event)\"></lib-field-type-selector>\n </div>\n }\n }\n</div>\n", styles: [":host{display:block}.form-block-card{border:solid 1px var(--blue-500);border-radius:5px;overflow:hidden}.form-block-card-header{display:flex;gap:5px;align-items:flex-start;background-color:var(--uic-surface-raised, white);padding:10px 10px 10px 6px;border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300))}.form-block-card.collapsed .form-block-card-header{border-bottom:none;align-items:center}.form-block-card-body{padding:15px;display:flex;flex-direction:column;background-color:var(--uic-neutral-50, var(--grey-50));gap:10px;min-height:40px}:host(.cdk-drag-preview) .form-block-card{box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18))}.block-drag-handle{cursor:grab;padding:4px 2px;color:var(--uic-neutral-400, var(--grey-400))}.block-drag-handle:hover{color:var(--uic-neutral-600, var(--grey-600))}.block-drag-handle:active{cursor:grabbing}.block-texts{flex:1 1;min-width:0;display:flex;flex-direction:column;gap:2px}.block-texts input{width:100%;border:solid 1px transparent;background:transparent;padding:2px 6px;border-radius:5px;color:var(--uic-neutral-800, var(--grey-800))}.block-texts input:hover{border-color:var(--uic-neutral-200, var(--grey-200))}.block-texts input:focus{border-color:var(--primary-500);background-color:var(--uic-surface, white);outline:none}.block-texts input::placeholder{color:var(--uic-neutral-400, var(--grey-400))}.block-texts input[readonly]{cursor:default}.block-texts input[readonly]:hover,.block-texts input[readonly]:focus{border-color:transparent;background:transparent}.block-texts .block-title-input{font-size:16px;font-weight:600}.block-texts .block-subtitle-input{font-size:13px;color:var(--uic-neutral-600, var(--grey-600))}.block-texts .block-message-input{font-size:12px;font-style:italic;color:var(--uic-neutral-500, var(--grey-500))}.block-count{flex:0 0 auto;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));padding:0 6px}.xfield-card{background-color:var(--uic-surface-raised, white);border-radius:5px;padding:10px;gap:10px;display:flex;align-items:center;border:solid 2px var(--uic-neutral-200, var(--grey-200));cursor:pointer;transition:border-color .3s ease}.xfield-card:hover{border-color:var(--uic-neutral-300, var(--grey-300))}.xfield-card-icon{display:flex;justify-content:center;align-items:center;border-radius:5px;width:30px;height:30px;font-size:20px;background-color:var(--uic-neutral-300, var(--grey-300));color:var(--uic-neutral-600, var(--grey-600))}.xfield-card-body{flex:1 1;min-width:0;display:flex;flex-direction:column;gap:2px}.xfield-card-body b{display:flex;align-items:center;gap:5px;min-width:0}.xfield-card-body p{color:var(--uic-neutral-400, var(--grey-400));font-size:12px}.field-drag-handle{cursor:grab;color:var(--uic-neutral-400, var(--grey-400));transition:color .2s ease}.field-drag-handle:active{cursor:grabbing}.xfield-card:hover .field-drag-handle{color:var(--uic-neutral-600, var(--grey-600))}.cdk-drag-preview{box-sizing:border-box;border-radius:5px;box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18))}.cdk-drag-placeholder{opacity:0}.cdk-drag-animating{transition:transform .25s cubic-bezier(0,0,.2,1)}.field-with-subfields{display:flex;flex-direction:column;gap:0}.repeater-inline-panel{background-color:var(--uic-neutral-100, var(--grey-100));border:solid 1px var(--blue-300);border-top:none;border-radius:0 0 5px 5px;padding:10px 10px 8px 28px;display:flex;flex-direction:column;gap:8px}.repeater-subfields-list{display:flex;flex-direction:column;gap:6px;min-height:6px}.subfield-card{font-size:13px;border-radius:4px;padding:7px 8px!important}.subfield-card .xfield-card-icon{width:26px!important;height:26px!important;font-size:16px!important}.subfield-card b{font-size:13px}.subfield-card p{font-size:11px}.new-subfield{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));flex-wrap:wrap;padding-top:2px}.empty-hint{font-size:12px;color:var(--uic-neutral-400, var(--grey-400));text-align:center;padding:4px 0;margin:0}.form-block-card-body.cdk-drop-list-dragging .xfield-card:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}.branched-field{color:var(--yellow-700)}.hidden-field{color:var(--uic-neutral-500, var(--grey-500))}.selected-field,.selected-field:hover{border-color:var(--primary-500)}.new-field{border-top:solid 1px var(--uic-neutral-300, var(--grey-300));padding:10px;background-color:var(--uic-surface-raised, white);display:flex;align-items:center;gap:5px;font-size:14px}.field-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.required-mark{color:var(--red-500);font-weight:700;cursor:default}.field-meta{display:flex;align-items:center;gap:6px;min-width:0}.field-identifier{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:11px;padding:0 5px;border-radius:3px;background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-600, var(--grey-600));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.xfield-card-body .vs-rule{display:flex;align-items:center;gap:4px;min-width:0;font-size:12px;color:var(--uic-neutral-600, var(--grey-600))}.xfield-card-body .vs-rule>span:not(.vs-rule-extra){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.vs-rule-extra{flex:0 0 auto;font-size:11px;padding:0 5px;border-radius:8px;background-color:var(--yellow-100);color:var(--yellow-700)}.empty-block{display:flex;flex-direction:column;align-items:center;gap:6px;padding:18px 10px;border:dashed 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;font-size:13px;color:var(--uic-neutral-400, var(--grey-400))}.empty-block i{font-size:22px}\n"] }]
|
|
13268
13733
|
}], ctorParameters: () => [], propDecorators: { visibilityParentFieldCodes: [{
|
|
13269
13734
|
type: Input
|
|
13270
13735
|
}], fieldLookup: [{
|
|
@@ -13276,9 +13741,16 @@ const UNDO_TIMEOUT_MS = 6000;
|
|
|
13276
13741
|
* Opciones manuales de un campo del que se puede depender: el editor de reglas las usa para
|
|
13277
13742
|
* mostrar un selector de valor (y su texto) en vez de pedir el id a mano. Con origen externo no hay lista fija.
|
|
13278
13743
|
*/
|
|
13279
|
-
const dependencyValueOptions = (fieldData) =>
|
|
13280
|
-
|
|
13281
|
-
|
|
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
|
+
};
|
|
13282
13754
|
const DEFAULT_PROPERTIES_WIDTH = 320;
|
|
13283
13755
|
const clampPropertiesWidth = (width) => Math.min(Math.max(width, 250), 600);
|
|
13284
13756
|
class UicUserFormbuilderComponent {
|
|
@@ -13287,6 +13759,11 @@ class UicUserFormbuilderComponent {
|
|
|
13287
13759
|
tinyAlertService = inject(UicTinyAlertService);
|
|
13288
13760
|
translateService = inject(UicTranslateService);
|
|
13289
13761
|
disabled = false;
|
|
13762
|
+
/**
|
|
13763
|
+
* Configuración inicial (tipos disponibles, creación de bloques, fuentes externas).
|
|
13764
|
+
* Se combina con la global de `provideUicFormBuilderConfig` y se lee una sola vez en ngOnInit.
|
|
13765
|
+
*/
|
|
13766
|
+
config = null;
|
|
13290
13767
|
formTitle = 'Nuevo formulario';
|
|
13291
13768
|
optionSources = [];
|
|
13292
13769
|
computedSources = [];
|
|
@@ -13295,10 +13772,14 @@ class UicUserFormbuilderComponent {
|
|
|
13295
13772
|
computedFieldResolver;
|
|
13296
13773
|
externalValidatorResolver;
|
|
13297
13774
|
readOnly = input(true);
|
|
13775
|
+
/** @deprecated Usar `config.allowNameEdit`. Se usa solo si la config no lo define. */
|
|
13298
13776
|
enableNameModify = input(false);
|
|
13299
|
-
/**
|
|
13777
|
+
/**
|
|
13778
|
+
* Vista previa como formulario (por defecto) o como encuesta (ui-survey). `config.preview.mode` tiene prioridad;
|
|
13779
|
+
* esta entrada sirve cuando el modo debe cambiar en tiempo de ejecución (la config se lee una sola vez).
|
|
13780
|
+
*/
|
|
13300
13781
|
previewMode = input('form');
|
|
13301
|
-
/** Ajustes de la vista previa en modo encuesta
|
|
13782
|
+
/** Ajustes de la vista previa en modo encuesta. `config.preview.survey` tiene prioridad (ver previewMode). */
|
|
13302
13783
|
surveyPreviewOptions = input(null);
|
|
13303
13784
|
editableFormInput = input({ cols: 2, blocks: [] }, { alias: 'editableForm' });
|
|
13304
13785
|
submitFormRequest = output();
|
|
@@ -13413,12 +13894,39 @@ class UicUserFormbuilderComponent {
|
|
|
13413
13894
|
'externalValidation.key': this.validationSources
|
|
13414
13895
|
};
|
|
13415
13896
|
}, { equal: (a, b) => this.areSelectOptionsRecordsEqual(a, b) });
|
|
13897
|
+
// ---- Configuración inicial ----
|
|
13898
|
+
globalConfig = inject(UIC_FORM_BUILDER_CONFIG, { optional: true });
|
|
13899
|
+
/** Config efectiva. Arranca con la global y se completa con la entrada `config` en ngOnInit (una sola vez). */
|
|
13900
|
+
settings = signal(resolveFormBuilderConfig(this.globalConfig));
|
|
13901
|
+
/** Sin creación de bloques no se puede eliminar el último (no habría dónde agregar campos). */
|
|
13902
|
+
canDeleteBlocks = computed(() => this.settings().allowBlockCreation || this.editableBlocks().length > 1);
|
|
13903
|
+
/** Edición del identificador: la config manda; si no la define, se usa la entrada (obsoleta) enableNameModify. */
|
|
13904
|
+
nameEditable = computed(() => this.settings().allowNameEdit ?? this.enableNameModify());
|
|
13905
|
+
// ---- Máximos ----
|
|
13906
|
+
totalFields = computed(() => this.editableBlocks().reduce((sum, block) => sum + block.fields.length, 0));
|
|
13907
|
+
fieldLimitReached = computed(() => isLimitReached(this.totalFields(), this.settings().limits.maxFields));
|
|
13908
|
+
blockLimitReached = computed(() => isLimitReached(this.editableBlocks().length, this.settings().limits.maxBlocks));
|
|
13909
|
+
ngOnInit() {
|
|
13910
|
+
this.settings.set(resolveFormBuilderConfig(this.globalConfig, this.config));
|
|
13911
|
+
}
|
|
13416
13912
|
constructor() {
|
|
13417
13913
|
inject(DestroyRef).onDestroy(() => {
|
|
13418
13914
|
this.clearUndoTimer();
|
|
13419
13915
|
if (this.copiedTimer)
|
|
13420
13916
|
clearTimeout(this.copiedTimer);
|
|
13421
13917
|
});
|
|
13918
|
+
// Sin creación de bloques, un formulario vacío necesita uno para poder agregar campos.
|
|
13919
|
+
// Se crea al editar y no cuenta como cambio sin guardar.
|
|
13920
|
+
effect(() => {
|
|
13921
|
+
if (this.settings().allowBlockCreation || this.isReadOnly() || this.editableBlocks().length > 0)
|
|
13922
|
+
return;
|
|
13923
|
+
untracked(() => {
|
|
13924
|
+
const wasClean = !this.hasUnsavedChanges();
|
|
13925
|
+
this.addBlock();
|
|
13926
|
+
if (wasClean)
|
|
13927
|
+
this.markAsSaved();
|
|
13928
|
+
});
|
|
13929
|
+
});
|
|
13422
13930
|
effect(() => {
|
|
13423
13931
|
const readOnly = this.readOnly();
|
|
13424
13932
|
this.isReadOnly.set(readOnly);
|
|
@@ -13475,6 +13983,11 @@ class UicUserFormbuilderComponent {
|
|
|
13475
13983
|
});
|
|
13476
13984
|
}
|
|
13477
13985
|
addBlock() {
|
|
13986
|
+
// Con la creación deshabilitada solo se permite el bloque inicial de un formulario vacío.
|
|
13987
|
+
if (!this.settings().allowBlockCreation && this.editableBlocks().length > 0)
|
|
13988
|
+
return;
|
|
13989
|
+
if (this.blockLimitReached())
|
|
13990
|
+
return;
|
|
13478
13991
|
this.dismissUndo();
|
|
13479
13992
|
const newBlockId = this.nextBlockId++;
|
|
13480
13993
|
this.editableBlocks.update(blocks => [...blocks, {
|
|
@@ -13510,6 +14023,8 @@ class UicUserFormbuilderComponent {
|
|
|
13510
14023
|
this.registerRemoval({ kind: 'block', index, item: removedBlock });
|
|
13511
14024
|
}
|
|
13512
14025
|
addField(blockCode, newFieldType) {
|
|
14026
|
+
if (this.fieldLimitReached())
|
|
14027
|
+
return;
|
|
13513
14028
|
this.dismissUndo();
|
|
13514
14029
|
const fieldCode = `field_${this.nextFieldId++}`;
|
|
13515
14030
|
const updatedField = {
|
|
@@ -13786,7 +14301,7 @@ class UicUserFormbuilderComponent {
|
|
|
13786
14301
|
const blocks = this.editableBlocks();
|
|
13787
14302
|
const block = blocks.find(b => b.fields.some(f => f.code === fieldCode));
|
|
13788
14303
|
const index = block?.fields.findIndex(f => f.code === fieldCode) ?? -1;
|
|
13789
|
-
if (!block || index === -1)
|
|
14304
|
+
if (!block || index === -1 || this.fieldLimitReached())
|
|
13790
14305
|
return;
|
|
13791
14306
|
this.dismissUndo();
|
|
13792
14307
|
const source = block.fields[index];
|
|
@@ -13815,8 +14330,8 @@ class UicUserFormbuilderComponent {
|
|
|
13815
14330
|
}
|
|
13816
14331
|
printForm() {
|
|
13817
14332
|
const data = {
|
|
13818
|
-
previewMode: this.previewMode(),
|
|
13819
|
-
surveyOptions: this.surveyPreviewOptions(),
|
|
14333
|
+
previewMode: this.settings().preview.mode ?? this.previewMode(),
|
|
14334
|
+
surveyOptions: this.settings().preview.survey ?? this.surveyPreviewOptions(),
|
|
13820
14335
|
schema: helperShowFormFromBuilder(this.editableBlocks(), this.editableCols(), true, {
|
|
13821
14336
|
titleFontSize: this.editableTitleFontSize() ?? undefined,
|
|
13822
14337
|
subtitleFontSize: this.editableSubtitleFontSize() ?? undefined,
|
|
@@ -13860,6 +14375,11 @@ class UicUserFormbuilderComponent {
|
|
|
13860
14375
|
});
|
|
13861
14376
|
return;
|
|
13862
14377
|
}
|
|
14378
|
+
const exceeded = this.describeExceededLimits(parsedForm);
|
|
14379
|
+
if (exceeded) {
|
|
14380
|
+
this.tinyAlertService.warning(this.translateService.translate('form_builder.limits.import_exceeds', { detail: exceeded }), { title: 'form_builder.import.invalid_schema_title' });
|
|
14381
|
+
return;
|
|
14382
|
+
}
|
|
13863
14383
|
const hasExistingContent = this.editableBlocks().some(block => block.fields.length > 0);
|
|
13864
14384
|
if (hasExistingContent) {
|
|
13865
14385
|
const response = await this.tinyAlertService.warning('form_builder.import.confirm_overwrite', {
|
|
@@ -13872,6 +14392,20 @@ class UicUserFormbuilderComponent {
|
|
|
13872
14392
|
}
|
|
13873
14393
|
this.applyImportedForm(parsedForm);
|
|
13874
14394
|
}
|
|
14395
|
+
/** Texto con los máximos que supera un formulario importado, o null si los respeta. */
|
|
14396
|
+
describeExceededLimits(form) {
|
|
14397
|
+
const { maxBlocks, maxFields, maxRepeaterFields } = this.settings().limits;
|
|
14398
|
+
const t = (key, params) => this.translateService.translate(key, params);
|
|
14399
|
+
const blocks = form.blocks ?? [];
|
|
14400
|
+
const fieldCount = blocks.reduce((sum, block) => sum + block.fields.length, 0);
|
|
14401
|
+
const maxSubFields = Math.max(0, ...blocks.flatMap(block => block.fields.map(field => field.repeaterSubFields?.length ?? 0)));
|
|
14402
|
+
const issues = [
|
|
14403
|
+
maxBlocks !== null && blocks.length > maxBlocks ? t('form_builder.limits.detail_blocks', { count: blocks.length, max: maxBlocks }) : null,
|
|
14404
|
+
maxFields !== null && fieldCount > maxFields ? t('form_builder.limits.detail_fields', { count: fieldCount, max: maxFields }) : null,
|
|
14405
|
+
maxRepeaterFields !== null && maxSubFields > maxRepeaterFields ? t('form_builder.limits.detail_repeater_fields', { count: maxSubFields, max: maxRepeaterFields }) : null,
|
|
14406
|
+
].filter((issue) => !!issue);
|
|
14407
|
+
return issues.length ? issues.join('; ') : null;
|
|
14408
|
+
}
|
|
13875
14409
|
buildExportableForm() {
|
|
13876
14410
|
return {
|
|
13877
14411
|
cols: this.editableCols(),
|
|
@@ -13928,7 +14462,7 @@ class UicUserFormbuilderComponent {
|
|
|
13928
14462
|
typeof field.fieldData.name === 'string' && typeof field.fieldData.type === 'string'));
|
|
13929
14463
|
}
|
|
13930
14464
|
submitForm() {
|
|
13931
|
-
if (this.
|
|
14465
|
+
if (this.nameEditable()) {
|
|
13932
14466
|
const duplicatedFieldName = this.getDuplicatedFieldName();
|
|
13933
14467
|
if (duplicatedFieldName) {
|
|
13934
14468
|
this.tinyAlertService.warning(this.translateService.translate('form_builder.validation.duplicate_identifier', {
|
|
@@ -13946,7 +14480,7 @@ class UicUserFormbuilderComponent {
|
|
|
13946
14480
|
repeaterSubFields: field.repeaterSubFields
|
|
13947
14481
|
}))
|
|
13948
14482
|
}));
|
|
13949
|
-
if (!this.
|
|
14483
|
+
if (!this.nameEditable()) {
|
|
13950
14484
|
blocksWithOrderedFields = this.deduplicateFieldNames(blocksWithOrderedFields);
|
|
13951
14485
|
}
|
|
13952
14486
|
this.editableBlocks.set(blocksWithOrderedFields);
|
|
@@ -14259,7 +14793,7 @@ class UicUserFormbuilderComponent {
|
|
|
14259
14793
|
return value;
|
|
14260
14794
|
}
|
|
14261
14795
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicUserFormbuilderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14262
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: UicUserFormbuilderComponent, isStandalone: true, selector: "ui-user-formbuilder", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, formTitle: { classPropertyName: "formTitle", publicName: "formTitle", isSignal: false, isRequired: false, transformFunction: null }, optionSources: { classPropertyName: "optionSources", publicName: "optionSources", isSignal: false, isRequired: false, transformFunction: null }, computedSources: { classPropertyName: "computedSources", publicName: "computedSources", isSignal: false, isRequired: false, transformFunction: null }, validationSources: { classPropertyName: "validationSources", publicName: "validationSources", isSignal: false, isRequired: false, transformFunction: null }, selectOptionsResolver: { classPropertyName: "selectOptionsResolver", publicName: "selectOptionsResolver", isSignal: false, isRequired: false, transformFunction: null }, computedFieldResolver: { classPropertyName: "computedFieldResolver", publicName: "computedFieldResolver", isSignal: false, isRequired: false, transformFunction: null }, externalValidatorResolver: { classPropertyName: "externalValidatorResolver", publicName: "externalValidatorResolver", isSignal: false, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, enableNameModify: { classPropertyName: "enableNameModify", publicName: "enableNameModify", isSignal: true, isRequired: false, transformFunction: null }, previewMode: { classPropertyName: "previewMode", publicName: "previewMode", isSignal: true, isRequired: false, transformFunction: null }, surveyPreviewOptions: { classPropertyName: "surveyPreviewOptions", publicName: "surveyPreviewOptions", isSignal: true, isRequired: false, transformFunction: null }, editableFormInput: { classPropertyName: "editableFormInput", publicName: "editableForm", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitFormRequest: "submitFormRequest" }, host: { listeners: { "window:beforeunload": "onBeforeUnload($event)", "document:mousemove": "onPropertiesResize($event)", "document:mouseup": "stopPropertiesResize()" } }, ngImport: i0, template: "<div class=\"formeditor\" [class.focused]=\"!isReadOnly()\" [class.read-only]=\"isReadOnly()\">\n <input #importFileInput id=\"formbuilder-import-file\" type=\"file\" accept=\".json,application/json\" hidden\n [attr.aria-label]=\"'form_builder.menu.load_json' | uicTranslate\"\n (change)=\"importSchemaFromFile($event)\">\n\n <!-- HEADER: t\u00EDtulo + estado | acciones principales + men\u00FA contextual -->\n <div class=\"formeditor-header\">\n <div class=\"formeditor-heading\">\n <span class=\"formeditor-title\">{{formTitle}}</span>\n @if (isReadOnly()) {\n <span class=\"status-chip read-only-chip\">\n <i class=\"ri-lock-line\" aria-hidden=\"true\"></i>\n {{'form_builder.read_only' | uicTranslate}}\n </span>\n } @else if (hasUnsavedChanges()) {\n <span class=\"status-chip unsaved-chip\" role=\"status\">\n <span class=\"unsaved-dot\" aria-hidden=\"true\"></span>\n {{'form_builder.unsaved_changes' | uicTranslate}}\n </span>\n }\n </div>\n\n <div class=\"formeditor-actions\">\n <ui-button color=\"primary\" type=\"bordered\" icon=\"ri-eye-line\" [text]=\"'form_builder.preview_form' | uicTranslate\" (click)=\"printForm()\"></ui-button>\n @if (isReadOnly()) {\n @if (!disabled) {\n <ui-button color=\"black\" icon=\"ri-edit-line\" [text]=\"'form_builder.edit' | uicTranslate\" (click)=\"enableEditMode()\"></ui-button>\n }\n } @else {\n <ui-button color=\"black\" type=\"bordered\" [text]=\"'form_builder.discard_changes' | uicTranslate\" (click)=\"discardChanges()\"></ui-button>\n <!-- Sin cambios no hay nada que guardar; \"Descartar\" sigue disponible para salir de la edici\u00F3n.\n Si el builder arranca en edici\u00F3n (sin snapshot), Guardar queda siempre habilitado. -->\n @let nothingToSave = !!editingSnapshot() && !hasUnsavedChanges();\n <ui-button\n color=\"black\"\n icon=\"ri-check-line\"\n [disabled]=\"nothingToSave\"\n [uiTooltip]=\"nothingToSave ? ('form_builder.no_changes' | uicTranslate) : ''\"\n [text]=\"'form_builder.submit_form' | uicTranslate\"\n (click)=\"submitForm()\">\n </ui-button>\n }\n\n <ui-dropdown-container width=\"280px\" maxWidth=\"calc(100vw - 32px)\" [positions]=\"menuPositions\">\n <ui-button\n button\n color=\"black\"\n type=\"ghost\"\n icon=\"ri-more-2-fill\"\n [iconOnly]=\"true\"\n [uiTooltip]=\"'form_builder.menu.more' | uicTranslate\"\n [attr.aria-label]=\"'form_builder.menu.more' | uicTranslate\">\n </ui-button>\n\n <div content class=\"fb-menu\">\n <div class=\"fb-menu-actions\">\n <button type=\"button\" class=\"fb-menu-item\" (click)=\"copySchemaToClipboard()\">\n <i [class]=\"schemaCopied() ? 'ri-check-line copied' : 'ri-file-copy-line'\" aria-hidden=\"true\"></i>\n <span>{{(schemaCopied() ? 'form_builder.menu.copied' : 'form_builder.menu.copy_json') | uicTranslate}}</span>\n </button>\n @if (!isReadOnly()) {\n <button type=\"button\" class=\"fb-menu-item\" uiDropdownClose (click)=\"importFileInput.click()\">\n <i class=\"ri-upload-2-line\" aria-hidden=\"true\"></i>\n <span>{{'form_builder.menu.load_json' | uicTranslate}}</span>\n </button>\n }\n </div>\n\n <div class=\"fb-menu-section\">\n <div class=\"fb-menu-section-title\">{{'form_builder.menu.layout_title' | uicTranslate}}</div>\n\n <div class=\"fb-menu-row\">\n <span id=\"fb-cols-label\">{{'form_builder.menu.columns' | uicTranslate}}</span>\n <div class=\"fb-segmented\" role=\"radiogroup\" aria-labelledby=\"fb-cols-label\">\n @for (cols of columnOptions; track cols) {\n <button\n type=\"button\"\n role=\"radio\"\n [attr.aria-checked]=\"editableCols() === cols\"\n [class.active]=\"editableCols() === cols\"\n [disabled]=\"isReadOnly()\"\n (click)=\"editableCols.set(cols)\">{{cols}}</button>\n }\n </div>\n </div>\n\n <div class=\"fb-menu-grid\">\n <span></span>\n <span class=\"fb-menu-grid-head\">{{'form_builder.menu.size' | uicTranslate}}</span>\n <span class=\"fb-menu-grid-head\">{{'form_builder.menu.margin' | uicTranslate}}</span>\n\n <span>{{'form_builder.menu.title' | uicTranslate}}</span>\n <input type=\"number\" min=\"8\" max=\"72\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.title_font_size' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableTitleFontSize()\" (ngModelChange)=\"editableTitleFontSize.set($event || null)\">\n <input type=\"number\" min=\"0\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.title_margin' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableTitleMargin()\" (ngModelChange)=\"editableTitleMargin.set($event || null)\">\n\n <span>{{'form_builder.menu.subtitle' | uicTranslate}}</span>\n <input type=\"number\" min=\"8\" max=\"72\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.subtitle_font_size' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableSubtitleFontSize()\" (ngModelChange)=\"editableSubtitleFontSize.set($event || null)\">\n <input type=\"number\" min=\"0\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.subtitle_margin' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableSubtitleMargin()\" (ngModelChange)=\"editableSubtitleMargin.set($event || null)\">\n </div>\n <p class=\"fb-menu-hint\">{{'form_builder.menu.layout_hint' | uicTranslate}}</p>\n </div>\n </div>\n </ui-dropdown-container>\n </div>\n </div>\n\n <!-- BODY: el mismo editor en ambos modos; en solo lectura todo queda deshabilitado -->\n <div class=\"formeditor-body\">\n <!-- Clic en una zona vac\u00EDa del canvas (no en un bloque ni un campo) cierra las propiedades -->\n <div class=\"formeditor-overflow\" (click)=\"onCanvasBackgroundClick($event)\">\n <div class=\"formeditor-workarea\">\n <div\n class=\"formeditor-blocks\"\n cdkDropList\n cdkDropListLockAxis=\"y\"\n [cdkDropListDisabled]=\"isReadOnly()\"\n (cdkDropListDropped)=\"reorderBlocks($event)\">\n @for (block of editableBlocks(); track block.code; let i = $index) {\n <lib-block-editor\n cdkDrag\n cdkDragLockAxis=\"y\"\n [cdkDragDisabled]=\"isReadOnly()\"\n [readOnly]=\"isReadOnly()\"\n [block]=\"block\"\n [fieldLookup]=\"fieldLookup()\"\n [showIdentifier]=\"enableNameModify()\"\n [connectedFieldListIds]=\"fieldListIds()\"\n (itemRemoved)=\"registerRemoval($event)\"\n (duplicateFieldRequest)=\"duplicateField($event)\"\n (moveFieldRequest)=\"moveField($event)\"\n [selectedFieldId]=\"selectedField()?.code ?? null\"\n [selectedSubFieldCode]=\"editingSubField()?.subField?.code ?? null\"\n [selectedSubFieldParentCode]=\"editingSubField()?.parentCode ?? null\"\n [visibilityParentFieldCodes]=\"visibilityParentFieldCodes()\"\n (blockChange)=\"onBlockChange(i, $event)\"\n (addFieldRequest)=\"addField(block.code, $event)\"\n (notifySelectedField)=\"selectField($event)\"\n (notifySelectedSubField)=\"onSelectSubField($event)\"\n (notifyNewSubField)=\"onNewSubField($event)\"\n (deleteBlock)=\"deleteBlock($event)\">\n </lib-block-editor>\n } @empty {\n @if (isReadOnly()) {\n <div class=\"no-selected-field\">\n <i class=\"ri-file-list-3-line\" aria-hidden=\"true\"></i>\n <p>{{'form_builder.no_blocks' | uicTranslate}}</p>\n </div>\n }\n }\n </div>\n @if (!isReadOnly()) {\n <ui-button type=\"bordered\" icon=\"ri-add-line\" color=\"black\" [text]=\"'form_builder.add_block' | uicTranslate\" (click)=\"addBlock()\"></ui-button>\n }\n </div>\n </div>\n <!-- PROPERTIES: solo existe mientras hay un campo seleccionado; cerrarlo deselecciona -->\n @let editing = editingSubField()?.subField ?? selectedField();\n @if (editing) {\n <section\n class=\"formeditor-properties\"\n [attr.aria-label]=\"'form_builder.properties.title' | uicTranslate\"\n [style.width.px]=\"propertiesWidth()\"\n (keydown.escape)=\"onPropertiesEscape($event)\">\n <div\n class=\"formeditor-properties-resize\"\n [class.resizing]=\"isResizing()\"\n [attr.title]=\"'form_builder.properties.resize' | uicTranslate\"\n (mousedown)=\"startPropertiesResize($event)\"\n (dblclick)=\"resetPropertiesWidth()\">\n </div>\n <div class=\"properties-header\">\n <div class=\"properties-header-top\">\n @if (editingSubField(); as sub) {\n @let parent = fieldLookup().get(sub.parentCode);\n <button type=\"button\" class=\"properties-breadcrumb\" (click)=\"backToRepeater(sub.parentCode)\" [uiTooltip]=\"'form_builder.properties.back_to_repeater' | uicTranslate\">\n <i class=\"ri-arrow-left-s-line\" aria-hidden=\"true\"></i>\n <i class=\"ri-stack-line\" aria-hidden=\"true\"></i>\n <span>{{parent?.fieldData?.label || parent?.fieldData?.name}}</span>\n </button>\n } @else {\n <span class=\"properties-eyebrow\">{{'form_builder.properties.title' | uicTranslate}}</span>\n }\n <button\n type=\"button\"\n class=\"properties-close\"\n [uiTooltip]=\"'form_builder.properties.close' | uicTranslate\"\n [attr.aria-label]=\"'form_builder.properties.close' | uicTranslate\"\n (click)=\"closeProperties()\">\n <i class=\"ri-close-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"properties-title\">\n <span class=\"properties-title-icon\"><i [class]=\"editing.field?.icon ?? 'ri-question-line'\" aria-hidden=\"true\"></i></span>\n <div class=\"properties-title-text\">\n <b>{{editing.fieldData.label || editing.fieldData.name}}</b>\n <small>{{(editing.field?.label ?? editing.fieldData.type) | uicTranslate}}</small>\n </div>\n </div>\n </div>\n <div class=\"formeditor-properties-form\">\n @if (editingSubField()) {\n <lib-field-editor\n [config]=\"editingSubField()!.subField\"\n [isSubField]=\"true\"\n [readOnly]=\"isReadOnly()\"\n [focusRequiredField]=\"focusNewSubFieldCode() === editingSubField()?.subField?.code\"\n [enableNameModify]=\"enableNameModify()\"\n [options]=\"subFieldDependencyOptions()\"\n (fieldChange)=\"onSubFieldChange($event)\">\n </lib-field-editor>\n } @else if (selectedField()) {\n <lib-field-editor\n [config]=\"selectedField()!\"\n [readOnly]=\"isReadOnly()\"\n [focusRequiredField]=\"focusNewFieldCode() === selectedField()?.code\"\n [enableNameModify]=\"enableNameModify()\"\n [options]=\"dependencyOptions()\"\n (fieldChange)=\"onFieldChange($event)\">\n </lib-field-editor>\n }\n </div>\n </section>\n }\n </div>\n\n @if (pendingUndo(); as undo) {\n <div class=\"undo-bar\" role=\"status\" aria-live=\"polite\">\n <i class=\"ri-delete-bin-line\" aria-hidden=\"true\"></i>\n <span class=\"undo-bar-text\">{{undo.message}}</span>\n <button type=\"button\" class=\"undo-bar-action\" (click)=\"undoRemoval()\">{{'form_builder.undo.action' | uicTranslate}}</button>\n <button type=\"button\" class=\"undo-bar-close\" [attr.aria-label]=\"'common.close' | uicTranslate\" (click)=\"dismissUndo()\">\n <i class=\"ri-close-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n</div>\n", styles: [".formeditor{position:relative;display:flex;flex-direction:column;overflow:hidden;background-color:var(--uic-neutral-100, var(--grey-100));border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;max-height:500px}.formeditor-header{background-color:var(--uic-surface, white);border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300));display:flex;align-items:center;gap:10px;padding:6px 8px 6px 14px;min-height:48px}.formeditor-heading{flex:1 1;min-width:0;display:flex;align-items:center;gap:10px}.formeditor-title{font-size:15px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.formeditor-actions{flex:0 0 auto;display:flex;align-items:center;gap:6px}.formeditor-body{display:flex;gap:10px;overflow:hidden;padding:10px;min-height:0}.formeditor-overflow{padding:5px;flex:1 1;overflow:auto;min-width:0}.formeditor-workarea{display:flex;flex-direction:column;gap:15px;height:fit-content}.formeditor-properties{width:320px;flex:0 0 auto;display:flex;flex-direction:column;position:relative;background-color:var(--uic-surface, white);border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;min-height:0;min-width:250px;max-width:600px}.formeditor-properties-resize{position:absolute;top:0;bottom:0;left:-6px;width:10px;cursor:col-resize;z-index:1}.formeditor-properties-resize:after{content:\"\";position:absolute;top:8px;bottom:8px;left:4px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.formeditor-properties-resize:hover:after,.formeditor-properties-resize.resizing:after{background-color:var(--primary-400)}.formeditor-properties-form{padding:10px;overflow:auto;flex:1 1 auto;min-height:0}.focused{border:solid 1px var(--primary-400);border-radius:10px;box-shadow:var(--uic-focus-shadow, 0 0 0 3px var(--secondary-alpha))}.no-selected-field{width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px 0;font-size:13px;gap:15px;text-align:center;color:var(--uic-neutral-400, var(--grey-400))}.no-selected-field i{font-size:24px}.status-chip{flex:0 0 auto;display:inline-flex;align-items:center;gap:5px;padding:1px 8px;border-radius:10px;font-size:11px;white-space:nowrap}.unsaved-chip{background-color:var(--yellow-100);color:var(--yellow-600)}.read-only-chip{background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-500, var(--grey-500))}.fb-menu{display:flex;flex-direction:column;font-size:13px}.fb-menu-actions{display:flex;flex-direction:column;padding:4px}.fb-menu-item{display:flex;align-items:center;gap:10px;width:100%;padding:7px 10px;border:none;border-radius:5px;background:none;color:inherit;text-align:left;cursor:pointer}.fb-menu-item i{font-size:16px;color:var(--uic-neutral-500, var(--grey-500))}.fb-menu-item i.copied{color:var(--green-600, #16a34a)}.fb-menu-item:hover,.fb-menu-item:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));outline:none}.fb-menu-section{border-top:solid 1px var(--uic-neutral-200, var(--grey-200));padding:10px 14px 12px;display:flex;flex-direction:column;gap:10px}.fb-menu-section-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400))}.fb-menu-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.fb-segmented{display:inline-flex;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:6px;overflow:hidden}.fb-segmented button{width:32px;height:26px;border:none;border-left:solid 1px var(--uic-neutral-300, var(--grey-300));background:var(--uic-surface, white);color:inherit;font-size:12px;cursor:pointer}.fb-segmented button:first-child{border-left:none}.fb-segmented button:hover:not(:disabled){background-color:var(--uic-neutral-100, var(--grey-100))}.fb-segmented button.active{background-color:var(--uic-neutral-800, var(--grey-800));color:var(--uic-neutral-50, var(--grey-50));font-weight:600}.fb-segmented button:disabled{cursor:default}.fb-segmented button:focus-visible{outline:solid 2px var(--primary-400);outline-offset:-2px}.fb-menu-grid{display:grid;grid-template-columns:1fr 64px 64px;align-items:center;gap:6px 8px}.fb-menu-grid-head{font-size:11px;color:var(--uic-neutral-500, var(--grey-500));text-align:center}.fb-menu-grid input{width:100%;height:26px;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;padding:0 6px;font-size:12px;text-align:center;background:var(--uic-surface, white);color:var(--uic-neutral-800, var(--grey-800))}.fb-menu-grid input:focus{outline:none;border-color:var(--primary-400)}.fb-menu-grid input:disabled{background:var(--uic-neutral-50, var(--grey-50));color:var(--uic-neutral-500, var(--grey-500))}.fb-menu-hint{font-size:11px;color:var(--uic-neutral-400, var(--grey-400))}.unsaved-dot{width:6px;height:6px;border-radius:50%;background-color:currentColor}.undo-bar{position:absolute;left:50%;bottom:14px;transform:translate(-50%);z-index:5;display:flex;align-items:center;gap:10px;max-width:calc(100% - 32px);padding:8px 8px 8px 14px;border-radius:6px;font-size:13px;background-color:var(--uic-neutral-800, var(--grey-800));color:var(--uic-neutral-50, var(--grey-50));box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18));animation:undo-bar-in .16s ease-out}.undo-bar-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.undo-bar-action,.undo-bar-close{flex:0 0 auto;border:none;background:none;color:inherit;cursor:pointer;border-radius:4px;padding:4px 8px}.undo-bar-action:hover,.undo-bar-action:focus-visible,.undo-bar-close:hover,.undo-bar-close:focus-visible{background-color:#ffffff1f;outline:none}.undo-bar-action{font-weight:600;color:var(--primary-200, #a9c7ff)}.undo-bar-close{padding:4px;display:flex}@keyframes undo-bar-in{0%{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%)}}@media (prefers-reduced-motion: reduce){.undo-bar{animation:none}}.formeditor-blocks{display:flex;flex-direction:column;gap:15px}.formeditor-blocks.cdk-drop-list-dragging>lib-block-editor:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}lib-block-editor.cdk-drag-placeholder{opacity:.35}.properties-header{display:flex;flex-direction:column;gap:6px;padding:10px;border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300));min-width:0}.formeditor-properties{animation:properties-in .16s ease-out}@keyframes properties-in{0%{opacity:0;transform:translate(12px)}to{opacity:1;transform:translate(0)}}@media (prefers-reduced-motion: reduce){.formeditor-properties{animation:none}}.properties-header-top{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:0}.properties-eyebrow{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400))}.properties-close{flex:0 0 auto;margin-left:auto;width:26px;height:26px;display:flex;align-items:center;justify-content:center;border:none;border-radius:5px;background:none;color:var(--uic-neutral-500, var(--grey-500));font-size:16px;cursor:pointer}.properties-close:hover,.properties-close:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-800, var(--grey-800));outline:none}.properties-breadcrumb{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;max-width:100%;border:none;background:none;padding:2px 4px 2px 0;border-radius:4px;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));cursor:pointer}.properties-breadcrumb span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.properties-breadcrumb:hover,.properties-breadcrumb:focus-visible{color:var(--primary-600);outline:none}.properties-title{display:flex;align-items:center;gap:8px;min-width:0}.properties-title-icon{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:5px;font-size:18px;background-color:var(--primary-100);color:var(--primary-600)}.properties-title-text{display:flex;flex-direction:column;min-width:0}.properties-title-text b{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.properties-title-text small{font-size:11px;color:var(--uic-neutral-500, var(--grey-500))}\n"], dependencies: [{ kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "pipe", type: UicTranslatePipe, name: "uicTranslate" }, { kind: "component", type: FieldEditorComponent, selector: "lib-field-editor", inputs: ["config", "focusRequiredField", "isSubField", "enableNameModify", "readOnly", "options"], outputs: ["fieldChange"] }, { kind: "ngmodule", type: FormsModule }, { 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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1$1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: BlockEditorComponent, selector: "lib-block-editor", inputs: ["block", "selectedFieldId", "selectedSubFieldCode", "selectedSubFieldParentCode", "visibilityParentFieldCodes", "fieldLookup", "showIdentifier", "connectedFieldListIds", "readOnly"], outputs: ["blockChange", "addFieldRequest", "deleteBlock", "notifySelectedField", "notifySelectedSubField", "notifyNewSubField", "itemRemoved", "duplicateFieldRequest", "moveFieldRequest"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: UicDropdownContainerComponent, selector: "ui-dropdown-container", inputs: ["buttonLabel", "disabled", "positions", "matchTriggerWidth", "width", "minWidth", "maxWidth", "backdropClass", "hasBackdrop", "closeOnBackdropClick", "closeOnEscape", "closeOnContentClick", "offsetX", "offsetY", "push", "flexibleDimensions"], outputs: ["closed"] }, { kind: "directive", type: UiDropdownCloseDirective, selector: "[uiDropdownClose]" }, { kind: "directive", type: UicToolTipDirective, selector: "[uiTooltip]", inputs: ["uiTooltip"] }] });
|
|
14796
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.14", type: UicUserFormbuilderComponent, isStandalone: true, selector: "ui-user-formbuilder", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: null }, config: { classPropertyName: "config", publicName: "config", isSignal: false, isRequired: false, transformFunction: null }, formTitle: { classPropertyName: "formTitle", publicName: "formTitle", isSignal: false, isRequired: false, transformFunction: null }, optionSources: { classPropertyName: "optionSources", publicName: "optionSources", isSignal: false, isRequired: false, transformFunction: null }, computedSources: { classPropertyName: "computedSources", publicName: "computedSources", isSignal: false, isRequired: false, transformFunction: null }, validationSources: { classPropertyName: "validationSources", publicName: "validationSources", isSignal: false, isRequired: false, transformFunction: null }, selectOptionsResolver: { classPropertyName: "selectOptionsResolver", publicName: "selectOptionsResolver", isSignal: false, isRequired: false, transformFunction: null }, computedFieldResolver: { classPropertyName: "computedFieldResolver", publicName: "computedFieldResolver", isSignal: false, isRequired: false, transformFunction: null }, externalValidatorResolver: { classPropertyName: "externalValidatorResolver", publicName: "externalValidatorResolver", isSignal: false, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, enableNameModify: { classPropertyName: "enableNameModify", publicName: "enableNameModify", isSignal: true, isRequired: false, transformFunction: null }, previewMode: { classPropertyName: "previewMode", publicName: "previewMode", isSignal: true, isRequired: false, transformFunction: null }, surveyPreviewOptions: { classPropertyName: "surveyPreviewOptions", publicName: "surveyPreviewOptions", isSignal: true, isRequired: false, transformFunction: null }, editableFormInput: { classPropertyName: "editableFormInput", publicName: "editableForm", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitFormRequest: "submitFormRequest" }, host: { listeners: { "window:beforeunload": "onBeforeUnload($event)", "document:mousemove": "onPropertiesResize($event)", "document:mouseup": "stopPropertiesResize()" } }, ngImport: i0, template: "<div class=\"formeditor\" [class.focused]=\"!isReadOnly()\" [class.read-only]=\"isReadOnly()\">\n <input #importFileInput id=\"formbuilder-import-file\" type=\"file\" accept=\".json,application/json\" hidden\n [attr.aria-label]=\"'form_builder.menu.load_json' | uicTranslate\"\n (change)=\"importSchemaFromFile($event)\">\n\n <!-- HEADER: t\u00EDtulo + estado | acciones principales + men\u00FA contextual -->\n <div class=\"formeditor-header\">\n <div class=\"formeditor-heading\">\n <span class=\"formeditor-title\">{{formTitle}}</span>\n @if (isReadOnly()) {\n <span class=\"status-chip read-only-chip\">\n <i class=\"ri-lock-line\" aria-hidden=\"true\"></i>\n {{'form_builder.read_only' | uicTranslate}}\n </span>\n } @else if (hasUnsavedChanges()) {\n <span class=\"status-chip unsaved-chip\" role=\"status\">\n <span class=\"unsaved-dot\" aria-hidden=\"true\"></span>\n {{'form_builder.unsaved_changes' | uicTranslate}}\n </span>\n }\n </div>\n\n <div class=\"formeditor-actions\">\n <ui-button color=\"primary\" type=\"bordered\" icon=\"ri-eye-line\" [text]=\"'form_builder.preview_form' | uicTranslate\" (click)=\"printForm()\"></ui-button>\n @if (isReadOnly()) {\n @if (!disabled) {\n <ui-button color=\"black\" icon=\"ri-edit-line\" [text]=\"'form_builder.edit' | uicTranslate\" (click)=\"enableEditMode()\"></ui-button>\n }\n } @else {\n <ui-button color=\"black\" type=\"bordered\" [text]=\"'form_builder.discard_changes' | uicTranslate\" (click)=\"discardChanges()\"></ui-button>\n <!-- Sin cambios no hay nada que guardar; \"Descartar\" sigue disponible para salir de la edici\u00F3n.\n Si el builder arranca en edici\u00F3n (sin snapshot), Guardar queda siempre habilitado. -->\n @let nothingToSave = !!editingSnapshot() && !hasUnsavedChanges();\n <ui-button\n color=\"black\"\n icon=\"ri-check-line\"\n [disabled]=\"nothingToSave\"\n [uiTooltip]=\"nothingToSave ? ('form_builder.no_changes' | uicTranslate) : ''\"\n [text]=\"'form_builder.submit_form' | uicTranslate\"\n (click)=\"submitForm()\">\n </ui-button>\n }\n\n <ui-dropdown-container width=\"280px\" maxWidth=\"calc(100vw - 32px)\" [positions]=\"menuPositions\">\n <ui-button\n button\n color=\"black\"\n type=\"ghost\"\n icon=\"ri-more-2-fill\"\n [iconOnly]=\"true\"\n [uiTooltip]=\"'form_builder.menu.more' | uicTranslate\"\n [attr.aria-label]=\"'form_builder.menu.more' | uicTranslate\">\n </ui-button>\n\n <div content class=\"fb-menu\">\n <div class=\"fb-menu-actions\">\n <button type=\"button\" class=\"fb-menu-item\" (click)=\"copySchemaToClipboard()\">\n <i [class]=\"schemaCopied() ? 'ri-check-line copied' : 'ri-file-copy-line'\" aria-hidden=\"true\"></i>\n <span>{{(schemaCopied() ? 'form_builder.menu.copied' : 'form_builder.menu.copy_json') | uicTranslate}}</span>\n </button>\n @if (!isReadOnly()) {\n <button type=\"button\" class=\"fb-menu-item\" uiDropdownClose (click)=\"importFileInput.click()\">\n <i class=\"ri-upload-2-line\" aria-hidden=\"true\"></i>\n <span>{{'form_builder.menu.load_json' | uicTranslate}}</span>\n </button>\n }\n </div>\n\n <div class=\"fb-menu-section\">\n <div class=\"fb-menu-section-title\">{{'form_builder.menu.layout_title' | uicTranslate}}</div>\n\n <div class=\"fb-menu-row\">\n <span id=\"fb-cols-label\">{{'form_builder.menu.columns' | uicTranslate}}</span>\n <div class=\"fb-segmented\" role=\"radiogroup\" aria-labelledby=\"fb-cols-label\">\n @for (cols of columnOptions; track cols) {\n <button\n type=\"button\"\n role=\"radio\"\n [attr.aria-checked]=\"editableCols() === cols\"\n [class.active]=\"editableCols() === cols\"\n [disabled]=\"isReadOnly()\"\n (click)=\"editableCols.set(cols)\">{{cols}}</button>\n }\n </div>\n </div>\n\n <div class=\"fb-menu-grid\">\n <span></span>\n <span class=\"fb-menu-grid-head\">{{'form_builder.menu.size' | uicTranslate}}</span>\n <span class=\"fb-menu-grid-head\">{{'form_builder.menu.margin' | uicTranslate}}</span>\n\n <span>{{'form_builder.menu.title' | uicTranslate}}</span>\n <input type=\"number\" min=\"8\" max=\"72\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.title_font_size' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableTitleFontSize()\" (ngModelChange)=\"editableTitleFontSize.set($event || null)\">\n <input type=\"number\" min=\"0\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.title_margin' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableTitleMargin()\" (ngModelChange)=\"editableTitleMargin.set($event || null)\">\n\n <span>{{'form_builder.menu.subtitle' | uicTranslate}}</span>\n <input type=\"number\" min=\"8\" max=\"72\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.subtitle_font_size' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableSubtitleFontSize()\" (ngModelChange)=\"editableSubtitleFontSize.set($event || null)\">\n <input type=\"number\" min=\"0\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.subtitle_margin' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableSubtitleMargin()\" (ngModelChange)=\"editableSubtitleMargin.set($event || null)\">\n </div>\n <p class=\"fb-menu-hint\">{{'form_builder.menu.layout_hint' | uicTranslate}}</p>\n </div>\n </div>\n </ui-dropdown-container>\n </div>\n </div>\n\n <!-- BODY: el mismo editor en ambos modos; en solo lectura todo queda deshabilitado -->\n <div class=\"formeditor-body\">\n <!-- Clic en una zona vac\u00EDa del canvas (no en un bloque ni un campo) cierra las propiedades -->\n <div class=\"formeditor-overflow\" (click)=\"onCanvasBackgroundClick($event)\">\n <div class=\"formeditor-workarea\">\n <div\n class=\"formeditor-blocks\"\n cdkDropList\n cdkDropListLockAxis=\"y\"\n [cdkDropListDisabled]=\"isReadOnly()\"\n (cdkDropListDropped)=\"reorderBlocks($event)\">\n @for (block of editableBlocks(); track block.code; let i = $index) {\n <lib-block-editor\n cdkDrag\n cdkDragLockAxis=\"y\"\n [cdkDragDisabled]=\"isReadOnly()\"\n [readOnly]=\"isReadOnly()\"\n [availableFieldTypes]=\"settings().fieldTypes\"\n [canDelete]=\"canDeleteBlocks()\"\n [fieldLimitReached]=\"fieldLimitReached()\"\n [maxFields]=\"settings().limits.maxFields\"\n [maxRepeaterFields]=\"settings().limits.maxRepeaterFields\"\n [block]=\"block\"\n [fieldLookup]=\"fieldLookup()\"\n [showIdentifier]=\"nameEditable()\"\n [connectedFieldListIds]=\"fieldListIds()\"\n (itemRemoved)=\"registerRemoval($event)\"\n (duplicateFieldRequest)=\"duplicateField($event)\"\n (moveFieldRequest)=\"moveField($event)\"\n [selectedFieldId]=\"selectedField()?.code ?? null\"\n [selectedSubFieldCode]=\"editingSubField()?.subField?.code ?? null\"\n [selectedSubFieldParentCode]=\"editingSubField()?.parentCode ?? null\"\n [visibilityParentFieldCodes]=\"visibilityParentFieldCodes()\"\n (blockChange)=\"onBlockChange(i, $event)\"\n (addFieldRequest)=\"addField(block.code, $event)\"\n (notifySelectedField)=\"selectField($event)\"\n (notifySelectedSubField)=\"onSelectSubField($event)\"\n (notifyNewSubField)=\"onNewSubField($event)\"\n (deleteBlock)=\"deleteBlock($event)\">\n </lib-block-editor>\n } @empty {\n @if (isReadOnly()) {\n <div class=\"no-selected-field\">\n <i class=\"ri-file-list-3-line\" aria-hidden=\"true\"></i>\n <p>{{'form_builder.no_blocks' | uicTranslate}}</p>\n </div>\n }\n }\n </div>\n @if (!isReadOnly() && settings().allowBlockCreation) {\n @let blockLimit = blockLimitReached();\n <!-- El tooltip va en un contenedor: un bot\u00F3n deshabilitado no recibe eventos del mouse -->\n <span class=\"limit-wrapper\" [uiTooltip]=\"blockLimit ? ('form_builder.limits.blocks_reached' | uicTranslate: { max: settings().limits.maxBlocks }) : ''\">\n <ui-button type=\"bordered\" icon=\"ri-add-line\" color=\"black\" [disabled]=\"blockLimit\" [text]=\"'form_builder.add_block' | uicTranslate\" (click)=\"addBlock()\"></ui-button>\n </span>\n }\n </div>\n </div>\n <!-- PROPERTIES: solo existe mientras hay un campo seleccionado; cerrarlo deselecciona -->\n @let editing = editingSubField()?.subField ?? selectedField();\n @if (editing) {\n <section\n class=\"formeditor-properties\"\n [attr.aria-label]=\"'form_builder.properties.title' | uicTranslate\"\n [style.width.px]=\"propertiesWidth()\"\n (keydown.escape)=\"onPropertiesEscape($event)\">\n <div\n class=\"formeditor-properties-resize\"\n [class.resizing]=\"isResizing()\"\n [attr.title]=\"'form_builder.properties.resize' | uicTranslate\"\n (mousedown)=\"startPropertiesResize($event)\"\n (dblclick)=\"resetPropertiesWidth()\">\n </div>\n <div class=\"properties-header\">\n <div class=\"properties-header-top\">\n @if (editingSubField(); as sub) {\n @let parent = fieldLookup().get(sub.parentCode);\n <button type=\"button\" class=\"properties-breadcrumb\" (click)=\"backToRepeater(sub.parentCode)\" [uiTooltip]=\"'form_builder.properties.back_to_repeater' | uicTranslate\">\n <i class=\"ri-arrow-left-s-line\" aria-hidden=\"true\"></i>\n <i class=\"ri-stack-line\" aria-hidden=\"true\"></i>\n <span>{{parent?.fieldData?.label || parent?.fieldData?.name}}</span>\n </button>\n } @else {\n <span class=\"properties-eyebrow\">{{'form_builder.properties.title' | uicTranslate}}</span>\n }\n <button\n type=\"button\"\n class=\"properties-close\"\n [uiTooltip]=\"'form_builder.properties.close' | uicTranslate\"\n [attr.aria-label]=\"'form_builder.properties.close' | uicTranslate\"\n (click)=\"closeProperties()\">\n <i class=\"ri-close-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"properties-title\">\n <span class=\"properties-title-icon\"><i [class]=\"editing.field?.icon ?? 'ri-question-line'\" aria-hidden=\"true\"></i></span>\n <div class=\"properties-title-text\">\n <b>{{editing.fieldData.label || editing.fieldData.name}}</b>\n <small>{{(editing.field?.label ?? editing.fieldData.type) | uicTranslate}}</small>\n </div>\n </div>\n </div>\n <div class=\"formeditor-properties-form\">\n @if (editingSubField()) {\n <lib-field-editor\n [config]=\"editingSubField()!.subField\"\n [isSubField]=\"true\"\n [readOnly]=\"isReadOnly()\"\n [externalSources]=\"settings().externalSources\"\n [visibilityRulesEnabled]=\"settings().visibilityRules\"\n [styleEnabled]=\"settings().styleSection\"\n [focusRequiredField]=\"focusNewSubFieldCode() === editingSubField()?.subField?.code\"\n [enableNameModify]=\"nameEditable()\"\n [options]=\"subFieldDependencyOptions()\"\n (fieldChange)=\"onSubFieldChange($event)\">\n </lib-field-editor>\n } @else if (selectedField()) {\n <lib-field-editor\n [config]=\"selectedField()!\"\n [readOnly]=\"isReadOnly()\"\n [externalSources]=\"settings().externalSources\"\n [visibilityRulesEnabled]=\"settings().visibilityRules\"\n [styleEnabled]=\"settings().styleSection\"\n [focusRequiredField]=\"focusNewFieldCode() === selectedField()?.code\"\n [enableNameModify]=\"nameEditable()\"\n [options]=\"dependencyOptions()\"\n (fieldChange)=\"onFieldChange($event)\">\n </lib-field-editor>\n }\n </div>\n </section>\n }\n </div>\n\n @if (pendingUndo(); as undo) {\n <div class=\"undo-bar\" role=\"status\" aria-live=\"polite\">\n <i class=\"ri-delete-bin-line\" aria-hidden=\"true\"></i>\n <span class=\"undo-bar-text\">{{undo.message}}</span>\n <button type=\"button\" class=\"undo-bar-action\" (click)=\"undoRemoval()\">{{'form_builder.undo.action' | uicTranslate}}</button>\n <button type=\"button\" class=\"undo-bar-close\" [attr.aria-label]=\"'common.close' | uicTranslate\" (click)=\"dismissUndo()\">\n <i class=\"ri-close-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n</div>\n", styles: [".formeditor{position:relative;display:flex;flex-direction:column;overflow:hidden;background-color:var(--uic-neutral-100, var(--grey-100));border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;max-height:500px}.formeditor-header{background-color:var(--uic-surface, white);border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300));display:flex;align-items:center;gap:10px;padding:6px 8px 6px 14px;min-height:48px}.formeditor-heading{flex:1 1;min-width:0;display:flex;align-items:center;gap:10px}.formeditor-title{font-size:15px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.formeditor-actions{flex:0 0 auto;display:flex;align-items:center;gap:6px}.formeditor-body{display:flex;gap:10px;overflow:hidden;padding:10px;min-height:0}.formeditor-overflow{padding:5px;flex:1 1;overflow:auto;min-width:0}.formeditor-workarea{display:flex;flex-direction:column;gap:15px;height:fit-content}.formeditor-properties{width:320px;flex:0 0 auto;display:flex;flex-direction:column;position:relative;background-color:var(--uic-surface, white);border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;min-height:0;min-width:250px;max-width:600px}.formeditor-properties-resize{position:absolute;top:0;bottom:0;left:-6px;width:10px;cursor:col-resize;z-index:1}.formeditor-properties-resize:after{content:\"\";position:absolute;top:8px;bottom:8px;left:4px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.formeditor-properties-resize:hover:after,.formeditor-properties-resize.resizing:after{background-color:var(--primary-400)}.formeditor-properties-form{padding:10px;overflow:auto;flex:1 1 auto;min-height:0}.focused{border:solid 1px var(--primary-400);border-radius:10px;box-shadow:var(--uic-focus-shadow, 0 0 0 3px var(--secondary-alpha))}.no-selected-field{width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px 0;font-size:13px;gap:15px;text-align:center;color:var(--uic-neutral-400, var(--grey-400))}.no-selected-field i{font-size:24px}.status-chip{flex:0 0 auto;display:inline-flex;align-items:center;gap:5px;padding:1px 8px;border-radius:10px;font-size:11px;white-space:nowrap}.unsaved-chip{background-color:var(--yellow-100);color:var(--yellow-700)}.read-only-chip{background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-500, var(--grey-500))}.fb-menu{display:flex;flex-direction:column;font-size:13px}.fb-menu-actions{display:flex;flex-direction:column;padding:4px}.fb-menu-item{display:flex;align-items:center;gap:10px;width:100%;padding:7px 10px;border:none;border-radius:5px;background:none;color:inherit;text-align:left;cursor:pointer}.fb-menu-item i{font-size:16px;color:var(--uic-neutral-500, var(--grey-500))}.fb-menu-item i.copied{color:var(--green-600, #16a34a)}.fb-menu-item:hover,.fb-menu-item:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));outline:none}.fb-menu-section{border-top:solid 1px var(--uic-neutral-200, var(--grey-200));padding:10px 14px 12px;display:flex;flex-direction:column;gap:10px}.fb-menu-section-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400))}.fb-menu-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.fb-segmented{display:inline-flex;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:6px;overflow:hidden}.fb-segmented button{width:32px;height:26px;border:none;border-left:solid 1px var(--uic-neutral-300, var(--grey-300));background:var(--uic-surface, white);color:inherit;font-size:12px;cursor:pointer}.fb-segmented button:first-child{border-left:none}.fb-segmented button:hover:not(:disabled){background-color:var(--uic-neutral-100, var(--grey-100))}.fb-segmented button.active{background-color:var(--uic-neutral-800, var(--grey-800));color:var(--uic-neutral-50, var(--grey-50));font-weight:600}.fb-segmented button:disabled{cursor:default}.fb-segmented button:focus-visible{outline:solid 2px var(--primary-400);outline-offset:-2px}.fb-menu-grid{display:grid;grid-template-columns:1fr 64px 64px;align-items:center;gap:6px 8px}.fb-menu-grid-head{font-size:11px;color:var(--uic-neutral-500, var(--grey-500));text-align:center}.fb-menu-grid input{width:100%;height:26px;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;padding:0 6px;font-size:12px;text-align:center;background:var(--uic-surface, white);color:var(--uic-neutral-800, var(--grey-800))}.fb-menu-grid input:focus{outline:none;border-color:var(--primary-400)}.fb-menu-grid input:disabled{background:var(--uic-neutral-50, var(--grey-50));color:var(--uic-neutral-500, var(--grey-500))}.fb-menu-hint{font-size:11px;color:var(--uic-neutral-400, var(--grey-400))}.unsaved-dot{width:6px;height:6px;border-radius:50%;background-color:currentColor}.undo-bar{position:absolute;left:50%;bottom:14px;transform:translate(-50%);z-index:5;display:flex;align-items:center;gap:10px;max-width:calc(100% - 32px);padding:8px 8px 8px 14px;border-radius:6px;font-size:13px;background-color:var(--uic-neutral-800, var(--grey-800));color:var(--uic-neutral-50, var(--grey-50));box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18));animation:undo-bar-in .16s ease-out}.undo-bar-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.undo-bar-action,.undo-bar-close{flex:0 0 auto;border:none;background:none;color:inherit;cursor:pointer;border-radius:4px;padding:4px 8px}.undo-bar-action:hover,.undo-bar-action:focus-visible,.undo-bar-close:hover,.undo-bar-close:focus-visible{background-color:#ffffff1f;outline:none}.undo-bar-action{font-weight:600;color:var(--primary-200, #a9c7ff)}.undo-bar-close{padding:4px;display:flex}@keyframes undo-bar-in{0%{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%)}}@media (prefers-reduced-motion: reduce){.undo-bar{animation:none}}.formeditor-blocks{display:flex;flex-direction:column;gap:15px}.formeditor-blocks.cdk-drop-list-dragging>lib-block-editor:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}lib-block-editor.cdk-drag-placeholder{opacity:.35}.properties-header{display:flex;flex-direction:column;gap:6px;padding:10px;border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300));min-width:0}.formeditor-properties{animation:properties-in .16s ease-out}@keyframes properties-in{0%{opacity:0;transform:translate(12px)}to{opacity:1;transform:translate(0)}}@media (prefers-reduced-motion: reduce){.formeditor-properties{animation:none}}.properties-header-top{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:0}.properties-eyebrow{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400))}.properties-close{flex:0 0 auto;margin-left:auto;width:26px;height:26px;display:flex;align-items:center;justify-content:center;border:none;border-radius:5px;background:none;color:var(--uic-neutral-500, var(--grey-500));font-size:16px;cursor:pointer}.properties-close:hover,.properties-close:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-800, var(--grey-800));outline:none}.properties-breadcrumb{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;max-width:100%;border:none;background:none;padding:2px 4px 2px 0;border-radius:4px;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));cursor:pointer}.properties-breadcrumb span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.properties-breadcrumb:hover,.properties-breadcrumb:focus-visible{color:var(--primary-600);outline:none}.properties-title{display:flex;align-items:center;gap:8px;min-width:0}.properties-title-icon{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:5px;font-size:18px;background-color:var(--primary-100);color:var(--primary-600)}.properties-title-text{display:flex;flex-direction:column;min-width:0}.properties-title-text b{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.properties-title-text small{font-size:11px;color:var(--uic-neutral-500, var(--grey-500))}.limit-wrapper{display:inline-block;align-self:flex-start}.limit-wrapper:has(button:disabled) ui-button{pointer-events:none}\n"], dependencies: [{ kind: "component", type: UicButtonComponent, selector: "ui-button", inputs: ["text", "icon", "rightIcon", "iconOnly", "disabled", "loading", "size", "type", "color"] }, { kind: "pipe", type: UicTranslatePipe, name: "uicTranslate" }, { kind: "component", type: FieldEditorComponent, selector: "lib-field-editor", inputs: ["config", "focusRequiredField", "isSubField", "enableNameModify", "readOnly", "externalSources", "visibilityRulesEnabled", "styleEnabled", "options"], outputs: ["fieldChange"] }, { kind: "ngmodule", type: FormsModule }, { 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.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$1.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i1$1.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i1$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: BlockEditorComponent, selector: "lib-block-editor", inputs: ["block", "selectedFieldId", "selectedSubFieldCode", "selectedSubFieldParentCode", "visibilityParentFieldCodes", "fieldLookup", "showIdentifier", "connectedFieldListIds", "readOnly", "availableFieldTypes", "canDelete", "fieldLimitReached", "maxFields", "maxRepeaterFields"], outputs: ["blockChange", "addFieldRequest", "deleteBlock", "notifySelectedField", "notifySelectedSubField", "notifyNewSubField", "itemRemoved", "duplicateFieldRequest", "moveFieldRequest"] }, { kind: "ngmodule", type: DragDropModule }, { kind: "directive", type: i2.CdkDropList, selector: "[cdkDropList], cdk-drop-list", inputs: ["cdkDropListConnectedTo", "cdkDropListData", "cdkDropListOrientation", "id", "cdkDropListLockAxis", "cdkDropListDisabled", "cdkDropListSortingDisabled", "cdkDropListEnterPredicate", "cdkDropListSortPredicate", "cdkDropListAutoScrollDisabled", "cdkDropListAutoScrollStep", "cdkDropListElementContainer"], outputs: ["cdkDropListDropped", "cdkDropListEntered", "cdkDropListExited", "cdkDropListSorted"], exportAs: ["cdkDropList"] }, { kind: "directive", type: i2.CdkDrag, selector: "[cdkDrag]", inputs: ["cdkDragData", "cdkDragLockAxis", "cdkDragRootElement", "cdkDragBoundary", "cdkDragStartDelay", "cdkDragFreeDragPosition", "cdkDragDisabled", "cdkDragConstrainPosition", "cdkDragPreviewClass", "cdkDragPreviewContainer", "cdkDragScale"], outputs: ["cdkDragStarted", "cdkDragReleased", "cdkDragEnded", "cdkDragEntered", "cdkDragExited", "cdkDragDropped", "cdkDragMoved"], exportAs: ["cdkDrag"] }, { kind: "component", type: UicDropdownContainerComponent, selector: "ui-dropdown-container", inputs: ["buttonLabel", "disabled", "positions", "matchTriggerWidth", "width", "minWidth", "maxWidth", "backdropClass", "hasBackdrop", "closeOnBackdropClick", "closeOnEscape", "closeOnContentClick", "offsetX", "offsetY", "push", "flexibleDimensions"], outputs: ["closed"] }, { kind: "directive", type: UiDropdownCloseDirective, selector: "[uiDropdownClose]" }, { kind: "directive", type: UicToolTipDirective, selector: "[uiTooltip]", inputs: ["uiTooltip"] }] });
|
|
14263
14797
|
}
|
|
14264
14798
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: UicUserFormbuilderComponent, decorators: [{
|
|
14265
14799
|
type: Component,
|
|
@@ -14273,9 +14807,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
14273
14807
|
UicDropdownContainerComponent,
|
|
14274
14808
|
UiDropdownCloseDirective,
|
|
14275
14809
|
UicToolTipDirective
|
|
14276
|
-
], template: "<div class=\"formeditor\" [class.focused]=\"!isReadOnly()\" [class.read-only]=\"isReadOnly()\">\n <input #importFileInput id=\"formbuilder-import-file\" type=\"file\" accept=\".json,application/json\" hidden\n [attr.aria-label]=\"'form_builder.menu.load_json' | uicTranslate\"\n (change)=\"importSchemaFromFile($event)\">\n\n <!-- HEADER: t\u00EDtulo + estado | acciones principales + men\u00FA contextual -->\n <div class=\"formeditor-header\">\n <div class=\"formeditor-heading\">\n <span class=\"formeditor-title\">{{formTitle}}</span>\n @if (isReadOnly()) {\n <span class=\"status-chip read-only-chip\">\n <i class=\"ri-lock-line\" aria-hidden=\"true\"></i>\n {{'form_builder.read_only' | uicTranslate}}\n </span>\n } @else if (hasUnsavedChanges()) {\n <span class=\"status-chip unsaved-chip\" role=\"status\">\n <span class=\"unsaved-dot\" aria-hidden=\"true\"></span>\n {{'form_builder.unsaved_changes' | uicTranslate}}\n </span>\n }\n </div>\n\n <div class=\"formeditor-actions\">\n <ui-button color=\"primary\" type=\"bordered\" icon=\"ri-eye-line\" [text]=\"'form_builder.preview_form' | uicTranslate\" (click)=\"printForm()\"></ui-button>\n @if (isReadOnly()) {\n @if (!disabled) {\n <ui-button color=\"black\" icon=\"ri-edit-line\" [text]=\"'form_builder.edit' | uicTranslate\" (click)=\"enableEditMode()\"></ui-button>\n }\n } @else {\n <ui-button color=\"black\" type=\"bordered\" [text]=\"'form_builder.discard_changes' | uicTranslate\" (click)=\"discardChanges()\"></ui-button>\n <!-- Sin cambios no hay nada que guardar; \"Descartar\" sigue disponible para salir de la edici\u00F3n.\n Si el builder arranca en edici\u00F3n (sin snapshot), Guardar queda siempre habilitado. -->\n @let nothingToSave = !!editingSnapshot() && !hasUnsavedChanges();\n <ui-button\n color=\"black\"\n icon=\"ri-check-line\"\n [disabled]=\"nothingToSave\"\n [uiTooltip]=\"nothingToSave ? ('form_builder.no_changes' | uicTranslate) : ''\"\n [text]=\"'form_builder.submit_form' | uicTranslate\"\n (click)=\"submitForm()\">\n </ui-button>\n }\n\n <ui-dropdown-container width=\"280px\" maxWidth=\"calc(100vw - 32px)\" [positions]=\"menuPositions\">\n <ui-button\n button\n color=\"black\"\n type=\"ghost\"\n icon=\"ri-more-2-fill\"\n [iconOnly]=\"true\"\n [uiTooltip]=\"'form_builder.menu.more' | uicTranslate\"\n [attr.aria-label]=\"'form_builder.menu.more' | uicTranslate\">\n </ui-button>\n\n <div content class=\"fb-menu\">\n <div class=\"fb-menu-actions\">\n <button type=\"button\" class=\"fb-menu-item\" (click)=\"copySchemaToClipboard()\">\n <i [class]=\"schemaCopied() ? 'ri-check-line copied' : 'ri-file-copy-line'\" aria-hidden=\"true\"></i>\n <span>{{(schemaCopied() ? 'form_builder.menu.copied' : 'form_builder.menu.copy_json') | uicTranslate}}</span>\n </button>\n @if (!isReadOnly()) {\n <button type=\"button\" class=\"fb-menu-item\" uiDropdownClose (click)=\"importFileInput.click()\">\n <i class=\"ri-upload-2-line\" aria-hidden=\"true\"></i>\n <span>{{'form_builder.menu.load_json' | uicTranslate}}</span>\n </button>\n }\n </div>\n\n <div class=\"fb-menu-section\">\n <div class=\"fb-menu-section-title\">{{'form_builder.menu.layout_title' | uicTranslate}}</div>\n\n <div class=\"fb-menu-row\">\n <span id=\"fb-cols-label\">{{'form_builder.menu.columns' | uicTranslate}}</span>\n <div class=\"fb-segmented\" role=\"radiogroup\" aria-labelledby=\"fb-cols-label\">\n @for (cols of columnOptions; track cols) {\n <button\n type=\"button\"\n role=\"radio\"\n [attr.aria-checked]=\"editableCols() === cols\"\n [class.active]=\"editableCols() === cols\"\n [disabled]=\"isReadOnly()\"\n (click)=\"editableCols.set(cols)\">{{cols}}</button>\n }\n </div>\n </div>\n\n <div class=\"fb-menu-grid\">\n <span></span>\n <span class=\"fb-menu-grid-head\">{{'form_builder.menu.size' | uicTranslate}}</span>\n <span class=\"fb-menu-grid-head\">{{'form_builder.menu.margin' | uicTranslate}}</span>\n\n <span>{{'form_builder.menu.title' | uicTranslate}}</span>\n <input type=\"number\" min=\"8\" max=\"72\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.title_font_size' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableTitleFontSize()\" (ngModelChange)=\"editableTitleFontSize.set($event || null)\">\n <input type=\"number\" min=\"0\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.title_margin' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableTitleMargin()\" (ngModelChange)=\"editableTitleMargin.set($event || null)\">\n\n <span>{{'form_builder.menu.subtitle' | uicTranslate}}</span>\n <input type=\"number\" min=\"8\" max=\"72\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.subtitle_font_size' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableSubtitleFontSize()\" (ngModelChange)=\"editableSubtitleFontSize.set($event || null)\">\n <input type=\"number\" min=\"0\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.subtitle_margin' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableSubtitleMargin()\" (ngModelChange)=\"editableSubtitleMargin.set($event || null)\">\n </div>\n <p class=\"fb-menu-hint\">{{'form_builder.menu.layout_hint' | uicTranslate}}</p>\n </div>\n </div>\n </ui-dropdown-container>\n </div>\n </div>\n\n <!-- BODY: el mismo editor en ambos modos; en solo lectura todo queda deshabilitado -->\n <div class=\"formeditor-body\">\n <!-- Clic en una zona vac\u00EDa del canvas (no en un bloque ni un campo) cierra las propiedades -->\n <div class=\"formeditor-overflow\" (click)=\"onCanvasBackgroundClick($event)\">\n <div class=\"formeditor-workarea\">\n <div\n class=\"formeditor-blocks\"\n cdkDropList\n cdkDropListLockAxis=\"y\"\n [cdkDropListDisabled]=\"isReadOnly()\"\n (cdkDropListDropped)=\"reorderBlocks($event)\">\n @for (block of editableBlocks(); track block.code; let i = $index) {\n <lib-block-editor\n cdkDrag\n cdkDragLockAxis=\"y\"\n [cdkDragDisabled]=\"isReadOnly()\"\n [readOnly]=\"isReadOnly()\"\n [block]=\"block\"\n [fieldLookup]=\"fieldLookup()\"\n [showIdentifier]=\"enableNameModify()\"\n [connectedFieldListIds]=\"fieldListIds()\"\n (itemRemoved)=\"registerRemoval($event)\"\n (duplicateFieldRequest)=\"duplicateField($event)\"\n (moveFieldRequest)=\"moveField($event)\"\n [selectedFieldId]=\"selectedField()?.code ?? null\"\n [selectedSubFieldCode]=\"editingSubField()?.subField?.code ?? null\"\n [selectedSubFieldParentCode]=\"editingSubField()?.parentCode ?? null\"\n [visibilityParentFieldCodes]=\"visibilityParentFieldCodes()\"\n (blockChange)=\"onBlockChange(i, $event)\"\n (addFieldRequest)=\"addField(block.code, $event)\"\n (notifySelectedField)=\"selectField($event)\"\n (notifySelectedSubField)=\"onSelectSubField($event)\"\n (notifyNewSubField)=\"onNewSubField($event)\"\n (deleteBlock)=\"deleteBlock($event)\">\n </lib-block-editor>\n } @empty {\n @if (isReadOnly()) {\n <div class=\"no-selected-field\">\n <i class=\"ri-file-list-3-line\" aria-hidden=\"true\"></i>\n <p>{{'form_builder.no_blocks' | uicTranslate}}</p>\n </div>\n }\n }\n </div>\n @if (!isReadOnly()) {\n <ui-button type=\"bordered\" icon=\"ri-add-line\" color=\"black\" [text]=\"'form_builder.add_block' | uicTranslate\" (click)=\"addBlock()\"></ui-button>\n }\n </div>\n </div>\n <!-- PROPERTIES: solo existe mientras hay un campo seleccionado; cerrarlo deselecciona -->\n @let editing = editingSubField()?.subField ?? selectedField();\n @if (editing) {\n <section\n class=\"formeditor-properties\"\n [attr.aria-label]=\"'form_builder.properties.title' | uicTranslate\"\n [style.width.px]=\"propertiesWidth()\"\n (keydown.escape)=\"onPropertiesEscape($event)\">\n <div\n class=\"formeditor-properties-resize\"\n [class.resizing]=\"isResizing()\"\n [attr.title]=\"'form_builder.properties.resize' | uicTranslate\"\n (mousedown)=\"startPropertiesResize($event)\"\n (dblclick)=\"resetPropertiesWidth()\">\n </div>\n <div class=\"properties-header\">\n <div class=\"properties-header-top\">\n @if (editingSubField(); as sub) {\n @let parent = fieldLookup().get(sub.parentCode);\n <button type=\"button\" class=\"properties-breadcrumb\" (click)=\"backToRepeater(sub.parentCode)\" [uiTooltip]=\"'form_builder.properties.back_to_repeater' | uicTranslate\">\n <i class=\"ri-arrow-left-s-line\" aria-hidden=\"true\"></i>\n <i class=\"ri-stack-line\" aria-hidden=\"true\"></i>\n <span>{{parent?.fieldData?.label || parent?.fieldData?.name}}</span>\n </button>\n } @else {\n <span class=\"properties-eyebrow\">{{'form_builder.properties.title' | uicTranslate}}</span>\n }\n <button\n type=\"button\"\n class=\"properties-close\"\n [uiTooltip]=\"'form_builder.properties.close' | uicTranslate\"\n [attr.aria-label]=\"'form_builder.properties.close' | uicTranslate\"\n (click)=\"closeProperties()\">\n <i class=\"ri-close-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"properties-title\">\n <span class=\"properties-title-icon\"><i [class]=\"editing.field?.icon ?? 'ri-question-line'\" aria-hidden=\"true\"></i></span>\n <div class=\"properties-title-text\">\n <b>{{editing.fieldData.label || editing.fieldData.name}}</b>\n <small>{{(editing.field?.label ?? editing.fieldData.type) | uicTranslate}}</small>\n </div>\n </div>\n </div>\n <div class=\"formeditor-properties-form\">\n @if (editingSubField()) {\n <lib-field-editor\n [config]=\"editingSubField()!.subField\"\n [isSubField]=\"true\"\n [readOnly]=\"isReadOnly()\"\n [focusRequiredField]=\"focusNewSubFieldCode() === editingSubField()?.subField?.code\"\n [enableNameModify]=\"enableNameModify()\"\n [options]=\"subFieldDependencyOptions()\"\n (fieldChange)=\"onSubFieldChange($event)\">\n </lib-field-editor>\n } @else if (selectedField()) {\n <lib-field-editor\n [config]=\"selectedField()!\"\n [readOnly]=\"isReadOnly()\"\n [focusRequiredField]=\"focusNewFieldCode() === selectedField()?.code\"\n [enableNameModify]=\"enableNameModify()\"\n [options]=\"dependencyOptions()\"\n (fieldChange)=\"onFieldChange($event)\">\n </lib-field-editor>\n }\n </div>\n </section>\n }\n </div>\n\n @if (pendingUndo(); as undo) {\n <div class=\"undo-bar\" role=\"status\" aria-live=\"polite\">\n <i class=\"ri-delete-bin-line\" aria-hidden=\"true\"></i>\n <span class=\"undo-bar-text\">{{undo.message}}</span>\n <button type=\"button\" class=\"undo-bar-action\" (click)=\"undoRemoval()\">{{'form_builder.undo.action' | uicTranslate}}</button>\n <button type=\"button\" class=\"undo-bar-close\" [attr.aria-label]=\"'common.close' | uicTranslate\" (click)=\"dismissUndo()\">\n <i class=\"ri-close-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n</div>\n", styles: [".formeditor{position:relative;display:flex;flex-direction:column;overflow:hidden;background-color:var(--uic-neutral-100, var(--grey-100));border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;max-height:500px}.formeditor-header{background-color:var(--uic-surface, white);border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300));display:flex;align-items:center;gap:10px;padding:6px 8px 6px 14px;min-height:48px}.formeditor-heading{flex:1 1;min-width:0;display:flex;align-items:center;gap:10px}.formeditor-title{font-size:15px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.formeditor-actions{flex:0 0 auto;display:flex;align-items:center;gap:6px}.formeditor-body{display:flex;gap:10px;overflow:hidden;padding:10px;min-height:0}.formeditor-overflow{padding:5px;flex:1 1;overflow:auto;min-width:0}.formeditor-workarea{display:flex;flex-direction:column;gap:15px;height:fit-content}.formeditor-properties{width:320px;flex:0 0 auto;display:flex;flex-direction:column;position:relative;background-color:var(--uic-surface, white);border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;min-height:0;min-width:250px;max-width:600px}.formeditor-properties-resize{position:absolute;top:0;bottom:0;left:-6px;width:10px;cursor:col-resize;z-index:1}.formeditor-properties-resize:after{content:\"\";position:absolute;top:8px;bottom:8px;left:4px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.formeditor-properties-resize:hover:after,.formeditor-properties-resize.resizing:after{background-color:var(--primary-400)}.formeditor-properties-form{padding:10px;overflow:auto;flex:1 1 auto;min-height:0}.focused{border:solid 1px var(--primary-400);border-radius:10px;box-shadow:var(--uic-focus-shadow, 0 0 0 3px var(--secondary-alpha))}.no-selected-field{width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px 0;font-size:13px;gap:15px;text-align:center;color:var(--uic-neutral-400, var(--grey-400))}.no-selected-field i{font-size:24px}.status-chip{flex:0 0 auto;display:inline-flex;align-items:center;gap:5px;padding:1px 8px;border-radius:10px;font-size:11px;white-space:nowrap}.unsaved-chip{background-color:var(--yellow-100);color:var(--yellow-600)}.read-only-chip{background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-500, var(--grey-500))}.fb-menu{display:flex;flex-direction:column;font-size:13px}.fb-menu-actions{display:flex;flex-direction:column;padding:4px}.fb-menu-item{display:flex;align-items:center;gap:10px;width:100%;padding:7px 10px;border:none;border-radius:5px;background:none;color:inherit;text-align:left;cursor:pointer}.fb-menu-item i{font-size:16px;color:var(--uic-neutral-500, var(--grey-500))}.fb-menu-item i.copied{color:var(--green-600, #16a34a)}.fb-menu-item:hover,.fb-menu-item:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));outline:none}.fb-menu-section{border-top:solid 1px var(--uic-neutral-200, var(--grey-200));padding:10px 14px 12px;display:flex;flex-direction:column;gap:10px}.fb-menu-section-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400))}.fb-menu-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.fb-segmented{display:inline-flex;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:6px;overflow:hidden}.fb-segmented button{width:32px;height:26px;border:none;border-left:solid 1px var(--uic-neutral-300, var(--grey-300));background:var(--uic-surface, white);color:inherit;font-size:12px;cursor:pointer}.fb-segmented button:first-child{border-left:none}.fb-segmented button:hover:not(:disabled){background-color:var(--uic-neutral-100, var(--grey-100))}.fb-segmented button.active{background-color:var(--uic-neutral-800, var(--grey-800));color:var(--uic-neutral-50, var(--grey-50));font-weight:600}.fb-segmented button:disabled{cursor:default}.fb-segmented button:focus-visible{outline:solid 2px var(--primary-400);outline-offset:-2px}.fb-menu-grid{display:grid;grid-template-columns:1fr 64px 64px;align-items:center;gap:6px 8px}.fb-menu-grid-head{font-size:11px;color:var(--uic-neutral-500, var(--grey-500));text-align:center}.fb-menu-grid input{width:100%;height:26px;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;padding:0 6px;font-size:12px;text-align:center;background:var(--uic-surface, white);color:var(--uic-neutral-800, var(--grey-800))}.fb-menu-grid input:focus{outline:none;border-color:var(--primary-400)}.fb-menu-grid input:disabled{background:var(--uic-neutral-50, var(--grey-50));color:var(--uic-neutral-500, var(--grey-500))}.fb-menu-hint{font-size:11px;color:var(--uic-neutral-400, var(--grey-400))}.unsaved-dot{width:6px;height:6px;border-radius:50%;background-color:currentColor}.undo-bar{position:absolute;left:50%;bottom:14px;transform:translate(-50%);z-index:5;display:flex;align-items:center;gap:10px;max-width:calc(100% - 32px);padding:8px 8px 8px 14px;border-radius:6px;font-size:13px;background-color:var(--uic-neutral-800, var(--grey-800));color:var(--uic-neutral-50, var(--grey-50));box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18));animation:undo-bar-in .16s ease-out}.undo-bar-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.undo-bar-action,.undo-bar-close{flex:0 0 auto;border:none;background:none;color:inherit;cursor:pointer;border-radius:4px;padding:4px 8px}.undo-bar-action:hover,.undo-bar-action:focus-visible,.undo-bar-close:hover,.undo-bar-close:focus-visible{background-color:#ffffff1f;outline:none}.undo-bar-action{font-weight:600;color:var(--primary-200, #a9c7ff)}.undo-bar-close{padding:4px;display:flex}@keyframes undo-bar-in{0%{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%)}}@media (prefers-reduced-motion: reduce){.undo-bar{animation:none}}.formeditor-blocks{display:flex;flex-direction:column;gap:15px}.formeditor-blocks.cdk-drop-list-dragging>lib-block-editor:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}lib-block-editor.cdk-drag-placeholder{opacity:.35}.properties-header{display:flex;flex-direction:column;gap:6px;padding:10px;border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300));min-width:0}.formeditor-properties{animation:properties-in .16s ease-out}@keyframes properties-in{0%{opacity:0;transform:translate(12px)}to{opacity:1;transform:translate(0)}}@media (prefers-reduced-motion: reduce){.formeditor-properties{animation:none}}.properties-header-top{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:0}.properties-eyebrow{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400))}.properties-close{flex:0 0 auto;margin-left:auto;width:26px;height:26px;display:flex;align-items:center;justify-content:center;border:none;border-radius:5px;background:none;color:var(--uic-neutral-500, var(--grey-500));font-size:16px;cursor:pointer}.properties-close:hover,.properties-close:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-800, var(--grey-800));outline:none}.properties-breadcrumb{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;max-width:100%;border:none;background:none;padding:2px 4px 2px 0;border-radius:4px;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));cursor:pointer}.properties-breadcrumb span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.properties-breadcrumb:hover,.properties-breadcrumb:focus-visible{color:var(--primary-600);outline:none}.properties-title{display:flex;align-items:center;gap:8px;min-width:0}.properties-title-icon{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:5px;font-size:18px;background-color:var(--primary-100);color:var(--primary-600)}.properties-title-text{display:flex;flex-direction:column;min-width:0}.properties-title-text b{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.properties-title-text small{font-size:11px;color:var(--uic-neutral-500, var(--grey-500))}\n"] }]
|
|
14810
|
+
], template: "<div class=\"formeditor\" [class.focused]=\"!isReadOnly()\" [class.read-only]=\"isReadOnly()\">\n <input #importFileInput id=\"formbuilder-import-file\" type=\"file\" accept=\".json,application/json\" hidden\n [attr.aria-label]=\"'form_builder.menu.load_json' | uicTranslate\"\n (change)=\"importSchemaFromFile($event)\">\n\n <!-- HEADER: t\u00EDtulo + estado | acciones principales + men\u00FA contextual -->\n <div class=\"formeditor-header\">\n <div class=\"formeditor-heading\">\n <span class=\"formeditor-title\">{{formTitle}}</span>\n @if (isReadOnly()) {\n <span class=\"status-chip read-only-chip\">\n <i class=\"ri-lock-line\" aria-hidden=\"true\"></i>\n {{'form_builder.read_only' | uicTranslate}}\n </span>\n } @else if (hasUnsavedChanges()) {\n <span class=\"status-chip unsaved-chip\" role=\"status\">\n <span class=\"unsaved-dot\" aria-hidden=\"true\"></span>\n {{'form_builder.unsaved_changes' | uicTranslate}}\n </span>\n }\n </div>\n\n <div class=\"formeditor-actions\">\n <ui-button color=\"primary\" type=\"bordered\" icon=\"ri-eye-line\" [text]=\"'form_builder.preview_form' | uicTranslate\" (click)=\"printForm()\"></ui-button>\n @if (isReadOnly()) {\n @if (!disabled) {\n <ui-button color=\"black\" icon=\"ri-edit-line\" [text]=\"'form_builder.edit' | uicTranslate\" (click)=\"enableEditMode()\"></ui-button>\n }\n } @else {\n <ui-button color=\"black\" type=\"bordered\" [text]=\"'form_builder.discard_changes' | uicTranslate\" (click)=\"discardChanges()\"></ui-button>\n <!-- Sin cambios no hay nada que guardar; \"Descartar\" sigue disponible para salir de la edici\u00F3n.\n Si el builder arranca en edici\u00F3n (sin snapshot), Guardar queda siempre habilitado. -->\n @let nothingToSave = !!editingSnapshot() && !hasUnsavedChanges();\n <ui-button\n color=\"black\"\n icon=\"ri-check-line\"\n [disabled]=\"nothingToSave\"\n [uiTooltip]=\"nothingToSave ? ('form_builder.no_changes' | uicTranslate) : ''\"\n [text]=\"'form_builder.submit_form' | uicTranslate\"\n (click)=\"submitForm()\">\n </ui-button>\n }\n\n <ui-dropdown-container width=\"280px\" maxWidth=\"calc(100vw - 32px)\" [positions]=\"menuPositions\">\n <ui-button\n button\n color=\"black\"\n type=\"ghost\"\n icon=\"ri-more-2-fill\"\n [iconOnly]=\"true\"\n [uiTooltip]=\"'form_builder.menu.more' | uicTranslate\"\n [attr.aria-label]=\"'form_builder.menu.more' | uicTranslate\">\n </ui-button>\n\n <div content class=\"fb-menu\">\n <div class=\"fb-menu-actions\">\n <button type=\"button\" class=\"fb-menu-item\" (click)=\"copySchemaToClipboard()\">\n <i [class]=\"schemaCopied() ? 'ri-check-line copied' : 'ri-file-copy-line'\" aria-hidden=\"true\"></i>\n <span>{{(schemaCopied() ? 'form_builder.menu.copied' : 'form_builder.menu.copy_json') | uicTranslate}}</span>\n </button>\n @if (!isReadOnly()) {\n <button type=\"button\" class=\"fb-menu-item\" uiDropdownClose (click)=\"importFileInput.click()\">\n <i class=\"ri-upload-2-line\" aria-hidden=\"true\"></i>\n <span>{{'form_builder.menu.load_json' | uicTranslate}}</span>\n </button>\n }\n </div>\n\n <div class=\"fb-menu-section\">\n <div class=\"fb-menu-section-title\">{{'form_builder.menu.layout_title' | uicTranslate}}</div>\n\n <div class=\"fb-menu-row\">\n <span id=\"fb-cols-label\">{{'form_builder.menu.columns' | uicTranslate}}</span>\n <div class=\"fb-segmented\" role=\"radiogroup\" aria-labelledby=\"fb-cols-label\">\n @for (cols of columnOptions; track cols) {\n <button\n type=\"button\"\n role=\"radio\"\n [attr.aria-checked]=\"editableCols() === cols\"\n [class.active]=\"editableCols() === cols\"\n [disabled]=\"isReadOnly()\"\n (click)=\"editableCols.set(cols)\">{{cols}}</button>\n }\n </div>\n </div>\n\n <div class=\"fb-menu-grid\">\n <span></span>\n <span class=\"fb-menu-grid-head\">{{'form_builder.menu.size' | uicTranslate}}</span>\n <span class=\"fb-menu-grid-head\">{{'form_builder.menu.margin' | uicTranslate}}</span>\n\n <span>{{'form_builder.menu.title' | uicTranslate}}</span>\n <input type=\"number\" min=\"8\" max=\"72\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.title_font_size' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableTitleFontSize()\" (ngModelChange)=\"editableTitleFontSize.set($event || null)\">\n <input type=\"number\" min=\"0\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.title_margin' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableTitleMargin()\" (ngModelChange)=\"editableTitleMargin.set($event || null)\">\n\n <span>{{'form_builder.menu.subtitle' | uicTranslate}}</span>\n <input type=\"number\" min=\"8\" max=\"72\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.subtitle_font_size' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableSubtitleFontSize()\" (ngModelChange)=\"editableSubtitleFontSize.set($event || null)\">\n <input type=\"number\" min=\"0\" placeholder=\"Auto\"\n [attr.aria-label]=\"'form_builder.schema.subtitle_margin' | uicTranslate\"\n [disabled]=\"isReadOnly()\"\n [ngModel]=\"editableSubtitleMargin()\" (ngModelChange)=\"editableSubtitleMargin.set($event || null)\">\n </div>\n <p class=\"fb-menu-hint\">{{'form_builder.menu.layout_hint' | uicTranslate}}</p>\n </div>\n </div>\n </ui-dropdown-container>\n </div>\n </div>\n\n <!-- BODY: el mismo editor en ambos modos; en solo lectura todo queda deshabilitado -->\n <div class=\"formeditor-body\">\n <!-- Clic en una zona vac\u00EDa del canvas (no en un bloque ni un campo) cierra las propiedades -->\n <div class=\"formeditor-overflow\" (click)=\"onCanvasBackgroundClick($event)\">\n <div class=\"formeditor-workarea\">\n <div\n class=\"formeditor-blocks\"\n cdkDropList\n cdkDropListLockAxis=\"y\"\n [cdkDropListDisabled]=\"isReadOnly()\"\n (cdkDropListDropped)=\"reorderBlocks($event)\">\n @for (block of editableBlocks(); track block.code; let i = $index) {\n <lib-block-editor\n cdkDrag\n cdkDragLockAxis=\"y\"\n [cdkDragDisabled]=\"isReadOnly()\"\n [readOnly]=\"isReadOnly()\"\n [availableFieldTypes]=\"settings().fieldTypes\"\n [canDelete]=\"canDeleteBlocks()\"\n [fieldLimitReached]=\"fieldLimitReached()\"\n [maxFields]=\"settings().limits.maxFields\"\n [maxRepeaterFields]=\"settings().limits.maxRepeaterFields\"\n [block]=\"block\"\n [fieldLookup]=\"fieldLookup()\"\n [showIdentifier]=\"nameEditable()\"\n [connectedFieldListIds]=\"fieldListIds()\"\n (itemRemoved)=\"registerRemoval($event)\"\n (duplicateFieldRequest)=\"duplicateField($event)\"\n (moveFieldRequest)=\"moveField($event)\"\n [selectedFieldId]=\"selectedField()?.code ?? null\"\n [selectedSubFieldCode]=\"editingSubField()?.subField?.code ?? null\"\n [selectedSubFieldParentCode]=\"editingSubField()?.parentCode ?? null\"\n [visibilityParentFieldCodes]=\"visibilityParentFieldCodes()\"\n (blockChange)=\"onBlockChange(i, $event)\"\n (addFieldRequest)=\"addField(block.code, $event)\"\n (notifySelectedField)=\"selectField($event)\"\n (notifySelectedSubField)=\"onSelectSubField($event)\"\n (notifyNewSubField)=\"onNewSubField($event)\"\n (deleteBlock)=\"deleteBlock($event)\">\n </lib-block-editor>\n } @empty {\n @if (isReadOnly()) {\n <div class=\"no-selected-field\">\n <i class=\"ri-file-list-3-line\" aria-hidden=\"true\"></i>\n <p>{{'form_builder.no_blocks' | uicTranslate}}</p>\n </div>\n }\n }\n </div>\n @if (!isReadOnly() && settings().allowBlockCreation) {\n @let blockLimit = blockLimitReached();\n <!-- El tooltip va en un contenedor: un bot\u00F3n deshabilitado no recibe eventos del mouse -->\n <span class=\"limit-wrapper\" [uiTooltip]=\"blockLimit ? ('form_builder.limits.blocks_reached' | uicTranslate: { max: settings().limits.maxBlocks }) : ''\">\n <ui-button type=\"bordered\" icon=\"ri-add-line\" color=\"black\" [disabled]=\"blockLimit\" [text]=\"'form_builder.add_block' | uicTranslate\" (click)=\"addBlock()\"></ui-button>\n </span>\n }\n </div>\n </div>\n <!-- PROPERTIES: solo existe mientras hay un campo seleccionado; cerrarlo deselecciona -->\n @let editing = editingSubField()?.subField ?? selectedField();\n @if (editing) {\n <section\n class=\"formeditor-properties\"\n [attr.aria-label]=\"'form_builder.properties.title' | uicTranslate\"\n [style.width.px]=\"propertiesWidth()\"\n (keydown.escape)=\"onPropertiesEscape($event)\">\n <div\n class=\"formeditor-properties-resize\"\n [class.resizing]=\"isResizing()\"\n [attr.title]=\"'form_builder.properties.resize' | uicTranslate\"\n (mousedown)=\"startPropertiesResize($event)\"\n (dblclick)=\"resetPropertiesWidth()\">\n </div>\n <div class=\"properties-header\">\n <div class=\"properties-header-top\">\n @if (editingSubField(); as sub) {\n @let parent = fieldLookup().get(sub.parentCode);\n <button type=\"button\" class=\"properties-breadcrumb\" (click)=\"backToRepeater(sub.parentCode)\" [uiTooltip]=\"'form_builder.properties.back_to_repeater' | uicTranslate\">\n <i class=\"ri-arrow-left-s-line\" aria-hidden=\"true\"></i>\n <i class=\"ri-stack-line\" aria-hidden=\"true\"></i>\n <span>{{parent?.fieldData?.label || parent?.fieldData?.name}}</span>\n </button>\n } @else {\n <span class=\"properties-eyebrow\">{{'form_builder.properties.title' | uicTranslate}}</span>\n }\n <button\n type=\"button\"\n class=\"properties-close\"\n [uiTooltip]=\"'form_builder.properties.close' | uicTranslate\"\n [attr.aria-label]=\"'form_builder.properties.close' | uicTranslate\"\n (click)=\"closeProperties()\">\n <i class=\"ri-close-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"properties-title\">\n <span class=\"properties-title-icon\"><i [class]=\"editing.field?.icon ?? 'ri-question-line'\" aria-hidden=\"true\"></i></span>\n <div class=\"properties-title-text\">\n <b>{{editing.fieldData.label || editing.fieldData.name}}</b>\n <small>{{(editing.field?.label ?? editing.fieldData.type) | uicTranslate}}</small>\n </div>\n </div>\n </div>\n <div class=\"formeditor-properties-form\">\n @if (editingSubField()) {\n <lib-field-editor\n [config]=\"editingSubField()!.subField\"\n [isSubField]=\"true\"\n [readOnly]=\"isReadOnly()\"\n [externalSources]=\"settings().externalSources\"\n [visibilityRulesEnabled]=\"settings().visibilityRules\"\n [styleEnabled]=\"settings().styleSection\"\n [focusRequiredField]=\"focusNewSubFieldCode() === editingSubField()?.subField?.code\"\n [enableNameModify]=\"nameEditable()\"\n [options]=\"subFieldDependencyOptions()\"\n (fieldChange)=\"onSubFieldChange($event)\">\n </lib-field-editor>\n } @else if (selectedField()) {\n <lib-field-editor\n [config]=\"selectedField()!\"\n [readOnly]=\"isReadOnly()\"\n [externalSources]=\"settings().externalSources\"\n [visibilityRulesEnabled]=\"settings().visibilityRules\"\n [styleEnabled]=\"settings().styleSection\"\n [focusRequiredField]=\"focusNewFieldCode() === selectedField()?.code\"\n [enableNameModify]=\"nameEditable()\"\n [options]=\"dependencyOptions()\"\n (fieldChange)=\"onFieldChange($event)\">\n </lib-field-editor>\n }\n </div>\n </section>\n }\n </div>\n\n @if (pendingUndo(); as undo) {\n <div class=\"undo-bar\" role=\"status\" aria-live=\"polite\">\n <i class=\"ri-delete-bin-line\" aria-hidden=\"true\"></i>\n <span class=\"undo-bar-text\">{{undo.message}}</span>\n <button type=\"button\" class=\"undo-bar-action\" (click)=\"undoRemoval()\">{{'form_builder.undo.action' | uicTranslate}}</button>\n <button type=\"button\" class=\"undo-bar-close\" [attr.aria-label]=\"'common.close' | uicTranslate\" (click)=\"dismissUndo()\">\n <i class=\"ri-close-line\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n</div>\n", styles: [".formeditor{position:relative;display:flex;flex-direction:column;overflow:hidden;background-color:var(--uic-neutral-100, var(--grey-100));border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;max-height:500px}.formeditor-header{background-color:var(--uic-surface, white);border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300));display:flex;align-items:center;gap:10px;padding:6px 8px 6px 14px;min-height:48px}.formeditor-heading{flex:1 1;min-width:0;display:flex;align-items:center;gap:10px}.formeditor-title{font-size:15px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.formeditor-actions{flex:0 0 auto;display:flex;align-items:center;gap:6px}.formeditor-body{display:flex;gap:10px;overflow:hidden;padding:10px;min-height:0}.formeditor-overflow{padding:5px;flex:1 1;overflow:auto;min-width:0}.formeditor-workarea{display:flex;flex-direction:column;gap:15px;height:fit-content}.formeditor-properties{width:320px;flex:0 0 auto;display:flex;flex-direction:column;position:relative;background-color:var(--uic-surface, white);border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;min-height:0;min-width:250px;max-width:600px}.formeditor-properties-resize{position:absolute;top:0;bottom:0;left:-6px;width:10px;cursor:col-resize;z-index:1}.formeditor-properties-resize:after{content:\"\";position:absolute;top:8px;bottom:8px;left:4px;width:2px;border-radius:1px;background-color:transparent;transition:background-color .15s ease}.formeditor-properties-resize:hover:after,.formeditor-properties-resize.resizing:after{background-color:var(--primary-400)}.formeditor-properties-form{padding:10px;overflow:auto;flex:1 1 auto;min-height:0}.focused{border:solid 1px var(--primary-400);border-radius:10px;box-shadow:var(--uic-focus-shadow, 0 0 0 3px var(--secondary-alpha))}.no-selected-field{width:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;padding:20px 0;font-size:13px;gap:15px;text-align:center;color:var(--uic-neutral-400, var(--grey-400))}.no-selected-field i{font-size:24px}.status-chip{flex:0 0 auto;display:inline-flex;align-items:center;gap:5px;padding:1px 8px;border-radius:10px;font-size:11px;white-space:nowrap}.unsaved-chip{background-color:var(--yellow-100);color:var(--yellow-700)}.read-only-chip{background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-500, var(--grey-500))}.fb-menu{display:flex;flex-direction:column;font-size:13px}.fb-menu-actions{display:flex;flex-direction:column;padding:4px}.fb-menu-item{display:flex;align-items:center;gap:10px;width:100%;padding:7px 10px;border:none;border-radius:5px;background:none;color:inherit;text-align:left;cursor:pointer}.fb-menu-item i{font-size:16px;color:var(--uic-neutral-500, var(--grey-500))}.fb-menu-item i.copied{color:var(--green-600, #16a34a)}.fb-menu-item:hover,.fb-menu-item:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));outline:none}.fb-menu-section{border-top:solid 1px var(--uic-neutral-200, var(--grey-200));padding:10px 14px 12px;display:flex;flex-direction:column;gap:10px}.fb-menu-section-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400))}.fb-menu-row{display:flex;align-items:center;justify-content:space-between;gap:10px}.fb-segmented{display:inline-flex;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:6px;overflow:hidden}.fb-segmented button{width:32px;height:26px;border:none;border-left:solid 1px var(--uic-neutral-300, var(--grey-300));background:var(--uic-surface, white);color:inherit;font-size:12px;cursor:pointer}.fb-segmented button:first-child{border-left:none}.fb-segmented button:hover:not(:disabled){background-color:var(--uic-neutral-100, var(--grey-100))}.fb-segmented button.active{background-color:var(--uic-neutral-800, var(--grey-800));color:var(--uic-neutral-50, var(--grey-50));font-weight:600}.fb-segmented button:disabled{cursor:default}.fb-segmented button:focus-visible{outline:solid 2px var(--primary-400);outline-offset:-2px}.fb-menu-grid{display:grid;grid-template-columns:1fr 64px 64px;align-items:center;gap:6px 8px}.fb-menu-grid-head{font-size:11px;color:var(--uic-neutral-500, var(--grey-500));text-align:center}.fb-menu-grid input{width:100%;height:26px;border:solid 1px var(--uic-neutral-300, var(--grey-300));border-radius:5px;padding:0 6px;font-size:12px;text-align:center;background:var(--uic-surface, white);color:var(--uic-neutral-800, var(--grey-800))}.fb-menu-grid input:focus{outline:none;border-color:var(--primary-400)}.fb-menu-grid input:disabled{background:var(--uic-neutral-50, var(--grey-50));color:var(--uic-neutral-500, var(--grey-500))}.fb-menu-hint{font-size:11px;color:var(--uic-neutral-400, var(--grey-400))}.unsaved-dot{width:6px;height:6px;border-radius:50%;background-color:currentColor}.undo-bar{position:absolute;left:50%;bottom:14px;transform:translate(-50%);z-index:5;display:flex;align-items:center;gap:10px;max-width:calc(100% - 32px);padding:8px 8px 8px 14px;border-radius:6px;font-size:13px;background-color:var(--uic-neutral-800, var(--grey-800));color:var(--uic-neutral-50, var(--grey-50));box-shadow:var(--uic-shadow-md, 0 6px 12px rgba(0, 0, 0, .18));animation:undo-bar-in .16s ease-out}.undo-bar-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.undo-bar-action,.undo-bar-close{flex:0 0 auto;border:none;background:none;color:inherit;cursor:pointer;border-radius:4px;padding:4px 8px}.undo-bar-action:hover,.undo-bar-action:focus-visible,.undo-bar-close:hover,.undo-bar-close:focus-visible{background-color:#ffffff1f;outline:none}.undo-bar-action{font-weight:600;color:var(--primary-200, #a9c7ff)}.undo-bar-close{padding:4px;display:flex}@keyframes undo-bar-in{0%{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%)}}@media (prefers-reduced-motion: reduce){.undo-bar{animation:none}}.formeditor-blocks{display:flex;flex-direction:column;gap:15px}.formeditor-blocks.cdk-drop-list-dragging>lib-block-editor:not(.cdk-drag-placeholder){transition:transform .25s cubic-bezier(0,0,.2,1)}lib-block-editor.cdk-drag-placeholder{opacity:.35}.properties-header{display:flex;flex-direction:column;gap:6px;padding:10px;border-bottom:solid 1px var(--uic-neutral-300, var(--grey-300));min-width:0}.formeditor-properties{animation:properties-in .16s ease-out}@keyframes properties-in{0%{opacity:0;transform:translate(12px)}to{opacity:1;transform:translate(0)}}@media (prefers-reduced-motion: reduce){.formeditor-properties{animation:none}}.properties-header-top{display:flex;align-items:center;justify-content:space-between;gap:6px;min-width:0}.properties-eyebrow{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--uic-neutral-400, var(--grey-400))}.properties-close{flex:0 0 auto;margin-left:auto;width:26px;height:26px;display:flex;align-items:center;justify-content:center;border:none;border-radius:5px;background:none;color:var(--uic-neutral-500, var(--grey-500));font-size:16px;cursor:pointer}.properties-close:hover,.properties-close:focus-visible{background-color:var(--uic-neutral-100, var(--grey-100));color:var(--uic-neutral-800, var(--grey-800));outline:none}.properties-breadcrumb{display:inline-flex;align-items:center;gap:4px;align-self:flex-start;max-width:100%;border:none;background:none;padding:2px 4px 2px 0;border-radius:4px;font-size:12px;color:var(--uic-neutral-500, var(--grey-500));cursor:pointer}.properties-breadcrumb span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.properties-breadcrumb:hover,.properties-breadcrumb:focus-visible{color:var(--primary-600);outline:none}.properties-title{display:flex;align-items:center;gap:8px;min-width:0}.properties-title-icon{flex:0 0 auto;display:flex;align-items:center;justify-content:center;width:30px;height:30px;border-radius:5px;font-size:18px;background-color:var(--primary-100);color:var(--primary-600)}.properties-title-text{display:flex;flex-direction:column;min-width:0}.properties-title-text b{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.properties-title-text small{font-size:11px;color:var(--uic-neutral-500, var(--grey-500))}.limit-wrapper{display:inline-block;align-self:flex-start}.limit-wrapper:has(button:disabled) ui-button{pointer-events:none}\n"] }]
|
|
14277
14811
|
}], ctorParameters: () => [], propDecorators: { disabled: [{
|
|
14278
14812
|
type: Input
|
|
14813
|
+
}], config: [{
|
|
14814
|
+
type: Input
|
|
14279
14815
|
}], formTitle: [{
|
|
14280
14816
|
type: Input
|
|
14281
14817
|
}], optionSources: [{
|
|
@@ -15102,5 +15638,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
|
|
|
15102
15638
|
* Generated bundle index. Do not edit.
|
|
15103
15639
|
*/
|
|
15104
15640
|
|
|
15105
|
-
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_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, isMobile, provideUicTranslateConfig, pushTop, sideModal, simpleFade, uicColorOptions, 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 };
|
|
15106
15642
|
//# sourceMappingURL=ui-core-abv.mjs.map
|