@arquimedes.co/eureka-forms 1.9.88-test → 1.9.90-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.
Files changed (19) hide show
  1. package/dist/@Types/FormStep.d.ts +4 -1
  2. package/dist/App.js +34 -19
  3. package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +4 -0
  4. package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +53 -23
  5. package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.js +21 -10
  6. package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/ListMapperElement/ListMapperElement.module.css +35 -23
  7. package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.js +2 -2
  8. package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +1 -1
  9. package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.js +28 -13
  10. package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.module.css +6 -0
  11. package/dist/FormComponents/Step/StepFunctions.d.ts +2 -2
  12. package/dist/FormComponents/Step/StepFunctions.js +13 -0
  13. package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +1 -1
  14. package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +29 -5
  15. package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.module.css +1 -2
  16. package/dist/shared/RoundedDatePicker/RoundedDatePicker.js +1 -1
  17. package/dist/shared/RoundedSmartSelect/RoundedSmartSelect.js +3 -2
  18. package/package.json +1 -1
  19. package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.module.css +0 -10
@@ -5,10 +5,13 @@ export interface Title extends GSteps.GBaseStep {
5
5
  type: Types.TITLE;
6
6
  title: string;
7
7
  description: string | null;
8
+ size?: 1 | 2 | 3 | 4;
8
9
  }
9
10
  export interface CheckBox extends GSteps.GCheckBox {
10
11
  type: Types.CHECKBOX;
11
- steps: string[];
12
+ steps?: string[];
13
+ uncheckedSteps?: string[];
14
+ maxSize: number;
12
15
  }
