shineout 3.5.0-beta.2 → 3.5.0-beta.3

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/shineout.js CHANGED
@@ -11984,7 +11984,7 @@ var handleStyle = function handleStyle(style) {
11984
11984
  };
11985
11985
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
11986
11986
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
11987
- /* harmony default export */ var version = ('3.5.0-beta.2');
11987
+ /* harmony default export */ var version = ('3.5.0-beta.3');
11988
11988
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
11989
11989
 
11990
11990
 
@@ -17009,8 +17009,6 @@ var cascaderStyle = objectSpread2_default()(objectSpread2_default()({
17009
17009
  },
17010
17010
  hideTag: {},
17011
17011
  list: {
17012
- paddingTop: 3,
17013
- paddingBottom: 3,
17014
17012
  display: 'inline-block',
17015
17013
  overflow: 'auto'
17016
17014
  },
@@ -17062,6 +17060,7 @@ var cascaderStyle = objectSpread2_default()(objectSpread2_default()({
17062
17060
  option: {
17063
17061
  listStyle: 'none',
17064
17062
  lineHeight: src.lineHeightDynamic,
17063
+ minWidth: 64,
17065
17064
  padding: "".concat(src.cascaderOptionPaddingY, " ").concat(src.cascaderOptionPaddingX),
17066
17065
  '&:not($optionDisabled)': {
17067
17066
  cursor: 'pointer'
@@ -19112,16 +19111,16 @@ var ImageStyle = objectSpread2_default()(objectSpread2_default()({}, animation),
19112
19111
  },
19113
19112
  circle: {
19114
19113
  borderRadius: src.imageCircleBorderRadius,
19115
- border: "1px solid ".concat(src.imageBorderColor)
19114
+ outline: "1px solid ".concat(src.imageBorderColor)
19116
19115
  },
19117
19116
  rounded: {
19118
19117
  borderRadius: src.imageBorderRadius,
19119
- border: "1px solid ".concat(src.imageBorderColor)
19118
+ outline: "1px solid ".concat(src.imageBorderColor)
19120
19119
  },
19121
19120
  thumbnail: {
19122
19121
  borderRadius: src.imageBorderRadius,
19123
19122
  backgroundColor: '#FFFFFF',
19124
- border: "1px solid ".concat(src.imageBorderColor),
19123
+ outline: "1px solid ".concat(src.imageBorderColor),
19125
19124
  '& $inner': {
19126
19125
  top: 4,
19127
19126
  left: 4,
@@ -19911,6 +19910,9 @@ var listStyle = {
19911
19910
  border: "".concat(src.listBorderWidth, " solid ").concat(src.listBorderColor),
19912
19911
  borderRadius: src.listBorderRadius
19913
19912
  },
19913
+ wrapperEmpty: {
19914
+ justifyContent: 'center'
19915
+ },
19914
19916
  wrapperSmall: {},
19915
19917
  wrapperLarge: {},
19916
19918
  wrapperStriped: {
@@ -29030,7 +29032,7 @@ var usePositionStyle = function usePositionStyle(config) {
29030
29032
  }
29031
29033
  var targetPosition = position;
29032
29034
  var rootContainer = getContainer() || document.body;
29033
- var closestScrollContainer = getClosestScrollContainer(parentElRef.current);
29035
+ var closestScrollContainer = absolute ? null : getClosestScrollContainer(parentElRef.current);
29034
29036
  var containerRect = rootContainer.getBoundingClientRect();
29035
29037
  var bodyRect = (document.documentElement || document.body).getBoundingClientRect();
29036
29038
  var containerScrollBarWidth = rootContainer.offsetWidth - rootContainer.clientWidth;
@@ -36379,6 +36381,428 @@ var useCascader = function useCascader(props) {
36379
36381
  };
36380
36382
  };
36381
36383
  /* harmony default export */ var use_cascader = (useCascader);
36384
+ ;// CONCATENATED MODULE: ../hooks/src/common/use-resize/index.ts
36385
+
36386
+
36387
+
36388
+ var useResize = function useResize(props) {
36389
+ var targetRef = props.targetRef,
36390
+ _props$timer = props.timer,
36391
+ timer = _props$timer === void 0 ? 100 : _props$timer;
36392
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
36393
+ _useState2 = slicedToArray_default()(_useState, 2),
36394
+ width = _useState2[0],
36395
+ setWidth = _useState2[1];
36396
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
36397
+ _useState4 = slicedToArray_default()(_useState3, 2),
36398
+ height = _useState4[0],
36399
+ setHeight = _useState4[1];
36400
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
36401
+ if (!targetRef.current) return;
36402
+ var el = targetRef.current;
36403
+ if (el) {
36404
+ setWidth(el.clientWidth);
36405
+ setHeight(el.clientHeight);
36406
+ }
36407
+ var clean = addResizeObserver(el, function (entry) {
36408
+ var _props$cb;
36409
+ var _entry$0$contentRect = entry[0].contentRect,
36410
+ width = _entry$0$contentRect.width,
36411
+ height = _entry$0$contentRect.height;
36412
+ setWidth(width);
36413
+ setHeight(height);
36414
+ (_props$cb = props.cb) === null || _props$cb === void 0 || _props$cb.call(props, width, height);
36415
+ }, {
36416
+ timer: timer,
36417
+ direction: false
36418
+ });
36419
+ return function () {
36420
+ if (clean) clean();
36421
+ };
36422
+ }, [targetRef.current]);
36423
+ return {
36424
+ width: width,
36425
+ height: height
36426
+ };
36427
+ };
36428
+ /* harmony default export */ var use_resize = ((/* unused pure expression or super */ null && (useResize)));
36429
+ ;// CONCATENATED MODULE: ../base/src/virtual-scroll/scroll.tsx
36430
+
36431
+
36432
+
36433
+
36434
+
36435
+
36436
+
36437
+ var Scroll = function Scroll(props) {
36438
+ var containerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
36439
+ var scrollRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
36440
+ var wrapperRef = useForkRef(scrollRef, props.wrapperRef);
36441
+ var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
36442
+ timer: null,
36443
+ isMouseDown: false
36444
+ }),
36445
+ context = _useRef.current;
36446
+ var _props$scrollHeight = props.scrollHeight,
36447
+ scrollHeight = _props$scrollHeight === void 0 ? 0 : _props$scrollHeight,
36448
+ _props$scrollWidth = props.scrollWidth,
36449
+ scrollWidth = _props$scrollWidth === void 0 ? 0 : _props$scrollWidth,
36450
+ _props$defaultHeight = props.defaultHeight,
36451
+ defaultHeight = _props$defaultHeight === void 0 ? 0 : _props$defaultHeight;
36452
+ var _useResize = useResize({
36453
+ targetRef: containerRef
36454
+ }),
36455
+ width = _useResize.width,
36456
+ h = _useResize.height;
36457
+ var height = h || defaultHeight;
36458
+ var config = useConfig();
36459
+ var isRtl = config.direction === 'rtl';
36460
+ var scrollerStyle = props.scrollerStyle || {
36461
+ height: '100%',
36462
+ width: '100%',
36463
+ overflow: 'auto'
36464
+ };
36465
+ var containerStyle = defineProperty_default()(defineProperty_default()({
36466
+ height: '100%',
36467
+ width: '100%',
36468
+ display: 'inline-flex',
36469
+ overflow: 'hidden',
36470
+ position: 'sticky'
36471
+ }, isRtl ? 'right' : 'left', 0), "top", 0);
36472
+ var paddingTop = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
36473
+ return Math.max(0, Math.floor(scrollHeight - height));
36474
+ }, [scrollHeight, height]);
36475
+ var placeStyle = {
36476
+ paddingTop: paddingTop,
36477
+ width: scrollWidth,
36478
+ overflow: props.isScrollY ? 'hidden' : 'auto hidden',
36479
+ height: props.isScrollY ? 0 : 1,
36480
+ marginTop: props.isScrollY ? 0 : -1,
36481
+ lineHeight: 0
36482
+ };
36483
+ var extractHeightValue = function extractHeightValue(num) {
36484
+ if (isNumber(num)) return num;
36485
+ var match = num.match(/(\d+)/);
36486
+ if (match) {
36487
+ return parseInt(match[0], 10);
36488
+ }
36489
+ return undefined;
36490
+ };
36491
+ var handleScroll = usePersistFn(function (e) {
36492
+ var onScrollToBottom = props.onScrollToBottom;
36493
+ var target = e.currentTarget;
36494
+ var scrollLeft = target.scrollLeft,
36495
+ scrollTop = target.scrollTop;
36496
+ if (props.height && onScrollToBottom) {
36497
+ var realHeight = extractHeightValue(props.height);
36498
+ if (realHeight !== undefined) {
36499
+ var touchBottom = target.scrollHeight === scrollTop + realHeight;
36500
+ if (touchBottom) onScrollToBottom();
36501
+ }
36502
+ }
36503
+ var maxY = target.scrollHeight - target.clientHeight;
36504
+ var maxX = target.scrollWidth - target.clientWidth;
36505
+ if (!isRtl) {
36506
+ // 解决浏览器缩放以后导致滚动条长度出现小数
36507
+ if (maxX - scrollLeft < 0 || maxX - scrollLeft < 1) scrollLeft = maxX;
36508
+ if (scrollLeft < 0) scrollLeft = 0;
36509
+ } else {
36510
+ if (maxX + scrollLeft < 0 || maxX + scrollLeft < 1) scrollLeft = 0 - maxX;
36511
+ if (scrollLeft > 0) scrollLeft = 0;
36512
+ }
36513
+ if (scrollTop > maxY || maxY - scrollTop < 1) scrollTop = maxY;
36514
+ if (scrollTop < 0) scrollTop = 0;
36515
+ var x = maxX === 0 ? 0 : Math.min(Math.abs(scrollLeft) / maxX, 1);
36516
+ var y = maxY === 0 ? 0 : Math.min(scrollTop / maxY, 1);
36517
+ if (props.onScroll) props.onScroll({
36518
+ scrollLeft: scrollLeft,
36519
+ scrollTop: scrollTop,
36520
+ x: x,
36521
+ y: y,
36522
+ height: height,
36523
+ width: width,
36524
+ fromDrag: context.isMouseDown
36525
+ });
36526
+ });
36527
+ var handleInnerScroll = usePersistFn(function (e) {
36528
+ var scrollTop = e.currentTarget.scrollTop;
36529
+ if (scrollRef.current) {
36530
+ e.currentTarget.scrollTop = 0;
36531
+ scrollRef.current.scrollTop += scrollTop;
36532
+ }
36533
+ });
36534
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
36535
+ className: props.className,
36536
+ style: props.style,
36537
+ onMouseMove: props.onMouseMove,
36538
+ children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute({
36539
+ role: 'scroll'
36540
+ })), {}, {
36541
+ style: scrollerStyle,
36542
+ onScroll: handleScroll,
36543
+ ref: wrapperRef,
36544
+ onMouseDown: function onMouseDown() {
36545
+ context.isMouseDown = true;
36546
+ },
36547
+ onMouseUp: function onMouseUp() {
36548
+ context.isMouseDown = false;
36549
+ },
36550
+ children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute({
36551
+ role: 'scroll-container'
36552
+ })), {}, {
36553
+ style: containerStyle,
36554
+ ref: containerRef,
36555
+ onScroll: handleInnerScroll,
36556
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
36557
+ style: objectSpread2_default()({
36558
+ flexGrow: 1
36559
+ }, props.childrenStyle),
36560
+ children: props.children
36561
+ })
36562
+ })), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
36563
+ style: placeStyle,
36564
+ children: "\xA0"
36565
+ })]
36566
+ }))
36567
+ });
36568
+ };
36569
+ /* harmony default export */ var virtual_scroll_scroll = (Scroll);
36570
+ ;// CONCATENATED MODULE: ../base/src/virtual-scroll/virtual-scroll-list.tsx
36571
+
36572
+
36573
+
36574
+
36575
+
36576
+
36577
+ var VirtualList = function VirtualList(props) {
36578
+ var rowsInView = props.rowsInView,
36579
+ _props$data = props.data,
36580
+ data = _props$data === void 0 ? [] : _props$data,
36581
+ groupKey = props.groupKey,
36582
+ style = props.style,
36583
+ className = props.className,
36584
+ lineHeight = props.lineHeight,
36585
+ height = props.height,
36586
+ renderItem = props.renderItem,
36587
+ customRenderItem = props.customRenderItem,
36588
+ _props$tag = props.tag,
36589
+ tag = _props$tag === void 0 ? 'div' : _props$tag,
36590
+ tagClassName = props.tagClassName,
36591
+ dynamicVirtual = props.dynamicVirtual,
36592
+ virtualRef = props.virtualRef,
36593
+ onControlTypeChange = props.onControlTypeChange;
36594
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
36595
+ _useState2 = slicedToArray_default()(_useState, 2),
36596
+ top = _useState2[0],
36597
+ setTop = _useState2[1];
36598
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
36599
+ _useState4 = slicedToArray_default()(_useState3, 2),
36600
+ offsetY = _useState4[0],
36601
+ setOffsetY = _useState4[1];
36602
+ var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(props.data.length * lineHeight),
36603
+ _useState6 = slicedToArray_default()(_useState5, 2),
36604
+ scrollHeight = _useState6[0],
36605
+ setHeight = _useState6[1];
36606
+ var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
36607
+ _useState8 = slicedToArray_default()(_useState7, 2),
36608
+ startIndex = _useState8[0],
36609
+ setStartIndex = _useState8[1];
36610
+ var wrapperRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
36611
+ var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
36612
+ cachedHeight: [],
36613
+ controlScrollRate: null,
36614
+ heightCallback: null,
36615
+ preIndex: null,
36616
+ topTimer: null,
36617
+ rateTimer: null,
36618
+ shouldUpdateHeight: true
36619
+ }),
36620
+ context = _useRef.current;
36621
+ var getContentHeight = function getContentHeight(index) {
36622
+ var sum = 0;
36623
+ for (var i = 0; i <= index; i++) {
36624
+ sum += context.cachedHeight[i] || lineHeight;
36625
+ }
36626
+ return sum;
36627
+ };
36628
+ var getCurrentIndex = usePersistFn(function () {
36629
+ return startIndex;
36630
+ });
36631
+ var getTop = usePersistFn(function () {
36632
+ return top;
36633
+ });
36634
+ var setRowHeight = usePersistFn(function (index, height) {
36635
+ var beforeHeight = context.cachedHeight[index];
36636
+ if (beforeHeight && beforeHeight === height) return;
36637
+ context.cachedHeight[index] = height;
36638
+ if (context.shouldUpdateHeight) {
36639
+ setHeight(getContentHeight(props.data.length - 1));
36640
+ }
36641
+ var preIndex = context.preIndex;
36642
+ // 解决: 从下往上滚 由于高度变化会导致滚动条跳动
36643
+ if (preIndex && preIndex > startIndex && startIndex === index) {
36644
+ // 发生在顶部
36645
+ if (context.heightCallback) return;
36646
+ var offset = height - (beforeHeight || lineHeight);
36647
+ setOffsetY(function (s) {
36648
+ return s + offset;
36649
+ });
36650
+ }
36651
+ });
36652
+ var updateRateScroll = usePersistFn(function (rate) {
36653
+ var sumHeight = getContentHeight(props.data.length - 1);
36654
+ if (sumHeight === scrollHeight) return;
36655
+ context.shouldUpdateHeight = true;
36656
+ context.heightCallback = function () {
36657
+ if (wrapperRef && wrapperRef.current) {
36658
+ var _scrollHeight = wrapperRef.current.scrollHeight;
36659
+ var clientHeight = wrapperRef.current.clientHeight;
36660
+ var nowTop = wrapperRef.current.scrollTop;
36661
+ var max = _scrollHeight - clientHeight;
36662
+ var _top = rate * max;
36663
+ if (Math.abs(nowTop - _top) < 1) {
36664
+ context.controlScrollRate = null;
36665
+ } else {
36666
+ context.controlScrollRate = rate;
36667
+ wrapperRef.current.scrollTop = _top;
36668
+ }
36669
+ }
36670
+ };
36671
+ setHeight(sumHeight);
36672
+ });
36673
+ var updateIndexAndTopFromTop = function updateIndexAndTopFromTop(scrollTop) {
36674
+ var sum = 0;
36675
+ var nextCurrentIndex = 0;
36676
+ var top = 0;
36677
+ var maxIndex = Math.max(props.data.length - rowsInView, 0);
36678
+ for (var i = 0; i <= maxIndex; i++) {
36679
+ sum += context.cachedHeight[i] || lineHeight;
36680
+ if (scrollTop < sum || i === maxIndex) {
36681
+ nextCurrentIndex = i;
36682
+ var beforeHeight = i === 0 ? 0 : sum - (context.cachedHeight[i] || lineHeight);
36683
+ top = scrollTop - beforeHeight;
36684
+ break;
36685
+ }
36686
+ }
36687
+ if (nextCurrentIndex !== startIndex) {
36688
+ setStartIndex(nextCurrentIndex);
36689
+ }
36690
+ setTop(top);
36691
+ };
36692
+ var handleScrollByStep = usePersistFn(function (step, top) {
36693
+ var _wrapperRef$current;
36694
+ var next = startIndex + step;
36695
+ (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 || _wrapperRef$current.scrollTo({
36696
+ top: next * lineHeight + (top || 0)
36697
+ });
36698
+ });
36699
+ var handleMouseMove = function handleMouseMove() {
36700
+ onControlTypeChange === null || onControlTypeChange === void 0 || onControlTypeChange('mouse');
36701
+ };
36702
+ var handleScroll = function handleScroll(info) {
36703
+ var _props$onScroll;
36704
+ var height = info.height,
36705
+ y = info.y,
36706
+ fromDrag = info.fromDrag;
36707
+ var scrollTop = info.scrollTop;
36708
+ context.shouldUpdateHeight = !fromDrag;
36709
+ var sumHeight = getContentHeight(props.data.length - 1);
36710
+ var max = sumHeight - height;
36711
+ if (scrollTop > max) {
36712
+ scrollTop = max;
36713
+ }
36714
+ if (fromDrag) {
36715
+ var _top2 = y * max;
36716
+ updateIndexAndTopFromTop(_top2);
36717
+ if (context.rateTimer) clearTimeout(context.rateTimer);
36718
+ context.rateTimer = setTimeout(function () {
36719
+ updateRateScroll(y);
36720
+ }, 120);
36721
+ } else {
36722
+ updateIndexAndTopFromTop(scrollTop);
36723
+ }
36724
+ (_props$onScroll = props.onScroll) === null || _props$onScroll === void 0 || _props$onScroll.call(props, info);
36725
+ };
36726
+ var renderList = function renderList() {
36727
+ var items = data.slice(startIndex, startIndex + rowsInView);
36728
+ var Tag = tag;
36729
+ var shouldScroll = getContentHeight(data.length - 1) > height;
36730
+ var nextStyle = objectSpread2_default()({}, style);
36731
+ if (shouldScroll) nextStyle.height = height;
36732
+ var scrollHeight = getContentHeight(data.length - 1);
36733
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(virtual_scroll_scroll, {
36734
+ className: className,
36735
+ style: nextStyle,
36736
+ height: height,
36737
+ scrollWidth: 0,
36738
+ scrollHeight: scrollHeight,
36739
+ wrapperRef: wrapperRef,
36740
+ childrenStyle: {
36741
+ width: '100%'
36742
+ },
36743
+ onScroll: handleScroll,
36744
+ onMouseMove: handleMouseMove,
36745
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)(Tag, {
36746
+ className: tagClassName,
36747
+ style: {
36748
+ transform: "translate3d(0, -".concat(top, "px, 0)")
36749
+ },
36750
+ children: items.map(function (d, i) {
36751
+ if (d[groupKey]) {
36752
+ return /*#__PURE__*/(0,jsx_runtime.jsx)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
36753
+ children: customRenderItem(d, startIndex + i, i)
36754
+ }, i);
36755
+ }
36756
+ return /*#__PURE__*/(0,jsx_runtime.jsx)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
36757
+ children: renderItem(d, startIndex + i, i, setRowHeight)
36758
+ }, dynamicVirtual ? startIndex + i : i);
36759
+ })
36760
+ })
36761
+ });
36762
+ };
36763
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
36764
+ // 记录preIndex
36765
+ context.preIndex = startIndex;
36766
+ }, [startIndex]);
36767
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
36768
+ // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
36769
+ setTop(0);
36770
+ setStartIndex(0);
36771
+ return function () {
36772
+ context.preIndex = null;
36773
+ };
36774
+ }, [data.length]);
36775
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
36776
+ if (offsetY) {
36777
+ if (wrapperRef.current) {
36778
+ setOffsetY(0);
36779
+ setTop(function (s) {
36780
+ return s + offsetY;
36781
+ });
36782
+ wrapperRef.current.scrollTop += offsetY;
36783
+ }
36784
+ }
36785
+ }, [offsetY, startIndex]);
36786
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
36787
+ setHeight(getContentHeight(props.data.length - 1));
36788
+ }, [data.length]);
36789
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
36790
+ if (context.heightCallback) {
36791
+ var cb = context.heightCallback;
36792
+ context.heightCallback = null;
36793
+ cb();
36794
+ }
36795
+ }, [scrollHeight]);
36796
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
36797
+ if (virtualRef !== null && virtualRef !== void 0 && virtualRef.current) {
36798
+ virtualRef.current.scrollByStep = handleScrollByStep;
36799
+ virtualRef.current.getCurrentIndex = getCurrentIndex;
36800
+ virtualRef.current.getTop = getTop;
36801
+ }
36802
+ }, []);
36803
+ return renderList();
36804
+ };
36805
+ /* harmony default export */ var virtual_scroll_list = (VirtualList);
36382
36806
  ;// CONCATENATED MODULE: ../base/src/cascader/node.tsx
