@arquimedes.co/eureka-forms 1.9.51-test → 1.9.53-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/@Types/Form.d.ts +9 -13
- package/dist/App.d.ts +1 -1
- package/dist/App.js +3 -3
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +2 -4
- package/dist/FormComponents/Form/Form.d.ts +1 -1
- package/dist/FormComponents/Form/Form.js +9 -11
- package/dist/FormComponents/Step/ClassifierSelectorStep/MaterialClassifierSelectorStep/MaterialClassifierSelectorStep.js +6 -5
- package/package.json +1 -1
package/dist/@Types/Form.d.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
import { FormStyleTypes, FormTypes } from '../constants/FormStepTypes';
|
|
2
2
|
import { FormStep } from './FormStep';
|
|
3
3
|
export interface Form {
|
|
4
|
-
apiKey
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
name?: string;
|
|
5
6
|
sections: Record<string, Section>;
|
|
6
7
|
steps: Record<string, FormStep>;
|
|
7
|
-
firstSection: string;
|
|
8
|
-
name: string;
|
|
9
|
-
type: FormTypes;
|
|
10
|
-
description: string;
|
|
11
|
-
isInternal: boolean;
|
|
12
|
-
isPublic: boolean;
|
|
13
|
-
hasCaptcha: boolean;
|
|
14
|
-
url: string;
|
|
15
|
-
isStandAlone: boolean;
|
|
16
|
-
style: FormStyle;
|
|
17
|
-
classifiers: Record<string, ParentClassifier>;
|
|
18
|
-
terms: Term[];
|
|
19
8
|
size: FormSize;
|
|
9
|
+
firstSection: string;
|
|
10
|
+
type?: FormTypes;
|
|
11
|
+
hasCaptcha?: boolean;
|
|
12
|
+
isStandAlone?: boolean;
|
|
13
|
+
style?: FormStyle;
|
|
14
|
+
classifiers?: Record<string, ParentClassifier>;
|
|
15
|
+
terms?: Term[];
|
|
20
16
|
}
|
|
21
17
|
export interface FormSize {
|
|
22
18
|
blockNum: 1 | 2 | 3 | 4;
|
package/dist/App.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export interface AppProps {
|
|
|
26
26
|
/** Custom steps to display */
|
|
27
27
|
customSteps?: Record<string, CustomStep>;
|
|
28
28
|
/** Custom function to call on send */
|
|
29
|
-
customSend?: (values: any, reload: Function) => Promise<void>;
|
|
29
|
+
customSend?: (values: any, reload: Function, setLoading: (loading: boolean) => void) => Promise<void>;
|
|
30
30
|
/** Custom submit buttons */
|
|
31
31
|
customSubmit?: JSX.Element;
|
|
32
32
|
/** Function to call on postview to fetch the download url of a file */
|
package/dist/App.js
CHANGED
|
@@ -161,7 +161,7 @@ function App(_a) {
|
|
|
161
161
|
LogRocket.default.identify(organizationInfo.idOrganization + '/' + apiKey, {
|
|
162
162
|
name: organizationInfo.name +
|
|
163
163
|
'/' +
|
|
164
|
-
(form ? form === null || form === void 0 ? void 0 : form.name : '404'),
|
|
164
|
+
((form === null || form === void 0 ? void 0 : form.name) ? form === null || form === void 0 ? void 0 : form.name : '404'),
|
|
165
165
|
});
|
|
166
166
|
return [3 /*break*/, 4];
|
|
167
167
|
case 3:
|
|
@@ -406,7 +406,7 @@ var mapOriginalValues = function (originalValues, form) {
|
|
|
406
406
|
return newValues;
|
|
407
407
|
};
|
|
408
408
|
var mapOriginalValue = function (step, value, form) {
|
|
409
|
-
var _a, _b;
|
|
409
|
+
var _a, _b, _c;
|
|
410
410
|
switch (step === null || step === void 0 ? void 0 : step.type) {
|
|
411
411
|
case StepTypes.TEXTAREA: {
|
|
412
412
|
if (step.hasTextEditor) {
|
|
@@ -421,7 +421,7 @@ var mapOriginalValue = function (step, value, form) {
|
|
|
421
421
|
return value;
|
|
422
422
|
}
|
|
423
423
|
case StepTypes.CLASSIFIER_SELECTOR: {
|
|
424
|
-
var classifier = form.classifiers[(
|
|
424
|
+
var classifier = (_b = form.classifiers) === null || _b === void 0 ? void 0 : _b[(_c = step.idClassifier) !== null && _c !== void 0 ? _c : ''];
|
|
425
425
|
if (classifier) {
|
|
426
426
|
var option = classifier.children.find(function (child) { return child._id == value; });
|
|
427
427
|
if (!(value === null || value === void 0 ? void 0 : value.value))
|
|
@@ -119,10 +119,8 @@ function ColumnForm(_a) {
|
|
|
119
119
|
newValues[idStep] = calcValue(idStep, form.steps, values, customSteps);
|
|
120
120
|
}
|
|
121
121
|
if (!customSend) return [3 /*break*/, 4];
|
|
122
|
-
return [4 /*yield*/, customSend(newValues, reload)];
|
|
123
|
-
case 3:
|
|
124
|
-
_c.sent();
|
|
125
|
-
return [3 /*break*/, 9];
|
|
122
|
+
return [4 /*yield*/, customSend(newValues, reload, setLoading)];
|
|
123
|
+
case 3: return [2 /*return*/, _c.sent()];
|
|
126
124
|
case 4:
|
|
127
125
|
payload = {
|
|
128
126
|
formValues: { steps: newValues },
|
|
@@ -13,7 +13,7 @@ export interface FormComponentProps {
|
|
|
13
13
|
organization: Organization;
|
|
14
14
|
originalValues: Record<string, unknown>;
|
|
15
15
|
customSteps: Record<string, CustomStep>;
|
|
16
|
-
customSend?: (values: any, reload: Function) => Promise<void>;
|
|
16
|
+
customSend?: (values: any, reload: Function, setLoading: (loading: boolean) => void) => Promise<void>;
|
|
17
17
|
customSubmit?: JSX.Element;
|
|
18
18
|
widthStats: WidthStats;
|
|
19
19
|
internal: boolean;
|
|
@@ -48,10 +48,10 @@ export var getLocale = function () {
|
|
|
48
48
|
navigator.browserLanguage]) !== null && _a !== void 0 ? _a : localeMap.es);
|
|
49
49
|
};
|
|
50
50
|
function FormComponent(_a) {
|
|
51
|
-
var _b, _c;
|
|
51
|
+
var _b, _c, _d, _e, _f, _g;
|
|
52
52
|
var form = _a.form, isWidget = _a.isWidget, internal = _a.internal, postview = _a.postview, organization = _a.organization, containerRef = _a.containerRef, others = __rest(_a, ["form", "isWidget", "internal", "postview", "organization", "containerRef"]);
|
|
53
|
-
var
|
|
54
|
-
var
|
|
53
|
+
var _h = useState(false), loaded = _h[0], setLoaded = _h[1];
|
|
54
|
+
var _j = useState(undefined), widthStats = _j[0], setWidthStats = _j[1];
|
|
55
55
|
/** Calcs the currentBreakPoint and if is mobile */
|
|
56
56
|
var handleResize = function () {
|
|
57
57
|
var _a;
|
|
@@ -88,7 +88,7 @@ function FormComponent(_a) {
|
|
|
88
88
|
if ((postview || internal || !form.isStandAlone) &&
|
|
89
89
|
widthStats !== undefined) {
|
|
90
90
|
return (_jsx("div", __assign({ style: {
|
|
91
|
-
backgroundColor: internal
|
|
91
|
+
backgroundColor: internal || !form.style
|
|
92
92
|
? InternalFormStyle.backgroundColor
|
|
93
93
|
: form.style.backgroundColor,
|
|
94
94
|
minHeight: form.isStandAlone && !isWidget ? '100vh' : '100%',
|
|
@@ -96,16 +96,16 @@ function FormComponent(_a) {
|
|
|
96
96
|
setLoaded(true);
|
|
97
97
|
}, widthStats: widthStats, form: form, internal: internal, postview: postview, organization: organization, formStyle: internal
|
|
98
98
|
? InternalFormStyle
|
|
99
|
-
: __assign(__assign({}, InternalFormStyle), form.style) })) })) })));
|
|
99
|
+
: __assign(__assign({}, InternalFormStyle), ((_c = form.style) !== null && _c !== void 0 ? _c : {})) })) })) })));
|
|
100
100
|
}
|
|
101
101
|
else if (organization && widthStats !== undefined) {
|
|
102
102
|
//Standalone cant have widget
|
|
103
|
-
return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: organization.logoUrl, color: (
|
|
103
|
+
return (_jsxs(React.Fragment, { children: [_jsx(Navbar, { logo: organization.logoUrl, color: (_d = organization.styles) === null || _d === void 0 ? void 0 : _d.primaryColor }), _jsx("div", __assign({ className: styles.standAloneFormContainer, ref: containerRef }, { children: _jsx("div", __assign({ className: widthStats.isResponsive
|
|
104
104
|
? styles.fullScreenStandAloneForm
|
|
105
105
|
: styles.standAloneFormCard, style: {
|
|
106
|
-
backgroundColor: form.style.backgroundColor,
|
|
106
|
+
backgroundColor: (_f = (_e = form.style) === null || _e === void 0 ? void 0 : _e.backgroundColor) !== null && _f !== void 0 ? _f : InternalFormStyle.backgroundColor,
|
|
107
107
|
visibility: loaded ? 'visible' : 'hidden',
|
|
108
|
-
} }, { children: _jsx(FormTypeComponent, __assign({}, others, { internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: form.style, organization: organization, handleLoaded: function () {
|
|
108
|
+
} }, { children: _jsx(FormTypeComponent, __assign({}, others, { internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: (_g = form.style) !== null && _g !== void 0 ? _g : InternalFormStyle, organization: organization, handleLoaded: function () {
|
|
109
109
|
setLoaded(true);
|
|
110
110
|
} })) })) }))] }));
|
|
111
111
|
}
|
|
@@ -126,12 +126,10 @@ function FormTypeComponent(_a) {
|
|
|
126
126
|
var props = __rest(_a, []);
|
|
127
127
|
var renderTypes = function () {
|
|
128
128
|
switch (props.form.type) {
|
|
129
|
-
case FormTypes.COLUMN: {
|
|
130
|
-
return _jsx(ColumnForm, __assign({}, props));
|
|
131
|
-
}
|
|
132
129
|
case FormTypes.STEPPER: {
|
|
133
130
|
return _jsx(StepperForm, __assign({}, props));
|
|
134
131
|
}
|
|
132
|
+
case FormTypes.COLUMN:
|
|
135
133
|
default: {
|
|
136
134
|
return _jsx(ColumnForm, __assign({}, props));
|
|
137
135
|
}
|
|
@@ -30,14 +30,15 @@ import { Controller } from 'react-hook-form';
|
|
|
30
30
|
import { calcFillerSize, calcStepWidth } from '../../StepFunctions';
|
|
31
31
|
import RoundedSmartSelect from '../../../../shared/RoundedSmartSelect/RoundedSmartSelect';
|
|
32
32
|
function ClassifierSelector(_a) {
|
|
33
|
+
var _b;
|
|
33
34
|
var step = _a.step, form = _a.form, level = _a.level, errors = _a.errors, value = _a.value, onBlur = _a.onBlur, control = _a.control, editable = _a.editable, onChange = _a.onChange, postview = _a.postview, inputRef = _a.inputRef, formStyle = _a.formStyle, getValues = _a.getValues, widthStats = _a.widthStats, handleSizeChange = _a.handleSizeChange, others = __rest(_a, ["step", "form", "level", "errors", "value", "onBlur", "control", "editable", "onChange", "postview", "inputRef", "formStyle", "getValues", "widthStats", "handleSizeChange"]);
|
|
34
|
-
var
|
|
35
|
+
var _c = useState(level === 0
|
|
35
36
|
? calcFillerSize(step, form.steps, getValues(), form.size)
|
|
36
|
-
: 0), fillerSize =
|
|
37
|
+
: 0), fillerSize = _c[0], setFillerSize = _c[1];
|
|
37
38
|
if (!step.idClassifier) {
|
|
38
39
|
return _jsx("div", {});
|
|
39
40
|
}
|
|
40
|
-
var classifier = form.classifiers[step.idClassifier];
|
|
41
|
+
var classifier = (_b = form.classifiers) === null || _b === void 0 ? void 0 : _b[step.idClassifier];
|
|
41
42
|
if (!classifier) {
|
|
42
43
|
return _jsx("div", {});
|
|
43
44
|
}
|
|
@@ -49,11 +50,11 @@ function ClassifierSelector(_a) {
|
|
|
49
50
|
: classifier === null || classifier === void 0 ? void 0 : classifier._id]) === null || _a === void 0 ? void 0 : _a.type) !== ClassifierOptionTypes.HIDE;
|
|
50
51
|
})
|
|
51
52
|
.map(function (classifier) {
|
|
52
|
-
var _a;
|
|
53
|
+
var _a, _b;
|
|
53
54
|
return typeof classifier === 'string'
|
|
54
55
|
? {
|
|
55
56
|
value: classifier,
|
|
56
|
-
label: (_a = form.classifiers[classifier]) === null ||
|
|
57
|
+
label: (_b = (_a = form.classifiers) === null || _a === void 0 ? void 0 : _a[classifier]) === null || _b === void 0 ? void 0 : _b.name,
|
|
57
58
|
}
|
|
58
59
|
: { value: classifier._id, label: classifier.name };
|
|
59
60
|
});
|
package/package.json
CHANGED