@arquimedes.co/eureka-forms 1.5.9 → 1.6.1
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.js +2 -2
- package/dist/FormComponents/Form/Form.d.ts +1 -0
- package/dist/FormComponents/Form/Form.js +2 -2
- package/dist/FormComponents/Section/Section.d.ts +2 -0
- package/dist/FormComponents/Step/@Construction/CBRLocativasStep/CBRLocativasStep.js +5 -5
- package/dist/FormComponents/Step/CBRStepMapper.js +15 -11
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +5 -5
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.d.ts +1 -1
- package/package.json +1 -1
package/dist/App.js
CHANGED
|
@@ -109,7 +109,7 @@ function App(_a) {
|
|
|
109
109
|
loadInfo(apiKey, domain);
|
|
110
110
|
}
|
|
111
111
|
else if (isWidget && apiKey && domain) {
|
|
112
|
-
//Is
|
|
112
|
+
//Is widget
|
|
113
113
|
loadOrgInfo(domain);
|
|
114
114
|
loadInfo(apiKey, domain);
|
|
115
115
|
}
|
|
@@ -257,7 +257,7 @@ function App(_a) {
|
|
|
257
257
|
if (handleConfirmed) {
|
|
258
258
|
handleConfirmed();
|
|
259
259
|
}
|
|
260
|
-
}, editable: editable, postview: postview === true, internal: internal === true, apiKey: apiKey, domain: domain, customSend: customSend, originalValues: originalValues, containerRef: containerRef, organization: organizationInfo, customSteps: customSteps !== null && customSteps !== void 0 ? customSteps : {} }), void 0) }), void 0));
|
|
260
|
+
}, editable: editable, postview: postview === true, internal: internal === true, apiKey: apiKey, domain: domain, customSend: customSend, originalValues: originalValues, containerRef: containerRef, organization: organizationInfo !== null && organizationInfo !== void 0 ? organizationInfo : { idOrganization: domain }, customSteps: customSteps !== null && customSteps !== void 0 ? customSteps : {} }), void 0) }), void 0));
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
export default App;
|
|
@@ -10,6 +10,7 @@ export interface WidthStats {
|
|
|
10
10
|
}
|
|
11
11
|
export interface FormComponentProps {
|
|
12
12
|
form: Form;
|
|
13
|
+
organization: Organization;
|
|
13
14
|
originalValues: Record<string, unknown>;
|
|
14
15
|
customSteps: Record<string, CustomStep>;
|
|
15
16
|
customSend?: (values: any, reload: Function) => Promise<void>;
|
|
@@ -93,7 +93,7 @@ function FormComponent(_a) {
|
|
|
93
93
|
: form.style.backgroundColor,
|
|
94
94
|
} }, { children: _jsx(FormTypeComponent, __assign({}, others, { handleLoaded: function () {
|
|
95
95
|
setLoaded(true);
|
|
96
|
-
}, widthStats: widthStats, form: form, internal: internal, postview: postview, formStyle: internal ? InternalFormStyle : form.style }), void 0) }), void 0));
|
|
96
|
+
}, widthStats: widthStats, form: form, internal: internal, postview: postview, organization: organization, formStyle: internal ? InternalFormStyle : form.style }), void 0) }), void 0));
|
|
97
97
|
}
|
|
98
98
|
else if (organization && widthStats !== undefined) {
|
|
99
99
|
//Standalone cant have widget
|
|
@@ -102,7 +102,7 @@ function FormComponent(_a) {
|
|
|
102
102
|
: styles.standAloneFormCard, style: {
|
|
103
103
|
backgroundColor: form.style.backgroundColor,
|
|
104
104
|
visibility: loaded ? 'visible' : 'hidden',
|
|
105
|
-
} }, { children: _jsx(FormTypeComponent, __assign({}, others, { internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: form.style, handleLoaded: function () {
|
|
105
|
+
} }, { children: _jsx(FormTypeComponent, __assign({}, others, { internal: internal, postview: postview, widthStats: widthStats, form: form, formStyle: form.style, organization: organization, handleLoaded: function () {
|
|
106
106
|
setLoaded(true);
|
|
107
107
|
} }), void 0) }), void 0) }), void 0)] }, void 0));
|
|
108
108
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Control, FieldValues, UseFormGetValues, UseFormTrigger } from 'react-hook-form';
|
|
3
|
+
import { Organization } from '../../@Types';
|
|
3
4
|
import { Form, FormStyle, Section } from '../../@Types/Form';
|
|
4
5
|
import { CustomStep } from '../../App';
|
|
5
6
|
import { WidthStats } from '../Form/Form';
|
|
6
7
|
export interface RecursiveData {
|
|
7
8
|
form: Form;
|
|
9
|
+
organization: Organization;
|
|
8
10
|
control: Control<FieldValues, object>;
|
|
9
11
|
formStyle: FormStyle;
|
|
10
12
|
/** If the formsteps can be edited (For entities) */
|
|
@@ -57,7 +57,7 @@ function CBRLocativasStep(props) {
|
|
|
57
57
|
marginTop: 2,
|
|
58
58
|
} }, void 0), getOptions: getLocativasOptions, getOptionSelected: function (option, value) {
|
|
59
59
|
return option.id === value.id;
|
|
60
|
-
}, calcDepError: calcDepError, calcInvalidDeps:
|
|
60
|
+
}, calcDepError: calcDepError, calcInvalidDeps: calcInvalidDependencies, valueOverwrite: function (value) {
|
|
61
61
|
if (value) {
|
|
62
62
|
return __assign(__assign({}, value), { subStep: props.step.subStep });
|
|
63
63
|
}
|
|
@@ -82,7 +82,7 @@ function LocativasSubStepRenderer(_a) {
|
|
|
82
82
|
height: 23,
|
|
83
83
|
width: 23,
|
|
84
84
|
marginTop: 2,
|
|
85
|
-
} }, void 0), calcInvalidDeps:
|
|
85
|
+
} }, void 0), calcInvalidDeps: calcInvalidDependencies, getOptions: getLocativasOptions, calcDepError: calcDepError, getOptionSelected: function (option, value) {
|
|
86
86
|
return option.id === value.id;
|
|
87
87
|
}, iconComponent: LeakIconComponent }, { children: _jsx(LocativasSubStepRenderer, {}, void 0) }), void 0));
|
|
88
88
|
}
|
|
@@ -94,7 +94,7 @@ function LeakIconComponent(props) {
|
|
|
94
94
|
marginTop: 2,
|
|
95
95
|
} }, void 0));
|
|
96
96
|
}
|
|
97
|
-
var getLocativasOptions = function (step, dependencyStore) { return __awaiter(void 0, void 0, void 0, function () {
|
|
97
|
+
var getLocativasOptions = function (idOrganization, step, dependencyStore) { return __awaiter(void 0, void 0, void 0, function () {
|
|
98
98
|
var idProyecto, response, father_1, locativasList;
|
|
99
99
|
var _a;
|
|
100
100
|
return __generator(this, function (_b) {
|
|
@@ -105,7 +105,7 @@ var getLocativasOptions = function (step, dependencyStore) { return __awaiter(vo
|
|
|
105
105
|
if (!idProyecto) {
|
|
106
106
|
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
107
107
|
}
|
|
108
|
-
return [4 /*yield*/, axios.get(
|
|
108
|
+
return [4 /*yield*/, axios.get("https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/cbr/ConsultaLocativas?idOrganization=" + idOrganization)];
|
|
109
109
|
case 1:
|
|
110
110
|
response = (_b.sent()).data;
|
|
111
111
|
father_1 = dependencyStore[step.dependencies[1]];
|
|
@@ -131,7 +131,7 @@ var getLocativasOptions = function (step, dependencyStore) { return __awaiter(vo
|
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
}); };
|
|
134
|
-
var
|
|
134
|
+
var calcInvalidDependencies = function (step, dependencyStore) {
|
|
135
135
|
var _a;
|
|
136
136
|
var deps = [];
|
|
137
137
|
if (step.dependencies) {
|
|
@@ -54,14 +54,14 @@ import TextAreaStep from './TextAreaStep/TextAreaStep';
|
|
|
54
54
|
import CBRIncidentsStep from './@Construction/CBRIncidentsStep/CBRIncidentsStep';
|
|
55
55
|
import CBRLocativasStep from './@Construction/CBRLocativasStep/CBRLocativasStep';
|
|
56
56
|
import axios from 'axios';
|
|
57
|
-
var baseUrl =
|
|
57
|
+
var baseUrl = "https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/cbr/";
|
|
58
58
|
function CBRStepMapper(props) {
|
|
59
59
|
var _this = this;
|
|
60
|
-
var getTipoDocOptions = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
60
|
+
var getTipoDocOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
|
|
61
61
|
var response;
|
|
62
62
|
return __generator(this, function (_a) {
|
|
63
63
|
switch (_a.label) {
|
|
64
|
-
case 0: return [4 /*yield*/, axios.get(baseUrl + 'ConsultaTiposDoc?idOrganization=
|
|
64
|
+
case 0: return [4 /*yield*/, axios.get(baseUrl + 'ConsultaTiposDoc?idOrganization=' + idOrganization)];
|
|
65
65
|
case 1:
|
|
66
66
|
response = (_a.sent()).data;
|
|
67
67
|
return [2 /*return*/, response.map(function (option) {
|
|
@@ -70,11 +70,11 @@ function CBRStepMapper(props) {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}); };
|
|
73
|
-
var getProyectoOptions = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
73
|
+
var getProyectoOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
|
|
74
74
|
var response;
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
76
|
switch (_a.label) {
|
|
77
|
-
case 0: return [4 /*yield*/, axios.get(baseUrl + 'Consultaproyectos?idOrganization=
|
|
77
|
+
case 0: return [4 /*yield*/, axios.get(baseUrl + 'Consultaproyectos?idOrganization=' + idOrganization)];
|
|
78
78
|
case 1:
|
|
79
79
|
response = (_a.sent()).data;
|
|
80
80
|
return [2 /*return*/, response.map(function (option) {
|
|
@@ -87,11 +87,13 @@ function CBRStepMapper(props) {
|
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
}); };
|
|
90
|
-
var getTipoSolicitanteOptions = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
90
|
+
var getTipoSolicitanteOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
|
|
91
91
|
var response;
|
|
92
92
|
return __generator(this, function (_a) {
|
|
93
93
|
switch (_a.label) {
|
|
94
|
-
case 0: return [4 /*yield*/, axios.get(baseUrl +
|
|
94
|
+
case 0: return [4 /*yield*/, axios.get(baseUrl +
|
|
95
|
+
'ConsultaTipoSolicitante?idOrganization=' +
|
|
96
|
+
idOrganization)];
|
|
95
97
|
case 1:
|
|
96
98
|
response = (_a.sent()).data;
|
|
97
99
|
return [2 /*return*/, response.map(function (option) {
|
|
@@ -103,7 +105,7 @@ function CBRStepMapper(props) {
|
|
|
103
105
|
}
|
|
104
106
|
});
|
|
105
107
|
}); };
|
|
106
|
-
var getTipoEspaciosOptions = function (step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
|
|
108
|
+
var getTipoEspaciosOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
|
|
107
109
|
var idProyecto, response;
|
|
108
110
|
var _a;
|
|
109
111
|
return __generator(this, function (_b) {
|
|
@@ -117,7 +119,8 @@ function CBRStepMapper(props) {
|
|
|
117
119
|
return [4 /*yield*/, axios.get(baseUrl +
|
|
118
120
|
'ConsultaTipoEspacios?idProyecto=' +
|
|
119
121
|
idProyecto +
|
|
120
|
-
'&idOrganization=
|
|
122
|
+
'&idOrganization=' +
|
|
123
|
+
idOrganization)];
|
|
121
124
|
case 1:
|
|
122
125
|
response = (_b.sent()).data;
|
|
123
126
|
return [2 /*return*/, response.map(function (option) {
|
|
@@ -130,7 +133,7 @@ function CBRStepMapper(props) {
|
|
|
130
133
|
}
|
|
131
134
|
});
|
|
132
135
|
}); };
|
|
133
|
-
var getInmueblesOptions = function (step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
|
|
136
|
+
var getInmueblesOptions = function (idOrganization, step, dependencyStore) { return __awaiter(_this, void 0, void 0, function () {
|
|
134
137
|
var idProyecto, idMacroProyecto, response;
|
|
135
138
|
var _a, _b;
|
|
136
139
|
return __generator(this, function (_c) {
|
|
@@ -147,7 +150,8 @@ function CBRStepMapper(props) {
|
|
|
147
150
|
idMacroProyecto +
|
|
148
151
|
'&idProyecto=' +
|
|
149
152
|
idProyecto +
|
|
150
|
-
'&idOrganization=
|
|
153
|
+
'&idOrganization=' +
|
|
154
|
+
idOrganization)];
|
|
151
155
|
case 1:
|
|
152
156
|
response = (_c.sent()).data;
|
|
153
157
|
return [2 /*return*/, response.map(function (option) {
|
package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js
CHANGED
|
@@ -66,7 +66,7 @@ import React from 'react';
|
|
|
66
66
|
function SmartSelect(_a) {
|
|
67
67
|
var _this = this;
|
|
68
68
|
var _b, _c, _d;
|
|
69
|
-
var icon = _a.icon, step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, trigger = _a.trigger, children = _a.children, editable = _a.editable, onChange = _a.onChange, inputRef = _a.inputRef, postview = _a.postview, formStyle = _a.formStyle, getOptions = _a.getOptions, widthStats = _a.widthStats, calcDepError = _a.calcDepError, iconComponent = _a.iconComponent, valueOverwrite = _a.valueOverwrite, dependencyStore = _a.dependencyStore, _e = _a.calcInvalidDeps, calcInvalidDeps = _e === void 0 ? function (step, depStore) {
|
|
69
|
+
var icon = _a.icon, step = _a.step, form = _a.form, value = _a.value, onBlur = _a.onBlur, errors = _a.errors, trigger = _a.trigger, children = _a.children, editable = _a.editable, onChange = _a.onChange, inputRef = _a.inputRef, postview = _a.postview, formStyle = _a.formStyle, getOptions = _a.getOptions, widthStats = _a.widthStats, organization = _a.organization, calcDepError = _a.calcDepError, iconComponent = _a.iconComponent, valueOverwrite = _a.valueOverwrite, dependencyStore = _a.dependencyStore, _e = _a.calcInvalidDeps, calcInvalidDeps = _e === void 0 ? function (step, depStore) {
|
|
70
70
|
var _a;
|
|
71
71
|
var missingDeps = [];
|
|
72
72
|
for (var _i = 0, _b = (_a = step.dependencies) !== null && _a !== void 0 ? _a : []; _i < _b.length; _i++) {
|
|
@@ -76,7 +76,7 @@ function SmartSelect(_a) {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
return missingDeps;
|
|
79
|
-
} : _e, getOptionSelected = _a.getOptionSelected, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["icon", "step", "form", "value", "onBlur", "errors", "trigger", "children", "editable", "onChange", "inputRef", "postview", "formStyle", "getOptions", "widthStats", "calcDepError", "iconComponent", "valueOverwrite", "dependencyStore", "calcInvalidDeps", "getOptionSelected", "setDependencyStore"]);
|
|
79
|
+
} : _e, getOptionSelected = _a.getOptionSelected, setDependencyStore = _a.setDependencyStore, others = __rest(_a, ["icon", "step", "form", "value", "onBlur", "errors", "trigger", "children", "editable", "onChange", "inputRef", "postview", "formStyle", "getOptions", "widthStats", "organization", "calcDepError", "iconComponent", "valueOverwrite", "dependencyStore", "calcInvalidDeps", "getOptionSelected", "setDependencyStore"]);
|
|
80
80
|
var _f = useState(true), first = _f[0], setFirst = _f[1];
|
|
81
81
|
var _g = useState(), options = _g[0], setOptions = _g[1];
|
|
82
82
|
var _h = useState(), error = _h[0], setError = _h[1];
|
|
@@ -85,7 +85,7 @@ function SmartSelect(_a) {
|
|
|
85
85
|
var _a;
|
|
86
86
|
return __generator(this, function (_b) {
|
|
87
87
|
switch (_b.label) {
|
|
88
|
-
case 0: return [4 /*yield*/, (getOptions === null || getOptions === void 0 ? void 0 : getOptions(step, dependencyStore))];
|
|
88
|
+
case 0: return [4 /*yield*/, (getOptions === null || getOptions === void 0 ? void 0 : getOptions(organization.idOrganization, step, dependencyStore))];
|
|
89
89
|
case 1:
|
|
90
90
|
resp = _b.sent();
|
|
91
91
|
if (resp !== null) {
|
|
@@ -112,7 +112,7 @@ function SmartSelect(_a) {
|
|
|
112
112
|
useEffect(function () {
|
|
113
113
|
if (first) {
|
|
114
114
|
setFirst(false);
|
|
115
|
-
var invalids = calcInvalidDeps(step, dependencyStore);
|
|
115
|
+
var invalids = calcInvalidDeps(step, dependencyStore).filter(function (idDep) { return others.originalValues[idDep]; });
|
|
116
116
|
setError(calcDepError === null || calcDepError === void 0 ? void 0 : calcDepError(invalids.map(function (idDep) { var _a; return (_a = form.steps[idDep]) === null || _a === void 0 ? void 0 : _a.type; })));
|
|
117
117
|
calcOptions(value, invalids);
|
|
118
118
|
}
|
|
@@ -160,7 +160,7 @@ function SmartSelect(_a) {
|
|
|
160
160
|
: step.description), error: error !== undefined || !!errors[step.id] }, void 0) }), void 0), children &&
|
|
161
161
|
cloneElement(children, {
|
|
162
162
|
value: value,
|
|
163
|
-
stepProps: __assign({ step: step, form: form, errors: errors, trigger: trigger, postview: postview, editable: editable, formStyle: formStyle, widthStats: widthStats, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore }, others),
|
|
163
|
+
stepProps: __assign({ step: step, form: form, errors: errors, trigger: trigger, postview: postview, editable: editable, formStyle: formStyle, widthStats: widthStats, organization: organization, dependencyStore: dependencyStore, setDependencyStore: setDependencyStore }, others),
|
|
164
164
|
})] }, void 0));
|
|
165
165
|
}
|
|
166
166
|
function SmartSelectStep(props) {
|
|
@@ -10,7 +10,7 @@ export interface SmartSelectStepProps extends Omit<StepProps, 'step'> {
|
|
|
10
10
|
/** The iconComponent to display in the selector */
|
|
11
11
|
iconComponent?: any;
|
|
12
12
|
/** Function to call to get the options of the selector, return null if dependency is not met */
|
|
13
|
-
getOptions: (step: GSmartSelect, dependencyStore: Record<string, any>) => Promise<any[] | null>;
|
|
13
|
+
getOptions: (idOrganization: string, step: GSmartSelect, dependencyStore: Record<string, any>) => Promise<any[] | null>;
|
|
14
14
|
/** Function to determine the currently selected option */
|
|
15
15
|
getOptionSelected: (option: any, value: any) => boolean;
|
|
16
16
|
/** Function that returns the error message based on the types of the missing Dependencies, undefined if no error msg */
|