@arquimedes.co/eureka-forms 3.0.46-new-steps → 3.0.48-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/dist/@Types/Condition.d.ts +6 -4
- package/dist/@Types/ErkValue.d.ts +16 -0
- package/dist/@Types/ErkValue.js +1 -0
- package/dist/@Types/Form.d.ts +1 -0
- package/dist/@Types/FormStep.d.ts +8 -1
- package/dist/@Types/User.d.ts +13 -0
- package/dist/@Types/User.js +1 -0
- package/dist/App/App.js +1 -1
- package/dist/App/AppFunctions.js +8 -3
- package/dist/App/AppHooks.js +20 -1
- package/dist/Form/Form.js +6 -2
- package/dist/Form/Form.module.css +48 -39
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +8 -4
- package/dist/FormSteps/CBRStepMapper.js +1 -1
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +2 -2
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +52 -4
- package/dist/FormSteps/StepFunctions.js +6 -9
- package/dist/FormSteps/StepFunctions.test.js +3 -3
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +2 -1
- package/dist/Icons/@ErkIcon.d.ts +2 -2
- package/dist/Icons/@ErkIcon.js +2 -2
- package/dist/Icons/EmailIcon.d.ts +3 -0
- package/dist/Icons/EmailIcon.js +7 -0
- package/dist/Icons/Entities/SchoolIcon.d.ts +3 -0
- package/dist/Icons/Entities/SchoolIcon.js +7 -0
- package/dist/Icons/GroupIcon.d.ts +3 -0
- package/dist/Icons/GroupIcon.js +7 -0
- package/dist/Icons/LockedIcon.d.ts +3 -0
- package/dist/Icons/LockedIcon.js +7 -0
- package/dist/Login/Login.module.css +135 -0
- package/dist/Login/LoginLayout.module.css +68 -0
- package/dist/Login/LoginPage.d.ts +10 -0
- package/dist/Login/LoginPage.js +101 -0
- package/dist/Login/LoginTextField.d.ts +14 -0
- package/dist/Login/LoginTextField.js +29 -0
- package/dist/Services/ApiSelectorService.d.ts +366 -0
- package/dist/Services/ApiSelectorService.js +173 -0
- package/dist/Services/ApiSelectorService.test.d.ts +1 -0
- package/dist/Services/ApiSelectorService.test.js +87 -0
- package/dist/Services/DraftService.js +4 -1
- package/dist/Services/IntegrationService.d.ts +21 -0
- package/dist/Services/IntegrationService.js +22 -0
- package/dist/Services/UserService.d.ts +10 -0
- package/dist/Services/UserService.js +21 -0
- package/dist/Shared/ErkSelect/ErkSelect.d.ts +2 -2
- package/dist/Shared/InputIcon/InputIcon.js +6 -0
- package/dist/Shared/Navbar/Navbar.d.ts +2 -1
- package/dist/Shared/Navbar/Navbar.js +22 -3
- package/dist/Shared/Navbar/Navbar.module.css +22 -8
- package/dist/Shared/SmartDraftRenderer/LinkDecorator.d.ts +14 -0
- package/dist/Shared/SmartDraftRenderer/LinkDecorator.js +48 -0
- package/dist/Shared/SmartDraftRenderer/SmartDraftRenderer.js +8 -2
- package/dist/States/GlobalSlice.d.ts +4 -1
- package/dist/States/GlobalSlice.js +8 -1
- package/dist/constants/ErkIconTypes.d.ts +3 -1
- package/dist/constants/ErkIconTypes.js +2 -0
- package/dist/constants/ErkValueTypes.d.ts +6 -0
- package/dist/constants/ErkValueTypes.js +7 -0
- package/dist/constants/FormStepTypes.d.ts +2 -1
- package/dist/constants/FormStepTypes.js +1 -0
- package/dist/hooks.d.ts +3 -0
- package/dist/hooks.js +17 -1
- package/package.json +10 -3
- package/dist/@Types/AvailabilityFormStep.d.ts +0 -65
- package/dist/@Types/AvailabilityFormStep.js +0 -27
- package/dist/@Types/BankAccountFormStep.d.ts +0 -67
- package/dist/@Types/BankAccountFormStep.js +0 -14
- 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 -136
- package/dist/@Types/LocationFormStep.js +0 -33
- package/dist/@Types/NumericFormSteps.d.ts +0 -171
- package/dist/@Types/NumericFormSteps.js +0 -32
- package/dist/@Types/PredefinedSelectorFormStep.d.ts +0 -51
- package/dist/@Types/PredefinedSelectorFormStep.js +0 -39
- package/dist/@Types/StepRef.d.ts +0 -79
- package/dist/@Types/StepRef.js +0 -27
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — NumericFormSteps types
|
|
3
|
-
* Cubre tres pasos relacionados con números:
|
|
4
|
-
* - NUMBER → entrada numérica con subtipos (integer, decimal, currency, percentage, quantity, rate)
|
|
5
|
-
* - SCORE → calificación numérica con min/max/precision y bandas opcionales
|
|
6
|
-
* - FORMULA → campo calculado (solo lectura), derivado de otros steps
|
|
7
|
-
*/
|
|
8
|
-
import { GBaseStep } from './GenericFormSteps';
|
|
9
|
-
import { DynamicRef } from './StepRef';
|
|
10
|
-
/** Subtipo del paso numérico — discriminante secundario */
|
|
11
|
-
export declare enum NumberStepType {
|
|
12
|
-
INTEGER = "INTEGER",
|
|
13
|
-
DECIMAL = "DECIMAL",
|
|
14
|
-
CURRENCY = "CURRENCY",
|
|
15
|
-
PERCENTAGE = "PERCENTAGE",
|
|
16
|
-
QUANTITY = "QUANTITY",
|
|
17
|
-
RATE = "RATE"
|
|
18
|
-
}
|
|
19
|
-
/** Campos base compartidos por todos los subtipos numéricos */
|
|
20
|
-
interface GNumberStep extends GBaseStep {
|
|
21
|
-
type: 'NUMBER';
|
|
22
|
-
numberType: NumberStepType;
|
|
23
|
-
label: string;
|
|
24
|
-
description: string | null;
|
|
25
|
-
required: boolean;
|
|
26
|
-
min?: number;
|
|
27
|
-
max?: number;
|
|
28
|
-
/** Cantidad de decimales permitidos (0 = entero). Default: 2 */
|
|
29
|
-
decimals?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Sufijo de unidad que se muestra junto al valor (solo visual, no afecta el número guardado).
|
|
32
|
-
* Puede ser fijo ("km", "km/h", "°C") o venir de otro step.
|
|
33
|
-
*
|
|
34
|
-
* Ejemplo con SELECT dinámico:
|
|
35
|
-
* suffix: { type: 'STEP_REF', idStep: 'step_unidad', fallback: 'm' }
|
|
36
|
-
* → el step 'step_unidad' es un selector con opciones: km | m | cm
|
|
37
|
-
*/
|
|
38
|
-
suffix?: DynamicRef<string>;
|
|
39
|
-
size: 1 | 2 | 3 | 4;
|
|
40
|
-
defaultValue?: number;
|
|
41
|
-
}
|
|
42
|
-
export interface IntegerStep extends GNumberStep {
|
|
43
|
-
numberType: NumberStepType.INTEGER;
|
|
44
|
-
/** Siempre 0 para enteros, pero puede dejarse undefined */
|
|
45
|
-
decimals?: 0;
|
|
46
|
-
}
|
|
47
|
-
export interface DecimalStep extends GNumberStep {
|
|
48
|
-
numberType: NumberStepType.DECIMAL;
|
|
49
|
-
}
|
|
50
|
-
export interface PercentageStep extends GNumberStep {
|
|
51
|
-
numberType: NumberStepType.PERCENTAGE;
|
|
52
|
-
}
|
|
53
|
-
export interface CurrencyStep extends GNumberStep {
|
|
54
|
-
numberType: NumberStepType.CURRENCY;
|
|
55
|
-
/**
|
|
56
|
-
* Moneda: fija ("COP", "USD") o tomada de otro step (ej: un SELECT de monedas).
|
|
57
|
-
* null = el usuario elige la moneda en el mismo campo.
|
|
58
|
-
*/
|
|
59
|
-
currency: DynamicRef<string> | null;
|
|
60
|
-
allowCurrencyChange: boolean;
|
|
61
|
-
}
|
|
62
|
-
export interface QuantityStep extends GNumberStep {
|
|
63
|
-
numberType: NumberStepType.QUANTITY;
|
|
64
|
-
/**
|
|
65
|
-
* Unidad fija ("kg", "m", "hrs") o tomada de otro step (ej: un SELECT con km | m | cm).
|
|
66
|
-
* null = el usuario elige la unidad dentro del campo.
|
|
67
|
-
*/
|
|
68
|
-
unit: DynamicRef<string> | null;
|
|
69
|
-
allowUnitChange: boolean;
|
|
70
|
-
availableUnits?: string[];
|
|
71
|
-
}
|
|
72
|
-
export interface RateStep extends GNumberStep {
|
|
73
|
-
numberType: NumberStepType.RATE;
|
|
74
|
-
/** Moneda del rate ("USD") o tomada de otro step. null = usuario elige */
|
|
75
|
-
currency: DynamicRef<string> | null;
|
|
76
|
-
/**
|
|
77
|
-
* Unidad de tiempo/base del rate ("per_hour", "per_month", "per_km") o tomada de otro step.
|
|
78
|
-
* null = usuario elige.
|
|
79
|
-
*/
|
|
80
|
-
unit: DynamicRef<string> | null;
|
|
81
|
-
availableUnits?: string[];
|
|
82
|
-
}
|
|
83
|
-
/** Unión discriminada del paso NUMBER — narrowing por numberType */
|
|
84
|
-
export type NumberStep = IntegerStep | DecimalStep | PercentageStep | CurrencyStep | QuantityStep | RateStep;
|
|
85
|
-
export type IntegerValue = number;
|
|
86
|
-
export type DecimalValue = number;
|
|
87
|
-
export type PercentageValue = number;
|
|
88
|
-
export interface CurrencyValue {
|
|
89
|
-
value: number;
|
|
90
|
-
currency: string;
|
|
91
|
-
}
|
|
92
|
-
export interface QuantityValue {
|
|
93
|
-
value: number;
|
|
94
|
-
unit: string;
|
|
95
|
-
}
|
|
96
|
-
export interface RateValue {
|
|
97
|
-
value: number;
|
|
98
|
-
currency: string;
|
|
99
|
-
unit: string;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Banda de calificación — agrupa un rango numérico bajo una etiqueta.
|
|
103
|
-
* Ej: { label: 'Bajo', min: 0, max: 3, color: '#e53935' }
|
|
104
|
-
*/
|
|
105
|
-
export interface ScoreBand {
|
|
106
|
-
label: string;
|
|
107
|
-
min: number;
|
|
108
|
-
max: number;
|
|
109
|
-
/** Color hex o css para mostrar en la UI */
|
|
110
|
-
color?: string;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Calificación numérica configurable.
|
|
114
|
-
* Diferente de Rating (estrellas/like/escala fija) — Score tiene rango arbitrario.
|
|
115
|
-
* Ej: NPS 0-10, evaluación 0-100, score de riesgo 1-5 con 1 decimal.
|
|
116
|
-
*/
|
|
117
|
-
export interface ScoreStep extends GBaseStep {
|
|
118
|
-
type: 'SCORE';
|
|
119
|
-
label: string;
|
|
120
|
-
description: string | null;
|
|
121
|
-
required: boolean;
|
|
122
|
-
min: number;
|
|
123
|
-
max: number;
|
|
124
|
-
/** Cantidad de decimales. 0 = solo enteros */
|
|
125
|
-
precision: number;
|
|
126
|
-
/**
|
|
127
|
-
* Bandas visuales opcionales (Bajo/Medio/Alto, etc.).
|
|
128
|
-
* Si no se definen, el campo es solo numérico sin categorización.
|
|
129
|
-
*/
|
|
130
|
-
bands?: ScoreBand[];
|
|
131
|
-
size: 1 | 2 | 3 | 4;
|
|
132
|
-
defaultValue?: number;
|
|
133
|
-
}
|
|
134
|
-
export type ScoreValue = number;
|
|
135
|
-
/** Tipo de salida de la fórmula — define cómo se formatea el resultado */
|
|
136
|
-
export declare enum FormulaOutputType {
|
|
137
|
-
NUMBER = "NUMBER",
|
|
138
|
-
CURRENCY = "CURRENCY",
|
|
139
|
-
PERCENTAGE = "PERCENTAGE"
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Campo calculado — siempre readonly, su valor se deriva de otros steps.
|
|
143
|
-
*
|
|
144
|
-
* La expresión usa {{idStep}} para referenciar el valor de otros steps.
|
|
145
|
-
* Ej: "{{precio}} * {{cantidad}} * (1 + {{iva}} / 100)"
|
|
146
|
-
*
|
|
147
|
-
* La evaluación de la fórmula ocurre en el frontend en tiempo real
|
|
148
|
-
* y se valida en backend al guardar.
|
|
149
|
-
*/
|
|
150
|
-
export interface FormulaStep extends GBaseStep {
|
|
151
|
-
type: 'FORMULA';
|
|
152
|
-
label: string;
|
|
153
|
-
description: string | null;
|
|
154
|
-
/**
|
|
155
|
-
* Expresión matemática con referencias a steps entre doble llave.
|
|
156
|
-
* Ej: "{{step_subtotal}} * 1.19"
|
|
157
|
-
*/
|
|
158
|
-
formula: string;
|
|
159
|
-
outputType: FormulaOutputType;
|
|
160
|
-
/** Decimales a mostrar en el resultado */
|
|
161
|
-
precision?: number;
|
|
162
|
-
/** Requerido si outputType === CURRENCY. Puede venir de otro step. */
|
|
163
|
-
currency?: DynamicRef<string>;
|
|
164
|
-
/** Unidad a mostrar si outputType === NUMBER (ej: "m²", "hrs"). Puede venir de otro step. */
|
|
165
|
-
unit?: DynamicRef<string>;
|
|
166
|
-
size: 1 | 2 | 3 | 4;
|
|
167
|
-
/** Siempre true — el usuario no puede editar este campo */
|
|
168
|
-
readonly: true;
|
|
169
|
-
}
|
|
170
|
-
export type FormulaValue = number;
|
|
171
|
-
export {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DRAFT — NumericFormSteps types
|
|
3
|
-
* Cubre tres pasos relacionados con números:
|
|
4
|
-
* - NUMBER → entrada numérica con subtipos (integer, decimal, currency, percentage, quantity, rate)
|
|
5
|
-
* - SCORE → calificación numérica con min/max/precision y bandas opcionales
|
|
6
|
-
* - FORMULA → campo calculado (solo lectura), derivado de otros steps
|
|
7
|
-
*/
|
|
8
|
-
// ===========================================================================
|
|
9
|
-
// NUMBER
|
|
10
|
-
// ===========================================================================
|
|
11
|
-
// NUMBER
|
|
12
|
-
// ===========================================================================
|
|
13
|
-
/** Subtipo del paso numérico — discriminante secundario */
|
|
14
|
-
export var NumberStepType;
|
|
15
|
-
(function (NumberStepType) {
|
|
16
|
-
NumberStepType["INTEGER"] = "INTEGER";
|
|
17
|
-
NumberStepType["DECIMAL"] = "DECIMAL";
|
|
18
|
-
NumberStepType["CURRENCY"] = "CURRENCY";
|
|
19
|
-
NumberStepType["PERCENTAGE"] = "PERCENTAGE";
|
|
20
|
-
NumberStepType["QUANTITY"] = "QUANTITY";
|
|
21
|
-
NumberStepType["RATE"] = "RATE";
|
|
22
|
-
})(NumberStepType || (NumberStepType = {}));
|
|
23
|
-
// ===========================================================================
|
|
24
|
-
// FORMULA
|
|
25
|
-
// ===========================================================================
|
|
26
|
-
/** Tipo de salida de la fórmula — define cómo se formatea el resultado */
|
|
27
|
-
export var FormulaOutputType;
|
|
28
|
-
(function (FormulaOutputType) {
|
|
29
|
-
FormulaOutputType["NUMBER"] = "NUMBER";
|
|
30
|
-
FormulaOutputType["CURRENCY"] = "CURRENCY";
|
|
31
|
-
FormulaOutputType["PERCENTAGE"] = "PERCENTAGE";
|
|
32
|
-
})(FormulaOutputType || (FormulaOutputType = {}));
|
|
@@ -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,79 +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
|
-
/** Valor literal configurado en tiempo de diseño del formulario */
|
|
20
|
-
export interface FixedRef<T> {
|
|
21
|
-
type: 'FIXED';
|
|
22
|
-
value: T;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Referencia al valor actual de otro step en el mismo formulario.
|
|
26
|
-
* El runtime sustituye este ref por el valor que el usuario haya ingresado
|
|
27
|
-
* en el step indicado. Si ese step aún no tiene valor, se usa `fallback`.
|
|
28
|
-
*
|
|
29
|
-
* @typeParam TAllowed - Literal(es) de tipo de step permitidos como origen.
|
|
30
|
-
* Default: `string` (sin restricción). Pasar un literal union restringe
|
|
31
|
-
* qué steps puede seleccionar el form builder en la UI.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* // sin restricción de tipo
|
|
35
|
-
* StepRef
|
|
36
|
-
*
|
|
37
|
-
* // solo puede apuntar a steps LOCATION
|
|
38
|
-
* StepRef<'LOCATION'>
|
|
39
|
-
*
|
|
40
|
-
* // puede apuntar a PREDEFINED_SELECTOR o CHECKBOX
|
|
41
|
-
* StepRef<'PREDEFINED_SELECTOR' | 'CHECKBOX'>
|
|
42
|
-
*/
|
|
43
|
-
export interface StepRef<TAllowed extends string = string> {
|
|
44
|
-
type: 'STEP_REF';
|
|
45
|
-
/** Id del step cuyo valor se usará */
|
|
46
|
-
idStep: string;
|
|
47
|
-
/**
|
|
48
|
-
* Valor de respaldo mientras el step referenciado no tenga valor.
|
|
49
|
-
* Si no se define, el campo aparece vacío/sin unidad.
|
|
50
|
-
*/
|
|
51
|
-
fallback?: string;
|
|
52
|
-
/**
|
|
53
|
-
* Restricción de tipo — puramente declarativa.
|
|
54
|
-
* El form builder filtra la lista de steps disponibles a estos tipos.
|
|
55
|
-
* El backend valida al guardar la configuración.
|
|
56
|
-
*
|
|
57
|
-
* Si no se define, se permite referenciar cualquier step.
|
|
58
|
-
*/
|
|
59
|
-
allowedStepTypes?: TAllowed[];
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Un campo dinámico de tipo T puede ser un valor fijo o una referencia a step.
|
|
63
|
-
*
|
|
64
|
-
* @typeParam T - Tipo del valor cuando es FIXED.
|
|
65
|
-
* @typeParam TAllowed - Tipos de step permitidos en la referencia (default: sin restricción).
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* // sufijo sin restricción de tipo de step
|
|
69
|
-
* DynamicRef<string>
|
|
70
|
-
*
|
|
71
|
-
* // centro de radio — solo puede apuntar a steps LOCATION
|
|
72
|
-
* DynamicRef<LocationCoords, 'LOCATION'>
|
|
73
|
-
*
|
|
74
|
-
* // moneda — solo desde PREDEFINED_SELECTOR o CHECKBOX
|
|
75
|
-
* DynamicRef<string, 'PREDEFINED_SELECTOR' | 'CHECKBOX'>
|
|
76
|
-
*/
|
|
77
|
-
export type DynamicRef<T, TAllowed extends string = string> = FixedRef<T> | StepRef<TAllowed>;
|
|
78
|
-
export declare function isFixedRef<T, TAllowed extends string = string>(ref: DynamicRef<T, TAllowed>): ref is FixedRef<T>;
|
|
79
|
-
export declare function isStepRef<T, TAllowed extends string = string>(ref: DynamicRef<T, TAllowed>): ref is StepRef<TAllowed>;
|
package/dist/@Types/StepRef.js
DELETED
|
@@ -1,27 +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
|
-
export function isFixedRef(ref) {
|
|
23
|
-
return ref.type === 'FIXED';
|
|
24
|
-
}
|
|
25
|
-
export function isStepRef(ref) {
|
|
26
|
-
return ref.type === 'STEP_REF';
|
|
27
|
-
}
|