@arquimedes.co/eureka-forms 2.0.13-test → 2.0.15-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.
@@ -3,7 +3,7 @@ import { FormStep, Mapper } from '../@Types/FormStep';
3
3
  import { SiteState, ValuesStore } from '../States/SiteSlice';
4
4
  import { CustomStep } from '../FormSteps/CustomStep';
5
5
  import { MapperElement } from '../@Types/MapperElement';
6
- export declare const calcValuesStore: (form: Form, originalValues?: Record<string, any>, postview?: boolean, customSteps?: Record<string, CustomStep>) => ValuesStore;
6
+ export declare const calcValuesStore: (form: Readonly<Form>, originalValues?: Record<string, any>, postview?: boolean, customSteps?: Record<string, CustomStep>) => ValuesStore;
7
7
  export declare const addMapperStep: <Type>(step: Mapper, customSteps: Record<string, CustomStep>) => {
8
8
  element: MapperElement<Type>;
9
9
  /** Record of all the new mapper values created */
@@ -12,5 +12,5 @@ export declare const addMapperStep: <Type>(step: Mapper, customSteps: Record<str
12
12
  steps: Record<string, FormStep>;
13
13
  };
14
14
  export declare function calcRecursiveData<Type>(element: Readonly<MapperElement<Type>>, newSteps: Record<string, FormStep>, customSteps: Record<string, CustomStep>): void;
15
- export declare const mapOriginalValue: (step: FormStep, value: any, values: ValuesStore, form?: Form) => any;
15
+ export declare const mapOriginalValue: (step: FormStep, value: any, values: ValuesStore, form: Readonly<Form>) => any;
16
16
  export declare const calcInitialSections: (form: Form) => Pick<SiteState, 'previousSections' | 'idCurrentSection' | 'nextSections'>;
@@ -172,7 +172,7 @@ export var mapOriginalValue = function (step, value, values, form) {
172
172
  return value;
173
173
  }
174
174
  case StepTypes.CLASSIFIER_SELECTOR: {
175
- var stepClassifier = (_d = form === null || form === void 0 ? void 0 : form.classifiers) === null || _d === void 0 ? void 0 : _d[(_e = step.idClassifier) !== null && _e !== void 0 ? _e : ''];
175
+ var stepClassifier = (_d = form.classifiers) === null || _d === void 0 ? void 0 : _d[(_e = step.idClassifier) !== null && _e !== void 0 ? _e : ''];
176
176
  if (stepClassifier) {
177
177
  var classifier = (_f = form.classifiers) === null || _f === void 0 ? void 0 : _f[value];
178
178
  if (!(value === null || value === void 0 ? void 0 : value.value))
@@ -147,6 +147,7 @@ export var useSetupApp = function (isEmbedded, _a) {
147
147
  }
148
148
  if (form) {
149
149
  form = createNextState(form, function (form) {
150
+ //If a rootStep is a mapper of type section
150
151
  if (form && classifiers)
151
152
  form.classifiers = classifiers;
152
153
  var _loop_1 = function (section) {
@@ -176,6 +176,14 @@ export var calcMapperSubSteps = function (step, elements, customSteps) {
176
176
  function calcStepDependency(idStep, steps, values, customSteps) {
177
177
  var _a, _b;
178
178
  var depStep = steps[idStep];
179
+ if (!depStep) {
180
+ console.error('Missing Step Dependency:', idStep);
181
+ return {
182
+ type: 'MISSING',
183
+ value: null,
184
+ dependents: [],
185
+ };
186
+ }
179
187
  var originalValue = (_a = values.sections[depStep.idSection]) === null || _a === void 0 ? void 0 : _a[depStep.id];
180
188
  return {
181
189
  type: (_b = depStep === null || depStep === void 0 ? void 0 : depStep.type) !== null && _b !== void 0 ? _b : 'ORIGINAL',
@@ -34,6 +34,6 @@ function CustomStepComponent(_a) {
34
34
  var dependencyStore = useAppSelector(function (state) { return state.site.dependencies; });
35
35
  var widthStats = useAppSelector(function (state) { return state.widthStats; });
36
36
  var dependencyInfo = useStepDependency(props.step);
37
- return customStep.component(__assign(__assign(__assign(__assign(__assign({}, props), { dependencyStore: dependencyStore, widthStats: widthStats, form: form, customStepProps: customStepProps }), dependencyInfo), global), ((_b = customStep.componentProps) !== null && _b !== void 0 ? _b : {})));
37
+ return customStep.component(__assign(__assign(__assign(__assign(__assign({}, global), dependencyInfo), props), { dependencyStore: dependencyStore, widthStats: widthStats, form: form, customStepProps: customStepProps }), ((_b = customStep.componentProps) !== null && _b !== void 0 ? _b : {})));
38
38
  }
39
39
  export default CustomStepComponent;
@@ -42,6 +42,7 @@ import CustomStep from './CustomStep';
42
42
  import { useAppSelector } from '../hooks';
43
43
  import { useContext } from 'react';
44
44
  import CustomContext from '../Contexts/CustomContext';
45
+ import { selectOriginalValue } from './StepHooks';
45
46
  function StepComponent(_a) {
46
47
  var _b;
47
48
  var step = _a.step, props = __rest(_a, ["step"]);
@@ -51,9 +52,14 @@ function StepComponent(_a) {
51
52
  }
52
53
  var _c = useAppSelector(function (state) { return state.global; }), postview = _c.postview, partial = _c.partial;
53
54
  var customSteps = useContext(CustomContext).customSteps;
55
+ var originalValue = useAppSelector(function (state) {
56
+ return selectOriginalValue(state, step);
57
+ });
54
58
  var customStep = customSteps[step.type];
55
59
  var editable = props.editable ? (_b = step.editable) !== null && _b !== void 0 ? _b : true : false;
56
- if ((postview || !editable) && (partial || step.partial)) {
60
+ if ((postview || !editable) &&
61
+ (partial || step.partial) &&
62
+ originalValue === undefined) {
57
63
  return _jsx("div", {});
58
64
  }
59
65
  if (customStep) {
@@ -1,7 +1,13 @@
1
1
  import { GBaseStep } from '../@Types/GenericFormSteps';
2
+ import { ValuesStore } from '../States/SiteSlice';
2
3
  import { RootState } from '../Utils/store';
3
4
  import { Form } from '../@Types';
4
5
  import { DependencyStore } from '../Form/Form';
6
+ export declare const selectOriginalValue: ((state: RootState, step: GBaseStep) => any) & import("reselect").OutputSelectorFields<(args_0: ValuesStore, args_1: GBaseStep) => any, {
7
+ clearCache: () => void;
8
+ }> & {
9
+ clearCache: () => void;
10
+ };
5
11
  export interface StepDependency {
6
12
  originalValue: any;
7
13
  isDependency: boolean;
@@ -18,7 +18,7 @@ var selectIsDependency = createSelector([
18
18
  ], function (dependencies, step) {
19
19
  return dependencies[step.id] !== undefined;
20
20
  });
21
- var selectOriginalValue = createSelector([
21
+ export var selectOriginalValue = createSelector([
22
22
  function (state) { return state.site.values; },
23
23
  function (state, step) { return step; },
24
24
  ], function (values, step) { var _a; return (_a = values.sections[step.idSection]) === null || _a === void 0 ? void 0 : _a[step.id]; });
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.13-test",
4
+ "version":"2.0.15-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",