@arquimedes.co/eureka-forms 1.9.22-test → 1.9.23-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 +2 -0
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.d.ts +1 -1
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +11 -5
- package/dist/FormComponents/Form/Form.d.ts +1 -0
- package/dist/FormComponents/Step/@Construction/CBRPropertyStep/CBRPropertyStep.js +7 -1
- package/package.json +1 -1
package/dist/App.d.ts
CHANGED
|
@@ -27,6 +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
|
+
/** Custom submit buttons */
|
|
31
|
+
customSubmit?: JSX.Element;
|
|
30
32
|
/** Function to call on postview to fetch the download url of a file */
|
|
31
33
|
fetchDownloadUrl?: (S3Key: string, fileName: string) => Promise<string>;
|
|
32
34
|
/** Function to call after the confimation dialog has been closed */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormComponentProps } from '../Form';
|
|
3
|
-
declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, sendLabel, widthStats, customSteps, customSend, handleLoaded, originalValues, ...others }: FormComponentProps): JSX.Element;
|
|
3
|
+
declare function ColumnForm({ form, apiKey, reload, domain, postview, internal, formStyle, sendLabel, widthStats, customSteps, customSend, customSubmit, handleLoaded, originalValues, ...others }: FormComponentProps): JSX.Element;
|
|
4
4
|
export default ColumnForm;
|
|
@@ -57,7 +57,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
57
57
|
return t;
|
|
58
58
|
};
|
|
59
59
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
60
|
-
import { useEffect, useRef, useState } from 'react';
|
|
60
|
+
import { cloneElement, useEffect, useRef, useState } from 'react';
|
|
61
61
|
import ReCAPTCHA from 'react-google-recaptcha';
|
|
62
62
|
import SectionComponent from '../../Section/Section';
|
|
63
63
|
import { useForm } from 'react-hook-form';
|
|
@@ -72,7 +72,7 @@ import widgetInstance from '../../../AxiosWidget';
|
|
|
72
72
|
import React from 'react';
|
|
73
73
|
function ColumnForm(_a) {
|
|
74
74
|
var _this = this;
|
|
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, handleLoaded = _a.handleLoaded, originalValues = _a.originalValues, others = __rest(_a, ["form", "apiKey", "reload", "domain", "postview", "internal", "formStyle", "sendLabel", "widthStats", "customSteps", "customSend", "handleLoaded", "originalValues"]);
|
|
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
76
|
var _b = useState(false), tempError = _b[0], setTempError = _b[1];
|
|
77
77
|
var _c = useState(calcDependencies(form.steps, originalValues)), dependencyStore = _c[0], setDependencyStore = _c[1];
|
|
78
78
|
var _d = useForm({
|
|
@@ -163,7 +163,7 @@ function ColumnForm(_a) {
|
|
|
163
163
|
(originalValues === null || originalValues === void 0 ? void 0 : originalValues['INTERNAL_CREATING_AGENT']) === undefined && (_jsx("div", __assign({ className: styles.termsContainer, style: {
|
|
164
164
|
width: (form.size.blockSize + form.size.spacingSize) *
|
|
165
165
|
form.size.blockNum,
|
|
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' })), _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 () {
|
|
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 () {
|
|
167
167
|
var valid, captcha;
|
|
168
168
|
return __generator(this, function (_a) {
|
|
169
169
|
switch (_a.label) {
|
|
@@ -196,8 +196,14 @@ function ColumnForm(_a) {
|
|
|
196
196
|
background: formStyle.primaryColor,
|
|
197
197
|
color: formStyle.primaryContrastColor,
|
|
198
198
|
}, disabled: loading }, { children: [_jsx("div", __assign({ style: {
|
|
199
|
-
visibility: loading
|
|
200
|
-
|
|
199
|
+
visibility: loading
|
|
200
|
+
? 'hidden'
|
|
201
|
+
: 'visible',
|
|
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, {
|
|
204
|
+
onSubmit: onSubmit,
|
|
205
|
+
loading: loading,
|
|
206
|
+
})] }))] })));
|
|
201
207
|
}
|
|
202
208
|
export default ColumnForm;
|
|
203
209
|
function calcNextSection(form, idSection, sections) {
|
|
@@ -14,6 +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
|
+
customSubmit?: JSX.Element;
|
|
17
18
|
widthStats: WidthStats;
|
|
18
19
|
internal: boolean;
|
|
19
20
|
reload: Function;
|
|
@@ -116,7 +116,13 @@ function CBRPropertyStepComponent(props) {
|
|
|
116
116
|
var time = today.getTime() - date.getTime();
|
|
117
117
|
var days = time / (1000 * 3600 * 24);
|
|
118
118
|
if (days > props.step.validation.maxDays) {
|
|
119
|
-
setShowWarning(date)
|
|
119
|
+
setShowWarning(new Date(date.getTime() +
|
|
120
|
+
(props.step.validation
|
|
121
|
+
.maxDays +
|
|
122
|
+
1) *
|
|
123
|
+
1000 *
|
|
124
|
+
3600 *
|
|
125
|
+
24));
|
|
120
126
|
}
|
|
121
127
|
}
|
|
122
128
|
}
|
package/package.json
CHANGED