shineout 3.5.4-beta.3 → 3.5.4-beta.5

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.4-beta.3'
503
+ version: '3.5.4-beta.5'
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.4-beta.3');
12033
+ /* harmony default export */ var version = ('3.5.4-beta.5');
12034
12034
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12035
12035
 
12036
12036
 
@@ -48043,12 +48043,14 @@ function useFormInstance() {
48043
48043
  ;// CONCATENATED MODULE: ../base/src/form/form.tsx
48044
48044
 
48045
48045
 
48046
+
48046
48047
  var form_excluded = ["jssStyle", "className", "style", "children", "formRef"];
48047
48048
 
48048
48049
 
48049
48050
 
48050
48051
 
48051
48052
 
48053
+
48052
48054
  var Form = function Form(props) {
48053
48055
  var _jssStyle$form;
48054
48056
  var jssStyle = props.jssStyle,
@@ -48089,6 +48091,16 @@ var Form = function Form(props) {
48089
48091
  type: 'withValue'
48090
48092
  });
48091
48093
  });
48094
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
48095
+ _useState2 = slicedToArray_default()(_useState, 2),
48096
+ renderKey = _useState2[0],
48097
+ setRenderKey = _useState2[1];
48098
+ var handleOuterSet = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (vals) {
48099
+ formFunc.setValue(vals);
48100
+ setRenderKey(function (prev) {
48101
+ return prev + 1;
48102
+ });
48103
+ }, [formFunc]);
48092
48104
  var formRefObj = useLatestObj({
48093
48105
  clearValidate: formFunc.clearValidate,
48094
48106
  getValue: formFunc.getValue,
@@ -48098,7 +48110,7 @@ var Form = function Form(props) {
48098
48110
  validateFields: validateFields,
48099
48111
  validateFieldsWithValue: validateFieldsWithValue,
48100
48112
  validateFieldsWithError: formFunc.validateFields,
48101
- set: formFunc.setValue,
48113
+ set: handleOuterSet,
48102
48114
  scrollToField: formFunc.scrollToField
48103
48115
  });
48104
48116
  external_root_React_commonjs2_react_commonjs_react_amd_react_default().useEffect(function () {
@@ -48147,17 +48159,17 @@ var Form = function Form(props) {
48147
48159
  }
48148
48160
  };
48149
48161
  }, [formProps.onSubmit]);
48150
- return /*#__PURE__*/(0,jsx_runtime.jsx)("form", objectSpread2_default()(objectSpread2_default()({}, removeProps(formProps, {
48162
+ return /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.createElement)("form", objectSpread2_default()(objectSpread2_default()({}, removeProps(formProps, {
48151
48163
  onSubmit: true
48152
48164
  })), {}, {
48153
48165
  ref: formElRef,
48154
- children: /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, objectSpread2_default()(objectSpread2_default()({}, ProviderProps), {}, {
48155
- children: /*#__PURE__*/(0,jsx_runtime.jsx)(FormContext.Provider, {
48156
- value: formRefObj,
48157
- children: children
48158
- })
48159
- }))
48160
- }));
48166
+ key: renderKey
48167
+ }), /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, objectSpread2_default()(objectSpread2_default()({}, ProviderProps), {}, {
48168
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)(FormContext.Provider, {
48169
+ value: formRefObj,
48170
+ children: children
48171
+ })
48172
+ })));
48161
48173
  };
48162
48174
  /* harmony default export */ var base_src_form_form = (Form);
48163
48175
  ;// CONCATENATED MODULE: ./src/form/form.tsx
@@ -48589,8 +48601,7 @@ var FormFieldSet = function FormFieldSet(props) {
48589
48601
  });
48590
48602
  }
48591
48603
  valueArr.forEach(function (v, i) {
48592
- var _context$ids$i;
48593
- if (context.lastValues[i] !== v) {
48604
+ if (context.lastValues.length !== valueArr.length) {
48594
48605
  context.ids[i] = generateUUID();
48595
48606
  }
48596
48607
  result.push( /*#__PURE__*/(0,jsx_runtime.jsx)(Provider, {
@@ -48639,7 +48650,7 @@ var FormFieldSet = function FormFieldSet(props) {
48639
48650
  formFunc === null || formFunc === void 0 || formFunc.spliceError(name, i);
48640
48651
  }
48641
48652
  })
48642
- }, (_context$ids$i = context.ids[i]) !== null && _context$ids$i !== void 0 ? _context$ids$i : i));
48653
+ }, context.ids[i]));
48643
48654
  });
48644
48655
 
48645
48656
  // 更新 lastValues
