@arquimedes.co/eureka-forms 2.0.17 → 2.0.19-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 -0
- package/dist/@Types/FormStep.d.ts +1 -0
- package/dist/App/AppFunctions.js +11 -11
- package/dist/Form/Section/MaterialSection/MaterialSection.js +1 -1
- package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +9 -1
- package/dist/FormSteps/@Construction/CBRElementStep/CBRElementStep.js +2 -2
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +1 -1
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +2 -2
- package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +13 -13
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.d.ts +2 -2
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.js +20 -63
- package/dist/FormSteps/ApiSelectorStep/MaterialApiSelectorStep/MaterialApiSelectorStep.module.css +0 -16
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.d.ts +1 -1
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +21 -76
- package/dist/FormSteps/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +0 -28
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +1 -1
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +39 -96
- package/dist/FormSteps/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +2 -2
- package/dist/FormSteps/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +7 -38
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.d.ts +1 -1
- package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +20 -74
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +2 -2
- package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +18 -42
- package/dist/FormSteps/MapperStep/MaterialMapperStep/Element/MapperElementComponent.js +2 -2
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +9 -5
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.d.ts +1 -1
- package/dist/FormSteps/RatingStep/MaterialRatingStep/MaterialRatingStep.js +15 -43
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +2 -2
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +22 -78
- package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.module.css +0 -16
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +1 -9
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +26 -57
- package/dist/FormSteps/Step.d.ts +0 -2
- package/dist/FormSteps/StepFunctions.d.ts +2 -1
- package/dist/FormSteps/StepFunctions.js +70 -63
- package/dist/FormSteps/StepHooks.d.ts +16 -0
- package/dist/FormSteps/StepHooks.js +58 -2
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaEditorStep.js +1 -1
- package/dist/FormSteps/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +6 -37
- package/dist/FormSteps/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +13 -39
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +1 -1
- package/dist/FormSteps/TitleStep/MaterialTitleStep/MaterialTitleStep.js +4 -24
- package/dist/FormSteps/Utils/@StepFiller/StepFiller.d.ts +9 -0
- package/dist/FormSteps/Utils/@StepFiller/StepFiller.js +48 -0
- package/dist/FormSteps/{EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.module.css → Utils/@StepFiller/StepFiller.module.css} +16 -16
- package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.d.ts +11 -0
- package/dist/FormSteps/Utils/MaterialInputContainer/MaterialInputContainer.js +32 -0
- package/dist/FormSteps/{DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.module.css → Utils/MaterialInputContainer/MaterialInputContainer.module.css} +9 -9
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.d.ts +3 -3
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +1 -4
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.js +1 -3
- package/dist/States/SiteSlice.d.ts +2 -1
- package/dist/States/SiteSlice.js +25 -6
- package/package.json +1 -1
- package/dist/FormSteps/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.module.css +0 -25
- package/dist/FormSteps/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.module.css +0 -9
package/dist/@Types/Form.d.ts
CHANGED
package/dist/App/AppFunctions.js
CHANGED
|
@@ -15,7 +15,7 @@ import { getRawText, stringToDraft } from '../Utils/DraftFunctions';
|
|
|
15
15
|
import { calcSubSteps } from '../FormSteps/StepFunctions';
|
|
16
16
|
export var calcValuesStore = function (form, originalValues, postview, customSteps) {
|
|
17
17
|
var _a;
|
|
18
|
-
var _b;
|
|
18
|
+
var _b, _c;
|
|
19
19
|
if (originalValues === void 0) { originalValues = {}; }
|
|
20
20
|
if (postview === void 0) { postview = false; }
|
|
21
21
|
if (customSteps === void 0) { customSteps = {}; }
|
|
@@ -23,10 +23,10 @@ export var calcValuesStore = function (form, originalValues, postview, customSte
|
|
|
23
23
|
global: {},
|
|
24
24
|
sections: {},
|
|
25
25
|
};
|
|
26
|
-
for (var _i = 0,
|
|
27
|
-
var idValue =
|
|
26
|
+
for (var _i = 0, _d = Object.keys(originalValues); _i < _d.length; _i++) {
|
|
27
|
+
var idValue = _d[_i];
|
|
28
28
|
var step = form.steps[idValue];
|
|
29
|
-
if (step) {
|
|
29
|
+
if (step && !((_b = form.hiddenSteps) === null || _b === void 0 ? void 0 : _b.includes(step.id))) {
|
|
30
30
|
var value = mapOriginalValue(step, originalValues[step.id], values, form);
|
|
31
31
|
if (value !== undefined) {
|
|
32
32
|
if (!values.sections[step.idSection])
|
|
@@ -40,17 +40,17 @@ export var calcValuesStore = function (form, originalValues, postview, customSte
|
|
|
40
40
|
}
|
|
41
41
|
if (postview)
|
|
42
42
|
return values;
|
|
43
|
-
for (var
|
|
44
|
-
var section = _e
|
|
45
|
-
for (var
|
|
46
|
-
var idStep = _g
|
|
43
|
+
for (var _e = 0, _f = Object.values(form.sections); _e < _f.length; _e++) {
|
|
44
|
+
var section = _f[_e];
|
|
45
|
+
for (var _g = 0, _h = section.steps; _g < _h.length; _g++) {
|
|
46
|
+
var idStep = _h[_g];
|
|
47
47
|
var step = form.steps[idStep];
|
|
48
48
|
if (step.type !== StepTypes.MAPPER ||
|
|
49
|
-
((
|
|
49
|
+
((_c = values.sections[step.idSection]) === null || _c === void 0 ? void 0 : _c[step.id]))
|
|
50
50
|
continue;
|
|
51
51
|
if (!values.sections[step.idSection])
|
|
52
52
|
values.sections[step.idSection] = {};
|
|
53
|
-
var
|
|
53
|
+
var _j = addMapperStep(step, customSteps), element = _j.element, mappers = _j.mappers;
|
|
54
54
|
values.sections[step.idSection] = __assign(__assign(__assign({}, values.sections[step.idSection]), mappers), (_a = {}, _a[step.id] = [element], _a));
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -166,7 +166,7 @@ export var mapOriginalValue = function (step, value, values, form) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
case StepTypes.SELECTOR: {
|
|
169
|
-
var option = step.options.find(function (option) { return option.value
|
|
169
|
+
var option = step.options.find(function (option) { return option.value === value; });
|
|
170
170
|
if (!(value === null || value === void 0 ? void 0 : value.value))
|
|
171
171
|
return option;
|
|
172
172
|
return value;
|
|
@@ -35,7 +35,7 @@ function MaterialSection(_a) {
|
|
|
35
35
|
: 'normal',
|
|
36
36
|
} }, { children: (_b = section.steps) === null || _b === void 0 ? void 0 : _b.map(function (idStep) {
|
|
37
37
|
var step = form.steps[idStep];
|
|
38
|
-
return (_jsx(StepComponent, { editable: editable, step: step
|
|
38
|
+
return (_jsx(StepComponent, { editable: editable, step: step }, idStep));
|
|
39
39
|
}) })));
|
|
40
40
|
}
|
|
41
41
|
export default MaterialSection;
|
|
@@ -30,16 +30,24 @@ import RoundedCheckBox from '../../../../Shared/RoundedCheckBox/RoundedCheckBox'
|
|
|
30
30
|
import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
|
|
31
31
|
import styles from './MaterialTerm.module.css';
|
|
32
32
|
import { useAppSelector } from '../../../../hooks';
|
|
33
|
+
import { createSelector } from '@reduxjs/toolkit';
|
|
34
|
+
var selectOriginalValue = createSelector([
|
|
35
|
+
function (state) { return state.site.values; },
|
|
36
|
+
function (state, idTerm) { return idTerm; },
|
|
37
|
+
], function (values, idTerm) { return values.global[idTerm]; });
|
|
33
38
|
function TermComponent(_a) {
|
|
34
39
|
var _b;
|
|
35
40
|
var term = _a.term, tempError = _a.tempError;
|
|
36
41
|
var _c = useAppSelector(function (state) { return state.global; }), formStyle = _c.formStyle, postview = _c.postview;
|
|
42
|
+
var originalValue = useAppSelector(function (state) {
|
|
43
|
+
return selectOriginalValue(state, term.id);
|
|
44
|
+
});
|
|
37
45
|
var _d = useController({
|
|
38
46
|
name: term.id,
|
|
39
47
|
rules: {
|
|
40
48
|
required: true,
|
|
41
49
|
},
|
|
42
|
-
defaultValue: false,
|
|
50
|
+
defaultValue: originalValue !== null && originalValue !== void 0 ? originalValue : false,
|
|
43
51
|
shouldUnregister: true,
|
|
44
52
|
}), _e = _d.field, ref = _e.ref, field = __rest(_e, ["ref"]), error = _d.fieldState.error;
|
|
45
53
|
var _f = useState(false), showDialog = _f[0], setShowDialog = _f[1];
|
|
@@ -80,14 +80,14 @@ function ElementSubStepRenderer(_a) {
|
|
|
80
80
|
var _b;
|
|
81
81
|
var value = _a.value, stepProps = __rest(_a, ["value"]);
|
|
82
82
|
var form = useContext(FormContext);
|
|
83
|
-
if (!value || stepProps
|
|
83
|
+
if (!value || stepProps === undefined) {
|
|
84
84
|
return _jsx("div", {});
|
|
85
85
|
}
|
|
86
86
|
var subStep = form.steps[(_b = stepProps.step.subStep) !== null && _b !== void 0 ? _b : ''];
|
|
87
87
|
if ((subStep === null || subStep === void 0 ? void 0 : subStep.type) !== CBRFormStepTypes.CBR_LOCATIVAS) {
|
|
88
88
|
return _jsx("div", {});
|
|
89
89
|
}
|
|
90
|
-
return (_jsx(SmartSelectStep, __assign({}, stepProps, { step: subStep,
|
|
90
|
+
return (_jsx(SmartSelectStep, __assign({}, stepProps, { step: subStep, icon: _jsx(InputIcon, { icon: 'LEAK' }), getOptions: getElementOptions, calcDepError: calcDepError, getOptionSelected: function (option, value) {
|
|
91
91
|
return option.id === value.id;
|
|
92
92
|
}, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value.id; }, renderNestedSteps: function (value) { return (_jsx(ElementSubStepRenderer, __assign({ value: value }, stepProps, { step: subStep }))); } })));
|
|
93
93
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CBRIncidentsStepProps } from '../../CBRIncidentsStep';
|
|
3
3
|
import { Incident } from '../MaterialCBRIncidentsStep';
|
|
4
|
-
declare function IncidentComponent({ step,
|
|
4
|
+
declare function IncidentComponent({ step, incident, handleDelete, ...others }: CBRIncidentsStepProps & {
|
|
5
5
|
incident: Incident;
|
|
6
6
|
handleDelete: () => void;
|
|
7
7
|
}): JSX.Element;
|
package/dist/FormSteps/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js
CHANGED
|
@@ -29,7 +29,7 @@ import FormContext from '../../../../../Contexts/FormContext';
|
|
|
29
29
|
import { useAppSelector } from '../../../../../hooks';
|
|
30
30
|
import { useContext } from 'react';
|
|
31
31
|
function IncidentComponent(_a) {
|
|
32
|
-
var step = _a.step,
|
|
32
|
+
var step = _a.step, incident = _a.incident, handleDelete = _a.handleDelete, others = __rest(_a, ["step", "incident", "handleDelete"]);
|
|
33
33
|
var _b = useAppSelector(function (state) { return state.global; }), formStyle = _b.formStyle, postview = _b.postview;
|
|
34
34
|
var form = useContext(FormContext);
|
|
35
35
|
var widthStats = useAppSelector(function (state) { return state.widthStats; });
|
|
@@ -50,6 +50,6 @@ function IncidentComponent(_a) {
|
|
|
50
50
|
if (others.editable && !postview) {
|
|
51
51
|
handleDelete();
|
|
52
52
|
}
|
|
53
|
-
} }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) })), _jsx(StepComponent, __assign({}, others, { step: spaceStep
|
|
53
|
+
} }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) })), _jsx(StepComponent, __assign({}, others, { step: spaceStep })), _jsx(StepComponent, __assign({}, others, { step: elementStep })), _jsx(TextAreaStep, __assign({}, others, { step: commentStep, maxLength: 200 }))] })) })));
|
|
54
54
|
}
|
|
55
55
|
export default IncidentComponent;
|
|
@@ -77,7 +77,7 @@ function Incidents(_a) {
|
|
|
77
77
|
dispatch(addStepsDependencies({
|
|
78
78
|
steps: newSteps,
|
|
79
79
|
customSteps: customSteps,
|
|
80
|
-
allSteps: newSteps,
|
|
80
|
+
allSteps: __assign(__assign(__assign({}, form.steps), localForm.steps), newSteps),
|
|
81
81
|
}));
|
|
82
82
|
};
|
|
83
83
|
var addRecursiveElementStep = function (idStep, step, idParent, steps, idProjectDep) {
|
|
@@ -98,19 +98,19 @@ function Incidents(_a) {
|
|
|
98
98
|
margin: step.description
|
|
99
99
|
? '10px 0px'
|
|
100
100
|
: '0px 0px 5px 0px',
|
|
101
|
-
} }, { children: step.description }))), incidents.map(function (incident, index) { return (_jsx(IncidentComponent, __assign({ incident: incident, step: step, editable: editable, handleDelete: function () {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
} }, { children: step.description }))), _jsx(FormContext.Provider, __assign({ value: localForm }, { children: incidents.map(function (incident, index) { return (_jsx(IncidentComponent, __assign({ incident: incident, step: step, editable: editable, handleDelete: function () {
|
|
102
|
+
var tempIncidents = __spreadArray([], incidents, true);
|
|
103
|
+
tempIncidents[index].deleted = true;
|
|
104
|
+
var n = 1;
|
|
105
|
+
for (var _i = 0, tempIncidents_1 = tempIncidents; _i < tempIncidents_1.length; _i++) {
|
|
106
|
+
var inc = tempIncidents_1[_i];
|
|
107
|
+
if (!inc.deleted) {
|
|
108
|
+
inc.num = n;
|
|
109
|
+
n++;
|
|
110
|
+
}
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
} }, others), index)); }), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: btnRef, className: 'hidden-input' }), _jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel, color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
|
112
|
+
onChange(tempIncidents);
|
|
113
|
+
} }, others), index)); }) })), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: btnRef, className: 'hidden-input' }), _jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel, color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
|
114
114
|
if (editable && !postview) {
|
|
115
115
|
handleAddIncident();
|
|
116
116
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ApiSelectorStepProps } from '../ApiSelectorStep';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
declare function ApiSelectorComponent({ step, editable, ...others }: ApiSelectorStepProps): JSX.Element;
|
|
4
|
+
export default ApiSelectorComponent;
|
|
@@ -56,28 +56,19 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
56
56
|
}
|
|
57
57
|
return t;
|
|
58
58
|
};
|
|
59
|
-
import { jsx as _jsx,
|
|
60
|
-
import React, {
|
|
59
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
60
|
+
import React, { useContext } from 'react';
|
|
61
61
|
import FormStepTypes, { ApiSelectorOptionTypes, ApiSelectorParamTypes, } from '../../../constants/FormStepTypes';
|
|
62
|
-
import styles from './MaterialApiSelectorStep.module.css';
|
|
63
62
|
import StepComponent from '../../Step';
|
|
64
|
-
import
|
|
65
|
-
import { calcFillerSize } from '../../StepFunctions';
|
|
66
|
-
import { SmartSelect } from '../../SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep';
|
|
63
|
+
import SmartSelect from '../../SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep';
|
|
67
64
|
import widgetInstance from '../../../Utils/AxiosWidget';
|
|
68
65
|
import axiosInstance from '../../../Utils/AxiosAPI';
|
|
69
66
|
import InputIcon from '../../../Shared/InputIcon/InputIcon';
|
|
70
67
|
import FormContext from '../../../Contexts/FormContext';
|
|
71
|
-
import
|
|
72
|
-
import { useStepDependency } from '../../StepHooks';
|
|
68
|
+
import StepFillerContainer from '../../Utils/@StepFiller/StepFiller';
|
|
73
69
|
function ApiSelectorComponent(_a) {
|
|
74
|
-
var step = _a.step,
|
|
70
|
+
var step = _a.step, editable = _a.editable, others = __rest(_a, ["step", "editable"]);
|
|
75
71
|
var form = useContext(FormContext);
|
|
76
|
-
var currentBreakPoint = useAppSelector(selectBreakPoint);
|
|
77
|
-
var getValues = useFormContext().getValues;
|
|
78
|
-
var _b = useState(level === 0
|
|
79
|
-
? calcFillerSize(step, form.steps, getValues(), form.size)
|
|
80
|
-
: 0), fillerSize = _b[0], setFillerSize = _b[1];
|
|
81
72
|
function calcOptionId(option) {
|
|
82
73
|
var _a;
|
|
83
74
|
return (_a = option === null || option === void 0 ? void 0 : option[step.idAttribute]) !== null && _a !== void 0 ? _a : '';
|
|
@@ -86,14 +77,7 @@ function ApiSelectorComponent(_a) {
|
|
|
86
77
|
var _a;
|
|
87
78
|
return (_a = option === null || option === void 0 ? void 0 : option[step.labelAttribute]) !== null && _a !== void 0 ? _a : '';
|
|
88
79
|
}
|
|
89
|
-
|
|
90
|
-
handleSizeChange === null || handleSizeChange === void 0 ? void 0 : handleSizeChange();
|
|
91
|
-
if (level === 0) {
|
|
92
|
-
setFillerSize(calcFillerSize(step, form.steps, getValues(), form.size));
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
var renderSelect = function () {
|
|
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) {
|
|
80
|
+
return (_jsx(StepFillerContainer, __assign({ step: step }, { children: _jsx(SmartSelect, __assign({}, others, { editable: editable, step: step, icon: step.icon ? _jsx(InputIcon, { icon: step.icon }) : undefined, getOptions: getApiOptions, getOptionSelected: function (option, value) {
|
|
97
81
|
return calcOptionId(option) === calcOptionId(value);
|
|
98
82
|
}, calcDepError: function (steps) {
|
|
99
83
|
for (var _i = 0, steps_1 = steps; _i < steps_1.length; _i++) {
|
|
@@ -103,48 +87,21 @@ function ApiSelectorComponent(_a) {
|
|
|
103
87
|
}
|
|
104
88
|
}
|
|
105
89
|
return undefined;
|
|
106
|
-
}, getValueString: function (value) { return calcOptionLabel(value); }
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (level === 0 && step.maxSize && step.maxSize < form.size.blockNum) {
|
|
120
|
-
return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
|
|
121
|
-
width: currentBreakPoint <= step.size ? '100%' : 'fit-content',
|
|
122
|
-
} }, { children: [renderSelect(), mapNestedOption(), level === 0 && step.maxSize < form.size.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
123
|
-
width: fillerSize,
|
|
124
|
-
} }, "SEPARATOR"))] })));
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
return (_jsxs(React.Fragment, { children: [renderSelect(), mapNestedOption(), level === 0 && step.maxSize && (_jsx("div", { className: styles.separator }))] }));
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
export default ApiSelectorStep;
|
|
131
|
-
function ApiSelectorStep(props) {
|
|
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 })));
|
|
90
|
+
}, getValueString: function (value) { return calcOptionLabel(value); }, renderNestedSteps: function (value) {
|
|
91
|
+
if (!value)
|
|
92
|
+
return _jsx(_Fragment, {});
|
|
93
|
+
var currentOption = step.options[calcOptionId(value)];
|
|
94
|
+
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === ApiSelectorOptionTypes.NESTED) {
|
|
95
|
+
return (_jsx(React.Fragment, { children: currentOption.steps.map(function (idStep) {
|
|
96
|
+
var subStep = form.steps[idStep];
|
|
97
|
+
return (_jsx(StepComponent, { editable: editable, step: subStep }, idStep));
|
|
98
|
+
}) }));
|
|
99
|
+
}
|
|
100
|
+
else
|
|
101
|
+
return _jsx(_Fragment, {});
|
|
102
|
+
} })) })));
|
|
147
103
|
}
|
|
104
|
+
export default ApiSelectorComponent;
|
|
148
105
|
var getApiOptions = function (idOrganization, step, dependencyStore) { return __awaiter(void 0, void 0, void 0, function () {
|
|
149
106
|
function calcOptionId(option) {
|
|
150
107
|
var _a;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckBoxStepProps } from '../CheckBoxStep';
|
|
3
|
-
declare function CheckBoxStep(
|
|
3
|
+
declare function CheckBoxStep({ step, editable }: CheckBoxStepProps): JSX.Element;
|
|
4
4
|
export default CheckBoxStep;
|
|
@@ -9,92 +9,37 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
|
|
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
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
13
|
import styles from './MaterialCheckBoxStep.module.css';
|
|
25
|
-
import { calcFillerSize, calcStepWidth } from '../../StepFunctions';
|
|
26
14
|
import RoundedCheckBox from '../../../Shared/RoundedCheckBox/RoundedCheckBox';
|
|
27
|
-
import {
|
|
28
|
-
import React, { useCallback, useContext, useState } from 'react';
|
|
15
|
+
import React, { useContext } from 'react';
|
|
29
16
|
import StepComponent from '../../Step';
|
|
30
17
|
import FormContext from '../../../Contexts/FormContext';
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
import { useAppSelector } from '../../../hooks';
|
|
19
|
+
import { useFormStep } from '../../StepHooks';
|
|
20
|
+
import StepFillerContainer from '../../Utils/@StepFiller/StepFiller';
|
|
21
|
+
import MaterialInputContainer from '../../Utils/MaterialInputContainer/MaterialInputContainer';
|
|
22
|
+
function CheckBoxStep(_a) {
|
|
23
|
+
var step = _a.step, editable = _a.editable;
|
|
24
|
+
var _b = useFormStep(step, {
|
|
25
|
+
rules: {
|
|
26
|
+
required: step.required ? 'Este campo es obligatorio' : undefined,
|
|
27
|
+
},
|
|
28
|
+
sizeChange: true,
|
|
29
|
+
}), ref = _b.ref, value = _b.value, onChange = _b.onChange, error = _b.error, field = _b.field;
|
|
30
|
+
var _c = useAppSelector(function (state) { return state.global; }), formStyle = _c.formStyle, postview = _c.postview;
|
|
36
31
|
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
|
|
40
|
-
? calcFillerSize(step, form.steps, getValues(), form.size)
|
|
41
|
-
: 0), fillerSize = _d[0], setFillerSize = _d[1];
|
|
42
|
-
var sizeChange = function () {
|
|
43
|
-
handleSizeChange === null || handleSizeChange === void 0 ? void 0 : handleSizeChange();
|
|
44
|
-
if (level === 0) {
|
|
45
|
-
setFillerSize(calcFillerSize(step, form.steps, getValues(), form.size));
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var renderCheckbox = function () {
|
|
49
|
-
return (_jsxs("div", __assign({ className: styles.container, style: {
|
|
50
|
-
width: currentBreakPoint <= step.size
|
|
51
|
-
? '100%'
|
|
52
|
-
: calcStepWidth(step.size, form.size),
|
|
53
|
-
minHeight: step.description ||
|
|
54
|
-
(!postview && editable && step.required)
|
|
55
|
-
? '55px'
|
|
56
|
-
: '43px',
|
|
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: {
|
|
58
|
-
color: errors[step.id]
|
|
59
|
-
? formStyle.errorColor
|
|
60
|
-
: formStyle.descriptionTextColor,
|
|
61
|
-
} }, { children: errors[step.id]
|
|
62
|
-
? 'Este campo es obligatorio'
|
|
63
|
-
: step.description })))] }), step.id));
|
|
64
|
-
};
|
|
65
32
|
var renderNested = function () {
|
|
66
33
|
var steps = value ? step.steps : step.uncheckedSteps;
|
|
67
34
|
return (_jsx(React.Fragment, { children: steps === null || steps === void 0 ? void 0 : steps.map(function (idStep) {
|
|
68
35
|
var subStep = form.steps[idStep];
|
|
69
|
-
return (_jsx(StepComponent, { editable: editable, step: subStep
|
|
36
|
+
return (_jsx(StepComponent, { editable: editable, step: subStep }, idStep));
|
|
70
37
|
}) }));
|
|
71
38
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} }, "SEPARATOR"))] })));
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
return (_jsxs(React.Fragment, { children: [renderCheckbox(), renderNested(), level === 0 && step.maxSize && (_jsx("div", { className: styles.separator }))] }));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function CheckBoxStep(props) {
|
|
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 })));
|
|
39
|
+
return (_jsxs(StepFillerContainer, __assign({ step: step }, { children: [_jsxs(MaterialInputContainer, __assign({ step: step, editable: editable }, { 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: {
|
|
40
|
+
color: error
|
|
41
|
+
? formStyle.errorColor
|
|
42
|
+
: formStyle.descriptionTextColor,
|
|
43
|
+
} }, { children: error ? 'Este campo es obligatorio' : step.description })))] })), renderNested()] })));
|
|
99
44
|
}
|
|
100
45
|
export default CheckBoxStep;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
width: fit-content;
|
|
3
|
-
max-width: calc(100% - 20px);
|
|
4
|
-
display: flex;
|
|
5
|
-
padding: 10px;
|
|
6
|
-
padding-bottom: 0px;
|
|
7
|
-
padding-top: 5px;
|
|
8
|
-
margin-bottom: 0px;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
1
|
.checkboxLbl {
|
|
13
2
|
font-size: 18px;
|
|
14
3
|
margin-right: 10px;
|
|
@@ -35,20 +24,3 @@
|
|
|
35
24
|
overflow: hidden;
|
|
36
25
|
text-overflow: ellipsis;
|
|
37
26
|
}
|
|
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
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { ClassifierSelectorStepProps } from '../ClassifierSelectorStep';
|
|
3
|
+
declare function ClassifierSelectorStep({ step, editable, }: ClassifierSelectorStepProps): JSX.Element;
|
|
3
4
|
export default ClassifierSelectorStep;
|
|
4
|
-
declare function ClassifierSelectorStep(props: ClassifierSelectorStepProps): JSX.Element;
|