@arquimedes.co/eureka-forms 1.9.87-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/{PillElementContainer/PillElementContainer.d.ts → ListMapperElement/ListMapperElement.d.ts} +2 -2
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.js +45 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/{PillElementContainer/PillElementContainer.module.css → ListMapperElement/ListMapperElement.module.css} +35 -23
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.d.ts +1 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.js +19 -4
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/PillMapperElement/PillMapperElement.d.ts +13 -0
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/{PillElementContainer/PillElementContainer.js → PillMapperElement/PillMapperElement.js} +9 -7
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +2 -1
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.js +21 -13
- 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 → PillMapperElement/PillMapperElement.module.css} +0 -0
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) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { MapperStepProps } from '../../../MapperStep';
|
|
3
3
|
import { MapperElementComponentProps } from '../MapperElement';
|
|
4
|
-
declare function
|
|
4
|
+
declare function ListMapperElement<Type = any>({ step, form, num, loading, element, children, editable, postview, formStyle, handleDelete, widthStats, customElementModifiers, }: MapperStepProps<Type> & MapperElementComponentProps<Type> & {
|
|
5
5
|
num: number;
|
|
6
6
|
formStyle: {
|
|
7
7
|
textColor: string;
|
|
@@ -10,4 +10,4 @@ declare function PillElementContainer<Type = any>({ step, form, num, element, ch
|
|
|
10
10
|
/** children to render */
|
|
11
11
|
children?: any;
|
|
12
12
|
}): JSX.Element;
|
|
13
|
-
export default
|
|
13
|
+
export default ListMapperElement;
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import styles from './ListMapperElement.module.css';
|
|
14
|
+
import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
|
|
15
|
+
function ListMapperElement(_a) {
|
|
16
|
+
var _b, _c;
|
|
17
|
+
var step = _a.step, form = _a.form, num = _a.num, loading = _a.loading, element = _a.element, children = _a.children, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, handleDelete = _a.handleDelete, widthStats = _a.widthStats, customElementModifiers = _a.customElementModifiers;
|
|
18
|
+
var size = form.size;
|
|
19
|
+
var calcName = (customElementModifiers !== null && customElementModifiers !== void 0 ? customElementModifiers : {}).calcName;
|
|
20
|
+
var name = calcName
|
|
21
|
+
? calcName(element)
|
|
22
|
+
: step.unitLabel + ' ' + (num + 1);
|
|
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" }) })))] })));
|
|
44
|
+
}
|
|
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 {
|
|
@@ -12,18 +12,33 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { createElement as _createElement } from "react";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import StepComponent from '../../../Step';
|
|
15
|
-
import
|
|
15
|
+
import { MapperStyleTypes } from '../../../../../constants/FormStepTypes';
|
|
16
|
+
import ListMapperElement from './ListMapperElement/ListMapperElement';
|
|
17
|
+
import PillMapperElement from './PillMapperElement/PillMapperElement';
|
|
18
|
+
import React from 'react';
|
|
16
19
|
function MapperElementComponent(props) {
|
|
17
|
-
var _a, _b;
|
|
20
|
+
var _a, _b, _c;
|
|
18
21
|
var level = props.level, form = props.form, step = props.step, element = props.element, editable = props.editable;
|
|
19
22
|
if (element.deleted) {
|
|
20
23
|
return _jsx("div", {});
|
|
21
24
|
}
|
|
22
25
|
var customStepProps = (_b = (_a = props.calcCustomStepProps) === null || _a === void 0 ? void 0 : _a.call(props, element, props.customStepProps)) !== null && _b !== void 0 ? _b : props.customStepProps;
|
|
23
|
-
|
|
26
|
+
var mapSubSteps = function () {
|
|
27
|
+
return step.rootSteps.map(function (idSubStep) {
|
|
24
28
|
var _a;
|
|
25
29
|
var subStep = form.steps[element.ids[idSubStep]];
|
|
26
30
|
return (_createElement(StepComponent, __assign({}, props, { customStepProps: customStepProps, globalEditable: editable ? (_a = step.editable) !== null && _a !== void 0 ? _a : true : false, step: subStep, key: idSubStep, level: level + 1 })));
|
|
27
|
-
})
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
switch ((_c = step.style) === null || _c === void 0 ? void 0 : _c.type) {
|
|
34
|
+
case MapperStyleTypes.INLINE:
|
|
35
|
+
return _jsx(React.Fragment, { children: mapSubSteps() });
|
|
36
|
+
case undefined:
|
|
37
|
+
case MapperStyleTypes.LIST:
|
|
38
|
+
return (_jsx(ListMapperElement, __assign({}, props, { step: step }, { children: mapSubSteps() })));
|
|
39
|
+
case MapperStyleTypes.PILL:
|
|
40
|
+
default:
|
|
41
|
+
return (_jsx(PillMapperElement, __assign({}, props, { step: step }, { children: mapSubSteps() })));
|
|
42
|
+
}
|
|
28
43
|
}
|
|
29
44
|
export default MapperElementComponent;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MapperStepProps } from '../../../MapperStep';
|
|
3
|
+
import { MapperElementComponentProps } from '../MapperElement';
|
|
4
|
+
declare function PillMapperElement<Type = any>({ step, form, num, loading, element, children, editable, postview, formStyle, handleDelete, widthStats, customElementModifiers, }: MapperStepProps<Type> & MapperElementComponentProps<Type> & {
|
|
5
|
+
num: number;
|
|
6
|
+
formStyle: {
|
|
7
|
+
textColor: string;
|
|
8
|
+
};
|
|
9
|
+
handleDelete?: Function;
|
|
10
|
+
/** children to render */
|
|
11
|
+
children?: any;
|
|
12
|
+
}): JSX.Element;
|
|
13
|
+
export default PillMapperElement;
|
|
@@ -9,20 +9,22 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import {
|
|
13
|
-
import styles from './
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import styles from './PillMapperElement.module.css';
|
|
14
14
|
import DeleteRoundedIcon from '@material-ui/icons/DeleteRounded';
|
|
15
|
-
function
|
|
15
|
+
function PillMapperElement(_a) {
|
|
16
16
|
var _b, _c;
|
|
17
|
-
var step = _a.step, form = _a.form, num = _a.num, element = _a.element, children = _a.children, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, handleDelete = _a.handleDelete, widthStats = _a.widthStats, customElementModifiers = _a.customElementModifiers;
|
|
17
|
+
var step = _a.step, form = _a.form, num = _a.num, loading = _a.loading, element = _a.element, children = _a.children, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, handleDelete = _a.handleDelete, widthStats = _a.widthStats, customElementModifiers = _a.customElementModifiers;
|
|
18
18
|
var size = form.size;
|
|
19
19
|
var calcName = (customElementModifiers !== null && customElementModifiers !== void 0 ? customElementModifiers : {}).calcName;
|
|
20
20
|
return (_jsx("div", __assign({ className: widthStats.isMobile ? styles.mobileContainer : styles.container }, { children: _jsxs("div", __assign({ className: styles.contentContainer, style: {
|
|
21
21
|
width: (size.blockSize + size.spacingSize) *
|
|
22
22
|
((_c = (_b = step.style) === null || _b === void 0 ? void 0 : _b.size) !== null && _c !== void 0 ? _c : size.blockNum - 1),
|
|
23
|
-
} }, { children: [
|
|
23
|
+
} }, { children: [_jsx("div", __assign({ className: styles.titleLbl, style: { color: formStyle.textColor } }, { children: loading
|
|
24
|
+
? ''
|
|
25
|
+
: (calcName
|
|
24
26
|
? calcName(element)
|
|
25
|
-
: step.unitLabel + ' ' + (num + 1)
|
|
27
|
+
: step.unitLabel + ' ' + (num + 1)) + ':' })), step.deletable !== false && (_jsx("div", __assign({ className: !editable || postview
|
|
26
28
|
? styles.disabledDeleteBtn
|
|
27
29
|
: styles.deleteBtn, style: { color: formStyle.textColor }, onClick: function () {
|
|
28
30
|
if (editable && !postview) {
|
|
@@ -30,4 +32,4 @@ function PillElementContainer(_a) {
|
|
|
30
32
|
}
|
|
31
33
|
} }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) }))), children] })) })));
|
|
32
34
|
}
|
|
33
|
-
export default
|
|
35
|
+
export default PillMapperElement;
|
|
@@ -6,7 +6,8 @@ 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, 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
|
+
loading?: boolean;
|
|
10
11
|
onChange: (elements: MapperElement<Type>[]) => void;
|
|
11
12
|
elements: MapperElement<Type>[];
|
|
12
13
|
inputRef: any;
|
|
@@ -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,10 +42,10 @@ 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, dependencyStore = _a.dependencyStore, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["step", "form", "inputRef", "editable", "postview", "elements", "formStyle", "customAdd", "dependencyStore", "setDependencyStore"]);
|
|
46
|
-
var
|
|
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
|
+
var _e = useState(true), firstRender = _e[0], setFirstRender = _e[1];
|
|
47
47
|
/** Mapper Steps to pass down */
|
|
48
|
-
var
|
|
48
|
+
var _f = useState(), localSteps = _f[0], setLocalSteps = _f[1];
|
|
49
49
|
var onChange = function (elements) {
|
|
50
50
|
var _a;
|
|
51
51
|
var _b;
|
|
@@ -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