ywana-core8 0.0.654 → 0.0.656
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.cjs +34 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -1
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +34 -25
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +34 -25
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/incubator/wizard.css +0 -1
- package/src/incubator/wizard.js +19 -15
- package/src/incubator/wizard.test.js +25 -9
package/dist/index.cjs
CHANGED
@@ -9625,40 +9625,48 @@ var TableAPI = function TableAPI(url, host) {
|
|
9625
9625
|
};
|
9626
9626
|
|
9627
9627
|
var Wizard = function Wizard(props) {
|
9628
|
-
var
|
9629
|
-
|
9630
|
-
|
9628
|
+
var finish = function finish() {
|
9629
|
+
try {
|
9630
|
+
return Promise.resolve(stepRef.current.onNext(function () {
|
9631
|
+
if (onClose) onClose();
|
9632
|
+
})).then(function () {});
|
9633
|
+
} catch (e) {
|
9634
|
+
return Promise.reject(e);
|
9635
|
+
}
|
9636
|
+
};
|
9637
|
+
|
9638
|
+
var next = function next() {
|
9639
|
+
try {
|
9640
|
+
return Promise.resolve(stepRef.current.onNext(function () {
|
9641
|
+
setCurrent(current + 1);
|
9642
|
+
})).then(function () {});
|
9643
|
+
} catch (e) {
|
9644
|
+
return Promise.reject(e);
|
9645
|
+
}
|
9646
|
+
};
|
9647
|
+
|
9648
|
+
var _props$init = props.init,
|
9631
9649
|
init = _props$init === void 0 ? 0 : _props$init,
|
9632
|
-
onClose = props.onClose
|
9650
|
+
onClose = props.onClose,
|
9651
|
+
children = props.children;
|
9633
9652
|
|
9634
9653
|
var _useState = React.useState(init),
|
9635
9654
|
_useState$ = _useState[0],
|
9636
9655
|
current = _useState$ === void 0 ? 0 : _useState$,
|
9637
9656
|
setCurrent = _useState[1];
|
9638
9657
|
|
9658
|
+
var steps = React__default["default"].Children.toArray(children);
|
9659
|
+
var stepRef = React.useRef();
|
9660
|
+
|
9639
9661
|
function prev() {
|
9640
9662
|
if (current > 0) setCurrent(current - 1);
|
9641
9663
|
}
|
9642
9664
|
|
9643
|
-
function
|
9644
|
-
|
9645
|
-
|
9646
|
-
if (step.onComplete) {
|
9647
|
-
step.onComplete(function () {
|
9648
|
-
setCurrent(current + 1);
|
9649
|
-
});
|
9650
|
-
} else {
|
9651
|
-
setCurrent(current + 1);
|
9652
|
-
}
|
9653
|
-
}
|
9654
|
-
|
9655
|
-
function finish() {
|
9656
|
-
var step = steps[current];
|
9657
|
-
if (step.onComplete) step.onComplete(function () {
|
9658
|
-
if (onClose) onClose();
|
9665
|
+
var currentStep = React.useMemo(function () {
|
9666
|
+
return React__default["default"].cloneElement(steps[current], {
|
9667
|
+
ref: stepRef
|
9659
9668
|
});
|
9660
|
-
}
|
9661
|
-
|
9669
|
+
}, [current]);
|
9662
9670
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
9663
9671
|
className: "wizard"
|
9664
9672
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
@@ -9677,10 +9685,10 @@ var Wizard = function Wizard(props) {
|
|
9677
9685
|
icon: "play_arrow"
|
9678
9686
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9679
9687
|
className: "wizard-step-label"
|
9680
|
-
}, step.label));
|
9688
|
+
}, step.props.label));
|
9681
9689
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9682
9690
|
className: "wizard-content"
|
9683
|
-
},
|
9691
|
+
}, currentStep), /*#__PURE__*/React__default["default"].createElement("div", {
|
9684
9692
|
className: "wizard-actions"
|
9685
9693
|
}, /*#__PURE__*/React__default["default"].createElement(Button, {
|
9686
9694
|
label: "Anterior",
|
@@ -9688,10 +9696,11 @@ var Wizard = function Wizard(props) {
|
|
9688
9696
|
action: prev
|
9689
9697
|
}), current < steps.length - 1 ? /*#__PURE__*/React__default["default"].createElement(Button, {
|
9690
9698
|
label: "Siguiente",
|
9691
|
-
disabled: current
|
9699
|
+
disabled: stepRef.current.isValid(),
|
9692
9700
|
action: next
|
9693
9701
|
}) : /*#__PURE__*/React__default["default"].createElement(Button, {
|
9694
9702
|
label: "Finalizar",
|
9703
|
+
disabled: stepRef.current.isValid(),
|
9695
9704
|
action: finish,
|
9696
9705
|
raised: true
|
9697
9706
|
})));
|