@arquimedes.co/eureka-forms 1.9.123 → 1.9.125
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.
|
@@ -56,13 +56,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
56
56
|
}
|
|
57
57
|
return t;
|
|
58
58
|
};
|
|
59
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
60
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
61
|
+
if (ar || !(i in from)) {
|
|
62
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
63
|
+
ar[i] = from[i];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
67
|
+
};
|
|
59
68
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
60
69
|
import { cloneElement, useEffect, useRef, useState } from 'react';
|
|
61
70
|
import ReCAPTCHA from 'react-google-recaptcha';
|
|
62
71
|
import SectionComponent from '../../Section/Section';
|
|
63
72
|
import { useForm } from 'react-hook-form';
|
|
64
73
|
import styles from './ColumnForm.module.css';
|
|
65
|
-
import Types from '../../../constants/FormStepTypes';
|
|
74
|
+
import Types, { EntityValueDataTypes } from '../../../constants/FormStepTypes';
|
|
66
75
|
import { convertToRaw } from 'draft-js';
|
|
67
76
|
import TermComponent from '../../Term/Term';
|
|
68
77
|
import ConfirmationDialog from '../ConfirmationDialog/ConfirmationDialog';
|
|
@@ -314,15 +323,15 @@ function stringToDraft(text) {
|
|
|
314
323
|
return draftStructure;
|
|
315
324
|
}
|
|
316
325
|
function calcDependencies(steps, originalValues, customSteps, allSteps, dependencies) {
|
|
317
|
-
var _a, _b;
|
|
326
|
+
var _a, _b, _c;
|
|
318
327
|
if (customSteps === void 0) { customSteps = {}; }
|
|
319
328
|
if (allSteps === void 0) { allSteps = steps; }
|
|
320
329
|
if (dependencies === void 0) { dependencies = {}; }
|
|
321
|
-
for (var _i = 0,
|
|
322
|
-
var step =
|
|
330
|
+
for (var _i = 0, _d = Object.values(steps); _i < _d.length; _i++) {
|
|
331
|
+
var step = _d[_i];
|
|
323
332
|
if (step.dependencies) {
|
|
324
|
-
for (var
|
|
325
|
-
var idDep = _e
|
|
333
|
+
for (var _e = 0, _f = step.dependencies; _e < _f.length; _e++) {
|
|
334
|
+
var idDep = _f[_e];
|
|
326
335
|
var depStep = allSteps[idDep];
|
|
327
336
|
if (depStep && dependencies[idDep] === undefined) {
|
|
328
337
|
dependencies[idDep] = calcStepDependencyValue(depStep, originalValues, customSteps);
|
|
@@ -336,15 +345,15 @@ function calcDependencies(steps, originalValues, customSteps, allSteps, dependen
|
|
|
336
345
|
var newSteps = {};
|
|
337
346
|
var elements = (_a = originalValues[step.id]) !== null && _a !== void 0 ? _a : [];
|
|
338
347
|
var _loop_1 = function (element) {
|
|
339
|
-
for (var
|
|
340
|
-
var idSubStep =
|
|
348
|
+
for (var _m = 0, _o = Object.keys(step.steps); _m < _o.length; _m++) {
|
|
349
|
+
var idSubStep = _o[_m];
|
|
341
350
|
var subStep = step.steps[idSubStep];
|
|
342
351
|
var mappedId = element.ids[idSubStep];
|
|
343
352
|
newSteps[mappedId] = __assign(__assign({}, subStep), { id: mappedId, dependencies: (_b = subStep.dependencies) === null || _b === void 0 ? void 0 : _b.map(function (dep) { var _a; return (_a = element.ids[dep]) !== null && _a !== void 0 ? _a : dep; }) });
|
|
344
353
|
}
|
|
345
354
|
};
|
|
346
|
-
for (var
|
|
347
|
-
var element = elements_2[
|
|
355
|
+
for (var _g = 0, elements_2 = elements; _g < elements_2.length; _g++) {
|
|
356
|
+
var element = elements_2[_g];
|
|
348
357
|
_loop_1(element);
|
|
349
358
|
}
|
|
350
359
|
if (elements.length === 0) {
|
|
@@ -353,6 +362,22 @@ function calcDependencies(steps, originalValues, customSteps, allSteps, dependen
|
|
|
353
362
|
calcDependencies(newSteps, originalValues, customSteps, __assign(__assign({}, allSteps), newSteps), dependencies);
|
|
354
363
|
}
|
|
355
364
|
}
|
|
365
|
+
/** After all steps have been checked check missing entityvalue dependencies */
|
|
366
|
+
for (var _h = 0, _j = Object.values(steps); _h < _j.length; _h++) {
|
|
367
|
+
var step = _j[_h];
|
|
368
|
+
if (step.type === Types.ENTITYVALUEPICKER) {
|
|
369
|
+
for (var _k = 0, _l = __spreadArray(__spreadArray([], step.path, true), step.filters, true); _k < _l.length; _k++) {
|
|
370
|
+
var path = _l[_k];
|
|
371
|
+
if (path.type !== EntityValueDataTypes.STEP)
|
|
372
|
+
continue;
|
|
373
|
+
if ((_c = step.dependencies) === null || _c === void 0 ? void 0 : _c.includes(path.idStep))
|
|
374
|
+
continue;
|
|
375
|
+
if (dependencies[path.idStep] === undefined) {
|
|
376
|
+
dependencies[path.idStep] = originalValues[path.idStep];
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
356
381
|
return dependencies;
|
|
357
382
|
}
|
|
358
383
|
export function calcStepDependencyValue(depStep, originalValues, customSteps) {
|
|
@@ -170,7 +170,7 @@ export default function RoundedSmartSelect(_a) {
|
|
|
170
170
|
}
|
|
171
171
|
else {
|
|
172
172
|
// Regular option
|
|
173
|
-
return (_b = option.label) !== null && _b !== void 0 ? _b : '';
|
|
173
|
+
return (_b = option === null || option === void 0 ? void 0 : option.label) !== null && _b !== void 0 ? _b : '';
|
|
174
174
|
}
|
|
175
175
|
}, getOptionSelected: getOptionSelected, PopperComponent: function (_a) {
|
|
176
176
|
var style = _a.style, props = __rest(_a, ["style"]);
|
|
@@ -231,6 +231,6 @@ export default function RoundedSmartSelect(_a) {
|
|
|
231
231
|
? function (props) {
|
|
232
232
|
return cloneElement(icon, props);
|
|
233
233
|
}
|
|
234
|
-
: undefined, showIcon: showIcon }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: options ? 'Sin Seleccionar' : 'Cargando...' }) }), 'EMPTY'), options === null || options === void 0 ? void 0 : options.map(function (option) { return (_jsx(MenuItem, __assign({ value: getValueString(option), style: { whiteSpace: 'normal' } }, { children: option.label }), getValueString(option))); }), options === undefined && value
|
|
234
|
+
: undefined, showIcon: showIcon }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: options ? 'Sin Seleccionar' : 'Cargando...' }) }), 'EMPTY'), options === null || options === void 0 ? void 0 : options.map(function (option) { return (_jsx(MenuItem, __assign({ value: getValueString(option), style: { whiteSpace: 'normal' } }, { children: option.label }), getValueString(option))); }), options === undefined && value && (_jsx(MenuItem, __assign({ value: getValueString(value), style: { whiteSpace: 'normal' } }, { children: (_b = value.label) !== null && _b !== void 0 ? _b : '' }), getValueString(value)))] })));
|
|
235
235
|
}
|
|
236
236
|
}
|
package/package.json
CHANGED