@arquimedes.co/eureka-forms 2.0.3-test → 2.0.4-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,8 +3,11 @@ import { StepProps } from './Step';
3
3
  import { Form } from '../@Types';
4
4
  import { GlobalState } from '../States/GlobalStateReducer';
5
5
  import { WidthStats } from '../Form/Form';
6
- export interface CustomStepProps extends StepProps, GlobalState {
6
+ import { StepDependency } from './StepHooks';
7
+ import { SiteState } from '../States/SiteStateReducer';
8
+ export interface CustomStepProps extends StepProps, GlobalState, StepDependency {
7
9
  form: Form;
10
+ dependencyStore: SiteState['dependencies'];
8
11
  customStepProps: Record<string, any>;
9
12
  widthStats: WidthStats;
10
13
  }
@@ -24,13 +24,16 @@ import FormContext from '../Contexts/FormContext';
24
24
  import { useAppSelector } from '../hooks';
25
25
  import CustomStepPropsContext from '../Contexts/CustomContext';
26
26
  import { useContext } from 'react';
27
+ import { useStepDependency } from './StepHooks';
27
28
  function CustomStepComponent(_a) {
28
29
  var _b;
29
30
  var customStep = _a.customStep, props = __rest(_a, ["customStep"]);
30
31
  var form = useContext(FormContext);
31
32
  var global = useAppSelector(function (state) { return state.global; });
32
33
  var customStepProps = useContext(CustomStepPropsContext);
34
+ var dependencyStore = useAppSelector(function (state) { return state.site.dependencies; });
33
35
  var widthStats = useAppSelector(function (state) { return state.widthStats; });
34
- return customStep.component(__assign(__assign(__assign(__assign({}, props), { widthStats: widthStats, form: form, customStepProps: customStepProps }), global), ((_b = customStep.componentProps) !== null && _b !== void 0 ? _b : {})));
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 : {})));
35
38
  }
36
39
  export default CustomStepComponent;
@@ -1,11 +1,12 @@
1
1
  import { GBaseStep } from '../@Types/GenericFormSteps';
2
2
  import { Form } from '../@Types';
3
3
  import { DependencyStore } from '../Form/Form';
4
- export declare const useStepDependency: (step: GBaseStep, defaultValue?: any) => {
4
+ export interface StepDependency {
5
5
  originalValue: any;
6
6
  isDependency: boolean;
7
7
  handleStepDep: (value: any | undefined) => void;
8
- };
8
+ }
9
+ export declare const useStepDependency: (step: GBaseStep, defaultValue?: any) => StepDependency;
9
10
  export declare const selectDependencies: ((state: {
10
11
  global: import("../States/GlobalStateReducer").GlobalState;
11
12
  site: import("../States/SiteStateReducer").SiteState;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version":"2.0.3-test",
4
+ "version":"2.0.4-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",
8
8
  "lint": "eslint 'src/**/*.ts'",
9
9
  "test": "react-scripts test",
10
- "test-ci": "react-scripts test --reporters=default --reporters=jest-junit --coverage",
10
+ "test-ci": "react-scripts test --reporters=default --reporters=jest-junit --coverage --coverageReporters cobertura html",
11
11
  "tsc-build": "tsc --noEmit false --outDir ./dist --incremental false",
12
12
  "watch": "tsc --build -w --preserveWatchOutput",
13
13
  "storybook": "storybook dev -p 6006",