ywana-core8 0.0.654 → 0.0.655
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 +16 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +16 -16
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +16 -16
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/incubator/wizard.js +16 -12
- package/src/incubator/wizard.test.js +25 -9
package/dist/index.cjs
CHANGED
@@ -9625,40 +9625,40 @@ var TableAPI = function TableAPI(url, host) {
|
|
9625
9625
|
};
|
9626
9626
|
|
9627
9627
|
var Wizard = function Wizard(props) {
|
9628
|
-
var _props$
|
9629
|
-
steps = _props$steps === void 0 ? [] : _props$steps,
|
9630
|
-
_props$init = props.init,
|
9628
|
+
var _props$init = props.init,
|
9631
9629
|
init = _props$init === void 0 ? 0 : _props$init,
|
9632
|
-
onClose = props.onClose
|
9630
|
+
onClose = props.onClose,
|
9631
|
+
children = props.children;
|
9633
9632
|
|
9634
9633
|
var _useState = React.useState(init),
|
9635
9634
|
_useState$ = _useState[0],
|
9636
9635
|
current = _useState$ === void 0 ? 0 : _useState$,
|
9637
9636
|
setCurrent = _useState[1];
|
9638
9637
|
|
9638
|
+
var steps = React__default["default"].Children.toArray(children);
|
9639
|
+
var stepRef = React.useRef();
|
9640
|
+
|
9639
9641
|
function prev() {
|
9640
9642
|
if (current > 0) setCurrent(current - 1);
|
9641
9643
|
}
|
9642
9644
|
|
9643
9645
|
function next() {
|
9644
|
-
|
9645
|
-
|
9646
|
-
if (step.onComplete) {
|
9647
|
-
step.onComplete(function () {
|
9648
|
-
setCurrent(current + 1);
|
9649
|
-
});
|
9650
|
-
} else {
|
9646
|
+
stepRef.current.onComplete(function () {
|
9651
9647
|
setCurrent(current + 1);
|
9652
|
-
}
|
9648
|
+
});
|
9653
9649
|
}
|
9654
9650
|
|
9655
9651
|
function finish() {
|
9656
|
-
|
9657
|
-
if (step.onComplete) step.onComplete(function () {
|
9652
|
+
stepRef.current.onComplete(function () {
|
9658
9653
|
if (onClose) onClose();
|
9659
9654
|
});
|
9660
9655
|
}
|
9661
9656
|
|
9657
|
+
var currentStep = React.useMemo(function () {
|
9658
|
+
return React__default["default"].cloneElement(steps[current], {
|
9659
|
+
ref: stepRef
|
9660
|
+
});
|
9661
|
+
}, [current]);
|
9662
9662
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
9663
9663
|
className: "wizard"
|
9664
9664
|
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
@@ -9677,10 +9677,10 @@ var Wizard = function Wizard(props) {
|
|
9677
9677
|
icon: "play_arrow"
|
9678
9678
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9679
9679
|
className: "wizard-step-label"
|
9680
|
-
}, step.label));
|
9680
|
+
}, step.props.label));
|
9681
9681
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
9682
9682
|
className: "wizard-content"
|
9683
|
-
},
|
9683
|
+
}, currentStep), /*#__PURE__*/React__default["default"].createElement("div", {
|
9684
9684
|
className: "wizard-actions"
|
9685
9685
|
}, /*#__PURE__*/React__default["default"].createElement(Button, {
|
9686
9686
|
label: "Anterior",
|