shineout 3.9.0-beta.4 → 3.9.0-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
@@ -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.0-beta.4'
525
+ version: '3.9.0-beta.5'
526
526
  };
package/dist/shineout.js CHANGED
@@ -12386,7 +12386,7 @@ var handleStyle = function handleStyle(style) {
12386
12386
  };
12387
12387
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12388
12388
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12389
- /* harmony default export */ var version = ('3.9.0-beta.4');
12389
+ /* harmony default export */ var version = ('3.9.0-beta.5');
12390
12390
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12391
12391
 
12392
12392
 
@@ -12434,9 +12434,13 @@ var styled = function styled(style, ns) {
12434
12434
  name: ns,
12435
12435
  generateId: createClassname
12436
12436
  });
12437
+ var styledCacheMap = {};
12437
12438
  var getClassName = function getClassName() {
12438
12439
  var classes = hoc();
12439
- return Object.keys(classes).reduce(function (acc, key) {
12440
+ if (styledCacheMap[ns]) {
12441
+ return styledCacheMap[ns];
12442
+ }
12443
+ return styledCacheMap[ns] = Object.keys(classes).reduce(function (acc, key) {
12440
12444
  var k = key;
12441
12445
  var value = '';
12442
12446
  // 给每个组件的root类名添加命名空间
@@ -55058,7 +55062,8 @@ var InputNumber = function InputNumber(props) {
55058
55062
  value: numberFormatProps.value || '',
55059
55063
  className: classnames_default()(forwardProps.className, inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.wrapperNumber),
55060
55064
  onKeyDown: onKeyDown,
55061
- addEnd: addEnd
55065
+ addEnd: addEnd,
55066
+ showClear: props.showClear
55062
55067
  }));
55063
55068
  };
55064
55069
  /* harmony default export */ var input_number = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().memo(InputNumber));
@@ -63263,6 +63268,7 @@ var scroll_table_Scroll = function Scroll(props) {
63263
63268
  // 非定高的Table但依旧采用了virtual渲染方式,需要渲染出全部的data
63264
63269
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
63265
63270
  if (!props.tableRef.current || !props.setFakeVirtual) return;
63271
+ if (props.tableRef.current.style.height || props.tableRef.current.style.flex) return;
63266
63272
  var container = containerRef.current;
63267
63273
  var isContainerVisible = (container === null || container === void 0 ? void 0 : container.offsetParent) !== null;
63268
63274
  if (!isContainerVisible) return;
@@ -64072,7 +64078,9 @@ var useTableVirtual = function useTableVirtual(props) {
64072
64078
  _useState2 = slicedToArray_default()(_useState, 2),
64073
64079
  innerTop = _useState2[0],
64074
64080
  setTop = _useState2[1];
64075
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(props.data.length * props.rowHeight),
64081
+ var strictRowHeight = props.strictRowHeight ? props.strictRowHeight : 0;
64082
+ var defaultScrollHeight = strictRowHeight ? props.data.length * strictRowHeight : props.data.length * props.rowHeight;
64083
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(defaultScrollHeight),
64076
64084
  _useState4 = slicedToArray_default()(_useState3, 2),
64077
64085
  scrollHeight = _useState4[0],
64078
64086
  setHeight = _useState4[1];
@@ -64158,6 +64166,9 @@ var useTableVirtual = function useTableVirtual(props) {
64158
64166
  context = _useRef.current;
64159
64167
  var getContentHeight = function getContentHeight(index) {
64160
64168
  if (props.disabled) return 0;
64169
+ if (strictRowHeight) {
64170
+ return strictRowHeight * (index + 1) + props.theadHeight + props.tfootHeight;
64171
+ }
64161
64172
  var sum = 0;
64162
64173
  for (var i = 0; i <= index; i++) {
64163
64174
  sum += context.cachedHeight[i] || props.rowHeight;
@@ -64193,7 +64204,7 @@ var useTableVirtual = function useTableVirtual(props) {
64193
64204
  var scrollContainerHeight = Math.max(((_props$scrollRef$curr = props.scrollRef.current) === null || _props$scrollRef$curr === void 0 ? void 0 : _props$scrollRef$curr.clientHeight) || 0, 200);
64194
64205
  for (var i = 0; i <= maxIndex; i++) {
64195
64206
  context.rowSpanRows = 0;
64196
- var currentRowHeight = context.cachedHeight[i] || props.rowHeight;
64207
+ var currentRowHeight = strictRowHeight || context.cachedHeight[i] || props.rowHeight;
64197
64208
  sum += currentRowHeight;
64198
64209
  var rowSpanHeight = 0;
64199
64210
  if (rowSpanInfo) {
@@ -64208,13 +64219,13 @@ var useTableVirtual = function useTableVirtual(props) {
64208
64219
  if (rowSpanHeight < scrollContainerHeight) {
64209
64220
  var index = siblingsIndexs[j];
64210
64221
  context.rowSpanRows += 1;
64211
- rowSpanHeight += context.cachedHeight[index] || props.rowHeight;
64222
+ rowSpanHeight += strictRowHeight || context.cachedHeight[index] || props.rowHeight;
64212
64223
  }
64213
64224
  }
64214
64225
  }
64215
64226
  if (scrollTop < sum + rowSpanHeight || i === maxIndex) {
64216
64227
  currentIndex = i;
64217
- var beforeHeight = i === 0 ? 0 : sum - (context.cachedHeight[i] || props.rowHeight);
64228
+ var beforeHeight = i === 0 ? 0 : sum - (strictRowHeight || context.cachedHeight[i] || props.rowHeight);
64218
64229
  top = scrollTop - beforeHeight;
64219
64230
  break;
64220
64231
  }
@@ -64347,10 +64358,10 @@ var useTableVirtual = function useTableVirtual(props) {
64347
64358
  var addonHeight = 0;
64348
64359
  var addonCount = 0;
64349
64360
  for (var i = startIndex + rowsInView; i < props.data.length; i++) {
64350
- var height = context.cachedHeight[i] || props.rowHeight;
64361
+ var height = strictRowHeight || context.cachedHeight[i] || props.rowHeight;
64351
64362
  addonHeight += height;
64352
64363
  addonCount += 1;
64353
- if (addonHeight >= remainHeight + context.cachedHeight[0]) break;
64364
+ if (addonHeight >= remainHeight + (strictRowHeight || context.cachedHeight[0])) break;
64354
64365
  }
64355
64366
  if (addonCount > 0) {
64356
64367
  context.autoAddRows = addonCount;
@@ -65495,7 +65506,6 @@ function useComponentMemo(getValue, condition, shouldUpdate) {
65495
65506
 
65496
65507
 
65497
65508
  function Td(props) {
65498
- var _props$style, _props$style2;
65499
65509
  var col = props.col,
65500
65510
  colSpan = props.colSpan,
65501
65511
  rowSpan = props.rowSpan,
@@ -65507,28 +65517,31 @@ function Td(props) {
65507
65517
  onMouseEnter = props.onMouseEnter,
65508
65518
  onMouseLeave = props.onMouseLeave,
65509
65519
  renderContent = props.renderContent;
65510
- var $td = useComponentMemo(function () {
65511
- var content = renderContent(props.col, props.data);
65512
- return /*#__PURE__*/(0,jsx_runtime.jsx)("td", {
65513
- colSpan: colSpan,
65514
- rowSpan: rowSpan,
65515
- onMouseEnter: onMouseEnter,
65516
- onMouseLeave: onMouseLeave,
65517
- className: className,
65518
- style: props.style,
65519
- dir: direction,
65520
- "data-role": role,
65521
- onClick: onClick,
65522
- children: content
65523
- }, col.key);
65524
- }, [data, className, (_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.left, (_props$style2 = props.style) === null || _props$style2 === void 0 ? void 0 : _props$style2.right, col.type, col.treeColumnsName], props.virtual === 'lazy' ? function (prev, next) {
65525
- if (col.type || col.treeColumnsName) {
65526
- return true;
65527
- }
65528
- return prev.some(function (_, index) {
65529
- return !shallowEqual(prev === null || prev === void 0 ? void 0 : prev[index], next === null || next === void 0 ? void 0 : next[index]);
65530
- }) || !props.scrolling;
65531
- } : undefined);
65520
+ var $td = /*#__PURE__*/(0,jsx_runtime.jsx)("td", {
65521
+ colSpan: colSpan,
65522
+ rowSpan: rowSpan,
65523
+ onMouseEnter: onMouseEnter,
65524
+ onMouseLeave: onMouseLeave,
65525
+ className: className,
65526
+ style: props.style,
65527
+ dir: direction,
65528
+ "data-role": role,
65529
+ onClick: onClick,
65530
+ children: renderContent(props.col, props.data)
65531
+ }, col.key);
65532
+ if (props.virtual === 'lazy') {
65533
+ var _props$style, _props$style2;
65534
+ return useComponentMemo(function () {
65535
+ return $td;
65536
+ }, [data, className, (_props$style = props.style) === null || _props$style === void 0 ? void 0 : _props$style.left, (_props$style2 = props.style) === null || _props$style2 === void 0 ? void 0 : _props$style2.right, col.type, col.treeColumnsName], function (prev, next) {
65537
+ if (col.type || col.treeColumnsName) {
65538
+ return true;
65539
+ }
65540
+ return prev.some(function (_, index) {
65541
+ return !shallowEqual(prev === null || prev === void 0 ? void 0 : prev[index], next === null || next === void 0 ? void 0 : next[index]);
65542
+ }) || !props.scrolling;
65543
+ });
65544
+ }
65532
65545
  return $td;
65533
65546
  }
65534
65547
  ;// CONCATENATED MODULE: ../base/src/table/tr.tsx
@@ -65582,12 +65595,12 @@ var Tr = function Tr(props) {
65582
65595
  }
65583
65596
  return undefined;
65584
65597
  };
65585
- var getTdStyle = usePersistFn(function (column, colSpan) {
65598
+ var getTdStyle = function getTdStyle(column, colSpan) {
65586
65599
  var index = column.index;
65587
65600
  var fixedStyle = getFixedStyle(column.fixed, index, colSpan);
65588
65601
  if (!fixedStyle && !column.style) return;
65589
65602
  return objectSpread2_default()(objectSpread2_default()({}, column.style), fixedStyle);
65590
- });
65603
+ };
65591
65604
  var handleCellClick = usePersistFn(function (data, colIndex) {
65592
65605
  if (!props.onCellClick) return;
65593
65606
  props.onCellClick(data, {
@@ -65597,16 +65610,16 @@ var Tr = function Tr(props) {
65597
65610
  });
65598
65611
  });
65599
65612
  var setVirtualRowHeight = usePersistFn(function () {
65613
+ if (props.strictRowHeight) return;
65600
65614
  if (props.setRowHeight && trRef.current) {
65601
- // 祖先元素不可见时(display: none)
65602
- if (!trRef.current.offsetParent) return;
65603
65615
  var expandHeight = expandRef.current ? expandRef.current.getBoundingClientRect().height : 0;
65604
65616
  props.setRowHeight(props.rowIndex, trRef.current.getBoundingClientRect().height + expandHeight);
65605
65617
  }
65606
65618
  });
65607
65619
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(setVirtualRowHeight, [props.expanded, props.rowIndex, props.bodyScrollWidth, props.resizeFlag]);
65608
65620
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
65609
- if (!trRef.current) return;
65621
+ // 祖先元素不可见时(display: none)
65622
+ if (props.strictRowHeight || !trRef.current || !trRef.current.offsetParent) return;
65610
65623
  var cancelObserver = addResizeObserver(trRef.current, setVirtualRowHeight, {
65611
65624
  direction: 'y'
65612
65625
  });
@@ -65652,7 +65665,7 @@ var Tr = function Tr(props) {
65652
65665
  return _ref.apply(this, arguments);
65653
65666
  };
65654
65667
  }());
65655
- var renderTreeExpand = usePersistFn(function (content) {
65668
+ var renderTreeExpand = function renderTreeExpand(content) {
65656
65669
  var treeIndent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 22;
65657
65670
  var level = props.treeExpandLevel.get(props.originKey) || 0;
65658
65671
  var className = tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.expandWrapper;
@@ -65705,8 +65718,8 @@ var Tr = function Tr(props) {
65705
65718
  },
65706
65719
  children: [$expandIconWrapper, content]
65707
65720
  });
65708
- });
65709
- var renderContent = usePersistFn(function (col, data) {
65721
+ };
65722
+ var renderContent = function renderContent(col, data) {
65710
65723
  if (col.type === 'expand' || col.type === 'row-expand') {
65711
65724
  var renderResult = typeof col.render === 'function' ? col.render(props.rawData, props.rowIndex) : undefined;
65712
65725
  if (typeof renderResult !== 'function') return null;
@@ -65774,8 +65787,8 @@ var Tr = function Tr(props) {
65774
65787
  }
65775
65788
  if (col.render === undefined) return null;
65776
65789
  return content;
65777
- });
65778
- var renderTds = usePersistFn(function (cols, data) {
65790
+ };
65791
+ var renderTds = function renderTds(cols, data) {
65779
65792
  var tds = [];
65780
65793
  var skip = 0;
65781
65794
  var lastRowIndex = data.length - 1;
@@ -65792,7 +65805,7 @@ var Tr = function Tr(props) {
65792
65805
  var last = cols[i + (data[i].colSpan || 1) - 1] || {};
65793
65806
  var isRowSpanTd = data[i].rowSpan > 1;
65794
65807
  var shouldBindMouseEvent = props.hover && hasSiblingRowSpan || isRowSpanTd;
65795
- var showCellHover = props.hoverIndex.has(props.rowIndex);
65808
+ var showCellHover = props.hover && props.hoverIndex.has(props.rowIndex);
65796
65809
  if (!showCellHover && data[i].rowSpan > 1) {
65797
65810
  for (var j = 0; j < data[i].rowSpan; j++) {
65798
65811
  if (props.hoverIndex.has(props.rowIndex + j)) {
@@ -65831,7 +65844,7 @@ var Tr = function Tr(props) {
65831
65844
  if (_loop(i)) continue;
65832
65845
  }
65833
65846
  return tds;
65834
- });
65847
+ };
65835
65848
  var renderExpand = function renderExpand() {
65836
65849
  if (!props.expanded) return null;
65837
65850
  var expandCol = props.expandCol;
@@ -65906,7 +65919,10 @@ var Tr = function Tr(props) {
65906
65919
  return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
65907
65920
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("tr", objectSpread2_default()(objectSpread2_default()({
65908
65921
  ref: trRef,
65909
- className: classnames_default()(props === null || props === void 0 || (_props$rowClassName = props.rowClassName) === null || _props$rowClassName === void 0 ? void 0 : _props$rowClassName.call(props, props.rawData, props.rowIndex), props.striped && props.rowIndex % 2 === 1 && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.rowStriped), props.isSelect && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.rowChecked), props.hover && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.rowHover))
65922
+ className: classnames_default()(props === null || props === void 0 || (_props$rowClassName = props.rowClassName) === null || _props$rowClassName === void 0 ? void 0 : _props$rowClassName.call(props, props.rawData, props.rowIndex), props.striped && props.rowIndex % 2 === 1 && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.rowStriped), props.isSelect && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.rowChecked), props.hover && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.rowHover)),
65923
+ style: {
65924
+ height: props.strictRowHeight ? props.strictRowHeight : undefined
65925
+ }
65910
65926
  }, props.rowEvents), {}, {
65911
65927
  onClick: handleRowClick,
65912
65928
  children: renderTds(props.columns, props.row)
@@ -66004,20 +66020,24 @@ var Tr = function Tr(props) {
66004
66020
  treeCheckAll: props.treeCheckAll,
66005
66021
  onCellClick: props.onCellClick,
66006
66022
  virtual: props.virtual,
66007
- scrolling: props.scrolling
66023
+ scrolling: props.scrolling,
66024
+ strictRowHeight: props.strictRowHeight
66008
66025
  }, trRenderKey);
66009
66026
  };
66010
- var $tbody = useComponentMemo(function () {
66011
- return /*#__PURE__*/(0,jsx_runtime.jsx)("tbody", {
66012
- children: (props.data || []).map(function (item, index) {
66013
- return renderRow(item, index);
66014
- })
66027
+ var $tbody = /*#__PURE__*/(0,jsx_runtime.jsx)("tbody", {
66028
+ children: (props.data || []).map(function (item, index) {
66029
+ return renderRow(item, index);
66030
+ })
66031
+ });
66032
+ if (props.virtual === 'lazy') {
66033
+ return useComponentMemo(function () {
66034
+ return $tbody;
66035
+ }, [props.data, currentIndex], function (prev, next) {
66036
+ return prev.some(function (_, index) {
66037
+ return !shallowEqual(prev === null || prev === void 0 ? void 0 : prev[index], next === null || next === void 0 ? void 0 : next[index]);
66038
+ }) || !props.scrolling;
66015
66039
  });
66016
- }, [props.data, currentIndex], props.virtual === 'lazy' ? function (prev, next) {
66017
- return prev.some(function (_, index) {
66018
- return !shallowEqual(prev === null || prev === void 0 ? void 0 : prev[index], next === null || next === void 0 ? void 0 : next[index]);
66019
- }) || !props.scrolling;
66020
- } : undefined);
66040
+ }
66021
66041
  return $tbody;
66022
66042
  });
66023
66043
  ;// CONCATENATED MODULE: ../base/src/table/tfoot.tsx
@@ -66398,6 +66418,7 @@ var emptyRef = {
66398
66418
  colgroup: colgroup,
66399
66419
  rowsInView: props.rowsInView || 20,
66400
66420
  rowHeight: props.rowHeight || 40,
66421
+ strictRowHeight: props.strictRowHeight,
66401
66422
  scrollRef: scrollRef,
66402
66423
  innerRef: tbodyRef,
66403
66424
  scrollLeft: props.scrollLeft,
@@ -66520,7 +66541,8 @@ var emptyRef = {
66520
66541
  bodyScrollWidth: scrollWidth,
66521
66542
  resizeFlag: resizeFlag,
66522
66543
  treeCheckAll: props.treeCheckAll,
66523
- onCellClick: props.onCellClick
66544
+ onCellClick: props.onCellClick,
66545
+ strictRowHeight: props.strictRowHeight
66524
66546
  };
66525
66547
  var headCommonProps = {
66526
66548
  disabled: props.disabled,
@@ -73345,7 +73367,7 @@ var upload_interface = __webpack_require__(8821);
73345
73367
 
73346
73368
 
73347
73369
  /* harmony default export */ var src_0 = ({
73348
- version: '3.9.0-beta.4'
73370
+ version: '3.9.0-beta.5'
73349
73371
  });
73350
73372
  }();
73351
73373
  /******/ return __webpack_exports__;