36383
36807
 
36384
36808
 
@@ -36505,6 +36929,8 @@ var CascaderNode = function CascaderNode(props) {
36505
36929
 
36506
36930
 
36507
36931
 
36932
+
36933
+
36508
36934
  var CascaderList = function CascaderList(props) {
36509
36935
  var _jssStyle$cascader;
36510
36936
  var jssStyle = props.jssStyle,
@@ -36512,7 +36938,6 @@ var CascaderList = function CascaderList(props) {
36512
36938
  keygen = props.keygen,
36513
36939
  parentId = props.parentId,
36514
36940
  datum = props.datum,
36515
- renderItem = props.renderItem,
36516
36941
  loader = props.loader,
36517
36942
  onChange = props.onChange,
36518
36943
  onPathChange = props.onPathChange,
@@ -36521,8 +36946,28 @@ var CascaderList = function CascaderList(props) {
36521
36946
  childrenKey = props.childrenKey,
36522
36947
  shouldFinal = props.shouldFinal,
36523
36948
  path = props.path,
36524
- mode = props.mode;
36949
+ mode = props.mode,
36950
+ size = props.size,
36951
+ virtual = props.virtual;
36525
36952
  var styles = jssStyle === null || jssStyle === void 0 || (_jssStyle$cascader = jssStyle.cascader) === null || _jssStyle$cascader === void 0 ? void 0 : _jssStyle$cascader.call(jssStyle);
36953
+ var virtualRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
36954
+ scrollByStep: undefined,
36955
+ getCurrentIndex: undefined,
36956
+ getHoverIndex: undefined
36957
+ });
36958
+ var getLineHeight = function getLineHeight() {
36959
+ // if (lineHeightProp && lineHeightProp !== 'auto') return lineHeightProp;
36960
+ if (size === 'small') return 26;
36961
+ if (size === 'default') return 34;
36962
+ if (size === 'large') return 42;
36963
+ return 34;
36964
+ };
36965
+ var lineHeight = getLineHeight();
36966
+ var getHeight = function getHeight() {
36967
+ if (props.height) return props.height;
36968
+ return lineHeight * 7;
36969
+ };
36970
+ var height = getHeight();
36526
36971
 
36527
36972
  // 和 datum 中的 geyKey 不一样,根据 parentId 生成唯一的 key
36528
36973
  var getKey = function getKey(item, index) {
@@ -36541,31 +36986,46 @@ var CascaderList = function CascaderList(props) {
36541
36986
  children: "noData"
36542
36987
  });
36543
36988
  };
36989
+ var renderItem = function renderItem(item, index) {
36990
+ var id = getKey(item, index);
36991
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(node, {
36992
+ jssStyle: jssStyle,
36993
+ active: props.id === id,
36994
+ id: id,
36995
+ data: item,
36996
+ datum: datum,
36997
+ renderItem: props.renderItem,
36998
+ keygen: keygen,
36999
+ loader: loader,
37000
+ onPathChange: onPathChange,
37001
+ onChange: onChange,
37002
+ multiple: multiple,
37003
+ mode: mode,
37004
+ expandTrigger: expandTrigger,
37005
+ childrenKey: childrenKey,
37006
+ shouldFinal: shouldFinal,
37007
+ parentId: parentId,
37008
+ path: path
37009
+ }, id);
37010
+ };
37011
+ var renderSimpleList = function renderSimpleList() {
37012
+ return data.map(renderItem);
37013
+ };
37014
+ var renderVritualList = function renderVritualList() {
37015
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(virtual_scroll_list, {
37016
+ virtualRef: virtualRef,
37017
+ data: data,
37018
+ keygen: keygen,
37019
+ renderItem: renderItem,
37020
+ rowsInView: 20,
37021
+ height: height,
37022
+ lineHeight: lineHeight
37023
+ });
37024
+ };
36544
37025
  if (!data || data.length === 0) return renderEmpety();
36545
37026
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
36546
37027
  className: classnames_default()(styles.list),
36547
- children: data.map(function (item, index) {
36548
- var id = getKey(item, index);
36549
- return /*#__PURE__*/(0,jsx_runtime.jsx)(node, {
36550
- jssStyle: jssStyle,
36551
- active: props.id === id,
36552
- id: id,
36553
- data: item,
36554
- datum: datum,
36555
- renderItem: renderItem,
36556
- keygen: keygen,
36557
- loader: loader,
36558
- onPathChange: onPathChange,
36559
- onChange: onChange,
36560
- multiple: multiple,
36561
- mode: mode,
36562
- expandTrigger: expandTrigger,
36563
- childrenKey: childrenKey,
36564
- shouldFinal: shouldFinal,
36565
- parentId: parentId,
36566
- path: path
36567
- }, id);
36568
- })
37028
+ children: virtual ? renderVritualList() : renderSimpleList()
36569
37029
  });
