@arquimedes.co/eureka-forms 1.9.26-test → 1.9.27-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
|
@@ -27,10 +27,8 @@ export interface AppProps {
|
|
|
27
27
|
customSteps?: Record<string, CustomStep>;
|
|
28
28
|
/** Custom function to call on send */
|
|
29
29
|
customSend?: (values: any, reload: Function) => Promise<void>;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
submit?: JSX.Element;
|
|
33
|
-
};
|
|
30
|
+
/** Custom submit buttons */
|
|
31
|
+
customSubmit?: JSX.Element;
|
|
34
32
|
/** Function to call on postview to fetch the download url of a file */
|
|
35
33
|
fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
|
|
36
34
|
/** Function to call after the confimation dialog has been closed */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Form } from '../../../@Types/Form';
|
|
3
3
|
import { FormComponentProps } from '../Form';
|
|
4
|
-
declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, sendLabel, widthStats, customSteps, customSend,
|
|
4
|
+
declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, sendLabel, widthStats, customSteps, customSend, customSubmit, handleLoaded, originalValues, ...others }: FormComponentProps): JSX.Element;
|
|
5
5
|
export default ColumnForm;
|
|
6
6
|
export declare const mapOriginalValues: (originalValues: Record<string, any>, form: Form) => any;
|
|
@@ -72,19 +72,18 @@ import widgetInstance from '../../../AxiosWidget';
|
|
|
72
72
|
import React from 'react';
|
|
73
73
|
function ColumnForm(_a) {
|
|
74
74
|
var _this = this;
|
|
75
|
-
var
|
|
76
|
-
var
|
|
77
|
-
var _c = useState(
|
|
78
|
-
var _d =
|
|
79
|
-
var _e = (_b = customForm === null || customForm === void 0 ? void 0 : customForm.form) !== null && _b !== void 0 ? _b : useForm({
|
|
75
|
+
var form = _a.form, apiKey = _a.apiKey, reload = _a.reload, domain = _a.domain, postview = _a.postview, internal = _a.internal, formStyle = _a.formStyle, sendLabel = _a.sendLabel, widthStats = _a.widthStats, customSteps = _a.customSteps, customSend = _a.customSend, customSubmit = _a.customSubmit, handleLoaded = _a.handleLoaded, originalValues = _a.originalValues, others = __rest(_a, ["form", "apiKey", "reload", "domain", "postview", "internal", "formStyle", "sendLabel", "widthStats", "customSteps", "customSend", "customSubmit", "handleLoaded", "originalValues"]);
|
|
76
|
+
var _b = useState(false), tempError = _b[0], setTempError = _b[1];
|
|
77
|
+
var _c = useState(calcDependencies(form.steps, originalValues)), dependencyStore = _c[0], setDependencyStore = _c[1];
|
|
78
|
+
var _d = useForm({
|
|
80
79
|
defaultValues: mapOriginalValues(originalValues, form),
|
|
81
80
|
mode: 'onTouched',
|
|
82
81
|
shouldFocusError: true,
|
|
83
|
-
}), getValues =
|
|
82
|
+
}), getValues = _d.getValues, setValue = _d.setValue, clearErrors = _d.clearErrors, control = _d.control, errors = _d.formState.errors, trigger = _d.trigger;
|
|
84
83
|
var recaptchaRef = useRef();
|
|
85
|
-
var
|
|
86
|
-
var
|
|
87
|
-
var
|
|
84
|
+
var _e = useState(undefined), sections = _e[0], setSections = _e[1];
|
|
85
|
+
var _f = useState(false), loading = _f[0], setLoading = _f[1];
|
|
86
|
+
var _g = useState(), showConfirmation = _g[0], setShowConfirmation = _g[1];
|
|
88
87
|
useEffect(function () {
|
|
89
88
|
var tempSections = [];
|
|
90
89
|
calcNextSection(form, form.firstSection, tempSections);
|
|
@@ -164,7 +163,7 @@ function ColumnForm(_a) {
|
|
|
164
163
|
(originalValues === null || originalValues === void 0 ? void 0 : originalValues['INTERNAL_CREATING_AGENT']) === undefined && (_jsx("div", __assign({ className: styles.termsContainer, style: {
|
|
165
164
|
width: (form.size.blockSize + form.size.spacingSize) *
|
|
166
165
|
form.size.blockNum,
|
|
167
|
-
} }, { children: form.terms.map(function (term, index) { return (_jsx(TermComponent, { setValue: setValue, postview: postview, tempError: tempError, term: term, control: control, errors: errors, form: form, formStyle: formStyle }, index)); }) }))), !postview && others.editable && (_jsxs(React.Fragment, { children: [form.hasCaptcha && !internal && (_jsx(ReCAPTCHA, { ref: recaptchaRef, sitekey: "6LcL22kkAAAAAEotDeAFbRATob-u5vbibbCyWL2p", size: 'invisible', badge: 'bottomright' })), !
|
|
166
|
+
} }, { children: form.terms.map(function (term, index) { return (_jsx(TermComponent, { setValue: setValue, postview: postview, tempError: tempError, term: term, control: control, errors: errors, form: form, formStyle: formStyle }, index)); }) }))), !postview && others.editable && (_jsxs(React.Fragment, { children: [form.hasCaptcha && !internal && (_jsx(ReCAPTCHA, { ref: recaptchaRef, sitekey: "6LcL22kkAAAAAEotDeAFbRATob-u5vbibbCyWL2p", size: 'invisible', badge: 'bottomright' })), !customSubmit && (_jsx("div", __assign({ className: styles.submitBtnContainer }, { children: _jsxs("button", __assign({ "data-testid": "form__submit", className: styles.submitBtn, onClick: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
168
167
|
var valid, captcha;
|
|
169
168
|
return __generator(this, function (_a) {
|
|
170
169
|
switch (_a.label) {
|
|
@@ -200,8 +199,8 @@ function ColumnForm(_a) {
|
|
|
200
199
|
visibility: loading
|
|
201
200
|
? 'hidden'
|
|
202
201
|
: 'visible',
|
|
203
|
-
} }, { children: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar' })), loading && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) })))] })) }))),
|
|
204
|
-
cloneElement(
|
|
202
|
+
} }, { children: sendLabel !== null && sendLabel !== void 0 ? sendLabel : 'Enviar' })), loading && (_jsx("div", __assign({ className: styles.loaderContainer }, { children: _jsx(Loader, { color: formStyle.primaryContrastColor, position: "unset" }) })))] })) }))), customSubmit &&
|
|
203
|
+
cloneElement(customSubmit, {
|
|
205
204
|
onSubmit: onSubmit,
|
|
206
205
|
loading: loading,
|
|
207
206
|
})] }))] })));
|
|
@@ -14,10 +14,7 @@ export interface FormComponentProps {
|
|
|
14
14
|
originalValues: Record<string, unknown>;
|
|
15
15
|
customSteps: Record<string, CustomStep>;
|
|
16
16
|
customSend?: (values: any, reload: Function) => Promise<void>;
|
|
17
|
-
|
|
18
|
-
form?: any;
|
|
19
|
-
submit?: JSX.Element;
|
|
20
|
-
};
|
|
17
|
+
customSubmit?: JSX.Element;
|
|
21
18
|
widthStats: WidthStats;
|
|
22
19
|
internal: boolean;
|
|
23
20
|
reload: Function;
|
package/package.json
CHANGED