13
16
  export interface Rating extends GSteps.GBaseStep {
14
17
  type: Types.RATING;
package/dist/App.js CHANGED
@@ -91,9 +91,7 @@ function App(_a) {
91
91
  else {
92
92
  setForm(form);
93
93
  }
94
- if (valuesData !== undefined) {
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 () {
@@ -363,22 +361,14 @@ var migrateForm = function (form, classifiers) {
363
361
  return newForm;
364
362
  };
365
363
  function getStaticWidth(step) {
366
- if (step.type === StepTypes.SELECTOR ||
367
- step.type === StepTypes.TEXTINPUT ||
368
- step.type === StepTypes.CLASSIFIER_SELECTOR) {
369
- switch (step.size) {
370
- case SIZES.LARGE:
371
- return 4;
372
- case SIZES.MEDIUM:
373
- return 2;
374
- case SIZES.SMALL:
375
- return 1;
376
- default:
377
- return 1;
378
- }
379
- }
380
- else {
381
- return 4;
364
+ switch (step.size) {
365
+ case SIZES.SMALL:
366
+ return 1;
367
+ case SIZES.MEDIUM:
368
+ return 2;
369
+ case SIZES.LARGE:
370
+ default:
371
+ return 4;
382
372
  }
383
373
  }
384
374
  var mapOriginalValues = function (originalValues, form) {
@@ -425,8 +415,33 @@ var mapOriginalValues = function (originalValues, form) {
425
415
  newValues[idValue] = originalValues[idValue];
426
416
  }
427
417
  }
418
+ addInitialMappers(newValues, form.steps);
419
+ console.log(newValues);
428
420
  return newValues;
429
421
  };
422
+ var addInitialMappers = function (newValues, steps) {
423
+ for (var _i = 0, _a = Object.values(steps); _i < _a.length; _i++) {
424
+ var step = _a[_i];
425
+ if (step.type !== StepTypes.MAPPER)
426
+ continue;
427
+ var idElement = nanoid();
428
+ var newElement = {
429
+ ids: {},
430
+ id: idElement,
431
+ };
432
+ var newSteps = {};
433
+ for (var _b = 0, _c = Object.keys(step.steps); _b < _c.length; _b++) {
434
+ var idStep = _c[_b];
435
+ var baseStep = JSON.parse(JSON.stringify(step.steps[idStep]));
436
+ var newIdStep = step.id + '-' + idStep + '-' + idElement;
437
+ baseStep.id = newIdStep;
438
+ newElement.ids[idStep] = newIdStep;
439
+ newSteps[newIdStep] = baseStep;
440
+ }
441
+ addInitialMappers(newValues, step.steps);
442
+ newValues[step.id] = [newElement];
443
+ }
444
+ };
430
445
  export var mapOriginalValue = function (step, value, form) {
431
446
  var _a, _b, _c, _d;
432
447
  switch (step === null || step === void 0 ? void 0 : step.type) {
@@ -237,6 +237,10 @@ export var calcValue = function (idStep, steps, values, customSteps, deleteIds,
237
237
  }
238
238
  else {
239
239
  switch (step === null || step === void 0 ? void 0 : step.type) {
240
+ case Types.TITLE: {
241
+ deleteIds.push(idStep);
242
+ return null;
243
+ }
240
244
  case Types.TEXTAREA: {
241
245
  if (step.hasTextEditor) {
242
246
  var currentContent = value.getCurrentContent();
@@ -23,33 +23,63 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { createElement as _createElement } from "react";
24
24
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
25
25
  import styles from './MaterialCheckBoxStep.module.css';
26
- import { calcStepWidth } from '../../StepFunctions';
26
+ import { calcFillerSize, calcStepWidth } from '../../StepFunctions';
27
27
  import RoundedCheckBox from '../../../../shared/RoundedCheckBox/RoundedCheckBox';
28
28
  import { Controller } from 'react-hook-form';
29
- import React from 'react';
29
+ import React, { useState } from 'react';
30
30
  import StepComponent from '../../Step';
31
31
  function CheckBox(_a) {
32
- var step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, onChange = _a.onChange, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats, others = __rest(_a, ["step", "form", "value", "onBlur", "errors", "onChange", "inputRef", "editable", "postview", "formStyle", "widthStats"]);
33
- return (_jsxs(React.Fragment, { children: [_jsxs("div", __assign({ className: styles.container, style: {
34
- width: widthStats.currentBreakPoint <= step.size
35
- ? '100%'
36
- : calcStepWidth(step.size, form.size),
37
- minHeight: step.description ||
38
- (!postview && editable && step.required)
39
- ? '55px'
40
- : '43px',
41
- } }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [step.label && (_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }))), _jsx(RoundedCheckBox, { onChange: onChange, onBlur: onBlur, "data-testid": step.id, inputRef: inputRef, padding: "0px", size: "1.6rem", error: !!errors[step.id], cantEdit: !editable || postview, checkedColor: formStyle.primaryColor, uncheckedColor: formStyle.outlineColor, checked: value })] })), (step.description || !!errors[step.id]) && (_jsx("div", __assign({ className: styles.descriptionPar, style: {
42
- color: !!errors[step.id]
43
- ? formStyle.errorColor
44
- : formStyle.descriptionTextColor,
45
- } }, { children: !!errors[step.id]
46
- ? 'Este campo es obligatorio'
47
- : step.description })))] })), value &&
48
- step.steps &&
49
- step.steps.map(function (idSubStep) {
50
- var subStep = form.steps[idSubStep];
51
- return (_createElement(StepComponent, __assign({}, others, { editable: editable, postview: postview, errors: errors, formStyle: formStyle, form: form, widthStats: widthStats, step: subStep, key: idSubStep, handleSizeChange: function () { } })));
52
- })] }));
32
+ var step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, level = _a.level, onChange = _a.onChange, inputRef = _a.inputRef, editable = _a.editable, postview = _a.postview, getValues = _a.getValues, formStyle = _a.formStyle, widthStats = _a.widthStats, others = __rest(_a, ["step", "form", "value", "onBlur", "errors", "level", "onChange", "inputRef", "editable", "postview", "getValues", "formStyle", "widthStats"]);
33
+ var handleSizeChange = others.handleSizeChange;
34
+ var _b = useState(level === 0
35
+ ? calcFillerSize(step, form.steps, getValues(), form.size)
36
+ : 0), fillerSize = _b[0], setFillerSize = _b[1];
37
+ var sizeChange = function () {
38
+ handleSizeChange === null || handleSizeChange === void 0 ? void 0 : handleSizeChange();
39
+ if (level === 0) {
40
+ setFillerSize(calcFillerSize(step, form.steps, getValues(), form.size));
41
+ }
42
+ };
43
+ var renderCheckbox = function () {
44
+ return (_jsxs("div", __assign({ className: styles.container, style: {
45
+ width: widthStats.currentBreakPoint <= step.size
46
+ ? '100%'
47
+ : calcStepWidth(step.size, form.size),
48
+ minHeight: step.description ||
49
+ (!postview && editable && step.required)
50
+ ? '55px'
51
+ : '43px',
52
+ } }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [step.label && (_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }))), _jsx(RoundedCheckBox, { onChange: onChange, onBlur: onBlur, "data-testid": step.id, inputRef: inputRef, padding: "0px", size: "1.6rem", error: !!errors[step.id], cantEdit: !editable || postview, checkedColor: formStyle.primaryColor, uncheckedColor: formStyle.outlineColor, checked: value })] })), (step.description || !!errors[step.id]) && (_jsx("div", __assign({ className: styles.descriptionPar, style: {
53
+ color: !!errors[step.id]
54
+ ? formStyle.errorColor
55
+ : formStyle.descriptionTextColor,
56
+ } }, { children: !!errors[step.id]
57
+ ? 'Este campo es obligatorio'
58
+ : step.description })))] }), step.id));
59
+ };
60
+ var renderNested = function () {
61
+ var steps = value ? step.steps : step.uncheckedSteps;
62
+ if (!steps)
63
+ return;
64
+ return (_jsx(React.Fragment, { children: steps.map(function (idStep) {
65
+ var subStep = form.steps[idStep];
66
+ return (_createElement(StepComponent, __assign({}, others, { postview: postview, editable: editable, widthStats: widthStats, getValues: getValues, formStyle: formStyle, errors: errors, form: form, step: subStep, key: idStep, level: level + 1, handleSizeChange: function () {
67
+ sizeChange();
68
+ } })));
69
+ }) }));
70
+ };
71
+ if (level === 0 && step.maxSize < form.size.blockNum) {
72
+ return (_jsxs("div", __assign({ className: styles.firstLvlContainer, style: {
73
+ width: widthStats.currentBreakPoint <= step.size
74
+ ? '100%'
75
+ : 'fit-content',
76
+ } }, { children: [renderCheckbox(), renderNested(), level === 0 && step.maxSize < form.size.blockNum && (_jsx("div", { className: styles.smallSeparator, style: {
77
+ width: fillerSize,
78
+ } }, "SEPARATOR"))] })));
79
+ }
80
+ else {
81
+ return (_jsxs(React.Fragment, { children: [renderCheckbox(), renderNested(), level === 0 && _jsx("div", { className: styles.separator })] }));
82
+ }
53
83
  }
