@arquimedes.co/eureka-forms 1.9.56 → 1.9.58-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;
@@ -2,6 +2,7 @@ export interface GBaseStep {
2
2
  id: string;
3
3
  type: string;
4
4
  editable?: boolean;
5
+ partial?: boolean;
5
6
  dependencies?: string[];
6
7
  }
7
8
  export interface GTitle extends GBaseStep {
@@ -20,13 +20,12 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  }
21
21
  return t;
22
22
  };
23
- import { createElement as _createElement } from "react";
24
23
  import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { createElement as _createElement } from "react";
25
25
  import StepComponent from '../../Step/Step';
26
26
  import styles from './MaterialSection.module.css';
27
27
  function MaterialSection(_a) {
28
28
  var form = _a.form, section = _a.section, widthStats = _a.widthStats, sendLabel = _a.sendLabel, others = __rest(_a, ["form", "section", "widthStats", "sendLabel"]);
29
- var postview = others.postview, partial = others.partial, originalValues = others.originalValues;
30
29
  return (_jsx("div", __assign({ className: styles.container, style: {
31
30
  width: (form.size.blockSize + form.size.spacingSize) *
32
31
  form.size.blockNum,
@@ -37,12 +36,7 @@ function MaterialSection(_a) {
37
36
  } }, { children: section.steps.map(function (idStep) {
38
37
  var step = form.steps[idStep];
39
38
  //If partial is active only display steps with originalValues
40
- if (postview &&
41
- partial &&
42
- originalValues[idStep] === undefined) {
43
- return _jsx("div", {}, idStep);
44
- }
45
- else if (step) {
39
+ if (step) {
46
40
  return (_createElement(StepComponent, __assign({}, others, { globalEditable: others.editable, widthStats: widthStats, form: form, step: step, key: idStep, level: 0 })));
47
41
  }
48
42
  else {
@@ -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];
@@ -45,6 +45,11 @@ function StepComponent(_a) {
45
45
  if (customStep) {
46
46
  return customStep.component(__assign(__assign(__assign({}, props), ((_c = customStep.componentProps) !== null && _c !== void 0 ? _c : {})), { step: step, editable: editable }));
47
47
  }
48
+ if ((props.postview || !editable) &&
49
+ (props.partial || step.partial) &&
50
+ props.originalValues[step.id] === undefined) {
51
+ return _jsx("div", {});
52
+ }
48
53
  switch (step.type) {
49
54
  case Types.TITLE: {
50
55
  return (_jsx(TitleStep, __assign({}, props, { step: step, editable: editable })));
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",
4
+ "version":"1.9.58-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",