@arquimedes.co/eureka-forms 1.9.56-test → 1.9.57-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.
@@ -8,6 +8,7 @@ export interface Title extends GSteps.GBaseStep {
8
8
  }
9
9
  export interface CheckBox extends GSteps.GCheckBox {
10
10
  type: Types.CHECKBOX;
11
+ steps: string[];
11
12
  }
12
13
  export interface Rating extends GSteps.GBaseStep {
13
14
  type: Types.RATING;
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  import { CheckBoxStepProps } from '../CheckBoxStep';
3
- declare function CheckBoxStep({ step, form, errors, control, editable, postview, formStyle, widthStats, }: CheckBoxStepProps): JSX.Element;
3
+ declare function CheckBoxStep(props: CheckBoxStepProps): JSX.Element;
4
4
  export default CheckBoxStep;
@@ -20,31 +20,43 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
+ import { createElement as _createElement } from "react";
23
24
  import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
24
25
  import styles from './MaterialCheckBoxStep.module.css';
25
26
  import { calcStepWidth } from '../../StepFunctions';
26
27
  import RoundedCheckBox from '../../../../shared/RoundedCheckBox/RoundedCheckBox';
27
28
  import { Controller } from 'react-hook-form';
28
- function CheckBoxStep(_a) {
29
- var step = _a.step, form = _a.form, errors = _a.errors, control = _a.control, editable = _a.editable, postview = _a.postview, formStyle = _a.formStyle, widthStats = _a.widthStats;
30
- return (_jsxs("div", __assign({ className: styles.container, style: {
31
- width: widthStats.currentBreakPoint <= step.size
32
- ? '100%'
33
- : calcStepWidth(step.size, form.size),
34
- minHeight: step.description || step.required ? '55px' : '43px',
35
- } }, { children: [_jsxs("div", __assign({ className: styles.labelCheckBoxContainer }, { children: [step.label && (_jsxs("div", __assign({ className: styles.checkboxLbl }, { children: [step.label, step.required ? ' *' : '', ":"] }))), _jsx(Controller, { name: step.id, control: control, defaultValue: false, rules: {
36
- required: step.required
37
- ? 'Este campo es obligatorio'
38
- : undefined,
39
- }, shouldUnregister: true, render: function (_a) {
40
- var _b = _a.field, ref = _b.ref, field = __rest(_b, ["ref"]);
41
- return (_jsx(RoundedCheckBox, __assign({}, field, { "data-testid": step.id, inputRef: ref, padding: "0px", size: "1.6rem", error: !!errors[step.id], cantEdit: !editable || postview, checkedColor: formStyle.primaryColor, uncheckedColor: formStyle.outlineColor, checked: field.value })));
42
- } })] })), (step.description || !!errors[step.id]) && (_jsx("div", __assign({ className: styles.descriptionPar, style: {
43
- color: !!errors[step.id]
44
- ? formStyle.errorColor
45
- : formStyle.descriptionTextColor,
46
- } }, { children: !!errors[step.id]
47
- ? 'Este campo es obligatorio'
48
- : step.description })))] })));
29
+ import React from 'react';
30
+ import StepComponent from '../../Step';
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 || step.required ? '55px' : '43px',
38
+ } }, { 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: {
39
+ color: !!errors[step.id]
40
+ ? formStyle.errorColor
41
+ : formStyle.descriptionTextColor,
42
+ } }, { children: !!errors[step.id]
43
+ ? 'Este campo es obligatorio'
44
+ : step.description })))] })), value &&
45
+ step.steps &&
46
+ step.steps.map(function (idSubStep) {
47
+ var subStep = form.steps[idSubStep];
48
+ return (_createElement(StepComponent, __assign({}, others, { editable: editable, postview: postview, errors: errors, formStyle: formStyle, form: form, widthStats: widthStats, step: subStep, key: idSubStep, handleSizeChange: function () { } })));
49
+ })] }));
50
+ }
51
+ function CheckBoxStep(props) {
52
+ var _a;
53
+ return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: (_a = props.originalValues[props.step.id]) !== null && _a !== void 0 ? _a : false, rules: {
54
+ required: props.step.required
55
+ ? 'Este campo es obligatorio'
56
+ : undefined,
57
+ }, shouldUnregister: true, render: function (_a) {
58
+ var _b = _a.field, ref = _b.ref, field = __rest(_b, ["ref"]);
59
+ return (_jsx(CheckBox, __assign({}, props, field, { inputRef: ref })));
60
+ } }));
49
61
  }
50
62
  export default CheckBoxStep;
@@ -195,6 +195,16 @@ function calcRecursiveData(element, newSteps, deps, originalValues) {
195
195
  }
196
196
  break;
197
197
  }
198
+ case StepTypes.CHECKBOX: {
199
+ if (step.steps) {
200
+ for (var i = 0; i < step.steps.length; i++) {
201
+ var idStep_5 = step.steps[i];
202
+ var newId = element.ids[idStep_5];
203
+ step.steps[i] = newId;
204
+ }
205
+ }
206
+ break;
207
+ }
198
208
  case StepTypes.ENTITYVALUEPICKER:
199
209
  for (var _h = 0, _j = step.filters; _h < _j.length; _h++) {
200
210
  var filter = _j[_h];
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.56-test",
4
+ "version":"1.9.57-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",