54
84
  function CheckBoxStep(props) {
55
85
  var _a;
@@ -20,15 +20,26 @@ function ListMapperElement(_a) {
20
20
  var name = calcName
21
21
  ? calcName(element)
22
22
  : step.unitLabel + ' ' + (num + 1);
23
- return (_jsx("div", __assign({ className: widthStats.isMobile ? styles.mobileContainer : styles.container }, { children: _jsxs("div", __assign({ className: styles.contentContainer, style: {
24
- width: (size.blockSize + size.spacingSize) *
25
- ((_c = (_b = step.style) === null || _b === void 0 ? void 0 : _b.size) !== null && _c !== void 0 ? _c : size.blockNum - 1),
26
- } }, { children: [name && (_jsx("div", __assign({ className: styles.titleLbl, style: { color: formStyle.textColor } }, { children: loading ? '' : name + ':' }))), step.deletable !== false && (_jsx("div", __assign({ className: !editable || postview
27
- ? styles.disabledDeleteBtn
28
- : styles.deleteBtn, style: { color: formStyle.textColor }, onClick: function () {
29
- if (editable && !postview) {
30
- handleDelete === null || handleDelete === void 0 ? void 0 : handleDelete();
31
- }
32
- } }, { children: _jsx(DeleteRoundedIcon, { fontSize: "inherit" }) }))), children] })) })));
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
- background-color: #f0f0f0;
4
- border: 1px solid #d6d6d6;
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
- .container {
16
- max-width: calc(100% - 112px);
17
- padding-right: 55px;
18
- padding-left: 55px;
12
+ .bulletContainer {
13
+ display: flex;
14
+ margin-left: 30px;
15
+ margin-right: 10px;
16
+ align-items: center;
19
17
  }
20
-
21
- .mobileContainer {
22
- max-width: calc(100% - 42px);
23
- padding-right: 20px;
24
- padding-left: 20px;
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
- font-size: 20px;
30
- font-weight: 600;
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
- position: absolute;
54
- right: 15px;
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,7 @@ 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 (_jsx("div", __assign({ className: styles.contentContainer }, { children: mapSubSteps() })));
35
+ return _jsx(React.Fragment, { children: mapSubSteps() });
36
36
  case MapperStyleTypes.LIST:
37
37
  return (_jsx(ListMapperElement, __assign({}, props, { step: step }, { children: mapSubSteps() })));
38
38
  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 }))), elements.map(function (element, index) { return (_jsx(MapperElementComponent, __assign({ num: index, loading: loading, element: element, formStyle: formStyle, step: step, form: __assign(__assign({}, form), { steps: __assign(__assign({}, form.steps), localSteps) }), editable: editable, postview: postview, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore, handleDelete: function () {
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
- required: props.step.required
149
- ? 'Este campo es obligatorio'
150
- : undefined,
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 })));
@@ -228,6 +236,13 @@ function calcRecursiveData(element, newSteps, deps, customSteps, originalValues)
228
236
  step.steps[i] = newId;
229
237
  }
230
238
  }
239
+ if (step.uncheckedSteps) {
240
+ for (var i = 0; i < step.uncheckedSteps.length; i++) {
241
+ var idStep_6 = step.uncheckedSteps[i];
242
+ var newId = element.ids[idStep_6];
243
+ step.uncheckedSteps[i] = newId;
244
+ }
245
+ }
231
246
  break;
232
247
  }