36570
37030
  };
36571
37031
  /* harmony default export */ var cascader_list = (CascaderList);
@@ -37428,6 +37888,11 @@ var result_isObject = is_isObject,
37428
37888
  result_isUnMatchedData = isUnMatchedData,
37429
37889
  result_isFunc = isFunc,
37430
37890
  result_isArray = isArray;
37891
+ var getValueArr = function getValueArr(v) {
37892
+ return (result_isArray(v) ? v : [v]).filter(function (v) {
37893
+ return v !== undefined && v !== null;
37894
+ });
37895
+ };
37431
37896
  var result_Result = function Result(props) {
37432
37897
  var jssStyle = props.jssStyle,
37433
37898
  multiple = props.multiple,
@@ -37444,6 +37909,7 @@ var result_Result = function Result(props) {
37444
37909
  placeholder = props.placeholder,
37445
37910
  filterText = props.filterText,
37446
37911
  inputText = props.inputText,
37912
+ inputRef = props.inputRef,
37447
37913
  compressed = props.compressed,
37448
37914
  compressedBound = props.compressedBound,
37449
37915
  compressedClassName = props.compressedClassName,
@@ -37488,6 +37954,7 @@ var result_Result = function Result(props) {
37488
37954
  var isEmptyResult = function isEmptyResult() {
37489
37955
  if (!value) return true;
37490
37956
  if (result_isArray(value) && value.length <= 0) return true;
37957
+ return false;
37491
37958
  var datas = getDataByValues(value);
37492
37959
  var hasValue = datas.findIndex(function (item, index) {
37493
37960
  var cur = renderResultContent(item, index, datas);
@@ -37495,7 +37962,9 @@ var result_Result = function Result(props) {
37495
37962
  }) >= 0;
37496
37963
  return !hasValue;
37497
37964
  };
37498
- var empty = isEmptyResult();
37965
+ var empty = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
37966
+ return isEmptyResult();
37967
+ }, [props.value]);
37499
37968
  var isCompressedBound = function isCompressedBound() {
37500
37969
  return compressedBound && result_isNumber(compressedBound) && compressedBound >= 1;
37501
37970
  };
@@ -37613,12 +38082,7 @@ var result_Result = function Result(props) {
37613
38082
  children: content
37614
38083
  }, 'single');
37615
38084
  };
