@arquimedes.co/eureka-forms 1.9.19-test → 1.9.20-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/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 +64 -47
- 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 +25 -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,3 +1,40 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
var __assign = (this && this.__assign) || function () {
|
|
17
|
+
__assign = Object.assign || function(t) {
|
|
18
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
19
|
+
s = arguments[i];
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
21
|
+
t[p] = s[p];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
return __assign.apply(this, arguments);
|
|
26
|
+
};
|
|
27
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
28
|
+
var t = {};
|
|
29
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
30
|
+
t[p] = s[p];
|
|
31
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
32
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
33
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
34
|
+
t[p[i]] = s[p[i]];
|
|
35
|
+
}
|
|
36
|
+
return t;
|
|
37
|
+
};
|
|
1
38
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
39
|
import React from 'react';
|
|
3
40
|
import { makeStyles } from '@material-ui/core/styles';
|
|
@@ -6,7 +43,7 @@ import FormControl from '@material-ui/core/FormControl';
|
|
|
6
43
|
import OutlinedInput from '@material-ui/core/OutlinedInput';
|
|
7
44
|
import Select from '@material-ui/core/Select';
|
|
8
45
|
import { FormHelperText } from '@material-ui/core';
|
|
9
|
-
|
|
46
|
+
var useStyles = makeStyles(function (theme) { return ({
|
|
10
47
|
root: {
|
|
11
48
|
display: 'flex',
|
|
12
49
|
flexWrap: 'wrap',
|
|
@@ -18,121 +55,133 @@ const useStyles = makeStyles((theme) => ({
|
|
|
18
55
|
selectEmpty: {
|
|
19
56
|
marginTop: theme.spacing(2),
|
|
20
57
|
},
|
|
21
|
-
}));
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
58
|
+
}); });
|
|
59
|
+
var useOutlinedInputStyles = function (props) {
|
|
60
|
+
return makeStyles({
|
|
61
|
+
root: {
|
|
62
|
+
cursor: props.cantEdit ? 'default' : 'default',
|
|
63
|
+
height: props.height,
|
|
64
|
+
borderRadius: props.borderRadius,
|
|
65
|
+
backgroundColor: props.innerBackgroundColor,
|
|
66
|
+
fontSize: props.fontSize,
|
|
67
|
+
'& $notchedOutline': {
|
|
68
|
+
borderColor: props.outlineColor,
|
|
69
|
+
'& legend': {
|
|
70
|
+
fontSize: 'calc(' + props.fontSize + ' * 0.75)',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
'&:hover $notchedOutline': {
|
|
74
|
+
borderColor: props.cantEdit
|
|
75
|
+
? props.outlineColor
|
|
76
|
+
: props.focusColor,
|
|
77
|
+
},
|
|
78
|
+
'& .Mui-disabled': {
|
|
79
|
+
cursor: 'default',
|
|
80
|
+
color: props.color,
|
|
81
|
+
},
|
|
82
|
+
'& .Mui-error': {
|
|
83
|
+
color: props.errorColor,
|
|
84
|
+
},
|
|
85
|
+
'&.Mui-error .EF-MuiOutlinedInput-notchedOutline': {
|
|
86
|
+
borderColor: props.outlineColor,
|
|
87
|
+
},
|
|
88
|
+
'& .EF-MuiSelect-root': {
|
|
89
|
+
paddingLeft: props.paddingLeft,
|
|
90
|
+
},
|
|
91
|
+
'&$focused $notchedOutline': {
|
|
92
|
+
borderColor: props.focusColor,
|
|
93
|
+
},
|
|
94
|
+
'& .EF-MuiSelect-icon.Mui-disabled': {
|
|
95
|
+
color: props.outlineColor,
|
|
96
|
+
},
|
|
97
|
+
'& .EF-MuiSelect-icon.iconOutlined': {
|
|
98
|
+
right: 8,
|
|
99
|
+
},
|
|
100
|
+
'& .EF-MuiSelect-iconOpen': {
|
|
101
|
+
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
33
102
|
},
|
|
34
|
-
},
|
|
35
|
-
'&:hover $notchedOutline': {
|
|
36
|
-
borderColor: props.cantEdit
|
|
37
|
-
? props.outlineColor
|
|
38
|
-
: props.focusColor,
|
|
39
|
-
},
|
|
40
|
-
'& .Mui-disabled': {
|
|
41
|
-
cursor: 'default',
|
|
42
103
|
color: props.color,
|
|
43
104
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
},
|
|
53
|
-
'&$focused $notchedOutline': {
|
|
54
|
-
borderColor: props.focusColor,
|
|
105
|
+
focused: {},
|
|
106
|
+
notchedOutline: {},
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
var useLabelInputStyles = function (props) {
|
|
110
|
+
return makeStyles(function () { return ({
|
|
111
|
+
focused: {
|
|
112
|
+
color: props.focusColor + ' !important',
|
|
55
113
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
root: {
|
|
75
|
-
fontWeight: props.fontWeight,
|
|
76
|
-
whiteSpace: 'nowrap',
|
|
77
|
-
overflow: 'hidden',
|
|
78
|
-
maxWidth: 'calc(100% - 45px)',
|
|
79
|
-
textOverflow: 'ellipsis',
|
|
80
|
-
marginTop: props.height != '40px' ? '-4px' : '0px',
|
|
81
|
-
'&.EF-MuiInputLabel-shrink': {
|
|
82
|
-
marginTop: '0px',
|
|
83
|
-
maxWidth: 'calc(100% - 5px)',
|
|
84
|
-
},
|
|
85
|
-
'& .Mui-error': {
|
|
86
|
-
color: props.errorColor,
|
|
87
|
-
},
|
|
88
|
-
'&.Mui-error': {
|
|
89
|
-
color: props.errorColor,
|
|
114
|
+
root: {
|
|
115
|
+
fontWeight: props.fontWeight,
|
|
116
|
+
whiteSpace: 'nowrap',
|
|
117
|
+
overflow: 'hidden',
|
|
118
|
+
maxWidth: 'calc(100% - 45px)',
|
|
119
|
+
textOverflow: 'ellipsis',
|
|
120
|
+
marginTop: props.height != '40px' ? '-4px' : '0px',
|
|
121
|
+
'&.EF-MuiInputLabel-shrink': {
|
|
122
|
+
marginTop: '0px',
|
|
123
|
+
maxWidth: 'calc(100% - 5px)',
|
|
124
|
+
},
|
|
125
|
+
'& .Mui-error': {
|
|
126
|
+
color: props.errorColor,
|
|
127
|
+
},
|
|
128
|
+
'&.Mui-error': {
|
|
129
|
+
color: props.errorColor,
|
|
130
|
+
},
|
|
90
131
|
},
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
132
|
+
}); });
|
|
133
|
+
};
|
|
134
|
+
var useHelperTextStyles = function (props) {
|
|
135
|
+
return makeStyles(function () { return ({
|
|
136
|
+
root: {
|
|
137
|
+
color: props.helperTextColor,
|
|
138
|
+
'&.Mui-error': {
|
|
139
|
+
color: props.errorColor,
|
|
140
|
+
},
|
|
98
141
|
},
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
function CustomSelect(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
142
|
+
}); });
|
|
143
|
+
};
|
|
144
|
+
function CustomSelect(_a) {
|
|
145
|
+
var children = _a.children, _b = _a.value, value = _b === void 0 ? '' : _b, handleUpdate = _a.handleUpdate, label = _a.label, minWidth = _a.minWidth, helperText = _a.helperText, _c = _a.color, color = _c === void 0 ? '#293241' : _c, _d = _a.errorColor, errorColor = _d === void 0 ? '#cc2936' : _d, _e = _a.focusColor, focusColor = _e === void 0 ? '#3d5a7f' : _e, _f = _a.outlineColor, outlineColor = _f === void 0 ? '#0000003b' : _f, _g = _a.helperTextColor, helperTextColor = _g === void 0 ? '#989898' : _g, _h = _a.backgroundColor, backgroundColor = _h === void 0 ? '#ffffff' : _h, _j = _a.readOnly, readOnly = _j === void 0 ? false : _j, _k = _a.borderRadius, borderRadius = _k === void 0 ? 10 : _k, innerBackgroundColor = _a.innerBackgroundColor, _l = _a.paddingLeft, paddingLeft = _l === void 0 ? 14 : _l, _m = _a.cantEdit, cantEdit = _m === void 0 ? false : _m, _o = _a.showIcon, showIcon = _o === void 0 ? true : _o, _p = _a.containerMargin, containerMargin = _p === void 0 ? '8px' : _p, _q = _a.height, height = _q === void 0 ? '40px' : _q, _r = _a.fontSize, fontSize = _r === void 0 ? '1rem' : _r, required = _a.required, iconComponent = _a.iconComponent, error = _a.error, others = __rest(_a, ["children", "value", "handleUpdate", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "outlineColor", "helperTextColor", "backgroundColor", "readOnly", "borderRadius", "innerBackgroundColor", "paddingLeft", "cantEdit", "showIcon", "containerMargin", "height", "fontSize", "required", "iconComponent", "error"]);
|
|
146
|
+
var styleProps = {
|
|
147
|
+
color: color,
|
|
148
|
+
height: height,
|
|
149
|
+
readOnly: readOnly,
|
|
150
|
+
fontSize: fontSize,
|
|
151
|
+
cantEdit: cantEdit,
|
|
152
|
+
errorColor: errorColor,
|
|
153
|
+
focusColor: focusColor,
|
|
154
|
+
paddingLeft: paddingLeft,
|
|
155
|
+
outlineColor: outlineColor,
|
|
156
|
+
borderRadius: borderRadius,
|
|
157
|
+
helperTextColor: helperTextColor,
|
|
158
|
+
backgroundColor: backgroundColor,
|
|
115
159
|
showIcon: showIcon && iconComponent !== undefined,
|
|
116
|
-
innerBackgroundColor: innerBackgroundColor
|
|
160
|
+
innerBackgroundColor: innerBackgroundColor !== null && innerBackgroundColor !== void 0 ? innerBackgroundColor : backgroundColor,
|
|
117
161
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return (_jsxs(FormControl, { variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
|
|
123
|
-
? { minWidth, outlineColor, margin: containerMargin }
|
|
162
|
+
var classes = useStyles();
|
|
163
|
+
var outlinedInputClasses = useOutlinedInputStyles(styleProps)();
|
|
164
|
+
var labelClasses = useLabelInputStyles(styleProps)();
|
|
165
|
+
var helperTextClasses = useHelperTextStyles(styleProps)();
|
|
166
|
+
return (_jsxs(FormControl, __assign({ variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
|
|
167
|
+
? { minWidth: minWidth, outlineColor: outlineColor, margin: containerMargin }
|
|
124
168
|
: {
|
|
125
169
|
margin: containerMargin,
|
|
126
|
-
}, fullWidth: true, required: required, error: error, children: [label && _jsx(InputLabel, { classes: labelClasses, children: label }), _jsx(Select, {
|
|
127
|
-
|
|
128
|
-
|
|
170
|
+
}, fullWidth: true, required: required, error: error }, { children: [label && _jsx(InputLabel, __assign({ classes: labelClasses }, { children: label })), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate }, (showIcon && iconComponent
|
|
171
|
+
? { IconComponent: iconComponent }
|
|
172
|
+
: {}), { input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label ? label + (required ? ' *' : '') : undefined, classes: outlinedInputClasses }) }, { children: children })), helperText !== undefined && (_jsx(FormHelperText, __assign({ classes: helperTextClasses }, { children: helperText })))] })));
|
|
129
173
|
}
|
|
130
174
|
/**
|
|
131
175
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
132
176
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
177
|
+
var RoundedSelect = /** @class */ (function (_super) {
|
|
178
|
+
__extends(RoundedSelect, _super);
|
|
179
|
+
function RoundedSelect() {
|
|
180
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
136
181
|
}
|
|
137
|
-
|
|
182
|
+
RoundedSelect.prototype.render = function () {
|
|
183
|
+
return _jsx(CustomSelect, __assign({}, this.props));
|
|
184
|
+
};
|
|
185
|
+
return RoundedSelect;
|
|
186
|
+
}(React.Component));
|
|
138
187
|
export default RoundedSelect;
|
|
@@ -1,3 +1,25 @@
|
|
|
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, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
24
|
import Autocomplete, { createFilterOptions, } from '@material-ui/lab/Autocomplete';
|
|
3
25
|
import { makeStyles } from '@material-ui/core/styles';
|
|
@@ -6,174 +28,187 @@ import { cloneElement } from 'react';
|
|
|
6
28
|
import { MenuItem, Popper } from '@material-ui/core';
|
|
7
29
|
import RoundedSelect from '../RoundedSelect/RoundedSelect';
|
|
8
30
|
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'&::placeholder': {
|
|
31
|
+
var filter = createFilterOptions();
|
|
32
|
+
var useTextfieldStyles = function (props) {
|
|
33
|
+
return makeStyles(function () { return ({
|
|
34
|
+
root: {
|
|
35
|
+
borderRadius: props.borderRadius,
|
|
36
|
+
backgroundColor: props.backgroundColor,
|
|
37
|
+
'& input, textarea': {
|
|
38
|
+
cursor: props.cantEdit ? 'default' : 'text',
|
|
39
|
+
fontWeight: props.fontWeight,
|
|
40
|
+
color: props.color,
|
|
20
41
|
fontSize: props.fontSize,
|
|
42
|
+
'&::placeholder': {
|
|
43
|
+
fontSize: props.fontSize,
|
|
44
|
+
},
|
|
45
|
+
backgroundColor: props.innerBackgroundColor,
|
|
46
|
+
borderRadius: props.borderRadius,
|
|
47
|
+
height: props.height,
|
|
48
|
+
marginTop: '0px !important',
|
|
49
|
+
padding: '0px 38px 0px 12px !important',
|
|
21
50
|
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
marginTop: '0px !important',
|
|
26
|
-
padding: '0px 38px 0px 12px !important',
|
|
27
|
-
},
|
|
28
|
-
'& .EF-MuiInputBase-root': {
|
|
29
|
-
padding: '0px !important',
|
|
30
|
-
pointerEvents: 'all',
|
|
31
|
-
},
|
|
32
|
-
'& label': {
|
|
33
|
-
marginTop: '-4px',
|
|
34
|
-
fontSize: props.fontSize,
|
|
35
|
-
whiteSpace: 'nowrap',
|
|
36
|
-
overflow: 'hidden',
|
|
37
|
-
textOverflow: 'ellipsis',
|
|
38
|
-
maxWidth: 'calc(100% - 22px)',
|
|
39
|
-
},
|
|
40
|
-
'& label.EF-MuiInputLabel-shrink': {
|
|
41
|
-
marginTop: '0px',
|
|
42
|
-
maxWidth: 'calc(100% - 5px)',
|
|
43
|
-
},
|
|
44
|
-
'& input + fieldset': {
|
|
45
|
-
borderRadius: props.borderRadius,
|
|
46
|
-
},
|
|
47
|
-
'& .EF-MuiInput-underline:after': {
|
|
48
|
-
borderBottomColor: props.outlineColor,
|
|
49
|
-
},
|
|
50
|
-
'& .EF-MuiOutlinedInput-root': {
|
|
51
|
-
borderRadius: props.borderRadius,
|
|
52
|
-
'&.Mui-focused fieldset': {
|
|
53
|
-
borderColor: props.focusColor,
|
|
54
|
-
borderWidth: props.readOnly ? 1 : 2,
|
|
51
|
+
'& .EF-MuiInputBase-root': {
|
|
52
|
+
padding: '0px !important',
|
|
53
|
+
pointerEvents: 'all',
|
|
55
54
|
},
|
|
56
|
-
'&
|
|
57
|
-
|
|
55
|
+
'& label': {
|
|
56
|
+
marginTop: '-4px',
|
|
57
|
+
fontSize: props.fontSize,
|
|
58
|
+
whiteSpace: 'nowrap',
|
|
59
|
+
overflow: 'hidden',
|
|
60
|
+
textOverflow: 'ellipsis',
|
|
61
|
+
maxWidth: 'calc(100% - 22px)',
|
|
62
|
+
},
|
|
63
|
+
'& label.EF-MuiInputLabel-shrink': {
|
|
64
|
+
marginTop: '0px',
|
|
65
|
+
maxWidth: 'calc(100% - 5px)',
|
|
58
66
|
},
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
'& input + fieldset': {
|
|
68
|
+
borderRadius: props.borderRadius,
|
|
69
|
+
},
|
|
70
|
+
'& .EF-MuiInput-underline:after': {
|
|
71
|
+
borderBottomColor: props.outlineColor,
|
|
72
|
+
},
|
|
73
|
+
'& .EF-MuiOutlinedInput-root': {
|
|
74
|
+
borderRadius: props.borderRadius,
|
|
75
|
+
'&.Mui-focused fieldset': {
|
|
76
|
+
borderColor: props.focusColor,
|
|
77
|
+
borderWidth: props.readOnly ? 1 : 2,
|
|
78
|
+
},
|
|
79
|
+
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
80
|
+
borderColor: props.outlineColor,
|
|
81
|
+
},
|
|
61
82
|
height: props.height,
|
|
62
|
-
|
|
83
|
+
'& .EF-MuiAutocomplete-input': {
|
|
84
|
+
height: props.height,
|
|
85
|
+
marginTop: -10,
|
|
86
|
+
},
|
|
87
|
+
'& .EF-MuiAutocomplete-input::placeholder': {
|
|
88
|
+
color: '#787878',
|
|
89
|
+
opacity: 1,
|
|
90
|
+
},
|
|
63
91
|
},
|
|
64
|
-
'& .EF-
|
|
65
|
-
|
|
66
|
-
|
|
92
|
+
'& .EF-MuiOutlinedInput-root:hover .EF-MuiOutlinedInput-notchedOutline': {
|
|
93
|
+
borderColor: props.cantEdit
|
|
94
|
+
? props.outlineColor
|
|
95
|
+
: props.focusColor,
|
|
96
|
+
},
|
|
97
|
+
'& label.Mui-focused': {
|
|
98
|
+
color: props.focusColor,
|
|
99
|
+
},
|
|
100
|
+
'& .Mui-error': {
|
|
101
|
+
color: props.errorColor + ' !important',
|
|
102
|
+
},
|
|
103
|
+
'& .EF-MuiFormHelperText-root': {
|
|
104
|
+
color: props.helperTextColor,
|
|
105
|
+
},
|
|
106
|
+
'& .EF-MuiFormLabel-root.Mui-disabled': {
|
|
107
|
+
color: '#0000008a',
|
|
108
|
+
},
|
|
109
|
+
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
110
|
+
borderColor: '#0000003b',
|
|
111
|
+
},
|
|
112
|
+
'.EF-MuiAutocomplete-popupIndicator': {
|
|
113
|
+
padding: 0,
|
|
114
|
+
},
|
|
115
|
+
'& .EF-MuiAutocomplete-popupIndicatorOpen': {
|
|
116
|
+
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
117
|
+
},
|
|
118
|
+
'& .EF-MuiAutocomplete-clearIndicator': {
|
|
119
|
+
display: 'none',
|
|
120
|
+
},
|
|
121
|
+
'& .EF-MuiAutocomplete-endAdornment': {
|
|
122
|
+
top: 'calc(50% - 13px)',
|
|
67
123
|
},
|
|
68
124
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
borderColor: '#0000003b',
|
|
88
|
-
},
|
|
89
|
-
'.EF-MuiAutocomplete-popupIndicator': {
|
|
90
|
-
padding: 0,
|
|
91
|
-
},
|
|
92
|
-
'& .EF-MuiAutocomplete-popupIndicatorOpen': {
|
|
93
|
-
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
94
|
-
},
|
|
95
|
-
'& .EF-MuiAutocomplete-clearIndicator': {
|
|
96
|
-
display: 'none',
|
|
97
|
-
},
|
|
98
|
-
'& .EF-MuiAutocomplete-endAdornment': {
|
|
99
|
-
top: 'calc(50% - 13px)',
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
}));
|
|
103
|
-
export default function RoundedSmartSelect({ options = [], value = '', handleUpdate, label, getValueString = (value) => value.value, color = '#293241', errorColor = '#cc2936', focusColor = '#3d5a7f', helperTextColor = '#989898', outlineColor = '#b8b8b8', backgroundColor = '#ffffff', cantEdit = false, loading = false, height = '31px', fontSize = '1rem', required, changeListener, error, innerBackgroundColor, getOptionSelected, helperText, readOnly = false, borderRadius = 10, fontWeight = '400', icon, searchable = false, containerMargin = '0px', showIcon = true, inputRef, disabled, creatable = false, onBlur, name, }) {
|
|
104
|
-
const props = {
|
|
105
|
-
color,
|
|
106
|
-
height,
|
|
107
|
-
errorColor,
|
|
108
|
-
focusColor,
|
|
109
|
-
outlineColor,
|
|
110
|
-
innerBackgroundColor: innerBackgroundColor ?? backgroundColor,
|
|
111
|
-
helperTextColor,
|
|
112
|
-
backgroundColor,
|
|
113
|
-
borderRadius,
|
|
114
|
-
readOnly,
|
|
115
|
-
fontSize,
|
|
116
|
-
fontWeight,
|
|
117
|
-
cantEdit,
|
|
125
|
+
}); });
|
|
126
|
+
};
|
|
127
|
+
export default function RoundedSmartSelect(_a) {
|
|
128
|
+
var _b = _a.options, options = _b === void 0 ? [] : _b, _c = _a.value, value = _c === void 0 ? '' : _c, handleUpdate = _a.handleUpdate, label = _a.label, _d = _a.getValueString, getValueString = _d === void 0 ? function (value) { return value.value; } : _d, _e = _a.color, color = _e === void 0 ? '#293241' : _e, _f = _a.errorColor, errorColor = _f === void 0 ? '#cc2936' : _f, _g = _a.focusColor, focusColor = _g === void 0 ? '#3d5a7f' : _g, _h = _a.helperTextColor, helperTextColor = _h === void 0 ? '#989898' : _h, _j = _a.outlineColor, outlineColor = _j === void 0 ? '#b8b8b8' : _j, _k = _a.backgroundColor, backgroundColor = _k === void 0 ? '#ffffff' : _k, _l = _a.cantEdit, cantEdit = _l === void 0 ? false : _l, _m = _a.loading, loading = _m === void 0 ? false : _m, _o = _a.height, height = _o === void 0 ? '31px' : _o, _p = _a.fontSize, fontSize = _p === void 0 ? '1rem' : _p, required = _a.required, changeListener = _a.changeListener, error = _a.error, innerBackgroundColor = _a.innerBackgroundColor, getOptionSelected = _a.getOptionSelected, helperText = _a.helperText, _q = _a.readOnly, readOnly = _q === void 0 ? false : _q, _r = _a.borderRadius, borderRadius = _r === void 0 ? 10 : _r, _s = _a.fontWeight, fontWeight = _s === void 0 ? '400' : _s, icon = _a.icon, _t = _a.searchable, searchable = _t === void 0 ? false : _t, _u = _a.containerMargin, containerMargin = _u === void 0 ? '0px' : _u, _v = _a.showIcon, showIcon = _v === void 0 ? true : _v, inputRef = _a.inputRef, disabled = _a.disabled, _w = _a.creatable, creatable = _w === void 0 ? false : _w, onBlur = _a.onBlur, name = _a.name;
|
|
129
|
+
var props = {
|
|
130
|
+
color: color,
|
|
131
|
+
height: height,
|
|
132
|
+
errorColor: errorColor,
|
|
133
|
+
focusColor: focusColor,
|
|
134
|
+
outlineColor: outlineColor,
|
|
135
|
+
innerBackgroundColor: innerBackgroundColor !== null && innerBackgroundColor !== void 0 ? innerBackgroundColor : backgroundColor,
|
|
136
|
+
helperTextColor: helperTextColor,
|
|
137
|
+
backgroundColor: backgroundColor,
|
|
138
|
+
borderRadius: borderRadius,
|
|
139
|
+
readOnly: readOnly,
|
|
140
|
+
fontSize: fontSize,
|
|
141
|
+
fontWeight: fontWeight,
|
|
142
|
+
cantEdit: cantEdit,
|
|
118
143
|
showIcon: showIcon && icon !== undefined,
|
|
119
144
|
};
|
|
120
|
-
|
|
145
|
+
var textFieldClasses = useTextfieldStyles(props)();
|
|
121
146
|
if (searchable) {
|
|
122
|
-
return (_jsx(Autocomplete, { size: "small", fullWidth: true, openOnFocus: true, freeSolo: creatable, disabled: cantEdit || disabled, popupIcon: loading ? (_jsx(CircularProgress, { size: 22, style: { color: '#757575' } })) : showIcon && icon ? (icon) : undefined, onOpen: ()
|
|
147
|
+
return (_jsx(Autocomplete, { size: "small", fullWidth: true, openOnFocus: true, freeSolo: creatable, disabled: cantEdit || disabled, popupIcon: loading ? (_jsx(CircularProgress, { size: 22, style: { color: '#757575' } })) : showIcon && icon ? (icon) : undefined, onOpen: function () { }, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options, getOptionLabel: function (option) {
|
|
148
|
+
var _a, _b;
|
|
123
149
|
// Value selected with enter, right from the input
|
|
124
150
|
if (typeof option === 'string') {
|
|
125
151
|
return option;
|
|
126
152
|
}
|
|
127
|
-
else if (option
|
|
128
|
-
return option.inputValue
|
|
153
|
+
else if (option === null || option === void 0 ? void 0 : option.inputValue) {
|
|
154
|
+
return (_a = option.inputValue) !== null && _a !== void 0 ? _a : '';
|
|
129
155
|
}
|
|
130
156
|
else {
|
|
131
157
|
// Regular option
|
|
132
|
-
return option.label
|
|
158
|
+
return (_b = option.label) !== null && _b !== void 0 ? _b : '';
|
|
133
159
|
}
|
|
134
|
-
}, getOptionSelected: getOptionSelected, PopperComponent:
|
|
160
|
+
}, getOptionSelected: getOptionSelected, PopperComponent: function (_a) {
|
|
161
|
+
var style = _a.style, props = __rest(_a, ["style"]);
|
|
162
|
+
return (_jsx(Popper, __assign({}, props, { style: __assign(__assign({}, style), { zIndex: 1305 }) })));
|
|
163
|
+
}, value: value ? value : null, onChange: function (event, newValue) {
|
|
135
164
|
if (creatable) {
|
|
136
165
|
if (typeof newValue === 'string') {
|
|
137
|
-
changeListener
|
|
138
|
-
handleUpdate
|
|
166
|
+
changeListener === null || changeListener === void 0 ? void 0 : changeListener(newValue);
|
|
167
|
+
handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue);
|
|
139
168
|
}
|
|
140
169
|
else if (newValue && newValue.inputValue) {
|
|
141
|
-
changeListener
|
|
142
|
-
handleUpdate
|
|
170
|
+
changeListener === null || changeListener === void 0 ? void 0 : changeListener(newValue.inputValue);
|
|
171
|
+
handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue.inputValue); // Create a new value from the user input
|
|
143
172
|
}
|
|
144
173
|
else {
|
|
145
|
-
changeListener
|
|
146
|
-
handleUpdate
|
|
174
|
+
changeListener === null || changeListener === void 0 ? void 0 : changeListener(newValue === null || newValue === void 0 ? void 0 : newValue.label);
|
|
175
|
+
handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue === null || newValue === void 0 ? void 0 : newValue.label);
|
|
147
176
|
}
|
|
148
177
|
}
|
|
149
178
|
else {
|
|
150
|
-
changeListener
|
|
151
|
-
handleUpdate
|
|
179
|
+
changeListener === null || changeListener === void 0 ? void 0 : changeListener(newValue);
|
|
180
|
+
handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue);
|
|
152
181
|
}
|
|
153
|
-
}, filterOptions: (options, params)
|
|
154
|
-
if (value && value.label === params
|
|
182
|
+
}, filterOptions: function (options, params) {
|
|
183
|
+
if (value && value.label === (params === null || params === void 0 ? void 0 : params.inputValue)) {
|
|
155
184
|
return options;
|
|
156
185
|
}
|
|
157
186
|
else {
|
|
158
|
-
|
|
187
|
+
var filtered = filter(options, params);
|
|
159
188
|
// Suggest the creation of a new value
|
|
160
189
|
if (creatable && params.inputValue !== '') {
|
|
161
190
|
filtered.push({
|
|
162
191
|
inputValue: params.inputValue,
|
|
163
|
-
label:
|
|
192
|
+
label: "Crear \"".concat(params.inputValue, "\""),
|
|
164
193
|
});
|
|
165
194
|
}
|
|
166
195
|
return filtered;
|
|
167
196
|
}
|
|
168
|
-
}, renderOption: (option)
|
|
197
|
+
}, renderOption: function (option) {
|
|
198
|
+
return typeof option === 'string' ? option : option.label;
|
|
199
|
+
}, renderInput: function (params) { return (_jsx(TextField, __assign({ classes: textFieldClasses }, params, { inputRef: inputRef, onBlur: onBlur, name: name, variant: "outlined", label: label, required: required, error: error, helperText: helperText }))); }, style: { pointerEvents: 'none' }, noOptionsText: "No hay opciones" }));
|
|
169
200
|
}
|
|
170
201
|
else {
|
|
171
|
-
return (_jsxs(RoundedSelect, { onBlur: onBlur, inputRef: inputRef, name: name, fullWidth: true, handleUpdate: (event)
|
|
172
|
-
handleUpdate
|
|
173
|
-
|
|
202
|
+
return (_jsxs(RoundedSelect, __assign({ onBlur: onBlur, inputRef: inputRef, name: name, fullWidth: true, handleUpdate: function (event) {
|
|
203
|
+
handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(options.find(function (option) {
|
|
204
|
+
return getValueString(option) == event.target.value;
|
|
205
|
+
}));
|
|
206
|
+
}, onOpen: function () {
|
|
174
207
|
//Show loading icon if loading
|
|
175
208
|
}, value: getValueString(value), color: color, errorColor: errorColor, focusColor: focusColor, helperTextColor: helperTextColor, backgroundColor: backgroundColor, outlineColor: outlineColor, innerBackgroundColor: innerBackgroundColor, cantEdit: cantEdit, label: label, required: required, readOnly: readOnly, helperText: helperText, containerMargin: containerMargin, height: height, fontSize: fontSize, error: error, iconComponent: icon
|
|
176
|
-
? (props)
|
|
177
|
-
|
|
209
|
+
? function (props) {
|
|
210
|
+
return cloneElement(icon, props);
|
|
211
|
+
}
|
|
212
|
+
: undefined, showIcon: showIcon }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: "Sin Seleccionar" }) }), 'EMPTY'), options.map(function (option) { return (_jsx(MenuItem, __assign({ value: getValueString(option), style: { whiteSpace: 'normal' } }, { children: option.label }), getValueString(option))); })] })));
|
|
178
213
|
}
|
|
179
214
|
}
|