@arquimedes.co/eureka-forms 1.9.70-test → 1.9.71-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/FormStep.d.ts +18 -1
- package/dist/@Types/Organization.d.ts +1 -0
- package/dist/FormComponents/Form/Form.js +11 -11
- package/dist/FormComponents/Step/EntityValueStep/{EntityValueStep.d.ts → EntityValuePickerStep.d.ts} +1 -1
- package/dist/FormComponents/Step/EntityValueStep/EntityValuePickerStep.js +35 -0
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.d.ts +4 -0
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.js +203 -0
- package/dist/FormComponents/Step/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValuePickerStep.module.css +25 -0
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.d.ts +6 -0
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +2 -1
- package/dist/FormComponents/Step/Step.js +1 -1
- package/dist/FormComponents/Step/StepFunctions.d.ts +2 -2
- package/dist/FormComponents/Step/StepFunctions.js +17 -2
- package/dist/constants/FormStepTypes.d.ts +4 -0
- package/dist/constants/FormStepTypes.js +5 -0
- package/dist/shared/RoundedSelect/RoundedSelect.d.ts +2 -0
- package/dist/shared/RoundedSelect/RoundedSelect.js +36 -26
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +99 -90
- package/package.json +1 -1
- package/dist/FormComponents/Step/EntityValueStep/EntityValueStep.js +0 -129
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Types, { ClassifierOptionTypes, OptionTypes, RatingTypes, MapperStyleTypes } from '../constants/FormStepTypes';
|
|
1
|
+
import Types, { ClassifierOptionTypes, OptionTypes, RatingTypes, MapperStyleTypes, EntityValueOptionTypes } from '../constants/FormStepTypes';
|
|
2
2
|
import * as GSteps from './GenericFormSteps';
|
|
3
3
|
export type FormStep = Title | Rating | CheckBox | TextArea | TextInput | DatePicker | FileUpload | Separator | FormSelector | ClassifierSelector | Collapsible | EntityValuePicker | Mapper;
|
|
4
4
|
export interface Title extends GSteps.GBaseStep {
|
|
@@ -101,6 +101,23 @@ export interface EntityValuePicker extends GSteps.GSmartSelect {
|
|
|
101
101
|
value?: string;
|
|
102
102
|
required?: boolean;
|
|
103
103
|
}[];
|
|
104
|
+
path: {
|
|
105
|
+
idEntity: string;
|
|
106
|
+
idStep?: string;
|
|
107
|
+
idEntityValue?: string;
|
|
108
|
+
}[];
|
|
109
|
+
options: Record<string, FormEntityValuePickerOption>;
|
|
110
|
+
maxSize: number;
|
|
111
|
+
}
|
|
112
|
+
export type FormEntityValuePickerOption = NestedEntityValuePickerOption | HideFormEntityValuePickerOption;
|
|
113
|
+
interface NestedEntityValuePickerOption {
|
|
114
|
+
type: EntityValueOptionTypes.NESTED;
|
|
115
|
+
idEntityValue: string;
|
|
116
|
+
steps: string[];
|
|
117
|
+
}
|
|
118
|
+
interface HideFormEntityValuePickerOption {
|
|
119
|
+
type: EntityValueOptionTypes.HIDE;
|
|
120
|
+
idEntityValue: String;
|
|
104
121
|
}
|
|
105
122
|
export interface Mapper extends GSteps.GBaseStep {
|
|
106
123
|
type: Types.MAPPER;
|
|
@@ -48,10 +48,10 @@ export var getLocale = function () {
|
|
|
48
48
|
navigator.browserLanguage]) !== null && _a !== void 0 ? _a : localeMap.es);
|
|
49
49
|
};
|
|
50
50
|
function FormComponent(_a) {
|
|
51
|
-
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
51
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
52
52
|
var form = _a.form, isWidget = _a.isWidget, internal = _a.internal, postview = _a.postview, organization = _a.organization, containerRef = _a.containerRef, others = __rest(_a, ["form", "isWidget", "internal", "postview", "organization", "containerRef"]);
|
|
53
|
-
var
|
|
54
|
-
var
|
|
53
|
+
var _p = useState(false), loaded = _p[0], setLoaded = _p[1];
|
|
54
|
+
var _q = useState(undefined), widthStats = _q[0], setWidthStats = _q[1];
|
|
55
55
|
/** Calcs the currentBreakPoint and if is mobile */
|
|
56
56
|
var handleResize = function () {
|
|
57
57
|
var _a;
|
|
@@ -88,26 +88,26 @@ function FormComponent(_a) {
|
|
|
88
88
|
if ((postview || internal || !form.isStandAlone) &&
|
|
89
89
|
widthStats !== undefined) {
|
|
90
90
|
return (_jsx("div", __assign({ style: {
|
|
91
|
-
backgroundColor: internal
|
|
92
|
-
?
|
|
93
|
-
: form.style.backgroundColor,
|
|
91
|
+
backgroundColor: internal
|
|
92
|
+
? 'transparent'
|
|
93
|
+
: (_d = (_c = form.style) === null || _c === void 0 ? void 0 : _c.backgroundColor) !== null && _d !== void 0 ? _d : InternalFormStyle.backgroundColor,
|
|
94
94
|
minHeight: form.isStandAlone && !isWidget ? '100vh' : '100%',
|
|
95
95
|
} }, { children: _jsx("div", __assign({ className: styles.widgetFormContainer, ref: containerRef }, { children: _jsx(FormTypeComponent, __assign({}, others, { handleLoaded: function () {
|
|
96
96
|
setLoaded(true);
|
|
97
97
|
}, widthStats: widthStats, form: form, internal: internal, postview: postview, organization: organization, formStyle: internal
|
|
98
98
|
? InternalFormStyle
|
|
99
|
-
: __assign(__assign({}, InternalFormStyle), ((
|
|
99
|
+
: __assign(__assign({}, InternalFormStyle), ((_e = form.style) !== null && _e !== void 0 ? _e : {})) })) })) })));
|
|
100
100
|
}
|
|
101
101
|
else if (organization && widthStats !== undefined) {
|
|
102
102
|
//Standalone cant have widget
|
|
103
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: organization.logoUrl, color: (
|
|
104
|
-
background: (
|
|
103
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: organization.logoUrl, color: (_g = (_f = organization.styles) === null || _f === void 0 ? void 0 : _f.navbarColor) !== null && _g !== void 0 ? _g : (_h = organization.styles) === null || _h === void 0 ? void 0 : _h.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef, style: {
|
|
104
|
+
background: (_k = (_j = form.style) === null || _j === void 0 ? void 0 : _j.standAloneBackgroundColor) !== null && _k !== void 0 ? _k : '#ffffff',
|
|
105
105
|
} }, { children: _jsx("div", __assign({ className: widthStats.isResponsive
|
|
106
106
|
? styles.fullScreenStandAloneForm
|
|
107
107
|
: styles.standAloneFormCard, style: {
|
|
108
|
-
backgroundColor: (
|
|
108
|
+
backgroundColor: (_m = (_l = form.style) === null || _l === void 0 ? void 0 : _l.backgroundColor) !== null && _m !== void 0 ? _m : InternalFormStyle.backgroundColor,
|
|
109
109
|
visibility: loaded ? 'visible' : 'hidden',
|
|
110
|
-
} }, { children: _jsx(FormTypeComponent, __assign({}, others, { internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: (
|
|
110
|
+
} }, { children: _jsx(FormTypeComponent, __assign({}, others, { internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: (_o = form.style) !== null && _o !== void 0 ? _o : InternalFormStyle, organization: organization, handleLoaded: function () {
|
|
111
111
|
setLoaded(true);
|
|
112
112
|
} })) })) }))] }));
|
|
113
113
|
}
|
package/dist/FormComponents/Step/EntityValueStep/{EntityValueStep.d.ts → EntityValuePickerStep.d.ts}
RENAMED
|
@@ -11,5 +11,5 @@ export interface EntityValuePickerStepProps extends StepProps {
|
|
|
11
11
|
/** Default value to display */
|
|
12
12
|
defaultValue?: Date | null;
|
|
13
13
|
}
|
|
14
|
-
declare function EntityValuePickerStep({
|
|
14
|
+
declare function EntityValuePickerStep({ ...props }: EntityValuePickerStepProps): JSX.Element;
|
|
15
15
|
export default EntityValuePickerStep;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
+
import { FormStyleTypes } from '../../../constants/FormStepTypes';
|
|
25
|
+
import MaterialEntityValuePickerStep from './MaterialEntityValuePickerStep/MaterialEntityValuePickerStep';
|
|
26
|
+
function EntityValuePickerStep(_a) {
|
|
27
|
+
var props = __rest(_a, []);
|
|
28
|
+
switch (props.formStyle.type) {
|
|
29
|
+
case FormStyleTypes.MATERIAL:
|
|
30
|
+
default: {
|
|
31
|
+
return _jsx(MaterialEntityValuePickerStep, __assign({}, props));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export default EntityValuePickerStep;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
+
var t = {};
|
|
50
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
+
t[p] = s[p];
|
|
52
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
+
t[p[i]] = s[p[i]];
|
|
56
|
+
}
|
|
57
|
+
return t;
|
|
58
|
+
};
|
|
59
|
+
import { createElement as _createElement } from "react";
|
|
60
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
61
|
+
import React, { useEffect, useState } from 'react';
|
|
62
|
+
import FormStepTypes, { EntityValueOptionTypes, } from '../../../../constants/FormStepTypes';
|
|
63
|
+
import styles from './MaterialEntityValuePickerStep.module.css';
|
|
64
|
+
import StepComponent from '../../Step';
|
|
65
|
+
import { Controller } from 'react-hook-form';
|
|
66
|
+
import { calcFillerSize, calcStepWidth } from '../../StepFunctions';
|
|
67
|
+
import { SmartSelect } from '../../SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep';
|
|
68
|
+
import widgetInstance from '../../../../AxiosWidget';
|
|
69
|
+
import axiosInstance from '../../../../AxiosAPI';
|
|
70
|
+
import InputIcon from '../../../../shared/InputIcon/InputIcon';
|
|
71
|
+
function EntityValuePicker(_a) {
|
|
72
|
+
var _this = this;
|
|
73
|
+
var step = _a.step, form = _a.form, level = _a.level, value = _a.value, control = _a.control, editable = _a.editable, postview = _a.postview, inputRef = _a.inputRef, getValues = _a.getValues, widthStats = _a.widthStats, handleSizeChange = _a.handleSizeChange, others = __rest(_a, ["step", "form", "level", "value", "control", "editable", "postview", "inputRef", "getValues", "widthStats", "handleSizeChange"]);
|
|
74
|
+
var _b = useState(level === 0
|
|
75
|
+
? calcFillerSize(step, form.steps, getValues(), form.size)
|
|
76
|
+
: 0), fillerSize = _b[0], setFillerSize = _b[1];
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
if (!others.originalValues[step.id] && others.defaultValue) {
|
|
79
|
+
others.setDependencyStore(function (deps) {
|
|
80
|
+
var _a;
|
|
81
|
+
return (__assign(__assign({}, deps), (_a = {}, _a[step.id] = others.defaultValue, _a)));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}, []);
|
|
85
|
+
var getEntityValueOptions = function (_a, _step, dependencyStore, domain) {
|
|
86
|
+
var idOrganization = _a.idOrganization;
|
|
87
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
88
|
+
var params, _i, _b, filter, value_1, currentValue, url, response;
|
|
89
|
+
var _c;
|
|
90
|
+
return __generator(this, function (_d) {
|
|
91
|
+
switch (_d.label) {
|
|
92
|
+
case 0:
|
|
93
|
+
params = new URLSearchParams({});
|
|
94
|
+
for (_i = 0, _b = step.filters; _i < _b.length; _i++) {
|
|
95
|
+
filter = _b[_i];
|
|
96
|
+
value_1 = filter.value;
|
|
97
|
+
if (filter.idStep) {
|
|
98
|
+
currentValue = dependencyStore[filter.idStep];
|
|
99
|
+
if (currentValue) {
|
|
100
|
+
if (typeof currentValue === 'string')
|
|
101
|
+
value_1 = currentValue;
|
|
102
|
+
else
|
|
103
|
+
value_1 = (_c = currentValue._id) !== null && _c !== void 0 ? _c : currentValue.id;
|
|
104
|
+
//TODO: Manejo de multiple!
|
|
105
|
+
}
|
|
106
|
+
else if (filter.required) {
|
|
107
|
+
return [2 /*return*/, null];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (value_1)
|
|
111
|
+
params.set(filter.idProperty, value_1);
|
|
112
|
+
}
|
|
113
|
+
url = "".concat(domain !== null && domain !== void 0 ? domain : idOrganization, "/entities/").concat(step.idEntity).concat(step.path.map(function (path) {
|
|
114
|
+
var _a;
|
|
115
|
+
var idEntityValue = path.idEntityValue;
|
|
116
|
+
if (path.idStep) {
|
|
117
|
+
var currentValue = dependencyStore[path.idStep];
|
|
118
|
+
if (currentValue) {
|
|
119
|
+
if (typeof currentValue === 'string')
|
|
120
|
+
idEntityValue = currentValue;
|
|
121
|
+
else
|
|
122
|
+
idEntityValue = (_a = currentValue._id) !== null && _a !== void 0 ? _a : currentValue.id;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return ('/' + path.idEntity + (idEntityValue ? '/' + idEntityValue : ''));
|
|
126
|
+
}), "?").concat(params.toString());
|
|
127
|
+
return [4 /*yield*/, (domain
|
|
128
|
+
? widgetInstance.get(url)
|
|
129
|
+
: axiosInstance.get(url))];
|
|
130
|
+
case 1:
|
|
131
|
+
response = _d.sent();
|
|
132
|
+
return [2 /*return*/, response.data.filter(function (option) {
|
|
133
|
+
return step.options[option._id].type !== EntityValueOptionTypes.HIDE;
|
|
134
|
+
})];
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
var sizeChange = function () {
|
|
140
|
+
handleSizeChange === null || handleSizeChange === void 0 ? void 0 : handleSizeChange();
|
|
141
|
+
if (level === 0) {
|
|
142
|
+
setFillerSize(calcFillerSize(step, form.steps, getValues(), form.size));
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
var renderSelect = function () {
|
|
146
|
+
return (_jsx("div", __assign({ className: styles.container, style: {
|
|
147
|
+
width: widthStats.currentBreakPoint <= step.size
|
|
148
|
+
? '100%'
|
|
149
|
+
: calcStepWidth(step.size, form.size),
|
|
150
|
+
minHeight: step.description ||
|
|
151
|
+
(!postview && editable && step.required)
|
|
152
|
+
? '55px'
|
|
153
|
+
: '43px',
|
|
154
|
+
} }, { children: _jsx(SmartSelect, __assign({}, others, { form: form, level: level, control: control, postview: postview, getValues: getValues, widthStats: widthStats, value: value, inputRef: inputRef, editable: editable, step: step, icon: step.icon ? _jsx(InputIcon, { icon: step.icon }) : undefined, getOptions: getEntityValueOptions, getOptionSelected: function (option, value) {
|
|
155
|
+
return option._id === value._id;
|
|
156
|
+
}, calcDepError: function (steps) {
|
|
157
|
+
for (var _i = 0, steps_1 = steps; _i < steps_1.length; _i++) {
|
|
158
|
+
var step_1 = steps_1[_i];
|
|
159
|
+
if (step_1.type === FormStepTypes.ENTITYVALUEPICKER) {
|
|
160
|
+
return 'Selecciona un ' + step_1.label;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return undefined;
|
|
164
|
+
}, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value._id; } })) }), step.id));
|
|
165
|
+
};
|
|
166
|
+
var mapNestedOption = function () {
|
|
167
|
+
if (value) {
|
|
168
|
+
var currentOption = step.options[value._id];
|
|
169
|
+
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === EntityValueOptionTypes.NESTED) {
|
|
170
|
+
return (_jsx(React.Fragment, { children: currentOption.steps.map(function (idStep) {
|
|
171
|
+
var subStep = form.steps[idStep];
|
|
172
|
+
return (_createElement(StepComponent, __assign({}, others, { postview: postview, editable: editable, widthStats: widthStats, getValues: getValues, form: form, control: control, step: subStep, key: idStep, level: level + 1, handleSizeChange: function () {
|
|
173
|
+
sizeChange();
|
|
174
|
+
} })));
|
|
175
|
+
}) }));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
if (level === 0 && step.maxSize < form.size.blockNum) {
|
|
180
|
+
return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
|
|
181
|
+
width: widthStats.currentBreakPoint <= step.size
|
|
182
|
+
? '100%'
|
|
183
|
+
: 'fit-content',
|
|
184
|
+
} }, { children: [renderSelect(), mapNestedOption(), level === 0 && step.maxSize < form.size.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
|
|
185
|
+
width: fillerSize,
|
|
186
|
+
} }, "SEPARATOR"))] })));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
return (_jsxs(React.Fragment, { children: [renderSelect(), mapNestedOption(), level === 0 && _jsx("div", { className: styles.separator })] }));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
export default EntityValuePickerStep;
|
|
193
|
+
function EntityValuePickerStep(props) {
|
|
194
|
+
var _a, _b;
|
|
195
|
+
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: (_b = (_a = props.originalValues[props.step.id]) !== null && _a !== void 0 ? _a : props.defaultValue) !== null && _b !== void 0 ? _b : null, rules: {
|
|
196
|
+
required: props.step.required
|
|
197
|
+
? 'Este campo es obligatorio'
|
|
198
|
+
: undefined,
|
|
199
|
+
}, shouldUnregister: true, render: function (_a) {
|
|
200
|
+
var _b = _a.field, ref = _b.ref, field = __rest(_b, ["ref"]);
|
|
201
|
+
return (_jsx(EntityValuePicker, __assign({}, props, field, { inputRef: ref })));
|
|
202
|
+
} }));
|
|
203
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
width: fit-content;
|
|
3
|
+
max-width: calc(100% - 20px);
|
|
4
|
+
display: flex;
|
|
5
|
+
padding: 10px;
|
|
6
|
+
padding-bottom: 0px;
|
|
7
|
+
padding-top: 5px;
|
|
8
|
+
margin-bottom: 0px;
|
|
9
|
+
}
|
|
10
|
+
.separator {
|
|
11
|
+
flex-basis: 100%;
|
|
12
|
+
height: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.firstLvlContainer {
|
|
16
|
+
max-width: 100%;
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-flow: row wrap;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.smallSeparator {
|
|
22
|
+
height: 0;
|
|
23
|
+
max-width: 100%;
|
|
24
|
+
flex-basis: 0;
|
|
25
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { SmartSelectStepProps } from '../SmartSelectStep';
|
|
3
|
+
export declare function SmartSelect({ icon, step, form, value, onBlur, errors, setFocus, children, editable, onChange, inputRef, postview, formStyle, getOptions, widthStats, organization, calcDepError, valueOverwrite, getValueString, originalValues, changeListener, dependencyStore, calcInvalidDeps, getValueWarning, getOptionSelected, setDependencyStore, ...others }: SmartSelectStepProps & {
|
|
4
|
+
onChange: Function;
|
|
5
|
+
onBlur: (event: any) => void;
|
|
6
|
+
value: any;
|
|
7
|
+
inputRef: any;
|
|
8
|
+
}): JSX.Element;
|
|
3
9
|
declare function SmartSelectStep(props: SmartSelectStepProps): JSX.Element;
|
|
4
10
|
export default SmartSelectStep;
|
package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js
CHANGED
|
@@ -63,7 +63,7 @@ import { calcStepWidth } from '../../StepFunctions';
|
|
|
63
63
|
import RoundedSmartSelect from '../../../../shared/RoundedSmartSelect/RoundedSmartSelect';
|
|
64
64
|
import { cloneElement, useEffect, useState } from 'react';
|
|
65
65
|
import React from 'react';
|
|
66
|
-
function SmartSelect(_a) {
|
|
66
|
+
export function SmartSelect(_a) {
|
|
67
67
|
var _this = this;
|
|
68
68
|
var _b, _c, _d, _e;
|
|
69
69
|
var icon = _a.icon, step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, setFocus = _a.setFocus, children = _a.children, editable = _a.editable, onChange = _a.onChange, inputRef = _a.inputRef, postview = _a.postview, formStyle = _a.formStyle, getOptions = _a.getOptions, widthStats = _a.widthStats, organization = _a.organization, calcDepError = _a.calcDepError, valueOverwrite = _a.valueOverwrite, getValueString = _a.getValueString, originalValues = _a.originalValues, changeListener = _a.changeListener, dependencyStore = _a.dependencyStore, _f = _a.calcInvalidDeps, calcInvalidDeps = _f === void 0 ? function (step, depStore) {
|
|
@@ -221,6 +221,7 @@ function SmartSelect(_a) {
|
|
|
221
221
|
function SmartSelectStep(props) {
|
|
222
222
|
var _a, _b;
|
|
223
223
|
useEffect(function () {
|
|
224
|
+
/** Al modificar tambien modificar en EntityValues */
|
|
224
225
|
if (!props.originalValues[props.step.id] && props.defaultValue) {
|
|
225
226
|
props.setDependencyStore(function (deps) {
|
|
226
227
|
var _a;
|
|
@@ -34,7 +34,7 @@ import CheckBoxStep from './CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxSt
|
|
|
34
34
|
import CBRStepMapper from './CBRStepMapper';
|
|
35
35
|
import RatingStep from './RatingStep/RatingStep';
|
|
36
36
|
import AYFStepMapper from './AYFStepMapper';
|
|
37
|
-
import EntityValuePickerStep from './EntityValueStep/
|
|
37
|
+
import EntityValuePickerStep from './EntityValueStep/EntityValuePickerStep';
|
|
38
38
|
import MapperStep from './MapperStep/MapperStep';
|
|
39
39
|
import CollapsibleStep from './CollapsibleStep/CollapsibleStep';
|
|
40
40
|
function StepComponent(_a) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FormSize } from '../../@Types/Form';
|
|
2
|
-
import { ClassifierSelector, FormSelector, FormStep } from '../../@Types/FormStep';
|
|
3
|
-
export declare function calcFillerSize(step: FormSelector | ClassifierSelector, steps: Record<string, FormStep>, values: Record<string, unknown>, size: FormSize): number;
|
|
2
|
+
import { ClassifierSelector, EntityValuePicker, FormSelector, FormStep } from '../../@Types/FormStep';
|
|
3
|
+
export declare function calcFillerSize(step: FormSelector | ClassifierSelector | EntityValuePicker, steps: Record<string, FormStep>, values: Record<string, unknown>, size: FormSize): number;
|
|
4
4
|
export declare function recursivelyCheckOpenSize(idStep: string, steps: Record<string, FormStep>, values: Record<string, any>): number;
|
|
5
5
|
export declare const calcStepWidth: (stepSize: 1 | 2 | 3 | 4, size: FormSize) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Types, { ClassifierOptionTypes, OptionTypes, } from '../../constants/FormStepTypes';
|
|
1
|
+
import Types, { ClassifierOptionTypes, EntityValueOptionTypes, OptionTypes, } from '../../constants/FormStepTypes';
|
|
2
2
|
export function calcFillerSize(step, steps, values, size) {
|
|
3
3
|
if (step.maxSize < size.blockNum) {
|
|
4
4
|
var stepSize = step.maxSize - recursivelyCheckOpenSize(step.id, steps, values);
|
|
@@ -26,7 +26,7 @@ export function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
26
26
|
}
|
|
27
27
|
return size;
|
|
28
28
|
}
|
|
29
|
-
if (step.type === Types.CLASSIFIER_SELECTOR) {
|
|
29
|
+
else if (step.type === Types.CLASSIFIER_SELECTOR) {
|
|
30
30
|
var size = step.size;
|
|
31
31
|
if (value) {
|
|
32
32
|
var currentOption = step.options[value];
|
|
@@ -41,6 +41,21 @@ export function recursivelyCheckOpenSize(idStep, steps, values) {
|
|
|
41
41
|
}
|
|
42
42
|
return size;
|
|
43
43
|
}
|
|
44
|
+
if (step.type === Types.ENTITYVALUEPICKER) {
|
|
45
|
+
var size = step.size;
|
|
46
|
+
if (value) {
|
|
47
|
+
var currentOption = step.options[value];
|
|
48
|
+
if ((currentOption === null || currentOption === void 0 ? void 0 : currentOption.type) === EntityValueOptionTypes.NESTED) {
|
|
49
|
+
var optionSize = 0;
|
|
50
|
+
for (var _d = 0, _e = currentOption.steps; _d < _e.length; _d++) {
|
|
51
|
+
var pStepId = _e[_d];
|
|
52
|
+
optionSize += recursivelyCheckOpenSize(pStepId, steps, values);
|
|
53
|
+
}
|
|
54
|
+
size += optionSize;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return size;
|
|
58
|
+
}
|
|
44
59
|
else {
|
|
45
60
|
return 4;
|
|
46
61
|
}
|
|
@@ -29,6 +29,10 @@ export declare enum ClassifierOptionTypes {
|
|
|
29
29
|
HIDE = "CLASSIFIER_HIDE",
|
|
30
30
|
NESTED = "CLASSIFIER_NESTED"
|
|
31
31
|
}
|
|
32
|
+
export declare enum EntityValueOptionTypes {
|
|
33
|
+
HIDE = "ENTITY_VALUE_HIDE",
|
|
34
|
+
NESTED = "ENTITY_VALUE_NESTED"
|
|
35
|
+
}
|
|
32
36
|
export declare enum RatingTypes {
|
|
33
37
|
SCALE = "SCALE",
|
|
34
38
|
SATISFACTION = "SATISFACTION",
|
|
@@ -34,6 +34,11 @@ export var ClassifierOptionTypes;
|
|
|
34
34
|
ClassifierOptionTypes["HIDE"] = "CLASSIFIER_HIDE";
|
|
35
35
|
ClassifierOptionTypes["NESTED"] = "CLASSIFIER_NESTED";
|
|
36
36
|
})(ClassifierOptionTypes || (ClassifierOptionTypes = {}));
|
|
37
|
+
export var EntityValueOptionTypes;
|
|
38
|
+
(function (EntityValueOptionTypes) {
|
|
39
|
+
EntityValueOptionTypes["HIDE"] = "ENTITY_VALUE_HIDE";
|
|
40
|
+
EntityValueOptionTypes["NESTED"] = "ENTITY_VALUE_NESTED";
|
|
41
|
+
})(EntityValueOptionTypes || (EntityValueOptionTypes = {}));
|
|
37
42
|
export var RatingTypes;
|
|
38
43
|
(function (RatingTypes) {
|
|
39
44
|
RatingTypes["SCALE"] = "SCALE";
|
|
@@ -27,6 +27,8 @@ interface StyleProps {
|
|
|
27
27
|
borderRadius?: number;
|
|
28
28
|
/** The padding to the left of the input */
|
|
29
29
|
paddingLeft?: number;
|
|
30
|
+
/** The padding to the right of the input */
|
|
31
|
+
paddingRight?: number;
|
|
30
32
|
/** If custom icon exists and should be displayed */
|
|
31
33
|
showIcon?: boolean;
|
|
32
34
|
}
|
|
@@ -57,6 +57,7 @@ var useStyles = makeStyles(function (theme) { return ({
|
|
|
57
57
|
},
|
|
58
58
|
}); });
|
|
59
59
|
var useOutlinedInputStyles = function (props) {
|
|
60
|
+
var _a;
|
|
60
61
|
return makeStyles({
|
|
61
62
|
root: {
|
|
62
63
|
cursor: props.cantEdit ? 'default' : 'default',
|
|
@@ -91,12 +92,15 @@ var useOutlinedInputStyles = function (props) {
|
|
|
91
92
|
},
|
|
92
93
|
'& .EF-MuiSelect-root': {
|
|
93
94
|
paddingLeft: props.paddingLeft,
|
|
95
|
+
paddingRight: props.paddingRight,
|
|
94
96
|
},
|
|
95
97
|
'&$focused $notchedOutline': {
|
|
96
98
|
borderColor: props.focusColor,
|
|
97
99
|
},
|
|
98
100
|
'& .EF-MuiSelect-icon': {
|
|
99
|
-
color: props.color
|
|
101
|
+
color: ((_a = props.color) === null || _a === void 0 ? void 0 : _a.startsWith('#'))
|
|
102
|
+
? props.color + '8a'
|
|
103
|
+
: props.color,
|
|
100
104
|
},
|
|
101
105
|
'& .EF-MuiSelect-icon.Mui-disabled': {
|
|
102
106
|
color: props.outlineColor,
|
|
@@ -114,30 +118,35 @@ var useOutlinedInputStyles = function (props) {
|
|
|
114
118
|
});
|
|
115
119
|
};
|
|
116
120
|
var useLabelInputStyles = function (props) {
|
|
117
|
-
return makeStyles(function () {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
121
|
+
return makeStyles(function () {
|
|
122
|
+
var _a;
|
|
123
|
+
return ({
|
|
124
|
+
focused: {
|
|
125
|
+
color: props.focusColor + ' !important',
|
|
126
|
+
},
|
|
127
|
+
root: {
|
|
128
|
+
color: ((_a = props.color) === null || _a === void 0 ? void 0 : _a.startsWith('#'))
|
|
129
|
+
? props.color + '8a'
|
|
130
|
+
: props.color,
|
|
131
|
+
fontWeight: props.fontWeight,
|
|
132
|
+
whiteSpace: 'nowrap',
|
|
133
|
+
overflow: 'hidden',
|
|
134
|
+
maxWidth: 'calc(100% - 45px)',
|
|
135
|
+
textOverflow: 'ellipsis',
|
|
136
|
+
marginTop: props.height != '40px' ? '-4px' : '0px',
|
|
137
|
+
'&.EF-MuiInputLabel-shrink': {
|
|
138
|
+
marginTop: '0px',
|
|
139
|
+
maxWidth: 'calc(100% - 5px)',
|
|
140
|
+
},
|
|
141
|
+
'& .Mui-error': {
|
|
142
|
+
color: props.errorColor,
|
|
143
|
+
},
|
|
144
|
+
'&.Mui-error': {
|
|
145
|
+
color: props.errorColor,
|
|
146
|
+
},
|
|
138
147
|
},
|
|
139
|
-
}
|
|
140
|
-
});
|
|
148
|
+
});
|
|
149
|
+
});
|
|
141
150
|
};
|
|
142
151
|
var useHelperTextStyles = function (props) {
|
|
143
152
|
return makeStyles(function () { return ({
|
|
@@ -150,7 +159,7 @@ var useHelperTextStyles = function (props) {
|
|
|
150
159
|
}); });
|
|
151
160
|
};
|
|
152
161
|
function CustomSelect(_a) {
|
|
153
|
-
var children = _a.children, _b = _a.value, value = _b === void 0 ? '' : _b, handleUpdate = _a.handleUpdate, label = _a.label, minWidth = _a.minWidth, helperText = _a.helperText, _c = _a.color, color = _c === void 0 ? '#293241' : _c, _d = _a.errorColor, errorColor = _d === void 0 ? '#cc2936' : _d, _e = _a.focusColor, focusColor = _e === void 0 ? '#3d5a7f' : _e, _f = _a.outlineColor, outlineColor = _f === void 0 ? '#0000003b' : _f, _g = _a.helperTextColor, helperTextColor = _g === void 0 ? '#989898' : _g, _h = _a.backgroundColor, backgroundColor = _h === void 0 ? '#ffffff' : _h, _j = _a.readOnly, readOnly = _j === void 0 ? false : _j, _k = _a.borderRadius, borderRadius = _k === void 0 ? 10 : _k, _l = _a.paddingLeft, paddingLeft = _l === void 0 ? 14 : _l, _m = _a.
|
|
162
|
+
var children = _a.children, _b = _a.value, value = _b === void 0 ? '' : _b, handleUpdate = _a.handleUpdate, label = _a.label, minWidth = _a.minWidth, helperText = _a.helperText, _c = _a.color, color = _c === void 0 ? '#293241' : _c, _d = _a.errorColor, errorColor = _d === void 0 ? '#cc2936' : _d, _e = _a.focusColor, focusColor = _e === void 0 ? '#3d5a7f' : _e, _f = _a.outlineColor, outlineColor = _f === void 0 ? '#0000003b' : _f, _g = _a.helperTextColor, helperTextColor = _g === void 0 ? '#989898' : _g, _h = _a.backgroundColor, backgroundColor = _h === void 0 ? '#ffffff' : _h, _j = _a.readOnly, readOnly = _j === void 0 ? false : _j, _k = _a.borderRadius, borderRadius = _k === void 0 ? 10 : _k, _l = _a.paddingLeft, paddingLeft = _l === void 0 ? 14 : _l, _m = _a.paddingRight, paddingRight = _m === void 0 ? 32 : _m, _o = _a.cantEdit, cantEdit = _o === void 0 ? false : _o, _p = _a.showIcon, showIcon = _p === void 0 ? true : _p, _q = _a.containerMargin, containerMargin = _q === void 0 ? '8px' : _q, _r = _a.height, height = _r === void 0 ? '40px' : _r, _s = _a.fontSize, fontSize = _s === void 0 ? '1rem' : _s, required = _a.required, iconComponent = _a.iconComponent, error = _a.error, others = __rest(_a, ["children", "value", "handleUpdate", "label", "minWidth", "helperText", "color", "errorColor", "focusColor", "outlineColor", "helperTextColor", "backgroundColor", "readOnly", "borderRadius", "paddingLeft", "paddingRight", "cantEdit", "showIcon", "containerMargin", "height", "fontSize", "required", "iconComponent", "error"]);
|
|
154
163
|
var styleProps = {
|
|
155
164
|
color: color,
|
|
156
165
|
height: height,
|
|
@@ -160,6 +169,7 @@ function CustomSelect(_a) {
|
|
|
160
169
|
errorColor: errorColor,
|
|
161
170
|
focusColor: focusColor,
|
|
162
171
|
paddingLeft: paddingLeft,
|
|
172
|
+
paddingRight: paddingRight,
|
|
163
173
|
outlineColor: outlineColor,
|
|
164
174
|
borderRadius: borderRadius,
|
|
165
175
|
helperTextColor: helperTextColor,
|
|
@@ -170,7 +180,7 @@ function CustomSelect(_a) {
|
|
|
170
180
|
var outlinedInputClasses = useOutlinedInputStyles(styleProps)();
|
|
171
181
|
var labelClasses = useLabelInputStyles(styleProps)();
|
|
172
182
|
var helperTextClasses = useHelperTextStyles(styleProps)();
|
|
173
|
-
var
|
|
183
|
+
var _t = useState(false), open = _t[0], setOpen = _t[1];
|
|
174
184
|
return (_jsxs(FormControl, __assign({ variant: "outlined", className: classes.formControl, size: "small", style: minWidth !== undefined
|
|
175
185
|
? { minWidth: minWidth, outlineColor: outlineColor, margin: containerMargin }
|
|
176
186
|
: {
|
|
@@ -30,104 +30,113 @@ import RoundedSelect from '../RoundedSelect/RoundedSelect';
|
|
|
30
30
|
import CircularProgress from '@material-ui/core/CircularProgress';
|
|
31
31
|
var filter = createFilterOptions();
|
|
32
32
|
var useTextfieldStyles = function (props) {
|
|
33
|
-
return makeStyles(function () {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
return makeStyles(function () {
|
|
34
|
+
var _a, _b, _c;
|
|
35
|
+
return ({
|
|
36
|
+
root: {
|
|
37
|
+
borderRadius: props.borderRadius,
|
|
38
|
+
'& input, textarea': {
|
|
39
|
+
cursor: props.cantEdit ? 'default' : 'text',
|
|
40
|
+
fontWeight: props.fontWeight,
|
|
41
|
+
color: props.color,
|
|
42
42
|
fontSize: props.fontSize,
|
|
43
|
+
'&::placeholder': {
|
|
44
|
+
fontSize: props.fontSize,
|
|
45
|
+
},
|
|
46
|
+
backgroundColor: props.backgroundColor,
|
|
47
|
+
borderRadius: props.borderRadius,
|
|
48
|
+
height: props.height,
|
|
49
|
+
marginTop: '0px !important',
|
|
50
|
+
padding: '0px 38px 0px 12px !important',
|
|
43
51
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
marginTop: '0px !important',
|
|
48
|
-
padding: '0px 38px 0px 12px !important',
|
|
49
|
-
},
|
|
50
|
-
'& .EF-MuiInputBase-root': {
|
|
51
|
-
padding: '0px !important',
|
|
52
|
-
pointerEvents: 'all',
|
|
53
|
-
},
|
|
54
|
-
'& label': {
|
|
55
|
-
marginTop: '-4px',
|
|
56
|
-
fontSize: props.fontSize,
|
|
57
|
-
color: props.color + '8a',
|
|
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,
|
|
52
|
+
'& .EF-MuiInputBase-root': {
|
|
53
|
+
padding: '0px !important',
|
|
54
|
+
pointerEvents: 'all',
|
|
78
55
|
},
|
|
79
|
-
'&
|
|
80
|
-
|
|
56
|
+
'& label': {
|
|
57
|
+
marginTop: '-4px',
|
|
58
|
+
fontSize: props.fontSize,
|
|
59
|
+
color: ((_a = props.color) === null || _a === void 0 ? void 0 : _a.startsWith('#'))
|
|
60
|
+
? props.color + '8a'
|
|
61
|
+
: props.color,
|
|
62
|
+
whiteSpace: 'nowrap',
|
|
63
|
+
overflow: 'hidden',
|
|
64
|
+
textOverflow: 'ellipsis',
|
|
65
|
+
maxWidth: 'calc(100% - 22px)',
|
|
66
|
+
},
|
|
67
|
+
'& label.EF-MuiInputLabel-shrink': {
|
|
68
|
+
marginTop: '0px',
|
|
69
|
+
maxWidth: 'calc(100% - 5px)',
|
|
70
|
+
},
|
|
71
|
+
'& input + fieldset': {
|
|
72
|
+
borderRadius: props.borderRadius,
|
|
81
73
|
},
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
'& .EF-MuiInput-underline:after': {
|
|
75
|
+
borderBottomColor: props.outlineColor,
|
|
76
|
+
},
|
|
77
|
+
'& .EF-MuiOutlinedInput-root': {
|
|
78
|
+
borderRadius: props.borderRadius,
|
|
79
|
+
'&.Mui-focused fieldset': {
|
|
80
|
+
borderColor: props.focusColor,
|
|
81
|
+
borderWidth: props.readOnly ? 1 : 2,
|
|
82
|
+
},
|
|
83
|
+
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
84
|
+
borderColor: props.outlineColor,
|
|
85
|
+
},
|
|
84
86
|
height: props.height,
|
|
85
|
-
|
|
87
|
+
'& .EF-MuiAutocomplete-input': {
|
|
88
|
+
height: props.height,
|
|
89
|
+
marginTop: -10,
|
|
90
|
+
},
|
|
91
|
+
'& .EF-MuiAutocomplete-input::placeholder': {
|
|
92
|
+
color: '#787878',
|
|
93
|
+
opacity: 1,
|
|
94
|
+
},
|
|
86
95
|
},
|
|
87
|
-
'& .EF-
|
|
88
|
-
|
|
89
|
-
|
|
96
|
+
'& .EF-MuiOutlinedInput-root:hover .EF-MuiOutlinedInput-notchedOutline': {
|
|
97
|
+
borderColor: props.cantEdit
|
|
98
|
+
? props.outlineColor
|
|
99
|
+
: props.focusColor,
|
|
100
|
+
},
|
|
101
|
+
'& label.Mui-focused': {
|
|
102
|
+
color: props.focusColor,
|
|
103
|
+
},
|
|
104
|
+
'& .Mui-error': {
|
|
105
|
+
color: props.errorColor + ' !important',
|
|
106
|
+
},
|
|
107
|
+
'& .EF-MuiFormHelperText-root': {
|
|
108
|
+
color: props.helperTextColor,
|
|
109
|
+
},
|
|
110
|
+
'& .EF-MuiFormHelperText-root.Mui-error': {
|
|
111
|
+
color: props.errorColor + ' !important',
|
|
112
|
+
},
|
|
113
|
+
'& .EF-MuiFormLabel-root.Mui-disabled': {
|
|
114
|
+
color: '#0000008a',
|
|
115
|
+
},
|
|
116
|
+
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
117
|
+
borderColor: '#0000003b',
|
|
118
|
+
},
|
|
119
|
+
'& .EF-MuiAutocomplete-popupIndicator': {
|
|
120
|
+
padding: 0,
|
|
121
|
+
color: ((_b = props.color) === null || _b === void 0 ? void 0 : _b.startsWith('#'))
|
|
122
|
+
? props.color + '8a'
|
|
123
|
+
: props.color,
|
|
124
|
+
},
|
|
125
|
+
'& .EF-MuiAutocomplete-popupIndicatorOpen': {
|
|
126
|
+
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
127
|
+
},
|
|
128
|
+
'& .EF-MuiAutocomplete-clearIndicator': {
|
|
129
|
+
display: 'none',
|
|
130
|
+
},
|
|
131
|
+
'& .EF-MuiAutocomplete-endAdornment': {
|
|
132
|
+
top: 'calc(50% - 13px)',
|
|
133
|
+
color: ((_c = props.color) === null || _c === void 0 ? void 0 : _c.startsWith('#'))
|
|
134
|
+
? props.color + '8a'
|
|
135
|
+
: props.color,
|
|
90
136
|
},
|
|
91
137
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
? props.outlineColor
|
|
95
|
-
: props.focusColor,
|
|
96
|
-
},
|
|
97
|
-
'& label.Mui-focused': {
|
|
98
|
-
color: props.focusColor,
|
|
99
|
-
},
|
|
100
|
-
'& .Mui-error': {
|
|
101
|
-
color: props.errorColor + ' !important',
|
|
102
|
-
},
|
|
103
|
-
'& .EF-MuiFormHelperText-root': {
|
|
104
|
-
color: props.helperTextColor,
|
|
105
|
-
},
|
|
106
|
-
'& .EF-MuiFormHelperText-root.Mui-error': {
|
|
107
|
-
color: props.errorColor + ' !important',
|
|
108
|
-
},
|
|
109
|
-
'& .EF-MuiFormLabel-root.Mui-disabled': {
|
|
110
|
-
color: '#0000008a',
|
|
111
|
-
},
|
|
112
|
-
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
113
|
-
borderColor: '#0000003b',
|
|
114
|
-
},
|
|
115
|
-
'& .EF-MuiAutocomplete-popupIndicator': {
|
|
116
|
-
padding: 0,
|
|
117
|
-
color: props.color + '8a',
|
|
118
|
-
},
|
|
119
|
-
'& .EF-MuiAutocomplete-popupIndicatorOpen': {
|
|
120
|
-
transform: props.showIcon ? 'none' : 'rotate(180deg)',
|
|
121
|
-
},
|
|
122
|
-
'& .EF-MuiAutocomplete-clearIndicator': {
|
|
123
|
-
display: 'none',
|
|
124
|
-
},
|
|
125
|
-
'& .EF-MuiAutocomplete-endAdornment': {
|
|
126
|
-
top: 'calc(50% - 13px)',
|
|
127
|
-
color: props.color + '8a',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
}); });
|
|
138
|
+
});
|
|
139
|
+
});
|
|
131
140
|
};
|
|
132
141
|
export default function RoundedSmartSelect(_a) {
|
|
133
142
|
var options = _a.options, _b = _a.value, value = _b === void 0 ? '' : _b, handleUpdate = _a.handleUpdate, label = _a.label, _c = _a.getValueString, getValueString = _c === void 0 ? function (value) { return value.value; } : _c, _d = _a.color, color = _d === void 0 ? '#293241' : _d, _e = _a.errorColor, errorColor = _e === void 0 ? '#cc2936' : _e, _f = _a.focusColor, focusColor = _f === void 0 ? '#3d5a7f' : _f, _g = _a.helperTextColor, helperTextColor = _g === void 0 ? '#989898' : _g, _h = _a.outlineColor, outlineColor = _h === void 0 ? '#b8b8b8' : _h, _j = _a.backgroundColor, backgroundColor = _j === void 0 ? '#ffffff' : _j, _k = _a.cantEdit, cantEdit = _k === void 0 ? false : _k, _l = _a.loading, loading = _l === void 0 ? false : _l, _m = _a.height, height = _m === void 0 ? '31px' : _m, _o = _a.fontSize, fontSize = _o === void 0 ? '1rem' : _o, required = _a.required, changeListener = _a.changeListener, error = _a.error, getOptionSelected = _a.getOptionSelected, helperText = _a.helperText, _p = _a.readOnly, readOnly = _p === void 0 ? false : _p, _q = _a.borderRadius, borderRadius = _q === void 0 ? 10 : _q, _r = _a.fontWeight, fontWeight = _r === void 0 ? '400' : _r, icon = _a.icon, _s = _a.searchable, searchable = _s === void 0 ? false : _s, _t = _a.containerMargin, containerMargin = _t === void 0 ? '0px' : _t, _u = _a.showIcon, showIcon = _u === void 0 ? true : _u, inputRef = _a.inputRef, disabled = _a.disabled, _v = _a.creatable, creatable = _v === void 0 ? false : _v, onBlur = _a.onBlur, name = _a.name, onFocus = _a.onFocus;
|
package/package.json
CHANGED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
49
|
-
var t = {};
|
|
50
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
51
|
-
t[p] = s[p];
|
|
52
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
53
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
54
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
55
|
-
t[p[i]] = s[p[i]];
|
|
56
|
-
}
|
|
57
|
-
return t;
|
|
58
|
-
};
|
|
59
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
60
|
-
import FormStepTypes, { FormStyleTypes, } from '../../../constants/FormStepTypes';
|
|
61
|
-
import InputIcon from '../../../shared/InputIcon/InputIcon';
|
|
62
|
-
import SmartSelectStep from '../SmartSelectStep/SmartSelectStep';
|
|
63
|
-
import widgetInstance from '../../../AxiosWidget';
|
|
64
|
-
import axiosInstance from '../../../AxiosAPI';
|
|
65
|
-
function EntityValuePickerStep(_a) {
|
|
66
|
-
var _this = this;
|
|
67
|
-
var step = _a.step, props = __rest(_a, ["step"]);
|
|
68
|
-
var getEntityValueOptions = function (_a, _step, dependencyStore, domain) {
|
|
69
|
-
var idOrganization = _a.idOrganization;
|
|
70
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
71
|
-
var params, _i, _b, filter, value, currentValue, url, response;
|
|
72
|
-
var _c;
|
|
73
|
-
return __generator(this, function (_d) {
|
|
74
|
-
switch (_d.label) {
|
|
75
|
-
case 0:
|
|
76
|
-
params = new URLSearchParams({
|
|
77
|
-
idOrganization: idOrganization,
|
|
78
|
-
});
|
|
79
|
-
if (domain) {
|
|
80
|
-
params.set('idOrganization', domain);
|
|
81
|
-
}
|
|
82
|
-
for (_i = 0, _b = step.filters; _i < _b.length; _i++) {
|
|
83
|
-
filter = _b[_i];
|
|
84
|
-
value = filter.value;
|
|
85
|
-
if (filter.idStep) {
|
|
86
|
-
currentValue = dependencyStore[filter.idStep];
|
|
87
|
-
if (currentValue) {
|
|
88
|
-
if (typeof currentValue === 'string')
|
|
89
|
-
value = currentValue;
|
|
90
|
-
else
|
|
91
|
-
value = (_c = currentValue._id) !== null && _c !== void 0 ? _c : currentValue.id;
|
|
92
|
-
//TODO: Manejo de multiple!
|
|
93
|
-
}
|
|
94
|
-
else if (filter.required) {
|
|
95
|
-
return [2 /*return*/, null];
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (value)
|
|
99
|
-
params.set(filter.idProperty, value);
|
|
100
|
-
}
|
|
101
|
-
url = "/entities/".concat(step.idEntity, "/values?").concat(params.toString());
|
|
102
|
-
return [4 /*yield*/, (domain
|
|
103
|
-
? widgetInstance.get(url)
|
|
104
|
-
: axiosInstance.get(url))];
|
|
105
|
-
case 1:
|
|
106
|
-
response = _d.sent();
|
|
107
|
-
return [2 /*return*/, response.data];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
switch (props.formStyle.type) {
|
|
113
|
-
case FormStyleTypes.MATERIAL:
|
|
114
|
-
default: {
|
|
115
|
-
return (_jsx(SmartSelectStep, __assign({}, props, { step: step, icon: step.icon ? _jsx(InputIcon, { icon: step.icon }) : undefined, getOptions: getEntityValueOptions, getOptionSelected: function (option, value) {
|
|
116
|
-
return option._id === value._id;
|
|
117
|
-
}, calcDepError: function (steps) {
|
|
118
|
-
for (var _i = 0, steps_1 = steps; _i < steps_1.length; _i++) {
|
|
119
|
-
var step_1 = steps_1[_i];
|
|
120
|
-
if (step_1.type === FormStepTypes.ENTITYVALUEPICKER) {
|
|
121
|
-
return 'Selecciona un ' + step_1.label;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return undefined;
|
|
125
|
-
}, getValueString: function (value) { return value === null || value === void 0 ? void 0 : value._id; } })));
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
export default EntityValuePickerStep;
|