37616
- var getValueArr = function getValueArr(v) {
37617
- return (result_isArray(v) ? v : [v]).filter(function (v) {
37618
- return v !== undefined && v !== null;
37619
- });
37620
- };
37621
- var renderMultipleResult = function renderMultipleResult() {
38085
+ var renderMultipleResult = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
37622
38086
  if (isEmptyResult()) return renderNbsp();
37623
38087
  // [TODO] separator 处理逻辑后续交给 hooks 处理,此处临时处理
37624
38088
  var nextValue = getValueArr(value);
@@ -37637,8 +38101,8 @@ var result_Result = function Result(props) {
37637
38101
  return renderResultItem(d, i, datas, v);
37638
38102
  });
37639
38103
  return result;
37640
- };
37641
- var result = renderMultipleResult();
38104
+ }, [props.value]);
38105
+ var result = renderMultipleResult;
37642
38106
  var moreNumber = getCompressedBound();
37643
38107
  var renderMultipleResultMore = /*#__PURE__*/(0,jsx_runtime.jsx)(result_more, {
37644
38108
  keygen: keygen,
@@ -37657,7 +38121,7 @@ var result_Result = function Result(props) {
37657
38121
  }
37658
38122
  var result = [];
37659
38123
  if (multiple) {
37660
- result.push(compressed ? renderMultipleResultMore : renderMultipleResult());
38124
+ result.push(compressed ? renderMultipleResultMore : renderMultipleResult);
37661
38125
  if (showInput) {
37662
38126
  result.push(renderInput());
37663
38127
  } else if (result.length === 0) {
@@ -37688,8 +38152,18 @@ var result_Result = function Result(props) {
37688
38152
  onFilter === null || onFilter === void 0 || onFilter('', 'blur');
37689
38153
  }, 400);
37690
38154
  }
38155
+
38156
+ // 单选场景下,焦点时自动选中input文本
38157
+ if (focus && showInput && mounted.current) {
38158
+ var nextValue = getValueArr(value);
38159
+ props.setInputText(nextValue[0]);
38160
+ setTimeout(function () {
38161
+ var _inputRef$current;
38162
+ inputRef === null || inputRef === void 0 || (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.select();
38163
+ }, 10);
38164
+ }
37691
38165
  mounted.current = true;
37692
- }, [focus]);
38166
+ }, [focus, showInput]);
37693
38167
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
37694
38168
  handleResetMore();
