@arquimedes.co/eureka-forms 1.9.134 → 2.0.1-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/Form.d.ts +1 -1
- package/dist/@Types/FormStep.d.ts +2 -2
- package/dist/@Types/GenericFormSteps.d.ts +1 -0
- package/dist/App/App.css +6 -0
- package/dist/{App.d.ts → App/App.d.ts} +13 -21
- package/dist/App/App.js +76 -0
- package/dist/App/AppFunctions.d.ts +17 -0
- package/dist/App/AppFunctions.js +210 -0
- package/dist/App/AppHooks.d.ts +10 -0
- package/dist/App/AppHooks.js +235 -0
- package/dist/Contexts/CustomContext.d.ts +11 -0
- package/dist/Contexts/CustomContext.js +6 -0
- package/dist/Contexts/FormContext.d.ts +4 -0
- package/dist/Contexts/FormContext.js +19 -0
- package/dist/Contexts/SectionContext.d.ts +3 -0
- package/dist/Contexts/SectionContext.js +3 -0
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.d.ts +2 -4
- package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +3 -1
- package/dist/Form/Form.d.ts +17 -34
- package/dist/Form/Form.js +73 -124
- package/dist/Form/FormFunctions.d.ts +5 -4
- package/dist/Form/FormFunctions.js +24 -25
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.d.ts +1 -1
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.js +34 -58
- package/dist/Form/FormTypes/ColumnForm/ColumnForm.module.css +0 -4
- package/dist/Form/FormTypes/StepperForm/StepperForm.d.ts +1 -1
- package/dist/Form/FormTypes/StepperForm/StepperForm.js +122 -3
- package/dist/Form/FormTypes/StepperForm/StepperForm.module.css +53 -0
- package/dist/Form/Hooks.d.ts +9 -0
- package/dist/Form/Hooks.js +7 -0
- package/dist/Form/Section/MaterialSection/MaterialSection.d.ts +1 -1
- package/dist/Form/Section/MaterialSection/MaterialSection.js +15 -16
- package/dist/Form/Section/Section.d.ts +2 -34
- package/dist/Form/Section/Section.js +11 -5
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.d.ts +1 -1
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +19 -14
- package/dist/Form/Terms/Term/Term.d.ts +1 -8
- package/dist/Form/Terms/Term/Term.js +3 -1
- package/dist/Form/Terms/Terms.d.ts +1 -2
- package/dist/Form/Terms/Terms.js +17 -8
- package/dist/Form/Terms/Terms.module.css +3 -0
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.d.ts +3 -3
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +49 -38
- package/dist/FormSteps/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +3 -1
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +2 -2
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +11 -5
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +29 -27
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.module.css +0 -6
- package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +39 -31
- package/dist/FormSteps/AYFStepMapper.js +42 -43
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.d.ts +1 -1
- package/dist/FormSteps/ApiSelectorStep/ApiSelectorStep.js +4 -14
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +84 -97
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.module.css +0 -9
- package/dist/FormSteps/CBRStepMapper.js +78 -74
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.d.ts +1 -1
- package/dist/FormSteps/CheckBoxStep/CheckBoxStep.js +4 -14
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +33 -26
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +17 -0
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +1 -1
- package/dist/FormSteps/ClassifierSelectorStep/ClassifierSelectorStep.js +4 -14
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +34 -27
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.d.ts +1 -1
- package/dist/FormSteps/CollapsibleStep/CollapsibleStep.js +4 -2
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +16 -11
- package/dist/FormSteps/CustomStep.d.ts +22 -0
- package/dist/FormSteps/CustomStep.js +37 -0
- package/dist/FormSteps/DatePickerStep/DatePickerStep.js +3 -1
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +1 -1
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +26 -14
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.d.ts +1 -1
- package/dist/FormSteps/EntityValueStep/EntityValuePickerStep.js +4 -14
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +93 -112
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.module.css +0 -9
- package/dist/FormSteps/FileUploadStep/FileUploadStep.js +3 -1
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +1 -1
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +1 -1
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.module.css +0 -7
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +32 -18
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +0 -7
- package/dist/FormSteps/MapperStep/MapperStep.d.ts +2 -2
- package/dist/FormSteps/MapperStep/MapperStep.js +4 -14
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.d.ts +1 -9
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.js +7 -2
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElement.d.ts +3 -2
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElement.js +18 -10
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.d.ts +1 -9
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.js +7 -2
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +1 -1
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +44 -228
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.module.css +0 -7
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.js +30 -14
- package/dist/FormSteps/RatingStep/RatingStep.js +3 -1
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +36 -26
- package/dist/FormSteps/SelectorStep/SelectorStep.d.ts +1 -1
- package/dist/FormSteps/SelectorStep/SelectorStep.js +4 -14
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +1 -1
- package/dist/FormSteps/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +3 -1
- package/dist/FormSteps/SeparatorStep/SeparatorStep.d.ts +1 -1
- package/dist/FormSteps/SeparatorStep/SeparatorStep.js +4 -14
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +5 -2
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +119 -199
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.d.ts +9 -10
- package/dist/FormSteps/SmartSelectStep/SmartSelectStep.js +3 -1
- package/dist/FormSteps/Step.d.ts +3 -4
- package/dist/FormSteps/Step.js +12 -8
- package/dist/FormSteps/StepFunctions.d.ts +10 -0
- package/dist/FormSteps/StepFunctions.js +156 -1
- package/dist/FormSteps/StepHooks.d.ts +23 -0
- package/dist/FormSteps/StepHooks.js +87 -0
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.d.ts +10 -0
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.js +148 -0
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +1 -6
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +40 -186
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +0 -9
- package/dist/FormSteps/TextAreaStep/TextAreaStep.js +8 -2
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +1 -1
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +43 -42
- package/dist/FormSteps/TextInputStep/TextInputStep.js +3 -1
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +11 -6
- package/dist/FormSteps/TitleStep/TitleStep.d.ts +1 -1
- package/dist/FormSteps/TitleStep/TitleStep.js +4 -14
- package/dist/Icons/Construction/LeakIcon.d.ts +2 -2
- package/dist/Icons/Construction/LeakIcon.js +2 -1
- package/dist/Icons/Construction/ProjectIcon.d.ts +2 -2
- package/dist/Icons/Construction/ProjectIcon.js +2 -1
- package/dist/Icons/Construction/PropertyIcon.d.ts +2 -2
- package/dist/Icons/Construction/PropertyIcon.js +2 -1
- package/dist/Icons/Construction/SpaceIcon.d.ts +2 -2
- package/dist/Icons/Construction/SpaceIcon.js +2 -1
- package/dist/Icons/DocumentIcon.d.ts +2 -2
- package/dist/Icons/DocumentIcon.js +2 -1
- package/dist/Icons/Entities/CheckListIcon.d.ts +2 -2
- package/dist/Icons/Entities/CheckListIcon.js +2 -1
- package/dist/Icons/Entities/GenericEntityIcon.d.ts +2 -1
- package/dist/Icons/Entities/GenericEntityIcon.js +1 -1
- package/dist/Icons/Entities/HandshakeIcon.d.ts +2 -1
- package/dist/Icons/Entities/HandshakeIcon.js +1 -1
- package/dist/Icons/Entities/SupplierIcon.d.ts +2 -1
- package/dist/Icons/Entities/SupplierIcon.js +4 -1
- package/dist/{controllers → Services}/FileService.d.ts +1 -1
- package/dist/{controllers → Services}/FileService.js +5 -5
- package/dist/Services/FormService.d.ts +5 -0
- package/dist/Services/FormService.js +59 -0
- package/dist/Services/OrganizationService.d.ts +2 -0
- package/dist/Services/OrganizationService.js +65 -0
- package/dist/Shared/Navbar/Navbar.module.css +8 -0
- package/dist/{shared → Shared}/Rating/Rating.d.ts +1 -1
- package/dist/Shared/Rating/Rating.module.css +18 -0
- package/dist/{shared → Shared}/Rating/Ratings/LikeRating.js +5 -5
- package/dist/{shared → Shared}/Rating/Ratings/SatisfactionRating.js +9 -9
- package/dist/{shared → Shared}/Rating/Ratings/ScaleRating.js +1 -2
- package/dist/{shared → Shared}/RoundedCheckBox/RoundedCheckBox.d.ts +1 -1
- package/dist/{shared → Shared}/RoundedSmartSelect/RoundedSmartSelect.js +4 -4
- package/dist/{shared → Shared}/RoundedTextField/RoundedTextField.d.ts +1 -1
- package/dist/{shared → Shared}/RoundedTextField/RoundedTextField.js +3 -2
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.d.ts +24 -0
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.js +25 -0
- package/dist/States/GlobalStateReducer.d.ts +35 -0
- package/dist/States/GlobalStateReducer.js +34 -0
- package/dist/States/SiteStateReducer.d.ts +63 -0
- package/dist/States/SiteStateReducer.js +110 -0
- package/dist/States/WidthStatsStateReducer.d.ts +11 -0
- package/dist/States/WidthStatsStateReducer.js +64 -0
- package/dist/Utils/DraftFunctions.d.ts +3 -0
- package/dist/Utils/DraftFunctions.js +42 -0
- package/dist/Utils/MaterialProviders.d.ts +6 -0
- package/dist/Utils/MaterialProviders.js +31 -0
- package/dist/Utils/store.d.ts +25 -0
- package/dist/Utils/store.js +52 -0
- package/dist/Widget.js +3 -3
- package/dist/constants/CBRFormStepTypes.d.ts +2 -2
- package/dist/constants/CBRFormStepTypes.js +22 -22
- package/dist/hooks.d.ts +5 -0
- package/dist/hooks.js +7 -0
- package/dist/index.js +1 -1
- package/dist/index.lib.d.ts +1 -1
- package/dist/index.lib.js +1 -1
- package/package.json +63 -44
- package/dist/App.js +0 -472
- package/dist/shared/Navbar/Navbar.module.css +0 -18
- package/dist/shared/Rating/Rating.module.css +0 -32
- package/dist/{App.module.css → App/App.module.css} +0 -0
- package/dist/{shared → Shared}/InputIcon/InputIcon.d.ts +0 -0
- package/dist/{shared → Shared}/InputIcon/InputIcon.js +0 -0
- package/dist/{shared → Shared}/Loader/Loader.d.ts +0 -0
- package/dist/{shared → Shared}/Loader/Loader.js +0 -0
- package/dist/{shared → Shared}/Loader/Loader.module.css +0 -0
- package/dist/{shared → Shared}/Navbar/Navbar.d.ts +0 -0
- package/dist/{shared → Shared}/Navbar/Navbar.js +0 -0
- package/dist/{shared → Shared}/Rating/Rating.js +2 -2
- /package/dist/{shared → Shared}/Rating/Ratings/LikeRating.d.ts +0 -0
- /package/dist/{shared → Shared}/Rating/Ratings/SatisfactionRating.d.ts +0 -0
- /package/dist/{shared → Shared}/Rating/Ratings/ScaleRating.d.ts +0 -0
- /package/dist/{shared → Shared}/RoundedButton/RoundedButton.d.ts +0 -0
- /package/dist/{shared → Shared}/RoundedButton/RoundedButton.js +0 -0
- /package/dist/{shared → Shared}/RoundedCheckBox/RoundedCheckBox.js +0 -0
- /package/dist/{shared → Shared}/RoundedDatePicker/RoundedDatePicker.d.ts +0 -0
- /package/dist/{shared → Shared}/RoundedDatePicker/RoundedDatePicker.js +0 -0
- /package/dist/{shared → Shared}/RoundedSelect/RoundedSelect.d.ts +0 -0
- /package/dist/{shared → Shared}/RoundedSelect/RoundedSelect.js +0 -0
- /package/dist/{shared → Shared}/RoundedSmartSelect/RoundedSmartSelect.d.ts +0 -0
- /package/dist/{AxiosAPI.d.ts → Utils/AxiosAPI.d.ts} +0 -0
- /package/dist/{AxiosAPI.js → Utils/AxiosAPI.js} +0 -0
- /package/dist/{AxiosWidget.d.ts → Utils/AxiosWidget.d.ts} +0 -0
- /package/dist/{AxiosWidget.js → Utils/AxiosWidget.js} +0 -0
- /package/dist/{utils/CbrFunctions.d.ts → Utils/CBRFunctions.d.ts} +0 -0
- /package/dist/{utils/CbrFunctions.js → Utils/CBRFunctions.js} +0 -0
|
@@ -31,23 +31,28 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
31
31
|
};
|
|
32
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
33
|
import { createElement as _createElement } from "react";
|
|
34
|
-
import React, { useState, useEffect,
|
|
34
|
+
import React, { useState, useEffect, useContext, useMemo } from 'react';
|
|
35
35
|
import styles from './MaterialMapperStep.module.css';
|
|
36
|
-
import { Controller } from 'react-hook-form';
|
|
37
|
-
import
|
|
38
|
-
import RoundedButton from '../../../
|
|
39
|
-
import { nanoid } from 'nanoid';
|
|
36
|
+
import { Controller, useFormContext } from 'react-hook-form';
|
|
37
|
+
import { MapperStyleTypes } from '../../../constants/FormStepTypes';
|
|
38
|
+
import RoundedButton from '../../../Shared/RoundedButton/RoundedButton';
|
|
40
39
|
import MapperElementComponent from './Element/MapperElement';
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import {
|
|
44
|
-
import
|
|
40
|
+
import { addStepsDependencies } from '../../../States/SiteStateReducer';
|
|
41
|
+
import FormContext from '../../../Contexts/FormContext';
|
|
42
|
+
import { useAppDispatch, useAppSelector } from '../../../hooks';
|
|
43
|
+
import CustomContext from '../../../Contexts/CustomContext';
|
|
44
|
+
import { useStepDependency } from '../../StepHooks';
|
|
45
|
+
import { addMapperStep, calcRecursiveData } from '../../../App/AppFunctions';
|
|
45
46
|
export function ElementsComponent(_a) {
|
|
46
|
-
var _b,
|
|
47
|
-
var
|
|
48
|
-
var
|
|
47
|
+
var step = _a.step, inputRef = _a.inputRef, editable = _a.editable, elements = _a.elements, customAdd = _a.customAdd, _b = _a.loading, loading = _b === void 0 ? false : _b, others = __rest(_a, ["step", "inputRef", "editable", "elements", "customAdd", "loading"]);
|
|
48
|
+
var form = useContext(FormContext);
|
|
49
|
+
var _c = useAppSelector(function (state) { return state.global; }), formStyle = _c.formStyle, postview = _c.postview;
|
|
50
|
+
var customSteps = useContext(CustomContext).customSteps;
|
|
51
|
+
var dispatch = useAppDispatch();
|
|
52
|
+
var _d = useFormContext(), setValue = _d.setValue, errors = _d.formState.errors;
|
|
53
|
+
var handleStepDep = useStepDependency(step).handleStepDep;
|
|
49
54
|
/** Mapper Steps to pass down */
|
|
50
|
-
var
|
|
55
|
+
var _e = useState((function () {
|
|
51
56
|
var _a;
|
|
52
57
|
var newSteps = {};
|
|
53
58
|
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) {
|
|
@@ -61,70 +66,32 @@ export function ElementsComponent(_a) {
|
|
|
61
66
|
elemSteps[newIdStep] = baseStep;
|
|
62
67
|
newSteps[newIdStep] = baseStep;
|
|
63
68
|
}
|
|
64
|
-
calcRecursiveData(element, elemSteps,
|
|
69
|
+
calcRecursiveData(element, elemSteps, customSteps);
|
|
65
70
|
}
|
|
66
71
|
return newSteps;
|
|
67
|
-
})()), localSteps =
|
|
72
|
+
})()), localSteps = _e[0], setLocalSteps = _e[1];
|
|
68
73
|
var onChange = function (elements) {
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
var _a;
|
|
72
|
-
var _b;
|
|
73
|
-
return (__assign(__assign({}, dependencyStore), (_a = {}, _a[step.id] = {
|
|
74
|
-
type: step.type,
|
|
75
|
-
value: (_b = elements.map(function (element) { return element.value; })) !== null && _b !== void 0 ? _b : null,
|
|
76
|
-
}, _a)));
|
|
77
|
-
});
|
|
78
|
-
}
|
|
74
|
+
if (customAdd)
|
|
75
|
+
handleStepDep(elements.map(function (element) { return element.value; }));
|
|
79
76
|
others.onChange(elements);
|
|
80
77
|
};
|
|
81
78
|
useEffect(function () {
|
|
82
|
-
if (
|
|
83
|
-
if (
|
|
84
|
-
|
|
85
|
-
editable &&
|
|
86
|
-
step.creatable) {
|
|
87
|
-
if (!customAdd)
|
|
88
|
-
handleAddElement();
|
|
89
|
-
}
|
|
90
|
-
setFirstRender(false);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
onChange([]);
|
|
79
|
+
if (elements.length === 0 && !postview && editable && step.creatable) {
|
|
80
|
+
if (!customAdd)
|
|
81
|
+
handleAddElement();
|
|
94
82
|
}
|
|
95
|
-
},
|
|
83
|
+
}, []);
|
|
96
84
|
var handleAddElement = function (value) {
|
|
97
|
-
var
|
|
98
|
-
var newElement = {
|
|
99
|
-
ids: {},
|
|
100
|
-
id: idElement,
|
|
101
|
-
originalValues: {},
|
|
102
|
-
isOriginal: false,
|
|
103
|
-
};
|
|
85
|
+
var _a = addMapperStep(step, customSteps), element = _a.element, steps = _a.steps, mappers = _a.mappers;
|
|
104
86
|
if (value)
|
|
105
|
-
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
var idStep = _a[_i];
|
|
110
|
-
var baseStep = JSON.parse(JSON.stringify(step.steps[idStep]));
|
|
111
|
-
var newIdStep = step.id + '-' + idStep + '-' + idElement;
|
|
112
|
-
baseStep.id = newIdStep;
|
|
113
|
-
newElement.ids[idStep] = newIdStep;
|
|
114
|
-
newSteps[newIdStep] = baseStep;
|
|
115
|
-
if (baseStep.type === StepTypes.MAPPER) {
|
|
116
|
-
addInitialMapper(newValues, baseStep);
|
|
117
|
-
}
|
|
87
|
+
element.value = value;
|
|
88
|
+
for (var _i = 0, _b = Object.entries(mappers); _i < _b.length; _i++) {
|
|
89
|
+
var _c = _b[_i], key = _c[0], elems = _c[1];
|
|
90
|
+
setValue(key, elems);
|
|
118
91
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
var deps = __assign({}, dependencyStore);
|
|
124
|
-
calcRecursiveData(newElement, newSteps, deps, others.customSteps);
|
|
125
|
-
onChange(__spreadArray(__spreadArray([], elements, true), [newElement], false));
|
|
126
|
-
setLocalSteps(__assign(__assign({}, localSteps), newSteps));
|
|
127
|
-
setDependencyStore(deps);
|
|
92
|
+
onChange(__spreadArray(__spreadArray([], elements, true), [element], false));
|
|
93
|
+
setLocalSteps(__assign(__assign({}, localSteps), steps));
|
|
94
|
+
dispatch(addStepsDependencies({ steps: steps, customSteps: customSteps }));
|
|
128
95
|
};
|
|
129
96
|
var calcStyles = function () {
|
|
130
97
|
var _a;
|
|
@@ -136,13 +103,14 @@ export function ElementsComponent(_a) {
|
|
|
136
103
|
return { container: styles.pillContainer };
|
|
137
104
|
}
|
|
138
105
|
};
|
|
106
|
+
var subForm = useMemo(function () { return (__assign(__assign({}, form), { steps: __assign(__assign({}, form.steps), localSteps) })); }, [localSteps]);
|
|
139
107
|
var container = calcStyles().container;
|
|
140
108
|
var mapElements = function () {
|
|
141
|
-
return elements.map(function (element, index) { return (_createElement(MapperElementComponent, __assign({}, others, { key: element.id, num: index, loading: loading, element: element,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
109
|
+
return (_jsx(FormContext.Provider, __assign({ value: subForm }, { children: elements.map(function (element, index) { return (_createElement(MapperElementComponent, __assign({}, others, { key: element.id, num: index, loading: loading, element: element, step: step, editable: editable, handleDelete: function () {
|
|
110
|
+
var tempElements = __spreadArray([], elements, true);
|
|
111
|
+
tempElements[index] = __assign(__assign({}, tempElements[index]), { deleted: true });
|
|
112
|
+
onChange(tempElements);
|
|
113
|
+
} }))); }) })));
|
|
146
114
|
};
|
|
147
115
|
if (step.style.type === MapperStyleTypes.INLINE)
|
|
148
116
|
return _jsx(React.Fragment, { children: mapElements() });
|
|
@@ -150,20 +118,16 @@ export function ElementsComponent(_a) {
|
|
|
150
118
|
margin: step.description
|
|
151
119
|
? '10px 0px'
|
|
152
120
|
: '0px 0px 5px 0px',
|
|
153
|
-
} }, { children: step.description }))), mapElements(), _jsx("input", { ref: inputRef, className:
|
|
121
|
+
} }, { children: step.description }))), mapElements(), _jsx("input", { ref: inputRef, className: 'hidden-input' }), step.creatable !== false && (_jsxs("div", __assign({ className: styles.btnContainer }, { children: [!customAdd && (_jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel + (step.required ? ' *' : ''), color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
|
154
122
|
if (editable && !postview) {
|
|
155
123
|
handleAddElement();
|
|
156
124
|
}
|
|
157
|
-
} })), customAdd &&
|
|
158
|
-
cloneElement(customAdd, {
|
|
159
|
-
inputRef: inputRef,
|
|
160
|
-
disabled: !editable || postview,
|
|
161
|
-
handleAddElement: handleAddElement,
|
|
162
|
-
})] }))), !!errors[step.id] &&
|
|
125
|
+
} })), customAdd === null || customAdd === void 0 ? void 0 : customAdd(inputRef, !editable || postview, handleAddElement)] }))), !!errors[step.id] &&
|
|
163
126
|
elements.filter(function (elem) { return !elem.deleted; }).length === 0 && (_jsx("div", __assign({ className: styles.errorMsg, style: { color: formStyle.errorColor } }, { children: "Este campo es obligatorio" })))] })));
|
|
164
127
|
}
|
|
165
128
|
function MapperStep(props) {
|
|
166
|
-
|
|
129
|
+
var originalValue = useStepDependency(props.step).originalValue;
|
|
130
|
+
return (_jsx(Controller, { name: props.step.id, defaultValue: originalValue, rules: {
|
|
167
131
|
validate: function (array) {
|
|
168
132
|
return (props.step.required &&
|
|
169
133
|
array.filter(function (elem) { return !elem.deleted; }).length > 0) ||
|
|
@@ -175,151 +139,3 @@ function MapperStep(props) {
|
|
|
175
139
|
} }));
|
|
176
140
|
}
|
|
177
141
|
export default MapperStep;
|
|
178
|
-
function calcRecursiveData(element, newSteps, deps, customSteps, originalValues) {
|
|
179
|
-
var _a;
|
|
180
|
-
if (originalValues === void 0) { originalValues = {}; }
|
|
181
|
-
if (!newSteps)
|
|
182
|
-
return;
|
|
183
|
-
for (var _i = 0, _b = Object.keys(newSteps); _i < _b.length; _i++) {
|
|
184
|
-
var idStep = _b[_i];
|
|
185
|
-
var step = newSteps[idStep];
|
|
186
|
-
if (step.dependencies) {
|
|
187
|
-
for (var i = 0; i < step.dependencies.length; i++) {
|
|
188
|
-
var idDep = step.dependencies[i];
|
|
189
|
-
var newId = element.ids[idDep];
|
|
190
|
-
if (newId) {
|
|
191
|
-
step.dependencies[i] = newId;
|
|
192
|
-
deps[newId] = calcStepDependency(newId, newSteps, originalValues, customSteps);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
var custom = customSteps[step === null || step === void 0 ? void 0 : step.type];
|
|
197
|
-
if (custom === null || custom === void 0 ? void 0 : custom.calcRecursiveData) {
|
|
198
|
-
custom.calcRecursiveData(step, element.ids);
|
|
199
|
-
}
|
|
200
|
-
switch (step.type) {
|
|
201
|
-
case StepTypes.SELECTOR: {
|
|
202
|
-
for (var _c = 0, _d = step.options; _c < _d.length; _c++) {
|
|
203
|
-
var option = _d[_c];
|
|
204
|
-
if (option.type === OptionTypes.NESTED) {
|
|
205
|
-
for (var i = 0; i < option.steps.length; i++) {
|
|
206
|
-
var idStep_1 = option.steps[i];
|
|
207
|
-
var newId = element.ids[idStep_1];
|
|
208
|
-
option.steps[i] = newId;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
break;
|
|
213
|
-
}
|
|
214
|
-
case StepTypes.CLASSIFIER_SELECTOR:
|
|
215
|
-
for (var _e = 0, _f = Object.keys(step.options); _e < _f.length; _e++) {
|
|
216
|
-
var idOption = _f[_e];
|
|
217
|
-
var option = step.options[idOption];
|
|
218
|
-
if (option.type === ClassifierOptionTypes.NESTED) {
|
|
219
|
-
for (var i = 0; i < option.steps.length; i++) {
|
|
220
|
-
var idStep_2 = option.steps[i];
|
|
221
|
-
var newId = element.ids[idStep_2];
|
|
222
|
-
option.steps[i] = newId;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
break;
|
|
227
|
-
case StepTypes.RATING:
|
|
228
|
-
if (step.nestedSteps) {
|
|
229
|
-
for (var _g = 0, _h = step.nestedSteps; _g < _h.length; _g++) {
|
|
230
|
-
var steps = _h[_g];
|
|
231
|
-
for (var i = 0; i < steps.length; i++) {
|
|
232
|
-
var idStep_3 = steps[i];
|
|
233
|
-
var newId = element.ids[idStep_3];
|
|
234
|
-
steps[i] = newId;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
break;
|
|
239
|
-
case StepTypes.COLLAPSIBLE: {
|
|
240
|
-
for (var i = 0; i < step.steps.length; i++) {
|
|
241
|
-
var idStep_4 = step.steps[i];
|
|
242
|
-
var newId = element.ids[idStep_4];
|
|
243
|
-
step.steps[i] = newId;
|
|
244
|
-
}
|
|
245
|
-
break;
|
|
246
|
-
}
|
|
247
|
-
case StepTypes.CHECKBOX: {
|
|
248
|
-
if (step.steps)
|
|
249
|
-
for (var i = 0; i < step.steps.length; i++) {
|
|
250
|
-
var idStep_5 = step.steps[i];
|
|
251
|
-
var newId = element.ids[idStep_5];
|
|
252
|
-
step.steps[i] = newId;
|
|
253
|
-
}
|
|
254
|
-
if (step.uncheckedSteps)
|
|
255
|
-
for (var i = 0; i < step.uncheckedSteps.length; i++) {
|
|
256
|
-
var idStep_6 = step.uncheckedSteps[i];
|
|
257
|
-
var newId = element.ids[idStep_6];
|
|
258
|
-
step.uncheckedSteps[i] = newId;
|
|
259
|
-
}
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
case StepTypes.ENTITYVALUEPICKER:
|
|
263
|
-
for (var _j = 0, _k = step.path; _j < _k.length; _j++) {
|
|
264
|
-
var path = _k[_j];
|
|
265
|
-
switch (path.type) {
|
|
266
|
-
case EntityValueDataTypes.STEP:
|
|
267
|
-
var newId = element.ids[path.idStep];
|
|
268
|
-
if (newId) {
|
|
269
|
-
path.idStep = newId;
|
|
270
|
-
deps[newId] = calcStepDependency(newId, newSteps, originalValues, customSteps);
|
|
271
|
-
}
|
|
272
|
-
break;
|
|
273
|
-
default:
|
|
274
|
-
break;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
for (var _l = 0, _m = step.filters; _l < _m.length; _l++) {
|
|
278
|
-
var filter = _m[_l];
|
|
279
|
-
switch (filter.type) {
|
|
280
|
-
case EntityValueDataTypes.STEP:
|
|
281
|
-
var newId = element.ids[filter.idStep];
|
|
282
|
-
if (newId) {
|
|
283
|
-
filter.idStep = newId;
|
|
284
|
-
deps[newId] = calcStepDependency(newId, newSteps, originalValues, customSteps);
|
|
285
|
-
}
|
|
286
|
-
break;
|
|
287
|
-
default:
|
|
288
|
-
break;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
for (var _o = 0, _p = Object.keys((_a = step.options) !== null && _a !== void 0 ? _a : {}); _o < _p.length; _o++) {
|
|
292
|
-
var idOption = _p[_o];
|
|
293
|
-
var option = step.options[idOption];
|
|
294
|
-
if (option.type === EntityValueOptionTypes.NESTED) {
|
|
295
|
-
for (var i = 0; i < option.steps.length; i++) {
|
|
296
|
-
var idStep_7 = option.steps[i];
|
|
297
|
-
var newId = element.ids[idStep_7];
|
|
298
|
-
option.steps[i] = newId;
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
break;
|
|
303
|
-
case CBRFormStepTypes.CBR_LOCATIVAS:
|
|
304
|
-
var elementStep = step;
|
|
305
|
-
if (elementStep.subStep) {
|
|
306
|
-
var newId = element.ids[elementStep.subStep];
|
|
307
|
-
if (newId) {
|
|
308
|
-
elementStep.subStep = newId;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
break;
|
|
312
|
-
case AYFFormStepTypes.AYF_ICA_CITY:
|
|
313
|
-
var cityStep = step;
|
|
314
|
-
if (cityStep.idNitStep) {
|
|
315
|
-
var newId = element.ids[cityStep.idNitStep];
|
|
316
|
-
if (newId) {
|
|
317
|
-
cityStep.idNitStep = newId;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
break;
|
|
321
|
-
default:
|
|
322
|
-
break;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
@@ -21,16 +21,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
import { createElement as _createElement } from "react";
|
|
25
24
|
import styles from './MaterialRatingStep.module.css';
|
|
26
|
-
import {
|
|
27
|
-
import React from 'react';
|
|
28
|
-
import Rating from '../../../
|
|
25
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
26
|
+
import React, { useCallback, useContext } from 'react';
|
|
27
|
+
import Rating from '../../../Shared/Rating/Rating';
|
|
29
28
|
import { RatingTypes } from '../../../constants/FormStepTypes';
|
|
30
29
|
import StepComponent from '../../Step';
|
|
30
|
+
import FormContext from '../../../Contexts/FormContext';
|
|
31
|
+
import { useAppSelector } from '../../../hooks';
|
|
32
|
+
import { useStepDependency } from '../../StepHooks';
|
|
31
33
|
function MaterialRatingStep(_a) {
|
|
32
34
|
var _b, _c, _d, _e, _f;
|
|
33
|
-
var
|
|
35
|
+
var step = _a.step, value = _a.value, level = _a.level, onChange = _a.onChange, inputRef = _a.inputRef, editable = _a.editable;
|
|
36
|
+
var _g = useAppSelector(function (state) { return state.global; }), formStyle = _g.formStyle, postview = _g.postview;
|
|
37
|
+
var form = useContext(FormContext);
|
|
38
|
+
var widthStats = useAppSelector(function (state) { return state.widthStats; });
|
|
39
|
+
var errors = useFormContext().formState.errors;
|
|
34
40
|
var renderNestedOption = function () {
|
|
35
41
|
var currentOption;
|
|
36
42
|
if (value !== undefined && value !== null && step.nestedSteps) {
|
|
@@ -43,7 +49,7 @@ function MaterialRatingStep(_a) {
|
|
|
43
49
|
if (currentOption && currentOption.length > 0) {
|
|
44
50
|
return (_jsx(React.Fragment, { children: currentOption.map(function (idSubStep) {
|
|
45
51
|
var subStep = form.steps[idSubStep];
|
|
46
|
-
return (
|
|
52
|
+
return (_jsx(StepComponent, { editable: editable, step: subStep, level: level + 1 }, idSubStep));
|
|
47
53
|
}) }));
|
|
48
54
|
}
|
|
49
55
|
}
|
|
@@ -59,13 +65,23 @@ function MaterialRatingStep(_a) {
|
|
|
59
65
|
: step.description })))] })), renderNestedOption()] }));
|
|
60
66
|
}
|
|
61
67
|
function RatingStep(props) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
68
|
+
var step = props.step;
|
|
69
|
+
var _a = useStepDependency(step), handleStepDep = _a.handleStepDep, originalValue = _a.originalValue;
|
|
70
|
+
var _b = useController({
|
|
71
|
+
name: step.id,
|
|
72
|
+
shouldUnregister: true,
|
|
73
|
+
rules: {
|
|
74
|
+
required: step.required ? 'Este campo es obligatorio' : undefined,
|
|
75
|
+
},
|
|
76
|
+
defaultValue: originalValue,
|
|
77
|
+
}).field, ref = _b.ref, field = __rest(_b, ["ref"]);
|
|
78
|
+
var onChange = useCallback(function (value) {
|
|
79
|
+
handleStepDep(value);
|
|
80
|
+
field.onChange(value);
|
|
81
|
+
}, [handleStepDep, field]);
|
|
82
|
+
return (_jsx(MaterialRatingStep, __assign({}, props, field, { inputRef: ref, onChange: function (value) {
|
|
83
|
+
handleStepDep(value);
|
|
84
|
+
onChange(value);
|
|
85
|
+
} })));
|
|
70
86
|
}
|
|
71
87
|
export default RatingStep;
|
|
@@ -12,8 +12,10 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
14
14
|
import MaterialRatingStep from './MaterialRatingStep/MaterialRatingStep';
|
|
15
|
+
import { useAppSelector } from '../../hooks';
|
|
15
16
|
function RatingStep(props) {
|
|
16
|
-
|
|
17
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
18
|
+
switch (formStyle.type) {
|
|
17
19
|
case FormStyleTypes.MATERIAL:
|
|
18
20
|
default: {
|
|
19
21
|
return _jsx(MaterialRatingStep, __assign({}, props));
|
|
@@ -20,20 +20,26 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import { createElement as _createElement } from "react";
|
|
24
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
-
import React, { useState } from 'react';
|
|
24
|
+
import React, { useCallback, useContext, useState } from 'react';
|
|
26
25
|
import { OptionTypes } from '../../../constants/FormStepTypes';
|
|
27
26
|
import styles from './MaterialSelectorStep.module.css';
|
|
28
27
|
import StepComponent from '../../Step';
|
|
29
28
|
import { calcFillerSize, calcStepWidth } from '../../StepFunctions';
|
|
30
|
-
import {
|
|
31
|
-
import RoundedSmartSelect from '../../../
|
|
29
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
30
|
+
import RoundedSmartSelect from '../../../Shared/RoundedSmartSelect/RoundedSmartSelect';
|
|
31
|
+
import FormContext from '../../../Contexts/FormContext';
|
|
32
|
+
import { selectBreakPoint, useAppSelector } from '../../../hooks';
|
|
33
|
+
import { useStepDependency } from '../../StepHooks';
|
|
32
34
|
function Selector(_a) {
|
|
33
|
-
var step = _a.step,
|
|
34
|
-
var
|
|
35
|
+
var step = _a.step, value = _a.value, level = _a.level, onBlur = _a.onBlur, editable = _a.editable, onChange = _a.onChange, handleSizeChange = _a.handleSizeChange, inputRef = _a.inputRef;
|
|
36
|
+
var form = useContext(FormContext);
|
|
37
|
+
var _b = useAppSelector(function (state) { return state.global; }), postview = _b.postview, formStyle = _b.formStyle;
|
|
38
|
+
var currentBreakPoint = useAppSelector(selectBreakPoint);
|
|
39
|
+
var _c = useFormContext(), getValues = _c.getValues, errors = _c.formState.errors;
|
|
40
|
+
var _d = useState(level === 0
|
|
35
41
|
? calcFillerSize(step, form.steps, getValues(), form.size)
|
|
36
|
-
: 0), fillerSize =
|
|
42
|
+
: 0), fillerSize = _d[0], setFillerSize = _d[1];
|
|
37
43
|
var sizeChange = function () {
|
|
38
44
|
handleSizeChange === null || handleSizeChange === void 0 ? void 0 : handleSizeChange();
|
|
39
45
|
if (level === 0) {
|
|
@@ -41,9 +47,9 @@ function Selector(_a) {
|
|
|
41
47
|
}
|
|
42
48
|
};
|
|
43
49
|
var renderSelect = function () {
|
|
44
|
-
var _a;
|
|
50
|
+
var _a, _b, _c, _d;
|
|
45
51
|
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
46
|
-
width:
|
|
52
|
+
width: currentBreakPoint <= step.size
|
|
47
53
|
? '100%'
|
|
48
54
|
: calcStepWidth(step.size, form.size),
|
|
49
55
|
minHeight: step.description ||
|
|
@@ -54,9 +60,7 @@ function Selector(_a) {
|
|
|
54
60
|
onChange(value);
|
|
55
61
|
}, getOptionSelected: function (option, value) {
|
|
56
62
|
return (option === null || option === void 0 ? void 0 : option.value) === (value === null || value === void 0 ? void 0 : value.value);
|
|
57
|
-
}, helperText: errors[step.id]
|
|
58
|
-
? errors[step.id].message
|
|
59
|
-
: step.description, error: !!errors[step.id] }) })));
|
|
63
|
+
}, helperText: (_d = (_c = (_b = errors[step.id]) === null || _b === void 0 ? void 0 : _b.message) === null || _c === void 0 ? void 0 : _c.toString()) !== null && _d !== void 0 ? _d : step.description, error: !!errors[step.id] }) })));
|
|
60
64
|
};
|
|
61
65
|
var mapNestedOption = function () {
|
|
62
66
|
var currentOptionIndex = null;
|
|
@@ -72,17 +76,13 @@ function Selector(_a) {
|
|
|
72
76
|
currentOptionIndex !== null) {
|
|
73
77
|
return (_jsx(React.Fragment, { children: currentOption.steps.map(function (idSubStep) {
|
|
74
78
|
var subStep = form.steps[idSubStep];
|
|
75
|
-
return (
|
|
76
|
-
sizeChange();
|
|
77
|
-
} })));
|
|
79
|
+
return (_jsx(StepComponent, { editable: editable, step: subStep, level: level + 1, handleSizeChange: sizeChange }, idSubStep));
|
|
78
80
|
}) }));
|
|
79
81
|
}
|
|
80
82
|
};
|
|
81
83
|
if (level === 0 && step.maxSize && step.maxSize < form.size.blockNum) {
|
|
82
84
|
return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
|
|
83
|
-
width:
|
|
84
|
-
? '100%'
|
|
85
|
-
: 'fit-content',
|
|
85
|
+
width: currentBreakPoint <= step.size ? '100%' : 'fit-content',
|
|
86
86
|
} }, { children: [renderSelect(), mapNestedOption(), level === 0 && step.maxSize < form.size.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
87
87
|
width: fillerSize,
|
|
88
88
|
} }))] })));
|
|
@@ -92,13 +92,23 @@ function Selector(_a) {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
function SelectorStep(props) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
var step = props.step;
|
|
96
|
+
var _a = useStepDependency(step), handleStepDep = _a.handleStepDep, originalValue = _a.originalValue;
|
|
97
|
+
var _b = useController({
|
|
98
|
+
name: step.id,
|
|
99
|
+
rules: {
|
|
100
|
+
required: step.required ? 'Este campo es obligatorio' : undefined,
|
|
101
|
+
},
|
|
102
|
+
shouldUnregister: true,
|
|
103
|
+
defaultValue: originalValue,
|
|
104
|
+
}).field, ref = _b.ref, field = __rest(_b, ["ref"]);
|
|
105
|
+
var onChange = useCallback(function (value) {
|
|
106
|
+
handleStepDep(value);
|
|
107
|
+
field.onChange(value);
|
|
108
|
+
}, [handleStepDep, field]);
|
|
109
|
+
return (_jsx(Selector, __assign({}, props, field, { inputRef: ref, onChange: function (value) {
|
|
110
|
+
handleStepDep(value);
|
|
111
|
+
onChange(value);
|
|
112
|
+
} })));
|
|
103
113
|
}
|
|
104
114
|
export default SelectorStep;
|
|
@@ -5,5 +5,5 @@ export interface SelectorStepProps extends StepProps {
|
|
|
5
5
|
/** The SelectorStep to display */
|
|
6
6
|
step: FormSelector;
|
|
7
7
|
}
|
|
8
|
-
declare function SelectorStep(
|
|
8
|
+
declare function SelectorStep(props: SelectorStepProps): JSX.Element;
|
|
9
9
|
export default SelectorStep;
|
|
@@ -9,26 +9,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useAppSelector } from '../../hooks';
|
|
24
14
|
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
25
15
|
import MaterialSelectorStep from './MaterialSelectorStep/MaterialSelectorStep';
|
|
26
|
-
function SelectorStep(
|
|
27
|
-
var formStyle =
|
|
16
|
+
function SelectorStep(props) {
|
|
17
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
28
18
|
switch (formStyle.type) {
|
|
29
19
|
case FormStyleTypes.MATERIAL:
|
|
30
20
|
default: {
|
|
31
|
-
return _jsx(MaterialSelectorStep, __assign({
|
|
21
|
+
return _jsx(MaterialSelectorStep, __assign({}, props));
|
|
32
22
|
}
|
|
33
23
|
}
|
|
34
24
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SeparatorStepProps } from '../SeparatorStep';
|
|
3
|
-
declare function SeparatorStep({ step
|
|
3
|
+
declare function SeparatorStep({ step }: SeparatorStepProps): JSX.Element;
|
|
4
4
|
export default SeparatorStep;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useAppSelector } from '../../../hooks';
|
|
2
3
|
import styles from './MaterialSeparatorStep.module.css';
|
|
3
4
|
function SeparatorStep(_a) {
|
|
4
|
-
var step = _a.step
|
|
5
|
+
var step = _a.step;
|
|
6
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
5
7
|
return (_jsx("div", { className: styles.container, style: {
|
|
6
8
|
backgroundColor: step.transparent
|
|
7
9
|
? 'transparent'
|
|
@@ -5,5 +5,5 @@ export interface SeparatorStepProps extends StepProps {
|
|
|
5
5
|
/** The TitleStep to display */
|
|
6
6
|
step: Separator;
|
|
7
7
|
}
|
|
8
|
-
declare function SeparatorStep(
|
|
8
|
+
declare function SeparatorStep(props: SeparatorStepProps): JSX.Element;
|
|
9
9
|
export default SeparatorStep;
|
|
@@ -9,26 +9,16 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { useAppSelector } from '../../hooks';
|
|
24
14
|
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
25
15
|
import MaterialSeparatorStep from './MaterialSeparatorStep/MaterialSeparatorStep';
|
|
26
|
-
function SeparatorStep(
|
|
27
|
-
var
|
|
16
|
+
function SeparatorStep(props) {
|
|
17
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
28
18
|
switch (formStyle.type) {
|
|
29
19
|
case FormStyleTypes.MATERIAL:
|
|
30
20
|
default: {
|
|
31
|
-
return
|
|
21
|
+
return _jsx(MaterialSeparatorStep, __assign({}, props));
|
|
32
22
|
}
|
|
33
23
|
}
|
|
34
24
|
}
|