@arquimedes.co/eureka-forms 0.2.9-test → 0.2.12-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 +7 -3
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +6 -2
- package/dist/FormComponents/Form/Form.d.ts +2 -1
- package/dist/FormComponents/Section/Section.d.ts +2 -1
- package/dist/FormComponents/Step/Step.js +1 -2
- package/dist/index.lib.d.ts +6 -3
- package/dist/index.lib.js +4 -3
- package/package.json +1 -1
package/dist/App.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from '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,
|
|
21
|
+
customSteps?: Record<string, CustomStep>;
|
|
22
|
+
}
|
|
23
|
+
export interface CustomStep {
|
|
24
|
+
component: ReactNode;
|
|
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,
|
|
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,
|
|
17
|
+
customSteps: Record<string, CustomStep>;
|
|
17
18
|
}
|
|
18
19
|
export interface SectionComponentProps extends RecursiveData {
|
|
19
20
|
section: Section;
|
|
@@ -30,7 +30,6 @@ import ClassifierSelectorStep from './ClassifierSelectorStep/ClassifierSelectorS
|
|
|
30
30
|
import TextAreaStep from './TextAreaStep/TextAreaStep';
|
|
31
31
|
import DatePickerStep from './DatePickerStep/DatePickerStep';
|
|
32
32
|
import FileUploadStep from './FileUploadStep/FileUploadStep';
|
|
33
|
-
import React from 'react';
|
|
34
33
|
function StepComponent(_a) {
|
|
35
34
|
var step = _a.step, props = __rest(_a, ["step"]);
|
|
36
35
|
switch (step.type) {
|
|
@@ -63,7 +62,7 @@ function StepComponent(_a) {
|
|
|
63
62
|
var customStep = props.customSteps[step.type];
|
|
64
63
|
console.log(customStep);
|
|
65
64
|
if (customStep) {
|
|
66
|
-
return
|
|
65
|
+
return customStep.component(__assign({ step: step }, props));
|
|
67
66
|
}
|
|
68
67
|
else {
|
|
69
68
|
return _jsx("div", {}, void 0);
|
package/dist/index.lib.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
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
|
|
2
|
-
|
|
3
|
-
export
|
|
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