@@ -58492,6 +58503,7 @@ var useTableSort = function useTableSort(props) {
58492
58503
 
58493
58504
 
58494
58505
 
58506
+
58495
58507
  var getExpandData = function getExpandData(_treeData, keys, keygen, treeColumnsName) {
58496
58508
  var expandKeys = keys;
58497
58509
  var expandSet = new Set(expandKeys);
@@ -58592,6 +58604,9 @@ var useTableTree = function useTableTree(props) {
58592
58604
  var newExpandKeys = expandKeysState.filter(function (key) {
58593
58605
  return !unmatchExpandKeys.includes(key);
58594
58606
  });
58607
+ if (shallowEqual(newExpandKeys, expandKeysState)) {
58608
+ return;
58609
+ }
58595
58610
  setExpandKeysState(newExpandKeys);
58596
58611
  }, [unmatchExpandKeys, expandKeysState]);
58597
58612
  return {
@@ -58626,7 +58641,6 @@ function getMaxRowSpanLength(input) {
58626
58641
  }
58627
58642
  return Math.max.apply(Math, toConsumableArray_default()(Array.from(map.values())));
58628
58643
  }
58629
- var MAX_ROW_SPAN = 200;
58630
58644
  var useTableVirtual = function useTableVirtual(props) {
58631
58645
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
58632
58646
  _useState2 = slicedToArray_default()(_useState, 2),
@@ -58659,7 +58673,7 @@ var useTableVirtual = function useTableVirtual(props) {
58659
58673
  var totalLength = props.data.length;
58660
58674
  var _loop = function _loop(i) {
58661
58675
  var startIndex = i;
58662
- var rowSpanInfo = rowSpanColumns.map(function (col) {
58676
+ var _rowSpanInfo = rowSpanColumns.map(function (col) {
58663
58677
  var rowSpan = col.rowSpan;
58664
58678
  function getRowSpanCount(index, _count) {
58665
58679
  var count = _count;
@@ -58675,7 +58689,7 @@ var useTableVirtual = function useTableVirtual(props) {
58675
58689
  var count = getRowSpanCount(i, 1);
58676
58690
  return [startIndex, startIndex + count - 1];
58677
58691
  });
58678
- _rowSpanInfos.push(rowSpanInfo);
58692
+ _rowSpanInfos.push(_rowSpanInfo);
58679
58693
  };
58680
58694
  for (var i = 0; i < totalLength; i++) {
58681
58695
  _loop(i);
@@ -58701,10 +58715,12 @@ var useTableVirtual = function useTableVirtual(props) {
58701
58715
  });
58702
58716
  return Math.min.apply(Math, toConsumableArray_default()(startIndexs));
58703
58717
  });
58704
- var maxRowSpan = getMaxRowSpanLength(resultArr);
58705
- return maxRowSpan > 1 ? {
58718
+
58719
+ // 根据data计算出实际需要的最大合并行数
58720
+ var _maxRowSpan = getMaxRowSpanLength(resultArr);
58721
+ return _maxRowSpan > 1 ? {
58706
58722
  rowSpanIndexArray: resultArr,
58707
- maxRowSpan: maxRowSpan
58723
+ maxRowSpan: _maxRowSpan
58708
58724
  } : null;
58709
58725
  }, [props.data, props.columns]);
58710
58726
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
@@ -58761,32 +58777,31 @@ var useTableVirtual = function useTableVirtual(props) {
58761
58777
  }
58762
58778
  });
58763
58779
  var updateIndexAndTopFromTop = function updateIndexAndTopFromTop(scrollTop) {
58780
+ var _props$scrollRef$curr;
58764
58781
  if (props.disabled) return;
58765
58782
  var sum = 0;
58766
58783
  var currentIndex = 0;
58767
58784
  var top = 0;
58768
58785
  var maxIndex = Math.max(props.data.length - rowsInView, 0);
58769
- var maxRowSpanLenth = 0;
58770
- if (rowSpanInfo) {
58771
- maxRowSpanLenth = Math.min(rowSpanInfo.rowSpanIndexArray.length,
58772
- // 根据data计算出实际需要的最大合并行数(rowSpanInfo.maxRowSpan),当rowSpanInfo.maxRowSpan大于外部传的rowsInView时,使用rowSpanInfo.maxRowSpan
58773
- Math.max(rowSpanInfo.maxRowSpan, props.rowsInView > MAX_ROW_SPAN ? props.rowsInView : props.rowsInView || MAX_ROW_SPAN));
58774
- }
58786
+ var scrollContainerHeight = Math.max(((_props$scrollRef$curr = props.scrollRef.current) === null || _props$scrollRef$curr === void 0 ? void 0 : _props$scrollRef$curr.clientHeight) || 0, 200);
58775
58787
  for (var i = 0; i <= maxIndex; i++) {
58776
58788
  context.rowSpanRows = 0;
58777
58789
  sum += context.cachedHeight[i] || props.rowHeight;
58778
58790
  var rowSpanHeight = 0;
58779
58791
  if (rowSpanInfo) {
58780
58792
  var siblingsIndexs = [];
58781
- for (var k = i; k < maxRowSpanLenth + i; k++) {
58793
+ for (var k = i; k < rowSpanInfo.maxRowSpan + i; k++) {
58782
58794
  if (rowSpanInfo.rowSpanIndexArray[k] <= i && k > i) {
58783
58795
  siblingsIndexs.push(k);
58784
58796
  }
58785
58797
  }
58786
58798
  for (var j = 0; j < siblingsIndexs.length; j++) {
58787
- var index = siblingsIndexs[j];
58788
- context.rowSpanRows += 1;
58789
- rowSpanHeight += context.cachedHeight[index] || props.rowHeight;
58799
+ // 在当前滚动容器滚动一屏上方销毁tr,不在可见区域内销毁重建,避免引起可见的单元格(合并的)内容闪烁
58800
+ if (rowSpanHeight < scrollContainerHeight) {
58801
+ var index = siblingsIndexs[j];
58802
+ context.rowSpanRows += 1;
58803
+ rowSpanHeight += context.cachedHeight[index] || props.rowHeight;
58804
+ }
58790
58805
  }
58791
58806
  }
58792
58807
  if (scrollTop < sum + rowSpanHeight || i === maxIndex) {
@@ -59994,23 +60009,30 @@ var Tr = function Tr(props) {
59994
60009
  var col = cols[i];
59995
60010
  if (data[i]) {
59996
60011
  var last = cols[i + (data[i].colSpan || 1) - 1] || {};
60012
+ var isRowSpanTd = data[i].rowSpan > 1;
60013
+ var $tdContent = renderContent(col, data[i].data);
59997
60014
  var td = /*#__PURE__*/(0,jsx_runtime.jsx)("td", {
59998
60015
  colSpan: data[i].colSpan,
59999
60016
  rowSpan: data[i].rowSpan,
60000
- onMouseEnter: props.hover && hasSiblingRowSpan || data[i].rowSpan > 1 ? function () {
60017
+ onMouseEnter: props.hover && hasSiblingRowSpan || isRowSpanTd ? function () {
60001
60018
  props.handleCellHover(props.rowIndex, data[i].rowSpan);
60002
60019
  } : undefined,
60003
- onMouseLeave: props.hover && hasSiblingRowSpan || data[i].rowSpan > 1 ? function () {
60020
+ onMouseLeave: props.hover && hasSiblingRowSpan || isRowSpanTd ? function () {
60004
60021
  props.handleCellHover(-1, 0);
60005
60022
  } : undefined,
60006
- className: classnames_default()(col.className, col.type === 'checkbox' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellCheckbox), col.fixed === 'left' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLeft), col.fixed === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedRight), col.align === 'center' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignCenter), col.align === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignRight), (col.lastFixed || col.firstFixed || last.lastFixed) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLast), lastRowIndex === i && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellIgnoreBorder), props.hoverIndex.has(props.rowIndex) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellHover), data[i].rowSpan > 1 && props.isCellHover(props.rowIndex, data[i].rowSpan) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellHover)),
60023
+ className: classnames_default()(col.className, col.type === 'checkbox' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellCheckbox), col.fixed === 'left' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLeft), col.fixed === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedRight), col.align === 'center' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignCenter), col.align === 'right' && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellAlignRight), (col.lastFixed || col.firstFixed || last.lastFixed) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellFixedLast), lastRowIndex === i && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellIgnoreBorder), props.hoverIndex.has(props.rowIndex) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellHover), isRowSpanTd && props.isCellHover(props.rowIndex, data[i].rowSpan) && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.cellHover)),
60007
60024
  style: getTdStyle(col, data[i].colSpan),
60008
60025
  dir: config.direction,
60009
60026
  "data-role": col.type === 'checkbox' ? 'checkbox' : undefined,
60010
60027
  onClick: props.onCellClick ? function () {
60011
60028
  return handleCellClick(data[i].data, i);
60012
60029
  } : undefined,
60013
- children: renderContent(col, data[i].data)
60030
+ children: isRowSpanTd ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
60031
+ style: {
60032
+ height: 0
60033
+ },
60034
+ children: $tdContent
60035
+ }) : $tdContent
60014
60036
  }, col.key);
60015
60037
  tds.push(td);
60016
60038
  if (data[i].colSpan) skip = data[i].colSpan - 1;
@@ -66990,7 +67012,7 @@ var upload_interface = __webpack_require__(8821);
66990
67012
 
66991
67013
 
66992
67014
  /* harmony default export */ var src_0 = ({
66993
- version: '3.5.4-beta.3'
67015
+ version: '3.5.4-beta.5'
66994
67016
  });
66995
67017
  }();
66996
67018
  /******/ return __webpack_exports__;