@arquimedes.co/eureka-forms 1.2.0 → 1.4.2-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@Types/@Types.d.ts +1 -0
- package/dist/@Types/Form.d.ts +1 -1
- package/dist/@Types/FormStep.d.ts +1 -6
- package/dist/@Types/index.d.ts +1 -0
- package/dist/@Types/index.js +1 -0
- package/dist/App.d.ts +3 -1
- package/dist/App.js +6 -5
- package/dist/AxiosWidget.js +1 -1
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.d.ts +1 -1
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +57 -51
- package/dist/FormComponents/Form/ConfirmationDialog/ConfirmationDialog.js +2 -4
- package/dist/FormComponents/Form/Form.d.ts +1 -0
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +2 -2
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +6 -3
- package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js +1 -1
- package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +2 -1
- package/dist/FormComponents/Step/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +1 -1
- package/dist/FormComponents/Step/Step.js +5 -7
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.js +23 -7
- package/dist/FormComponents/Step/TextAreaStep/MaterialTextAreaStep/MaterialTextAreaStep.module.css +1 -1
- package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js +1 -1
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +3 -1
- package/dist/constants/FormStepTypes.d.ts +0 -6
- package/dist/constants/FormStepTypes.js +0 -7
- package/dist/controllers/FileService.js +1 -1
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.d.ts +1 -1
- package/dist/shared/RoundedCheckBox/RoundedCheckBox.js +1 -1
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.d.ts +2 -4
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +9 -6
- package/dist/shared/RoundedSelect/RoundedSelect.d.ts +5 -1
- package/dist/shared/RoundedSelect/RoundedSelect.js +8 -2
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +63 -0
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +182 -0
- package/dist/shared/RoundedTextField/RoundedTextField.js +3 -2
- package/package.json +16 -13
package/dist/@Types/@Types.d.ts
CHANGED
package/dist/@Types/Form.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Types, { ClassifierOptionTypes,
|
|
1
|
+
import Types, { ClassifierOptionTypes, OptionTypes } from '../constants/FormStepTypes';
|
|
2
2
|
export declare type FormStep = Title | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector;
|
|
3
3
|
export interface Title {
|
|
4
4
|
id: string;
|
|
@@ -34,7 +34,6 @@ export interface TextArea {
|
|
|
34
34
|
description: string | null;
|
|
35
35
|
required: boolean;
|
|
36
36
|
hasTextEditor: boolean;
|
|
37
|
-
isPrimary: boolean;
|
|
38
37
|
}
|
|
39
38
|
export interface TextInput {
|
|
40
39
|
id: string;
|
|
@@ -43,9 +42,6 @@ export interface TextInput {
|
|
|
43
42
|
description: string | null;
|
|
44
43
|
validation?: FormValidation;
|
|
45
44
|
required: boolean;
|
|
46
|
-
isSubject: boolean;
|
|
47
|
-
isClientInfo: boolean;
|
|
48
|
-
clientInfoType?: ClientInfoTypes;
|
|
49
45
|
size: 1 | 2 | 3 | 4;
|
|
50
46
|
}
|
|
51
47
|
export interface DatePicker {
|
|
@@ -55,7 +51,6 @@ export interface DatePicker {
|
|
|
55
51
|
pickTime: boolean;
|
|
56
52
|
description: string | null;
|
|
57
53
|
required: boolean;
|
|
58
|
-
showIcon: boolean;
|
|
59
54
|
size: 1 | 2 | 3 | 4;
|
|
60
55
|
}
|
|
61
56
|
declare type FormValidation = {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './@Types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './@Types';
|
package/dist/App.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface AppProps {
|
|
|
19
19
|
valuesData?: Record<string, unknown>;
|
|
20
20
|
/** Custom steps to display */
|
|
21
21
|
customSteps?: Record<string, CustomStep>;
|
|
22
|
+
/** Custom function to call on send */
|
|
23
|
+
customSend?: (values: any, reload: Function) => Promise<void>;
|
|
22
24
|
/** Function to call on postview to fetch the download url of a file */
|
|
23
25
|
fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
|
|
24
26
|
/** Function to call after the confimation dialog has been closed */
|
|
@@ -28,7 +30,7 @@ export interface CustomStep {
|
|
|
28
30
|
component: ReactNode;
|
|
29
31
|
updateValue: (idStep: string, values: Record<string, any>, form: Form) => void;
|
|
30
32
|
}
|
|
31
|
-
declare function App({ apiKey, domain, preview, formData, postview, isWidget, internal, valuesData, customSteps, handleConfirmed, ...others }: AppProps): JSX.Element;
|
|
33
|
+
declare function App({ apiKey, domain, preview, formData, postview, isWidget, internal, valuesData, customSend, customSteps, handleConfirmed, ...others }: AppProps): JSX.Element;
|
|
32
34
|
export default App;
|
|
33
35
|
export declare enum SIZES {
|
|
34
36
|
SMALL = "SMALL",
|
package/dist/App.js
CHANGED
|
@@ -68,7 +68,7 @@ import widgetInstance from './AxiosWidget';
|
|
|
68
68
|
function App(_a) {
|
|
69
69
|
var _this = this;
|
|
70
70
|
var _b, _c, _d, _e;
|
|
71
|
-
var apiKey = _a.apiKey, domain = _a.domain, preview = _a.preview, formData = _a.formData, postview = _a.postview, isWidget = _a.isWidget, internal = _a.internal, valuesData = _a.valuesData, customSteps = _a.customSteps, handleConfirmed = _a.handleConfirmed, others = __rest(_a, ["apiKey", "domain", "preview", "formData", "postview", "isWidget", "internal", "valuesData", "customSteps", "handleConfirmed"]);
|
|
71
|
+
var apiKey = _a.apiKey, domain = _a.domain, preview = _a.preview, formData = _a.formData, postview = _a.postview, isWidget = _a.isWidget, internal = _a.internal, valuesData = _a.valuesData, customSend = _a.customSend, customSteps = _a.customSteps, handleConfirmed = _a.handleConfirmed, others = __rest(_a, ["apiKey", "domain", "preview", "formData", "postview", "isWidget", "internal", "valuesData", "customSend", "customSteps", "handleConfirmed"]);
|
|
72
72
|
var _f = useState(undefined), form = _f[0], setForm = _f[1];
|
|
73
73
|
var _g = useState({}), originalValues = _g[0], setOriginalValues = _g[1];
|
|
74
74
|
var _h = useState(undefined), organizationInfo = _h[0], setOrganizationInfo = _h[1];
|
|
@@ -127,6 +127,7 @@ function App(_a) {
|
|
|
127
127
|
if (!(organizationInfo && form !== undefined)) return [3 /*break*/, 4];
|
|
128
128
|
if (!(process.env.NODE_ENV === 'production' &&
|
|
129
129
|
apiKey !== 'rCgWiEfOSN1TlUmHO28Y0' &&
|
|
130
|
+
apiKey !== 'FORMSTEST' &&
|
|
130
131
|
!internal &&
|
|
131
132
|
!postview &&
|
|
132
133
|
!preview)) return [3 /*break*/, 4];
|
|
@@ -162,7 +163,7 @@ function App(_a) {
|
|
|
162
163
|
case 0:
|
|
163
164
|
_b.trys.push([0, 5, , 6]);
|
|
164
165
|
if (!domain) return [3 /*break*/, 2];
|
|
165
|
-
return [4 /*yield*/, widgetInstance.get("/organization?idOrganization="
|
|
166
|
+
return [4 /*yield*/, widgetInstance.get("/organization?idOrganization=" + domain)];
|
|
166
167
|
case 1:
|
|
167
168
|
_a = _b.sent();
|
|
168
169
|
return [3 /*break*/, 4];
|
|
@@ -205,8 +206,8 @@ function App(_a) {
|
|
|
205
206
|
case 0:
|
|
206
207
|
_a.trys.push([0, 2, , 3]);
|
|
207
208
|
return [4 /*yield*/, (domain
|
|
208
|
-
? widgetInstance.get("/form/"
|
|
209
|
-
: axiosInstance.get("/form/"
|
|
209
|
+
? widgetInstance.get("/form/" + apiKey + "?idOrganization=" + domain)
|
|
210
|
+
: axiosInstance.get("/form/" + apiKey))];
|
|
210
211
|
case 1:
|
|
211
212
|
response = _a.sent();
|
|
212
213
|
if (response) {
|
|
@@ -255,7 +256,7 @@ function App(_a) {
|
|
|
255
256
|
if (handleConfirmed) {
|
|
256
257
|
handleConfirmed();
|
|
257
258
|
}
|
|
258
|
-
}, postview: postview === true, internal: internal === true, apiKey: apiKey, domain: domain, originalValues: originalValues, containerRef: containerRef, organization: organizationInfo, customSteps: customSteps !== null && customSteps !== void 0 ? customSteps : {} }), void 0) }), void 0));
|
|
259
|
+
}, postview: postview === true, internal: internal === true, apiKey: apiKey, domain: domain, customSend: customSend, originalValues: originalValues, containerRef: containerRef, organization: organizationInfo, customSteps: customSteps !== null && customSteps !== void 0 ? customSteps : {} }), void 0) }), void 0));
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
262
|
export default App;
|
package/dist/AxiosWidget.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
var headers = {};
|
|
3
3
|
var widgetInstance = axios.create({
|
|
4
|
-
baseURL: "https://api.forms."
|
|
4
|
+
baseURL: "https://api.forms." + process.env.REACT_APP_DOMAIN + "/api",
|
|
5
5
|
timeout: 30000,
|
|
6
6
|
headers: headers,
|
|
7
7
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormComponentProps } from '../Form';
|
|
3
|
-
declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, widthStats, customSteps, originalValues, ...others }: FormComponentProps): JSX.Element;
|
|
3
|
+
declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, widthStats, customSteps, customSend, originalValues, ...others }: FormComponentProps): JSX.Element;
|
|
4
4
|
export default ColumnForm;
|
|
@@ -70,7 +70,7 @@ import axiosInstance from '../../../AxiosAPI';
|
|
|
70
70
|
import widgetInstance from '../../../AxiosWidget';
|
|
71
71
|
function ColumnForm(_a) {
|
|
72
72
|
var _this = this;
|
|
73
|
-
var form = _a.form, apiKey = _a.apiKey, reload = _a.reload, domain = _a.domain, postview = _a.postview, internal = _a.internal, formStyle = _a.formStyle, widthStats = _a.widthStats, customSteps = _a.customSteps, originalValues = _a.originalValues, others = __rest(_a, ["form", "apiKey", "reload", "domain", "postview", "internal", "formStyle", "widthStats", "customSteps", "originalValues"]);
|
|
73
|
+
var form = _a.form, apiKey = _a.apiKey, reload = _a.reload, domain = _a.domain, postview = _a.postview, internal = _a.internal, formStyle = _a.formStyle, widthStats = _a.widthStats, customSteps = _a.customSteps, customSend = _a.customSend, originalValues = _a.originalValues, others = __rest(_a, ["form", "apiKey", "reload", "domain", "postview", "internal", "formStyle", "widthStats", "customSteps", "customSend", "originalValues"]);
|
|
74
74
|
var _b = useState(false), tempError = _b[0], setTempError = _b[1];
|
|
75
75
|
var _c = useForm({
|
|
76
76
|
defaultValues: mapOriginal(originalValues, form),
|
|
@@ -93,7 +93,7 @@ function ColumnForm(_a) {
|
|
|
93
93
|
return __generator(this, function (_c) {
|
|
94
94
|
switch (_c.label) {
|
|
95
95
|
case 0:
|
|
96
|
-
if (!(apiKey || internal)) return [3 /*break*/,
|
|
96
|
+
if (!(apiKey || internal)) return [3 /*break*/, 11];
|
|
97
97
|
return [4 /*yield*/, trigger(undefined, { shouldFocus: true })];
|
|
98
98
|
case 1:
|
|
99
99
|
valid = _c.sent();
|
|
@@ -104,42 +104,46 @@ function ColumnForm(_a) {
|
|
|
104
104
|
setTimeout(function () {
|
|
105
105
|
setTempError(false);
|
|
106
106
|
}, 500);
|
|
107
|
-
return [3 /*break*/,
|
|
107
|
+
return [3 /*break*/, 11];
|
|
108
108
|
case 2:
|
|
109
|
-
_c.trys.push([2,
|
|
109
|
+
_c.trys.push([2, 10, , 11]);
|
|
110
110
|
setLoading(true);
|
|
111
111
|
for (_i = 0, _a = Object.keys(values); _i < _a.length; _i++) {
|
|
112
112
|
idStep = _a[_i];
|
|
113
113
|
updateValue(idStep, values, form, customSteps);
|
|
114
114
|
}
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
if (!customSend) return [3 /*break*/, 4];
|
|
116
|
+
return [4 /*yield*/, customSend(values, reload)];
|
|
117
|
+
case 3:
|
|
118
|
+
_c.sent();
|
|
119
|
+
return [3 /*break*/, 9];
|
|
120
|
+
case 4:
|
|
119
121
|
payload = {
|
|
120
122
|
formValues: { steps: values },
|
|
121
123
|
};
|
|
122
|
-
url = "/ticket/"
|
|
123
|
-
if (!(domain || internal)) return [3 /*break*/,
|
|
124
|
-
return [4 /*yield*/, widgetInstance.post(
|
|
125
|
-
case 3:
|
|
126
|
-
_b = _c.sent();
|
|
127
|
-
return [3 /*break*/, 6];
|
|
128
|
-
case 4: return [4 /*yield*/, axiosInstance.post(url, payload)];
|
|
124
|
+
url = "/ticket/" + (internal ? form.apiKey : apiKey);
|
|
125
|
+
if (!(domain || internal)) return [3 /*break*/, 6];
|
|
126
|
+
return [4 /*yield*/, widgetInstance.post(url + "?idOrganization=" + domain, payload)];
|
|
129
127
|
case 5:
|
|
130
128
|
_b = _c.sent();
|
|
131
|
-
|
|
132
|
-
case 6:
|
|
129
|
+
return [3 /*break*/, 8];
|
|
130
|
+
case 6: return [4 /*yield*/, axiosInstance.post(url, payload)];
|
|
131
|
+
case 7:
|
|
132
|
+
_b = _c.sent();
|
|
133
|
+
_c.label = 8;
|
|
134
|
+
case 8:
|
|
133
135
|
resp = _b;
|
|
134
136
|
setShowConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
|
|
137
|
+
_c.label = 9;
|
|
138
|
+
case 9:
|
|
135
139
|
setLoading(false);
|
|
136
|
-
return [3 /*break*/,
|
|
137
|
-
case
|
|
140
|
+
return [3 /*break*/, 11];
|
|
141
|
+
case 10:
|
|
138
142
|
error_1 = _c.sent();
|
|
139
143
|
console.error(error_1);
|
|
140
144
|
setLoading(false);
|
|
141
|
-
return [3 /*break*/,
|
|
142
|
-
case
|
|
145
|
+
return [3 /*break*/, 11];
|
|
146
|
+
case 11: return [2 /*return*/];
|
|
143
147
|
}
|
|
144
148
|
});
|
|
145
149
|
}); };
|
|
@@ -148,7 +152,7 @@ function ColumnForm(_a) {
|
|
|
148
152
|
setShowConfirmation(undefined);
|
|
149
153
|
} }, void 0)), sections.map(function (idSection, index) { return (_jsx(SectionComponent, __assign({ form: form, domain: domain, postview: postview, clearErrors: clearErrors, widthStats: widthStats, control: control, getValues: getValues, originalValues: originalValues, errors: errors, index: index, setSections: setSections, section: form.sections[idSection], formStyle: formStyle, customSteps: customSteps }, others), index)); }), form.terms &&
|
|
150
154
|
!internal &&
|
|
151
|
-
form.terms.map(function (term, index) { return (_jsx(TermComponent, { setValue: setValue, postview: postview, tempError: tempError, term: term, control: control, errors: errors, form: form, formStyle: formStyle }, index)); }), !postview && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children: _jsxs("button", __assign({ "data-testid": "
|
|
155
|
+
form.terms.map(function (term, index) { return (_jsx(TermComponent, { setValue: setValue, postview: postview, tempError: tempError, term: term, control: control, errors: errors, form: form, formStyle: formStyle }, index)); }), !postview && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children: _jsxs("button", __assign({ "data-testid": "form__submit", className: styles.submitBtn, onClick: function () {
|
|
152
156
|
onSubmit();
|
|
153
157
|
}, style: {
|
|
154
158
|
background: formStyle.primaryColor,
|
|
@@ -196,38 +200,40 @@ var mapOriginal = function (values, form) {
|
|
|
196
200
|
};
|
|
197
201
|
var updateValue = function (idStep, values, form, customSteps) {
|
|
198
202
|
var step = form.steps[idStep];
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
203
|
+
var custom = customSteps[step === null || step === void 0 ? void 0 : step.type];
|
|
204
|
+
if (custom !== undefined) {
|
|
205
|
+
custom.updateValue(idStep, values, form);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
switch (step === null || step === void 0 ? void 0 : step.type) {
|
|
209
|
+
case Types.TEXTAREA: {
|
|
210
|
+
var value = values[step.id];
|
|
211
|
+
if (step.hasTextEditor) {
|
|
212
|
+
var currentContent = value.getCurrentContent();
|
|
213
|
+
values[step.id] = {
|
|
214
|
+
value: currentContent.getPlainText(),
|
|
215
|
+
draft: convertToRaw(currentContent),
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
values[step.id] = {
|
|
220
|
+
value: value,
|
|
221
|
+
draft: stringToDraft(value),
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
208
225
|
}
|
|
209
|
-
|
|
210
|
-
values[step.id]
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
226
|
+
case Types.FILEUPLOAD: {
|
|
227
|
+
var value = values[step.id];
|
|
228
|
+
values[step.id] = value.map(function (val) { return ({
|
|
229
|
+
fileName: val.fileName,
|
|
230
|
+
S3Key: val.S3Key,
|
|
231
|
+
}); });
|
|
232
|
+
break;
|
|
214
233
|
}
|
|
215
|
-
|
|
234
|
+
default:
|
|
235
|
+
break;
|
|
216
236
|
}
|
|
217
|
-
case Types.FILEUPLOAD: {
|
|
218
|
-
var value = values[step.id];
|
|
219
|
-
values[step.id] = value.map(function (val) { return ({
|
|
220
|
-
fileName: val.fileName,
|
|
221
|
-
S3Key: val.S3Key,
|
|
222
|
-
}); });
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
default:
|
|
226
|
-
var custom = customSteps[step === null || step === void 0 ? void 0 : step.type];
|
|
227
|
-
if (custom !== undefined) {
|
|
228
|
-
custom.updateValue(idStep, values, form);
|
|
229
|
-
}
|
|
230
|
-
break;
|
|
231
237
|
}
|
|
232
238
|
};
|
|
233
239
|
function stringToDraft(text) {
|
|
@@ -24,10 +24,8 @@ function ConfirmationDialog(_a) {
|
|
|
24
24
|
},
|
|
25
25
|
}, open: true }, { children: _jsxs("div", __assign({ className: styles.confirmationContainer, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.closeIcon, onClick: function () {
|
|
26
26
|
onClose();
|
|
27
|
-
} }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.checkContainer, style: { color: formStyle.primaryColor } }, { children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["Tu caso n\u00FAmero", ' ', _jsx("span", __assign({ style: { fontWeight: 'bold' } }, { children: confirmation.case }), void 0), ' ', "ha sido registrado!"] }), void 0), _jsx("div", __assign({ className: styles.messageContainer }, { children: "Pronto te estaremos dando respuesta." }), void 0), _jsxs("div", __assign({ className: styles.linkContainer }, { children: ["Puedes consultar el estado aqui:", ' '] }), void 0), _jsx("
|
|
28
|
-
|
|
29
|
-
(_c = (_b = (_a = window
|
|
30
|
-
.open) === null || _a === void 0 ? void 0 : _a.call(window, confirmation.url, '_blank')) === null || _b === void 0 ? void 0 : _b.focus) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
27
|
+
} }, { children: _jsx(CloseRoundedIcon, { fontSize: "inherit" }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.container }, { children: [_jsx("div", __assign({ className: styles.checkContainer, style: { color: formStyle.primaryColor } }, { children: _jsx(CheckCircleOutlineRoundedIcon, { fontSize: "inherit", style: { fontSize: '160px' } }, void 0) }), void 0), _jsxs("div", __assign({ className: styles.messageContainer }, { children: ["Tu caso n\u00FAmero", ' ', _jsx("span", __assign({ style: { fontWeight: 'bold' } }, { children: confirmation.case }), void 0), ' ', "ha sido registrado!"] }), void 0), _jsx("div", __assign({ className: styles.messageContainer }, { children: "Pronto te estaremos dando respuesta." }), void 0), _jsxs("div", __assign({ className: styles.linkContainer }, { children: ["Puedes consultar el estado aqui:", ' '] }), void 0), _jsx("a", __assign({ className: styles.url, "data-testid": "ResUrl", target: "_blank", href: confirmation.url, style: {
|
|
28
|
+
color: formStyle.textColor,
|
|
31
29
|
} }, { children: confirmation.url }), void 0)] }), void 0)] }), void 0) }), void 0));
|
|
32
30
|
}
|
|
33
31
|
export default ConfirmationDialog;
|
|
@@ -11,6 +11,7 @@ export interface FormComponentProps {
|
|
|
11
11
|
form: Form;
|
|
12
12
|
originalValues: Record<string, unknown>;
|
|
13
13
|
customSteps: Record<string, CustomStep>;
|
|
14
|
+
customSend?: (values: any, reload: Function) => Promise<void>;
|
|
14
15
|
widthStats: WidthStats;
|
|
15
16
|
internal: boolean;
|
|
16
17
|
reload: Function;
|
|
@@ -21,13 +21,13 @@ function CheckBoxStep(_a) {
|
|
|
21
21
|
? '100%'
|
|
22
22
|
: calcStepWidth(step.size, form),
|
|
23
23
|
minHeight: step.description || step.required ? '55px' : '43px',
|
|
24
|
-
} }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }), void 0), _jsx(Controller, { name: step.id, control: control, defaultValue: false, rules: {
|
|
24
|
+
} }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [step.label && (_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }), void 0)), _jsx(Controller, { name: step.id, control: control, defaultValue: false, rules: {
|
|
25
25
|
required: step.required
|
|
26
26
|
? 'Este campo es obligatorio'
|
|
27
27
|
: undefined,
|
|
28
28
|
}, shouldUnregister: true, render: function (_a) {
|
|
29
29
|
var field = _a.field;
|
|
30
|
-
return (_jsx(RoundedCheckBox, __assign({}, field, { inputRef: field.ref, padding: "0px", size: "1.6rem", cantEdit: postview, checkedColor: formStyle.primaryColor, uncheckedColor: formStyle.outlineColor, checked: field.value }), void 0));
|
|
30
|
+
return (_jsx(RoundedCheckBox, __assign({}, field, { "data-testid": step.id, inputRef: field.ref, padding: "0px", size: "1.6rem", cantEdit: postview, checkedColor: formStyle.primaryColor, uncheckedColor: formStyle.outlineColor, checked: field.value }), void 0));
|
|
31
31
|
} }, void 0)] }), void 0), (step.description || !!errors[step.id]) && (_jsx("div", __assign({ className: styles.descriptionPar, style: {
|
|
32
32
|
color: !!errors[step.id]
|
|
33
33
|
? formStyle.errorColor
|
|
@@ -55,7 +55,7 @@ function ClassifierSelector(_a) {
|
|
|
55
55
|
} }, { children: _jsxs(RoundedSelect, __assign({ fullWidth: true, value: value, cantEdit: postview, helperTextColor: formStyle.descriptionTextColor, errorColor: formStyle.errorColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, label: step.label ? step.label : classifier.name, required: step.required, containerMargin: "0px", height: '31px', onBlur: onBlur, handleUpdate: function (event) {
|
|
56
56
|
onChange(event.target.value);
|
|
57
57
|
sizeChange();
|
|
58
|
-
}, inputRef: inputRef, helperText: errors[step.id]
|
|
58
|
+
}, "data-testid": step.id, inputRef: inputRef, helperText: errors[step.id]
|
|
59
59
|
? errors[step.id].message
|
|
60
60
|
: step.description, error: !!errors[step.id] }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: "Sin Seleccionar" }, void 0) }), 'EMPTY'), classifier.children
|
|
61
61
|
.filter(function (classifier) {
|
|
@@ -63,7 +63,10 @@ function ClassifierSelector(_a) {
|
|
|
63
63
|
return ((_a = step.options[classifier._id]) === null || _a === void 0 ? void 0 : _a.type) !==
|
|
64
64
|
ClassifierOptionTypes.HIDE;
|
|
65
65
|
})
|
|
66
|
-
.map(function (classifier) {
|
|
66
|
+
.map(function (classifier) {
|
|
67
|
+
var _a;
|
|
68
|
+
return typeof classifier === 'string' ? (_jsx(MenuItem, __assign({ value: classifier, style: { whiteSpace: 'normal' } }, { children: (_a = form.classifiers[classifier]) === null || _a === void 0 ? void 0 : _a.name }), classifier)) : (_jsx(MenuItem, __assign({ value: classifier._id, style: { whiteSpace: 'normal' } }, { children: classifier.name }), classifier._id));
|
|
69
|
+
})] }), void 0) }), step.id));
|
|
67
70
|
};
|
|
68
71
|
var mapNestedOption = function () {
|
|
69
72
|
if (value) {
|
|
@@ -85,7 +88,7 @@ function ClassifierSelector(_a) {
|
|
|
85
88
|
: 'fit-content',
|
|
86
89
|
} }, { children: [renderSelect(), mapNestedOption(), level === 0 && step.maxSize < form.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
87
90
|
width: fillerSize,
|
|
88
|
-
} },
|
|
91
|
+
} }, "SEPARATOR"))] }), void 0));
|
|
89
92
|
}
|
|
90
93
|
else {
|
|
91
94
|
return (_jsxs(React.Fragment, { children: [renderSelect(), mapNestedOption(), level === 0 && _jsx("div", { className: styles.separator }, void 0)] }, void 0));
|
package/dist/FormComponents/Step/DatePickerStep/MaterialDatePickerStep/MaterialDatePickerStep.js
CHANGED
|
@@ -27,7 +27,7 @@ function DatePickerStep(_a) {
|
|
|
27
27
|
: undefined,
|
|
28
28
|
}, shouldUnregister: true, render: function (_a) {
|
|
29
29
|
var field = _a.field;
|
|
30
|
-
return (_jsx(RoundedDatePicker, __assign({}, field, { pickTime: step.pickTime,
|
|
30
|
+
return (_jsx(RoundedDatePicker, __assign({}, field, { pickTime: step.pickTime, inputRef: field.ref, cantEdit: postview, "data-testid": step.id, secondaryColor: formStyle.secondaryColor, contrastColor: formStyle.secondaryContrastColor, accentColor: formStyle.textColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, helperTextColor: formStyle.descriptionTextColor, fontWeight: 400, label: step.label, helperText: errors[step.id]
|
|
31
31
|
? errors[step.id].message
|
|
32
32
|
: step.description, error: !!errors[step.id], required: step.required }), void 0));
|
|
33
33
|
} }, void 0) }), void 0));
|
package/dist/FormComponents/Step/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js
CHANGED
|
@@ -190,7 +190,8 @@ function FileUploadStep(_a) {
|
|
|
190
190
|
}
|
|
191
191
|
return '';
|
|
192
192
|
};
|
|
193
|
-
return (_jsxs("div", __assign({ className: styles.container
|
|
193
|
+
return (_jsxs("div", __assign({ className: styles.container +
|
|
194
|
+
(error || !!errors[step.id] ? ' EF-error' : ''), "data-testid": step.id }, { children: [_jsx("div", __assign({ className: styles.labelLabel }, { children: step.label }), void 0), step.description && (_jsx("div", __assign({ className: styles.stepDescriptionLabel, style: { color: formStyle.descriptionTextColor } }, { children: step.description }), void 0)), _jsx("input", { type: "file", ref: inputRef, className: styles.filesInput, onChange: function (e) {
|
|
194
195
|
var files = e.target.files;
|
|
195
196
|
if (files) {
|
|
196
197
|
var filesArray = Array.from(files);
|
|
@@ -45,7 +45,7 @@ function Selector(_a) {
|
|
|
45
45
|
? '100%'
|
|
46
46
|
: calcStepWidth(step.size, form),
|
|
47
47
|
minHeight: step.description || step.required ? '55px' : '43px',
|
|
48
|
-
} }, { children: _jsxs(RoundedSelect, __assign({ value: value, fullWidth: true, inputRef: inputRef, cantEdit: postview, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, label: step.label, required: step.required, containerMargin: "0px", height: '31px', onBlur: onBlur, handleUpdate: function (event) {
|
|
48
|
+
} }, { children: _jsxs(RoundedSelect, __assign({ value: value, fullWidth: true, inputRef: inputRef, cantEdit: postview, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, label: step.label, "data-testid": step.id, required: step.required, containerMargin: "0px", height: '31px', onBlur: onBlur, handleUpdate: function (event) {
|
|
49
49
|
onChange(event.target.value);
|
|
50
50
|
sizeChange();
|
|
51
51
|
}, helperText: errors[step.id]
|
|
@@ -33,6 +33,10 @@ import FileUploadStep from './FileUploadStep/FileUploadStep';
|
|
|
33
33
|
import CheckBoxStep from './CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep';
|
|
34
34
|
function StepComponent(_a) {
|
|
35
35
|
var step = _a.step, props = __rest(_a, ["step"]);
|
|
36
|
+
var customStep = props.customSteps[step.type];
|
|
37
|
+
if (customStep) {
|
|
38
|
+
return customStep.component(__assign({ step: step }, props));
|
|
39
|
+
}
|
|
36
40
|
switch (step.type) {
|
|
37
41
|
case Types.TITLE: {
|
|
38
42
|
return _jsx(TitleStep, __assign({ step: step }, props), void 0);
|
|
@@ -62,13 +66,7 @@ function StepComponent(_a) {
|
|
|
62
66
|
return _jsx(FileUploadStep, __assign({ step: step }, props), void 0);
|
|
63
67
|
}
|
|
64
68
|
default:
|
|
65
|
-
|
|
66
|
-
if (customStep) {
|
|
67
|
-
return customStep.component(__assign({ step: step }, props));
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return _jsx("div", {}, void 0);
|
|
71
|
-
}
|
|
69
|
+
return _jsx("div", {}, void 0);
|
|
72
70
|
}
|
|
73
71
|
}
|
|
74
72
|
export default StepComponent;
|
|
@@ -20,10 +20,9 @@ import { convertFromRaw, EditorState } from 'draft-js';
|
|
|
20
20
|
import { useState } from 'react';
|
|
21
21
|
import { ClickAwayListener } from '@material-ui/core';
|
|
22
22
|
function TextAreaStep(_a) {
|
|
23
|
-
var _b;
|
|
24
23
|
var step = _a.step, errors = _a.errors, control = _a.control, postview = _a.postview, formStyle = _a.formStyle, originalValues = _a.originalValues;
|
|
25
|
-
var
|
|
26
|
-
var
|
|
24
|
+
var _b = useState(false), hovering = _b[0], setHovering = _b[1];
|
|
25
|
+
var _c = useState(false), focus = _c[0], setFocus = _c[1];
|
|
27
26
|
var calcStyle = function () {
|
|
28
27
|
if (focus) {
|
|
29
28
|
return {
|
|
@@ -42,6 +41,23 @@ function TextAreaStep(_a) {
|
|
|
42
41
|
};
|
|
43
42
|
}
|
|
44
43
|
};
|
|
44
|
+
var calcDefaultStringValue = function (defaultValue) {
|
|
45
|
+
var _a;
|
|
46
|
+
if (typeof defaultValue === 'string') {
|
|
47
|
+
return defaultValue;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return (_a = defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.text) !== null && _a !== void 0 ? _a : '';
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var calcDefaultDraftValue = function (defaultValue) {
|
|
54
|
+
if (typeof defaultValue === 'string') {
|
|
55
|
+
return EditorState.createWithContent(convertFromRaw(stringToDraft(defaultValue)));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
return EditorState.createWithContent(convertFromRaw(getRawText(defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.draft, defaultValue === null || defaultValue === void 0 ? void 0 : defaultValue.text)));
|
|
59
|
+
}
|
|
60
|
+
};
|
|
45
61
|
if (step.hasTextEditor) {
|
|
46
62
|
return (_jsxs("div", __assign({ className: styles.textEditorContainer, style: {
|
|
47
63
|
'--eureka-outline': formStyle.outlineColor,
|
|
@@ -54,7 +70,7 @@ function TextAreaStep(_a) {
|
|
|
54
70
|
if (!postview) {
|
|
55
71
|
setFocus(false);
|
|
56
72
|
}
|
|
57
|
-
} }, { children: _jsx("div", __assign({ className: styles.textContainer + ' EF-DraftContainer', style: calcStyle(), onMouseEnter: function () {
|
|
73
|
+
} }, { children: _jsx("div", __assign({ className: styles.textContainer + ' EF-DraftContainer', "data-testid": step.id, style: calcStyle(), onMouseEnter: function () {
|
|
58
74
|
if (!postview) {
|
|
59
75
|
setHovering(true);
|
|
60
76
|
}
|
|
@@ -67,7 +83,7 @@ function TextAreaStep(_a) {
|
|
|
67
83
|
setFocus(true);
|
|
68
84
|
}
|
|
69
85
|
} }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: originalValues[step.id]
|
|
70
|
-
?
|
|
86
|
+
? calcDefaultDraftValue(originalValues[step.id])
|
|
71
87
|
: EditorState.createEmpty(), rules: step.required
|
|
72
88
|
? {
|
|
73
89
|
validate: function (editorState) {
|
|
@@ -123,13 +139,13 @@ function TextAreaStep(_a) {
|
|
|
123
139
|
else {
|
|
124
140
|
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
125
141
|
paddingBottom: step.description || !!errors[step.id] ? '0px' : '23px',
|
|
126
|
-
} }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: (
|
|
142
|
+
} }, { children: _jsx(Controller, { name: step.id, control: control, defaultValue: calcDefaultStringValue(originalValues[step.id]), rules: {
|
|
127
143
|
required: step.required
|
|
128
144
|
? 'Este campo es obligatorio'
|
|
129
145
|
: undefined,
|
|
130
146
|
}, shouldUnregister: true, render: function (_a) {
|
|
131
147
|
var field = _a.field;
|
|
132
|
-
return (_jsx(RoundedTextField, __assign({}, field, { label: step.label, inputRef: field.ref, required: step.required, cantEdit: postview, fontWeight: 400, multiline: true, minRows: 4, maxRows: 6, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperTextColor: formStyle.descriptionTextColor, helperText: errors[step.id]
|
|
148
|
+
return (_jsx(RoundedTextField, __assign({}, field, { "data-testid": step.id, label: step.label, inputRef: field.ref, required: step.required, cantEdit: postview, fontWeight: 400, multiline: true, minRows: 4, maxRows: 6, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, textColor: formStyle.textColor, errorColor: formStyle.errorColor, backgroundColor: formStyle.backgroundColor, innerBackgroundColor: formStyle.stepBackgroundColor, helperTextColor: formStyle.descriptionTextColor, helperText: errors[step.id]
|
|
133
149
|
? errors[step.id].message
|
|
134
150
|
: step.description, error: !!errors[step.id] }), void 0));
|
|
135
151
|
} }, void 0) }), void 0));
|
package/dist/FormComponents/Step/TextInputStep/MaterialTextInputStep/MaterialTextInputStep.js
CHANGED
|
@@ -35,7 +35,7 @@ function TextInputStep(_a) {
|
|
|
35
35
|
: undefined,
|
|
36
36
|
}, shouldUnregister: true, render: function (_a) {
|
|
37
37
|
var field = _a.field;
|
|
38
|
-
return (_jsx(RoundedTextField, __assign({}, field, { label: step.label, inputRef: field.ref, cantEdit: 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]
|
|
38
|
+
return (_jsx(RoundedTextField, __assign({}, field, { "data-testid": step.id, label: step.label, inputRef: field.ref, cantEdit: 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
39
|
? errors[step.id].message
|
|
40
40
|
: step.description, helperTextColor: formStyle.descriptionTextColor, error: !!errors[step.id] }), void 0));
|
|
41
41
|
} }, void 0) }), void 0));
|
|
@@ -13,6 +13,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import styles from './MaterialTitleStep.module.css';
|
|
14
14
|
function TitleStep(_a) {
|
|
15
15
|
var step = _a.step, formStyle = _a.formStyle;
|
|
16
|
-
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.titleLbl }, { children: step.title }), void 0), step.description && (_jsx("p", __assign({ className: styles.descriptionPar
|
|
16
|
+
return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.titleLbl }, { children: step.title }), void 0), step.description && (_jsx("p", __assign({ className: styles.descriptionPar, style: {
|
|
17
|
+
marginTop: step.title ? '15px' : '0px',
|
|
18
|
+
} }, { children: step.description }), void 0))] }), void 0));
|
|
17
19
|
}
|
|
18
20
|
export default TitleStep;
|
|
@@ -25,10 +25,4 @@ export declare enum ClassifierOptionTypes {
|
|
|
25
25
|
HIDE = "CLASSIFIER_HIDE",
|
|
26
26
|
NESTED = "CLASSIFIER_NESTED"
|
|
27
27
|
}
|
|
28
|
-
export declare enum ClientInfoTypes {
|
|
29
|
-
NAME = "NAME",
|
|
30
|
-
LASTNAME = "LASTNAME",
|
|
31
|
-
EMAIL = "EMAIL",
|
|
32
|
-
OTHER = "OTHER"
|
|
33
|
-
}
|
|
34
28
|
export default TYPES;
|
|
@@ -30,11 +30,4 @@ export var ClassifierOptionTypes;
|
|
|
30
30
|
ClassifierOptionTypes["HIDE"] = "CLASSIFIER_HIDE";
|
|
31
31
|
ClassifierOptionTypes["NESTED"] = "CLASSIFIER_NESTED";
|
|
32
32
|
})(ClassifierOptionTypes || (ClassifierOptionTypes = {}));
|
|
33
|
-
export var ClientInfoTypes;
|
|
34
|
-
(function (ClientInfoTypes) {
|
|
35
|
-
ClientInfoTypes["NAME"] = "NAME";
|
|
36
|
-
ClientInfoTypes["LASTNAME"] = "LASTNAME";
|
|
37
|
-
ClientInfoTypes["EMAIL"] = "EMAIL";
|
|
38
|
-
ClientInfoTypes["OTHER"] = "OTHER";
|
|
39
|
-
})(ClientInfoTypes || (ClientInfoTypes = {}));
|
|
40
33
|
export default TYPES;
|
|
@@ -49,7 +49,7 @@ export function getUploadUrls(files, domain) {
|
|
|
49
49
|
extension: file.name.split('.').pop(),
|
|
50
50
|
}); });
|
|
51
51
|
if (!domain) return [3 /*break*/, 2];
|
|
52
|
-
return [4 /*yield*/, widgetInstance.post("/uploadfile?idOrganization="
|
|
52
|
+
return [4 /*yield*/, widgetInstance.post("/uploadfile?idOrganization=" + domain, filesArray)];
|
|
53
53
|
case 1:
|
|
54
54
|
response = _b.sent();
|
|
55
55
|
return [3 /*break*/, 4];
|
|
@@ -71,7 +71,7 @@ var useCheckBoxStyles = function (props) {
|
|
|
71
71
|
* Generic rounded checkbox
|
|
72
72
|
*/
|
|
73
73
|
function CustomCheckBox(_a) {
|
|
74
|
-
var _b = _a.padding, padding = _b === void 0 ? '9px' : _b, onChange = _a.onChange, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? '1.5rem' : _d, _e = _a.
|
|
74
|
+
var _b = _a.padding, padding = _b === void 0 ? '9px' : _b, onChange = _a.onChange, _c = _a.error, error = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? '1.5rem' : _d, _e = _a.checkedColor, checkedColor = _e === void 0 ? '#3d5a7f' : _e, _f = _a.uncheckedColor, uncheckedColor = _f === void 0 ? '#787878' : _f, _g = _a.disabledColor, disabledColor = _g === void 0 ? '#A0A0A0' : _g, _h = _a.errorColor, errorColor = _h === void 0 ? '#cc2936' : _h, _j = _a.cantEdit, cantEdit = _j === void 0 ? false : _j, checked = _a.checked, others = __rest(_a, ["padding", "onChange", "error", "size", "checkedColor", "uncheckedColor", "disabledColor", "errorColor", "cantEdit", "checked"]);
|
|
75
75
|
var classes = useCheckBoxStyles({
|
|
76
76
|
size: size,
|
|
77
77
|
error: error,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DatePickerProps } from '@material-ui/pickers';
|
|
3
3
|
interface StyleProps {
|
|
4
4
|
/** The color of the text */
|
|
5
5
|
textColor?: string;
|
|
@@ -38,13 +38,11 @@ interface StyleProps {
|
|
|
38
38
|
helperTextColor?: string;
|
|
39
39
|
}
|
|
40
40
|
interface RoundedDatePickerProps extends StyleProps {
|
|
41
|
-
/** If the calendar icon should be shown */
|
|
42
|
-
showIcon?: boolean;
|
|
43
41
|
}
|
|
44
42
|
/**
|
|
45
43
|
* Generic datepicker with apps designs. Is class do to the use in the react-hook-forms library
|
|
46
44
|
*/
|
|
47
|
-
declare class RoundedDatePicker extends React.Component<RoundedDatePickerProps &
|
|
45
|
+
declare class RoundedDatePicker extends React.Component<RoundedDatePickerProps & DatePickerProps> {
|
|
48
46
|
render(): JSX.Element;
|
|
49
47
|
}
|
|
50
48
|
export default RoundedDatePicker;
|
|
@@ -39,7 +39,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
39
39
|
import React, { cloneElement } from 'react';
|
|
40
40
|
import { makeStyles } from '@material-ui/core/styles';
|
|
41
41
|
import CalendarTodayRoundedIcon from '@material-ui/icons/CalendarTodayRounded';
|
|
42
|
-
import {
|
|
42
|
+
import { DatePicker, DateTimePicker, } from '@material-ui/pickers';
|
|
43
43
|
import { getLocale } from '../../FormComponents/Form/Form';
|
|
44
44
|
import { format } from 'date-fns';
|
|
45
45
|
var useDatePickerStyles = function (props) {
|
|
@@ -47,8 +47,9 @@ var useDatePickerStyles = function (props) {
|
|
|
47
47
|
root: {
|
|
48
48
|
borderRadius: props.borderRadius,
|
|
49
49
|
backgroundColor: props.backgroundColor,
|
|
50
|
+
cursor: props.cantEdit ? 'default' : 'pointer',
|
|
50
51
|
'& input, textarea': {
|
|
51
|
-
cursor: props.cantEdit ? 'default' : '
|
|
52
|
+
cursor: props.cantEdit ? 'default' : 'pointer',
|
|
52
53
|
padding: props.padding,
|
|
53
54
|
fontWeight: props.fontWeight,
|
|
54
55
|
color: props.textColor,
|
|
@@ -100,8 +101,8 @@ var useDatePickerLabelStyles = function (props) {
|
|
|
100
101
|
whiteSpace: 'nowrap',
|
|
101
102
|
overflow: 'hidden',
|
|
102
103
|
maxWidth: 'calc(100% - 50px)',
|
|
103
|
-
textOverflow: 'ellipsis',
|
|
104
104
|
marginTop: '-4px',
|
|
105
|
+
textOverflow: 'ellipsis',
|
|
105
106
|
fontSize: props.fontSize,
|
|
106
107
|
'&.Mui-focused': {
|
|
107
108
|
color: props.focusColor,
|
|
@@ -210,7 +211,7 @@ var useDatePickerDialogStyles = function (props) {
|
|
|
210
211
|
}); });
|
|
211
212
|
};
|
|
212
213
|
function CustomDatePicker(_a) {
|
|
213
|
-
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.secondaryColor, secondaryColor = _c === void 0 ? '#98c1d9' : _c, _d = _a.outlineColor, outlineColor = _d === void 0 ? '#0000003b' : _d, _e = _a.backgroundColor, backgroundColor = _e === void 0 ? 'white' : _e, innerBackgroundColor = _a.innerBackgroundColor, _f = _a.textColor, textColor = _f === void 0 ? '#293241' : _f, _g = _a.contrastColor, contrastColor = _g === void 0 ? '#ee6c4d' : _g, _h = _a.accentColor, accentColor = _h === void 0 ? '#293241' : _h, _j = _a.errorColor, errorColor = _j === void 0 ? '#cc2936' : _j, _k = _a.borderRadius, borderRadius = _k === void 0 ? 10 : _k, _l = _a.padding, padding = _l === void 0 ? '6px 0px 6px 12px' : _l, _m = _a.fontSize, fontSize = _m === void 0 ? '1rem' : _m, _o = _a.shrunkenFontSize, shrunkenFontSize = _o === void 0 ? '1rem' : _o, _p = _a.helperTextColor, helperTextColor = _p === void 0 ? '#989898' : _p, _q = _a.fontWeight, fontWeight = _q === void 0 ? '300' : _q, _r = _a.
|
|
214
|
+
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.secondaryColor, secondaryColor = _c === void 0 ? '#98c1d9' : _c, _d = _a.outlineColor, outlineColor = _d === void 0 ? '#0000003b' : _d, _e = _a.backgroundColor, backgroundColor = _e === void 0 ? 'white' : _e, innerBackgroundColor = _a.innerBackgroundColor, _f = _a.textColor, textColor = _f === void 0 ? '#293241' : _f, _g = _a.contrastColor, contrastColor = _g === void 0 ? '#ee6c4d' : _g, _h = _a.accentColor, accentColor = _h === void 0 ? '#293241' : _h, _j = _a.errorColor, errorColor = _j === void 0 ? '#cc2936' : _j, _k = _a.borderRadius, borderRadius = _k === void 0 ? 10 : _k, _l = _a.padding, padding = _l === void 0 ? '6px 0px 6px 12px' : _l, _m = _a.fontSize, fontSize = _m === void 0 ? '1rem' : _m, _o = _a.shrunkenFontSize, shrunkenFontSize = _o === void 0 ? '1rem' : _o, _p = _a.helperTextColor, helperTextColor = _p === void 0 ? '#989898' : _p, _q = _a.fontWeight, fontWeight = _q === void 0 ? '300' : _q, _r = _a.cantEdit, cantEdit = _r === void 0 ? false : _r, _s = _a.pickTime, pickTime = _s === void 0 ? false : _s, onChange = _a.onChange, required = _a.required, others = __rest(_a, ["focusColor", "secondaryColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "contrastColor", "accentColor", "errorColor", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "helperTextColor", "fontWeight", "cantEdit", "pickTime", "onChange", "required"]);
|
|
214
215
|
var classes = useDatePickerStyles({
|
|
215
216
|
padding: padding,
|
|
216
217
|
cantEdit: cantEdit,
|
|
@@ -277,7 +278,7 @@ function CustomDatePicker(_a) {
|
|
|
277
278
|
helperTextColor: helperTextColor,
|
|
278
279
|
})();
|
|
279
280
|
if (pickTime) {
|
|
280
|
-
return (_jsx(
|
|
281
|
+
return (_jsx(DateTimePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'Pp', { locale: getLocale() }), format: "Pp", required: required, InputLabelProps: { classes: labelClasses }, DialogProps: {
|
|
281
282
|
disableEnforceFocus: true,
|
|
282
283
|
className: datePicker,
|
|
283
284
|
cancelLabel: '',
|
|
@@ -286,6 +287,7 @@ function CustomDatePicker(_a) {
|
|
|
286
287
|
required: required,
|
|
287
288
|
classes: classes,
|
|
288
289
|
disabled: cantEdit,
|
|
290
|
+
endAdornment: (_jsx(CalendarTodayRoundedIcon, { fontSize: "inherit", style: { color: '#757575' } }, void 0)),
|
|
289
291
|
}, FormHelperTextProps: {
|
|
290
292
|
classes: helperTextStyles,
|
|
291
293
|
}, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
|
|
@@ -298,7 +300,7 @@ function CustomDatePicker(_a) {
|
|
|
298
300
|
}, variant: "dialog" }), void 0));
|
|
299
301
|
}
|
|
300
302
|
else {
|
|
301
|
-
return (_jsx(
|
|
303
|
+
return (_jsx(DatePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'P', { locale: getLocale() }), format: "P", required: required, InputLabelProps: { classes: labelClasses }, DialogProps: {
|
|
302
304
|
disableEnforceFocus: true,
|
|
303
305
|
className: datePicker,
|
|
304
306
|
cancelLabel: '',
|
|
@@ -307,6 +309,7 @@ function CustomDatePicker(_a) {
|
|
|
307
309
|
required: required,
|
|
308
310
|
classes: classes,
|
|
309
311
|
disabled: cantEdit,
|
|
312
|
+
endAdornment: (_jsx(CalendarTodayRoundedIcon, { fontSize: "inherit", style: { color: '#757575' } }, void 0)),
|
|
310
313
|
}, FormHelperTextProps: {
|
|
311
314
|
classes: helperTextStyles,
|
|
312
315
|
}, renderDay: function (day, selectedDate, dayInCurrentMonth, dayComponent) {
|
|
@@ -15,6 +15,8 @@ interface ColorProps {
|
|
|
15
15
|
height?: string;
|
|
16
16
|
/** The color of the text in the form */
|
|
17
17
|
color?: string;
|
|
18
|
+
/** If custom iconComponent exists */
|
|
19
|
+
showIcon?: boolean;
|
|
18
20
|
}
|
|
19
21
|
interface RoundedSelectProps extends Omit<SelectProps, 'color'>, ColorProps {
|
|
20
22
|
/** children to display in the options */
|
|
@@ -22,7 +24,7 @@ interface RoundedSelectProps extends Omit<SelectProps, 'color'>, ColorProps {
|
|
|
22
24
|
/** Currently selected value */
|
|
23
25
|
value: any;
|
|
24
26
|
/** function called when value changes */
|
|
25
|
-
handleUpdate
|
|
27
|
+
handleUpdate?: (event: React.ChangeEvent<{
|
|
26
28
|
name?: string | undefined;
|
|
27
29
|
value: any;
|
|
28
30
|
}>, child?: React.ReactNode) => void;
|
|
@@ -38,6 +40,8 @@ interface RoundedSelectProps extends Omit<SelectProps, 'color'>, ColorProps {
|
|
|
38
40
|
helperText?: string;
|
|
39
41
|
/** the margin around the selector */
|
|
40
42
|
containerMargin?: string;
|
|
43
|
+
/** The icon to display */
|
|
44
|
+
iconComponent?: any;
|
|
41
45
|
}
|
|
42
46
|
/**
|
|
43
47
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
@@ -85,6 +85,9 @@ var useOutlinedInputStyles = function (props) {
|
|
|
85
85
|
'& .EF-MuiSelect-icon.Mui-disabled': {
|
|
86
86
|
color: props.outlineColor,
|
|
87
87
|
},
|
|
88
|
+
'& .EF-MuiSelect-iconOpen': {
|
|
89
|
+
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
90
|
+
},
|
|
88
91
|
borderRadius: 10,
|
|
89
92
|
color: props.color,
|
|
90
93
|
},
|
|
@@ -127,7 +130,7 @@ var useHelperTextStyles = function (props) {
|
|
|
127
130
|
}); });
|
|
128
131
|
};
|
|
129
132
|
function CustomSelect(_a) {
|
|
130
|
-
var children = _a.children, value = _a.value, handleUpdate = _a.handleUpdate, label = _a.label, minWidth = _a.minWidth, helperText = _a.helperText, _b = _a.color, color = _b === void 0 ? '#293241' : _b, _c = _a.errorColor, errorColor = _c === void 0 ? '#cc2936' : _c, _d = _a.focusColor, focusColor = _d === void 0 ? '#3d5a7f' : _d, _e = _a.outlineColor, outlineColor = _e === void 0 ? '#0000003b' : _e, _f = _a.helperTextColor, helperTextColor = _f === void 0 ? '#989898' : _f, _g = _a.cantEdit, cantEdit = _g === void 0 ? false : _g, _h = _a.containerMargin, containerMargin =
|
|
133
|
+
var children = _a.children, value = _a.value, handleUpdate = _a.handleUpdate, label = _a.label, minWidth = _a.minWidth, helperText = _a.helperText, _b = _a.color, color = _b === void 0 ? '#293241' : _b, _c = _a.errorColor, errorColor = _c === void 0 ? '#cc2936' : _c, _d = _a.focusColor, focusColor = _d === void 0 ? '#3d5a7f' : _d, _e = _a.outlineColor, outlineColor = _e === void 0 ? '#0000003b' : _e, _f = _a.helperTextColor, helperTextColor = _f === void 0 ? '#989898' : _f, _g = _a.cantEdit, cantEdit = _g === void 0 ? false : _g, _h = _a.showIcon, showIcon = _h === void 0 ? true : _h, _j = _a.containerMargin, containerMargin = _j === void 0 ? '8px' : _j, _k = _a.height, height = _k === void 0 ? '40px' : _k, required = _a.required, iconComponent = _a.iconComponent, error = _a.error, others = __rest(_a, ["children", "value", "handleUpdate", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "outlineColor", "helperTextColor", "cantEdit", "showIcon", "containerMargin", "height", "required", "iconComponent", "error"]);
|
|
131
134
|
var classes = useStyles();
|
|
132
135
|
var outlinedInputClasses = useOutlinedInputStyles({
|
|
133
136
|
helperTextColor: helperTextColor,
|
|
@@ -137,6 +140,7 @@ function CustomSelect(_a) {
|
|
|
137
140
|
cantEdit: cantEdit,
|
|
138
141
|
height: height,
|
|
139
142
|
color: color,
|
|
143
|
+
showIcon: showIcon && iconComponent !== undefined,
|
|
140
144
|
})();
|
|
141
145
|
var labelClasses = useLabelInputStyles({
|
|
142
146
|
helperTextColor: helperTextColor,
|
|
@@ -160,7 +164,9 @@ function CustomSelect(_a) {
|
|
|
160
164
|
? { minWidth: minWidth, outlineColor: outlineColor, margin: containerMargin }
|
|
161
165
|
: {
|
|
162
166
|
margin: containerMargin,
|
|
163
|
-
}, fullWidth: true, required: required, error: error }, { children: [_jsx(InputLabel, __assign({ classes: labelClasses }, { children: label }), void 0), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate
|
|
167
|
+
}, fullWidth: true, required: required, error: error }, { children: [_jsx(InputLabel, __assign({ classes: labelClasses }, { children: label }), void 0), _jsx(Select, __assign({}, others, { value: value, onChange: handleUpdate }, (showIcon && iconComponent
|
|
168
|
+
? { IconComponent: iconComponent }
|
|
169
|
+
: {}), { input: _jsx(OutlinedInput, { disabled: cantEdit, name: label, label: label + (required ? ' *' : ''), classes: outlinedInputClasses }, void 0) }, { children: children }), void 0), helperText !== undefined && (_jsx(FormHelperText, __assign({ classes: helperTextClasses }, { children: helperText }), void 0))] }), void 0));
|
|
164
170
|
}
|
|
165
171
|
/**
|
|
166
172
|
* Generic textfield with apps designs. Is class do to the use in the react-hook-forms library
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextFieldProps } from '@material-ui/core';
|
|
3
|
+
interface StyleProps {
|
|
4
|
+
/** The color of the outline when selected and hovered on */
|
|
5
|
+
focusColor?: string;
|
|
6
|
+
/** The color of the outline when it is not selected */
|
|
7
|
+
outlineColor?: string;
|
|
8
|
+
/** The color of the background */
|
|
9
|
+
backgroundColor?: string;
|
|
10
|
+
/** The color of the error to display */
|
|
11
|
+
errorColor?: string;
|
|
12
|
+
/** If the style should change on hover */
|
|
13
|
+
cantEdit?: boolean;
|
|
14
|
+
/** The hight of the container */
|
|
15
|
+
height?: string;
|
|
16
|
+
/** The color of the text in the form */
|
|
17
|
+
color?: string;
|
|
18
|
+
/** The fontsize of the content */
|
|
19
|
+
fontSize?: string;
|
|
20
|
+
/** The color of the inner input */
|
|
21
|
+
innerBackgroundColor?: string;
|
|
22
|
+
/** The borderRadius of the input */
|
|
23
|
+
borderRadius?: number;
|
|
24
|
+
/** If input is readOnly */
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
/** The weight of the font of the value and the placeholder */
|
|
27
|
+
fontWeight?: number | string;
|
|
28
|
+
/** The color of the helper text when not error */
|
|
29
|
+
helperTextColor?: string;
|
|
30
|
+
/** If custom iconComponent exists */
|
|
31
|
+
showIcon?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface RoundedSmartSelectProps extends Omit<TextFieldProps, 'color'>, StyleProps {
|
|
34
|
+
/** Currently selected value */
|
|
35
|
+
value: any;
|
|
36
|
+
/** The array of options to display */
|
|
37
|
+
options?: any[];
|
|
38
|
+
/** If the input is loading */
|
|
39
|
+
loading?: boolean;
|
|
40
|
+
/** Function to call to fetch data if none is found */
|
|
41
|
+
fetchData?: () => Promise<void>;
|
|
42
|
+
/** function called when value changes */
|
|
43
|
+
handleUpdate?: (event: React.ChangeEvent<{
|
|
44
|
+
name?: string | undefined;
|
|
45
|
+
value: any;
|
|
46
|
+
}>, child?: React.ReactNode) => void;
|
|
47
|
+
/** Strig to place in the label */
|
|
48
|
+
label: string;
|
|
49
|
+
/** Minimum width in px of the component */
|
|
50
|
+
minWidth?: number;
|
|
51
|
+
/** The helper Text to display */
|
|
52
|
+
helperText?: string;
|
|
53
|
+
/** The margin around the selector */
|
|
54
|
+
containerMargin?: string;
|
|
55
|
+
/** The icon to display */
|
|
56
|
+
icon?: React.ReactNode;
|
|
57
|
+
/** The iconComponent to display in the selector */
|
|
58
|
+
iconComponent?: any;
|
|
59
|
+
/** If the options are searchable */
|
|
60
|
+
searchable?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export default function RoundedSmartSelect({ options, value, handleUpdate, label, fetchData, color, errorColor, focusColor, helperTextColor, outlineColor, backgroundColor, cantEdit, loading, height, fontSize, required, error, innerBackgroundColor, helperText, readOnly, borderRadius, fontWeight, icon, iconComponent, searchable, containerMargin, showIcon, }: RoundedSmartSelectProps): JSX.Element;
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import Autocomplete, { createFilterOptions, } from '@material-ui/lab/Autocomplete';
|
|
25
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
26
|
+
import TextField from '@material-ui/core/TextField';
|
|
27
|
+
import { Popper } from '@material-ui/core';
|
|
28
|
+
import RoundedSelect from '../RoundedSelect/RoundedSelect';
|
|
29
|
+
var filter = createFilterOptions();
|
|
30
|
+
var useStyles = makeStyles(function (theme) { return ({
|
|
31
|
+
root: {
|
|
32
|
+
'& > * + *': {
|
|
33
|
+
marginTop: theme.spacing(3),
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
}); });
|
|
37
|
+
var useTextfieldStyles = function (props) {
|
|
38
|
+
return makeStyles(function () { return ({
|
|
39
|
+
root: {
|
|
40
|
+
borderRadius: props.borderRadius,
|
|
41
|
+
backgroundColor: props.backgroundColor,
|
|
42
|
+
'& input, textarea': {
|
|
43
|
+
cursor: props.cantEdit ? 'default' : 'text',
|
|
44
|
+
padding: '6px 12px',
|
|
45
|
+
fontWeight: props.fontWeight,
|
|
46
|
+
color: props.color,
|
|
47
|
+
fontSize: props.fontSize,
|
|
48
|
+
'&::placeholder': {
|
|
49
|
+
fontSize: props.fontSize,
|
|
50
|
+
},
|
|
51
|
+
backgroundColor: props.innerBackgroundColor,
|
|
52
|
+
borderRadius: props.borderRadius,
|
|
53
|
+
height: props.height,
|
|
54
|
+
},
|
|
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)',
|
|
66
|
+
},
|
|
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
|
+
},
|
|
82
|
+
height: props.height,
|
|
83
|
+
'& .EF-MuiAutocomplete-input': {
|
|
84
|
+
height: props.height,
|
|
85
|
+
marginTop: -10,
|
|
86
|
+
},
|
|
87
|
+
'& .EF-MuiAutocomplete-input::placeholder': {
|
|
88
|
+
color: 'var(--greyFont)',
|
|
89
|
+
opacity: 1,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
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,
|
|
102
|
+
},
|
|
103
|
+
'& .EF-MuiFormHelperText-root': {
|
|
104
|
+
color: props.helperTextColor,
|
|
105
|
+
},
|
|
106
|
+
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
107
|
+
borderColor: '#0000003b',
|
|
108
|
+
},
|
|
109
|
+
'.EF-MuiAutocomplete-popupIndicator': {
|
|
110
|
+
padding: 0,
|
|
111
|
+
},
|
|
112
|
+
'& .EF-MuiAutocomplete-popupIndicatorOpen': {
|
|
113
|
+
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
}); });
|
|
117
|
+
};
|
|
118
|
+
export default function RoundedSmartSelect(_a) {
|
|
119
|
+
var _b = _a.options, options = _b === void 0 ? [] : _b, value = _a.value, handleUpdate = _a.handleUpdate, label = _a.label, fetchData = _a.fetchData, _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.helperTextColor, helperTextColor = _f === void 0 ? '#989898' : _f, _g = _a.outlineColor, outlineColor = _g === void 0 ? '#b8b8b8' : _g, _h = _a.backgroundColor, backgroundColor = _h === void 0 ? '#ffffff' : _h, _j = _a.cantEdit, cantEdit = _j === void 0 ? false : _j, _k = _a.loading, loading = _k === void 0 ? false : _k, _l = _a.height, height = _l === void 0 ? '31px' : _l, _m = _a.fontSize, fontSize = _m === void 0 ? '1rem' : _m, required = _a.required, error = _a.error, innerBackgroundColor = _a.innerBackgroundColor, helperText = _a.helperText, _o = _a.readOnly, readOnly = _o === void 0 ? false : _o, _p = _a.borderRadius, borderRadius = _p === void 0 ? 10 : _p, _q = _a.fontWeight, fontWeight = _q === void 0 ? '400' : _q, icon = _a.icon, iconComponent = _a.iconComponent, _r = _a.searchable, searchable = _r === void 0 ? false : _r, _s = _a.containerMargin, containerMargin = _s === void 0 ? '0px' : _s, _t = _a.showIcon, showIcon = _t === void 0 ? true : _t;
|
|
120
|
+
var props = {
|
|
121
|
+
color: color,
|
|
122
|
+
height: height,
|
|
123
|
+
errorColor: errorColor,
|
|
124
|
+
focusColor: focusColor,
|
|
125
|
+
outlineColor: outlineColor,
|
|
126
|
+
innerBackgroundColor: innerBackgroundColor !== null && innerBackgroundColor !== void 0 ? innerBackgroundColor : backgroundColor,
|
|
127
|
+
helperTextColor: helperTextColor,
|
|
128
|
+
backgroundColor: backgroundColor,
|
|
129
|
+
borderRadius: borderRadius,
|
|
130
|
+
readOnly: readOnly,
|
|
131
|
+
fontSize: fontSize,
|
|
132
|
+
fontWeight: fontWeight,
|
|
133
|
+
cantEdit: cantEdit,
|
|
134
|
+
showIcon: showIcon && icon !== undefined,
|
|
135
|
+
};
|
|
136
|
+
// const fetchAreas = async (): Promise<void> => {
|
|
137
|
+
// const response = await axiosInstance.get('agents/areas');
|
|
138
|
+
// setLoading(false);
|
|
139
|
+
// setOptions(response.data.map((option: string) => ({ label: option })));
|
|
140
|
+
// };
|
|
141
|
+
var classes = useStyles();
|
|
142
|
+
var textFieldClasses = useTextfieldStyles(props)();
|
|
143
|
+
if (searchable) {
|
|
144
|
+
return (_jsx("div", __assign({ className: classes.root }, { children: _jsx(Autocomplete, { size: "small", fullWidth: true, popupIcon: showIcon && icon ? icon : undefined, onOpen: function () {
|
|
145
|
+
if (options.length === 0 && fetchData) {
|
|
146
|
+
fetchData();
|
|
147
|
+
}
|
|
148
|
+
}, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options, getOptionLabel: function (option) {
|
|
149
|
+
// Value selected with enter, right from the input
|
|
150
|
+
if (typeof option === 'string') {
|
|
151
|
+
return option;
|
|
152
|
+
}
|
|
153
|
+
else if (option.inputValue) {
|
|
154
|
+
return option.inputValue;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
// Regular option
|
|
158
|
+
return option.label;
|
|
159
|
+
}
|
|
160
|
+
}, PopperComponent: function (_a) {
|
|
161
|
+
var style = _a.style, props = __rest(_a, ["style"]);
|
|
162
|
+
return (_jsx(Popper, __assign({}, props, { style: __assign(__assign({}, style), { zIndex: 1305 }) }), void 0));
|
|
163
|
+
}, value: value !== null && value !== void 0 ? value : '', onChange: function (event, newValue) {
|
|
164
|
+
if (typeof newValue === 'string') {
|
|
165
|
+
handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(newValue === null || newValue === void 0 ? void 0 : newValue.label);
|
|
169
|
+
}
|
|
170
|
+
}, filterOptions: function (options, params) {
|
|
171
|
+
var filtered = filter(options, params);
|
|
172
|
+
return filtered;
|
|
173
|
+
}, renderOption: function (option) { return option.label; }, renderInput: function (params) { return (_jsx(TextField, __assign({ classes: textFieldClasses }, params, { variant: "outlined", label: label, required: required, error: error, helperText: helperText }), void 0)); }, noOptionsText: "No hay opciones" }, void 0) }), void 0));
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
return (_jsx(RoundedSelect, { fullWidth: true, handleUpdate: handleUpdate, onOpen: function () {
|
|
177
|
+
if (options.length === 0 && fetchData) {
|
|
178
|
+
fetchData();
|
|
179
|
+
}
|
|
180
|
+
}, value: value, color: color, errorColor: errorColor, focusColor: focusColor, helperTextColor: helperTextColor, outlineColor: outlineColor, cantEdit: cantEdit, label: label, required: required, readOnly: readOnly, helperText: helperText, containerMargin: containerMargin, height: height, error: error, iconComponent: iconComponent, showIcon: showIcon }, void 0));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
@@ -102,7 +102,7 @@ var useTextfieldStyles = function (props) {
|
|
|
102
102
|
}); });
|
|
103
103
|
};
|
|
104
104
|
function CustomTextfield(_a) {
|
|
105
|
-
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.helperTextColor, helperTextColor = _c === void 0 ? '#989898' : _c, _d = _a.outlineColor, outlineColor = _d === void 0 ? '#0000003b' : _d, _e = _a.backgroundColor, backgroundColor = _e === void 0 ? 'white' : _e, innerBackgroundColor = _a.innerBackgroundColor, _f = _a.textColor, textColor = _f === void 0 ? '#293241' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.borderRadius, borderRadius = _h === void 0 ? 10 : _h, _j = _a.padding, padding = _j === void 0 ? '6px 12px' : _j, _k = _a.fontSize, fontSize = _k === void 0 ? '1rem' : _k, _l = _a.shrunkenFontSize, shrunkenFontSize = _l === void 0 ? '1rem' : _l, _m = _a.errorColor, errorColor = _m === void 0 ? '#cc2936' : _m, _o = _a.fontWeight, fontWeight = _o === void 0 ? '300' : _o, _p = _a.multiline, multiline = _p === void 0 ? false : _p, _q = _a.cantEdit, cantEdit = _q === void 0 ? false : _q, others = __rest(_a, ["focusColor", "helperTextColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "readOnly", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "errorColor", "fontWeight", "multiline", "cantEdit"]);
|
|
105
|
+
var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.helperTextColor, helperTextColor = _c === void 0 ? '#989898' : _c, _d = _a.outlineColor, outlineColor = _d === void 0 ? '#0000003b' : _d, _e = _a.backgroundColor, backgroundColor = _e === void 0 ? 'white' : _e, innerBackgroundColor = _a.innerBackgroundColor, _f = _a.textColor, textColor = _f === void 0 ? '#293241' : _f, _g = _a.readOnly, readOnly = _g === void 0 ? false : _g, _h = _a.borderRadius, borderRadius = _h === void 0 ? 10 : _h, _j = _a.padding, padding = _j === void 0 ? '6px 12px' : _j, _k = _a.fontSize, fontSize = _k === void 0 ? '1rem' : _k, _l = _a.shrunkenFontSize, shrunkenFontSize = _l === void 0 ? '1rem' : _l, _m = _a.errorColor, errorColor = _m === void 0 ? '#cc2936' : _m, _o = _a.fontWeight, fontWeight = _o === void 0 ? '300' : _o, _p = _a.multiline, multiline = _p === void 0 ? false : _p, _q = _a.cantEdit, cantEdit = _q === void 0 ? false : _q, inputProps = _a.inputProps, value = _a.value, others = __rest(_a, ["focusColor", "helperTextColor", "outlineColor", "backgroundColor", "innerBackgroundColor", "textColor", "readOnly", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "errorColor", "fontWeight", "multiline", "cantEdit", "inputProps", "value"]);
|
|
106
106
|
var classes = useTextfieldStyles({
|
|
107
107
|
padding: padding,
|
|
108
108
|
textColor: textColor,
|
|
@@ -120,9 +120,10 @@ function CustomTextfield(_a) {
|
|
|
120
120
|
multiline: multiline,
|
|
121
121
|
cantEdit: cantEdit,
|
|
122
122
|
})();
|
|
123
|
-
return (_jsx(TextField, __assign({ classes: classes }, others, { multiline: multiline, variant: "outlined", size: "small", fullWidth: true, InputProps: {
|
|
123
|
+
return (_jsx(TextField, __assign({ classes: classes }, others, { value: value !== null && value !== void 0 ? value : '', multiline: multiline, variant: "outlined", size: "small", fullWidth: true, InputProps: {
|
|
124
124
|
readOnly: readOnly,
|
|
125
125
|
disabled: cantEdit,
|
|
126
|
+
inputProps: inputProps,
|
|
126
127
|
} }), void 0));
|
|
127
128
|
}
|
|
128
129
|
/**
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arquimedes.co/eureka-forms",
|
|
3
3
|
"repository": "git://github.com/Arquimede5/Eureka-Forms.git",
|
|
4
|
-
"version":
|
|
4
|
+
"version":"1.4.2-test",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start": "react-scripts start",
|
|
7
7
|
"build": "react-scripts build",
|
|
8
|
+
"e2e": "percy exec -- cypress run",
|
|
8
9
|
"lint": "eslint 'src/**/*.ts'",
|
|
9
10
|
"tsc-build": "tsc --noEmit false --outDir ./dist"
|
|
10
11
|
},
|
|
@@ -17,11 +18,11 @@
|
|
|
17
18
|
"@testing-library/jest-dom": "^5.14.1",
|
|
18
19
|
"@testing-library/react": "^11.2.7",
|
|
19
20
|
"@testing-library/user-event": "^12.8.3",
|
|
20
|
-
"axios": "^0.21.
|
|
21
|
-
"date-fns": "^2.23.
|
|
22
|
-
"draft-js": "^0.11.
|
|
23
|
-
"react-draft-wysiwyg": "^1.14.
|
|
24
|
-
"react-hook-form": "7.
|
|
21
|
+
"axios": "^0.21.x",
|
|
22
|
+
"date-fns": "^2.23.x",
|
|
23
|
+
"draft-js": "^0.11.x",
|
|
24
|
+
"react-draft-wysiwyg": "^1.14.x",
|
|
25
|
+
"react-hook-form": "^7.6.4",
|
|
25
26
|
"react-router-dom": "^5.2.0",
|
|
26
27
|
"react-scripts": "5.0.0-next.37",
|
|
27
28
|
"typescript": "^4.4.3"
|
|
@@ -46,35 +47,37 @@
|
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@babel/core": "^7.14.6",
|
|
50
|
+
"@percy/cli": "^1.0.0-beta.76",
|
|
51
|
+
"@percy/cypress": "^3.1.1",
|
|
49
52
|
"@types/draft-js": "^0.11.5",
|
|
50
53
|
"@types/jest": "^26.0.24",
|
|
51
|
-
"@types/node": "^12.20.25",
|
|
52
54
|
"@types/react": "^17.0.21",
|
|
53
55
|
"@types/react-dom": "^17.0.9",
|
|
54
56
|
"@types/react-draft-wysiwyg": "^1.13.3",
|
|
55
57
|
"@types/react-router-dom": "^5.1.7",
|
|
56
58
|
"@typescript-eslint/eslint-plugin": "^4.24.0",
|
|
57
59
|
"@typescript-eslint/parser": "^4.24.0",
|
|
60
|
+
"cypress": "^9.5.2",
|
|
58
61
|
"eslint": "^7.27.0",
|
|
59
62
|
"eslint-config-prettier": "^8.3.0",
|
|
60
63
|
"eslint-plugin-prettier": "^3.4.0",
|
|
61
64
|
"jest-junit": "^12.2.0",
|
|
65
|
+
"local-web-server": "^5.2.0",
|
|
62
66
|
"postcss-normalize": "^10.0.1",
|
|
63
67
|
"prettier": "^2.3.0",
|
|
64
68
|
"react": "^17.0.2",
|
|
65
69
|
"react-dom": "^17.0.2"
|
|
66
70
|
},
|
|
67
71
|
"peerDependencies": {
|
|
68
|
-
"react": "^17.x.x",
|
|
69
|
-
"react-dom": "^17.x.x",
|
|
70
72
|
"axios": "^0.21.x",
|
|
73
|
+
"babel-plugin-add-react-displayname": "0.0.x",
|
|
71
74
|
"date-fns": "^2.23.x",
|
|
72
75
|
"draft-js": "^0.11.x",
|
|
76
|
+
"logrocket": "^2.x.x",
|
|
77
|
+
"react": "^17.x.x",
|
|
78
|
+
"react-dom": "^17.x.x",
|
|
73
79
|
"react-draft-wysiwyg": "^1.14.x",
|
|
74
|
-
"react-hook-form": "^7.6.4"
|
|
75
|
-
"react-router-dom": "^5.2.0",
|
|
76
|
-
"babel-plugin-add-react-displayname": "0.0.x",
|
|
77
|
-
"logrocket": "^2.x.x"
|
|
80
|
+
"react-hook-form": "^7.6.4"
|
|
78
81
|
},
|
|
79
82
|
"publishConfig": {
|
|
80
83
|
"access": "public"
|