shineout 3.5.3-beta.2 → 3.5.3-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/cjs/index.js CHANGED
@@ -500,5 +500,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
500
500
  // 此文件由脚本自动生成,请勿直接修改。
501
501
  // This file was generated automatically by a script. Please do not modify it directly.
502
502
  var _default = exports.default = {
503
- version: '3.5.3-beta.2'
503
+ version: '3.5.3-beta.3'
504
504
  };
package/dist/shineout.js CHANGED
@@ -12030,7 +12030,7 @@ var handleStyle = function handleStyle(style) {
12030
12030
  };
12031
12031
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12032
12032
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12033
- /* harmony default export */ var version = ('3.5.3-beta.2');
12033
+ /* harmony default export */ var version = ('3.5.3-beta.3');
12034
12034
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12035
12035
 
12036
12036
 
@@ -58575,6 +58575,24 @@ var useTableTree = function useTableTree(props) {
58575
58575
 
58576
58576
 
58577
58577
 
58578
+
58579
+ // 找出最大的连续数字的个数
58580
+ function getMaxRowSpanLength(input) {
58581
+ var map = new Map();
58582
+ var _iterator = createForOfIteratorHelper_default()(input),
58583
+ _step;
58584
+ try {
58585
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
58586
+ var num = _step.value;
58587
+ map.set(num, (map.get(num) || 0) + 1);
58588
+ }
58589
+ } catch (err) {
58590
+ _iterator.e(err);
58591
+ } finally {
58592
+ _iterator.f();
58593
+ }
58594
+ return Math.max.apply(Math, toConsumableArray_default()(Array.from(map.values())));
58595
+ }
58578
58596
  var MAX_ROW_SPAN = 200;
