@arquimedes.co/eureka-forms 1.9.88-test → 1.9.89-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.js +26 -3
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.js +21 -10
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.module.css +35 -23
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.js +3 -2
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +1 -1
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.js +19 -11
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.module.css +6 -0
- package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +1 -1
- package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +3 -2
- package/package.json +1 -1
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.module.css +0 -10
package/dist/App.js
CHANGED
|
@@ -91,9 +91,7 @@ function App(_a) {
|
|
|
91
91
|
else {
|
|
92
92
|
setForm(form);
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
setOriginalValues(mapOriginalValues(valuesData, form));
|
|
96
|
-
}
|
|
94
|
+
setOriginalValues(mapOriginalValues(valuesData !== null && valuesData !== void 0 ? valuesData : {}, form));
|
|
97
95
|
};
|
|
98
96
|
function fetchPreview(formData, valuesData) {
|
|
99
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -425,8 +423,33 @@ var mapOriginalValues = function (originalValues, form) {
|
|
|
425
423
|
newValues[idValue] = originalValues[idValue];
|
|
426
424
|
}
|
|
427
425
|
}
|
|
426
|
+
addInitialMappers(newValues, form.steps);
|
|
427
|
+
console.log(newValues);
|
|
428
428
|
return newValues;
|
|
429
429
|
};
|
|
430
|
+
var addInitialMappers = function (newValues, steps) {
|
|
431
|
+
for (var _i = 0, _a = Object.values(steps); _i < _a.length; _i++) {
|
|
432
|
+
var step = _a[_i];
|
|
433
|
+
if (step.type !== StepTypes.MAPPER)
|
|
434
|
+
continue;
|
|
435
|
+
var idElement = nanoid();
|
|
436
|
+
var newElement = {
|
|
437
|
+
ids: {},
|
|
438
|
+
id: idElement,
|
|
439
|
+
};
|
|
440
|
+
var newSteps = {};
|
|
441
|
+
for (var _b = 0, _c = Object.keys(step.steps); _b < _c.length; _b++) {
|
|
442
|
+
var idStep = _c[_b];
|
|
443
|
+
var baseStep = JSON.parse(JSON.stringify(step.steps[idStep]));
|
|
444
|
+
var newIdStep = step.id + '-' + idStep + '-' + idElement;
|
|
445
|
+
baseStep.id = newIdStep;
|
|
446
|
+
newElement.ids[idStep] = newIdStep;
|
|
447
|
+
newSteps[newIdStep] = baseStep;
|
|
448
|
+
}
|
|
449
|
+
addInitialMappers(newValues, step.steps);
|
|
450
|
+
newValues[step.id] = [newElement];
|
|
451
|
+
}
|
|
452
|
+
};
|
|
430
453
|
export var mapOriginalValue = function (step, value, form) {
|
|
431
454
|
var _a, _b, _c, _d;
|
|
432
455
|
switch (step === null || step === void 0 ? void 0 : step.type) {
|
|
@@ -20,15 +20,26 @@ function ListMapperElement(_a) {
|
|
|
20
20
|
var name = calcName
|
|
21
21
|
? calcName(element)
|
|
22
22
|
: step.unitLabel + ' ' + (num + 1);
|
|
23
|
-
return (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
23
|
+
return (_jsxs("div", __assign({ className: widthStats.isMobile ? styles.mobileContainer : styles.container }, { children: [_jsx("div", __assign({ className: styles.bulletContainer, style: {
|
|
24
|
+
height: name ? 28 : 40,
|
|
25
|
+
} }, { children: _jsx("div", { className: styles.bullet, style: {
|
|
26
|
+
backgroundColor: formStyle.outlineColor,
|
|
27
|
+
borderColor: formStyle.descriptionTextColor,
|
|
28
|
+
} }) })), _jsxs("div", __assign({ className: styles.contentContainer, style: {
|
|
29
|
+
width: (size.blockSize + size.spacingSize) *
|
|
30
|
+
((_c = (_b = step.style) === null || _b === void 0 ? void 0 : _b.size) !== null && _c !== void 0 ? _c : size.blockNum - 1),
|
|
31
|
+
} }, { children: [name && (_jsxs("div", __assign({ className: styles.title, style: { color: formStyle.textColor } }, { children: [_jsx("label", __assign({ className: styles.titleLbl }, { children: loading ? '' : name + ':' })), step.deletable !== false && (_jsx("div", __assign({ className: !editable || postview
|
|
32
|
+
? styles.disabledDeleteBtn
|
|
33
|
+
: styles.deleteBtn, style: { color: formStyle.textColor }, onClick: function () {
|
|
34
|
+
if (editable && !postview) {
|
|
35
|
+
handleDelete === null || handleDelete === void 0 ? void 0 : handleDelete();
|
|
36
|
+
}
|
|
37
|
+
} }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) })))] }))), children] })), !name && step.deletable !== false && (_jsx("div", __assign({ className: !editable || postview
|
|
38
|
+
? styles.disabledDeleteBtn
|
|
39
|
+
: styles.deleteBtn, style: { color: formStyle.textColor, marginTop: 7 }, onClick: function () {
|
|
40
|
+
if (editable && !postview) {
|
|
41
|
+
handleDelete === null || handleDelete === void 0 ? void 0 : handleDelete();
|
|
42
|
+
}
|
|
43
|
+
} }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) })))] })));
|
|
33
44
|
}
|
|
34
45
|
export default ListMapperElement;
|
|
@@ -1,41 +1,53 @@
|
|
|
1
1
|
.container,
|
|
2
2
|
.mobileContainer {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: row;
|
|
5
5
|
width: fit-content;
|
|
6
|
-
border-radius: 20px;
|
|
7
|
-
margin-bottom: 10px;
|
|
8
|
-
margin-top: 10px;
|
|
9
|
-
margin-left: auto;
|
|
10
6
|
margin-right: auto;
|
|
11
|
-
padding-top: 20px;
|
|
12
|
-
padding-bottom: 20px;
|
|
13
7
|
position: relative;
|
|
8
|
+
padding-top: 10px;
|
|
9
|
+
padding-bottom: 5px;
|
|
10
|
+
max-width: 100%;
|
|
14
11
|
}
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
.bulletContainer {
|
|
13
|
+
display: flex;
|
|
14
|
+
margin-left: 30px;
|
|
15
|
+
margin-right: 10px;
|
|
16
|
+
align-items: center;
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
.bullet {
|
|
19
|
+
border-width: 2px;
|
|
20
|
+
border-style: solid;
|
|
21
|
+
margin-bottom: 2px;
|
|
22
|
+
height: 20px;
|
|
23
|
+
width: 20px;
|
|
24
|
+
border-radius: 20px;
|
|
25
|
+
margin-left: 10px;
|
|
26
|
+
/* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); */
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
.titleLbl {
|
|
28
30
|
width: 100%;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
height: 28px;
|
|
32
|
+
margin-right: 10px;
|
|
31
33
|
white-space: nowrap;
|
|
32
34
|
overflow: hidden;
|
|
33
35
|
text-overflow: ellipsis;
|
|
34
36
|
cursor: default;
|
|
35
|
-
margin-left: 10px;
|
|
36
37
|
margin-bottom: 10px;
|
|
37
38
|
}
|
|
38
39
|
|
|
40
|
+
.title {
|
|
41
|
+
height: 28px;
|
|
42
|
+
margin-bottom: 5px;
|
|
43
|
+
margin-left: 10px;
|
|
44
|
+
font-size: 20px;
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
width: 100%;
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
}
|
|
50
|
+
|
|
39
51
|
.contentContainer {
|
|
40
52
|
margin-left: auto;
|
|
41
53
|
margin-right: auto;
|
|
@@ -49,10 +61,10 @@
|
|
|
49
61
|
|
|
50
62
|
.deleteBtn,
|
|
51
63
|
.disabledDeleteBtn {
|
|
64
|
+
display: flex;
|
|
52
65
|
font-size: 24px;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
top: 15px;
|
|
66
|
+
margin-right: 8px;
|
|
67
|
+
margin-left: auto;
|
|
56
68
|
}
|
|
57
69
|
|
|
58
70
|
.deleteBtn {
|
|
@@ -13,9 +13,9 @@ import { createElement as _createElement } from "react";
|
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import StepComponent from '../../../Step';
|
|
15
15
|
import { MapperStyleTypes } from '../../../../../constants/FormStepTypes';
|
|
16
|
-
import styles from './MapperElement.module.css';
|
|
17
16
|
import ListMapperElement from './ListMapperElement/ListMapperElement';
|
|
18
17
|
import PillMapperElement from './PillMapperElement/PillMapperElement';
|
|
18
|
+
import React from 'react';
|
|
19
19
|
function MapperElementComponent(props) {
|
|
20
20
|
var _a, _b, _c;
|
|
21
21
|
var level = props.level, form = props.form, step = props.step, element = props.element, editable = props.editable;
|
|
@@ -32,7 +32,8 @@ function MapperElementComponent(props) {
|
|
|
32
32
|
};
|
|
33
33
|
switch ((_c = step.style) === null || _c === void 0 ? void 0 : _c.type) {
|
|
34
34
|
case MapperStyleTypes.INLINE:
|
|
35
|
-
return
|
|
35
|
+
return _jsx(React.Fragment, { children: mapSubSteps() });
|
|
36
|
+
case undefined:
|
|
36
37
|
case MapperStyleTypes.LIST:
|
|
37
38
|
return (_jsx(ListMapperElement, __assign({}, props, { step: step }, { children: mapSubSteps() })));
|
|
38
39
|
case MapperStyleTypes.PILL:
|
|
@@ -6,7 +6,7 @@ export interface MapperElement<Type> {
|
|
|
6
6
|
deleted?: boolean;
|
|
7
7
|
value?: Type;
|
|
8
8
|
}
|
|
9
|
-
export declare function ElementsComponent<Type = any>({ step, form, inputRef, editable, postview, elements, formStyle, customAdd, loading, dependencyStore, setDependencyStore, ...others }: MapperStepProps<Type> & {
|
|
9
|
+
export declare function ElementsComponent<Type = any>({ step, form, errors, inputRef, editable, postview, elements, formStyle, customAdd, loading, dependencyStore, setDependencyStore, ...others }: MapperStepProps<Type> & {
|
|
10
10
|
loading?: boolean;
|
|
11
11
|
onChange: (elements: MapperElement<Type>[]) => void;
|
|
12
12
|
elements: MapperElement<Type>[];
|
|
@@ -30,7 +30,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
30
30
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
31
|
};
|
|
32
32
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
33
|
-
import { useState, useEffect, cloneElement } from 'react';
|
|
33
|
+
import React, { useState, useEffect, cloneElement } from 'react';
|
|
34
34
|
import styles from './MaterialMapperStep.module.css';
|
|
35
35
|
import { Controller } from 'react-hook-form';
|
|
36
36
|
import StepTypes, { ClassifierOptionTypes, EntityValueOptionTypes, MapperStyleTypes, OptionTypes, } from '../../../../constants/FormStepTypes';
|
|
@@ -42,7 +42,7 @@ import AYFFormStepTypes from '../../../../constants/AYFFormStepTypes';
|
|
|
42
42
|
import CBRFormStepTypes from '../../../../constants/CBRFormStepTypes';
|
|
43
43
|
export function ElementsComponent(_a) {
|
|
44
44
|
var _b, _c;
|
|
45
|
-
var step = _a.step, form = _a.form, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, elements = _a.elements, formStyle = _a.formStyle, customAdd = _a.customAdd, _d = _a.loading, loading = _d === void 0 ? false : _d, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["step", "form", "inputRef", "editable", "postview", "elements", "formStyle", "customAdd", "loading", "dependencyStore", "setDependencyStore"]);
|
|
45
|
+
var step = _a.step, form = _a.form, errors = _a.errors, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, elements = _a.elements, formStyle = _a.formStyle, customAdd = _a.customAdd, _d = _a.loading, loading = _d === void 0 ? false : _d, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["step", "form", "errors", "inputRef", "editable", "postview", "elements", "formStyle", "customAdd", "loading", "dependencyStore", "setDependencyStore"]);
|
|
46
46
|
var _e = useState(true), firstRender = _e[0], setFirstRender = _e[1];
|
|
47
47
|
/** Mapper Steps to pass down */
|
|
48
48
|
var _f = useState(), localSteps = _f[0], setLocalSteps = _f[1];
|
|
@@ -123,15 +123,20 @@ export function ElementsComponent(_a) {
|
|
|
123
123
|
var container = calcStyles().container;
|
|
124
124
|
if (!localSteps)
|
|
125
125
|
return _jsx("div", {});
|
|
126
|
+
var mapElements = function () {
|
|
127
|
+
return elements.map(function (element, index) { return (_jsx(MapperElementComponent, __assign({ num: index, loading: loading, element: element, formStyle: formStyle, step: step, errors: errors, form: __assign(__assign({}, form), { steps: __assign(__assign({}, form.steps), localSteps) }), editable: editable, postview: postview, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore, handleDelete: function () {
|
|
128
|
+
var tempElements = __spreadArray([], elements, true);
|
|
129
|
+
tempElements[index].deleted = true;
|
|
130
|
+
onChange(tempElements);
|
|
131
|
+
} }, others), element.id)); });
|
|
132
|
+
};
|
|
133
|
+
if (step.style.type === MapperStyleTypes.INLINE)
|
|
134
|
+
return _jsx(React.Fragment, { children: mapElements() });
|
|
126
135
|
return (_jsxs("div", __assign({ className: container, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.titleLbl }, { children: step.label })), step.description && (_jsx("p", __assign({ className: styles.descriptionPar, style: {
|
|
127
136
|
margin: step.description
|
|
128
137
|
? '10px 0px'
|
|
129
138
|
: '0px 0px 5px 0px',
|
|
130
|
-
} }, { children: step.description }))),
|
|
131
|
-
var tempElements = __spreadArray([], elements, true);
|
|
132
|
-
tempElements[index].deleted = true;
|
|
133
|
-
onChange(tempElements);
|
|
134
|
-
} }, others), element.id)); }), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }), step.creatable !== false && !customAdd && (_jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel, color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
|
139
|
+
} }, { children: step.description }))), mapElements(), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: inputRef, className: styles.hiddenInput }), step.creatable !== false && !customAdd && (_jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel + (step.required ? ' *' : ''), color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
|
135
140
|
if (editable && !postview) {
|
|
136
141
|
handleAddElement();
|
|
137
142
|
}
|
|
@@ -141,13 +146,16 @@ export function ElementsComponent(_a) {
|
|
|
141
146
|
inputRef: inputRef,
|
|
142
147
|
disabled: !editable || postview,
|
|
143
148
|
handleAddElement: handleAddElement,
|
|
144
|
-
})] }))]
|
|
149
|
+
})] })), !!errors[step.id] &&
|
|
150
|
+
elements.filter(function (elem) { return !elem.deleted; }).length === 0 && (_jsx("div", __assign({ className: styles.errorMsg, style: { color: formStyle.errorColor } }, { children: "Este campo es obligatorio" })))] })));
|
|
145
151
|
}
|
|
146
152
|
function MapperStep(props) {
|
|
147
153
|
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: [], rules: {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
154
|
+
validate: function (array) {
|
|
155
|
+
return (props.step.required &&
|
|
156
|
+
array.filter(function (elem) { return !elem.deleted; }).length > 0) ||
|
|
157
|
+
!props.step.required;
|
|
158
|
+
},
|
|
151
159
|
}, shouldUnregister: true, render: function (_a) {
|
|
152
160
|
var _b = _a.field, ref = _b.ref, value = _b.value, field = __rest(_b, ["ref", "value"]);
|
|
153
161
|
return (_jsx(ElementsComponent, __assign({}, props, field, { elements: value, inputRef: ref })));
|
|
@@ -48,6 +48,7 @@ var useDatePickerStyles = function (props) {
|
|
|
48
48
|
borderRadius: props.borderRadius,
|
|
49
49
|
cursor: props.cantEdit ? 'default' : 'pointer',
|
|
50
50
|
height: props.height,
|
|
51
|
+
backgroundColor: props.backgroundColor,
|
|
51
52
|
'& input, textarea': {
|
|
52
53
|
cursor: props.cantEdit ? 'default' : 'pointer',
|
|
53
54
|
padding: props.padding,
|
|
@@ -57,7 +58,6 @@ var useDatePickerStyles = function (props) {
|
|
|
57
58
|
'&::placeholder': {
|
|
58
59
|
fontSize: props.fontSize,
|
|
59
60
|
},
|
|
60
|
-
backgroundColor: props.backgroundColor,
|
|
61
61
|
borderRadius: props.borderRadius,
|
|
62
62
|
},
|
|
63
63
|
'& .EF-MuiOutlinedInput-notchedOutline': {
|
|
@@ -139,7 +139,8 @@ var useTextfieldStyles = function (props) {
|
|
|
139
139
|
});
|
|
140
140
|
};
|
|
141
141
|
export default function RoundedSmartSelect(_a) {
|
|
142
|
-
var
|
|
142
|
+
var _b;
|
|
143
|
+
var options = _a.options, _c = _a.value, value = _c === void 0 ? '' : _c, handleUpdate = _a.handleUpdate, label = _a.label, _d = _a.getValueString, getValueString = _d === void 0 ? function (value) { return value.value; } : _d, _e = _a.color, color = _e === void 0 ? '#293241' : _e, _f = _a.errorColor, errorColor = _f === void 0 ? '#cc2936' : _f, _g = _a.focusColor, focusColor = _g === void 0 ? '#3d5a7f' : _g, _h = _a.helperTextColor, helperTextColor = _h === void 0 ? '#989898' : _h, _j = _a.outlineColor, outlineColor = _j === void 0 ? '#b8b8b8' : _j, _k = _a.backgroundColor, backgroundColor = _k === void 0 ? '#ffffff' : _k, _l = _a.cantEdit, cantEdit = _l === void 0 ? false : _l, _m = _a.loading, loading = _m === void 0 ? false : _m, _o = _a.height, height = _o === void 0 ? '31px' : _o, _p = _a.fontSize, fontSize = _p === void 0 ? '1rem' : _p, required = _a.required, changeListener = _a.changeListener, error = _a.error, getOptionSelected = _a.getOptionSelected, helperText = _a.helperText, _q = _a.readOnly, readOnly = _q === void 0 ? false : _q, _r = _a.borderRadius, borderRadius = _r === void 0 ? 10 : _r, _s = _a.fontWeight, fontWeight = _s === void 0 ? '400' : _s, icon = _a.icon, _t = _a.searchable, searchable = _t === void 0 ? false : _t, _u = _a.containerMargin, containerMargin = _u === void 0 ? '0px' : _u, _v = _a.showIcon, showIcon = _v === void 0 ? true : _v, inputRef = _a.inputRef, disabled = _a.disabled, _w = _a.creatable, creatable = _w === void 0 ? false : _w, onBlur = _a.onBlur, name = _a.name, onFocus = _a.onFocus;
|
|
143
144
|
var props = {
|
|
144
145
|
color: color,
|
|
145
146
|
height: height,
|
|
@@ -229,6 +230,6 @@ export default function RoundedSmartSelect(_a) {
|
|
|
229
230
|
? function (props) {
|
|
230
231
|
return cloneElement(icon, props);
|
|
231
232
|
}
|
|
232
|
-
: undefined, showIcon: showIcon }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: options ? 'Sin Seleccionar' : 'Cargando...' }) }), 'EMPTY'), options === null || options === void 0 ? void 0 : options.map(function (option) { return (_jsx(MenuItem, __assign({ value: getValueString(option), style: { whiteSpace: 'normal' } }, { children: option.label }), getValueString(option))); })] })));
|
|
233
|
+
: undefined, showIcon: showIcon }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: options ? 'Sin Seleccionar' : 'Cargando...' }) }), 'EMPTY'), options === null || options === void 0 ? void 0 : options.map(function (option) { return (_jsx(MenuItem, __assign({ value: getValueString(option), style: { whiteSpace: 'normal' } }, { children: option.label }), getValueString(option))); }), options === undefined && value !== undefined && (_jsx(MenuItem, __assign({ value: getValueString(value), style: { whiteSpace: 'normal' } }, { children: (_b = value.label) !== null && _b !== void 0 ? _b : '' }), getValueString(value)))] })));
|
|
233
234
|
}
|
|
234
235
|
}
|
package/package.json
CHANGED