@arquimedes.co/eureka-forms 1.9.19-test → 1.9.20
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/App.js +205 -98
- package/dist/AxiosAPI.js +3 -3
- package/dist/AxiosWidget.js +4 -4
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +207 -104
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +17 -5
- package/dist/FormComponents/Form/Form.js +56 -29
- package/dist/FormComponents/Form/StepperForm/StepperForm.js +1 -1
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +30 -7
- package/dist/FormComponents/Section/Section.js +13 -2
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +13 -2
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +32 -9
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +70 -49
- package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +102 -41
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +92 -37
- package/dist/FormComponents/Step/AYFStepMapper.js +75 -23
- package/dist/FormComponents/Step/CBRStepMapper.js +144 -56
- package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +26 -3
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +21 -6
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +26 -3
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +65 -32
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +13 -2
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +21 -6
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +13 -2
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +88 -27
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +171 -81
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +41 -15
- package/dist/FormComponents/Step/RatingStep/RatingStep.js +13 -2
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +52 -25
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +26 -3
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +2 -1
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +26 -3
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +145 -83
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +13 -2
- package/dist/FormComponents/Step/Step.js +39 -19
- package/dist/FormComponents/Step/StepFunctions.js +16 -14
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +62 -43
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +13 -2
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +21 -6
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +13 -2
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +15 -3
- package/dist/FormComponents/Step/TitleStep/TitleStep.js +26 -3
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +35 -19
- package/dist/FormComponents/Term/Term.js +13 -2
- package/dist/Widget.js +29 -13
- package/dist/constants/Files/FileExtensions.js +3 -3
- package/dist/constants/Files/FileMaxSize.js +1 -1
- package/dist/constants/InternalFormStyle.js +1 -1
- package/dist/constants/MaterialClassNameSeed.js +1 -1
- package/dist/controllers/FileService.js +86 -29
- package/dist/index.js +15 -4
- package/dist/shared/Loader/Loader.js +17 -5
- package/dist/shared/Navbar/Navbar.js +14 -2
- package/dist/shared/Rating/Rating.js +27 -4
- package/dist/shared/Rating/Ratings/LikeRating.js +21 -9
- package/dist/shared/Rating/Ratings/SatisfactionRating.js +27 -15
- package/dist/shared/Rating/Ratings/ScaleRating.js +49 -22
- package/dist/shared/RoundedButton/RoundedButton.js +24 -12
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +84 -39
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +286 -235
- package/dist/shared/RoundedSelect/RoundedSelect.js +152 -103
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +160 -125
- package/dist/shared/RoundedTextField/RoundedTextField.js +137 -92
- package/dist/utils/CbrFunctions.js +30 -30
- package/package.json +1 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Types, { ClassifierOptionTypes, OptionTypes, } from '../../constants/FormStepTypes';
|
|
2
2
|
export function calcFillerSize(step, steps, values, size) {
|
|
3
3
|
if (step.maxSize < size.blockNum) {
|
|
4
|
-
|
|
4
|
+
var stepSize = step.maxSize - recursivelyCheckOpenSize(step.id, steps, values);
|
|
5
5
|
return (size.blockSize * stepSize + size.spacingSize * (stepSize - 1) + 20);
|
|
6
6
|
}
|
|
7
7
|
else {
|
|
@@ -9,15 +9,16 @@ export function calcFillerSize(step, steps, values, size) {
|
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
export function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
var step = steps[idStep];
|
|
13
|
+
var value = values[idStep];
|
|
14
14
|
if (step.type === Types.SELECTOR) {
|
|
15
|
-
|
|
15
|
+
var size = step.size;
|
|
16
16
|
if (value) {
|
|
17
|
-
|
|
18
|
-
if (currentOption
|
|
19
|
-
|
|
20
|
-
for (
|
|
17
|
+
var currentOption = step.options.find(function (option) { return option.value === value; });
|
|
18
|
+
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === OptionTypes.NESTED) {
|
|
19
|
+
var optionSize = 0;
|
|
20
|
+
for (var _i = 0, _a = currentOption.steps; _i < _a.length; _i++) {
|
|
21
|
+
var pStepId = _a[_i];
|
|
21
22
|
optionSize += recursivelyCheckOpenSize(pStepId, steps, values);
|
|
22
23
|
}
|
|
23
24
|
size += optionSize;
|
|
@@ -26,12 +27,13 @@ export function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
26
27
|
return size;
|
|
27
28
|
}
|
|
28
29
|
if (step.type === Types.CLASSIFIER_SELECTOR) {
|
|
29
|
-
|
|
30
|
+
var size = step.size;
|
|
30
31
|
if (value) {
|
|
31
|
-
|
|
32
|
-
if (currentOption
|
|
33
|
-
|
|
34
|
-
for (
|
|
32
|
+
var currentOption = step.options[value];
|
|
33
|
+
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === ClassifierOptionTypes.NESTED) {
|
|
34
|
+
var optionSize = 0;
|
|
35
|
+
for (var _b = 0, _c = currentOption.steps; _b < _c.length; _b++) {
|
|
36
|
+
var pStepId = _c[_b];
|
|
35
37
|
optionSize += recursivelyCheckOpenSize(pStepId, steps, values);
|
|
36
38
|
}
|
|
37
39
|
size += optionSize;
|
|
@@ -43,6 +45,6 @@ export function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
43
45
|
return 4;
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
|
-
export
|
|
48
|
+
export var calcStepWidth = function (stepSize, size) {
|
|
47
49
|
return size.blockSize * stepSize + size.spacingSize * (stepSize - 1);
|
|
48
50
|
};
|
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import RoundedTextField from '../../../../shared/RoundedTextField/RoundedTextField';
|
|
3
14
|
import styles from './MaterialTextAreaStep.module.css';
|
|
@@ -8,87 +19,93 @@ import './DraftEditor.css';
|
|
|
8
19
|
import { convertFromRaw, EditorState } from 'draft-js';
|
|
9
20
|
import React, { useState } from 'react';
|
|
10
21
|
import { ClickAwayListener } from '@material-ui/core';
|
|
11
|
-
function TextAreaStep(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
22
|
+
function TextAreaStep(_a) {
|
|
23
|
+
var step = _a.step, errors = _a.errors, partial = _a.partial, control = _a.control, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, maxLength = _a.maxLength, originalValues = _a.originalValues, backgroundColor = _a.backgroundColor;
|
|
24
|
+
var _b = useState(false), hovering = _b[0], setHovering = _b[1];
|
|
25
|
+
var _c = useState(false), focus = _c[0], setFocus = _c[1];
|
|
26
|
+
var calcStyle = function () {
|
|
27
|
+
var backgroundColor = formStyle.stepBackgroundColor;
|
|
16
28
|
if (focus) {
|
|
17
29
|
return {
|
|
18
30
|
border: '2px solid ' + formStyle.primaryColor,
|
|
19
31
|
marginTop: -1,
|
|
20
32
|
marginLeft: -1,
|
|
21
33
|
marginBottom: 0,
|
|
22
|
-
backgroundColor,
|
|
34
|
+
backgroundColor: backgroundColor,
|
|
23
35
|
};
|
|
24
36
|
}
|
|
25
37
|
else if (hovering) {
|
|
26
38
|
return {
|
|
27
39
|
border: '1px solid ' + formStyle.primaryColor,
|
|
28
|
-
backgroundColor,
|
|
40
|
+
backgroundColor: backgroundColor,
|
|
29
41
|
};
|
|
30
42
|
}
|
|
31
43
|
else {
|
|
32
44
|
return {
|
|
33
45
|
border: '1px solid ' + formStyle.outlineColor,
|
|
34
|
-
backgroundColor,
|
|
46
|
+
backgroundColor: backgroundColor,
|
|
35
47
|
};
|
|
36
48
|
}
|
|
37
49
|
};
|
|
38
|
-
|
|
50
|
+
var calcDefaultStringValue = function (defaultValue) {
|
|
51
|
+
var _a;
|
|
39
52
|
if (typeof defaultValue === 'string') {
|
|
40
53
|
return defaultValue;
|
|
41
54
|
}
|
|
42
55
|
else {
|
|
43
|
-
return defaultValue
|
|
56
|
+
return (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.text) !== null && _a !== void 0 ? _a : '';
|
|
44
57
|
}
|
|
45
58
|
};
|
|
46
|
-
|
|
59
|
+
var calcDefaultDraftValue = function (defaultValue) {
|
|
47
60
|
if (typeof defaultValue === 'string') {
|
|
48
61
|
return EditorState.createWithContent(convertFromRaw(stringToDraft(defaultValue)));
|
|
49
62
|
}
|
|
50
63
|
else {
|
|
51
|
-
return EditorState.createWithContent(convertFromRaw(getRawText(defaultValue
|
|
64
|
+
return EditorState.createWithContent(convertFromRaw(getRawText(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.draft, defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.text)));
|
|
52
65
|
}
|
|
53
66
|
};
|
|
54
|
-
|
|
67
|
+
var canEdit = editable && !postview;
|
|
55
68
|
if (step.hasTextEditor) {
|
|
56
|
-
return (_jsxs("div", { className: styles.textEditorContainer, style: {
|
|
69
|
+
return (_jsxs("div", __assign({ className: styles.textEditorContainer, style: {
|
|
57
70
|
'--eureka-outline': formStyle.outlineColor,
|
|
58
71
|
'--eureka-primary': formStyle.primaryColor,
|
|
59
|
-
}, children: [step.label && (_jsxs("div", { className: styles.textEditorLabel, style: {
|
|
72
|
+
} }, { children: [step.label && (_jsxs("div", __assign({ className: styles.textEditorLabel, style: {
|
|
60
73
|
color: !!errors[step.id]
|
|
61
74
|
? formStyle.errorColor
|
|
62
75
|
: formStyle.textColor,
|
|
63
|
-
}, children: [step.label, " ", step.required ? ' *' : ''] })), _jsx(ClickAwayListener, { mouseEvent: "onMouseDown", onClickAway: ()
|
|
76
|
+
} }, { children: [step.label, " ", step.required ? ' *' : ''] }))), _jsx(ClickAwayListener, __assign({ mouseEvent: "onMouseDown", onClickAway: function () {
|
|
64
77
|
if (canEdit) {
|
|
65
78
|
setFocus(false);
|
|
66
79
|
}
|
|
67
|
-
}, children: _jsx("div", { className: postview
|
|
80
|
+
} }, { children: _jsx("div", __assign({ className: postview
|
|
68
81
|
? styles.postViewContainer +
|
|
69
82
|
' EF-DraftContainer'
|
|
70
|
-
: styles.textContainer + ' EF-DraftContainer', "data-testid": step.id, style: calcStyle(), onMouseEnter: ()
|
|
83
|
+
: styles.textContainer + ' EF-DraftContainer', "data-testid": step.id, style: calcStyle(), onMouseEnter: function () {
|
|
71
84
|
if (canEdit) {
|
|
72
85
|
setHovering(true);
|
|
73
86
|
}
|
|
74
|
-
}, onMouseLeave: ()
|
|
87
|
+
}, onMouseLeave: function () {
|
|
75
88
|
if (canEdit) {
|
|
76
89
|
setHovering(false);
|
|
77
90
|
}
|
|
78
|
-
}, onClick: ()
|
|
91
|
+
}, onClick: function () {
|
|
79
92
|
if (canEdit) {
|
|
80
93
|
setFocus(true);
|
|
81
94
|
}
|
|
82
|
-
}, children: _jsx(Controller, { name: step.id, control: control, defaultValue: originalValues[step.id]
|
|
95
|
+
} }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: originalValues[step.id]
|
|
83
96
|
? calcDefaultDraftValue(originalValues[step.id])
|
|
84
97
|
: EditorState.createEmpty(), rules: step.required
|
|
85
98
|
? {
|
|
86
|
-
validate: (editorState)
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
validate: function (editorState) {
|
|
100
|
+
return editorState
|
|
101
|
+
.getCurrentContent()
|
|
102
|
+
.hasText();
|
|
103
|
+
},
|
|
89
104
|
}
|
|
90
|
-
: {}, shouldUnregister: true, render: (
|
|
91
|
-
|
|
105
|
+
: {}, shouldUnregister: true, render: function (_a) {
|
|
106
|
+
var _b;
|
|
107
|
+
var field = _a.field;
|
|
108
|
+
var editorClassName = styles.editor;
|
|
92
109
|
if (!field.value.getCurrentContent().hasText()) {
|
|
93
110
|
if (field.value
|
|
94
111
|
.getCurrentContent()
|
|
@@ -102,12 +119,12 @@ function TextAreaStep({ step, errors, partial, control, editable, postview, form
|
|
|
102
119
|
if (!canEdit) {
|
|
103
120
|
editorClassName += ' postview-editor';
|
|
104
121
|
}
|
|
105
|
-
return (_jsx(Editor, { editorRef: field.ref, onFocus: ()
|
|
122
|
+
return (_jsx(Editor, { editorRef: field.ref, onFocus: function () {
|
|
106
123
|
setFocus(true);
|
|
107
124
|
}, readOnly: !canEdit, onBlur: field.onBlur, stripPastedStyles: true, editorState: field.value, onEditorStateChange: field.onChange, toolbarClassName: styles.toolbar +
|
|
108
125
|
(!canEdit
|
|
109
126
|
? ' postview-editor-toolbar'
|
|
110
|
-
: ''), editorClassName: editorClassName, wrapperClassName: styles.wrapper, placeholder: step.description
|
|
127
|
+
: ''), editorClassName: editorClassName, wrapperClassName: styles.wrapper, placeholder: (_b = step.description) !== null && _b !== void 0 ? _b : '', toolbar: {
|
|
111
128
|
options: [
|
|
112
129
|
'inline',
|
|
113
130
|
'list',
|
|
@@ -125,36 +142,38 @@ function TextAreaStep({ step, errors, partial, control, editable, postview, form
|
|
|
125
142
|
options: ['unordered'],
|
|
126
143
|
},
|
|
127
144
|
} }));
|
|
128
|
-
} }) }) }), _jsx("div", { className: styles.errorMsg, style: {
|
|
145
|
+
} }) })) })), _jsx("div", __assign({ className: styles.errorMsg, style: {
|
|
129
146
|
color: formStyle.errorColor,
|
|
130
|
-
}, children: !!errors[step.id] && 'Este campo es obligatorio' })] }));
|
|
147
|
+
} }, { children: !!errors[step.id] && 'Este campo es obligatorio' }))] })));
|
|
131
148
|
}
|
|
132
149
|
else {
|
|
133
|
-
return (_jsx("div", { className: styles.container, style: {
|
|
150
|
+
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
134
151
|
paddingBottom: step.required || step.description || !!errors[step.id]
|
|
135
152
|
? '0px'
|
|
136
153
|
: '5px',
|
|
137
|
-
}, children: _jsx(Controller, { name: step.id, control: control, defaultValue: calcDefaultStringValue(originalValues[step.id]), rules: {
|
|
154
|
+
} }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: calcDefaultStringValue(originalValues[step.id]), rules: {
|
|
138
155
|
required: step.required
|
|
139
156
|
? 'Este campo es obligatorio'
|
|
140
157
|
: undefined,
|
|
141
|
-
}, shouldUnregister: true, render: (
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
158
|
+
}, shouldUnregister: true, render: function (_a) {
|
|
159
|
+
var _b;
|
|
160
|
+
var field = _a.field;
|
|
161
|
+
return (_jsxs(React.Fragment, { children: [_jsx("div", __assign({ className: styles.erkTextArea }, { children: _jsx(RoundedTextField, __assign({}, field, { "data-testid": step.id, maxLength: maxLength, label: step.label, inputRef: field.ref, required: step.required, cantEdit: !canEdit, fontWeight: 400, multiline: true, minRows: postview && partial ? undefined : 4, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: backgroundColor !== null && backgroundColor !== void 0 ? backgroundColor : formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperTextColor: formStyle.descriptionTextColor, helperText: errors[step.id]
|
|
162
|
+
? errors[step.id].message
|
|
163
|
+
: (_b = step.description) !== null && _b !== void 0 ? _b : (step.required ? ' ' : null), error: !!errors[step.id] })) })), postview && (_jsxs("div", __assign({ className: styles.print }, { children: [_jsxs("div", { children: [step.label, ":"] }), _jsx("p", __assign({ className: styles.printContainer, style: {
|
|
164
|
+
backgroundColor: formStyle.stepBackgroundColor,
|
|
165
|
+
borderColor: formStyle.outlineColor,
|
|
166
|
+
} }, { children: field.value }))] })))] }));
|
|
167
|
+
} }) })));
|
|
149
168
|
}
|
|
150
169
|
}
|
|
151
170
|
export default TextAreaStep;
|
|
152
171
|
export function stringToDraft(text) {
|
|
153
|
-
|
|
172
|
+
var draftStructure = {
|
|
154
173
|
blocks: [],
|
|
155
174
|
entityMap: {},
|
|
156
175
|
};
|
|
157
|
-
text.split('\n').forEach((element, index)
|
|
176
|
+
text.split('\n').forEach(function (element, index) {
|
|
158
177
|
draftStructure.blocks.push({
|
|
159
178
|
key: String(index),
|
|
160
179
|
text: element,
|
|
@@ -167,7 +186,7 @@ export function stringToDraft(text) {
|
|
|
167
186
|
});
|
|
168
187
|
return draftStructure;
|
|
169
188
|
}
|
|
170
|
-
export
|
|
189
|
+
export var getRawText = function (draft, text) {
|
|
171
190
|
if (draft !== undefined) {
|
|
172
191
|
return draft;
|
|
173
192
|
}
|
|
@@ -1,13 +1,24 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
3
14
|
import MaterialTextAreaStep from './MaterialTextAreaStep/MaterialTextAreaStep';
|
|
4
15
|
function TextAreaStep(props) {
|
|
5
16
|
switch (props.formStyle.type) {
|
|
6
17
|
case FormStyleTypes.MATERIAL: {
|
|
7
|
-
return _jsx(MaterialTextAreaStep, {
|
|
18
|
+
return _jsx(MaterialTextAreaStep, __assign({}, props));
|
|
8
19
|
}
|
|
9
20
|
default: {
|
|
10
|
-
return _jsx(MaterialTextAreaStep, {
|
|
21
|
+
return _jsx(MaterialTextAreaStep, __assign({}, props));
|
|
11
22
|
}
|
|
12
23
|
}
|
|
13
24
|
}
|
package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import RoundedTextField from '../../../../shared/RoundedTextField/RoundedTextField';
|
|
3
14
|
import styles from './MaterialTextInputStep.module.css';
|
|
4
15
|
import { Controller } from 'react-hook-form';
|
|
5
16
|
import { calcStepWidth } from '../../StepFunctions';
|
|
6
|
-
function TextInputStep(
|
|
7
|
-
|
|
17
|
+
function TextInputStep(_a) {
|
|
18
|
+
var icon = _a.icon, step = _a.step, form = _a.form, errors = _a.errors, control = _a.control, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b;
|
|
19
|
+
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
8
20
|
width: widthStats.currentBreakPoint <= step.size
|
|
9
21
|
? '100%'
|
|
10
22
|
: calcStepWidth(step.size, form.size),
|
|
11
23
|
minHeight: step.description || step.required || step.validation
|
|
12
24
|
? '55px'
|
|
13
25
|
: '43px',
|
|
14
|
-
}, children: _jsx(Controller, { name: step.id, control: control, defaultValue: defaultValue, rules: {
|
|
26
|
+
} }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: defaultValue, rules: {
|
|
15
27
|
required: step.required
|
|
16
28
|
? 'Este campo es obligatorio'
|
|
17
29
|
: undefined,
|
|
@@ -21,8 +33,11 @@ function TextInputStep({ icon, step, form, errors, control, editable, postview,
|
|
|
21
33
|
message: step.validation.message,
|
|
22
34
|
}
|
|
23
35
|
: undefined,
|
|
24
|
-
}, shouldUnregister: true, render: (
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
}, shouldUnregister: true, render: function (_a) {
|
|
37
|
+
var field = _a.field;
|
|
38
|
+
return (_jsx(RoundedTextField, __assign({}, field, { "data-testid": step.id, label: step.label, inputRef: field.ref, cantEdit: !editable || postview, required: step.required, fontWeight: 400, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperText: errors[step.id]
|
|
39
|
+
? errors[step.id].message
|
|
40
|
+
: step.description, helperTextColor: formStyle.descriptionTextColor, error: !!errors[step.id], icon: step.showIcon ? icon : undefined })));
|
|
41
|
+
} }) })));
|
|
27
42
|
}
|
|
28
43
|
export default TextInputStep;
|
|
@@ -1,13 +1,24 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
3
14
|
import MaterialTextInputStep from './MaterialTextInputStep/MaterialTextInputStep';
|
|
4
15
|
function TextInputStep(props) {
|
|
5
16
|
switch (props.formStyle.type) {
|
|
6
17
|
case FormStyleTypes.MATERIAL: {
|
|
7
|
-
return _jsx(MaterialTextInputStep, {
|
|
18
|
+
return _jsx(MaterialTextInputStep, __assign({}, props));
|
|
8
19
|
}
|
|
9
20
|
default: {
|
|
10
|
-
return _jsx(MaterialTextInputStep, {
|
|
21
|
+
return _jsx(MaterialTextInputStep, __assign({}, props));
|
|
11
22
|
}
|
|
12
23
|
}
|
|
13
24
|
}
|
|
@@ -1,8 +1,20 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
13
|
import styles from './MaterialTitleStep.module.css';
|
|
3
|
-
function TitleStep(
|
|
4
|
-
|
|
14
|
+
function TitleStep(_a) {
|
|
15
|
+
var step = _a.step, formStyle = _a.formStyle, widthStats = _a.widthStats;
|
|
16
|
+
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.titleLbl, style: { textAlign: widthStats.isMobile ? 'center' : 'start' } }, { children: step.title })), step.description && (_jsx("p", __assign({ className: styles.descriptionPar, style: {
|
|
5
17
|
margin: step.title ? '10px 0px' : '0px 0px 5px 0px',
|
|
6
|
-
}, children: step.description }))] }));
|
|
18
|
+
} }, { children: step.description })))] })));
|
|
7
19
|
}
|
|
8
20
|
export default TitleStep;
|
|
@@ -1,13 +1,36 @@
|
|
|
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
|
+
};
|
|
1
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
24
|
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
3
25
|
import MaterialTitleStep from './MaterialTitleStep/MaterialTitleStep';
|
|
4
|
-
function TitleStep(
|
|
26
|
+
function TitleStep(_a) {
|
|
27
|
+
var step = _a.step, formStyle = _a.formStyle, others = __rest(_a, ["step", "formStyle"]);
|
|
5
28
|
switch (formStyle.type) {
|
|
6
29
|
case FormStyleTypes.MATERIAL: {
|
|
7
|
-
return (_jsx(MaterialTitleStep, { step: step, formStyle: formStyle,
|
|
30
|
+
return (_jsx(MaterialTitleStep, __assign({ step: step, formStyle: formStyle }, others)));
|
|
8
31
|
}
|
|
9
32
|
default: {
|
|
10
|
-
return (_jsx(MaterialTitleStep, { step: step, formStyle: formStyle,
|
|
33
|
+
return (_jsx(MaterialTitleStep, __assign({ step: step, formStyle: formStyle }, others)));
|
|
11
34
|
}
|
|
12
35
|
}
|
|
13
36
|
}
|
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
13
|
import { Dialog } from '@material-ui/core';
|
|
3
14
|
import React from 'react';
|
|
@@ -7,55 +18,60 @@ import RoundedButton from '../../../shared/RoundedButton/RoundedButton';
|
|
|
7
18
|
import RoundedCheckBox from '../../../shared/RoundedCheckBox/RoundedCheckBox';
|
|
8
19
|
import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
|
|
9
20
|
import styles from './MaterialTerm.module.css';
|
|
10
|
-
function TermComponent(
|
|
11
|
-
|
|
21
|
+
function TermComponent(_a) {
|
|
22
|
+
var _b;
|
|
23
|
+
var term = _a.term, errors = _a.errors, control = _a.control, postview = _a.postview, setValue = _a.setValue, formStyle = _a.formStyle, tempError = _a.tempError;
|
|
24
|
+
var _c = useState(false), showDialog = _c[0], setShowDialog = _c[1];
|
|
12
25
|
/**
|
|
13
26
|
* Function that renders the highlighted text
|
|
14
27
|
* @returns a string with span highlighted
|
|
15
28
|
*/
|
|
16
|
-
|
|
29
|
+
var renderText = function (text) {
|
|
17
30
|
if (text) {
|
|
18
31
|
var parts = text.split(/{{(.*?)}}/gi);
|
|
19
32
|
for (var i = 1; i < parts.length; i += 2) {
|
|
20
|
-
parts[i] = (_jsx("span", { className: styles.highlight, style: {
|
|
33
|
+
parts[i] = (_jsx("span", __assign({ className: styles.highlight, style: {
|
|
21
34
|
color: !!errors[term.id] && tempError
|
|
22
35
|
? formStyle.errorColor
|
|
23
36
|
: formStyle.primaryColor,
|
|
24
|
-
}, onClick: ()
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
37
|
+
}, onClick: function () {
|
|
38
|
+
var _a, _b, _c, _d, _e;
|
|
39
|
+
if (((_a = term.clickEffect) === null || _a === void 0 ? void 0 : _a.type) === 'LINK') {
|
|
40
|
+
(_d = (_c = (_b = window
|
|
41
|
+
.open) === null || _b === void 0 ? void 0 : _b.call(window, term.clickEffect.url, '_blank')) === null || _c === void 0 ? void 0 : _c.focus) === null || _d === void 0 ? void 0 : _d.call(_c);
|
|
29
42
|
}
|
|
30
|
-
else if (term.clickEffect
|
|
43
|
+
else if (((_e = term.clickEffect) === null || _e === void 0 ? void 0 : _e.type) === 'DIALOG') {
|
|
31
44
|
setShowDialog(true);
|
|
32
45
|
}
|
|
33
|
-
}, children: parts[i] }, i));
|
|
46
|
+
} }, { children: parts[i] }), i));
|
|
34
47
|
}
|
|
35
48
|
return parts;
|
|
36
49
|
}
|
|
37
50
|
};
|
|
38
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Dialog, { PaperProps: {
|
|
51
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Dialog, __assign({ PaperProps: {
|
|
39
52
|
style: {
|
|
40
53
|
borderRadius: '20px',
|
|
41
54
|
},
|
|
42
|
-
}, onClose: ()
|
|
55
|
+
}, onClose: function () {
|
|
43
56
|
setShowDialog(false);
|
|
44
|
-
}, open: showDialog, children: term.clickEffect
|
|
57
|
+
}, open: showDialog }, { children: ((_b = term.clickEffect) === null || _b === void 0 ? void 0 : _b.type) === 'DIALOG' && (_jsxs("div", __assign({ className: styles.dialogContainer, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
|
|
45
58
|
setShowDialog(false);
|
|
46
|
-
}, children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }) }), _jsx("div", { className: styles.dialogTitle, style: {
|
|
59
|
+
} }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }) })), _jsx("div", __assign({ className: styles.dialogTitle, style: {
|
|
47
60
|
borderBottom: '1px solid ' + formStyle.primaryColor,
|
|
48
|
-
}, children: term.clickEffect.title }), _jsx("div", { className: styles.dialogContentContainer, children: term.clickEffect.text }), _jsx(RoundedButton, { text: 'Aceptar', padding: "20px 15px", backgroundColor: formStyle.primaryColor, color: formStyle.primaryContrastColor, fontSize: 20, onClick: ()
|
|
61
|
+
} }, { children: term.clickEffect.title })), _jsx("div", __assign({ className: styles.dialogContentContainer }, { children: term.clickEffect.text })), _jsx(RoundedButton, { text: 'Aceptar', padding: "20px 15px", backgroundColor: formStyle.primaryColor, color: formStyle.primaryContrastColor, fontSize: 20, onClick: function () {
|
|
49
62
|
setShowDialog(false);
|
|
50
63
|
if (!postview) {
|
|
51
64
|
setValue(term.id, true);
|
|
52
65
|
}
|
|
53
|
-
} })] })) }), _jsxs("div", { className: styles.container + ' noselect', children: [_jsx("div", { className: styles.checkboxContainer, children: _jsx(Controller, { name: term.id, control: control, rules: {
|
|
66
|
+
} })] }))) })), _jsxs("div", __assign({ className: styles.container + ' noselect' }, { children: [_jsx("div", __assign({ className: styles.checkboxContainer }, { children: _jsx(Controller, { name: term.id, control: control, rules: {
|
|
54
67
|
required: true,
|
|
55
|
-
}, defaultValue: false, shouldUnregister: true, render:
|
|
68
|
+
}, defaultValue: false, shouldUnregister: true, render: function (_a) {
|
|
69
|
+
var field = _a.field;
|
|
70
|
+
return (_jsx(RoundedCheckBox, { checked: field.value, onChange: field.onChange, cantEdit: postview, padding: "5px", checkedColor: formStyle.primaryColor, errorColor: formStyle.errorColor, size: "1.5rem", error: !!errors[term.id] }));
|
|
71
|
+
} }) })), _jsx("div", __assign({ className: styles.messageContainer, style: {
|
|
56
72
|
color: !!errors[term.id] && tempError
|
|
57
73
|
? formStyle.errorColor
|
|
58
74
|
: 'inherit',
|
|
59
|
-
}, children: renderText(term.message) })] })] }));
|
|
75
|
+
} }, { children: renderText(term.message) }))] }))] }));
|
|
60
76
|
}
|
|
61
77
|
export default TermComponent;
|
|
@@ -1,13 +1,24 @@
|
|
|
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
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import { FormStyleTypes } from '../../constants/FormStepTypes';
|
|
3
14
|
import MaterialTerm from './MaterialTerm/MaterialTerm';
|
|
4
15
|
function TermComponent(props) {
|
|
5
16
|
switch (props.formStyle.type) {
|
|
6
17
|
case FormStyleTypes.MATERIAL: {
|
|
7
|
-
return _jsx(MaterialTerm, {
|
|
18
|
+
return _jsx(MaterialTerm, __assign({}, props));
|
|
8
19
|
}
|
|
9
20
|
default: {
|
|
10
|
-
return _jsx(MaterialTerm, {
|
|
21
|
+
return _jsx(MaterialTerm, __assign({}, props));
|
|
11
22
|
}
|
|
12
23
|
}
|
|
13
24
|
}
|