58579
58597
  var useTableVirtual = function useTableVirtual(props) {
58580
58598
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
@@ -58599,11 +58617,11 @@ var useTableVirtual = function useTableVirtual(props) {
58599
58617
  setOffsetY = _useState10[1];
58600
58618
  var rowsInView = props.rowsInView === 0 ? props.data.length : props.rowsInView;
58601
58619
  var sleft = props.scrollLeft !== undefined ? props.scrollLeft : innerLeft;
58602
- var rowSpanInfos = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
58620
+ var rowSpanInfo = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(function () {
58603
58621
  var rowSpanColumns = props.columns.filter(function (col) {
58604
58622
  return typeof col.rowSpan === 'function';
58605
58623
  });
58606
- if (rowSpanColumns.length === 0) return;
58624
+ if (rowSpanColumns.length === 0) return null;
58607
58625
  var _rowSpanInfos = [];
58608
58626
  var totalLength = props.data.length;
58609
58627
  var _loop = function _loop(i) {
@@ -58644,12 +58662,17 @@ var useTableVirtual = function useTableVirtual(props) {
58644
58662
  }
58645
58663
  }
58646
58664
  }
58647
- return _rowSpanInfos.map(function (_rowSpanInfo) {
58665
+ var resultArr = _rowSpanInfos.map(function (_rowSpanInfo) {
58648
58666
  var startIndexs = _rowSpanInfo.map(function (arr) {
58649
58667
  return arr[0];
58650
58668
  });
58651
58669
  return Math.min.apply(Math, toConsumableArray_default()(startIndexs));
58652
58670
  });
58671
+ var maxRowSpan = getMaxRowSpanLength(resultArr);
58672
+ return maxRowSpan > 1 ? {
58673
+ rowSpanIndexArray: resultArr,
58674
+ maxRowSpan: maxRowSpan
58675
+ } : null;
58653
58676
  }, [props.data, props.columns]);
58654
58677
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
58655
58678
  cachedHeight: [],
@@ -58710,15 +58733,20 @@ var useTableVirtual = function useTableVirtual(props) {
58710
58733
  var currentIndex = 0;
58711
58734
  var top = 0;
58712
58735
  var maxIndex = Math.max(props.data.length - rowsInView, 0);
58736
+ var maxRowSpanLenth = 0;
58737
+ if (rowSpanInfo) {
58738
+ maxRowSpanLenth = Math.min(rowSpanInfo.rowSpanIndexArray.length,
58739
+ // 根据data计算出实际需要的最大合并行数(rowSpanInfo.maxRowSpan),当rowSpanInfo.maxRowSpan大于外部传的rowsInView时,使用rowSpanInfo.maxRowSpan
58740
+ Math.max(rowSpanInfo.maxRowSpan, props.rowsInView > MAX_ROW_SPAN ? props.rowsInView : props.rowsInView || MAX_ROW_SPAN));
58741
+ }
58713
58742
  for (var i = 0; i <= maxIndex; i++) {
58714
58743
  context.rowSpanRows = 0;
58715
58744
  sum += context.cachedHeight[i] || props.rowHeight;
58716
58745
  var rowSpanHeight = 0;
58717
- if (rowSpanInfos) {
58718
- var maxRowSpanLenth = Math.min(rowSpanInfos.length, props.rowsInView > MAX_ROW_SPAN ? props.rowsInView : props.rowsInView || MAX_ROW_SPAN);
58746
+ if (rowSpanInfo) {
58719
58747
  var siblingsIndexs = [];
58720
58748
  for (var k = 0; k < maxRowSpanLenth; k++) {
58721
- if (rowSpanInfos[k] <= i && k > i) {
58749
+ if (rowSpanInfo.rowSpanIndexArray[k] <= i && k > i) {
58722
58750
  siblingsIndexs.push(k);
58723
58751
  }
58724
58752
  }
@@ -59874,29 +59902,23 @@ var Tr = function Tr(props) {
59874
59902
  });
59875
59903
  }
59876
59904
  if (col.type === 'checkbox') {
59877
- if (props.radio) {
59878
- return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
59879
- className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.iconWrapper,
59880
- children: /*#__PURE__*/(0,jsx_runtime.jsx)(base_src_radio_radio, {
59881
- jssStyle: props.jssStyle,
59882
- style: {
59883
- margin: 0
59884
- },
59885
- checked: props.isSelect,
59886
- disabled: props.disabled,
59887
- onChange: function onChange(value) {
59888
- if (value) {
59889
- props.datum.add(data);
59890
- } else {
59891
- props.datum.remove(data);
59892
- }
59893
- }
59894
- })
59895
- });
59896
- }
59897
- return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
59905
+ var instance = /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
59898
59906
  className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.iconWrapper,
59899
- children: /*#__PURE__*/(0,jsx_runtime.jsx)(base_src_checkbox_checkbox, {
59907
+ children: props.radio ? /*#__PURE__*/(0,jsx_runtime.jsx)(base_src_radio_radio, {
59908
+ jssStyle: props.jssStyle,
59909
+ style: {
59910
+ margin: 0
59911
+ },
59912
+ checked: props.isSelect,
59913
+ disabled: props.disabled,
59914
+ onChange: function onChange(value) {
59915
+ if (value) {
59916
+ props.datum.add(data);
59917
+ } else {
59918
+ props.datum.remove(data);
59919
+ }
59920
+ }
59921
+ }) : /*#__PURE__*/(0,jsx_runtime.jsx)(base_src_checkbox_checkbox, {
59900
59922
  jssStyle: props.jssStyle,
59901
59923
  disabled: props.disabled,
59902
59924
  style: {
@@ -59916,6 +59938,7 @@ var Tr = function Tr(props) {
59916
59938
  }
59917
59939
  })
59918
59940
  });
59941
+ return typeof col.render === 'function' ? col.render(props.rawData, props.rowIndex, instance) : instance;
59919
59942
  }
59920
59943
  var content = render_render(col.render, data, props.rowIndex);
59921
59944
  if (col.treeColumnsName) {
@@ -66934,7 +66957,7 @@ var upload_interface = __webpack_require__(8821);
66934
66957
 
66935
66958
 
66936
66959
  /* harmony default export */ var src_0 = ({
66937
- version: '3.5.3-beta.2'
66960
+ version: '3.5.3-beta.3'
66938
66961
  });
66939
66962
  }();
66940
66963
  /******/ return __webpack_exports__;