37695
38169
  }, [valueProp, data]);
@@ -37755,7 +38229,7 @@ var result_Result = function Result(props) {
37755
38229
  var Cascader = function Cascader(props0) {
37756
38230
  var _jssStyle$cascader;
37757
38231
  var props = use_with_form_config(props0);
37758
- var defaultHeight = 232;
38232
+ var defaultHeight = 250;
37759
38233
  var jssStyle = props.jssStyle,
37760
38234
  style = props.style,
37761
38235
  _props$adjust = props.adjust,
@@ -37819,6 +38293,7 @@ var Cascader = function Cascader(props0) {
37819
38293
  onFilterProp = props.onFilter,
37820
38294
  onCollapseProp = props.onCollapse,
37821
38295
  size = props.size,
38296
+ virtual = props.virtual,
37822
38297
  filterSameChange = props.filterSameChange;
37823
38298
  var showInput = isFunc(onFilterProp);
37824
38299
  var styles = jssStyle === null || jssStyle === void 0 || (_jssStyle$cascader = jssStyle.cascader) === null || _jssStyle$cascader === void 0 ? void 0 : _jssStyle$cascader.call(jssStyle);
@@ -38057,13 +38532,8 @@ var Cascader = function Cascader(props0) {
38057
38532
  onChange(datum.getValue(), item);
38058
38533
  };
38059
38534
  var getDataByValues = function getDataByValues(values) {
38060
- var nextValues = values === null || values === void 0 ? void 0 : values.filter(function (v) {
38061
- return !is_isEmpty(v);
38062
- }).reduce(function (acc, val) {
38063
- return acc.concat(val);
38064
- }, []);
38065
- if (!nextValues) return [];
38066
- return datum.getDataByValues(nextValues);
38535
+ if (!values) return [];
38536
+ return datum.getDataByValues(values);
38067
38537
  };
38068
38538
  var checkUnMatched = function checkUnMatched(item) {
38069
38539
  return isUnMatchedData(item);
@@ -38182,9 +38652,11 @@ var Cascader = function Cascader(props0) {
38182
38652
  expandTrigger: expandTrigger,
38183
38653
  childrenKey: childrenKey,
38184
38654
  shouldFinal: shouldFinal,
38655
+ height: height,
38185
38656
  data: tempData,
38186
38657
  id: path[0],
38187
38658
  parentId: "",
38659
+ virtual: virtual,
38188
38660
  path: [],
38189
38661
  mode: mode
38190
38662
  }, 'root')];
@@ -38197,6 +38669,8 @@ var Cascader = function Cascader(props0) {
38197
38669
  tempData = tempData[childrenKey];
38198
38670
  return /*#__PURE__*/(0,jsx_runtime.jsx)(cascader_list, {
38199
38671
  datum: datum,
38672
+ size: size,
38673
+ height: height,
38200
38674
  jssStyle: jssStyle,
38201
38675
  renderItem: renderItem,
38202
38676
  keygen: keygen,
@@ -38209,6 +38683,7 @@ var Cascader = function Cascader(props0) {
38209
38683
  shouldFinal: shouldFinal,
38210
38684
  data: tempData,
38211
38685
  id: path[i + 1],
38686
+ virtual: virtual,
38212
38687
  parentId: path[i],
38213
38688
  path: path.slice(0, i + 1)
38214
38689
  }, p);
@@ -38880,18 +39355,37 @@ function useFormControl(props) {
38880
39355
  var errors = arguments.length > 1 ? arguments[1] : undefined;
38881
39356
  var severErrors = arguments.length > 2 ? arguments[2] : undefined;
38882
39357
  if (!name) return;
38883
- var value = getValue(name, formValue);
38884
- var error = getError(name, errors, severErrors);
38885
- if (error !== errorState) {
38886
- setErrorState(error);
38887
- }
38888
- if (!shallowEqual(value, latestInfo.valueState)) {
38889
- if (value === undefined && defaultValue !== undefined) {
38890
- setValueState(defaultValue);
38891
- } else {
38892
- setValueState(value);
39358
+ if (isArray(name)) {
39359
+ var _value = getValue(name, formValue);
39360
+ var _error = getError(name, errors, severErrors);
39361
+ if (_error !== errorState) {
39362
+ setErrorState(_error);
39363
+ }
39364
+ // format defaultValue
39365
+ var dv = isArray(defaultValue) ? defaultValue : [];
39366
+ var nextValue = [];
39367
+ name.forEach(function (n, index) {
39368
+ if (_value[index] === undefined && dv[index] !== undefined) {
39369
+ nextValue[index] = dv[index];
39370
+ } else {
39371
+ nextValue[index] = _value[index];
39372
+ }
39373
+ });
39374
+ setValueState(nextValue);
39375
+ } else {
39376
+ var _value2 = getValue(name, formValue);
39377
+ var _error2 = getError(name, errors, severErrors);
39378
+ if (_error2 !== errorState) {
39379
+ setErrorState(_error2);
39380
+ }
39381
+ if (!shallowEqual(_value2, latestInfo.valueState)) {
39382
+ if (_value2 === undefined && defaultValue !== undefined) {
39383
+ setValueState(defaultValue);
39384
+ } else {
39385
+ setValueState(_value2);
39386
+ }
39387
+ latestInfo.valueState = _value2;
38893
39388
  }
38894
- latestInfo.valueState = value;
38895
39389
  }
38896
39390
  });
38897
39391
  var validateFiled = use_persist_fn(function (name, v, formV) {
@@ -41432,51 +41926,6 @@ var useDate = function useDate(props) {
41432
41926
  };
41433
41927
  };
41434
41928
  /* harmony default export */ var use_date = (useDate);
41435
- ;// CONCATENATED MODULE: ../hooks/src/common/use-resize/index.ts
41436
-
41437
-
41438
-
41439
- var useResize = function useResize(props) {
41440
- var targetRef = props.targetRef,
41441
- _props$timer = props.timer,
41442
- timer = _props$timer === void 0 ? 100 : _props$timer;
41443
- var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
41444
- _useState2 = slicedToArray_default()(_useState, 2),
41445
- width = _useState2[0],
41446
- setWidth = _useState2[1];
41447
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
41448
- _useState4 = slicedToArray_default()(_useState3, 2),
41449
- height = _useState4[0],
41450
- setHeight = _useState4[1];
41451
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
41452
- if (!targetRef.current) return;
41453
- var el = targetRef.current;
41454
- if (el) {
41455
- setWidth(el.clientWidth);
41456
- setHeight(el.clientHeight);
41457
- }
41458
- var clean = addResizeObserver(el, function (entry) {
41459
- var _props$cb;
41460
- var _entry$0$contentRect = entry[0].contentRect,
41461
- width = _entry$0$contentRect.width,
41462
- height = _entry$0$contentRect.height;
41463
- setWidth(width);
41464
- setHeight(height);
41465
- (_props$cb = props.cb) === null || _props$cb === void 0 || _props$cb.call(props, width, height);
41466
- }, {
41467
- timer: timer,
41468
- direction: false
41469
- });
41470
- return function () {
41471
- if (clean) clean();
41472
- };
41473
- }, [targetRef.current]);
41474
- return {
41475
- width: width,
41476
- height: height
41477
- };
41478
- };
41479
- /* harmony default export */ var use_resize = ((/* unused pure expression or super */ null && (useResize)));
41480
41929
  ;// CONCATENATED MODULE: ../hooks/src/components/use-datepicker/use-time.tsx
41481
41930
 
41482
41931
 
@@ -42886,11 +43335,13 @@ var Quick = function Quick(props) {
42886
43335
  format = props.format,
42887
43336
  options = props.options,
42888
43337
  children = props.children,
42889
- type = props.type;
43338
+ type = props.type,
43339
+ closePop = props.closePop;
42890
43340
  var styles = jssStyle === null || jssStyle === void 0 || (_jssStyle$datePicker = jssStyle.datePicker) === null || _jssStyle$datePicker === void 0 ? void 0 : _jssStyle$datePicker.call(jssStyle);
42891
43341
  var quickDateCache = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
42892
43342
  var quickActiveKey = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
42893
43343
  var handleClick = function handleClick(item, index) {
43344
+ var immediate = item.immediate;
42894
43345
  var itemV = isFunc(item.value) ? item.value() : item.value;
42895
43346
  quickDateCache.current = itemV;
42896
43347
  quickActiveKey.current = index;
@@ -42905,6 +43356,9 @@ var Quick = function Quick(props) {
42905
43356
  });
42906
43357
  props.setDateArr(dateArr);
42907
43358
  props.setCurrentArr(dateArr, 'quick', item);
43359
+ if (immediate && closePop) {
43360
+ closePop();
43361
+ }
42908
43362
  };
42909
43363
  if (!(quickSelect !== null && quickSelect !== void 0 && quickSelect.length)) {
42910
43364
  return children || null;
@@ -43282,6 +43736,7 @@ var Picker = function Picker(props) {
43282
43736
  className: styles === null || styles === void 0 ? void 0 : styles.pickerBox,
43283
43737
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)(quick, {
43284
43738
  quickSelect: props.quickSelect,
43739
+ closePop: props.closePop,
43285
43740
  range: props.range,
43286
43741
  jssStyle: jssStyle,
43287
43742
  dateArr: dateArr,
@@ -48943,383 +49398,6 @@ var usePaginationList = function usePaginationList(props) {
48943
49398
  };
48944
49399
  /* harmony default export */ var use_pagination_list = ((/* unused pure expression or super */ null && (usePaginationList)));
48945
49400
 
48946
- ;// CONCATENATED MODULE: ../base/src/virtual-scroll/scroll.tsx
48947
-
48948
-
48949
-
48950
-
48951
-
48952
-
48953
-
48954
- var Scroll = function Scroll(props) {
48955
- var containerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
48956
- var scrollRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
48957
- var wrapperRef = useForkRef(scrollRef, props.wrapperRef);
48958
- var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
48959
- timer: null,
48960
- isMouseDown: false
48961
- }),
48962
- context = _useRef.current;
48963
- var _props$scrollHeight = props.scrollHeight,
48964
- scrollHeight = _props$scrollHeight === void 0 ? 0 : _props$scrollHeight,
48965
- _props$scrollWidth = props.scrollWidth,
48966
- scrollWidth = _props$scrollWidth === void 0 ? 0 : _props$scrollWidth,
48967
- _props$defaultHeight = props.defaultHeight,
48968
- defaultHeight = _props$defaultHeight === void 0 ? 0 : _props$defaultHeight;
48969
- var _useResize = useResize({
48970
- targetRef: containerRef
48971
- }),
48972
- width = _useResize.width,
48973
- h = _useResize.height;
48974
- var height = h || defaultHeight;
48975
- var config = useConfig();
48976
- var isRtl = config.direction === 'rtl';
48977
- var scrollerStyle = props.scrollerStyle || {
48978
- height: '100%',
48979
- width: '100%',
48980
- overflow: 'auto'
48981
- };
48982
- var containerStyle = defineProperty_default()(defineProperty_default()({
48983
- height: '100%',
48984
- width: '100%',
48985
- display: 'inline-flex',
48986
- overflow: 'hidden',
48987
- position: 'sticky'
48988
- }, isRtl ? 'right' : 'left', 0), "top", 0);
48989
- var paddingTop = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
48990
- return Math.max(0, Math.floor(scrollHeight - height));
48991
- }, [scrollHeight, height]);
48992
- var placeStyle = {
48993
- paddingTop: paddingTop,
48994
- width: scrollWidth,
48995
- overflow: props.isScrollY ? 'hidden' : 'auto hidden',
48996
- height: props.isScrollY ? 0 : 1,
48997
- marginTop: props.isScrollY ? 0 : -1,
48998
- lineHeight: 0
48999
- };
49000
- var extractHeightValue = function extractHeightValue(num) {
49001
- if (isNumber(num)) return num;
49002
- var match = num.match(/(\d+)/);
49003
- if (match) {
49004
- return parseInt(match[0], 10);
49005
- }
49006
- return undefined;
49007
- };
49008
- var handleScroll = usePersistFn(function (e) {
49009
- var onScrollToBottom = props.onScrollToBottom;
49010
- var target = e.currentTarget;
49011
- var scrollLeft = target.scrollLeft,
49012
- scrollTop = target.scrollTop;
49013
- if (props.height && onScrollToBottom) {
49014
- var realHeight = extractHeightValue(props.height);
49015
- if (realHeight !== undefined) {
49016
- var touchBottom = target.scrollHeight === scrollTop + realHeight;
49017
- if (touchBottom) onScrollToBottom();
49018
- }
49019
- }
49020
- var maxY = target.scrollHeight - target.clientHeight;
49021
- var maxX = target.scrollWidth - target.clientWidth;
49022
- if (!isRtl) {
49023
- // 解决浏览器缩放以后导致滚动条长度出现小数
49024
- if (maxX - scrollLeft < 0 || maxX - scrollLeft < 1) scrollLeft = maxX;
49025
- if (scrollLeft < 0) scrollLeft = 0;
49026
- } else {
49027
- if (maxX + scrollLeft < 0 || maxX + scrollLeft < 1) scrollLeft = 0 - maxX;
49028
- if (scrollLeft > 0) scrollLeft = 0;
49029
- }
49030
- if (scrollTop > maxY || maxY - scrollTop < 1) scrollTop = maxY;
49031
- if (scrollTop < 0) scrollTop = 0;
49032
- var x = maxX === 0 ? 0 : Math.min(Math.abs(scrollLeft) / maxX, 1);
49033
- var y = maxY === 0 ? 0 : Math.min(scrollTop / maxY, 1);
49034
- if (props.onScroll) props.onScroll({
49035
- scrollLeft: scrollLeft,
49036
- scrollTop: scrollTop,
49037
- x: x,
49038
- y: y,
49039
- height: height,
49040
- width: width,
49041
- fromDrag: context.isMouseDown
49042
- });
49043
- });
49044
- var handleInnerScroll = usePersistFn(function (e) {
49045
- var scrollTop = e.currentTarget.scrollTop;
49046
- if (scrollRef.current) {
49047
- e.currentTarget.scrollTop = 0;
49048
- scrollRef.current.scrollTop += scrollTop;
49049
- }
49050
- });
49051
- return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
49052
- className: props.className,
49053
- style: props.style,
49054
- onMouseMove: props.onMouseMove,
49055
- children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute({
49056
- role: 'scroll'
49057
- })), {}, {
49058
- style: scrollerStyle,
49059
- onScroll: handleScroll,
49060
- ref: wrapperRef,
49061
- onMouseDown: function onMouseDown() {
49062
- context.isMouseDown = true;
49063
- },
49064
- onMouseUp: function onMouseUp() {
49065
- context.isMouseDown = false;
49066
- },
49067
- children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute({
49068
- role: 'scroll-container'
49069
- })), {}, {
49070
- style: containerStyle,
49071
- ref: containerRef,
49072
- onScroll: handleInnerScroll,
49073
- children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
49074
- style: objectSpread2_default()({
49075
- flexGrow: 1
49076
- }, props.childrenStyle),
49077
- children: props.children
49078
- })
49079
- })), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
49080
- style: placeStyle,
49081
- children: "\xA0"
49082
- })]
49083
- }))
49084
- });
49085
- };
49086
- /* harmony default export */ var virtual_scroll_scroll = (Scroll);
49087
- ;// CONCATENATED MODULE: ../base/src/virtual-scroll/virtual-scroll-list.tsx
49088
-
49089
-
49090
-
49091
-
49092
-
49093
-
49094
- var VirtualList = function VirtualList(props) {
49095
- var rowsInView = props.rowsInView,
49096
- _props$data = props.data,
49097
- data = _props$data === void 0 ? [] : _props$data,
49098
- groupKey = props.groupKey,
49099
- style = props.style,
49100
- className = props.className,
49101
- lineHeight = props.lineHeight,
49102
- height = props.height,
49103
- renderItem = props.renderItem,
49104
- customRenderItem = props.customRenderItem,
49105
- _props$tag = props.tag,
49106
- tag = _props$tag === void 0 ? 'div' : _props$tag,
49107
- tagClassName = props.tagClassName,
49108
- dynamicVirtual = props.dynamicVirtual,
49109
- virtualRef = props.virtualRef,
49110
- onControlTypeChange = props.onControlTypeChange;
49111
- var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
49112
- _useState2 = slicedToArray_default()(_useState, 2),
49113
- top = _useState2[0],
49114
- setTop = _useState2[1];
49115
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
49116
- _useState4 = slicedToArray_default()(_useState3, 2),
49117
- offsetY = _useState4[0],
49118
- setOffsetY = _useState4[1];
49119
- var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(props.data.length * lineHeight),
49120
- _useState6 = slicedToArray_default()(_useState5, 2),
49121
- scrollHeight = _useState6[0],
49122
- setHeight = _useState6[1];
49123
- var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
49124
- _useState8 = slicedToArray_default()(_useState7, 2),
49125
- startIndex = _useState8[0],
49126
- setStartIndex = _useState8[1];
49127
- var wrapperRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
49128
- var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
49129
- cachedHeight: [],
49130
- controlScrollRate: null,
49131
- heightCallback: null,
49132
- preIndex: null,
49133
- topTimer: null,
49134
- rateTimer: null,
49135
- shouldUpdateHeight: true
49136
- }),
49137
- context = _useRef.current;
49138
- var getContentHeight = function getContentHeight(index) {
49139
- var sum = 0;
49140
- for (var i = 0; i <= index; i++) {
49141
- sum += context.cachedHeight[i] || lineHeight;
49142
- }
49143
- return sum;
49144
- };
49145
- var getCurrentIndex = usePersistFn(function () {
49146
- return startIndex;
49147
- });
49148
- var getTop = usePersistFn(function () {
49149
- return top;
49150
- });
49151
- var setRowHeight = usePersistFn(function (index, height) {
49152
- var beforeHeight = context.cachedHeight[index];
49153
- if (beforeHeight && beforeHeight === height) return;
49154
- context.cachedHeight[index] = height;
49155
- if (context.shouldUpdateHeight) {
49156
- setHeight(getContentHeight(props.data.length - 1));
49157
- }
49158
- var preIndex = context.preIndex;
49159
- // 解决: 从下往上滚 由于高度变化会导致滚动条跳动
49160
- if (preIndex && preIndex > startIndex && startIndex === index) {
49161
- // 发生在顶部
49162
- if (context.heightCallback) return;
49163
- var offset = height - (beforeHeight || lineHeight);
49164
- setOffsetY(function (s) {
49165
- return s + offset;
49166
- });
49167
- }
49168
- });
49169
- var updateRateScroll = usePersistFn(function (rate) {
49170
- var sumHeight = getContentHeight(props.data.length - 1);
49171
- if (sumHeight === scrollHeight) return;
49172
- context.shouldUpdateHeight = true;
49173
- context.heightCallback = function () {
49174
- if (wrapperRef && wrapperRef.current) {
49175
- var _scrollHeight = wrapperRef.current.scrollHeight;
49176
- var clientHeight = wrapperRef.current.clientHeight;
49177
- var nowTop = wrapperRef.current.scrollTop;
49178
- var max = _scrollHeight - clientHeight;
49179
- var _top = rate * max;
49180
- if (Math.abs(nowTop - _top) < 1) {
49181
- context.controlScrollRate = null;
49182
- } else {
49183
- context.controlScrollRate = rate;
49184
- wrapperRef.current.scrollTop = _top;
49185
- }
49186
- }
49187
- };
49188
- setHeight(sumHeight);
49189
- });
49190
- var updateIndexAndTopFromTop = function updateIndexAndTopFromTop(scrollTop) {
49191
- var sum = 0;
49192
- var nextCurrentIndex = 0;
49193
- var top = 0;
49194
- var maxIndex = Math.max(props.data.length - rowsInView, 0);
49195
- for (var i = 0; i <= maxIndex; i++) {
49196
- sum += context.cachedHeight[i] || lineHeight;
49197
- if (scrollTop < sum || i === maxIndex) {
49198
- nextCurrentIndex = i;
49199
- var beforeHeight = i === 0 ? 0 : sum - (context.cachedHeight[i] || lineHeight);
49200
- top = scrollTop - beforeHeight;
49201
- break;
49202
- }
49203
- }
49204
- if (nextCurrentIndex !== startIndex) {
49205
- setStartIndex(nextCurrentIndex);
49206
- }
49207
- setTop(top);
49208
- };
49209
- var handleScrollByStep = usePersistFn(function (step, top) {
49210
- var _wrapperRef$current;
49211
- var next = startIndex + step;
49212
- (_wrapperRef$current = wrapperRef.current) === null || _wrapperRef$current === void 0 || _wrapperRef$current.scrollTo({
49213
- top: next * lineHeight + (top || 0)
49214
- });
49215
- });
49216
- var handleMouseMove = function handleMouseMove() {
49217
- onControlTypeChange === null || onControlTypeChange === void 0 || onControlTypeChange('mouse');
49218
- };
49219
- var handleScroll = function handleScroll(info) {
49220
- var _props$onScroll;
49221
- var height = info.height,
49222
- y = info.y,
49223
- fromDrag = info.fromDrag;
49224
- var scrollTop = info.scrollTop;
49225
- context.shouldUpdateHeight = !fromDrag;
49226
- var sumHeight = getContentHeight(props.data.length - 1);
49227
- var max = sumHeight - height;
49228
- if (scrollTop > max) {
49229
- scrollTop = max;
49230
- }
49231
- if (fromDrag) {
49232
- var _top2 = y * max;
49233
- updateIndexAndTopFromTop(_top2);
49234
- if (context.rateTimer) clearTimeout(context.rateTimer);
49235
- context.rateTimer = setTimeout(function () {
49236
- updateRateScroll(y);
49237
- }, 120);
49238
- } else {
49239
- updateIndexAndTopFromTop(scrollTop);
49240
- }
49241
- (_props$onScroll = props.onScroll) === null || _props$onScroll === void 0 || _props$onScroll.call(props, info);
49242
- };
49243
- var renderList = function renderList() {
49244
- var items = data.slice(startIndex, startIndex + rowsInView);
49245
- var Tag = tag;
49246
- var shouldScroll = getContentHeight(data.length - 1) > height;
49247
- var nextStyle = objectSpread2_default()({}, style);
49248
- if (shouldScroll) nextStyle.height = height;
49249
- var scrollHeight = getContentHeight(data.length - 1);
49250
- return /*#__PURE__*/(0,jsx_runtime.jsx)(virtual_scroll_scroll, {
49251
- className: className,
49252
- style: nextStyle,
49253
- height: height,
49254
- scrollWidth: 0,
49255
- scrollHeight: scrollHeight,
49256
- wrapperRef: wrapperRef,
49257
- childrenStyle: {
49258
- width: '100%'
49259
- },
49260
- onScroll: handleScroll,
49261
- onMouseMove: handleMouseMove,
49262
- children: /*#__PURE__*/(0,jsx_runtime.jsx)(Tag, {
49263
- className: tagClassName,
49264
- style: {
49265
- transform: "translate3d(0, -".concat(top, "px, 0)")
49266
- },
49267
- children: items.map(function (d, i) {
49268
- if (d[groupKey]) {
49269
- return /*#__PURE__*/(0,jsx_runtime.jsx)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
49270
- children: customRenderItem(d, startIndex + i, i)
49271
- }, i);
49272
- }
49273
- return /*#__PURE__*/(0,jsx_runtime.jsx)((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, {
49274
- children: renderItem(d, startIndex + i, i, setRowHeight)
49275
- }, dynamicVirtual ? startIndex + i : i);
49276
- })
49277
- })
49278
- });
49279
- };
49280
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
49281
- // 记录preIndex
49282
- context.preIndex = startIndex;
49283
- }, [startIndex]);
49284
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
49285
- // 数据变化的时候清空掉 preIndex, 如果之前有缓存的index, setRowHeight 会有问题
49286
- setTop(0);
49287
- setStartIndex(0);
49288
- return function () {
49289
- context.preIndex = null;
49290
- };
49291
- }, [data.length]);
49292
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
49293
- if (offsetY) {
49294
- if (wrapperRef.current) {
49295
- setOffsetY(0);
49296
- setTop(function (s) {
49297
- return s + offsetY;
49298
- });
49299
- wrapperRef.current.scrollTop += offsetY;
49300
- }
49301
- }
49302
- }, [offsetY, startIndex]);
49303
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
49304
- setHeight(getContentHeight(props.data.length - 1));
49305
- }, [data.length]);
49306
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
49307
- if (context.heightCallback) {
49308
- var cb = context.heightCallback;
49309
- context.heightCallback = null;
49310
- cb();
49311
- }
49312
- }, [scrollHeight]);
49313
- (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
49314
- if (virtualRef !== null && virtualRef !== void 0 && virtualRef.current) {
49315
- virtualRef.current.scrollByStep = handleScrollByStep;
49316
- virtualRef.current.getCurrentIndex = getCurrentIndex;
49317
- virtualRef.current.getTop = getTop;
49318
- }
49319
- }, []);
49320
- return renderList();
49321
- };
49322
- /* harmony default export */ var virtual_scroll_list = (VirtualList);
49323
49401
  ;// CONCATENATED MODULE: ../hooks/src/components/use-treeselect/use-tiled.tsx