233
248
  case StepTypes.ENTITYVALUEPICKER:
@@ -246,8 +261,8 @@ function calcRecursiveData(element, newSteps, deps, customSteps, originalValues)
246
261
  var option = step.options[idOption];
247
262
  if (option.type === EntityValueOptionTypes.NESTED) {
248
263
  for (var i = 0; i < option.steps.length; i++) {
249
- var idStep_6 = option.steps[i];
250
- var newId = element.ids[idStep_6];
264
+ var idStep_7 = option.steps[i];
265
+ var newId = element.ids[idStep_7];
251
266
  option.steps[i] = newId;
252
267
  }
253
268
  }
@@ -40,3 +40,9 @@
40
40
  margin-bottom: 3px;
41
41
  width: fit-content;
42
42
  }
43
+
44
+ .errorMsg {
45
+ font-size: 0.75rem;
46
+ margin-top: 5px;
47
+ margin-left: 15px;
48
+ }
@@ -1,5 +1,5 @@
1
1
  import { FormSize } from '../../@Types/Form';
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;
2
+ import { CheckBox, ClassifierSelector, EntityValuePicker, FormSelector, FormStep } from '../../@Types/FormStep';
3
+ export declare function calcFillerSize(step: FormSelector | ClassifierSelector | EntityValuePicker | CheckBox, 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;
@@ -56,6 +56,19 @@ export function recursivelyCheckOpenSize(idStep, steps, values) {
56
56
  }
57
57
  return size;
58
58
  }
