shineout 3.9.3-beta.10 → 3.9.3-beta.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/cjs/index.js CHANGED
@@ -522,5 +522,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
522
522
  // 此文件由脚本自动生成,请勿直接修改。
523
523
  // This file was generated automatically by a script. Please do not modify it directly.
524
524
  var _default = exports.default = {
525
- version: '3.9.3-beta.10'
525
+ version: '3.9.3-beta.12'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12401,7 +12401,7 @@ var handleStyle = function handleStyle(style) {
12401
12401
  };
12402
12402
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12403
12403
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12404
- /* harmony default export */ var version = ('3.9.3-beta.10');
12404
+ /* harmony default export */ var version = ('3.9.3-beta.12');
12405
12405
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12406
12406
 
12407
12407
 
@@ -57809,7 +57809,7 @@ var TreeVirtual = function TreeVirtual(props) {
57809
57809
 
57810
57810
 
57811
57811
 
57812
- var tree_excluded = ["jssStyle", "line", "childrenKey", "data", "value", "mode", "keygen", "virtual", "expanded", "expandIcons", "iconClass", "leafClass", "nodeClass", "contentClass", "rootStyle", "renderItem", "defaultValue", "dataUpdate", "childrenClass", "defaultExpandAll", "defaultExpanded", "parentClickExpand", "doubleClickExpand", "dragImageSelector", "dragImageStyle", "dragSibling", "unmatch", "ignoreSetFlat", "dragHoverExpand", "active", "setActive", "disabled", "inlineNode", "highlight", "className", "onClick", "loader", "getDatum", "onDrop", "onExpand", "onChange", "onDragEnd", "onDragLeave", "onDragOver", "onDragStart", "datum", "rowsInView", "actionOnClick", "tiledData", "height"];
57812
+ var tree_excluded = ["jssStyle", "line", "childrenKey", "data", "value", "mode", "keygen", "virtual", "expanded", "expandIcons", "iconClass", "leafClass", "nodeClass", "contentClass", "rootStyle", "renderItem", "defaultValue", "dataUpdate", "childrenClass", "defaultExpandAll", "defaultExpanded", "parentClickExpand", "doubleClickExpand", "dragImageSelector", "dragImageStyle", "dragSibling", "unmatch", "ignoreSetFlat", "dragHoverExpand", "active", "setActive", "disabled", "inlineNode", "highlight", "className", "onClick", "loader", "getDatum", "onDrop", "onExpand", "onChange", "onDragEnd", "onDragLeave", "onDragOver", "onDragStart", "datum", "rowsInView", "actionOnClick", "tiledData", "height", "leafIcon"];
57813
57813
 
57814
57814
 
57815
57815
 
@@ -57876,6 +57876,7 @@ var Tree = function Tree(props) {
57876
57876
  actionOnClick = props.actionOnClick,
57877
57877
  tiledData = props.tiledData,
57878
57878
  height = props.height,
57879
+ leafIcon = props.leafIcon,
57879
57880
  rest = objectWithoutProperties_default()(props, tree_excluded);
57880
57881
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(propActive),
57881
57882
  _useState2 = slicedToArray_default()(_useState, 2),
@@ -58100,7 +58101,7 @@ var Tree = function Tree(props) {
58100
58101
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(tree_context_Provider, {
58101
58102
  value: objectSpread2_default()(objectSpread2_default()({}, datum), {}, {
58102
58103
  size: props.size,
58103
- leafIcon: props.leafIcon
58104
+ leafIcon: leafIcon
58104
58105
  }),
58105
58106
  children: renderList()
58106
58107
  })
@@ -64537,9 +64538,10 @@ var getHideExpandCol = function getHideExpandCol() {
64537
64538
  }
64538
64539
  return null;
64539
64540
  };
64540
- // 缓冲区列数:左右各2列
64541
- var BUFFER_COUNT = 2;
64541
+ // 默认 overscan 值:可视区域两侧各额外渲染2列
64542
+ var DEFAULT_OVERSCAN = 2;
64542
64543
  var useColumns = function useColumns(props) {
64544
+ var _props$data;
64543
64545
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
64544
64546
  _useState2 = slicedToArray_default()(_useState, 2),
64545
64547
  startIndex = _useState2[0],
@@ -64550,6 +64552,14 @@ var useColumns = function useColumns(props) {
64550
64552
  setRenderedCount = _useState4[1];
64551
64553
  var _props$columns = props.columns,
64552
64554
  propsColumns = _props$columns === void 0 ? [] : _props$columns;
64555
+
64556
+ // 获取 overscan 配置,支持布尔值和对象两种格式
64557
+ var overscan = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
64558
+ var _props$virtualColumn$;
64559
+ if (!props.virtualColumn) return DEFAULT_OVERSCAN;
64560
+ if (typeof props.virtualColumn === 'boolean') return DEFAULT_OVERSCAN;
64561
+ return (_props$virtualColumn$ = props.virtualColumn.overscan) !== null && _props$virtualColumn$ !== void 0 ? _props$virtualColumn$ : DEFAULT_OVERSCAN;
64562
+ }, [props.virtualColumn]);
64553
64563
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
64554
64564
  cachedColumns: null,
64555
64565
  oldColumns: null,
@@ -64636,13 +64646,13 @@ var useColumns = function useColumns(props) {
64636
64646
  if (props.scrollRef.current && sum - scrollLeft >= ((_props$scrollRef$curr = props.scrollRef.current) === null || _props$scrollRef$curr === void 0 ? void 0 : _props$scrollRef$curr.clientWidth)) {
64637
64647
  // 在原有基础上,右侧增加缓冲列
64638
64648
  var visibleCount = j - i;
64639
- setRenderedCount(Math.min(visibleCount + BUFFER_COUNT * 2, len));
64649
+ setRenderedCount(Math.min(visibleCount + overscan * 2, len));
64640
64650
  break;
64641
64651
  }
64642
64652
  }
64643
64653
 
64644
64654
  // 左侧也增加缓冲列,但不能小于0
64645
- var bufferedStartIndex = Math.max(0, i - BUFFER_COUNT);
64655
+ var bufferedStartIndex = Math.max(0, i - overscan);
64646
64656
  currentIndex = bufferedStartIndex;
64647
64657
  break;
64648
64658
  }
@@ -64655,6 +64665,15 @@ var useColumns = function useColumns(props) {
64655
64665
  scrollLeft: 0
64656
64666
  });
64657
64667
  }, []);
