@arquimedes.co/eureka-forms 0.2.10-test → 0.2.11-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.
package/dist/App.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { Form } from './@Types/Form';
3
- interface AppProps {
3
+ export interface AppProps {
4
4
  /** If the app is currently a widget */
5
5
  isWidget?: boolean;
6
6
  /** The apikey of the Form */
@@ -18,7 +18,11 @@ interface AppProps {
18
18
  /** The data to fill the form with */
19
19
  valuesData?: Record<string, unknown>;
20
20
  /** Custom steps to display */
21
- customSteps?: Record<string, JSX.Element>;
21
+ customSteps?: Record<string, CustomStep>;
22
+ }
23
+ export interface CustomStep {
24
+ component: JSX.Element;
25
+ updateValue: (idStep: string, values: Record<string, any>, form: Form) => void;
22
26
  }
23
27
  declare function App({ apiKey, domain, preview, formData, postview, isWidget, internal, valuesData, customSteps, ...others }: AppProps): JSX.Element;
24
28
  export default App;
@@ -99,7 +99,7 @@ function ColumnForm(_a) {
99
99
  setLoading(true);
100
100
  for (_i = 0, _a = Object.keys(values); _i < _a.length; _i++) {
101
101
  idStep = _a[_i];
102
- updateValue(idStep, values, form);
102
+ updateValue(idStep, values, form, customSteps);
103
103
  }
104
104
  url = "https://" + domain + ".forms." + process.env.REACT_APP_DOMAIN + "/api/ticket?apiKey=" + (internal ? form.apiKey : apiKey) + "&domain=" + domain;
105
105
  console.log(values);
@@ -157,7 +157,7 @@ function calcNextSection(form, idSection, sections) {
157
157
  }
158
158
  }
159
159
  }
160
- var updateValue = function (idStep, values, form) {
160
+ var updateValue = function (idStep, values, form, customSteps) {
161
161
  var step = form.steps[idStep];
162
162
  switch (step === null || step === void 0 ? void 0 : step.type) {
163
163
  case Types.TEXTAREA: {
@@ -178,6 +178,10 @@ var updateValue = function (idStep, values, form) {
178
178
  break;
179
179
  }
180
180
  default:
181
+ var custom = customSteps[idStep];
182
+ if (custom !== undefined) {
183
+ custom.updateValue(idStep, values, form);
184
+ }
181
185
  break;
182
186
  }
183
187
  };
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Organization } from '../../@Types/@Types';
3
3
  import { Form, FormStyle } from '../../@Types/Form';
4
+ import { CustomStep } from '../../App';
4
5
  export interface WidthStats {
5
6
  currentBreakPoint: number;
6
7
  isMobile: boolean;
@@ -8,7 +9,7 @@ export interface WidthStats {
8
9
  export interface FormComponentProps {
9
10
  form: Form;
10
11
  originalValues: Record<string, unknown>;
11
- customSteps: Record<string, JSX.Element>;
12
+ customSteps: Record<string, CustomStep>;
12
13
  widthStats: WidthStats;
13
14
  internal: boolean;
14
15
  reload: Function;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Control, FieldValues, UseFormGetValues } from 'react-hook-form';
3
3
  import { Form, FormStyle, Section } from '../../@Types/Form';
4
+ import { CustomStep } from '../../App';
4
5
  import { WidthStats } from '../Form/Form';
5
6
  export interface RecursiveData {
6
7
  form: Form;
@@ -13,7 +14,7 @@ export interface RecursiveData {
13
14
  clearErrors: Function;
14
15
  getValues: UseFormGetValues<FieldValues>;
15
16
  originalValues: Record<string, any>;
16
- customSteps: Record<string, JSX.Element>;
17
+ customSteps: Record<string, CustomStep>;
17
18
  }
18
19
  export interface SectionComponentProps extends RecursiveData {
19
20
  section: Section;
@@ -63,7 +63,7 @@ function StepComponent(_a) {
63
63
  var customStep = props.customSteps[step.type];
64
64
  console.log(customStep);
65
65
  if (customStep) {
66
- return React.cloneElement(customStep, __assign({ step: step }, props));
66
+ return React.cloneElement(customStep.component, __assign({ step: step }, props));
67
67
  }
68
68
  else {
69
69
  return _jsx("div", {}, void 0);
@@ -1,3 +1,6 @@
1
- import App from './App';
2
- export { App };
3
- export default App;
1
+ import EurekaForm, { AppProps as EurekaFormProps } from './App';
2
+ import { StepProps } from './FormComponents/Step/Step';
3
+ import * as StepFunctions from './FormComponents/Step/StepFunctions';
4
+ export type { StepProps, EurekaFormProps };
5
+ export { EurekaForm, StepFunctions };
6
+ export default EurekaForm;
package/dist/index.lib.js CHANGED
@@ -1,3 +1,4 @@
1
- import App from './App';
2
- export { App };
3
- export default App;
1
+ import EurekaForm from './App';
2
+ import * as StepFunctions from './FormComponents/Step/StepFunctions';
3
+ export { EurekaForm, StepFunctions };
4
+ export default EurekaForm;
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": "0.2.10-test",
4
+ "version": "0.2.11-test",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",