@arquimedes.co/eureka-forms 2.0.18 → 2.0.19

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.
@@ -15,6 +15,7 @@ export interface Form {
15
15
  Branding?: Branding;
16
16
  classifiers?: Record<string, Classifier>;
17
17
  terms?: Term[];
18
+ hiddenSteps?: string[];
18
19
  }
19
20
  export interface FormSize {
20
21
  blockNum: 1 | 2 | 3 | 4;
@@ -15,7 +15,7 @@ import { getRawText, stringToDraft } from '../Utils/DraftFunctions';
15
15
  import { calcSubSteps } from '../FormSteps/StepFunctions';
16
16
  export var calcValuesStore = function (form, originalValues, postview, customSteps) {
17
17
  var _a;
18
- var _b;
18
+ var _b, _c;
19
19
  if (originalValues === void 0) { originalValues = {}; }
20
20
  if (postview === void 0) { postview = false; }
21
21
  if (customSteps === void 0) { customSteps = {}; }
@@ -23,10 +23,10 @@ export var calcValuesStore = function (form, originalValues, postview, customSte
23
23
  global: {},
24
24
  sections: {},
25
25
  };
26
- for (var _i = 0, _c = Object.keys(originalValues); _i < _c.length; _i++) {
27
- var idValue = _c[_i];
26
+ for (var _i = 0, _d = Object.keys(originalValues); _i < _d.length; _i++) {
27
+ var idValue = _d[_i];
28
28
  var step = form.steps[idValue];
29
- if (step) {
29
+ if (step && !((_b = form.hiddenSteps) === null || _b === void 0 ? void 0 : _b.includes(step.id))) {
30
30
  var value = mapOriginalValue(step, originalValues[step.id], values, form);
31
31
  if (value !== undefined) {
32
32
  if (!values.sections[step.idSection])
@@ -40,17 +40,17 @@ export var calcValuesStore = function (form, originalValues, postview, customSte
40
40
  }
41
41
  if (postview)
42
42
  return values;
43
- for (var _d = 0, _e = Object.values(form.sections); _d < _e.length; _d++) {
44
- var section = _e[_d];
45
- for (var _f = 0, _g = section.steps; _f < _g.length; _f++) {
46
- var idStep = _g[_f];
43
+ for (var _e = 0, _f = Object.values(form.sections); _e < _f.length; _e++) {
44
+ var section = _f[_e];
45
+ for (var _g = 0, _h = section.steps; _g < _h.length; _g++) {
46
+ var idStep = _h[_g];
47
47
  var step = form.steps[idStep];
48
48
  if (step.type !== StepTypes.MAPPER ||
49
- ((_b = values.sections[step.idSection]) === null || _b === void 0 ? void 0 : _b[step.id]))
49
+ ((_c = values.sections[step.idSection]) === null || _c === void 0 ? void 0 : _c[step.id]))
50
50
  continue;
51
51
  if (!values.sections[step.idSection])
52
52
  values.sections[step.idSection] = {};
53
- var _h = addMapperStep(step, customSteps), element = _h.element, mappers = _h.mappers;
53
+ var _j = addMapperStep(step, customSteps), element = _j.element, mappers = _j.mappers;
54
54
  values.sections[step.idSection] = __assign(__assign(__assign({}, values.sections[step.idSection]), mappers), (_a = {}, _a[step.id] = [element], _a));
55
55
  }
56
56
  }
@@ -30,16 +30,24 @@ import RoundedCheckBox from '../../../../Shared/RoundedCheckBox/RoundedCheckBox'
30
30
  import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
31
31
  import styles from './MaterialTerm.module.css';
32
32
  import { useAppSelector } from '../../../../hooks';
33
+ import { createSelector } from '@reduxjs/toolkit';
34
+ var selectOriginalValue = createSelector([
35
+ function (state) { return state.site.values; },
36
+ function (state, idTerm) { return idTerm; },
37
+ ], function (values, idTerm) { return values.global[idTerm]; });
33
38
  function TermComponent(_a) {
34
39
  var _b;
35
40
  var term = _a.term, tempError = _a.tempError;
36
41
  var _c = useAppSelector(function (state) { return state.global; }), formStyle = _c.formStyle, postview = _c.postview;
42
+ var originalValue = useAppSelector(function (state) {
43
+ return selectOriginalValue(state, term.id);
44
+ });
37
45
  var _d = useController({
38
46
  name: term.id,
39
47
  rules: {
40
48
  required: true,
41
49
  },
42
- defaultValue: false,
50
+ defaultValue: originalValue,
43
51
  shouldUnregister: true,
44
52
  }), _e = _d.field, ref = _e.ref, field = __rest(_e, ["ref"]), error = _d.fieldState.error;
45
53
  var _f = useState(false), showDialog = _f[0], setShowDialog = _f[1];
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.18",
4
+ "version": "2.0.19",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",