shineout 3.5.3-beta.1 → 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.1'
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.1');
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
 
@@ -47705,9 +47705,11 @@ var useForm = function useForm(props) {
47705
47705
  onChange(function (draft) {
47706
47706
  var values = Object.keys(vals);
47707
47707
  // 针对 name 为数组模式,如 datepicker 的 name={['startTime', 'endTime']} 时,前者校验可能需要依赖后者,因此需要提前将后者数据整合至 draft 用于多字段整合校验
47708
- var nextDraft = Object.assign({}, current(draft), vals);
47708
+ var nextDraft = current(draft);
47709
+ values.forEach(function (key) {
47710
+ deepSet(nextDraft, key, vals[key], deepSetOptions);
47711
+ });
47709
47712
  values.forEach(function (key) {
47710
- deepSet(draft, key, vals[key], deepSetOptions);
47711
47713
  if (option.validate) {
47712
47714
  var _context$validateMap$;
47713
47715
  (_context$validateMap$ = context.validateMap[key]) === null || _context$validateMap$ === void 0 || _context$validateMap$.forEach(function (validate) {
@@ -58573,6 +58575,24 @@ var useTableTree = function useTableTree(props) {
58573
58575
 
58574
58576
 
58575
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
+ }
58576
58596
  var MAX_ROW_SPAN = 200;
58577
58597
  var useTableVirtual = function useTableVirtual(props) {
58578
58598
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
@@ -58597,11 +58617,11 @@ var useTableVirtual = function useTableVirtual(props) {
58597
58617
  setOffsetY = _useState10[1];
58598
58618
  var rowsInView = props.rowsInView === 0 ? props.data.length : props.rowsInView;
58599
58619
  var sleft = props.scrollLeft !== undefined ? props.scrollLeft : innerLeft;
58600
- 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 () {
58601
58621
  var rowSpanColumns = props.columns.filter(function (col) {
58602
58622
  return typeof col.rowSpan === 'function';
58603
58623
  });
58604
- if (rowSpanColumns.length === 0) return;
58624
+ if (rowSpanColumns.length === 0) return null;
58605
58625
  var _rowSpanInfos = [];
58606
58626
  var totalLength = props.data.length;
58607
58627
  var _loop = function _loop(i) {
@@ -58642,12 +58662,17 @@ var useTableVirtual = function useTableVirtual(props) {
58642
58662
  }
58643
58663
  }
58644
58664
  }
58645
- return _rowSpanInfos.map(function (_rowSpanInfo) {
58665
+ var resultArr = _rowSpanInfos.map(function (_rowSpanInfo) {
58646
58666
  var startIndexs = _rowSpanInfo.map(function (arr) {
58647
58667
  return arr[0];
58648
58668
  });
58649
58669
  return Math.min.apply(Math, toConsumableArray_default()(startIndexs));
58650
58670
  });
58671
+ var maxRowSpan = getMaxRowSpanLength(resultArr);
58672
+ return maxRowSpan > 1 ? {
58673
+ rowSpanIndexArray: resultArr,
58674
+ maxRowSpan: maxRowSpan
58675
+ } : null;
58651
58676
  }, [props.data, props.columns]);
58652
58677
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
58653
58678
  cachedHeight: [],
@@ -58708,15 +58733,20 @@ var useTableVirtual = function useTableVirtual(props) {
58708
58733
  var currentIndex = 0;
58709
58734
  var top = 0;
58710
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
+ }
58711
58742
  for (var i = 0; i <= maxIndex; i++) {
58712
58743
  context.rowSpanRows = 0;
58713
58744
  sum += context.cachedHeight[i] || props.rowHeight;
58714
58745
  var rowSpanHeight = 0;
58715
- if (rowSpanInfos) {
58716
- var maxRowSpanLenth = Math.min(rowSpanInfos.length, props.rowsInView > MAX_ROW_SPAN ? props.rowsInView : props.rowsInView || MAX_ROW_SPAN);
58746
+ if (rowSpanInfo) {
58717
58747
  var siblingsIndexs = [];
58718
58748
  for (var k = 0; k < maxRowSpanLenth; k++) {
58719
- if (rowSpanInfos[k] <= i && k > i) {
58749
+ if (rowSpanInfo.rowSpanIndexArray[k] <= i && k > i) {
58720
58750
  siblingsIndexs.push(k);
58721
58751
  }
58722
58752
  }
@@ -59872,29 +59902,23 @@ var Tr = function Tr(props) {
59872
59902
  });
59873
59903
  }
59874
59904
  if (col.type === 'checkbox') {
59875
- if (props.radio) {
59876
- return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
59877
- className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.iconWrapper,
59878
- children: /*#__PURE__*/(0,jsx_runtime.jsx)(base_src_radio_radio, {
59879
- jssStyle: props.jssStyle,
59880
- style: {
59881
- margin: 0
59882
- },
59883
- checked: props.isSelect,
59884
- disabled: props.disabled,
59885
- onChange: function onChange(value) {
59886
- if (value) {
59887
- props.datum.add(data);
59888
- } else {
59889
- props.datum.remove(data);
59890
- }
59891
- }
59892
- })
59893
- });
59894
- }
59895
- return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
59905
+ var instance = /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
59896
59906
  className: tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.iconWrapper,
59897
- 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, {
59898
59922
  jssStyle: props.jssStyle,
59899
59923
  disabled: props.disabled,
59900
59924
  style: {
@@ -59914,6 +59938,7 @@ var Tr = function Tr(props) {
59914
59938
  }
59915
59939
  })
59916
59940
  });
59941
+ return typeof col.render === 'function' ? col.render(props.rawData, props.rowIndex, instance) : instance;
59917
59942
  }
59918
59943
  var content = render_render(col.render, data, props.rowIndex);
59919
59944
  if (col.treeColumnsName) {
@@ -66932,7 +66957,7 @@ var upload_interface = __webpack_require__(8821);
66932
66957
 
66933
66958
 
66934
66959
  /* harmony default export */ var src_0 = ({
66935
- version: '3.5.3-beta.1'
66960
+ version: '3.5.3-beta.3'
66936
66961
  });
66937
66962
  }();
66938
66963
  /******/ return __webpack_exports__;