shineout 3.9.3-beta.10 → 3.9.3-beta.11

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.11'
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.11');
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),
@@ -58090,6 +58091,12 @@ var Tree = function Tree(props) {
58090
58091
  if (getDatum) getDatum(datum);
58091
58092
  context.mounted = true;
58092
58093
  }, []);
58094
+ var providerValue = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
58095
+ return objectSpread2_default()(objectSpread2_default()({}, datum), {}, {
58096
+ size: props.size,
58097
+ leafIcon: leafIcon
58098
+ });
58099
+ }, [datum, props.size, leafIcon]);
58093
58100
  var _useContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(FormFieldContext),
58094
58101
  fieldId = _useContext.fieldId;
58095
58102
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", objectSpread2_default()(objectSpread2_default()({
@@ -58098,10 +58105,7 @@ var Tree = function Tree(props) {
58098
58105
  id: fieldId
58099
58106
  }, rest), {}, {
58100
58107
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(tree_context_Provider, {
58101
- value: objectSpread2_default()(objectSpread2_default()({}, datum), {}, {
58102
- size: props.size,
58103
- leafIcon: props.leafIcon
58104
- }),
58108
+ value: providerValue,
58105
58109
  children: renderList()
58106
58110
  })
58107
58111
  }));
@@ -64537,9 +64541,10 @@ var getHideExpandCol = function getHideExpandCol() {
64537
64541
  }
64538
64542
  return null;
64539
64543
  };
64540
- // 缓冲区列数:左右各2列
64541
- var BUFFER_COUNT = 2;
64544
+ // 默认 overscan 值:可视区域两侧各额外渲染2列
64545
+ var DEFAULT_OVERSCAN = 2;
64542
64546
  var useColumns = function useColumns(props) {
64547
+ var _props$data;
64543
64548
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
64544
64549
  _useState2 = slicedToArray_default()(_useState, 2),
64545
64550
  startIndex = _useState2[0],
@@ -64550,6 +64555,14 @@ var useColumns = function useColumns(props) {
64550
64555
  setRenderedCount = _useState4[1];
64551
64556
  var _props$columns = props.columns,
64552
64557
  propsColumns = _props$columns === void 0 ? [] : _props$columns;
64558
+
64559
+ // 获取 overscan 配置,支持布尔值和对象两种格式
64560
+ var overscan = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
64561
+ var _props$virtualColumn$;
64562
+ if (!props.virtualColumn) return DEFAULT_OVERSCAN;
64563
+ if (typeof props.virtualColumn === 'boolean') return DEFAULT_OVERSCAN;
64564
+ return (_props$virtualColumn$ = props.virtualColumn.overscan) !== null && _props$virtualColumn$ !== void 0 ? _props$virtualColumn$ : DEFAULT_OVERSCAN;
64565
+ }, [props.virtualColumn]);
64553
64566
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
64554
64567
  cachedColumns: null,
64555
64568
  oldColumns: null,
@@ -64636,13 +64649,13 @@ var useColumns = function useColumns(props) {
64636
64649
  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
64650
  // 在原有基础上,右侧增加缓冲列
64638
64651
  var visibleCount = j - i;
64639
- setRenderedCount(Math.min(visibleCount + BUFFER_COUNT * 2, len));
64652
+ setRenderedCount(Math.min(visibleCount + overscan * 2, len));
64640
64653
  break;
64641
64654
  }
64642
64655
  }
64643
64656
 
64644
64657
  // 左侧也增加缓冲列,但不能小于0
64645
- var bufferedStartIndex = Math.max(0, i - BUFFER_COUNT);
64658
+ var bufferedStartIndex = Math.max(0, i - overscan);
64646
64659
  currentIndex = bufferedStartIndex;
64647
64660
  break;
64648
64661
  }
@@ -64655,6 +64668,15 @@ var useColumns = function useColumns(props) {
64655
64668
  scrollLeft: 0
64656
64669
  });
64657
64670
  }, []);
64671
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
64672
+ var _props$scrollRef$curr2;
64673
+ if (!props.virtualColumn) return;
64674
+ if (((_props$scrollRef$curr2 = props.scrollRef.current) === null || _props$scrollRef$curr2 === void 0 ? void 0 : _props$scrollRef$curr2.scrollLeft) === 0) {
64675
+ handleScroll({
64676
+ scrollLeft: 0
64677
+ });
64678
+ }
64679
+ }, [(_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.length]);
64658
64680
  var processedColumns = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
64659
64681
  if (!props.virtualColumn) return columns;
