@arquimedes.co/eureka-forms 2.0.40 → 2.0.42
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/App/AppFunctions.d.ts +2 -0
- package/dist/App/AppFunctions.js +23 -0
- package/dist/Form/FormFunctions.js +7 -3
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +7 -5
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +4 -0
- package/dist/FormSteps/Utils/@StepFiller/StepFiller.js +2 -2
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import { FormStep, Mapper } from '../@Types/FormStep';
|
|
|
3
3
|
import { SiteState, ValuesStore } from '../States/SiteSlice';
|
|
4
4
|
import { CustomStep } from '../FormSteps/CustomStep';
|
|
5
5
|
import { MapperElement } from '../@Types/MapperElement';
|
|
6
|
+
import { Condition } from '../@Types/Condition';
|
|
6
7
|
export declare const calcValuesStore: (form: Readonly<Form>, originalValues?: Record<string, any>, postview?: boolean, customSteps?: Record<string, CustomStep>) => ValuesStore;
|
|
7
8
|
export declare const addMapperStep: <Type>(step: Mapper, customSteps: Record<string, CustomStep>) => {
|
|
8
9
|
element: MapperElement<Type>;
|
|
@@ -12,5 +13,6 @@ export declare const addMapperStep: <Type>(step: Mapper, customSteps: Record<str
|
|
|
12
13
|
steps: Record<string, FormStep>;
|
|
13
14
|
};
|
|
14
15
|
export declare function calcRecursiveData<Type>(element: Readonly<MapperElement<Type>>, newSteps: Record<string, FormStep>, customSteps: Record<string, CustomStep>): void;
|
|
16
|
+
export declare const calcRecursiveCondition: (condition: Condition, ids: Record<string, string>) => void;
|
|
15
17
|
export declare const mapOriginalValue: (step: FormStep, value: any, values: ValuesStore, form?: Readonly<Form>) => any;
|
|
16
18
|
export declare const calcInitialSections: (form: Form) => Pick<SiteState, 'previousSections' | 'idCurrentSection' | 'nextSections'>;
|
package/dist/App/AppFunctions.js
CHANGED
|
@@ -13,6 +13,7 @@ import { nanoid } from 'nanoid';
|
|
|
13
13
|
import StepTypes, { FormTypes } from '../constants/FormStepTypes';
|
|
14
14
|
import { getRawText, stringToDraft } from '../Utils/DraftFunctions';
|
|
15
15
|
import { calcSubSteps } from '../FormSteps/StepFunctions';
|
|
16
|
+
import ConditionTypes from '../constants/ConditionTypes';
|
|
16
17
|
export var calcValuesStore = function (form, originalValues, postview, customSteps) {
|
|
17
18
|
var _a;
|
|
18
19
|
var _b, _c;
|
|
@@ -106,9 +107,31 @@ export function calcRecursiveData(element, newSteps, customSteps) {
|
|
|
106
107
|
if (custom === null || custom === void 0 ? void 0 : custom.calcRecursiveData) {
|
|
107
108
|
custom.calcRecursiveData(step, element.ids);
|
|
108
109
|
}
|
|
110
|
+
if (step.condition) {
|
|
111
|
+
calcRecursiveCondition(step.condition, element.ids);
|
|
112
|
+
}
|
|
109
113
|
calcSubSteps(step.id, newSteps, function (idStep) { var _a; return (_a = element.ids[idStep]) !== null && _a !== void 0 ? _a : idStep; });
|
|
110
114
|
}
|
|
111
115
|
}
|
|
116
|
+
export var calcRecursiveCondition = function (condition, ids) {
|
|
117
|
+
switch (condition.type) {
|
|
118
|
+
case ConditionTypes.EXPRESSION:
|
|
119
|
+
for (var _i = 0, _a = condition.conditions; _i < _a.length; _i++) {
|
|
120
|
+
var subCondition = _a[_i];
|
|
121
|
+
calcRecursiveCondition(subCondition, ids);
|
|
122
|
+
}
|
|
123
|
+
break;
|
|
124
|
+
case ConditionTypes.FORM_STEP: {
|
|
125
|
+
var newId = ids[condition.idStep];
|
|
126
|
+
if (newId) {
|
|
127
|
+
condition.idStep = newId;
|
|
128
|
+
}
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
default:
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
112
135
|
export var mapOriginalValue = function (step, value, values, form) {
|
|
113
136
|
var _a, _b, _c, _d, _e, _f;
|
|
114
137
|
if (!value)
|
|
@@ -130,15 +130,15 @@ export function calcDependencies(steps, customSteps, allSteps, dependencies, val
|
|
|
130
130
|
sections: {},
|
|
131
131
|
}; }
|
|
132
132
|
if (addDependents === void 0) { addDependents = true; }
|
|
133
|
-
|
|
134
|
-
var step = _c[_i];
|
|
133
|
+
var _loop_1 = function (step) {
|
|
135
134
|
var idDeps = calcStepDeps(step);
|
|
136
135
|
for (var _d = 0, idDeps_1 = idDeps; _d < idDeps_1.length; _d++) {
|
|
137
136
|
var idDep = idDeps_1[_d];
|
|
138
137
|
if (dependencies[idDep] === undefined &&
|
|
139
138
|
(addDependents || allSteps[idDep]))
|
|
140
139
|
dependencies[idDep] = calcStepDependency(idDep, allSteps, values, customSteps);
|
|
141
|
-
if (addDependents
|
|
140
|
+
if (addDependents &&
|
|
141
|
+
!dependencies[idDep].dependents.find(function (dep) { return dep.id === step.id; }))
|
|
142
142
|
dependencies[idDep].dependents.push(step);
|
|
143
143
|
}
|
|
144
144
|
if (step.type === StepTypes.ENTITYVALUEPICKER) {
|
|
@@ -161,6 +161,10 @@ export function calcDependencies(steps, customSteps, allSteps, dependencies, val
|
|
|
161
161
|
var hasSubSteps = Object.keys(subSteps).length > 0;
|
|
162
162
|
calcDependencies(hasSubSteps ? subSteps : step.steps, customSteps, __assign(__assign({}, allSteps), subSteps), dependencies, values, hasSubSteps);
|
|
163
163
|
}
|
|
164
|
+
};
|
|
165
|
+
for (var _i = 0, _c = Object.values(steps); _i < _c.length; _i++) {
|
|
166
|
+
var step = _c[_i];
|
|
167
|
+
_loop_1(step);
|
|
164
168
|
}
|
|
165
169
|
return dependencies;
|
|
166
170
|
}
|
|
@@ -38,10 +38,12 @@ function CheckBoxStep(_a) {
|
|
|
38
38
|
return (_jsx(StepComponent, { editable: editable, step: subStep }, idStep));
|
|
39
39
|
}) }));
|
|
40
40
|
};
|
|
41
|
-
return (_jsxs(StepFillerContainer, __assign({ step: step }, { children: [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
return (_jsxs(StepFillerContainer, __assign({ step: step }, { children: [_jsx(MaterialInputContainer, __assign({ step: step, editable: editable }, { children: _jsxs("div", __assign({ className: styles.container }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [step.label && (_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }))), _jsx(RoundedCheckBox, __assign({}, field, { inputRef: ref, onChange: onChange, "data-testid": step.id, padding: "0px", size: "1.6rem", error: !!error, cantEdit: !editable || postview, checkedColor: formStyle.primaryColor, uncheckedColor: formStyle.outlineColor, checked: value }))] })), (step.description || !!error) && (_jsx("div", __assign({ className: styles.descriptionPar, style: {
|
|
42
|
+
color: error
|
|
43
|
+
? formStyle.errorColor
|
|
44
|
+
: formStyle.descriptionTextColor,
|
|
45
|
+
} }, { children: error
|
|
46
|
+
? 'Este campo es obligatorio'
|
|
47
|
+
: step.description })))] })) })), renderNested()] })));
|
|
46
48
|
}
|
|
47
49
|
export default CheckBoxStep;
|
|
@@ -29,9 +29,9 @@ function StepFiller(_a) {
|
|
|
29
29
|
if (step.maxSize && step.maxSize < form.size.blockNum) {
|
|
30
30
|
return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
|
|
31
31
|
width: currentBreakPoint <= step.size ? '100%' : 'fit-content',
|
|
32
|
-
} }, { children: [_jsx(SizeChangeContext.Provider, __assign({ value: handleSizeChange }, { children: children })), _jsx("div", { className: styles.smallSeparator, style: {
|
|
32
|
+
} }, { children: [_jsx(SizeChangeContext.Provider, __assign({ value: handleSizeChange }, { children: children })), fillerSize > 0 && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
33
33
|
width: fillerSize,
|
|
34
|
-
} })] })));
|
|
34
|
+
} }))] })));
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
37
|
return (_jsxs(SizeChangeContext.Provider, __assign({ value: handleSizeChange }, { children: [children, step.maxSize && _jsx("div", { className: styles.separator })] })));
|