@arquimedes.co/eureka-forms 1.9.133 → 2.0.0-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 +16 -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 -38
- 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 +23 -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
|
@@ -20,21 +20,27 @@ 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 { ClassifierOptionTypes } from '../../../constants/FormStepTypes';
|
|
27
26
|
import styles from './MaterialClassifierSelectorStep.module.css';
|
|
28
27
|
import StepComponent from '../../Step';
|
|
29
|
-
import {
|
|
28
|
+
import { useController, useFormContext } from 'react-hook-form';
|
|
30
29
|
import { calcFillerSize, calcStepWidth } from '../../StepFunctions';
|
|
31
|
-
import RoundedSmartSelect from '../../../
|
|
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 ClassifierSelector(_a) {
|
|
33
35
|
var _b, _c;
|
|
34
|
-
var step = _a.step,
|
|
35
|
-
var _d =
|
|
36
|
+
var step = _a.step, level = _a.level, value = _a.value, onBlur = _a.onBlur, onChange = _a.onChange, inputRef = _a.inputRef, editable = _a.editable, handleSizeChange = _a.handleSizeChange;
|
|
37
|
+
var _d = useAppSelector(function (state) { return state.global; }), formStyle = _d.formStyle, postview = _d.postview, preview = _d.preview;
|
|
38
|
+
var form = useContext(FormContext);
|
|
39
|
+
var currentBreakPoint = useAppSelector(selectBreakPoint);
|
|
40
|
+
var _e = useFormContext(), getValues = _e.getValues, errors = _e.formState.errors;
|
|
41
|
+
var _f = useState(level === 0
|
|
36
42
|
? calcFillerSize(step, form.steps, getValues(), form.size)
|
|
37
|
-
: 0), fillerSize =
|
|
43
|
+
: 0), fillerSize = _f[0], setFillerSize = _f[1];
|
|
38
44
|
if (!step.idClassifier) {
|
|
39
45
|
return _jsx("div", {});
|
|
40
46
|
}
|
|
@@ -52,7 +58,7 @@ function ClassifierSelector(_a) {
|
|
|
52
58
|
var classifier = (_a = form.classifiers) === null || _a === void 0 ? void 0 : _a[idClassifier];
|
|
53
59
|
return {
|
|
54
60
|
value: classifier === null || classifier === void 0 ? void 0 : classifier._id,
|
|
55
|
-
label: ((_c = (_b = classifier === null || classifier === void 0 ? void 0 : classifier.clientName) === null || _b === void 0 ? void 0 : _b.trim) === null || _c === void 0 ? void 0 : _c.call(_b)) &&
|
|
61
|
+
label: ((_c = (_b = classifier === null || classifier === void 0 ? void 0 : classifier.clientName) === null || _b === void 0 ? void 0 : _b.trim) === null || _c === void 0 ? void 0 : _c.call(_b)) && preview
|
|
56
62
|
? classifier === null || classifier === void 0 ? void 0 : classifier.clientName
|
|
57
63
|
: classifier === null || classifier === void 0 ? void 0 : classifier.name,
|
|
58
64
|
};
|
|
@@ -64,9 +70,9 @@ function ClassifierSelector(_a) {
|
|
|
64
70
|
}
|
|
65
71
|
};
|
|
66
72
|
var renderSelect = function () {
|
|
67
|
-
var _a;
|
|
73
|
+
var _a, _b, _c, _d;
|
|
68
74
|
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
69
|
-
width:
|
|
75
|
+
width: currentBreakPoint <= step.size
|
|
70
76
|
? '100%'
|
|
71
77
|
: calcStepWidth(step.size, form.size),
|
|
72
78
|
minHeight: step.description ||
|
|
@@ -78,9 +84,7 @@ function ClassifierSelector(_a) {
|
|
|
78
84
|
sizeChange();
|
|
79
85
|
}, getOptionSelected: function (option, value) {
|
|
80
86
|
return option.value === (value === null || value === void 0 ? void 0 : value.value);
|
|
81
|
-
}, helperText: errors[step.id]
|
|
82
|
-
? errors[step.id].message
|
|
83
|
-
: step.description, error: !!errors[step.id] }) }), step.id));
|
|
87
|
+
}, 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] }) }), step.id));
|
|
84
88
|
};
|
|
85
89
|
var mapNestedOption = function () {
|
|
86
90
|
if (value) {
|
|
@@ -88,18 +92,14 @@ function ClassifierSelector(_a) {
|
|
|
88
92
|
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === ClassifierOptionTypes.NESTED) {
|
|
89
93
|
return (_jsx(React.Fragment, { children: currentOption.steps.map(function (idStep) {
|
|
90
94
|
var subStep = form.steps[idStep];
|
|
91
|
-
return (
|
|
92
|
-
sizeChange();
|
|
93
|
-
} })));
|
|
95
|
+
return (_jsx(StepComponent, { step: subStep, level: level + 1, editable: editable, handleSizeChange: sizeChange }, idStep));
|
|
94
96
|
}) }));
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
};
|
|
98
100
|
if (level === 0 && step.maxSize && step.maxSize < form.size.blockNum) {
|
|
99
101
|
return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
|
|
100
|
-
width:
|
|
101
|
-
? '100%'
|
|
102
|
-
: 'fit-content',
|
|
102
|
+
width: currentBreakPoint <= step.size ? '100%' : 'fit-content',
|
|
103
103
|
} }, { children: [renderSelect(), mapNestedOption(), level === 0 && step.maxSize < form.size.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
104
104
|
width: fillerSize,
|
|
105
105
|
} }, "SEPARATOR"))] })));
|
|
@@ -110,12 +110,19 @@ function ClassifierSelector(_a) {
|
|
|
110
110
|
}
|
|
111
111
|
export default ClassifierSelectorStep;
|
|
112
112
|
function ClassifierSelectorStep(props) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
113
|
+
var step = props.step;
|
|
114
|
+
var _a = useStepDependency(step), handleStepDep = _a.handleStepDep, originalValue = _a.originalValue;
|
|
115
|
+
var _b = useController({
|
|
116
|
+
name: step.id,
|
|
117
|
+
rules: {
|
|
118
|
+
required: step.required ? 'Este campo es obligatorio' : undefined,
|
|
119
|
+
},
|
|
120
|
+
shouldUnregister: true,
|
|
121
|
+
defaultValue: originalValue,
|
|
122
|
+
}).field, ref = _b.ref, field = __rest(_b, ["ref"]);
|
|
123
|
+
var onChange = useCallback(function (value) {
|
|
124
|
+
handleStepDep(value);
|
|
125
|
+
field.onChange(value);
|
|
126
|
+
}, [handleStepDep, field]);
|
|
127
|
+
return (_jsx(ClassifierSelector, __assign({}, props, field, { inputRef: ref, onChange: onChange })));
|
|
121
128
|
}
|
|
@@ -5,5 +5,5 @@ export interface CollapsibleStepProps extends StepProps {
|
|
|
5
5
|
/** The CollapsibleStep to display */
|
|
6
6
|
step: Collapsible;
|
|
7
7
|
}
|
|
8
|
-
declare function CollapsibleStep({ step,
|
|
8
|
+
declare function CollapsibleStep({ step, ...others }: CollapsibleStepProps): JSX.Element;
|
|
9
9
|
export default CollapsibleStep;
|
|
@@ -21,16 +21,18 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { useAppSelector } from '../../hooks';
|
|
24
25
|
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
25
26
|
import MaterialCollapsibleStep from './MaterialTitleStep/MaterialCollapsibleStep';
|
|
26
27
|
function CollapsibleStep(_a) {
|
|
27
|
-
var step = _a.step,
|
|
28
|
+
var step = _a.step, others = __rest(_a, ["step"]);
|
|
29
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
28
30
|
if (step.steps.length === 0)
|
|
29
31
|
return _jsx(_Fragment, {});
|
|
30
32
|
switch (formStyle.type) {
|
|
31
33
|
case FormStyleTypes.MATERIAL:
|
|
32
34
|
default: {
|
|
33
|
-
return
|
|
35
|
+
return _jsx(MaterialCollapsibleStep, __assign({ step: step }, others));
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
}
|
|
@@ -22,20 +22,25 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { createElement as _createElement } from "react";
|
|
24
24
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
-
import React, { useEffect } from 'react';
|
|
25
|
+
import React, { useContext, useEffect } from 'react';
|
|
26
26
|
import styles from './MaterialCollapsibleStep.module.css';
|
|
27
|
-
import { Controller } from 'react-hook-form';
|
|
27
|
+
import { Controller, useFormContext } from 'react-hook-form';
|
|
28
28
|
import StepComponent from '../../Step';
|
|
29
29
|
import ExpandMoreRoundedIcon from '@material-ui/icons/ExpandMoreRounded';
|
|
30
30
|
import ExpandLessRoundedIcon from '@material-ui/icons/ExpandLessRounded';
|
|
31
|
+
import FormContext from '../../../Contexts/FormContext';
|
|
32
|
+
import { useAppSelector } from '../../../hooks';
|
|
31
33
|
function Collapsible(_a) {
|
|
32
34
|
var _b, _c, _d, _e;
|
|
33
|
-
var step = _a.step, open = _a.open, setOpen = _a.setOpen,
|
|
35
|
+
var step = _a.step, open = _a.open, setOpen = _a.setOpen, level = _a.level, others = __rest(_a, ["step", "open", "setOpen", "level"]);
|
|
36
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
37
|
+
var form = useContext(FormContext);
|
|
38
|
+
var errors = useFormContext().formState.errors;
|
|
34
39
|
var contentRef = React.useRef(null);
|
|
35
40
|
useEffect(function () {
|
|
36
41
|
var _a;
|
|
37
42
|
if (!open && ((_a = step.dependencies) === null || _a === void 0 ? void 0 : _a.find(function (dep) { return !!errors[dep]; }))) {
|
|
38
|
-
setOpen(
|
|
43
|
+
setOpen(true);
|
|
39
44
|
}
|
|
40
45
|
}, (_c = (_b = step.dependencies) === null || _b === void 0 ? void 0 : _b.map(function (dep) { return errors[dep]; })) !== null && _c !== void 0 ? _c : []);
|
|
41
46
|
return (_jsxs(React.Fragment, { children: [_jsxs("div", __assign({ className: styles.container, style: {
|
|
@@ -53,23 +58,23 @@ function Collapsible(_a) {
|
|
|
53
58
|
: 0,
|
|
54
59
|
} }, { children: _jsx("div", __assign({ className: styles.contentContainer, ref: contentRef }, { children: step.steps.map(function (idSubStep) {
|
|
55
60
|
var subStep = form.steps[idSubStep];
|
|
56
|
-
return (_createElement(StepComponent, __assign({}, others, {
|
|
61
|
+
return (_createElement(StepComponent, __assign({}, others, { step: subStep, key: idSubStep, level: level + 1 })));
|
|
57
62
|
}) })) })), _jsx("div", { className: styles.separator, style: {
|
|
58
63
|
backgroundColor: formStyle.primaryColor,
|
|
59
64
|
} })] }));
|
|
60
65
|
}
|
|
61
66
|
function CollapsibleStep(props) {
|
|
62
|
-
var _a
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
var _a;
|
|
68
|
+
var postview = useAppSelector(function (state) { return state.global; }).postview;
|
|
69
|
+
var _b = useFormContext(), clearErrors = _b.clearErrors, errors = _b.formState.errors;
|
|
70
|
+
return (_jsx(Controller, { name: props.step.id, defaultValue: ((_a = props.step.defaultValue) !== null && _a !== void 0 ? _a : postview) ? false : true, render: function (_a) {
|
|
66
71
|
var _b = _a.field, value = _b.value, onChange = _b.onChange;
|
|
67
72
|
return (_jsx(Collapsible, __assign({}, props, { open: value, setOpen: function (open) {
|
|
68
73
|
var _a;
|
|
69
74
|
if (!open) {
|
|
70
|
-
var deps = (_a = props.step.dependencies) === null || _a === void 0 ? void 0 : _a.filter(function (dep) { return !!
|
|
75
|
+
var deps = (_a = props.step.dependencies) === null || _a === void 0 ? void 0 : _a.filter(function (dep) { return !!errors[dep]; });
|
|
71
76
|
if (deps)
|
|
72
|
-
|
|
77
|
+
clearErrors(deps);
|
|
73
78
|
}
|
|
74
79
|
onChange(open);
|
|
75
80
|
} })));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
3
|
+
import { StepProps } from './Step';
|
|
4
|
+
import { Form } from '../@Types';
|
|
5
|
+
import { GlobalState } from '../States/GlobalStateReducer';
|
|
6
|
+
export interface CustomStepProps extends StepProps, UseFormReturn, GlobalState {
|
|
7
|
+
form: Form;
|
|
8
|
+
customStepProps: Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
export interface CustomStep {
|
|
11
|
+
componentProps?: Record<string, any>;
|
|
12
|
+
originalValues: Record<string, any>;
|
|
13
|
+
component: (props: CustomStepProps) => JSX.Element;
|
|
14
|
+
calcValue?: (step: any, value: any) => any;
|
|
15
|
+
/** Function to change custom steps nested step ids to the generated ones. */
|
|
16
|
+
calcRecursiveData?: (step: any, ids: Record<string, string>) => void;
|
|
17
|
+
calcDependencyValue?: (step: any, value: any) => any;
|
|
18
|
+
}
|
|
19
|
+
interface CustomStepComponentProps extends StepProps {
|
|
20
|
+
customStep: CustomStep;
|
|
21
|
+
}
|
|
22
|
+
declare function CustomStepComponent({ customStep, ...props }: CustomStepComponentProps): JSX.Element;
|
|
23
|
+
export default CustomStepComponent;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
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
|
+
import { useFormContext } from 'react-hook-form';
|
|
24
|
+
import FormContext from '../Contexts/FormContext';
|
|
25
|
+
import { useAppSelector } from '../hooks';
|
|
26
|
+
import CustomStepPropsContext from '../Contexts/CustomContext';
|
|
27
|
+
import { useContext } from 'react';
|
|
28
|
+
function CustomStepComponent(_a) {
|
|
29
|
+
var _b;
|
|
30
|
+
var customStep = _a.customStep, props = __rest(_a, ["customStep"]);
|
|
31
|
+
var form = useContext(FormContext);
|
|
32
|
+
var global = useAppSelector(function (state) { return state.global; });
|
|
33
|
+
var customStepProps = useContext(CustomStepPropsContext);
|
|
34
|
+
var formController = useFormContext();
|
|
35
|
+
return customStep.component(__assign(__assign(__assign(__assign(__assign({}, props), formController), { form: form, customStepProps: customStepProps }), global), ((_b = customStep.componentProps) !== null && _b !== void 0 ? _b : {})));
|
|
36
|
+
}
|
|
37
|
+
export default CustomStepComponent;
|
|
@@ -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 MaterialDatePickerStep from './MaterialDatePickerStep/MaterialDatePickerStep';
|
|
15
|
+
import { useAppSelector } from '../../hooks';
|
|
15
16
|
function DatePickerStep(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(MaterialDatePickerStep, __assign({}, props));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { DatePickerStepProps } from '../DatePickerStep';
|
|
3
|
-
declare function DatePickerStep({ step,
|
|
3
|
+
declare function DatePickerStep({ step, editable, defaultValue, }: DatePickerStepProps): JSX.Element;
|
|
4
4
|
export default DatePickerStep;
|
|
@@ -22,27 +22,39 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
import styles from './MaterialDatePickerStep.module.css';
|
|
25
|
-
import {
|
|
26
|
-
import RoundedDatePicker from '../../../
|
|
25
|
+
import { useController } from 'react-hook-form';
|
|
26
|
+
import RoundedDatePicker from '../../../Shared/RoundedDatePicker/RoundedDatePicker';
|
|
27
27
|
import { calcStepWidth } from '../../StepFunctions';
|
|
28
|
+
import { selectBreakPoint, useAppSelector } from '../../../hooks';
|
|
29
|
+
import FormContext from '../../../Contexts/FormContext';
|
|
30
|
+
import { useCallback, useContext } from 'react';
|
|
31
|
+
import { useStepDependency } from '../../StepHooks';
|
|
28
32
|
function DatePickerStep(_a) {
|
|
29
|
-
var
|
|
33
|
+
var _b;
|
|
34
|
+
var step = _a.step, editable = _a.editable, defaultValue = _a.defaultValue;
|
|
35
|
+
var currentBreakPoint = useAppSelector(selectBreakPoint);
|
|
36
|
+
var _c = useAppSelector(function (state) { return state.global; }), formStyle = _c.formStyle, postview = _c.postview;
|
|
37
|
+
var form = useContext(FormContext);
|
|
38
|
+
var _d = useStepDependency(step, defaultValue), handleStepDep = _d.handleStepDep, originalValue = _d.originalValue;
|
|
39
|
+
var _e = useController({
|
|
40
|
+
name: step.id,
|
|
41
|
+
rules: {
|
|
42
|
+
required: step.required ? 'Este campo es obligatorio' : undefined,
|
|
43
|
+
},
|
|
44
|
+
shouldUnregister: true,
|
|
45
|
+
defaultValue: originalValue,
|
|
46
|
+
}), _f = _e.field, ref = _f.ref, field = __rest(_f, ["ref"]), error = _e.fieldState.error;
|
|
47
|
+
var onChange = useCallback(function (value) {
|
|
48
|
+
handleStepDep(value);
|
|
49
|
+
field.onChange(value);
|
|
50
|
+
}, [handleStepDep, field]);
|
|
30
51
|
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
31
|
-
width:
|
|
52
|
+
width: currentBreakPoint <= step.size
|
|
32
53
|
? '100%'
|
|
33
54
|
: calcStepWidth(step.size, form.size),
|
|
34
55
|
minHeight: step.description || (!postview && editable && step.required)
|
|
35
56
|
? '55px'
|
|
36
57
|
: '43px',
|
|
37
|
-
} }, { children: _jsx(
|
|
38
|
-
required: step.required
|
|
39
|
-
? 'Este campo es obligatorio'
|
|
40
|
-
: undefined,
|
|
41
|
-
}, shouldUnregister: true, render: function (_a) {
|
|
42
|
-
var _b = _a.field, ref = _b.ref, field = __rest(_b, ["ref"]);
|
|
43
|
-
return (_jsx(RoundedDatePicker, __assign({}, field, { pickTime: step.pickTime, clearable: !step.required, clearLabel: "Borrar", inputRef: ref, cantEdit: !editable || postview, "data-testid": step.id, secondaryColor: formStyle.secondaryColor, contrastColor: formStyle.secondaryContrastColor, accentColor: formStyle.textColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, helperTextColor: formStyle.descriptionTextColor, fontWeight: 400, label: step.label, helperText: errors[step.id]
|
|
44
|
-
? errors[step.id].message
|
|
45
|
-
: step.description, error: !!errors[step.id], required: step.required })));
|
|
46
|
-
} }) })));
|
|
58
|
+
} }, { children: _jsx(RoundedDatePicker, __assign({}, field, { onChange: onChange, pickTime: step.pickTime, clearable: !step.required, clearLabel: "Borrar", inputRef: ref, cantEdit: !editable || postview, "data-testid": step.id, secondaryColor: formStyle.secondaryColor, contrastColor: formStyle.secondaryContrastColor, accentColor: formStyle.textColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, helperTextColor: formStyle.descriptionTextColor, fontWeight: 400, label: step.label, helperText: (_b = error === null || error === void 0 ? void 0 : error.message) !== null && _b !== void 0 ? _b : step.description, error: !!error, required: step.required })) })));
|
|
47
59
|
}
|
|
48
60
|
export default DatePickerStep;
|
|
@@ -11,5 +11,5 @@ export interface EntityValuePickerStepProps extends StepProps {
|
|
|
11
11
|
/** Default value to display */
|
|
12
12
|
defaultValue?: Date | null;
|
|
13
13
|
}
|
|
14
|
-
declare function EntityValuePickerStep(
|
|
14
|
+
declare function EntityValuePickerStep(props: EntityValuePickerStepProps): JSX.Element;
|
|
15
15
|
export default EntityValuePickerStep;
|
|
@@ -9,23 +9,13 @@ 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 MaterialEntityValuePickerStep from './MaterialEntityValuePickerStep/MaterialEntityValuePickerStep';
|
|
26
|
-
function EntityValuePickerStep(
|
|
27
|
-
var
|
|
28
|
-
switch (
|
|
16
|
+
function EntityValuePickerStep(props) {
|
|
17
|
+
var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
|
|
18
|
+
switch (formStyle.type) {
|
|
29
19
|
case FormStyleTypes.MATERIAL:
|
|
30
20
|
default: {
|
|
31
21
|
return _jsx(MaterialEntityValuePickerStep, __assign({}, props));
|