64660
64682
  return columns.map(function (col, index) {
@@ -64850,6 +64872,7 @@ var useTableLayout = function useTableLayout(props) {
64850
64872
  });
64851
64873
  };
64852
64874
  var changeColGroup = function changeColGroup(cols, adjust) {
64875
+ if (props.scrolling) return;
64853
64876
  // 修改`Table`被display:none时,表格头样式错乱的问题
64854
64877
  if (cols && cols.every(function (v) {
64855
64878
  return v === 0;
@@ -67484,6 +67507,9 @@ function Table(props) {
67484
67507
  pagination = _props$pagination === void 0 ? {} : _props$pagination;
67485
67508
  var config = useConfig();
67486
67509
  var nestedContext = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useContext)(table_nested_context);
67510
+
67511
+ // 判断是否启用了虚拟列
67512
+ var isVirtualColumnEnabled = !!props.virtualColumn;
67487
67513
  var isRtl = config.direction === 'rtl';
67488
67514
  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
67515
  var tbodyRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
@@ -67564,6 +67590,7 @@ function Table(props) {
67564
67590
  });
67565
67591
  var _useTableColumns = use_table_columns({
67566
67592
  columns: props.columns,
67593
+ data: props.data,
67567
67594
  virtualColumn: props.virtualColumn,
67568
67595
  scrollRef: scrollRef,
67569
67596
  showCheckbox: typeof props.onRowSelect === 'function'
@@ -67582,7 +67609,8 @@ function Table(props) {
67582
67609
  columnResizable: props.columnResizable,
67583
67610
  onColumnResize: props.onColumnResize,
67584
67611
  width: props.width,
67585
- isRtl: isRtl
67612
+ isRtl: isRtl,
67613
+ scrolling: isVirtualColumnEnabled && scrolling
67586
67614
  }),
67587
67615
  layoutFunc = _useTableLayout.func,
67588
67616
  colgroup = _useTableLayout.colgroup,
@@ -67741,7 +67769,7 @@ function Table(props) {
67741
67769
  var target = e.currentTarget;
67742
67770
  if (!target) return;
67743
67771
  layoutFunc.checkFloat();
67744
- if (props.virtualColumn) columnInfo.handleScroll({
67772
+ if (isVirtualColumnEnabled) columnInfo.handleScroll({
67745
67773
  scrollLeft: target.scrollLeft
67746
67774
  });
67747
67775
  if (headMirrorScrollRef.current) {
@@ -67763,7 +67791,7 @@ function Table(props) {
67763
67791
  // 虚拟表格的滚动事件
67764
67792
  var handleVirtualScroll = usePersistFn(function (info) {
67765
67793
  virtualInfo.handleScroll(info);
67766
- if (props.virtualColumn) columnInfo.handleScroll(info);
67794
+ if (isVirtualColumnEnabled) columnInfo.handleScroll(info);
67767
67795
  layoutFunc.checkFloat();
67768
67796
  if (headMirrorScrollRef.current) {
67769
67797
  headMirrorScrollRef.current.scrollLeft = info.scrollLeft;
@@ -67803,10 +67831,13 @@ function Table(props) {
67803
67831
  return null;
67804
67832
  };
67805
67833
  var $empty = renderEmpty();
67806
- var tableStyle = {
67807
- width: width,
67808
- borderSpacing: 0
67809
- };
67834
+ var tableStyle = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
67835
+ return {
67836
+ width: width,
67837
+ borderSpacing: 0,
67838
+ tableLayout: isVirtualColumnEnabled ? 'initial' : 'fixed'
67839
+ };
67840
+ }, [width, isVirtualColumnEnabled]);
67810
67841
  var renderTable = function renderTable() {
67811
67842
  var _props$summary, _sticky$top, _props$data2;
67812
67843
  var Group = /*#__PURE__*/(0,jsx_runtime.jsx)(table_colgroup, {
@@ -68168,7 +68199,6 @@ function Table(props) {
68168
68199
  })), renderPagination()]
68169
68200
  });
68170
68201
  }
68171
- ;
68172
68202
  ;// CONCATENATED MODULE: ./src/table/table.tsx
68173
68203
 
68174
68204
 
@@ -74690,7 +74720,7 @@ var upload_interface = __webpack_require__(8821);
74690
74720
 
74691
74721
 
74692
74722
  /* harmony default export */ var src_0 = ({
74693
- version: '3.9.3-beta.10'
74723
+ version: '3.9.3-beta.11'
74694
74724
  });
74695
74725
  }();
74696
74726
  /******/ return __webpack_exports__;