59
+ if (step.type === Types.CHECKBOX) {
60
+ var size = step.size;
61
+ var stepSteps = value ? step.steps : step.uncheckedSteps;
62
+ if (stepSteps) {
63
+ var optionSize = 0;
64
+ for (var _f = 0, stepSteps_1 = stepSteps; _f < stepSteps_1.length; _f++) {
65
+ var pStepId = stepSteps_1[_f];
66
+ optionSize += recursivelyCheckOpenSize(pStepId, steps, values);
67
+ }
68
+ size += optionSize;
69
+ }
70
+ return size;
71
+ }
59
72
  else {
60
73
  return 4;
61
74
  }
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { TitleStepProps } from '../TitleStep';
3
- declare function TitleStep({ step, formStyle, widthStats, }: TitleStepProps): JSX.Element;
3
+ declare function TitleStep(props: TitleStepProps): JSX.Element;
4
4
  export default TitleStep;
@@ -10,11 +10,35 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { Controller } from 'react-hook-form';
14
+ import { calcStepWidth } from '../../StepFunctions';
13
15
  import styles from './MaterialTitleStep.module.css';
14
- function TitleStep(_a) {
15
- var step = _a.step, formStyle = _a.formStyle, widthStats = _a.widthStats;
16
- return (_jsxs("div", __assign({ className: styles.container, style: { color: formStyle.textColor } }, { children: [_jsx("div", __assign({ className: styles.titleLbl, style: { textAlign: widthStats.isMobile ? 'center' : 'start' } }, { children: step.title })), step.description && (_jsx("p", __assign({ className: styles.descriptionPar, style: {
17
- margin: step.title ? '10px 0px' : '0px 0px 5px 0px',
18
- } }, { children: step.description })))] })));
16
+ function Title(_a) {
17
+ var _b;
18
+ var step = _a.step, form = _a.form, _c = _a.value, title = _c.title, description = _c.description, formStyle = _a.formStyle, widthStats = _a.widthStats;
19
+ var size = (_b = step.size) !== null && _b !== void 0 ? _b : form.size.blockNum;
20
+ return (_jsxs("div", __assign({ className: styles.container, style: {
21
+ color: formStyle.textColor,
22
+ width: widthStats.currentBreakPoint <= size
23
+ ? '100%'
24
+ : calcStepWidth(size, form.size),
25
+ } }, { children: [title && (_jsx("div", __assign({ className: styles.titleLbl, style: {
26
+ textAlign: widthStats.isMobile &&
27
+ widthStats.currentBreakPoint <= size
28
+ ? 'center'
29
+ : 'start',
30
+ } }, { children: title }))), description && (_jsx("p", __assign({ className: styles.descriptionPar, style: {
31
+ margin: title ? '10px 0px' : '0px 0px 5px 0px',
32
+ } }, { children: description })))] })));
33
+ }
34
+ function TitleStep(props) {
35
+ var _a;
36
+ return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: (_a = props.originalValues[props.step.id]) !== null && _a !== void 0 ? _a : {
37
+ title: props.step.title,
38
+ description: props.step.description,
39
+ }, render: function (_a) {
40
+ var field = _a.field;
41
+ return _jsx(Title, __assign({}, props, field));
42
+ } }));
19
43
  }
20
44
  export default TitleStep;
@@ -1,8 +1,7 @@
1
1
  .container {
2
2
  display: flex;
3
3
  flex-direction: column;
4
- width: 900px;
5
- max-width: 100%;
4
+ max-width: calc(100% - 20px);
6
5
  padding: 5px 10px;
7
6
  }
8
7
 
@@ -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 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;
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version":"1.9.88-test",
4
+ "version":"1.9.90-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",
@@ -1,10 +0,0 @@
1
- .contentContainer {
2
- margin-left: auto;
3
- margin-right: auto;
4
- display: flex;
5
- flex-flow: row wrap;
6
- height: fit-content;
7
- max-width: 100%;
8
- overflow-x: hidden;
9
- overflow-y: hidden;
10
- }