@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
|
@@ -56,21 +56,25 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
56
56
|
}
|
|
57
57
|
return t;
|
|
58
58
|
};
|
|
59
|
-
import { createElement as _createElement } from "react";
|
|
60
59
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
61
|
-
import React, {
|
|
60
|
+
import React, { useCallback, useContext, useState } from 'react';
|
|
62
61
|
import FormStepTypes, { ApiSelectorOptionTypes, ApiSelectorParamTypes, } from '../../../constants/FormStepTypes';
|
|
63
62
|
import styles from './MaterialApiSelectorStep.module.css';
|
|
64
63
|
import StepComponent from '../../Step';
|
|
65
|
-
import {
|
|
64
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
66
65
|
import { calcFillerSize } from '../../StepFunctions';
|
|
67
66
|
import { SmartSelect } from '../../SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep';
|
|
68
|
-
import widgetInstance from '../../../AxiosWidget';
|
|
69
|
-
import axiosInstance from '../../../AxiosAPI';
|
|
70
|
-
import InputIcon from '../../../
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
import widgetInstance from '../../../Utils/AxiosWidget';
|
|
68
|
+
import axiosInstance from '../../../Utils/AxiosAPI';
|
|
69
|
+
import InputIcon from '../../../Shared/InputIcon/InputIcon';
|
|
70
|
+
import FormContext from '../../../Contexts/FormContext';
|
|
71
|
+
import { selectBreakPoint, useAppSelector } from '../../../hooks';
|
|
72
|
+
import { useStepDependency } from '../../StepHooks';
|
|
73
|
+
function ApiSelectorComponent(_a) {
|
|
74
|
+
var step = _a.step, level = _a.level, value = _a.value, editable = _a.editable, inputRef = _a.inputRef, handleSizeChange = _a.handleSizeChange, others = __rest(_a, ["step", "level", "value", "editable", "inputRef", "handleSizeChange"]);
|
|
75
|
+
var form = useContext(FormContext);
|
|
76
|
+
var currentBreakPoint = useAppSelector(selectBreakPoint);
|
|
77
|
+
var getValues = useFormContext().getValues;
|
|
74
78
|
var _b = useState(level === 0
|
|
75
79
|
? calcFillerSize(step, form.steps, getValues(), form.size)
|
|
76
80
|
: 0), fillerSize = _b[0], setFillerSize = _b[1];
|
|
@@ -82,57 +86,6 @@ function ApiSelector(_a) {
|
|
|
82
86
|
var _a;
|
|
83
87
|
return (_a = option === null || option === void 0 ? void 0 : option[step.labelAttribute]) !== null && _a !== void 0 ? _a : '';
|
|
84
88
|
}
|
|
85
|
-
var getApiOptions = function (_a, _step, dependencyStore, domain) {
|
|
86
|
-
var idOrganization = _a.idOrganization;
|
|
87
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
88
|
-
var params, _i, _b, filter, currentValue, url, response;
|
|
89
|
-
var _c, _d;
|
|
90
|
-
return __generator(this, function (_e) {
|
|
91
|
-
switch (_e.label) {
|
|
92
|
-
case 0:
|
|
93
|
-
params = new URLSearchParams({});
|
|
94
|
-
for (_i = 0, _b = step.queryParams; _i < _b.length; _i++) {
|
|
95
|
-
filter = _b[_i];
|
|
96
|
-
switch (filter.type) {
|
|
97
|
-
case ApiSelectorParamTypes.STEP:
|
|
98
|
-
currentValue = (_c = dependencyStore[filter.idStep]) === null || _c === void 0 ? void 0 : _c.value;
|
|
99
|
-
if (currentValue) {
|
|
100
|
-
if (typeof currentValue === 'string')
|
|
101
|
-
params.set(filter.key, currentValue);
|
|
102
|
-
else
|
|
103
|
-
params.set(filter.key, (_d = currentValue.label) !== null && _d !== void 0 ? _d : currentValue.id);
|
|
104
|
-
}
|
|
105
|
-
else if (filter.required) {
|
|
106
|
-
return [2 /*return*/, null];
|
|
107
|
-
}
|
|
108
|
-
break;
|
|
109
|
-
case ApiSelectorParamTypes.VALUE:
|
|
110
|
-
default:
|
|
111
|
-
params.set(filter.key, filter.value);
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
url = step.url.replace('capta.co', process.env.REACT_APP_DOMAIN);
|
|
116
|
-
if (domain && url.includes(process.env.REACT_APP_DOMAIN))
|
|
117
|
-
params.set('idOrganization', idOrganization);
|
|
118
|
-
if (!step.url.includes('?'))
|
|
119
|
-
url += '?';
|
|
120
|
-
url += params.toString();
|
|
121
|
-
return [4 /*yield*/, (domain
|
|
122
|
-
? widgetInstance.get(url)
|
|
123
|
-
: axiosInstance.get(url))];
|
|
124
|
-
case 1:
|
|
125
|
-
response = _e.sent();
|
|
126
|
-
return [2 /*return*/, response.data.filter(function (option) {
|
|
127
|
-
var _a;
|
|
128
|
-
return calcOptionId(option) &&
|
|
129
|
-
((_a = step.options[calcOptionId(option)]) === null || _a === void 0 ? void 0 : _a.type) !==
|
|
130
|
-
ApiSelectorOptionTypes.HIDE;
|
|
131
|
-
})];
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
89
|
var sizeChange = function () {
|
|
137
90
|
handleSizeChange === null || handleSizeChange === void 0 ? void 0 : handleSizeChange();
|
|
138
91
|
if (level === 0) {
|
|
@@ -140,7 +93,7 @@ function ApiSelector(_a) {
|
|
|
140
93
|
}
|
|
141
94
|
};
|
|
142
95
|
var renderSelect = function () {
|
|
143
|
-
return (_jsx(SmartSelect, __assign({}, others, {
|
|
96
|
+
return (_jsx(SmartSelect, __assign({}, others, { level: level, value: value, inputRef: inputRef, editable: editable, step: step, icon: step.icon ? _jsx(InputIcon, { icon: step.icon }) : undefined, getOptions: getApiOptions, getOptionSelected: function (option, value) {
|
|
144
97
|
return calcOptionId(option) === calcOptionId(value);
|
|
145
98
|
}, calcDepError: function (steps) {
|
|
146
99
|
for (var _i = 0, steps_1 = steps; _i < steps_1.length; _i++) {
|
|
@@ -158,18 +111,14 @@ function ApiSelector(_a) {
|
|
|
158
111
|
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === ApiSelectorOptionTypes.NESTED) {
|
|
159
112
|
return (_jsx(React.Fragment, { children: currentOption.steps.map(function (idStep) {
|
|
160
113
|
var subStep = form.steps[idStep];
|
|
161
|
-
return (
|
|
162
|
-
sizeChange();
|
|
163
|
-
} })));
|
|
114
|
+
return (_jsx(StepComponent, { editable: editable, step: subStep, level: level + 1, handleSizeChange: sizeChange }, idStep));
|
|
164
115
|
}) }));
|
|
165
116
|
}
|
|
166
117
|
}
|
|
167
118
|
};
|
|
168
119
|
if (level === 0 && step.maxSize && step.maxSize < form.size.blockNum) {
|
|
169
120
|
return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
|
|
170
|
-
width:
|
|
171
|
-
? '100%'
|
|
172
|
-
: 'fit-content',
|
|
121
|
+
width: currentBreakPoint <= step.size ? '100%' : 'fit-content',
|
|
173
122
|
} }, { children: [renderSelect(), mapNestedOption(), level === 0 && step.maxSize < form.size.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
174
123
|
width: fillerSize,
|
|
175
124
|
} }, "SEPARATOR"))] })));
|
|
@@ -180,34 +129,72 @@ function ApiSelector(_a) {
|
|
|
180
129
|
}
|
|
181
130
|
export default ApiSelectorStep;
|
|
182
131
|
function ApiSelectorStep(props) {
|
|
183
|
-
var
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}, shouldUnregister: true, render: function (_a) {
|
|
199
|
-
var _b = _a.field, ref = _b.ref, field = __rest(_b, ["ref"]);
|
|
200
|
-
return (_jsx(ApiSelector, __assign({}, props, field, { inputRef: ref, onChange: function (value) {
|
|
201
|
-
if (dependencyStore[step.id] !== undefined) {
|
|
202
|
-
props.setDependencyStore(function (dependencies) {
|
|
203
|
-
var _a;
|
|
204
|
-
return (__assign(__assign({}, dependencies), (_a = {}, _a[step.id] = {
|
|
205
|
-
type: step.type,
|
|
206
|
-
value: value !== null && value !== void 0 ? value : null,
|
|
207
|
-
}, _a)));
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
field.onChange(value);
|
|
211
|
-
} })));
|
|
212
|
-
} }));
|
|
132
|
+
var step = props.step, defaultValue = props.defaultValue;
|
|
133
|
+
var _a = useStepDependency(step, defaultValue), handleStepDep = _a.handleStepDep, originalValue = _a.originalValue;
|
|
134
|
+
var _b = useController({
|
|
135
|
+
name: step.id,
|
|
136
|
+
rules: {
|
|
137
|
+
required: step.required ? 'Este campo es obligatorio' : undefined,
|
|
138
|
+
},
|
|
139
|
+
shouldUnregister: true,
|
|
140
|
+
defaultValue: originalValue,
|
|
141
|
+
}), _c = _b.field, ref = _c.ref, field = __rest(_c, ["ref"]), error = _b.fieldState.error;
|
|
142
|
+
var onChange = useCallback(function (value) {
|
|
143
|
+
handleStepDep(value);
|
|
144
|
+
field.onChange(value);
|
|
145
|
+
}, [handleStepDep, field]);
|
|
146
|
+
return (_jsx(ApiSelectorComponent, __assign({}, props, field, { error: error, inputRef: ref, onChange: onChange })));
|
|
213
147
|
}
|
|
148
|
+
var getApiOptions = function (idOrganization, step, dependencyStore) { return __awaiter(void 0, void 0, void 0, function () {
|
|
149
|
+
function calcOptionId(option) {
|
|
150
|
+
var _a;
|
|
151
|
+
return (_a = option === null || option === void 0 ? void 0 : option[step.idAttribute]) !== null && _a !== void 0 ? _a : '';
|
|
152
|
+
}
|
|
153
|
+
var params, _i, _a, filter, currentValue, url, response;
|
|
154
|
+
var _b, _c;
|
|
155
|
+
return __generator(this, function (_d) {
|
|
156
|
+
switch (_d.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
params = new URLSearchParams({});
|
|
159
|
+
for (_i = 0, _a = step.queryParams; _i < _a.length; _i++) {
|
|
160
|
+
filter = _a[_i];
|
|
161
|
+
switch (filter.type) {
|
|
162
|
+
case ApiSelectorParamTypes.STEP: {
|
|
163
|
+
currentValue = (_b = dependencyStore[filter.idStep]) === null || _b === void 0 ? void 0 : _b.value;
|
|
164
|
+
if (currentValue) {
|
|
165
|
+
if (typeof currentValue === 'string')
|
|
166
|
+
params.set(filter.key, currentValue);
|
|
167
|
+
else
|
|
168
|
+
params.set(filter.key, (_c = currentValue.label) !== null && _c !== void 0 ? _c : currentValue.id);
|
|
169
|
+
}
|
|
170
|
+
else if (filter.required) {
|
|
171
|
+
return [2 /*return*/, null];
|
|
172
|
+
}
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
case ApiSelectorParamTypes.VALUE:
|
|
176
|
+
default:
|
|
177
|
+
params.set(filter.key, filter.value);
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
url = step.url.replace('capta.co', process.env.REACT_APP_DOMAIN);
|
|
182
|
+
if (idOrganization && url.includes(process.env.REACT_APP_DOMAIN))
|
|
183
|
+
params.set('idOrganization', idOrganization);
|
|
184
|
+
if (!step.url.includes('?'))
|
|
185
|
+
url += '?';
|
|
186
|
+
url += params.toString();
|
|
187
|
+
return [4 /*yield*/, (idOrganization
|
|
188
|
+
? widgetInstance.get(url)
|
|
189
|
+
: axiosInstance.get(url))];
|
|
190
|
+
case 1:
|
|
191
|
+
response = _d.sent();
|
|
192
|
+
return [2 /*return*/, response.data.filter(function (option) {
|
|
193
|
+
var _a;
|
|
194
|
+
return calcOptionId(option) &&
|
|
195
|
+
((_a = step.options[calcOptionId(option)]) === null || _a === void 0 ? void 0 : _a.type) !==
|
|
196
|
+
ApiSelectorOptionTypes.HIDE;
|
|
197
|
+
})];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}); };
|
|
@@ -55,91 +55,95 @@ import CBRIncidentsStep from './@Construction/CBRIncidentsStep/CBRIncidentsStep'
|
|
|
55
55
|
import CBRElementStep from './@Construction/CBRElementStep/CBRElementStep';
|
|
56
56
|
import axios from 'axios';
|
|
57
57
|
import CBRPropertyStep from './@Construction/CBRPropertyStep/CBRPropertyStep';
|
|
58
|
-
import InputIcon from '../
|
|
58
|
+
import InputIcon from '../Shared/InputIcon/InputIcon';
|
|
59
59
|
var baseUrl = "https://integrations.".concat(process.env.REACT_APP_DOMAIN, "/sinco/cbr/");
|
|
60
60
|
function CBRStepMapper(props) {
|
|
61
61
|
var _this = this;
|
|
62
|
-
var getTipoDocOptions = function (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
62
|
+
var getTipoDocOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
switch (_a.label) {
|
|
65
|
+
case 0:
|
|
66
|
+
if (!idOrganization)
|
|
67
|
+
return [2 /*return*/, null];
|
|
68
|
+
return [4 /*yield*/, axios.get(baseUrl + 'TiposDoc?idOrganization=' + idOrganization)];
|
|
69
|
+
case 1: return [2 /*return*/, (_a.sent()).data];
|
|
70
|
+
}
|
|
71
71
|
});
|
|
72
|
-
};
|
|
73
|
-
var getProyectoOptions = function (
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
72
|
+
}); };
|
|
73
|
+
var getProyectoOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
|
|
74
|
+
var idMacroProyecto, proyectos;
|
|
75
|
+
var _a, _b, _c, _d;
|
|
76
|
+
return __generator(this, function (_e) {
|
|
77
|
+
switch (_e.label) {
|
|
78
|
+
case 0:
|
|
79
|
+
if (!idOrganization)
|
|
80
|
+
return [2 /*return*/, null];
|
|
81
|
+
idMacroProyecto = (_d = (_c = dependencyStore[(_b = (_a = step.dependencies) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : '']) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.id;
|
|
82
|
+
return [4 /*yield*/, axios.get(baseUrl + 'Proyectos?idOrganization=' + idOrganization)];
|
|
83
|
+
case 1:
|
|
84
|
+
proyectos = (_e.sent()).data;
|
|
85
|
+
if (idMacroProyecto) {
|
|
86
|
+
proyectos = proyectos.filter(function (proyecto) { return proyecto.idMacroProyecto === idMacroProyecto; });
|
|
87
|
+
}
|
|
88
|
+
return [2 /*return*/, proyectos];
|
|
89
|
+
}
|
|
91
90
|
});
|
|
92
|
-
};
|
|
93
|
-
var getMacroProyectoOptions = function (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
91
|
+
}); };
|
|
92
|
+
var getMacroProyectoOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
|
|
93
|
+
return __generator(this, function (_a) {
|
|
94
|
+
switch (_a.label) {
|
|
95
|
+
case 0:
|
|
96
|
+
if (!idOrganization)
|
|
97
|
+
return [2 /*return*/, null];
|
|
98
|
+
return [4 /*yield*/, axios.get(baseUrl + 'MacroProyectos?idOrganization=' + idOrganization)];
|
|
99
|
+
case 1: return [2 /*return*/, (_a.sent()).data];
|
|
100
|
+
}
|
|
102
101
|
});
|
|
103
|
-
};
|
|
104
|
-
var getTipoSolicitanteOptions = function (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
102
|
+
}); };
|
|
103
|
+
var getTipoSolicitanteOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
|
|
104
|
+
return __generator(this, function (_a) {
|
|
105
|
+
switch (_a.label) {
|
|
106
|
+
case 0:
|
|
107
|
+
if (!idOrganization)
|
|
108
|
+
return [2 /*return*/, null];
|
|
109
|
+
return [4 /*yield*/, axios.get(baseUrl + 'TiposSolicitante?idOrganization=' + idOrganization)];
|
|
110
|
+
case 1: return [2 /*return*/, (_a.sent()).data];
|
|
111
|
+
}
|
|
113
112
|
});
|
|
114
|
-
};
|
|
115
|
-
var getTipoEspaciosOptions = function (
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
'&idOrganization=' +
|
|
132
|
-
idOrganization)];
|
|
133
|
-
case 1: return [2 /*return*/, (_d.sent()).data];
|
|
134
|
-
case 2: return [2 /*return*/, null];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
113
|
+
}); };
|
|
114
|
+
var getTipoEspaciosOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
|
|
115
|
+
var idProyecto, params;
|
|
116
|
+
var _a, _b;
|
|
117
|
+
return __generator(this, function (_c) {
|
|
118
|
+
switch (_c.label) {
|
|
119
|
+
case 0:
|
|
120
|
+
if (!(step.dependencies && idOrganization)) return [3 /*break*/, 2];
|
|
121
|
+
idProyecto = (_b = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.id;
|
|
122
|
+
if (!idProyecto) {
|
|
123
|
+
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
124
|
+
}
|
|
125
|
+
params = new URLSearchParams({ idProyecto: idProyecto, idOrganization: idOrganization });
|
|
126
|
+
return [4 /*yield*/, axios.get(baseUrl + 'TiposEspacio?' + params.toString())];
|
|
127
|
+
case 1: return [2 /*return*/, (_c.sent()).data];
|
|
128
|
+
case 2: return [2 /*return*/, null];
|
|
129
|
+
}
|
|
137
130
|
});
|
|
138
|
-
};
|
|
131
|
+
}); };
|
|
139
132
|
switch (props.step.type) {
|
|
140
|
-
case CBRFormStepTypes.CBR_CEL:
|
|
141
133
|
case CBRFormStepTypes.CBR_EMAIL:
|
|
134
|
+
return (_jsx(TextInputStep, __assign({}, props, { step: props.step, validation: {
|
|
135
|
+
type: 'EMAIL',
|
|
136
|
+
value: /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
|
137
|
+
.source,
|
|
138
|
+
message: 'El correo no es válido',
|
|
139
|
+
} })));
|
|
140
|
+
case CBRFormStepTypes.CBR_CEL:
|
|
142
141
|
case CBRFormStepTypes.CBR_PHONE:
|
|
142
|
+
return (_jsx(TextInputStep, __assign({}, props, { step: props.step, validation: {
|
|
143
|
+
type: 'OTHER',
|
|
144
|
+
value: /^(\+[0-9])|([0-9])$/.source,
|
|
145
|
+
message: 'El teléfono no es válido',
|
|
146
|
+
} })));
|
|
143
147
|
case CBRFormStepTypes.CBR_LAST_NAME:
|
|
144
148
|
case CBRFormStepTypes.CBR_FIRST_NAME:
|
|
145
149
|
case CBRFormStepTypes.CBR_MIDDLE_NAME:
|
|
@@ -5,5 +5,5 @@ export interface CheckBoxStepProps extends StepProps {
|
|
|
5
5
|
/** The CheckboxStep to display */
|
|
6
6
|
step: CheckBox;
|
|
7
7
|
}
|
|
8
|
-
declare function CheckboxStep(
|
|
8
|
+
declare function CheckboxStep(props: CheckBoxStepProps): JSX.Element;
|
|
9
9
|
export default CheckboxStep;
|
|
@@ -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";
|
|
24
13
|
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
25
14
|
import MaterialCheckBoxStep from './MaterialCheckBoxStep/MaterialCheckBoxStep';
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
import { useAppSelector } from '../../hooks';
|
|
16
|
+
function CheckboxStep(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(MaterialCheckBoxStep, __assign({
|
|
21
|
+
return _jsx(MaterialCheckBoxStep, __assign({}, props));
|
|
32
22
|
}
|
|
33
23
|
}
|
|
34
24
|
}
|
|
@@ -20,20 +20,25 @@ 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 { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
25
24
|
import styles from './MaterialCheckBoxStep.module.css';
|
|
26
25
|
import { calcFillerSize, calcStepWidth } from '../../StepFunctions';
|
|
27
|
-
import RoundedCheckBox from '../../../
|
|
28
|
-
import {
|
|
29
|
-
import React, { useState } from 'react';
|
|
26
|
+
import RoundedCheckBox from '../../../Shared/RoundedCheckBox/RoundedCheckBox';
|
|
27
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
28
|
+
import React, { useCallback, useContext, useState } from 'react';
|
|
30
29
|
import StepComponent from '../../Step';
|
|
30
|
+
import FormContext from '../../../Contexts/FormContext';
|
|
31
|
+
import { selectBreakPoint, useAppSelector } from '../../../hooks';
|
|
32
|
+
import { useStepDependency } from '../../StepHooks';
|
|
31
33
|
function CheckBox(_a) {
|
|
32
|
-
var step = _a.step,
|
|
33
|
-
var
|
|
34
|
-
var
|
|
34
|
+
var step = _a.step, value = _a.value, onBlur = _a.onBlur, level = _a.level, onChange = _a.onChange, inputRef = _a.inputRef, editable = _a.editable, handleSizeChange = _a.handleSizeChange;
|
|
35
|
+
var _b = useAppSelector(function (state) { return state.global; }), formStyle = _b.formStyle, postview = _b.postview;
|
|
36
|
+
var form = useContext(FormContext);
|
|
37
|
+
var currentBreakPoint = useAppSelector(selectBreakPoint);
|
|
38
|
+
var _c = useFormContext(), getValues = _c.getValues, errors = _c.formState.errors;
|
|
39
|
+
var _d = useState(level === 0
|
|
35
40
|
? calcFillerSize(step, form.steps, getValues(), form.size)
|
|
36
|
-
: 0), fillerSize =
|
|
41
|
+
: 0), fillerSize = _d[0], setFillerSize = _d[1];
|
|
37
42
|
var sizeChange = function () {
|
|
38
43
|
handleSizeChange === null || handleSizeChange === void 0 ? void 0 : handleSizeChange();
|
|
39
44
|
if (level === 0) {
|
|
@@ -42,7 +47,7 @@ function CheckBox(_a) {
|
|
|
42
47
|
};
|
|
43
48
|
var renderCheckbox = function () {
|
|
44
49
|
return (_jsxs("div", __assign({ className: styles.container, style: {
|
|
45
|
-
width:
|
|
50
|
+
width: currentBreakPoint <= step.size
|
|
46
51
|
? '100%'
|
|
47
52
|
: calcStepWidth(step.size, form.size),
|
|
48
53
|
minHeight: step.description ||
|
|
@@ -50,10 +55,10 @@ function CheckBox(_a) {
|
|
|
50
55
|
? '55px'
|
|
51
56
|
: '43px',
|
|
52
57
|
} }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [step.label && (_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }))), _jsx(RoundedCheckBox, { onChange: onChange, onBlur: onBlur, "data-testid": step.id, inputRef: inputRef, padding: "0px", size: "1.6rem", error: !!errors[step.id], cantEdit: !editable || postview, checkedColor: formStyle.primaryColor, uncheckedColor: formStyle.outlineColor, checked: value })] })), (step.description || !!errors[step.id]) && (_jsx("div", __assign({ className: styles.descriptionPar, style: {
|
|
53
|
-
color:
|
|
58
|
+
color: errors[step.id]
|
|
54
59
|
? formStyle.errorColor
|
|
55
60
|
: formStyle.descriptionTextColor,
|
|
56
|
-
} }, { children:
|
|
61
|
+
} }, { children: errors[step.id]
|
|
57
62
|
? 'Este campo es obligatorio'
|
|
58
63
|
: step.description })))] }), step.id));
|
|
59
64
|
};
|
|
@@ -61,16 +66,12 @@ function CheckBox(_a) {
|
|
|
61
66
|
var steps = value ? step.steps : step.uncheckedSteps;
|
|
62
67
|
return (_jsx(React.Fragment, { children: steps === null || steps === void 0 ? void 0 : steps.map(function (idStep) {
|
|
63
68
|
var subStep = form.steps[idStep];
|
|
64
|
-
return (
|
|
65
|
-
sizeChange();
|
|
66
|
-
} })));
|
|
69
|
+
return (_jsx(StepComponent, { editable: editable, step: subStep, level: level + 1, handleSizeChange: sizeChange }, idStep));
|
|
67
70
|
}) }));
|
|
68
71
|
};
|
|
69
72
|
if (level === 0 && step.maxSize && step.maxSize < form.size.blockNum) {
|
|
70
73
|
return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
|
|
71
|
-
width:
|
|
72
|
-
? '100%'
|
|
73
|
-
: 'fit-content',
|
|
74
|
+
width: currentBreakPoint <= step.size ? '100%' : 'fit-content',
|
|
74
75
|
} }, { children: [renderCheckbox(), renderNested(), level === 0 && step.maxSize < form.size.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
75
76
|
width: fillerSize,
|
|
76
77
|
} }, "SEPARATOR"))] })));
|
|
@@ -80,14 +81,20 @@ function CheckBox(_a) {
|
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
function CheckBoxStep(props) {
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
var step = props.step;
|
|
85
|
+
var _a = useStepDependency(step), handleStepDep = _a.handleStepDep, originalValue = _a.originalValue;
|
|
86
|
+
var _b = useController({
|
|
87
|
+
name: step.id,
|
|
88
|
+
rules: {
|
|
89
|
+
required: step.required ? 'Este campo es obligatorio' : undefined,
|
|
90
|
+
},
|
|
91
|
+
shouldUnregister: true,
|
|
92
|
+
defaultValue: originalValue,
|
|
93
|
+
}).field, ref = _b.ref, field = __rest(_b, ["ref"]);
|
|
94
|
+
var onChange = useCallback(function (value) {
|
|
95
|
+
handleStepDep(value);
|
|
96
|
+
field.onChange(value);
|
|
97
|
+
}, [handleStepDep, field]);
|
|
98
|
+
return (_jsx(CheckBox, __assign({}, props, field, { inputRef: ref, onChange: onChange })));
|
|
92
99
|
}
|
|
93
100
|
export default CheckBoxStep;
|
|
@@ -35,3 +35,20 @@
|
|
|
35
35
|
overflow: hidden;
|
|
36
36
|
text-overflow: ellipsis;
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
.separator {
|
|
40
|
+
flex-basis: 100%;
|
|
41
|
+
height: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.firstLvlContainer {
|
|
45
|
+
max-width: 100%;
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-flow: row wrap;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.smallSeparator {
|
|
51
|
+
height: 0;
|
|
52
|
+
max-width: 100%;
|
|
53
|
+
flex-basis: 0;
|
|
54
|
+
}
|
|
@@ -5,5 +5,5 @@ export interface ClassifierSelectorStepProps extends StepProps {
|
|
|
5
5
|
/** The ClassifierSelectorStep to display */
|
|
6
6
|
step: ClassifierSelector;
|
|
7
7
|
}
|
|
8
|
-
declare function ClassifierSelectorStep(
|
|
8
|
+
declare function ClassifierSelectorStep(props: ClassifierSelectorStepProps): JSX.Element;
|
|
9
9
|
export default ClassifierSelectorStep;
|
|
@@ -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";
|
|
24
13
|
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
25
14
|
import MaterialClassifierSelectorStep from './MaterialClassifierSelectorStep/MaterialClassifierSelectorStep';
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
import { useAppSelector } from '../../hooks';
|
|
16
|
+
function ClassifierSelectorStep(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(MaterialClassifierSelectorStep, __assign({}, props));
|
|
32
22
|
}
|
|
33
23
|
}
|
|
34
24
|
}
|