@arquimedes.co/eureka-forms 1.5.8-test → 1.6.0-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.js +1 -1
- 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 +33 -32
- package/dist/FormComponents/Step/CBRStepMapper.js +85 -62
- package/dist/FormComponents/Step/SmartSelectStep/MaterialSmartSelectStep/MaterialSmartSelectStep.js +6 -6
- package/dist/FormComponents/Step/SmartSelectStep/SmartSelectStep.d.ts +1 -1
- package/package.json +1 -1
- package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_INMUEBLE.json +0 -13151
- package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_LOCATIVAS.json +0 -71
- package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_PROYECTO.json +0 -74
- package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_TIPO_DOC.json +0 -50
- package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_TIPO_ESPACIO.json +0 -320
- package/dist/FormComponents/Step/CBRStepValuesTemp/CBR_TIPO_SOLICITANTE.json +0 -42
package/dist/App.js
CHANGED
|
@@ -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) */
|
|
@@ -47,8 +47,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
47
47
|
};
|
|
48
48
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
49
49
|
import SmartSelectStep from '../../SmartSelectStep/SmartSelectStep';
|
|
50
|
-
import LocativasData from '../../CBRStepValuesTemp/CBR_LOCATIVAS.json';
|
|
51
50
|
import CBRFormStepTypes from '../../../../constants/CBRFormStepTypes';
|
|
51
|
+
import axios from 'axios';
|
|
52
52
|
function CBRLocativasStep(props) {
|
|
53
53
|
return (_jsx(SmartSelectStep, __assign({}, props, { step: props.step, icon: _jsx(Leak, { fill: "#757575", style: {
|
|
54
54
|
display: 'flex',
|
|
@@ -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,43 +94,44 @@ 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) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
father_1 = dependencyStore[step.dependencies[1]];
|
|
108
|
-
if (father_1 !== undefined && father_1.id === undefined) {
|
|
109
|
-
return [2 /*return*/, null];
|
|
110
|
-
}
|
|
111
|
-
locativasList = response.lstLocativas.TipoLocativas.filter(function (locativa) {
|
|
112
|
-
if (father_1 === null || father_1 === void 0 ? void 0 : father_1.id) {
|
|
113
|
-
return (locativa.Id.startsWith(father_1.id) &&
|
|
114
|
-
locativa.Id !== father_1.id);
|
|
101
|
+
switch (_b.label) {
|
|
102
|
+
case 0:
|
|
103
|
+
if (!step.dependencies) return [3 /*break*/, 2];
|
|
104
|
+
idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
|
|
105
|
+
if (!idProyecto) {
|
|
106
|
+
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
115
107
|
}
|
|
116
|
-
|
|
117
|
-
|
|
108
|
+
return [4 /*yield*/, axios.get("https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/cbr/ConsultaLocativas?idOrganization=" + idOrganization)];
|
|
109
|
+
case 1:
|
|
110
|
+
response = (_b.sent()).data;
|
|
111
|
+
father_1 = dependencyStore[step.dependencies[1]];
|
|
112
|
+
if (father_1 !== undefined && father_1.id === undefined) {
|
|
113
|
+
return [2 /*return*/, null];
|
|
118
114
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
115
|
+
locativasList = response.lstLocativas.TipoLocativas.filter(function (locativa) {
|
|
116
|
+
if (father_1 === null || father_1 === void 0 ? void 0 : father_1.id) {
|
|
117
|
+
return (locativa.Id.startsWith(father_1.id) &&
|
|
118
|
+
locativa.Id !== father_1.id);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
return locativa.Id.length === 2;
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
return [2 /*return*/, locativasList.map(function (option) {
|
|
125
|
+
return {
|
|
126
|
+
label: option.Descripcion,
|
|
127
|
+
id: option.Id,
|
|
128
|
+
};
|
|
129
|
+
})];
|
|
130
|
+
case 2: return [2 /*return*/, null];
|
|
129
131
|
}
|
|
130
|
-
return [2 /*return*/];
|
|
131
132
|
});
|
|
132
133
|
}); };
|
|
133
|
-
var
|
|
134
|
+
var calcInvalidDependencies = function (step, dependencyStore) {
|
|
134
135
|
var _a;
|
|
135
136
|
var deps = [];
|
|
136
137
|
if (step.dependencies) {
|
|
@@ -52,93 +52,116 @@ import TextInputStep from './TextInputStep/TextInputStep';
|
|
|
52
52
|
import SmartSelectStep from './SmartSelectStep/SmartSelectStep';
|
|
53
53
|
import TextAreaStep from './TextAreaStep/TextAreaStep';
|
|
54
54
|
import CBRIncidentsStep from './@Construction/CBRIncidentsStep/CBRIncidentsStep';
|
|
55
|
-
import TipoDocData from './CBRStepValuesTemp/CBR_TIPO_DOC.json';
|
|
56
|
-
import ProyectoData from './CBRStepValuesTemp/CBR_PROYECTO.json';
|
|
57
|
-
import TipoSolicitanteData from './CBRStepValuesTemp/CBR_TIPO_SOLICITANTE.json';
|
|
58
|
-
import TipoEspacioData from './CBRStepValuesTemp/CBR_TIPO_ESPACIO.json';
|
|
59
|
-
import InmuebleData from './CBRStepValuesTemp/CBR_INMUEBLE.json';
|
|
60
55
|
import CBRLocativasStep from './@Construction/CBRLocativasStep/CBRLocativasStep';
|
|
56
|
+
import axios from 'axios';
|
|
57
|
+
var baseUrl = "https://integrations." + process.env.REACT_APP_DOMAIN + "/sinco/cbr/";
|
|
61
58
|
function CBRStepMapper(props) {
|
|
62
59
|
var _this = this;
|
|
63
|
-
var getTipoDocOptions = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
60
|
+
var getTipoDocOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
|
|
64
61
|
var response;
|
|
65
62
|
return __generator(this, function (_a) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
switch (_a.label) {
|
|
64
|
+
case 0: return [4 /*yield*/, axios.get(baseUrl + 'ConsultaTiposDoc?idOrganization=' + idOrganization)];
|
|
65
|
+
case 1:
|
|
66
|
+
response = (_a.sent()).data;
|
|
67
|
+
return [2 /*return*/, response.map(function (option) {
|
|
68
|
+
return { label: option.Descripcion, id: option.Id };
|
|
69
|
+
})];
|
|
70
|
+
}
|
|
70
71
|
});
|
|
71
72
|
}); };
|
|
72
|
-
var getProyectoOptions = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
73
|
+
var getProyectoOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
|
|
73
74
|
var response;
|
|
74
75
|
return __generator(this, function (_a) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0: return [4 /*yield*/, axios.get(baseUrl + 'Consultaproyectos?idOrganization=' + idOrganization)];
|
|
78
|
+
case 1:
|
|
79
|
+
response = (_a.sent()).data;
|
|
80
|
+
return [2 /*return*/, response.map(function (option) {
|
|
81
|
+
return {
|
|
82
|
+
label: option.NombreProyecto,
|
|
83
|
+
id: option.IdProyecto,
|
|
84
|
+
idMacroProyecto: option.IdMacroproyecto,
|
|
85
|
+
};
|
|
86
|
+
})];
|
|
87
|
+
}
|
|
83
88
|
});
|
|
84
89
|
}); };
|
|
85
|
-
var getTipoSolicitanteOptions = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
90
|
+
var getTipoSolicitanteOptions = function (idOrganization) { return __awaiter(_this, void 0, void 0, function () {
|
|
86
91
|
var response;
|
|
87
92
|
return __generator(this, function (_a) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
switch (_a.label) {
|
|
94
|
+
case 0: return [4 /*yield*/, axios.get(baseUrl +
|
|
95
|
+
'ConsultaTipoSolicitante?idOrganization=' +
|
|
96
|
+
idOrganization)];
|
|
97
|
+
case 1:
|
|
98
|
+
response = (_a.sent()).data;
|
|
99
|
+
return [2 /*return*/, response.map(function (option) {
|
|
100
|
+
return {
|
|
101
|
+
label: option.Descripcion,
|
|
102
|
+
id: option.Id,
|
|
103
|
+
};
|
|
104
|
+
})];
|
|
105
|
+
}
|
|
95
106
|
});
|
|
96
107
|
}); };
|
|
97
|
-
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 () {
|
|
98
109
|
var idProyecto, response;
|
|
99
110
|
var _a;
|
|
100
111
|
return __generator(this, function (_b) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
switch (_b.label) {
|
|
113
|
+
case 0:
|
|
114
|
+
if (!step.dependencies) return [3 /*break*/, 2];
|
|
115
|
+
idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
|
|
116
|
+
if (!idProyecto) {
|
|
117
|
+
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
118
|
+
}
|
|
119
|
+
return [4 /*yield*/, axios.get(baseUrl +
|
|
120
|
+
'ConsultaTipoEspacios?idProyecto=' +
|
|
121
|
+
idProyecto +
|
|
122
|
+
'&idOrganization=' +
|
|
123
|
+
idOrganization)];
|
|
124
|
+
case 1:
|
|
125
|
+
response = (_b.sent()).data;
|
|
126
|
+
return [2 /*return*/, response.map(function (option) {
|
|
127
|
+
return {
|
|
128
|
+
label: option.Descripcion,
|
|
129
|
+
id: option.Id,
|
|
130
|
+
};
|
|
131
|
+
})];
|
|
132
|
+
case 2: return [2 /*return*/, null];
|
|
116
133
|
}
|
|
117
|
-
return [2 /*return*/];
|
|
118
134
|
});
|
|
119
135
|
}); };
|
|
120
|
-
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 () {
|
|
121
137
|
var idProyecto, idMacroProyecto, response;
|
|
122
138
|
var _a, _b;
|
|
123
139
|
return __generator(this, function (_c) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
switch (_c.label) {
|
|
141
|
+
case 0:
|
|
142
|
+
if (!step.dependencies) return [3 /*break*/, 2];
|
|
143
|
+
idProyecto = (_a = dependencyStore[step.dependencies[0]]) === null || _a === void 0 ? void 0 : _a.id;
|
|
144
|
+
idMacroProyecto = (_b = dependencyStore[step.dependencies[0]]) === null || _b === void 0 ? void 0 : _b.idMacroProyecto;
|
|
145
|
+
if (!idProyecto) {
|
|
146
|
+
return [2 /*return*/, null]; //null para indicar que falta la depedency
|
|
147
|
+
}
|
|
148
|
+
return [4 /*yield*/, axios.get(baseUrl +
|
|
149
|
+
'ConsultaInmuebles?idMacro=' +
|
|
150
|
+
idMacroProyecto +
|
|
151
|
+
'&idProyecto=' +
|
|
152
|
+
idProyecto +
|
|
153
|
+
'&idOrganization=' +
|
|
154
|
+
idOrganization)];
|
|
155
|
+
case 1:
|
|
156
|
+
response = (_c.sent()).data;
|
|
157
|
+
return [2 /*return*/, response.map(function (option) {
|
|
158
|
+
return {
|
|
159
|
+
label: option.Descripcion,
|
|
160
|
+
id: option.Id,
|
|
161
|
+
};
|
|
162
|
+
})];
|
|
163
|
+
case 2: return [2 /*return*/, null];
|
|
140
164
|
}
|
|
141
|
-
return [2 /*return*/];
|
|
142
165
|
});
|
|
143
166
|
}); };
|
|
144
167
|
switch (props.step.type) {
|
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
|
}
|
|
@@ -146,7 +146,7 @@ function SmartSelect(_a) {
|
|
|
146
146
|
if (options === null) {
|
|
147
147
|
handleMissingDep();
|
|
148
148
|
}
|
|
149
|
-
} }, { children: _jsx(RoundedSmartSelect, { value: value, onBlur: onBlur, disabled: options === null, loading: options === undefined, options: options !== null && options !== void 0 ? options : [],
|
|
149
|
+
}, "data-testid": step.id }, { children: _jsx(RoundedSmartSelect, { value: value, onBlur: onBlur, disabled: options === null, loading: options === undefined, options: options !== null && options !== void 0 ? options : [], inputRef: inputRef, cantEdit: !editable || postview, fullWidth: true, backgroundColor: "transparent", innerBackgroundColor: (_d = formStyle.stepBackgroundColor) !== null && _d !== void 0 ? _d : 'white', label: step.label, required: step.required, height: '31px', searchable: step.searchable, icon: step.showIcon ? icon : undefined, iconComponent: step.showIcon ? iconComponent : undefined, helperTextColor: formStyle.descriptionTextColor, focusColor: formStyle.primaryColor, outlineColor: formStyle.outlineColor, errorColor: formStyle.errorColor, color: formStyle.textColor, containerMargin: "0px", handleUpdate: function (value) {
|
|
150
150
|
var _a;
|
|
151
151
|
if (dependencyStore[step.id] !== undefined) {
|
|
152
152
|
setDependencyStore(__assign(__assign({}, dependencyStore), (_a = {}, _a[step.id] = value, _a)));
|
|
@@ -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 */
|
package/package.json
CHANGED