@arquimedes.co/eureka-forms 1.9.103 → 1.9.105-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/FormStep.d.ts +2 -0
- package/dist/App.js +5 -5
- package/dist/FormComponents/Form/ColumnForm/ColumnForm.js +34 -38
- package/dist/FormComponents/Step/CheckBoxStep/MaterialCheckBoxStep/MaterialCheckBoxStep.js +2 -2
- package/dist/FormComponents/Step/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js +4 -1
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ export interface CheckBox extends GSteps.GCheckBox {
|
|
|
12
12
|
steps?: string[];
|
|
13
13
|
uncheckedSteps?: string[];
|
|
14
14
|
maxSize?: number;
|
|
15
|
+
defaultValue?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export interface Rating extends GSteps.GBaseStep {
|
|
17
18
|
type: Types.RATING;
|
|
@@ -44,6 +45,7 @@ export interface Collapsible extends GSteps.GBaseStep {
|
|
|
44
45
|
type: Types.COLLAPSIBLE;
|
|
45
46
|
label: string;
|
|
46
47
|
steps: string[];
|
|
48
|
+
defaultValue?: boolean;
|
|
47
49
|
}
|
|
48
50
|
export interface FormSelector extends GSteps.GBaseStep {
|
|
49
51
|
type: Types.SELECTOR;
|
package/dist/App.js
CHANGED
|
@@ -382,6 +382,8 @@ export var addInitialMapper = function (newValues, step) {
|
|
|
382
382
|
};
|
|
383
383
|
export var mapOriginalValue = function (step, value, newValues, form) {
|
|
384
384
|
var _a, _b, _c, _d, _e;
|
|
385
|
+
if (!value)
|
|
386
|
+
return value;
|
|
385
387
|
switch (step === null || step === void 0 ? void 0 : step.type) {
|
|
386
388
|
case StepTypes.MAPPER: {
|
|
387
389
|
var elements = value;
|
|
@@ -401,11 +403,9 @@ export var mapOriginalValue = function (step, value, newValues, form) {
|
|
|
401
403
|
var idStep = _g[_f];
|
|
402
404
|
var newIdStep = step.id + '-' + idStep + '-' + idElement;
|
|
403
405
|
mappedElement.ids[idStep] = newIdStep;
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
newValues[newIdStep] = value_1;
|
|
408
|
-
}
|
|
406
|
+
var value_1 = mapOriginalValue(step.steps[idStep], element[idStep], newValues, form);
|
|
407
|
+
if (value_1 !== undefined) {
|
|
408
|
+
newValues[newIdStep] = value_1;
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
for (var _h = 0, _j = Object.keys(element); _h < _j.length; _h++) {
|
|
@@ -94,24 +94,27 @@ function ColumnForm(_a) {
|
|
|
94
94
|
return _jsx("div", {});
|
|
95
95
|
}
|
|
96
96
|
var onSubmit = function (token) { return __awaiter(_this, void 0, void 0, function () {
|
|
97
|
-
var valid, values, newValues, deleteIds, _i, _a, idStep, _b, deleteIds_1, id, customResp,
|
|
98
|
-
return __generator(this, function (
|
|
99
|
-
switch (
|
|
97
|
+
var valid, values, newValues, deleteIds, _i, _a, idStep, _b, deleteIds_1, id, customResp, params, url, axios, resp, error_1;
|
|
98
|
+
return __generator(this, function (_c) {
|
|
99
|
+
switch (_c.label) {
|
|
100
100
|
case 0:
|
|
101
|
-
if (!
|
|
101
|
+
if (!apiKey && !internal && !customSend)
|
|
102
|
+
return [2 /*return*/];
|
|
102
103
|
return [4 /*yield*/, trigger(undefined, { shouldFocus: true })];
|
|
103
104
|
case 1:
|
|
104
|
-
valid =
|
|
105
|
+
valid = _c.sent();
|
|
105
106
|
values = getValues();
|
|
106
|
-
if (
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
if (!valid) {
|
|
108
|
+
console.error('ERRORS:', errors);
|
|
109
|
+
setTempError(true);
|
|
110
|
+
setTimeout(function () {
|
|
111
|
+
setTempError(false);
|
|
112
|
+
}, 500);
|
|
113
|
+
return [2 /*return*/];
|
|
114
|
+
}
|
|
115
|
+
_c.label = 2;
|
|
113
116
|
case 2:
|
|
114
|
-
|
|
117
|
+
_c.trys.push([2, 6, , 7]);
|
|
115
118
|
setLoading(true);
|
|
116
119
|
newValues = {};
|
|
117
120
|
deleteIds = [];
|
|
@@ -126,39 +129,32 @@ function ColumnForm(_a) {
|
|
|
126
129
|
if (!customSend) return [3 /*break*/, 4];
|
|
127
130
|
return [4 /*yield*/, customSend(newValues, reload)];
|
|
128
131
|
case 3:
|
|
129
|
-
customResp =
|
|
132
|
+
customResp = _c.sent();
|
|
130
133
|
setLoading(false);
|
|
131
134
|
return [2 /*return*/, customResp];
|
|
132
135
|
case 4:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
if (token)
|
|
137
|
-
|
|
138
|
-
}
|
|
136
|
+
params = new URLSearchParams();
|
|
137
|
+
if (domain || internal)
|
|
138
|
+
params.set('idOrganization', domain !== null && domain !== void 0 ? domain : '');
|
|
139
|
+
if (token)
|
|
140
|
+
params.set('token', token);
|
|
139
141
|
url = "/ticket/".concat(internal ? form.apiKey : apiKey);
|
|
140
|
-
if (
|
|
141
|
-
|
|
142
|
+
if (params.toString()) {
|
|
143
|
+
url += "?".concat(params.toString());
|
|
144
|
+
}
|
|
145
|
+
axios = domain || internal ? widgetInstance : axiosInstance;
|
|
146
|
+
return [4 /*yield*/, axios.post(url, newValues)];
|
|
142
147
|
case 5:
|
|
143
|
-
|
|
144
|
-
return [3 /*break*/, 8];
|
|
145
|
-
case 6: return [4 /*yield*/, axiosInstance.post(url, payload)];
|
|
146
|
-
case 7:
|
|
147
|
-
_c = _d.sent();
|
|
148
|
-
_d.label = 8;
|
|
149
|
-
case 8:
|
|
150
|
-
resp = _c;
|
|
148
|
+
resp = _c.sent();
|
|
151
149
|
setShowConfirmation(resp === null || resp === void 0 ? void 0 : resp.data);
|
|
152
|
-
|
|
153
|
-
case
|
|
154
|
-
|
|
155
|
-
return [3 /*break*/, 11];
|
|
156
|
-
case 10:
|
|
157
|
-
error_1 = _d.sent();
|
|
150
|
+
return [3 /*break*/, 7];
|
|
151
|
+
case 6:
|
|
152
|
+
error_1 = _c.sent();
|
|
158
153
|
console.error(error_1);
|
|
154
|
+
return [3 /*break*/, 7];
|
|
155
|
+
case 7:
|
|
159
156
|
setLoading(false);
|
|
160
|
-
return [
|
|
161
|
-
case 11: return [2 /*return*/];
|
|
157
|
+
return [2 /*return*/];
|
|
162
158
|
}
|
|
163
159
|
});
|
|
164
160
|
}); };
|
|
@@ -80,8 +80,8 @@ function CheckBox(_a) {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
function CheckBoxStep(props) {
|
|
83
|
-
var _a;
|
|
84
|
-
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: (_a = props.originalValues[props.step.id]) !== null && _a !== void 0 ? _a : false, rules: {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: (_b = (_a = props.originalValues[props.step.id]) !== null && _a !== void 0 ? _a : props.step.defaultValue) !== null && _b !== void 0 ? _b : false, rules: {
|
|
85
85
|
required: props.step.required
|
|
86
86
|
? 'Este campo es obligatorio'
|
|
87
87
|
: undefined,
|
package/dist/FormComponents/Step/CollapsibleStep/MaterialTitleStep/MaterialCollapsibleStep.js
CHANGED
|
@@ -59,7 +59,10 @@ function Collapsible(_a) {
|
|
|
59
59
|
} })] }));
|
|
60
60
|
}
|
|
61
61
|
function CollapsibleStep(props) {
|
|
62
|
-
|
|
62
|
+
var _a, _b;
|
|
63
|
+
return (_jsx(Controller, { name: props.step.id, control: props.control, defaultValue: ((_b = (_a = props.originalValues[props.step.id]) !== null && _a !== void 0 ? _a : props.step.defaultValue) !== null && _b !== void 0 ? _b : props.postview)
|
|
64
|
+
? false
|
|
65
|
+
: true, render: function (_a) {
|
|
63
66
|
var _b = _a.field, value = _b.value, onChange = _b.onChange;
|
|
64
67
|
return (_jsx(Collapsible, __assign({}, props, { open: value, setOpen: function (open) {
|
|
65
68
|
var _a;
|
package/package.json
CHANGED