aport-tools 4.4.11 → 4.4.12
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/index.esm.js +11 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +11 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/*! aport-tools v4.4.
|
1
|
+
/*! aport-tools v4.4.12 | ISC */
|
2
2
|
'use strict';
|
3
3
|
|
4
4
|
var React = require('react');
|
@@ -214,37 +214,26 @@ var Stepper = function Stepper(_a) {
|
|
214
214
|
seterrorBack = _f[1];
|
215
215
|
var handleStepPress = function handleStepPress(stepIndex) {
|
216
216
|
return __awaiter(void 0, void 0, void 0, function () {
|
217
|
-
var
|
217
|
+
var targetStep, errors;
|
218
218
|
return __generator(this, function (_a) {
|
219
219
|
switch (_a.label) {
|
220
220
|
case 0:
|
221
221
|
if (!presseable || stepIndex === currentStep) return [2 /*return*/];
|
222
|
-
|
223
|
-
|
224
|
-
_a.label = 1;
|
225
|
-
case 1:
|
226
|
-
if (!(current !== target)) return [3 /*break*/, 5];
|
227
|
-
if (!(target > current)) return [3 /*break*/, 3];
|
222
|
+
targetStep = stepIndex > currentStep ? currentStep + 1 : currentStep - 1;
|
223
|
+
if (!(targetStep > currentStep)) return [3 /*break*/, 2];
|
228
224
|
return [4 /*yield*/, handleFormSubmit(formValues)];
|
229
|
-
case
|
225
|
+
case 1:
|
230
226
|
errors = _a.sent();
|
231
227
|
if (Object.keys(errors).length > 0) {
|
232
|
-
console.log("Validation failed at step ".concat(
|
228
|
+
console.log("Validation failed at step ".concat(currentStep, ". Cannot proceed to step ").concat(targetStep, "."));
|
233
229
|
seterrorBack(true);
|
234
|
-
return [2 /*return*/]; // Stop if
|
230
|
+
return [2 /*return*/]; // Stop if current step has errors
|
235
231
|
}
|
232
|
+
_a.label = 2;
|
233
|
+
case 2:
|
234
|
+
// Update step
|
236
235
|
seterrorBack(false);
|
237
|
-
|
238
|
-
return [3 /*break*/, 4];
|
239
|
-
case 3:
|
240
|
-
// Moving backward: No validation required
|
241
|
-
current -= 1;
|
242
|
-
_a.label = 4;
|
243
|
-
case 4:
|
244
|
-
// Update the current step visually for each intermediate step
|
245
|
-
onPress === null || onPress === void 0 ? void 0 : onPress(current);
|
246
|
-
return [3 /*break*/, 1];
|
247
|
-
case 5:
|
236
|
+
onPress === null || onPress === void 0 ? void 0 : onPress(targetStep);
|
248
237
|
return [2 /*return*/];
|
249
238
|
}
|
250
239
|
});
|