49324
49402
 
49325
49403
 
@@ -51703,6 +51781,7 @@ function Select(props0) {
51703
51781
  allowOnFilter: showInput,
51704
51782
  focusSelected: focusSelected,
51705
51783
  inputText: inputText,
51784
+ inputRef: inputRef,
51706
51785
  filterText: filterText,
51707
51786
  onFilter: handleFilter,
51708
51787
  onRef: inputRef,
@@ -52618,6 +52697,7 @@ var list_list_List = function List(props) {
52618
52697
  _props$pagination = props.pagination,
52619
52698
  pagination = _props$pagination === void 0 ? {} : _props$pagination;
52620
52699
  var listClasses = (_props$jssStyle = props.jssStyle) === null || _props$jssStyle === void 0 || (_props$jssStyle$list = _props$jssStyle.list) === null || _props$jssStyle$list === void 0 ? void 0 : _props$jssStyle$list.call(_props$jssStyle);
52700
+ var isEmpty = !isArray(data) || data.length <= 0;
52621
52701
  var inputAble = useInputAble({
52622
52702
  value: props.value,
52623
52703
  onChange: props.onChange,
@@ -52741,6 +52821,7 @@ var list_list_List = function List(props) {
52741
52821
  }
52742
52822
  });
52743
52823
  var renderList = function renderList() {
52824
+ if (isEmpty) return null;
52744
52825
  if (props.fixed) return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
52745
52826
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)(virtual_scroll_list, {
52746
52827
  data: columnData,
@@ -52770,7 +52851,7 @@ var list_list_List = function List(props) {
52770
52851
  }), renderFooter()]
52771
52852
  });
