@arquimedes.co/eureka-forms 2.0.17 → 2.0.19
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
CHANGED
package/dist/App/AppFunctions.js
CHANGED
|
@@ -15,7 +15,7 @@ import { getRawText, stringToDraft } from '../Utils/DraftFunctions';
|
|
|
15
15
|
import { calcSubSteps } from '../FormSteps/StepFunctions';
|
|
16
16
|
export var calcValuesStore = function (form, originalValues, postview, customSteps) {
|
|
17
17
|
var _a;
|
|
18
|
-
var _b;
|
|
18
|
+
var _b, _c;
|
|
19
19
|
if (originalValues === void 0) { originalValues = {}; }
|
|
20
20
|
if (postview === void 0) { postview = false; }
|
|
21
21
|
if (customSteps === void 0) { customSteps = {}; }
|
|
@@ -23,10 +23,10 @@ export var calcValuesStore = function (form, originalValues, postview, customSte
|
|
|
23
23
|
global: {},
|
|
24
24
|
sections: {},
|
|
25
25
|
};
|
|
26
|
-
for (var _i = 0,
|
|
27
|
-
var idValue =
|
|
26
|
+
for (var _i = 0, _d = Object.keys(originalValues); _i < _d.length; _i++) {
|
|
27
|
+
var idValue = _d[_i];
|
|
28
28
|
var step = form.steps[idValue];
|
|
29
|
-
if (step) {
|
|
29
|
+
if (step && !((_b = form.hiddenSteps) === null || _b === void 0 ? void 0 : _b.includes(step.id))) {
|
|
30
30
|
var value = mapOriginalValue(step, originalValues[step.id], values, form);
|
|
31
31
|
if (value !== undefined) {
|
|
32
32
|
if (!values.sections[step.idSection])
|
|
@@ -40,17 +40,17 @@ export var calcValuesStore = function (form, originalValues, postview, customSte
|
|
|
40
40
|
}
|
|
41
41
|
if (postview)
|
|
42
42
|
return values;
|
|
43
|
-
for (var
|
|
44
|
-
var section = _e
|
|
45
|
-
for (var
|
|
46
|
-
var idStep = _g
|
|
43
|
+
for (var _e = 0, _f = Object.values(form.sections); _e < _f.length; _e++) {
|
|
44
|
+
var section = _f[_e];
|
|
45
|
+
for (var _g = 0, _h = section.steps; _g < _h.length; _g++) {
|
|
46
|
+
var idStep = _h[_g];
|
|
47
47
|
var step = form.steps[idStep];
|
|
48
48
|
if (step.type !== StepTypes.MAPPER ||
|
|
49
|
-
((
|
|
49
|
+
((_c = values.sections[step.idSection]) === null || _c === void 0 ? void 0 : _c[step.id]))
|
|
50
50
|
continue;
|
|
51
51
|
if (!values.sections[step.idSection])
|
|
52
52
|
values.sections[step.idSection] = {};
|
|
53
|
-
var
|
|
53
|
+
var _j = addMapperStep(step, customSteps), element = _j.element, mappers = _j.mappers;
|
|
54
54
|
values.sections[step.idSection] = __assign(__assign(__assign({}, values.sections[step.idSection]), mappers), (_a = {}, _a[step.id] = [element], _a));
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -30,16 +30,24 @@ import RoundedCheckBox from '../../../../Shared/RoundedCheckBox/RoundedCheckBox'
|
|
|
30
30
|
import CloseRoundedIcon from '@material-ui/icons/CloseRounded';
|
|
31
31
|
import styles from './MaterialTerm.module.css';
|
|
32
32
|
import { useAppSelector } from '../../../../hooks';
|
|
33
|
+
import { createSelector } from '@reduxjs/toolkit';
|
|
34
|
+
var selectOriginalValue = createSelector([
|
|
35
|
+
function (state) { return state.site.values; },
|
|
36
|
+
function (state, idTerm) { return idTerm; },
|
|
37
|
+
], function (values, idTerm) { return values.global[idTerm]; });
|
|
33
38
|
function TermComponent(_a) {
|
|
34
39
|
var _b;
|
|
35
40
|
var term = _a.term, tempError = _a.tempError;
|
|
36
41
|
var _c = useAppSelector(function (state) { return state.global; }), formStyle = _c.formStyle, postview = _c.postview;
|
|
42
|
+
var originalValue = useAppSelector(function (state) {
|
|
43
|
+
return selectOriginalValue(state, term.id);
|
|
44
|
+
});
|
|
37
45
|
var _d = useController({
|
|
38
46
|
name: term.id,
|
|
39
47
|
rules: {
|
|
40
48
|
required: true,
|
|
41
49
|
},
|
|
42
|
-
defaultValue:
|
|
50
|
+
defaultValue: originalValue,
|
|
43
51
|
shouldUnregister: true,
|
|
44
52
|
}), _e = _d.field, ref = _e.ref, field = __rest(_e, ["ref"]), error = _d.fieldState.error;
|
|
45
53
|
var _f = useState(false), showDialog = _f[0], setShowDialog = _f[1];
|
|
@@ -77,7 +77,7 @@ function Incidents(_a) {
|
|
|
77
77
|
dispatch(addStepsDependencies({
|
|
78
78
|
steps: newSteps,
|
|
79
79
|
customSteps: customSteps,
|
|
80
|
-
allSteps: newSteps,
|
|
80
|
+
allSteps: __assign(__assign(__assign({}, form.steps), localForm.steps), newSteps),
|
|
81
81
|
}));
|
|
82
82
|
};
|
|
83
83
|
var addRecursiveElementStep = function (idStep, step, idParent, steps, idProjectDep) {
|
|
@@ -98,19 +98,19 @@ function Incidents(_a) {
|
|
|
98
98
|
margin: step.description
|
|
99
99
|
? '10px 0px'
|
|
100
100
|
: '0px 0px 5px 0px',
|
|
101
|
-
} }, { children: step.description }))), incidents.map(function (incident, index) { return (_jsx(IncidentComponent, __assign({ incident: incident, step: step, editable: editable, handleDelete: function () {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
} }, { children: step.description }))), _jsx(FormContext.Provider, __assign({ value: localForm }, { children: incidents.map(function (incident, index) { return (_jsx(IncidentComponent, __assign({ incident: incident, step: step, editable: editable, handleDelete: function () {
|
|
102
|
+
var tempIncidents = __spreadArray([], incidents, true);
|
|
103
|
+
tempIncidents[index].deleted = true;
|
|
104
|
+
var n = 1;
|
|
105
|
+
for (var _i = 0, tempIncidents_1 = tempIncidents; _i < tempIncidents_1.length; _i++) {
|
|
106
|
+
var inc = tempIncidents_1[_i];
|
|
107
|
+
if (!inc.deleted) {
|
|
108
|
+
inc.num = n;
|
|
109
|
+
n++;
|
|
110
|
+
}
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
} }, others), index)); }), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: btnRef, className: 'hidden-input' }), _jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel, color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
|
112
|
+
onChange(tempIncidents);
|
|
113
|
+
} }, others), index)); }) })), _jsxs("div", __assign({ className: styles.btnContainer }, { children: [_jsx("input", { ref: btnRef, className: 'hidden-input' }), _jsx(RoundedButton, { disabled: !editable || postview, text: step.addBtnLabel, color: formStyle.primaryContrastColor, backgroundColor: formStyle.primaryColor, fontSize: '1rem', padding: '5px 15px 5px 15px', onClick: function () {
|
|
114
114
|
if (editable && !postview) {
|
|
115
115
|
handleAddIncident();
|
|
116
116
|
}
|