@arquimedes.co/eureka-forms 2.0.29 → 2.0.32-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.
@@ -55,6 +55,7 @@ export interface FormSelector extends GSteps.GBaseStep {
55
55
  options: FormSelectorOption[];
56
56
  size: 1 | 2 | 3 | 4;
57
57
  maxSize?: number;
58
+ defaultValue?: string;
58
59
  }
59
60
  export type FormSelectorOption = DefaultFormSelectorOption | NestedStepOption | AddSectionOption;
60
61
  interface DefaultFormSelectorOption {
@@ -87,7 +87,9 @@ export var calcValue = function (idStep, steps, values, customSteps, deleteIds,
87
87
  }
88
88
  return mappedValues;
89
89
  }
90
- case StepTypes.TITLE:
90
+ case StepTypes.TITLE: {
91
+ return value !== null && value !== void 0 ? value : undefined;
92
+ }
91
93
  case StepTypes.COLLAPSIBLE:
92
94
  deleteIds.push(idStep);
93
95
  return;
@@ -111,16 +111,16 @@ export var calcStepWidth = function (stepSize, size) {
111
111
  return size.blockSize * stepSize + size.spacingSize * (stepSize - 1);
112
112
  };
113
113
  export var calcDefaultValue = function (step) {
114
- var _a;
114
+ var _a, _b;
115
115
  switch (step.type) {
116
116
  case StepTypes.CHECKBOX:
117
117
  return (_a = step.defaultValue) !== null && _a !== void 0 ? _a : false;
118
118
  case StepTypes.TITLE:
119
- return {
120
- title: step.title,
121
- description: step.description,
122
- };
119
+ return undefined;
123
120
  case StepTypes.SELECTOR:
121
+ if (step.defaultValue)
122
+ return ((_b = step.options.find(function (option) { return option.value === step.defaultValue; })) !== null && _b !== void 0 ? _b : '');
123
+ return '';
124
124
  case StepTypes.TEXTINPUT:
125
125
  case StepTypes.CLASSIFIER_SELECTOR:
126
126
  return '';
@@ -10,22 +10,24 @@ 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 { calcDefaultValue, calcStepWidth } from '../../StepFunctions';
13
+ import { calcStepWidth } from '../../StepFunctions';
14
14
  import styles from './MaterialTitleStep.module.css';
15
15
  import { useAppSelector } from '../../../hooks';
16
16
  import FormContext from '../../../Contexts/FormContext';
17
17
  import { useContext } from 'react';
18
18
  import { useFormStep } from '../../StepHooks';
19
19
  function TitleStep(_a) {
20
- var _b;
20
+ var _b, _c, _d;
21
21
  var step = _a.step;
22
- var _c = useFormStep(step, {
23
- defaultValue: calcDefaultValue(step),
24
- }).value, title = _c.title, description = _c.description;
22
+ var value = useFormStep(step, {
23
+ defaultValue: undefined,
24
+ }).value;
25
+ var title = (_b = value === null || value === void 0 ? void 0 : value.title) !== null && _b !== void 0 ? _b : step.title;
26
+ var description = (_c = value === null || value === void 0 ? void 0 : value.description) !== null && _c !== void 0 ? _c : step.description;
25
27
  var formStyle = useAppSelector(function (state) { return state.global; }).formStyle;
26
28
  var form = useContext(FormContext);
27
29
  var widthStats = useAppSelector(function (state) { return state.widthStats; });
28
- var size = (_b = step.size) !== null && _b !== void 0 ? _b : form.size.blockNum;
30
+ var size = (_d = step.size) !== null && _d !== void 0 ? _d : form.size.blockNum;
29
31
  return (_jsxs("div", __assign({ className: styles.container, style: {
30
32
  color: formStyle.textColor,
31
33
  width: widthStats.currentBreakPoint <= size
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": "2.0.29",
4
+ "version":"2.0.32-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",