@arquimedes.co/eureka-forms 3.0.66 → 3.0.68-test
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/README +1 -33
- package/dist/@Types/FormStep.d.ts +2 -7
- package/dist/@Types/FormStep.js +1 -2
- package/dist/App/App.stories.d.ts +0 -10
- package/dist/App/App.stories.js +0 -189
- package/dist/App/AppHooks.js +0 -8
- package/dist/App/AppHooks.test.js +0 -8
- package/dist/Form/Form.js +6 -7
- package/dist/Form/FormFunctions.d.ts +0 -17
- package/dist/Form/FormFunctions.js +0 -22
- package/dist/Form/FormFunctions.test.js +1 -28
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.mobileLabel.test.js +12 -20
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +13 -6
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +13 -2
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +1 -3
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +21 -10
- package/dist/FormSteps/Step.js +0 -16
- package/dist/FormSteps/StepFunctions.js +0 -14
- package/dist/FormSteps/StepFunctions.test.js +0 -54
- package/dist/FormSteps/StepHooks.d.ts +0 -14
- package/dist/FormSteps/StepHooks.js +8 -39
- package/dist/Shared/ErkDatePicker/ErkDatePicker.js +12 -4
- package/dist/Shared/ErkDatePicker/ErkDatePicker.locale.test.js +39 -0
- package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +3 -2
- package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +16 -11
- package/dist/Shared/ErkSelect/ErkSelect.js +9 -1
- package/dist/Shared/ErkSelect/ErkSelect.test.d.ts +2 -0
- package/dist/Shared/ErkSelect/ErkSelect.test.js +53 -0
- package/dist/Shared/ErkTimePicker/ErkTimePicker.js +8 -1
- package/dist/Shared/ErkTimePicker/ErkTimePicker.test.d.ts +2 -0
- package/dist/Shared/ErkTimePicker/ErkTimePicker.test.js +24 -0
- package/dist/Utils/AxiosWidget.js +1 -9
- package/dist/Utils/LocaleUtils.d.ts +1 -0
- package/dist/Utils/LocaleUtils.js +10 -3
- package/dist/constants/FormStepTypes.d.ts +1 -5
- package/dist/constants/FormStepTypes.js +0 -4
- package/dist/index.lib.d.ts +2 -4
- package/dist/index.lib.js +1 -3
- package/package.json +1 -2
- package/dist/@Types/AvailabilityFormStep.d.ts +0 -48
- package/dist/@Types/AvailabilityFormStep.js +0 -24
- package/dist/@Types/BankAccountFormStep.d.ts +0 -67
- package/dist/@Types/BankAccountFormStep.js +0 -14
- package/dist/@Types/BookingFormStep.d.ts +0 -187
- package/dist/@Types/BookingFormStep.js +0 -44
- package/dist/@Types/CalendarFormStep.d.ts +0 -209
- package/dist/@Types/CalendarFormStep.js +0 -55
- package/dist/@Types/CommunicationChannelFormStep.d.ts +0 -51
- package/dist/@Types/CommunicationChannelFormStep.js +0 -15
- package/dist/@Types/ConsentFormStep.d.ts +0 -36
- package/dist/@Types/ConsentFormStep.js +0 -8
- package/dist/@Types/EntityFormFormStep.d.ts +0 -66
- package/dist/@Types/EntityFormFormStep.js +0 -20
- package/dist/@Types/EventFormStep.d.ts +0 -52
- package/dist/@Types/EventFormStep.js +0 -13
- package/dist/@Types/ExternalReferenceFormStep.d.ts +0 -74
- package/dist/@Types/ExternalReferenceFormStep.js +0 -20
- package/dist/@Types/LocationFormStep.d.ts +0 -159
- package/dist/@Types/LocationFormStep.js +0 -46
- package/dist/@Types/NumericFormSteps.d.ts +0 -108
- package/dist/@Types/NumericFormSteps.js +0 -20
- package/dist/@Types/PredefinedSelectorFormStep.d.ts +0 -51
- package/dist/@Types/PredefinedSelectorFormStep.js +0 -39
- package/dist/@Types/StepRef.d.ts +0 -135
- package/dist/@Types/StepRef.js +0 -49
- package/dist/FormSteps/AvailabilityStep/AvailabilityStep.d.ts +0 -7
- package/dist/FormSteps/AvailabilityStep/AvailabilityStep.js +0 -14
- package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.d.ts +0 -8
- package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.js +0 -32
- package/dist/FormSteps/BookingStep/BookingStep.d.ts +0 -17
- package/dist/FormSteps/BookingStep/BookingStep.js +0 -14
- package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.d.ts +0 -7
- package/dist/FormSteps/BookingStep/MaterialBookingStep/MaterialBookingStep.js +0 -32
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.lateClassifiers.test.js +0 -70
- package/dist/FormSteps/EntityValueStep/entityValueDependencyValue.d.ts +0 -12
- package/dist/FormSteps/EntityValueStep/entityValueDependencyValue.js +0 -35
- package/dist/FormSteps/EntityValueStep/entityValueDependencyValue.test.d.ts +0 -1
- package/dist/FormSteps/EntityValueStep/entityValueDependencyValue.test.js +0 -31
- package/dist/FormSteps/EntityValueStep/entityValuePickerWatchedSteps.d.ts +0 -27
- package/dist/FormSteps/EntityValueStep/entityValuePickerWatchedSteps.js +0 -64
- package/dist/FormSteps/EntityValueStep/entityValuePickerWatchedSteps.test.d.ts +0 -1
- package/dist/FormSteps/EntityValueStep/entityValuePickerWatchedSteps.test.js +0 -95
- package/dist/FormSteps/LocationStep/LocationStep.d.ts +0 -10
- package/dist/FormSteps/LocationStep/LocationStep.js +0 -14
- package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.d.ts +0 -3
- package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.js +0 -54
- package/dist/FormSteps/LocationStep/MaterialLocationStep/MaterialLocationStep.module.css +0 -18
- package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.d.ts +0 -3
- package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.js +0 -170
- package/dist/FormSteps/NumberStep/MaterialNumberStep/MaterialNumberStep.module.css +0 -96
- package/dist/FormSteps/NumberStep/NumberStep.d.ts +0 -10
- package/dist/FormSteps/NumberStep/NumberStep.js +0 -14
- package/dist/FormSteps/StepHooks.test.d.ts +0 -1
- package/dist/FormSteps/StepHooks.test.js +0 -92
- package/dist/Icons/AddIcon.d.ts +0 -3
- package/dist/Icons/AddIcon.js +0 -7
- package/dist/Icons/EditIcon.d.ts +0 -3
- package/dist/Icons/EditIcon.js +0 -7
- package/dist/Icons/RemoveIcon.d.ts +0 -3
- package/dist/Icons/RemoveIcon.js +0 -7
- package/dist/Icons/ViewDayIcon.d.ts +0 -3
- package/dist/Icons/ViewDayIcon.js +0 -7
- package/dist/Icons/ViewWeekIcon.d.ts +0 -3
- package/dist/Icons/ViewWeekIcon.js +0 -7
- package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.d.ts +0 -19
- package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.js +0 -80
- package/dist/Shared/ErkAddressAutocomplete/ErkAddressAutocomplete.module.css +0 -88
- package/dist/Shared/ErkAddressAutocomplete/googlePlaces.d.ts +0 -29
- package/dist/Shared/ErkAddressAutocomplete/googlePlaces.js +0 -139
- package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.d.ts +0 -25
- package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.js +0 -112
- package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.module.css +0 -88
- package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.d.ts +0 -1
- package/dist/Shared/ErkAvailabilityPicker/ErkAvailabilityPicker.test.js +0 -73
- package/dist/Shared/ErkBookingPicker/ErkBookingPicker.d.ts +0 -31
- package/dist/Shared/ErkBookingPicker/ErkBookingPicker.js +0 -228
- package/dist/Shared/ErkBookingPicker/ErkBookingPicker.module.css +0 -608
- package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.d.ts +0 -28
- package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.js +0 -117
- package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.d.ts +0 -1
- package/dist/Shared/ErkBookingPicker/ErkBookingPicker.stories.test.js +0 -49
- package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.d.ts +0 -1
- package/dist/Shared/ErkBookingPicker/ErkBookingPicker.test.js +0 -107
- package/dist/Shared/ErkIconButton/ErkIconButton.d.ts +0 -17
- package/dist/Shared/ErkIconButton/ErkIconButton.js +0 -11
- package/dist/Shared/ErkIconButton/ErkIconButton.module.css +0 -41
- package/dist/Shared/ErkLocationField/ErkLocationField.d.ts +0 -24
- package/dist/Shared/ErkLocationField/ErkLocationField.js +0 -128
- package/dist/Shared/ErkLocationField/ErkLocationField.module.css +0 -164
- package/dist/Shared/ErkLocationField/ErkLocationField.test.d.ts +0 -1
- package/dist/Shared/ErkLocationField/ErkLocationField.test.js +0 -82
- package/dist/Shared/ErkLocationField/addressFields.d.ts +0 -12
- package/dist/Shared/ErkLocationField/addressFields.js +0 -34
- package/dist/Shared/ErkLocationField/locationRestrictions.d.ts +0 -6
- package/dist/Shared/ErkLocationField/locationRestrictions.js +0 -51
- package/dist/Shared/ErkLocationInput/ErkLocationInput.d.ts +0 -15
- package/dist/Shared/ErkLocationInput/ErkLocationInput.js +0 -502
- package/dist/Shared/ErkLocationInput/ErkLocationInput.module.css +0 -128
- package/dist/Shared/ErkNumberField/ErkNumberField.d.ts +0 -42
- package/dist/Shared/ErkNumberField/ErkNumberField.js +0 -169
- /package/dist/{FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.lateClassifiers.test.d.ts → Shared/ErkDatePicker/ErkDatePicker.locale.test.d.ts} +0 -0
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* NumericFormSteps types
|
|
3
|
-
* Cubre el paso relacionado con números y sus múltiples subtipos.
|
|
4
|
-
*/
|
|
5
|
-
// ===========================================================================
|
|
6
|
-
// NUMBER
|
|
7
|
-
// ===========================================================================
|
|
8
|
-
/** Subtipo del paso numérico — discriminante secundario */
|
|
9
|
-
export var NumberStepType;
|
|
10
|
-
(function (NumberStepType) {
|
|
11
|
-
NumberStepType["INTEGER"] = "INTEGER";
|
|
12
|
-
NumberStepType["DECIMAL"] = "DECIMAL";
|
|
13
|
-
NumberStepType["PERCENTAGE"] = "PERCENTAGE";
|
|
14
|
-
/** Monto de dinero en una divisa (ej: 1500 COP). */
|
|
15
|
-
NumberStepType["MONEY"] = "MONEY";
|
|
16
|
-
/** Magnitud con unidad de medida (ej: 5 kg). */
|
|
17
|
-
NumberStepType["MEASURE"] = "MEASURE";
|
|
18
|
-
/** Precio por unidad: divisa sobre unidad (ej: 20 USD / hora). */
|
|
19
|
-
NumberStepType["UNIT_PRICE"] = "UNIT_PRICE";
|
|
20
|
-
})(NumberStepType || (NumberStepType = {}));
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — PredefinedSelectorFormStep types
|
|
3
|
-
*
|
|
4
|
-
* Paso que reemplaza tener que configurar manualmente opciones de selectores
|
|
5
|
-
* para listas fijas y controladas por Capta (países, ciudades, monedas, etc.).
|
|
6
|
-
* Las opciones vienen de APIs internas — el formulario no necesita configurarlas.
|
|
7
|
-
*
|
|
8
|
-
* También resuelve la cascada Country → State → City via parentStepId.
|
|
9
|
-
*/
|
|
10
|
-
import { GSmartSelect } from './GenericFormSteps';
|
|
11
|
-
export declare enum PredefinedOptionType {
|
|
12
|
-
/** ISO 3166-1 — lista de países */
|
|
13
|
-
COUNTRY = "COUNTRY",
|
|
14
|
-
/**
|
|
15
|
-
* Departamento / provincia / estado.
|
|
16
|
-
* Requiere parentStepId apuntando a un step COUNTRY.
|
|
17
|
-
*/
|
|
18
|
-
STATE = "STATE",
|
|
19
|
-
/**
|
|
20
|
-
* Ciudad / municipio.
|
|
21
|
-
* Requiere parentStepId apuntando a un step STATE (o COUNTRY si no hay STATE).
|
|
22
|
-
*/
|
|
23
|
-
CITY = "CITY",
|
|
24
|
-
/** ISO 4217 — monedas (USD, COP, EUR, etc.) */
|
|
25
|
-
CURRENCY = "CURRENCY",
|
|
26
|
-
/** BCP 47 — idiomas (es, en, pt, etc.) */
|
|
27
|
-
LANGUAGE = "LANGUAGE",
|
|
28
|
-
/** Tipos de canal de comunicación (WhatsApp, Email, Teléfono) */
|
|
29
|
-
COMMUNICATION_CHANNEL_TYPE = "COMMUNICATION_CHANNEL_TYPE",
|
|
30
|
-
/** Tipos de documento de identidad por país (CC, NIT, Pasaporte, etc.) */
|
|
31
|
-
DOCUMENT_TYPE = "DOCUMENT_TYPE",
|
|
32
|
-
/** Días de la semana */
|
|
33
|
-
DAY_OF_WEEK = "DAY_OF_WEEK",
|
|
34
|
-
/** Meses del año */
|
|
35
|
-
MONTH = "MONTH"
|
|
36
|
-
}
|
|
37
|
-
export interface PredefinedSelectorStep extends GSmartSelect {
|
|
38
|
-
type: 'PREDEFINED_SELECTOR';
|
|
39
|
-
predefinedType: PredefinedOptionType;
|
|
40
|
-
/**
|
|
41
|
-
* Solo para STATE y CITY: id del step padre que filtra las opciones.
|
|
42
|
-
* - COUNTRY step → filtra estados del país seleccionado
|
|
43
|
-
* - STATE step → filtra ciudades del estado seleccionado
|
|
44
|
-
*
|
|
45
|
-
* Si no se especifica, se listan todas las opciones sin filtrar.
|
|
46
|
-
*/
|
|
47
|
-
parentStepId?: string;
|
|
48
|
-
maxSize?: number;
|
|
49
|
-
defaultValue?: string;
|
|
50
|
-
}
|
|
51
|
-
export type PredefinedSelectorValue = string;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — PredefinedSelectorFormStep types
|
|
3
|
-
*
|
|
4
|
-
* Paso que reemplaza tener que configurar manualmente opciones de selectores
|
|
5
|
-
* para listas fijas y controladas por Capta (países, ciudades, monedas, etc.).
|
|
6
|
-
* Las opciones vienen de APIs internas — el formulario no necesita configurarlas.
|
|
7
|
-
*
|
|
8
|
-
* También resuelve la cascada Country → State → City via parentStepId.
|
|
9
|
-
*/
|
|
10
|
-
// ===========================================================================
|
|
11
|
-
// Tipos predefinidos disponibles
|
|
12
|
-
// ===========================================================================
|
|
13
|
-
export var PredefinedOptionType;
|
|
14
|
-
(function (PredefinedOptionType) {
|
|
15
|
-
/** ISO 3166-1 — lista de países */
|
|
16
|
-
PredefinedOptionType["COUNTRY"] = "COUNTRY";
|
|
17
|
-
/**
|
|
18
|
-
* Departamento / provincia / estado.
|
|
19
|
-
* Requiere parentStepId apuntando a un step COUNTRY.
|
|
20
|
-
*/
|
|
21
|
-
PredefinedOptionType["STATE"] = "STATE";
|
|
22
|
-
/**
|
|
23
|
-
* Ciudad / municipio.
|
|
24
|
-
* Requiere parentStepId apuntando a un step STATE (o COUNTRY si no hay STATE).
|
|
25
|
-
*/
|
|
26
|
-
PredefinedOptionType["CITY"] = "CITY";
|
|
27
|
-
/** ISO 4217 — monedas (USD, COP, EUR, etc.) */
|
|
28
|
-
PredefinedOptionType["CURRENCY"] = "CURRENCY";
|
|
29
|
-
/** BCP 47 — idiomas (es, en, pt, etc.) */
|
|
30
|
-
PredefinedOptionType["LANGUAGE"] = "LANGUAGE";
|
|
31
|
-
/** Tipos de canal de comunicación (WhatsApp, Email, Teléfono) */
|
|
32
|
-
PredefinedOptionType["COMMUNICATION_CHANNEL_TYPE"] = "COMMUNICATION_CHANNEL_TYPE";
|
|
33
|
-
/** Tipos de documento de identidad por país (CC, NIT, Pasaporte, etc.) */
|
|
34
|
-
PredefinedOptionType["DOCUMENT_TYPE"] = "DOCUMENT_TYPE";
|
|
35
|
-
/** Días de la semana */
|
|
36
|
-
PredefinedOptionType["DAY_OF_WEEK"] = "DAY_OF_WEEK";
|
|
37
|
-
/** Meses del año */
|
|
38
|
-
PredefinedOptionType["MONTH"] = "MONTH";
|
|
39
|
-
})(PredefinedOptionType || (PredefinedOptionType = {}));
|
package/dist/@Types/StepRef.d.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — Sistema de referencias dinámicas entre steps
|
|
3
|
-
*
|
|
4
|
-
* Permite que la configuración de un paso use el valor en tiempo de ejecución
|
|
5
|
-
* de otro step del mismo formulario, en lugar de un literal fijo.
|
|
6
|
-
*
|
|
7
|
-
* Patrón de uso:
|
|
8
|
-
*
|
|
9
|
-
* // Valor fijo definido en la configuración del formulario
|
|
10
|
-
* suffix: { type: 'FIXED', value: 'km' }
|
|
11
|
-
*
|
|
12
|
-
* // Valor tomado del step 'step_unidad' cuando el usuario interactúa
|
|
13
|
-
* suffix: { type: 'STEP_REF', idStep: 'step_unidad', fallback: 'm' }
|
|
14
|
-
*
|
|
15
|
-
* Se puede aplicar a cualquier campo de configuración cuyo valor deba
|
|
16
|
-
* responder a la selección previa del usuario: sufijos, unidades, monedas,
|
|
17
|
-
* títulos dinámicos, límites numéricos, etc.
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Representa un valor estático/literal configurado en tiempo de diseño.
|
|
21
|
-
* No cambia dinámicamente según las respuestas del usuario.
|
|
22
|
-
*
|
|
23
|
-
* @typeParam T - Tipo de dato del valor estático.
|
|
24
|
-
*/
|
|
25
|
-
export interface FixedRef<T> {
|
|
26
|
-
/**
|
|
27
|
-
* Indica que el valor es fijo.
|
|
28
|
-
*/
|
|
29
|
-
type: 'FIXED';
|
|
30
|
-
/**
|
|
31
|
-
* El valor estático de tipo T.
|
|
32
|
-
* @example "km"
|
|
33
|
-
* @example 50
|
|
34
|
-
*/
|
|
35
|
-
value: T;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Referencia dinámica al valor actual de otro step en el mismo formulario.
|
|
39
|
-
* El runtime del formulario sustituye esta referencia por el valor que el usuario
|
|
40
|
-
* haya ingresado en el step indicado.
|
|
41
|
-
*
|
|
42
|
-
* @typeParam TAllowed - Literal(es) de tipo de step permitidos como origen.
|
|
43
|
-
* Por defecto es `string` (cualquier tipo de step). Pasar un literal union
|
|
44
|
-
* permite al Form Builder filtrar la lista de steps disponibles en la UI.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```ts
|
|
48
|
-
* // Referencia a cualquier tipo de step
|
|
49
|
-
* const ref: StepRef = {
|
|
50
|
-
* type: 'STEP_REF',
|
|
51
|
-
* idStep: 'step_unidad_medida',
|
|
52
|
-
* fallback: 'm'
|
|
53
|
-
* }
|
|
54
|
-
*
|
|
55
|
-
* // Referencia restringida únicamente a pasos de tipo LOCATION
|
|
56
|
-
* const refLocation: StepRef<'LOCATION'> = {
|
|
57
|
-
* type: 'STEP_REF',
|
|
58
|
-
* idStep: 'step_destino_cliente',
|
|
59
|
-
* allowedStepTypes: ['LOCATION']
|
|
60
|
-
* }
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export interface StepRef<TAllowed extends string = string> {
|
|
64
|
-
/**
|
|
65
|
-
* Indica que el valor se toma dinámicamente de otro paso.
|
|
66
|
-
*/
|
|
67
|
-
type: 'STEP_REF';
|
|
68
|
-
/**
|
|
69
|
-
* ID del paso origen en el formulario del cual se leerá el valor en tiempo de ejecución.
|
|
70
|
-
* @example "step_ubicacion_cliente"
|
|
71
|
-
*/
|
|
72
|
-
idStep: string;
|
|
73
|
-
/**
|
|
74
|
-
* Valor de respaldo (fallback) en formato de texto a utilizar mientras el paso referenciado
|
|
75
|
-
* no contenga ningún valor (ej: porque el usuario aún no llega a ese paso).
|
|
76
|
-
* Si se omite, el campo referenciador se comportará como vacío o sin unidad.
|
|
77
|
-
*
|
|
78
|
-
* @example "m"
|
|
79
|
-
*/
|
|
80
|
-
fallback?: string;
|
|
81
|
-
/**
|
|
82
|
-
* Lista de tipos de pasos permitidos para esta referencia.
|
|
83
|
-
* Ayuda al Form Builder a filtrar la interfaz de selección de campos y es
|
|
84
|
-
* validada por el backend al guardar la configuración del formulario.
|
|
85
|
-
* Si no se define, se permite referenciar cualquier tipo de paso.
|
|
86
|
-
*
|
|
87
|
-
* @example ["LOCATION"]
|
|
88
|
-
* @example ["PREDEFINED_SELECTOR", "CHECKBOX"]
|
|
89
|
-
*/
|
|
90
|
-
allowedStepTypes?: TAllowed[];
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Tipo genérico para campos que admiten tanto un valor estático como una referencia dinámica.
|
|
94
|
-
*
|
|
95
|
-
* @typeParam T - Tipo del valor cuando es FIXED (ej: `string`, `number`, `boolean`).
|
|
96
|
-
* @typeParam TAllowed - Tipos de paso de origen permitidos si es STEP_REF.
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```ts
|
|
100
|
-
* // Un sufijo de texto dinámico:
|
|
101
|
-
* const sufijo: DynamicRef<string> = { type: 'FIXED', value: 'km' };
|
|
102
|
-
*
|
|
103
|
-
* // Una coordenada geográfica que debe venir de un paso de mapa:
|
|
104
|
-
* const origen: DynamicRef<LocationCoords, 'LOCATION'> = {
|
|
105
|
-
* type: 'STEP_REF',
|
|
106
|
-
* idStep: 'step_mapa_inicio',
|
|
107
|
-
* allowedStepTypes: ['LOCATION']
|
|
108
|
-
* };
|
|
109
|
-
* ```
|
|
110
|
-
*/
|
|
111
|
-
export type DynamicRef<T, TAllowed extends string = string> = FixedRef<T> | StepRef<TAllowed>;
|
|
112
|
-
/**
|
|
113
|
-
* Comprueba si la referencia dinámica recibida es de tipo FIXED.
|
|
114
|
-
* Funciona como Type Guard para TypeScript.
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* ```ts
|
|
118
|
-
* if (isFixedRef(miRef)) {
|
|
119
|
-
* console.log("El valor es:", miRef.value);
|
|
120
|
-
* }
|
|
121
|
-
* ```
|
|
122
|
-
*/
|
|
123
|
-
export declare function isFixedRef<T, TAllowed extends string = string>(ref: DynamicRef<T, TAllowed>): ref is FixedRef<T>;
|
|
124
|
-
/**
|
|
125
|
-
* Comprueba si la referencia dinámica recibida es de tipo STEP_REF.
|
|
126
|
-
* Funciona como Type Guard para TypeScript.
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
129
|
-
* ```ts
|
|
130
|
-
* if (isStepRef(miRef)) {
|
|
131
|
-
* console.log("Apunta al step:", miRef.idStep);
|
|
132
|
-
* }
|
|
133
|
-
* ```
|
|
134
|
-
*/
|
|
135
|
-
export declare function isStepRef<T, TAllowed extends string = string>(ref: DynamicRef<T, TAllowed>): ref is StepRef<TAllowed>;
|
package/dist/@Types/StepRef.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — Sistema de referencias dinámicas entre steps
|
|
3
|
-
*
|
|
4
|
-
* Permite que la configuración de un paso use el valor en tiempo de ejecución
|
|
5
|
-
* de otro step del mismo formulario, en lugar de un literal fijo.
|
|
6
|
-
*
|
|
7
|
-
* Patrón de uso:
|
|
8
|
-
*
|
|
9
|
-
* // Valor fijo definido en la configuración del formulario
|
|
10
|
-
* suffix: { type: 'FIXED', value: 'km' }
|
|
11
|
-
*
|
|
12
|
-
* // Valor tomado del step 'step_unidad' cuando el usuario interactúa
|
|
13
|
-
* suffix: { type: 'STEP_REF', idStep: 'step_unidad', fallback: 'm' }
|
|
14
|
-
*
|
|
15
|
-
* Se puede aplicar a cualquier campo de configuración cuyo valor deba
|
|
16
|
-
* responder a la selección previa del usuario: sufijos, unidades, monedas,
|
|
17
|
-
* títulos dinámicos, límites numéricos, etc.
|
|
18
|
-
*/
|
|
19
|
-
// ---------------------------------------------------------------------------
|
|
20
|
-
// Helpers de narrowing
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
/**
|
|
23
|
-
* Comprueba si la referencia dinámica recibida es de tipo FIXED.
|
|
24
|
-
* Funciona como Type Guard para TypeScript.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* if (isFixedRef(miRef)) {
|
|
29
|
-
* console.log("El valor es:", miRef.value);
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export function isFixedRef(ref) {
|
|
34
|
-
return ref.type === 'FIXED';
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Comprueba si la referencia dinámica recibida es de tipo STEP_REF.
|
|
38
|
-
* Funciona como Type Guard para TypeScript.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* if (isStepRef(miRef)) {
|
|
43
|
-
* console.log("Apunta al step:", miRef.idStep);
|
|
44
|
-
* }
|
|
45
|
-
* ```
|
|
46
|
-
*/
|
|
47
|
-
export function isStepRef(ref) {
|
|
48
|
-
return ref.type === 'STEP_REF';
|
|
49
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { AvailabilityStep } from '../../@Types/CalendarFormStep';
|
|
2
|
-
import { StepProps } from '../Step';
|
|
3
|
-
export interface AvailabilityStepProps extends StepProps {
|
|
4
|
-
step: AvailabilityStep;
|
|
5
|
-
}
|
|
6
|
-
declare function AvailabilityStepComponent(props: AvailabilityStepProps): JSX.Element;
|
|
7
|
-
export default AvailabilityStepComponent;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
3
|
-
import MaterialAvailabilityStep from './MaterialAvailabilityStep/MaterialAvailabilityStep';
|
|
4
|
-
import { useAppSelector } from '../../hooks';
|
|
5
|
-
function AvailabilityStepComponent(props) {
|
|
6
|
-
const { formStyle } = useAppSelector((state) => state.global);
|
|
7
|
-
switch (formStyle.type) {
|
|
8
|
-
case FormStyleTypes.MATERIAL:
|
|
9
|
-
default: {
|
|
10
|
-
return _jsx(MaterialAvailabilityStep, { ...props });
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export default AvailabilityStepComponent;
|
package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AvailabilityStepProps } from '../AvailabilityStep';
|
|
2
|
-
/**
|
|
3
|
-
* Conector del paso AVAILABILITY: pregunta de disponibilidad compacta
|
|
4
|
-
* (grid semanal día × hora). El calendario completo vive en el admin; el form
|
|
5
|
-
* solo captura ventanas disponibles que un paso BOOKING puede consumir.
|
|
6
|
-
*/
|
|
7
|
-
declare function MaterialAvailabilityStep({ step, editable }: AvailabilityStepProps): JSX.Element;
|
|
8
|
-
export default MaterialAvailabilityStep;
|
package/dist/FormSteps/AvailabilityStep/MaterialAvailabilityStep/MaterialAvailabilityStep.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext } from 'react';
|
|
3
|
-
import { useFormStep } from '../../StepHooks';
|
|
4
|
-
import FormContext from '../../../Contexts/FormContext';
|
|
5
|
-
import { selectBreakPoint, useAppSelector } from '../../../hooks';
|
|
6
|
-
import { calcStepWidth } from '../../StepFunctions';
|
|
7
|
-
import ErkAvailabilityPicker from '../../../Shared/ErkAvailabilityPicker/ErkAvailabilityPicker';
|
|
8
|
-
/**
|
|
9
|
-
* Conector del paso AVAILABILITY: pregunta de disponibilidad compacta
|
|
10
|
-
* (grid semanal día × hora). El calendario completo vive en el admin; el form
|
|
11
|
-
* solo captura ventanas disponibles que un paso BOOKING puede consumir.
|
|
12
|
-
*/
|
|
13
|
-
function MaterialAvailabilityStep({ step, editable }) {
|
|
14
|
-
const currentBreakPoint = useAppSelector(selectBreakPoint);
|
|
15
|
-
const { postview, formStyle } = useAppSelector((state) => state.global);
|
|
16
|
-
const formCtx = useContext(FormContext);
|
|
17
|
-
const isReadOnly = !editable || postview;
|
|
18
|
-
const widthStyle = currentBreakPoint <= step.size ? '100%' : calcStepWidth(step.size, formCtx.size);
|
|
19
|
-
const cssVars = {
|
|
20
|
-
width: widthStyle,
|
|
21
|
-
'--eureka-outline': formStyle.outlineColor,
|
|
22
|
-
'--eureka-primary': formStyle.primaryColor,
|
|
23
|
-
'--eureka-text': formStyle.textColor,
|
|
24
|
-
'--eureka-bg': formStyle.standAloneBackgroundColor ?? '#fff',
|
|
25
|
-
};
|
|
26
|
-
const { ref, value, onChange, error } = useFormStep(step, {
|
|
27
|
-
defaultValue: null,
|
|
28
|
-
rules: { required: step.required ? 'Marca tu disponibilidad' : undefined },
|
|
29
|
-
});
|
|
30
|
-
return (_jsx("div", { ref: ref, style: cssVars, children: _jsx(ErkAvailabilityPicker, { value: value, onChange: onChange, label: step.label, description: step.description, minTime: step.minTime, maxTime: step.maxTime, showWeekends: step.showWeekends, timezone: step.timezone, readOnly: isReadOnly, error: error?.message }) }));
|
|
31
|
-
}
|
|
32
|
-
export default MaterialAvailabilityStep;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { BookingStep } from '../../@Types/BookingFormStep';
|
|
2
|
-
import { BookingSlot } from '../../@Types/BookingFormStep';
|
|
3
|
-
import { StepProps } from '../Step';
|
|
4
|
-
export interface BookingStepProps extends StepProps {
|
|
5
|
-
step: BookingStep;
|
|
6
|
-
/**
|
|
7
|
-
* Callback to fetch available slots for a given person + date.
|
|
8
|
-
* The form host wires this to their availability API.
|
|
9
|
-
* If omitted, the component shows an empty slot list.
|
|
10
|
-
*/
|
|
11
|
-
fetchSlots?: (params: {
|
|
12
|
-
personId?: string;
|
|
13
|
-
date: string;
|
|
14
|
-
}) => Promise<BookingSlot[]>;
|
|
15
|
-
}
|
|
16
|
-
declare function BookingStepComponent(props: BookingStepProps): JSX.Element;
|
|
17
|
-
export default BookingStepComponent;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
3
|
-
import MaterialBookingStep from './MaterialBookingStep/MaterialBookingStep';
|
|
4
|
-
import { useAppSelector } from '../../hooks';
|
|
5
|
-
function BookingStepComponent(props) {
|
|
6
|
-
const { formStyle } = useAppSelector((state) => state.global);
|
|
7
|
-
switch (formStyle.type) {
|
|
8
|
-
case FormStyleTypes.MATERIAL:
|
|
9
|
-
default: {
|
|
10
|
-
return _jsx(MaterialBookingStep, { ...props });
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export default BookingStepComponent;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BookingStepProps } from '../BookingStep';
|
|
2
|
-
/**
|
|
3
|
-
* Conector del paso BOOKING: enlaza el estado del formulario (`useFormStep`) y el
|
|
4
|
-
* theming del form con el componente reutilizable `ErkBookingPicker` (en Shared).
|
|
5
|
-
*/
|
|
6
|
-
declare function MaterialBookingStep({ step, editable, fetchSlots }: BookingStepProps): JSX.Element;
|
|
7
|
-
export default MaterialBookingStep;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useContext } from 'react';
|
|
3
|
-
import { useFormStep } from '../../StepHooks';
|
|
4
|
-
import FormContext from '../../../Contexts/FormContext';
|
|
5
|
-
import { selectBreakPoint, useAppSelector } from '../../../hooks';
|
|
6
|
-
import { calcStepWidth } from '../../StepFunctions';
|
|
7
|
-
import ErkBookingPicker from '../../../Shared/ErkBookingPicker/ErkBookingPicker';
|
|
8
|
-
/**
|
|
9
|
-
* Conector del paso BOOKING: enlaza el estado del formulario (`useFormStep`) y el
|
|
10
|
-
* theming del form con el componente reutilizable `ErkBookingPicker` (en Shared).
|
|
11
|
-
*/
|
|
12
|
-
function MaterialBookingStep({ step, editable, fetchSlots }) {
|
|
13
|
-
const currentBreakPoint = useAppSelector(selectBreakPoint);
|
|
14
|
-
const { postview, formStyle } = useAppSelector((state) => state.global);
|
|
15
|
-
const formCtx = useContext(FormContext);
|
|
16
|
-
const isReadOnly = !editable || postview;
|
|
17
|
-
const widthStyle = currentBreakPoint <= step.size ? '100%' : calcStepWidth(step.size, formCtx.size);
|
|
18
|
-
const cssVars = {
|
|
19
|
-
width: widthStyle,
|
|
20
|
-
'--eureka-outline': formStyle.outlineColor,
|
|
21
|
-
'--eureka-primary': formStyle.primaryColor,
|
|
22
|
-
'--eureka-text': formStyle.textColor,
|
|
23
|
-
'--eureka-bg': formStyle.standAloneBackgroundColor ?? '#fff',
|
|
24
|
-
'--booking-accent': formStyle.secondaryContrastColor,
|
|
25
|
-
};
|
|
26
|
-
const { ref, value, onChange, error } = useFormStep(step, {
|
|
27
|
-
defaultValue: null,
|
|
28
|
-
rules: { required: step.required ? 'Selecciona una cita' : undefined },
|
|
29
|
-
});
|
|
30
|
-
return (_jsx("div", { ref: ref, style: cssVars, children: _jsx(ErkBookingPicker, { value: value, onChange: onChange, label: step.label, description: step.description, durationMinutes: step.durationMinutes, bufferMinutes: step.bufferMinutes, bookingMode: step.bookingMode, temporaryLockMinutes: step.temporaryLockMinutes, personSelectionMode: step.personSelectionMode, persons: step.persons, collectContact: step.collectContact, fetchSlots: fetchSlots, readOnly: isReadOnly, error: error?.message }) }));
|
|
31
|
-
}
|
|
32
|
-
export default MaterialBookingStep;
|
package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.lateClassifiers.test.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import userEvent from '@testing-library/user-event';
|
|
4
|
-
import { describe, expect, it } from 'vitest';
|
|
5
|
-
import '@testing-library/jest-dom';
|
|
6
|
-
import { Provider } from 'react-redux';
|
|
7
|
-
import { FormProvider, useForm } from 'react-hook-form';
|
|
8
|
-
import { configureStore } from '@reduxjs/toolkit';
|
|
9
|
-
import { EurekaFormsReducer, defaultRootState } from '../../Utils/store';
|
|
10
|
-
import { RootApi } from '../../Utils/_api';
|
|
11
|
-
import FormStepTypes from '../../constants/FormStepTypes';
|
|
12
|
-
import { StoreContext } from '../../Utils/StoreContext';
|
|
13
|
-
import FormContext, { IdFormContext } from '../../Contexts/FormContext';
|
|
14
|
-
import SectionContext from '../../Contexts/SectionContext';
|
|
15
|
-
import MaterialProviders from '../../Utils/MaterialProviders';
|
|
16
|
-
import InternalFormStyle from '../../constants/InternalFormStyle';
|
|
17
|
-
import ClassifierSelectorStep from './ClassifierSelectorStep';
|
|
18
|
-
const ID_FORM = 'LATE_CLASSIFIERS_FORM';
|
|
19
|
-
const step = {
|
|
20
|
-
id: 'tipo-step',
|
|
21
|
-
idSection: 'SECTION_1',
|
|
22
|
-
stepPath: ['tipo-step'],
|
|
23
|
-
type: FormStepTypes.CLASSIFIER_SELECTOR,
|
|
24
|
-
idClassifier: 'tipo',
|
|
25
|
-
label: 'Tipo de solicitud',
|
|
26
|
-
description: '',
|
|
27
|
-
searchable: true,
|
|
28
|
-
options: {},
|
|
29
|
-
required: false,
|
|
30
|
-
size: 2,
|
|
31
|
-
};
|
|
32
|
-
/** The project's classifiers, as the host resolves them (asynchronously) and passes them to the form. */
|
|
33
|
-
const classifiers = {
|
|
34
|
-
tipo: { _id: 'tipo', name: 'Tipo de solicitud', children: ['bug', 'mejora'] },
|
|
35
|
-
bug: { _id: 'bug', name: 'Error / Bug', children: [] },
|
|
36
|
-
mejora: { _id: 'mejora', name: 'Propuesta de mejora', children: [] },
|
|
37
|
-
};
|
|
38
|
-
const form = {
|
|
39
|
-
firstSection: 'SECTION_1',
|
|
40
|
-
sections: {
|
|
41
|
-
SECTION_1: { id: 'SECTION_1', name: 'Sección 1', steps: ['tipo-step'], nextSection: null },
|
|
42
|
-
},
|
|
43
|
-
steps: { 'tipo-step': step },
|
|
44
|
-
confirmationMessage: { blocks: [], entityMap: {} },
|
|
45
|
-
showLink: false,
|
|
46
|
-
size: { blockSize: 200, blockNum: 4, spacingSize: 10 },
|
|
47
|
-
};
|
|
48
|
-
function makeStore() {
|
|
49
|
-
return configureStore({
|
|
50
|
-
reducer: { forms: EurekaFormsReducer, [RootApi.reducerPath]: RootApi.reducer },
|
|
51
|
-
preloadedState: { forms: { [ID_FORM]: { ...defaultRootState } } },
|
|
52
|
-
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(RootApi.middleware),
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function Harness({ store, formClassifiers, }) {
|
|
56
|
-
const methods = useForm({ mode: 'onTouched' });
|
|
57
|
-
return (_jsx(MaterialProviders, { formStyle: InternalFormStyle, children: _jsx(Provider, { store: store, context: StoreContext, children: _jsx(IdFormContext.Provider, { value: ID_FORM, children: _jsx(FormContext.Provider, { value: { ...form, classifiers: formClassifiers }, children: _jsx(SectionContext.Provider, { value: "SECTION_1", children: _jsx(FormProvider, { ...methods, children: _jsx(ClassifierSelectorStep, { step: step, editable: true }) }) }) }) }) }) }));
|
|
58
|
-
}
|
|
59
|
-
describe('ClassifierSelectorStep with classifiers that arrive after the first render', () => {
|
|
60
|
-
it('renders nothing while the classifiers are unknown, then the selector with its options', async () => {
|
|
61
|
-
const user = userEvent.setup();
|
|
62
|
-
const store = makeStore();
|
|
63
|
-
const { rerender } = render(_jsx(Harness, { store: store, formClassifiers: undefined }));
|
|
64
|
-
expect(screen.queryByRole('combobox')).not.toBeInTheDocument();
|
|
65
|
-
rerender(_jsx(Harness, { store: store, formClassifiers: classifiers }));
|
|
66
|
-
await user.click(await screen.findByRole('combobox'));
|
|
67
|
-
expect(await screen.findByRole('option', { name: 'Error / Bug' })).toBeInTheDocument();
|
|
68
|
-
expect(screen.getByRole('option', { name: 'Propuesta de mejora' })).toBeInTheDocument();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { StepDependency } from '../../Form/Form';
|
|
2
|
-
/**
|
|
3
|
-
* Serializes the current value of a dependency step into the string an entity-picker STEP filter
|
|
4
|
-
* sends as `values.<idProperty>` query param.
|
|
5
|
-
*
|
|
6
|
-
* Entity values (and any id-bearing object) resolve to their id. The answer of a Selector or
|
|
7
|
-
* Classifier step is a `{ label, value }` option: a Selector keeps `value === label`, so its `value`
|
|
8
|
-
* is the text the entity property stores; a Classifier's `value` is the classifier id, which no
|
|
9
|
-
* entity property holds, so it resolves to its `label`. Returns undefined when the dependency has
|
|
10
|
-
* no usable value, so the caller treats the filter as unresolved.
|
|
11
|
-
*/
|
|
12
|
-
export declare function entityValueDependencyValue(dependency: StepDependency | undefined): string | undefined;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import FormStepTypes from '../../constants/FormStepTypes';
|
|
2
|
-
/**
|
|
3
|
-
* Serializes the current value of a dependency step into the string an entity-picker STEP filter
|
|
4
|
-
* sends as `values.<idProperty>` query param.
|
|
5
|
-
*
|
|
6
|
-
* Entity values (and any id-bearing object) resolve to their id. The answer of a Selector or
|
|
7
|
-
* Classifier step is a `{ label, value }` option: a Selector keeps `value === label`, so its `value`
|
|
8
|
-
* is the text the entity property stores; a Classifier's `value` is the classifier id, which no
|
|
9
|
-
* entity property holds, so it resolves to its `label`. Returns undefined when the dependency has
|
|
10
|
-
* no usable value, so the caller treats the filter as unresolved.
|
|
11
|
-
*/
|
|
12
|
-
export function entityValueDependencyValue(dependency) {
|
|
13
|
-
const currentValue = dependency?.value;
|
|
14
|
-
if (currentValue === null || currentValue === undefined || currentValue === '')
|
|
15
|
-
return undefined;
|
|
16
|
-
if (typeof currentValue === 'string')
|
|
17
|
-
return currentValue;
|
|
18
|
-
if (typeof currentValue === 'number' || typeof currentValue === 'boolean')
|
|
19
|
-
return String(currentValue);
|
|
20
|
-
if (currentValue instanceof Date)
|
|
21
|
-
return currentValue.toISOString();
|
|
22
|
-
if (typeof currentValue !== 'object')
|
|
23
|
-
return undefined;
|
|
24
|
-
const record = currentValue;
|
|
25
|
-
// A Selector's `value` is the stored text; every other step's `value` may be an id, so its `label` wins.
|
|
26
|
-
const keys = dependency?.type === FormStepTypes.SELECTOR ? ['_id', 'id', 'value', 'label'] : ['_id', 'id', 'label', 'value'];
|
|
27
|
-
for (const key of keys) {
|
|
28
|
-
const candidate = record[key];
|
|
29
|
-
if (typeof candidate === 'string' && candidate !== '')
|
|
30
|
-
return candidate;
|
|
31
|
-
if (typeof candidate === 'number')
|
|
32
|
-
return String(candidate);
|
|
33
|
-
}
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import FormStepTypes from '../../constants/FormStepTypes';
|
|
3
|
-
import { entityValueDependencyValue } from './entityValueDependencyValue';
|
|
4
|
-
const dep = (type, value) => ({
|
|
5
|
-
idOriginal: 'dep',
|
|
6
|
-
dependents: [],
|
|
7
|
-
type,
|
|
8
|
-
value,
|
|
9
|
-
});
|
|
10
|
-
describe('entityValueDependencyValue', () => {
|
|
11
|
-
test('an unanswered dependency is unresolved', () => {
|
|
12
|
-
expect(entityValueDependencyValue(undefined)).toBeUndefined();
|
|
13
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.SELECTOR, null))).toBeUndefined();
|
|
14
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.SELECTOR, ''))).toBeUndefined();
|
|
15
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.SELECTOR, {}))).toBeUndefined();
|
|
16
|
-
});
|
|
17
|
-
test('plain answers are sent as text', () => {
|
|
18
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.TEXTINPUT, 'Torre 3'))).toBe('Torre 3');
|
|
19
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.TEXTINPUT, 7))).toBe('7');
|
|
20
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.DATEPICKER, new Date('2026-01-02T00:00:00.000Z')))).toBe('2026-01-02T00:00:00.000Z');
|
|
21
|
-
});
|
|
22
|
-
test('an entity value resolves to its id', () => {
|
|
23
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.ENTITYVALUEPICKER, { _id: 'ev-1', label: 'Morros' }))).toBe('ev-1');
|
|
24
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.API_SELECTOR, { id: 'api-1', label: 'X' }))).toBe('api-1');
|
|
25
|
-
});
|
|
26
|
-
test('a selector option resolves to its value, a classifier option to its label', () => {
|
|
27
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.SELECTOR, { label: 'Piso 2', value: 'Piso 2' }))).toBe('Piso 2');
|
|
28
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.SELECTOR, { label: 'Dos', value: '2' }))).toBe('2');
|
|
29
|
-
expect(entityValueDependencyValue(dep(FormStepTypes.CLASSIFIER_SELECTOR, { label: 'Piso 2', value: '65f0c1a2b3c4d5e6f7a8b9c0' }))).toBe('Piso 2');
|
|
30
|
-
});
|
|
31
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { EntityValuePicker } from '../../@Types/FormStep';
|
|
2
|
-
/**
|
|
3
|
-
* The steps an entity picker reads a value from that `step.dependencies` does not already list:
|
|
4
|
-
* the STEP hops of `step.path` and every STEP filter, required or not.
|
|
5
|
-
*
|
|
6
|
-
* `step.dependencies` is recomputed server-side only when the form is saved
|
|
7
|
-
* (`FormDependencyFunctions.calcStepDependencies`), so it describes the form as it was at the last
|
|
8
|
-
* save. In the editor's live preview of an unsaved draft — and in any form whose stored
|
|
9
|
-
* dependencies went stale — a path hop or a filter added since then is missing from it, and the
|
|
10
|
-
* renderer would never watch the step it points at. The picker refetches its options when a watched
|
|
11
|
-
* value changes, so a filter the picker does not watch never triggers the fetch that would honour
|
|
12
|
-
* it: a required one leaves the select stuck with no options at all, an optional one leaves it
|
|
13
|
-
* showing options the filter should have narrowed.
|
|
14
|
-
*
|
|
15
|
-
* The `required` flag is deliberately not consulted: required or not, the filter's value is what
|
|
16
|
-
* has to trigger the refetch. Steps the last save already registered are skipped because the
|
|
17
|
-
* renderer watches `step.dependencies` anyway.
|
|
18
|
-
*/
|
|
19
|
-
export declare function entityValuePickerWatchedSteps(step: EntityValuePicker): string[];
|
|
20
|
-
/**
|
|
21
|
-
* The subset of `entityValuePickerWatchedSteps` whose value the picker cannot do without: every
|
|
22
|
-
* STEP hop of the path, and the STEP filters flagged `required`. Those are exactly the cases where
|
|
23
|
-
* `getEntityValueOptions` gives up and answers `null` — its "dependency not met" contract — so
|
|
24
|
-
* while they hold no value the select has to read as a missing dependency rather than as a failed
|
|
25
|
-
* load.
|
|
26
|
-
*/
|
|
27
|
-
export declare function entityValuePickerBlockingSteps(step: EntityValuePicker): string[];
|