64668
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
64669
+ var _props$scrollRef$curr2;
64670
+ if (!props.virtualColumn) return;
64671
+ if (((_props$scrollRef$curr2 = props.scrollRef.current) === null || _props$scrollRef$curr2 === void 0 ? void 0 : _props$scrollRef$curr2.scrollLeft) === 0) {
64672
+ handleScroll({
64673
+ scrollLeft: 0
64674
+ });
64675
+ }
64676
+ }, [(_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.length]);
64658
64677
  var processedColumns = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
64659
64678
  if (!props.virtualColumn) return columns;
64660
64679
  return columns.map(function (col, index) {
@@ -64850,6 +64869,7 @@ var useTableLayout = function useTableLayout(props) {
64850
64869
  });
64851
64870
  };
64852
64871
  var changeColGroup = function changeColGroup(cols, adjust) {
64872
+ if (props.scrolling) return;
64853
64873
  // 修改`Table`被display:none时,表格头样式错乱的问题
64854
64874
  if (cols && cols.every(function (v) {
64855
64875
  return v === 0;
@@ -67484,6 +67504,9 @@ function Table(props) {
67484
67504
  pagination = _props$pagination === void 0 ? {} : _props$pagination;
67485
67505
  var config = useConfig();
67486
67506
  var nestedContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(table_nested_context);
67507
+
67508
+ // 判断是否启用了虚拟列
67509
+ var isVirtualColumnEnabled = !!props.virtualColumn;
67487
67510
  var isRtl = config.direction === 'rtl';
67488
67511
  var tableClasses = props === null || props === void 0 || (_props$jssStyle = props.jssStyle) === null || _props$jssStyle === void 0 || (_props$jssStyle$table = _props$jssStyle.table) === null || _props$jssStyle$table === void 0 ? void 0 : _props$jssStyle$table.call(_props$jssStyle);
67489
67512
  var tbodyRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
@@ -67564,6 +67587,7 @@ function Table(props) {
67564
67587
  });
67565
67588
  var _useTableColumns = use_table_columns({
67566
67589
  columns: props.columns,
67590
+ data: props.data,
67567
67591
  virtualColumn: props.virtualColumn,
67568
67592
  scrollRef: scrollRef,
67569
67593
  showCheckbox: typeof props.onRowSelect === 'function'
@@ -67582,7 +67606,8 @@ function Table(props) {
67582
67606
  columnResizable: props.columnResizable,
67583
67607
  onColumnResize: props.onColumnResize,
67584
67608
  width: props.width,
67585
- isRtl: isRtl
67609
+ isRtl: isRtl,
67610
+ scrolling: isVirtualColumnEnabled && scrolling
67586
67611
  }),
67587
67612
  layoutFunc = _useTableLayout.func,
67588
67613
  colgroup = _useTableLayout.colgroup,
@@ -67741,7 +67766,7 @@ function Table(props) {
67741
67766
  var target = e.currentTarget;
67742
67767
  if (!target) return;
67743
67768
  layoutFunc.checkFloat();
67744
- if (props.virtualColumn) columnInfo.handleScroll({
67769
+ if (isVirtualColumnEnabled) columnInfo.handleScroll({
67745
67770
  scrollLeft: target.scrollLeft
67746
67771
  });
67747
67772
  if (headMirrorScrollRef.current) {
@@ -67763,7 +67788,7 @@ function Table(props) {
67763
67788
  // 虚拟表格的滚动事件
67764
67789
  var handleVirtualScroll = usePersistFn(function (info) {
67765
67790
  virtualInfo.handleScroll(info);
67766
- if (props.virtualColumn) columnInfo.handleScroll(info);
67791
+ if (isVirtualColumnEnabled) columnInfo.handleScroll(info);
67767
67792
  layoutFunc.checkFloat();
67768
67793
  if (headMirrorScrollRef.current) {
67769
67794
  headMirrorScrollRef.current.scrollLeft = info.scrollLeft;
@@ -67803,10 +67828,13 @@ function Table(props) {
67803
67828
  return null;
67804
67829
  };
67805
67830
  var $empty = renderEmpty();
67806
- var tableStyle = {
67807
- width: width,
67808
- borderSpacing: 0
67809
- };
67831
+ var tableStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
67832
+ return {
67833
+ width: width,
67834
+ borderSpacing: 0,
67835
+ tableLayout: 'fixed'
67836
+ };
67837
+ }, [width]);
67810
67838
  var renderTable = function renderTable() {
67811
67839
  var _props$summary, _sticky$top, _props$data2;
67812
67840
  var Group = /*#__PURE__*/(0,jsx_runtime.jsx)(table_colgroup, {
@@ -68168,7 +68196,6 @@ function Table(props) {
68168
68196
  })), renderPagination()]
68169
68197
  });
68170
68198
  }
68171
- ;
68172
68199
  ;// CONCATENATED MODULE: ./src/table/table.tsx
68173
68200
 
68174
68201
 
@@ -74690,7 +74717,7 @@ var upload_interface = __webpack_require__(8821);
74690
74717
 
74691
74718
 
74692
74719
  /* harmony default export */ var src_0 = ({
74693
- version: '3.9.3-beta.10'
74720
+ version: '3.9.3-beta.12'
74694
74721
  });
74695
74722
  }();
74696
74723
  /******/ return __webpack_exports__;