@arquimedes.co/eureka-forms 1.9.89-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.
- package/dist/@Types/FormStep.d.ts +4 -1
- package/dist/App.js +8 -16
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +4 -0
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +53 -23
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/Element/MapperElement.js +0 -1
- package/dist/FormComponents/Step/MapperStep/MaterialMapperStep/MaterialMapperStep.js +9 -2
- package/dist/FormComponents/Step/StepFunctions.d.ts +2 -2
- package/dist/FormComponents/Step/StepFunctions.js +13 -0
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.d.ts +1 -1
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.js +29 -5
- package/dist/FormComponents/Step/TitleStep/MaterialTitleStep/MaterialTitleStep.module.css +1 -2
- package/package.json +1 -1
|
@@ -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
|
|
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
|
@@ -361,22 +361,14 @@ var migrateForm = function (form, classifiers) {
|
|
|
361
361
|
return newForm;
|
|
362
362
|
};
|
|
363
363
|
function getStaticWidth(step) {
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
case SIZES.SMALL:
|
|
373
|
-
return 1;
|
|
374
|
-
default:
|
|
375
|
-
return 1;
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
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;
|
|
380
372
|
}
|
|
381
373
|
}
|
|
382
374
|
var mapOriginalValues = function (originalValues, form) {
|
|
@@ -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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
step.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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;
|
|
@@ -33,7 +33,6 @@ function MapperElementComponent(props) {
|
|
|
33
33
|
switch ((_c = step.style) === null || _c === void 0 ? void 0 : _c.type) {
|
|
34
34
|
case MapperStyleTypes.INLINE:
|
|
35
35
|
return _jsx(React.Fragment, { children: mapSubSteps() });
|
|
36
|
-
case undefined:
|
|
37
36
|
case MapperStyleTypes.LIST:
|
|
38
37
|
return (_jsx(ListMapperElement, __assign({}, props, { step: step }, { children: mapSubSteps() })));
|
|
39
38
|
case MapperStyleTypes.PILL:
|
|
@@ -236,6 +236,13 @@ function calcRecursiveData(element, newSteps, deps, customSteps, originalValues)
|
|
|
236
236
|
step.steps[i] = newId;
|
|
237
237
|
}
|
|
238
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
|
+
}
|
|
239
246
|
break;
|
|
240
247
|
}
|
|
241
248
|
case StepTypes.ENTITYVALUEPICKER:
|
|
@@ -254,8 +261,8 @@ function calcRecursiveData(element, newSteps, deps, customSteps, originalValues)
|
|
|
254
261
|
var option = step.options[idOption];
|
|
255
262
|
if (option.type === EntityValueOptionTypes.NESTED) {
|
|
256
263
|
for (var i = 0; i < option.steps.length; i++) {
|
|
257
|
-
var
|
|
258
|
-
var newId = element.ids[
|
|
264
|
+
var idStep_7 = option.steps[i];
|
|
265
|
+
var newId = element.ids[idStep_7];
|
|
259
266
|
option.steps[i] = newId;
|
|
260
267
|
}
|
|
261
268
|
}
|
|
@@ -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
|
}
|
|
@@ -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
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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;
|
package/package.json
CHANGED