52772
52853
  };
52773
- var wrapperClass = classnames_default()(props.className, listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapper, props.bordered && (listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapperBordered), props.size === 'small' && (listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapperSmall), props.size === 'large' && (listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapperLarge), props.striped && (listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapperStriped));
52854
+ var wrapperClass = classnames_default()(props.className, listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapper, isEmpty && (listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapperEmpty), props.bordered && (listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapperBordered), props.size === 'small' && (listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapperSmall), props.size === 'large' && (listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapperLarge), props.striped && (listClasses === null || listClasses === void 0 ? void 0 : listClasses.wrapperStriped));
52774
52855
  var wrapperStyle = objectSpread2_default()(objectSpread2_default()({}, props.style), {}, {
52775
52856
  height: props.height
52776
52857
  });
@@ -52800,7 +52881,8 @@ var list_jssStyle = {
52800
52881
  checkbox: useCheckboxStyle,
52801
52882
  empty: useEmptyStyle,
52802
52883
  spin: useSpinStyle,
52803
- image: useImageStyle
52884
+ image: useImageStyle,
52885
+ select: useSelectStyle
52804
52886
  };
52805
52887
  /* harmony default export */ var src_list_list_0 = (function (props) {
52806
52888
  return /*#__PURE__*/(0,jsx_runtime.jsx)(src_list_list, objectSpread2_default()({
@@ -65267,7 +65349,7 @@ var upload_interface = __webpack_require__(8821);
65267
65349
 
65268
65350
 
65269
65351
  /* harmony default export */ var src_0 = ({
65270
- version: '3.5.0-beta.2'
65352
+ version: '3.5.0-beta.3'
65271
65353
  });
65272
65354
  }();
65273
65355
  /******/ return __webpack_exports__;