wargerm 0.2.15 → 0.2.16
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 +49 -37
- package/dist/index.js +49 -37
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
@@ -523,39 +523,48 @@ var WSelect = function WSelect(props) {
|
|
523
523
|
valueEnumList = _useState4[0],
|
524
524
|
setValueEnumList = _useState4[1];
|
525
525
|
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
while (1) {
|
531
|
-
switch (_context.prev = _context.next) {
|
532
|
-
case 0:
|
533
|
-
if (!request) {
|
534
|
-
_context.next = 7;
|
535
|
-
break;
|
536
|
-
}
|
537
|
-
|
538
|
-
_context.next = 3;
|
539
|
-
return request();
|
526
|
+
var _useState5 = useState(null),
|
527
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
528
|
+
resList = _useState6[0],
|
529
|
+
setResList = _useState6[1];
|
540
530
|
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
531
|
+
useEffect(function () {
|
532
|
+
if (!resList) {
|
533
|
+
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
534
|
+
var res, node;
|
535
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
536
|
+
while (1) {
|
537
|
+
switch (_context.prev = _context.next) {
|
538
|
+
case 0:
|
539
|
+
if (!request) {
|
540
|
+
_context.next = 9;
|
541
|
+
break;
|
542
|
+
}
|
551
543
|
|
552
|
-
|
553
|
-
|
554
|
-
|
544
|
+
console.log('request');
|
545
|
+
_context.next = 4;
|
546
|
+
return request();
|
547
|
+
|
548
|
+
case 4:
|
549
|
+
res = _context.sent;
|
550
|
+
setResList(res);
|
551
|
+
onLoad && onLoad(res);
|
552
|
+
node = res.map(function (item) {
|
553
|
+
return /*#__PURE__*/React.createElement(_Select.Option, {
|
554
|
+
key: item.value,
|
555
|
+
value: item.value
|
556
|
+
}, item.label);
|
557
|
+
});
|
558
|
+
setChildrenNode(node);
|
559
|
+
|
560
|
+
case 9:
|
561
|
+
case "end":
|
562
|
+
return _context.stop();
|
563
|
+
}
|
555
564
|
}
|
556
|
-
}
|
557
|
-
}
|
558
|
-
}
|
565
|
+
}, _callee);
|
566
|
+
}))();
|
567
|
+
}
|
559
568
|
|
560
569
|
var valueEnumNode = [];
|
561
570
|
var options = [];
|
@@ -585,7 +594,7 @@ var WSelect = function WSelect(props) {
|
|
585
594
|
|
586
595
|
onLoad && onLoad(options);
|
587
596
|
setValueEnumList(valueEnumNode);
|
588
|
-
}, []);
|
597
|
+
}, [resList]);
|
589
598
|
return /*#__PURE__*/React.createElement(_Select, _objectSpread2({}, extraProps), request ? childrenNode : valueEnum ? valueEnumList : children);
|
590
599
|
};
|
591
600
|
|
@@ -8817,12 +8826,12 @@ var Index$7 = function Index(props) {
|
|
8817
8826
|
Index$7.defaultProps = {};
|
8818
8827
|
|
8819
8828
|
var _excluded$8 = ["list", "render", "partSize"];
|
8820
|
-
var autoScrollInterval = null;
|
8821
8829
|
|
8822
8830
|
function AutoScroll(props) {
|
8823
8831
|
var inner1 = useRef();
|
8824
8832
|
var inner2 = useRef();
|
8825
8833
|
var outer = useRef();
|
8834
|
+
var timer = useRef(null);
|
8826
8835
|
useImperativeHandle(props.cref, function () {
|
8827
8836
|
return {
|
8828
8837
|
tryScroll: tryScroll
|
@@ -8843,8 +8852,8 @@ function AutoScroll(props) {
|
|
8843
8852
|
|
8844
8853
|
|
8845
8854
|
var startScroll = function startScroll() {
|
8846
|
-
if (!
|
8847
|
-
|
8855
|
+
if (!timer.current) {
|
8856
|
+
timer.current = setInterval(function () {
|
8848
8857
|
// 如果已经滚动到inner1的底部,则重置滚动的位置到inner1的头部
|
8849
8858
|
if (outer.current.scrollTop >= inner1.current.offsetHeight) {
|
8850
8859
|
outer.current.scrollTop = 0; // 触发complete事件
|
@@ -8864,8 +8873,11 @@ function AutoScroll(props) {
|
|
8864
8873
|
|
8865
8874
|
|
8866
8875
|
var stopScroll = function stopScroll() {
|
8867
|
-
|
8868
|
-
|
8876
|
+
if (timer.current) {
|
8877
|
+
clearInterval(timer.current);
|
8878
|
+
}
|
8879
|
+
|
8880
|
+
timer.current = null;
|
8869
8881
|
};
|
8870
8882
|
|
8871
8883
|
useEffect(function () {
|
@@ -8876,7 +8888,7 @@ function AutoScroll(props) {
|
|
8876
8888
|
return function () {
|
8877
8889
|
stopScroll();
|
8878
8890
|
};
|
8879
|
-
}, []);
|
8891
|
+
}, [timer]);
|
8880
8892
|
return /*#__PURE__*/React.createElement("div", {
|
8881
8893
|
className: "autoScroll-outer ".concat(props.className),
|
8882
8894
|
ref: outer,
|
package/dist/index.js
CHANGED
@@ -556,39 +556,48 @@ var WSelect = function WSelect(props) {
|
|
556
556
|
valueEnumList = _useState4[0],
|
557
557
|
setValueEnumList = _useState4[1];
|
558
558
|
|
559
|
-
React.
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
while (1) {
|
564
|
-
switch (_context.prev = _context.next) {
|
565
|
-
case 0:
|
566
|
-
if (!request) {
|
567
|
-
_context.next = 7;
|
568
|
-
break;
|
569
|
-
}
|
570
|
-
|
571
|
-
_context.next = 3;
|
572
|
-
return request();
|
559
|
+
var _useState5 = React.useState(null),
|
560
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
561
|
+
resList = _useState6[0],
|
562
|
+
setResList = _useState6[1];
|
573
563
|
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
564
|
+
React.useEffect(function () {
|
565
|
+
if (!resList) {
|
566
|
+
_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
567
|
+
var res, node;
|
568
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
569
|
+
while (1) {
|
570
|
+
switch (_context.prev = _context.next) {
|
571
|
+
case 0:
|
572
|
+
if (!request) {
|
573
|
+
_context.next = 9;
|
574
|
+
break;
|
575
|
+
}
|
584
576
|
|
585
|
-
|
586
|
-
|
587
|
-
|
577
|
+
console.log('request');
|
578
|
+
_context.next = 4;
|
579
|
+
return request();
|
580
|
+
|
581
|
+
case 4:
|
582
|
+
res = _context.sent;
|
583
|
+
setResList(res);
|
584
|
+
onLoad && onLoad(res);
|
585
|
+
node = res.map(function (item) {
|
586
|
+
return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'].Option, {
|
587
|
+
key: item.value,
|
588
|
+
value: item.value
|
589
|
+
}, item.label);
|
590
|
+
});
|
591
|
+
setChildrenNode(node);
|
592
|
+
|
593
|
+
case 9:
|
594
|
+
case "end":
|
595
|
+
return _context.stop();
|
596
|
+
}
|
588
597
|
}
|
589
|
-
}
|
590
|
-
}
|
591
|
-
}
|
598
|
+
}, _callee);
|
599
|
+
}))();
|
600
|
+
}
|
592
601
|
|
593
602
|
var valueEnumNode = [];
|
594
603
|
var options = [];
|
@@ -618,7 +627,7 @@ var WSelect = function WSelect(props) {
|
|
618
627
|
|
619
628
|
onLoad && onLoad(options);
|
620
629
|
setValueEnumList(valueEnumNode);
|
621
|
-
}, []);
|
630
|
+
}, [resList]);
|
622
631
|
return /*#__PURE__*/React__default['default'].createElement(_Select__default['default'], _objectSpread2({}, extraProps), request ? childrenNode : valueEnum ? valueEnumList : children);
|
623
632
|
};
|
624
633
|
|
@@ -8850,12 +8859,12 @@ var Index$7 = function Index(props) {
|
|
8850
8859
|
Index$7.defaultProps = {};
|
8851
8860
|
|
8852
8861
|
var _excluded$8 = ["list", "render", "partSize"];
|
8853
|
-
var autoScrollInterval = null;
|
8854
8862
|
|
8855
8863
|
function AutoScroll(props) {
|
8856
8864
|
var inner1 = React.useRef();
|
8857
8865
|
var inner2 = React.useRef();
|
8858
8866
|
var outer = React.useRef();
|
8867
|
+
var timer = React.useRef(null);
|
8859
8868
|
React.useImperativeHandle(props.cref, function () {
|
8860
8869
|
return {
|
8861
8870
|
tryScroll: tryScroll
|
@@ -8876,8 +8885,8 @@ function AutoScroll(props) {
|
|
8876
8885
|
|
8877
8886
|
|
8878
8887
|
var startScroll = function startScroll() {
|
8879
|
-
if (!
|
8880
|
-
|
8888
|
+
if (!timer.current) {
|
8889
|
+
timer.current = setInterval(function () {
|
8881
8890
|
// 如果已经滚动到inner1的底部,则重置滚动的位置到inner1的头部
|
8882
8891
|
if (outer.current.scrollTop >= inner1.current.offsetHeight) {
|
8883
8892
|
outer.current.scrollTop = 0; // 触发complete事件
|
@@ -8897,8 +8906,11 @@ function AutoScroll(props) {
|
|
8897
8906
|
|
8898
8907
|
|
8899
8908
|
var stopScroll = function stopScroll() {
|
8900
|
-
|
8901
|
-
|
8909
|
+
if (timer.current) {
|
8910
|
+
clearInterval(timer.current);
|
8911
|
+
}
|
8912
|
+
|
8913
|
+
timer.current = null;
|
8902
8914
|
};
|
8903
8915
|
|
8904
8916
|
React.useEffect(function () {
|
@@ -8909,7 +8921,7 @@ function AutoScroll(props) {
|
|
8909
8921
|
return function () {
|
8910
8922
|
stopScroll();
|
8911
8923
|
};
|
8912
|
-
}, []);
|
8924
|
+
}, [timer]);
|
8913
8925
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
8914
8926
|
className: "autoScroll-outer ".concat(props.className),
|
8915
8927
|
ref: outer,
|