@arquimedes.co/eureka-forms 1.9.79-test → 1.9.80-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/@Types.d.ts +2 -0
- package/dist/@Types/@Types.js +1 -0
- package/dist/@Types/AYFFormStep.d.ts +19 -0
- package/dist/@Types/AYFFormStep.js +1 -0
- package/dist/@Types/CBRFormStep.d.ts +74 -0
- package/dist/@Types/CBRFormStep.js +1 -0
- package/dist/@Types/Form.d.ts +65 -0
- package/dist/@Types/Form.js +1 -0
- package/dist/@Types/FormStep.d.ts +138 -0
- package/dist/@Types/FormStep.js +1 -0
- package/dist/@Types/GenericFormSteps.d.ts +60 -0
- package/dist/@Types/GenericFormSteps.js +1 -0
- package/dist/@Types/Organization.d.ts +17 -0
- package/dist/@Types/Organization.js +1 -0
- package/dist/@Types/index.d.ts +1 -0
- package/dist/@Types/index.js +1 -0
- package/dist/App.d.ts +58 -0
- package/dist/App.js +470 -0
- package/dist/App.module.css +34 -0
- package/dist/AxiosAPI.d.ts +2 -0
- package/dist/AxiosAPI.js +8 -0
- package/dist/AxiosWidget.d.ts +2 -0
- package/dist/AxiosWidget.js +8 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.d.ts +7 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +379 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.module.css +51 -0
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.d.ts +12 -0
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +31 -0
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.module.css +64 -0
- package/dist/FormComponents/Form/Form.d.ts +41 -0
- package/dist/FormComponents/Form/Form.js +147 -0
- package/dist/FormComponents/Form/Form.module.css +39 -0
- package/dist/FormComponents/Form/StepperForm/StepperForm.d.ts +4 -0
- package/dist/FormComponents/Form/StepperForm/StepperForm.js +6 -0
- package/dist/FormComponents/Form/StepperForm/StepperForm.module.css +0 -0
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.d.ts +4 -0
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +42 -0
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.module.css +8 -0
- package/dist/FormComponents/Section/Section.d.ts +38 -0
- package/dist/FormComponents/Section/Section.js +23 -0
- package/dist/FormComponents/Step/@Construction/CBRElementStep/CBRElementStep.d.ts +8 -0
- package/dist/FormComponents/Step/@Construction/CBRElementStep/CBRElementStep.js +139 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.d.ts +9 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +23 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.d.ts +8 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +49 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.module.css +60 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.d.ts +11 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +121 -0
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.module.css +34 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.d.ts +8 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +138 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.module.css +54 -0
- package/dist/FormComponents/Step/AYFStepMapper.d.ts +12 -0
- package/dist/FormComponents/Step/AYFStepMapper.js +170 -0
- package/dist/FormComponents/Step/CBRStepMapper.d.ts +13 -0
- package/dist/FormComponents/Step/CBRStepMapper.js +202 -0
- package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.d.ts +9 -0
- package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +35 -0
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.d.ts +4 -0
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +65 -0
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.module.css +37 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.d.ts +9 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +35 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.d.ts +4 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +121 -0
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.module.css +25 -0
- package/dist/FormComponents/Step/CollapsibleStep/CollapsibleStep.d.ts +9 -0
- package/dist/FormComponents/Step/CollapsibleStep/CollapsibleStep.js +37 -0
- package/dist/FormComponents/Step/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.d.ts +4 -0
- package/dist/FormComponents/Step/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +75 -0
- package/dist/FormComponents/Step/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.module.css +62 -0
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.d.ts +11 -0
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +23 -0
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.d.ts +4 -0
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +48 -0
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.module.css +9 -0
- package/dist/FormComponents/Step/EntityValueStep/EntityValuePickerStep.d.ts +15 -0
- package/dist/FormComponents/Step/EntityValueStep/EntityValuePickerStep.js +35 -0
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.d.ts +4 -0
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +203 -0
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.module.css +25 -0
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.d.ts +9 -0
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +23 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.d.ts +13 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +123 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.module.css +60 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.d.ts +16 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +272 -0
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.module.css +59 -0
- package/dist/FormComponents/Step/MapperStep/MapperStep.d.ts +15 -0
- package/dist/FormComponents/Step/MapperStep/MapperStep.js +35 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.d.ts +10 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.js +27 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.module.css +60 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/PillElementContainer/PillElementContainer.d.ts +13 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/PillElementContainer/PillElementContainer.js +33 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/PillElementContainer/PillElementContainer.module.css +60 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +15 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.js +275 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.module.css +42 -0
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.d.ts +4 -0
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +71 -0
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.module.css +30 -0
- package/dist/FormComponents/Step/RatingStep/RatingStep.d.ts +9 -0
- package/dist/FormComponents/Step/RatingStep/RatingStep.js +23 -0
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.d.ts +4 -0
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +104 -0
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.module.css +25 -0
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.d.ts +9 -0
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +35 -0
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.d.ts +4 -0
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +11 -0
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.module.css +7 -0
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.d.ts +9 -0
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +35 -0
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +10 -0
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +241 -0
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.module.css +9 -0
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.d.ts +33 -0
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +23 -0
- package/dist/FormComponents/Step/Step.d.ts +11 -0
- package/dist/FormComponents/Step/Step.js +108 -0
- package/dist/FormComponents/Step/StepFunctions.d.ts +5 -0
- package/dist/FormComponents/Step/StepFunctions.js +65 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/DraftEditor.css +96 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.d.ts +13 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +213 -0
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +93 -0
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.d.ts +10 -0
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +23 -0
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.d.ts +4 -0
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +76 -0
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.module.css +9 -0
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.d.ts +13 -0
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +23 -0
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +4 -0
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +20 -0
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.module.css +19 -0
- package/dist/FormComponents/Step/TitleStep/TitleStep.d.ts +9 -0
- package/dist/FormComponents/Step/TitleStep/TitleStep.js +35 -0
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.d.ts +4 -0
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +88 -0
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.module.css +83 -0
- package/dist/FormComponents/Term/Term.d.ts +15 -0
- package/dist/FormComponents/Term/Term.js +23 -0
- package/dist/Icons/Construction/LeakIcon.d.ts +3 -0
- package/dist/Icons/Construction/LeakIcon.js +16 -0
- package/dist/Icons/Construction/ProjectIcon.d.ts +3 -0
- package/dist/Icons/Construction/ProjectIcon.js +16 -0
- package/dist/Icons/Construction/PropertyIcon.d.ts +3 -0
- package/dist/Icons/Construction/PropertyIcon.js +16 -0
- package/dist/Icons/Construction/SpaceIcon.d.ts +3 -0
- package/dist/Icons/Construction/SpaceIcon.js +16 -0
- package/dist/Icons/DocumentIcon.d.ts +3 -0
- package/dist/Icons/DocumentIcon.js +16 -0
- package/dist/Icons/Entities/GenericEntityIcon.d.ts +2 -0
- package/dist/Icons/Entities/GenericEntityIcon.js +17 -0
- package/dist/Icons/Entities/HandshakeIcon.d.ts +2 -0
- package/dist/Icons/Entities/HandshakeIcon.js +17 -0
- package/dist/Widget.d.ts +1 -0
- package/dist/Widget.js +61 -0
- package/dist/constants/AYFFormStepTypes.d.ts +9 -0
- package/dist/constants/AYFFormStepTypes.js +10 -0
- package/dist/constants/CBRFormStepTypes.d.ts +21 -0
- package/dist/constants/CBRFormStepTypes.js +22 -0
- package/dist/constants/Files/FileExtensions.d.ts +3 -0
- package/dist/constants/Files/FileExtensions.js +68 -0
- package/dist/constants/Files/FileMaxSize.d.ts +2 -0
- package/dist/constants/Files/FileMaxSize.js +2 -0
- package/dist/constants/FormStepTypes.d.ts +46 -0
- package/dist/constants/FormStepTypes.js +54 -0
- package/dist/constants/IconTypes.d.ts +10 -0
- package/dist/constants/IconTypes.js +11 -0
- package/dist/constants/InternalFormStyle.d.ts +3 -0
- package/dist/constants/InternalFormStyle.js +16 -0
- package/dist/constants/MaterialClassNameSeed.d.ts +1 -0
- package/dist/constants/MaterialClassNameSeed.js +1 -0
- package/dist/controllers/FileService.d.ts +5 -0
- package/dist/controllers/FileService.js +92 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +29 -0
- package/dist/index.lib.d.ts +7 -0
- package/dist/index.lib.js +5 -0
- package/dist/index.module.css +14 -0
- package/dist/shared/InputIcon/InputIcon.d.ts +7 -0
- package/dist/shared/InputIcon/InputIcon.js +81 -0
- package/dist/shared/Loader/Loader.d.ts +18 -0
- package/dist/shared/Loader/Loader.js +26 -0
- package/dist/shared/Loader/Loader.module.css +12 -0
- package/dist/shared/Navbar/Navbar.d.ts +9 -0
- package/dist/shared/Navbar/Navbar.js +18 -0
- package/dist/shared/Navbar/Navbar.module.css +18 -0
- package/dist/shared/Rating/Rating.d.ts +16 -0
- package/dist/shared/Rating/Rating.js +41 -0
- package/dist/shared/Rating/Rating.module.css +32 -0
- package/dist/shared/Rating/Ratings/LikeRating.d.ts +4 -0
- package/dist/shared/Rating/Ratings/LikeRating.js +43 -0
- package/dist/shared/Rating/Ratings/SatisfactionRating.d.ts +4 -0
- package/dist/shared/Rating/Ratings/SatisfactionRating.js +61 -0
- package/dist/shared/Rating/Ratings/ScaleRating.d.ts +4 -0
- package/dist/shared/Rating/Ratings/ScaleRating.js +63 -0
- package/dist/shared/RoundedButton/RoundedButton.d.ts +30 -0
- package/dist/shared/RoundedButton/RoundedButton.js +45 -0
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.d.ts +24 -0
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +101 -0
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.d.ts +48 -0
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +348 -0
- package/dist/shared/RoundedSelect/RoundedSelect.d.ts +68 -0
- package/dist/shared/RoundedSelect/RoundedSelect.js +214 -0
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +66 -0
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +234 -0
- package/dist/shared/RoundedTextField/RoundedTextField.d.ts +45 -0
- package/dist/shared/RoundedTextField/RoundedTextField.js +175 -0
- package/dist/utils/CbrFunctions.d.ts +8 -0
- package/dist/utils/CbrFunctions.js +53 -0
- package/package.json +1 -1
|
@@ -0,0 +1,104 @@
|
|
|
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 { createElement as _createElement } from "react";
|
|
24
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
import React, { useState } from 'react';
|
|
26
|
+
import { OptionTypes } from '../../../../constants/FormStepTypes';
|
|
27
|
+
import styles from './MaterialSelectorStep.module.css';
|
|
28
|
+
import StepComponent from '../../Step';
|
|
29
|
+
import { calcFillerSize, calcStepWidth } from '../../StepFunctions';
|
|
30
|
+
import { Controller } from 'react-hook-form';
|
|
31
|
+
import RoundedSmartSelect from '../../../../shared/RoundedSmartSelect/RoundedSmartSelect';
|
|
32
|
+
function Selector(_a) {
|
|
33
|
+
var step = _a.step, form = _a.form, value = _a.value, level = _a.level, onBlur = _a.onBlur, control = _a.control, editable = _a.editable, onChange = _a.onChange, postview = _a.postview, formStyle = _a.formStyle, getValues = _a.getValues, widthStats = _a.widthStats, handleSizeChange = _a.handleSizeChange, errors = _a.errors, inputRef = _a.inputRef, others = __rest(_a, ["step", "form", "value", "level", "onBlur", "control", "editable", "onChange", "postview", "formStyle", "getValues", "widthStats", "handleSizeChange", "errors", "inputRef"]);
|
|
34
|
+
var _b = useState(level === 0
|
|
35
|
+
? calcFillerSize(step, form.steps, getValues(), form.size)
|
|
36
|
+
: 0), fillerSize = _b[0], setFillerSize = _b[1];
|
|
37
|
+
var sizeChange = function () {
|
|
38
|
+
handleSizeChange === null || handleSizeChange === void 0 ? void 0 : handleSizeChange();
|
|
39
|
+
if (level === 0) {
|
|
40
|
+
setFillerSize(calcFillerSize(step, form.steps, getValues(), form.size));
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
var renderSelect = function () {
|
|
44
|
+
var _a;
|
|
45
|
+
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
46
|
+
width: widthStats.currentBreakPoint <= step.size
|
|
47
|
+
? '100%'
|
|
48
|
+
: calcStepWidth(step.size, form.size),
|
|
49
|
+
minHeight: step.description ||
|
|
50
|
+
(!postview && editable && step.required)
|
|
51
|
+
? '55px'
|
|
52
|
+
: '43px',
|
|
53
|
+
} }, { children: _jsx(RoundedSmartSelect, { value: value, onBlur: onBlur, disabled: false, loading: false, options: step.options, inputRef: inputRef, cantEdit: !editable || postview, fullWidth: true, backgroundColor: (_a = formStyle.stepBackgroundColor) !== null && _a !== void 0 ? _a : 'white', label: step.label, required: step.required, height: '31px', searchable: step.searchable, icon: undefined, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, containerMargin: "0px", handleUpdate: function (value) {
|
|
54
|
+
onChange(value);
|
|
55
|
+
}, getOptionSelected: function (option, value) {
|
|
56
|
+
return (option === null || option === void 0 ? void 0 : option.value) === (value === null || value === void 0 ? void 0 : value.value);
|
|
57
|
+
}, helperText: errors[step.id]
|
|
58
|
+
? errors[step.id].message
|
|
59
|
+
: step.description, error: !!errors[step.id] }) })));
|
|
60
|
+
};
|
|
61
|
+
var mapNestedOption = function () {
|
|
62
|
+
var currentOptionIndex = null;
|
|
63
|
+
var currentOption = null;
|
|
64
|
+
for (var i = 0; i < step.options.length; i++) {
|
|
65
|
+
var option = step.options[i];
|
|
66
|
+
if ((option === null || option === void 0 ? void 0 : option.value) === (value === null || value === void 0 ? void 0 : value.value)) {
|
|
67
|
+
currentOptionIndex = i;
|
|
68
|
+
currentOption = option;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === OptionTypes.NESTED &&
|
|
72
|
+
currentOptionIndex !== null) {
|
|
73
|
+
return (_jsx(React.Fragment, { children: currentOption.steps.map(function (idSubStep) {
|
|
74
|
+
var subStep = form.steps[idSubStep];
|
|
75
|
+
return (_createElement(StepComponent, __assign({}, others, { postview: postview, editable: editable, formStyle: formStyle, form: form, getValues: getValues, errors: errors, control: control, widthStats: widthStats, step: subStep, key: idSubStep, level: level + 1, handleSizeChange: function () {
|
|
76
|
+
sizeChange();
|
|
77
|
+
} })));
|
|
78
|
+
}) }));
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
if (level === 0 && step.maxSize < form.size.blockNum) {
|
|
82
|
+
return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
|
|
83
|
+
width: widthStats.currentBreakPoint <= step.size
|
|
84
|
+
? '100%'
|
|
85
|
+
: 'fit-content',
|
|
86
|
+
} }, { children: [renderSelect(), mapNestedOption(), level === 0 && step.maxSize < form.size.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
87
|
+
width: fillerSize,
|
|
88
|
+
} }))] })));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return (_jsxs(React.Fragment, { children: [renderSelect(), mapNestedOption(), level === 0 && _jsx("div", { className: styles.separator })] }));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function SelectorStep(props) {
|
|
95
|
+
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: "", rules: {
|
|
96
|
+
required: props.step.required
|
|
97
|
+
? 'Este campo es obligatorio'
|
|
98
|
+
: undefined,
|
|
99
|
+
}, shouldUnregister: true, render: function (_a) {
|
|
100
|
+
var _b = _a.field, ref = _b.ref, field = __rest(_b, ["ref"]);
|
|
101
|
+
return (_jsx(Selector, __assign({}, props, field, { inputRef: ref })));
|
|
102
|
+
} }));
|
|
103
|
+
}
|
|
104
|
+
export default SelectorStep;
|
package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.module.css
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
}
|
|
10
|
+
.separator {
|
|
11
|
+
flex-basis: 100%;
|
|
12
|
+
height: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.firstLvlContainer {
|
|
16
|
+
max-width: 100%;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-flow: row wrap;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.smallSeparator {
|
|
22
|
+
height: 0;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
flex-basis: 0;
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormSelector } from '../../../@Types/FormStep';
|
|
3
|
+
import { StepProps } from '../Step';
|
|
4
|
+
export interface SelectorStepProps extends StepProps {
|
|
5
|
+
/** The SelectorStep to display */
|
|
6
|
+
step: FormSelector;
|
|
7
|
+
}
|
|
8
|
+
declare function SelectorStep({ formStyle, ...others }: SelectorStepProps): JSX.Element;
|
|
9
|
+
export default SelectorStep;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
25
|
+
import MaterialSelectorStep from './MaterialSelectorStep/MaterialSelectorStep';
|
|
26
|
+
function SelectorStep(_a) {
|
|
27
|
+
var formStyle = _a.formStyle, others = __rest(_a, ["formStyle"]);
|
|
28
|
+
switch (formStyle.type) {
|
|
29
|
+
case FormStyleTypes.MATERIAL:
|
|
30
|
+
default: {
|
|
31
|
+
return _jsx(MaterialSelectorStep, __assign({ formStyle: formStyle }, others));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export default SelectorStep;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import styles from './MaterialSeparatorStep.module.css';
|
|
3
|
+
function SeparatorStep(_a) {
|
|
4
|
+
var step = _a.step, formStyle = _a.formStyle;
|
|
5
|
+
return (_jsx("div", { className: styles.container, style: {
|
|
6
|
+
backgroundColor: step.transparent
|
|
7
|
+
? 'transparent'
|
|
8
|
+
: formStyle.primaryColor,
|
|
9
|
+
} }));
|
|
10
|
+
}
|
|
11
|
+
export default SeparatorStep;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Separator } from '../../../@Types/FormStep';
|
|
3
|
+
import { StepProps } from '../Step';
|
|
4
|
+
export interface SeparatorStepProps extends StepProps {
|
|
5
|
+
/** The TitleStep to display */
|
|
6
|
+
step: Separator;
|
|
7
|
+
}
|
|
8
|
+
declare function SeparatorStep({ step, formStyle, ...others }: SeparatorStepProps): JSX.Element;
|
|
9
|
+
export default SeparatorStep;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
25
|
+
import MaterialSeparatorStep from './MaterialSeparatorStep/MaterialSeparatorStep';
|
|
26
|
+
function SeparatorStep(_a) {
|
|
27
|
+
var step = _a.step, formStyle = _a.formStyle, others = __rest(_a, ["step", "formStyle"]);
|
|
28
|
+
switch (formStyle.type) {
|
|
29
|
+
case FormStyleTypes.MATERIAL:
|
|
30
|
+
default: {
|
|
31
|
+
return (_jsx(MaterialSeparatorStep, __assign({ step: step, formStyle: formStyle }, others)));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export default SeparatorStep;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { SmartSelectStepProps } from '../SmartSelectStep';
|
|
3
|
+
export declare function SmartSelect({ icon, step, form, value, onBlur, errors, setFocus, children, editable, onChange, inputRef, postview, formStyle, getOptions, widthStats, organization, calcDepError, valueOverwrite, getValueString, originalValues, changeListener, dependencyStore, calcInvalidDeps, getValueWarning, getOptionSelected, setDependencyStore, ...others }: SmartSelectStepProps & {
|
|
4
|
+
onChange: Function;
|
|
5
|
+
onBlur: (event: any) => void;
|
|
6
|
+
value: any;
|
|
7
|
+
inputRef: any;
|
|
8
|
+
}): JSX.Element;
|
|
9
|
+
declare function SmartSelectStep(props: SmartSelectStepProps): JSX.Element;
|
|
10
|
+
export default SmartSelectStep;
|
package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
};
|
|
59
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
60
|
+
import styles from './MaterialSmartSelectStep.module.css';
|
|
61
|
+
import { Controller } from 'react-hook-form';
|
|
62
|
+
import { calcStepWidth } from '../../StepFunctions';
|
|
63
|
+
import RoundedSmartSelect from '../../../../shared/RoundedSmartSelect/RoundedSmartSelect';
|
|
64
|
+
import { cloneElement, useEffect, useState } from 'react';
|
|
65
|
+
import React from 'react';
|
|
66
|
+
export function SmartSelect(_a) {
|
|
67
|
+
var _this = this;
|
|
68
|
+
var _b, _c, _d, _e;
|
|
69
|
+
var icon = _a.icon, step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, setFocus = _a.setFocus, children = _a.children, editable = _a.editable, onChange = _a.onChange, inputRef = _a.inputRef, postview = _a.postview, formStyle = _a.formStyle, getOptions = _a.getOptions, widthStats = _a.widthStats, organization = _a.organization, calcDepError = _a.calcDepError, valueOverwrite = _a.valueOverwrite, getValueString = _a.getValueString, originalValues = _a.originalValues, changeListener = _a.changeListener, dependencyStore = _a.dependencyStore, _f = _a.calcInvalidDeps, calcInvalidDeps = _f === void 0 ? function (step, depStore) {
|
|
70
|
+
var _a;
|
|
71
|
+
var missingDeps = [];
|
|
72
|
+
for (var _i = 0, _b = (_a = step.dependencies) !== null && _a !== void 0 ? _a : []; _i < _b.length; _i++) {
|
|
73
|
+
var idDep = _b[_i];
|
|
74
|
+
if (depStore[idDep] === null) {
|
|
75
|
+
missingDeps.push(idDep);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return missingDeps;
|
|
79
|
+
} : _f, getValueWarning = _a.getValueWarning, getOptionSelected = _a.getOptionSelected, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["icon", "step", "form", "value", "onBlur", "errors", "setFocus", "children", "editable", "onChange", "inputRef", "postview", "formStyle", "getOptions", "widthStats", "organization", "calcDepError", "valueOverwrite", "getValueString", "originalValues", "changeListener", "dependencyStore", "calcInvalidDeps", "getValueWarning", "getOptionSelected", "setDependencyStore"]);
|
|
80
|
+
var _g = useState(true), first = _g[0], setFirst = _g[1];
|
|
81
|
+
var _h = useState(), options = _h[0], setOptions = _h[1];
|
|
82
|
+
var _j = useState(), error = _j[0], setError = _j[1];
|
|
83
|
+
var _k = useState(false), loading = _k[0], setLoading = _k[1];
|
|
84
|
+
var calcOptions = function (currentValue, invalidDeps) { return __awaiter(_this, void 0, void 0, function () {
|
|
85
|
+
var resp, currentOption, invalids, error_1;
|
|
86
|
+
var _a;
|
|
87
|
+
return __generator(this, function (_b) {
|
|
88
|
+
switch (_b.label) {
|
|
89
|
+
case 0:
|
|
90
|
+
setOptions(undefined);
|
|
91
|
+
_b.label = 1;
|
|
92
|
+
case 1:
|
|
93
|
+
_b.trys.push([1, 3, , 4]);
|
|
94
|
+
return [4 /*yield*/, (getOptions === null || getOptions === void 0 ? void 0 : getOptions(organization, step, dependencyStore, others.domain))];
|
|
95
|
+
case 2:
|
|
96
|
+
resp = _b.sent();
|
|
97
|
+
if (resp !== null) {
|
|
98
|
+
if (invalidDeps !== undefined && currentValue) {
|
|
99
|
+
currentOption = resp.find(function (option) {
|
|
100
|
+
return getOptionSelected(option, currentValue);
|
|
101
|
+
});
|
|
102
|
+
if (!currentOption) {
|
|
103
|
+
setError('Este campo es obligatorio');
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
invalids = (_a = calcInvalidDeps === null || calcInvalidDeps === void 0 ? void 0 : calcInvalidDeps(step, dependencyStore)) !== null && _a !== void 0 ? _a : [];
|
|
108
|
+
if (invalids.length === 0) {
|
|
109
|
+
setError(undefined);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
setOptions(resp);
|
|
114
|
+
return [3 /*break*/, 4];
|
|
115
|
+
case 3:
|
|
116
|
+
error_1 = _b.sent();
|
|
117
|
+
setOptions(null);
|
|
118
|
+
return [3 /*break*/, 4];
|
|
119
|
+
case 4:
|
|
120
|
+
setLoading(false);
|
|
121
|
+
return [2 /*return*/];
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}); };
|
|
125
|
+
useEffect(function () {
|
|
126
|
+
if (!postview) {
|
|
127
|
+
if (first) {
|
|
128
|
+
setFirst(false);
|
|
129
|
+
var invalids = calcInvalidDeps(step, dependencyStore).filter(function (idDep) { return originalValues[idDep]; });
|
|
130
|
+
setError(calcDepError === null || calcDepError === void 0 ? void 0 : calcDepError(invalids.map(function (idDep) { return form.steps[idDep]; })));
|
|
131
|
+
calcOptions(value, invalids);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
if (value) {
|
|
135
|
+
setLoading(true);
|
|
136
|
+
setOptions([]);
|
|
137
|
+
onChange(null);
|
|
138
|
+
}
|
|
139
|
+
calcOptions(null);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else if (value && !step.searchable) {
|
|
143
|
+
setOptions([value]);
|
|
144
|
+
}
|
|
145
|
+
}, (_c = (_b = step.dependencies) === null || _b === void 0 ? void 0 : _b.map(function (dep) { return dependencyStore[dep]; })) !== null && _c !== void 0 ? _c : []);
|
|
146
|
+
/**
|
|
147
|
+
* If the original value has no label search for it in the list.
|
|
148
|
+
*/
|
|
149
|
+
useEffect(function () {
|
|
150
|
+
var original = originalValues[step.id];
|
|
151
|
+
if (original &&
|
|
152
|
+
options &&
|
|
153
|
+
getValueString(original) !== undefined &&
|
|
154
|
+
!original.label) {
|
|
155
|
+
var newValue = options.find(function (option) { return getValueString(option) === getValueString(original); });
|
|
156
|
+
onChange(newValue);
|
|
157
|
+
}
|
|
158
|
+
}, [originalValues[step.id], options]);
|
|
159
|
+
var handleMissingDep = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
160
|
+
var invalids;
|
|
161
|
+
return __generator(this, function (_a) {
|
|
162
|
+
if (step.dependencies) {
|
|
163
|
+
invalids = calcInvalidDeps(step, dependencyStore);
|
|
164
|
+
setError(calcDepError === null || calcDepError === void 0 ? void 0 : calcDepError(invalids
|
|
165
|
+
.map(function (idDep) { return form.steps[idDep]; })
|
|
166
|
+
.filter(function (idDep) { return idDep !== undefined; })));
|
|
167
|
+
if (!value) {
|
|
168
|
+
if (invalids.length > 0) {
|
|
169
|
+
setFocus(invalids[0]);
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
setLoading(true);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return [2 /*return*/];
|
|
177
|
+
});
|
|
178
|
+
}); };
|
|
179
|
+
var warning = getValueWarning === null || getValueWarning === void 0 ? void 0 : getValueWarning(value);
|
|
180
|
+
return (_jsxs(React.Fragment, { children: [_jsx("div", __assign({ className: styles.container, style: {
|
|
181
|
+
width: widthStats.currentBreakPoint <= step.size
|
|
182
|
+
? '100%'
|
|
183
|
+
: calcStepWidth(step.size, form.size),
|
|
184
|
+
minHeight: step.description ||
|
|
185
|
+
(!postview && editable && step.required)
|
|
186
|
+
? '55px'
|
|
187
|
+
: '43px',
|
|
188
|
+
}, onClick: function () {
|
|
189
|
+
if (options === null && !(!editable || postview)) {
|
|
190
|
+
handleMissingDep();
|
|
191
|
+
}
|
|
192
|
+
if (options === undefined && !(!editable || postview)) {
|
|
193
|
+
setLoading(true);
|
|
194
|
+
}
|
|
195
|
+
}, "data-testid": step.id }, { children: _jsx(RoundedSmartSelect, { value: value, onBlur: onBlur, onFocus: function () {
|
|
196
|
+
if (options === null && !(!editable || postview)) {
|
|
197
|
+
handleMissingDep();
|
|
198
|
+
}
|
|
199
|
+
if (options === undefined && !(!editable || postview)) {
|
|
200
|
+
setLoading(true);
|
|
201
|
+
}
|
|
202
|
+
}, disabled: options === null, loading: loading, options: options !== null && options !== void 0 ? options : undefined, inputRef: inputRef, cantEdit: !editable || postview, fullWidth: true, backgroundColor: (_d = formStyle.stepBackgroundColor) !== null && _d !== void 0 ? _d : 'white', label: step.label, required: step.required, height: '31px', changeListener: changeListener, searchable: step.searchable, icon: step.showIcon ? icon : undefined, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, containerMargin: "0px", handleUpdate: function (value) {
|
|
203
|
+
var _a;
|
|
204
|
+
if (dependencyStore[step.id] !== undefined) {
|
|
205
|
+
setDependencyStore(__assign(__assign({}, dependencyStore), (_a = {}, _a[step.id] = value !== null && value !== void 0 ? value : null, _a)));
|
|
206
|
+
}
|
|
207
|
+
valueOverwrite
|
|
208
|
+
? onChange(valueOverwrite(value))
|
|
209
|
+
: onChange(value);
|
|
210
|
+
setError(undefined);
|
|
211
|
+
}, getOptionSelected: getOptionSelected, getValueString: getValueString, helperText: (_e = error !== null && error !== void 0 ? error : warning) !== null && _e !== void 0 ? _e : (errors[step.id]
|
|
212
|
+
? errors[step.id].message
|
|
213
|
+
: step.description), error: error !== undefined ||
|
|
214
|
+
(warning !== undefined && warning !== null) ||
|
|
215
|
+
!!errors[step.id] }) })), children &&
|
|
216
|
+
cloneElement(children, {
|
|
217
|
+
value: value,
|
|
218
|
+
stepProps: __assign({ step: step, form: form, errors: errors, setFocus: setFocus, postview: postview, editable: editable, formStyle: formStyle, widthStats: widthStats, organization: organization, originalValues: originalValues, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore }, others),
|
|
219
|
+
})] }));
|
|
220
|
+
}
|
|
221
|
+
function SmartSelectStep(props) {
|
|
222
|
+
var _a, _b;
|
|
223
|
+
useEffect(function () {
|
|
224
|
+
/** Al modificar tambien modificar en EntityValues */
|
|
225
|
+
if (!props.originalValues[props.step.id] && props.defaultValue) {
|
|
226
|
+
props.setDependencyStore(function (deps) {
|
|
227
|
+
var _a;
|
|
228
|
+
return (__assign(__assign({}, deps), (_a = {}, _a[props.step.id] = props.defaultValue, _a)));
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}, []);
|
|
232
|
+
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: (_b = (_a = props.originalValues[props.step.id]) !== null && _a !== void 0 ? _a : props.defaultValue) !== null && _b !== void 0 ? _b : null, rules: {
|
|
233
|
+
required: props.step.required
|
|
234
|
+
? 'Este campo es obligatorio'
|
|
235
|
+
: undefined,
|
|
236
|
+
}, shouldUnregister: true, render: function (_a) {
|
|
237
|
+
var _b = _a.field, ref = _b.ref, field = __rest(_b, ["ref"]);
|
|
238
|
+
return (_jsx(SmartSelect, __assign({}, props, field, { inputRef: ref })));
|
|
239
|
+
} }));
|
|
240
|
+
}
|
|
241
|
+
export default SmartSelectStep;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StepProps } from '../Step';
|
|
3
|
+
import { GSmartSelect } from '../../../@Types/GenericFormSteps';
|
|
4
|
+
import { Organization } from '../../../@Types';
|
|
5
|
+
import { FormStep } from '../../../@Types/FormStep';
|
|
6
|
+
export interface SmartSelectStepProps extends Omit<StepProps, 'step'> {
|
|
7
|
+
/** The SmartSelectStep to display */
|
|
8
|
+
step: GSmartSelect;
|
|
9
|
+
/** The icon to display */
|
|
10
|
+
icon?: React.ReactNode;
|
|
11
|
+
/** Function to call to get the options of the selector, return null if dependency is not met */
|
|
12
|
+
getOptions: (organization: Organization, step: GSmartSelect, dependencyStore: Record<string, any>, domain?: string) => Promise<any[] | null>;
|
|
13
|
+
/** Function to determine the currently selected option */
|
|
14
|
+
getOptionSelected: (option: any, value: any) => boolean;
|
|
15
|
+
/** Function to determine the current value in string format */
|
|
16
|
+
getValueString: (value: any) => string;
|
|
17
|
+
/** Function to if currently selected option has warning */
|
|
18
|
+
getValueWarning?: (value: any) => string | null;
|
|
19
|
+
/** Function that returns the error message based on the types of the missing Dependencies, undefined if no error msg */
|
|
20
|
+
calcDepError?: (types: FormStep[]) => string | undefined;
|
|
21
|
+
/** Function that returns the missing dependencies based on the current value */
|
|
22
|
+
calcInvalidDeps?: (step: GSmartSelect, dependencyStore: Record<string, any>) => string[];
|
|
23
|
+
/** children to render */
|
|
24
|
+
children?: React.ReactElement<any, string>;
|
|
25
|
+
/** Function that overwrites the value before setting it */
|
|
26
|
+
valueOverwrite?: (value: any | null) => any;
|
|
27
|
+
/** Function called on each value change */
|
|
28
|
+
changeListener?: (value: any) => void;
|
|
29
|
+
/** default Value to select */
|
|
30
|
+
defaultValue?: any;
|
|
31
|
+
}
|
|
32
|
+
declare function SmartSelectStep(props: SmartSelectStepProps): JSX.Element;
|
|
33
|
+
export default SmartSelectStep;
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
14
|
+
import MaterialSmartSelectStep from './MaterialSmartSelectStep/MaterialSmartSelectStep';
|
|
15
|
+
function SmartSelectStep(props) {
|
|
16
|
+
switch (props.formStyle.type) {
|
|
17
|
+
case FormStyleTypes.MATERIAL:
|
|
18
|
+
default: {
|
|
19
|
+
return _jsx(MaterialSmartSelectStep, __assign({}, props));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export default SmartSelectStep;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FormStep } from '../../@Types/FormStep';
|
|
3
|
+
import { RecursiveData } from '../Section/Section';
|
|
4
|
+
export interface StepProps extends RecursiveData {
|
|
5
|
+
step: FormStep;
|
|
6
|
+
handleSizeChange?: Function;
|
|
7
|
+
level: number;
|
|
8
|
+
globalEditable: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function StepComponent({ step, ...props }: StepProps): JSX.Element;
|
|
11
|
+
export default StepComponent;
|