@arquimedes.co/eureka-forms 1.9.15 → 1.9.17-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 +98 -205
- package/dist/AxiosAPI.js +3 -3
- package/dist/AxiosWidget.js +4 -4
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +104 -207
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +5 -17
- package/dist/FormComponents/Form/Form.js +29 -56
- package/dist/FormComponents/Form/StepperForm/StepperForm.js +1 -1
- package/dist/FormComponents/Section/MaterialSection/MaterialSection.js +7 -30
- package/dist/FormComponents/Section/Section.js +2 -13
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/CBRIncidentsStep.js +2 -13
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/Incident/Incident.js +9 -32
- package/dist/FormComponents/Step/@Construction/CBRIncidentsStep/MaterialCBRIncidentsStep/MaterialCBRIncidentsStep.js +47 -64
- package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +41 -102
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +37 -92
- package/dist/FormComponents/Step/AYFStepMapper.js +23 -75
- package/dist/FormComponents/Step/CBRStepMapper.js +56 -144
- package/dist/FormComponents/Step/CheckBoxStep/CheckBoxStep.js +3 -26
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +6 -21
- package/dist/FormComponents/Step/ClassifierSelectorStep/ClassifierSelectorStep.js +3 -26
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +32 -65
- package/dist/FormComponents/Step/DatePickerStep/DatePickerStep.js +2 -13
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +6 -21
- package/dist/FormComponents/Step/FileUploadStep/FileUploadStep.js +2 -13
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +27 -88
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +81 -171
- package/dist/FormComponents/Step/RatingStep/MaterialRatingStep/MaterialRatingStep.js +15 -41
- package/dist/FormComponents/Step/RatingStep/RatingStep.js +2 -13
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +25 -52
- package/dist/FormComponents/Step/SelectorStep/SelectorStep.js +3 -26
- package/dist/FormComponents/Step/SeparatorStep/MaterialSeparatorStep/MaterialSeparatorStep.js +1 -2
- package/dist/FormComponents/Step/SeparatorStep/SeparatorStep.js +3 -26
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +83 -145
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.js +2 -13
- package/dist/FormComponents/Step/Step.js +19 -39
- package/dist/FormComponents/Step/StepFunctions.js +14 -16
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +43 -62
- package/dist/FormComponents/Step/TextAreaStep/TextAreaStep.js +2 -13
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +6 -21
- package/dist/FormComponents/Step/TextInputStep/TextInputStep.js +2 -13
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +3 -15
- package/dist/FormComponents/Step/TitleStep/TitleStep.js +3 -26
- package/dist/FormComponents/Term/MaterialTerm/MaterialTerm.js +19 -35
- package/dist/FormComponents/Term/Term.js +2 -13
- package/dist/Widget.js +13 -25
- 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 +29 -86
- package/dist/index.js +4 -15
- package/dist/shared/Loader/Loader.js +5 -17
- package/dist/shared/Navbar/Navbar.js +2 -14
- package/dist/shared/Rating/Rating.js +4 -27
- package/dist/shared/Rating/Ratings/LikeRating.js +9 -21
- package/dist/shared/Rating/Ratings/SatisfactionRating.js +15 -27
- package/dist/shared/Rating/Ratings/ScaleRating.js +22 -49
- package/dist/shared/RoundedButton/RoundedButton.js +12 -24
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +39 -84
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +235 -286
- package/dist/shared/RoundedSelect/RoundedSelect.js +103 -152
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +125 -160
- package/dist/shared/RoundedTextField/RoundedTextField.js +92 -137
- package/dist/utils/CbrFunctions.js +30 -30
- package/package.json +4 -4
|
@@ -1,40 +1,3 @@
|
|
|
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
|
-
};
|
|
38
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
39
2
|
import React from 'react';
|
|
40
3
|
import { makeStyles } from '@material-ui/core/styles';
|
|
@@ -43,7 +6,7 @@ import FormControl from '@material-ui/core/FormControl';
|
|
|
43
6
|
import OutlinedInput from '@material-ui/core/OutlinedInput';
|
|
44
7
|
import Select from '@material-ui/core/Select';
|
|
45
8
|
import { FormHelperText } from '@material-ui/core';
|
|
46
|
-
|
|
9
|
+
const useStyles = makeStyles((theme) => ({
|
|
47
10
|
root: {
|
|
48
11
|
display: 'flex',
|
|
49
12
|
flexWrap: 'wrap',
|
|
@@ -55,133 +18,121 @@ var useStyles = makeStyles(function (theme) { return ({
|
|
|
55
18
|
selectEmpty: {
|
|
56
19
|
marginTop: theme.spacing(2),
|
|
57
20
|
},
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
'
|
|
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)',
|
|
21
|
+
}));
|
|
22
|
+
const useOutlinedInputStyles = (props) => makeStyles({
|
|
23
|
+
root: {
|
|
24
|
+
cursor: props.cantEdit ? 'default' : 'default',
|
|
25
|
+
height: props.height,
|
|
26
|
+
borderRadius: props.borderRadius,
|
|
27
|
+
backgroundColor: props.innerBackgroundColor,
|
|
28
|
+
fontSize: props.fontSize,
|
|
29
|
+
'& $notchedOutline': {
|
|
30
|
+
borderColor: props.outlineColor,
|
|
31
|
+
'& legend': {
|
|
32
|
+
fontSize: 'calc(' + props.fontSize + ' * 0.75)',
|
|
102
33
|
},
|
|
34
|
+
},
|
|
35
|
+
'&:hover $notchedOutline': {
|
|
36
|
+
borderColor: props.cantEdit
|
|
37
|
+
? props.outlineColor
|
|
38
|
+
: props.focusColor,
|
|
39
|
+
},
|
|
40
|
+
'& .Mui-disabled': {
|
|
41
|
+
cursor: 'default',
|
|
103
42
|
color: props.color,
|
|
104
43
|
},
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
var useLabelInputStyles = function (props) {
|
|
110
|
-
return makeStyles(function () { return ({
|
|
111
|
-
focused: {
|
|
112
|
-
color: props.focusColor + ' !important',
|
|
44
|
+
'& .Mui-error': {
|
|
45
|
+
color: props.errorColor,
|
|
113
46
|
},
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
},
|
|
47
|
+
'&.Mui-error .EF-MuiOutlinedInput-notchedOutline': {
|
|
48
|
+
borderColor: props.outlineColor,
|
|
131
49
|
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
50
|
+
'& .EF-MuiSelect-root': {
|
|
51
|
+
paddingLeft: props.paddingLeft,
|
|
52
|
+
},
|
|
53
|
+
'&$focused $notchedOutline': {
|
|
54
|
+
borderColor: props.focusColor,
|
|
55
|
+
},
|
|
56
|
+
'& .EF-MuiSelect-icon.Mui-disabled': {
|
|
57
|
+
color: props.outlineColor,
|
|
58
|
+
},
|
|
59
|
+
'& .EF-MuiSelect-icon.iconOutlined': {
|
|
60
|
+
right: 8,
|
|
61
|
+
},
|
|
62
|
+
'& .EF-MuiSelect-iconOpen': {
|
|
63
|
+
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
64
|
+
},
|
|
65
|
+
color: props.color,
|
|
66
|
+
},
|
|
67
|
+
focused: {},
|
|
68
|
+
notchedOutline: {},
|
|
69
|
+
});
|
|
70
|
+
const useLabelInputStyles = (props) => makeStyles(() => ({
|
|
71
|
+
focused: {
|
|
72
|
+
color: props.focusColor + ' !important',
|
|
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)',
|
|
141
84
|
},
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
85
|
+
'& .Mui-error': {
|
|
86
|
+
color: props.errorColor,
|
|
87
|
+
},
|
|
88
|
+
'&.Mui-error': {
|
|
89
|
+
color: props.errorColor,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
}));
|
|
93
|
+
const useHelperTextStyles = (props) => makeStyles(() => ({
|
|
94
|
+
root: {
|
|
95
|
+
color: props.helperTextColor,
|
|
96
|
+
'&.Mui-error': {
|
|
97
|
+
color: props.errorColor,
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
}));
|
|
101
|
+
function CustomSelect({ children, value = '', handleUpdate, label, minWidth, helperText, color = '#293241', errorColor = '#cc2936', focusColor = '#3d5a7f', outlineColor = '#0000003b', helperTextColor = '#989898', backgroundColor = '#ffffff', readOnly = false, borderRadius = 10, innerBackgroundColor, paddingLeft = 14, cantEdit = false, showIcon = true, containerMargin = '8px', height = '40px', fontSize = '1rem', required, iconComponent, error, ...others }) {
|
|
102
|
+
const styleProps = {
|
|
103
|
+
color,
|
|
104
|
+
height,
|
|
105
|
+
readOnly,
|
|
106
|
+
fontSize,
|
|
107
|
+
cantEdit,
|
|
108
|
+
errorColor,
|
|
109
|
+
focusColor,
|
|
110
|
+
paddingLeft,
|
|
111
|
+
outlineColor,
|
|
112
|
+
borderRadius,
|
|
113
|
+
helperTextColor,
|
|
114
|
+
backgroundColor,
|
|
159
115
|
showIcon: showIcon && iconComponent !== undefined,
|
|
160
|
-
innerBackgroundColor: innerBackgroundColor
|
|
116
|
+
innerBackgroundColor: innerBackgroundColor ?? backgroundColor,
|
|
161
117
|
};
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return (_jsxs(FormControl,
|
|
167
|
-
? { minWidth
|
|
118
|
+
const classes = useStyles();
|
|
119
|
+
const outlinedInputClasses = useOutlinedInputStyles(styleProps)();
|
|
120
|
+
const labelClasses = useLabelInputStyles(styleProps)();
|
|
121
|
+
const helperTextClasses = useHelperTextStyles(styleProps)();
|
|
122
|
+
return (_jsxs(FormControl, { variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
|
|
123
|
+
? { minWidth, outlineColor, margin: containerMargin }
|
|
168
124
|
: {
|
|
169
125
|
margin: containerMargin,
|
|
170
|
-
}, fullWidth: true, required: required, error: error
|
|
171
|
-
|
|
172
|
-
|
|
126
|
+
}, fullWidth: true, required: required, error: error, children: [label && _jsx(InputLabel, { classes: labelClasses, children: label }), _jsx(Select, { ...others, value: value, onChange: handleUpdate, ...(showIcon && iconComponent
|
|
127
|
+
? { IconComponent: iconComponent }
|
|
128
|
+
: {}), input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label ? label + (required ? ' *' : '') : undefined, classes: outlinedInputClasses }), children: children }), helperText !== undefined && (_jsx(FormHelperText, { classes: helperTextClasses, children: helperText }))] }));
|
|
173
129
|
}
|
|
174
130
|
/**
|
|
175
131
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
176
132
|
*/
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
133
|
+
class RoundedSelect extends React.Component {
|
|
134
|
+
render() {
|
|
135
|
+
return _jsx(CustomSelect, { ...this.props });
|
|
181
136
|
}
|
|
182
|
-
|
|
183
|
-
return _jsx(CustomSelect, __assign({}, this.props));
|
|
184
|
-
};
|
|
185
|
-
return RoundedSelect;
|
|
186
|
-
}(React.Component));
|
|
137
|
+
}
|
|
187
138
|
export default RoundedSelect;
|
|
@@ -1,25 +1,3 @@
|
|
|
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
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
2
|
import Autocomplete, { createFilterOptions, } from '@material-ui/lab/Autocomplete';
|
|
25
3
|
import { makeStyles } from '@material-ui/core/styles';
|
|
@@ -28,187 +6,174 @@ import { cloneElement } from 'react';
|
|
|
28
6
|
import { MenuItem, Popper } from '@material-ui/core';
|
|
29
7
|
import RoundedSelect from '../RoundedSelect/RoundedSelect';
|
|
30
8
|
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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',
|
|
50
|
-
},
|
|
51
|
-
'& .EF-MuiInputBase-root': {
|
|
52
|
-
padding: '0px !important',
|
|
53
|
-
pointerEvents: 'all',
|
|
54
|
-
},
|
|
55
|
-
'& label': {
|
|
56
|
-
marginTop: '-4px',
|
|
9
|
+
const filter = createFilterOptions();
|
|
10
|
+
const useTextfieldStyles = (props) => makeStyles(() => ({
|
|
11
|
+
root: {
|
|
12
|
+
borderRadius: props.borderRadius,
|
|
13
|
+
backgroundColor: props.backgroundColor,
|
|
14
|
+
'& input, textarea': {
|
|
15
|
+
cursor: props.cantEdit ? 'default' : 'text',
|
|
16
|
+
fontWeight: props.fontWeight,
|
|
17
|
+
color: props.color,
|
|
18
|
+
fontSize: props.fontSize,
|
|
19
|
+
'&::placeholder': {
|
|
57
20
|
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)',
|
|
66
|
-
},
|
|
67
|
-
'& input + fieldset': {
|
|
68
|
-
borderRadius: props.borderRadius,
|
|
69
21
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
'
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
'
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
'& .EF-MuiFormHelperText-root': {
|
|
104
|
-
color: props.helperTextColor,
|
|
105
|
-
},
|
|
106
|
-
'& .EF-MuiFormLabel-root.Mui-disabled': {
|
|
107
|
-
color: '#0000008a',
|
|
22
|
+
backgroundColor: props.innerBackgroundColor,
|
|
23
|
+
borderRadius: props.borderRadius,
|
|
24
|
+
height: props.height,
|
|
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,
|
|
108
55
|
},
|
|
109
56
|
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
110
|
-
borderColor:
|
|
57
|
+
borderColor: props.outlineColor,
|
|
111
58
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
117
|
-
},
|
|
118
|
-
'& .EF-MuiAutocomplete-clearIndicator': {
|
|
119
|
-
display: 'none',
|
|
59
|
+
height: props.height,
|
|
60
|
+
'& .EF-MuiAutocomplete-input': {
|
|
61
|
+
height: props.height,
|
|
62
|
+
marginTop: -10,
|
|
120
63
|
},
|
|
121
|
-
'& .EF-MuiAutocomplete-
|
|
122
|
-
|
|
64
|
+
'& .EF-MuiAutocomplete-input::placeholder': {
|
|
65
|
+
color: '#787878',
|
|
66
|
+
opacity: 1,
|
|
123
67
|
},
|
|
124
68
|
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
69
|
+
'& .EF-MuiOutlinedInput-root:hover .EF-MuiOutlinedInput-notchedOutline': {
|
|
70
|
+
borderColor: props.cantEdit
|
|
71
|
+
? props.outlineColor
|
|
72
|
+
: props.focusColor,
|
|
73
|
+
},
|
|
74
|
+
'& label.Mui-focused': {
|
|
75
|
+
color: props.focusColor,
|
|
76
|
+
},
|
|
77
|
+
'& .Mui-error': {
|
|
78
|
+
color: props.errorColor + ' !important',
|
|
79
|
+
},
|
|
80
|
+
'& .EF-MuiFormHelperText-root': {
|
|
81
|
+
color: props.helperTextColor,
|
|
82
|
+
},
|
|
83
|
+
'& .EF-MuiFormLabel-root.Mui-disabled': {
|
|
84
|
+
color: '#0000008a',
|
|
85
|
+
},
|
|
86
|
+
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
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,
|
|
143
118
|
showIcon: showIcon && icon !== undefined,
|
|
144
119
|
};
|
|
145
|
-
|
|
120
|
+
const textFieldClasses = useTextfieldStyles(props)();
|
|
146
121
|
if (searchable) {
|
|
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:
|
|
148
|
-
var _a, _b;
|
|
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: () => { }, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options, getOptionLabel: (option) => {
|
|
149
123
|
// Value selected with enter, right from the input
|
|
150
124
|
if (typeof option === 'string') {
|
|
151
125
|
return option;
|
|
152
126
|
}
|
|
153
|
-
else if (option
|
|
154
|
-
return
|
|
127
|
+
else if (option?.inputValue) {
|
|
128
|
+
return option.inputValue ?? '';
|
|
155
129
|
}
|
|
156
130
|
else {
|
|
157
131
|
// Regular option
|
|
158
|
-
return
|
|
132
|
+
return option.label ?? '';
|
|
159
133
|
}
|
|
160
|
-
}, getOptionSelected: getOptionSelected, PopperComponent:
|
|
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) {
|
|
134
|
+
}, getOptionSelected: getOptionSelected, PopperComponent: ({ style, ...props }) => (_jsx(Popper, { ...props, style: { ...style, zIndex: 1305 } })), value: value ? value : null, onChange: (event, newValue) => {
|
|
164
135
|
if (creatable) {
|
|
165
136
|
if (typeof newValue === 'string') {
|
|
166
|
-
changeListener
|
|
167
|
-
handleUpdate
|
|
137
|
+
changeListener?.(newValue);
|
|
138
|
+
handleUpdate?.(newValue);
|
|
168
139
|
}
|
|
169
140
|
else if (newValue && newValue.inputValue) {
|
|
170
|
-
changeListener
|
|
171
|
-
handleUpdate
|
|
141
|
+
changeListener?.(newValue.inputValue);
|
|
142
|
+
handleUpdate?.(newValue.inputValue); // Create a new value from the user input
|
|
172
143
|
}
|
|
173
144
|
else {
|
|
174
|
-
changeListener
|
|
175
|
-
handleUpdate
|
|
145
|
+
changeListener?.(newValue?.label);
|
|
146
|
+
handleUpdate?.(newValue?.label);
|
|
176
147
|
}
|
|
177
148
|
}
|
|
178
149
|
else {
|
|
179
|
-
changeListener
|
|
180
|
-
handleUpdate
|
|
150
|
+
changeListener?.(newValue);
|
|
151
|
+
handleUpdate?.(newValue);
|
|
181
152
|
}
|
|
182
|
-
}, filterOptions:
|
|
183
|
-
if (value && value.label ===
|
|
153
|
+
}, filterOptions: (options, params) => {
|
|
154
|
+
if (value && value.label === params?.inputValue) {
|
|
184
155
|
return options;
|
|
185
156
|
}
|
|
186
157
|
else {
|
|
187
|
-
|
|
158
|
+
const filtered = filter(options, params);
|
|
188
159
|
// Suggest the creation of a new value
|
|
189
160
|
if (creatable && params.inputValue !== '') {
|
|
190
161
|
filtered.push({
|
|
191
162
|
inputValue: params.inputValue,
|
|
192
|
-
label:
|
|
163
|
+
label: `Crear "${params.inputValue}"`,
|
|
193
164
|
});
|
|
194
165
|
}
|
|
195
166
|
return filtered;
|
|
196
167
|
}
|
|
197
|
-
}, renderOption:
|
|
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" }));
|
|
168
|
+
}, renderOption: (option) => typeof option === 'string' ? option : option.label, renderInput: (params) => (_jsx(TextField, { 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" }));
|
|
200
169
|
}
|
|
201
170
|
else {
|
|
202
|
-
return (_jsxs(RoundedSelect,
|
|
203
|
-
handleUpdate
|
|
204
|
-
|
|
205
|
-
}));
|
|
206
|
-
}, onOpen: function () {
|
|
171
|
+
return (_jsxs(RoundedSelect, { onBlur: onBlur, inputRef: inputRef, name: name, fullWidth: true, handleUpdate: (event) => {
|
|
172
|
+
handleUpdate?.(options.find((option) => getValueString(option) == event.target.value));
|
|
173
|
+
}, onOpen: () => {
|
|
207
174
|
//Show loading icon if loading
|
|
208
175
|
}, 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
|
|
209
|
-
?
|
|
210
|
-
|
|
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))); })] })));
|
|
176
|
+
? (props) => cloneElement(icon, props)
|
|
177
|
+
: undefined, showIcon: showIcon, children: [_jsx(MenuItem, { value: '', style: { whiteSpace: 'normal' }, children: _jsx("em", { children: "Sin Seleccionar" }) }, 'EMPTY'), options.map((option) => (_jsx(MenuItem, { value: getValueString(option), style: { whiteSpace: 'normal' }, children: option.label }, getValueString(option))))] }));
|
|
213
178
|
}
|
|
214
179
|
}
|