shineout 3.9.0-beta.3 → 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.3'
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.3');
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类名添加命名空间
@@ -17285,10 +17289,17 @@ var useCarouselStyle = styled(carousel_carousel, 'carousel');
17285
17289
  /* harmony default export */ var shineout_style_src_carousel = ((/* unused pure expression or super */ null && (useCarouselStyle)));
17286
17290
  ;// CONCATENATED MODULE: ../shineout-style/src/input/input-border.ts
17287
17291
 
17292
+
17293
+ var supportsHas = function supportsHas() {
17294
+ if (typeof CSS === 'undefined' || typeof CSS.supports === 'undefined') {
17295
+ return false;
17296
+ }
17297
+ return CSS.supports('selector(:has(*))');
17298
+ };
17288
17299
  /* harmony default export */ var input_border = (function (name) {
17289
- var _ref;
17300
+ var _ref2;
17290
17301
  var token = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
17291
- return _ref = {}, defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(_ref, name, {
17302
+ return _ref2 = {}, defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(defineProperty_default()(_ref2, name, objectSpread2_default()({
17292
17303
  boxSizing: 'border-box',
17293
17304
  borderRadius: token.borderRadius,
17294
17305
  background: token.backgroundColor,
@@ -17342,7 +17353,11 @@ var useCarouselStyle = styled(carousel_carousel, 'carousel');
17342
17353
  borderRadius: "".concat(token.borderRadius, " 0 0 ").concat(token.borderRadius)
17343
17354
  }
17344
17355
  }
17345
- }), "".concat(name, "PaddingBox"), defineProperty_default()(defineProperty_default()(defineProperty_default()({
17356
+ }, supportsHas() ? defineProperty_default()({}, "[data-soui-role=\"input-group\"]:has(&$".concat(name, "Error)"), {
17357
+ borderColor: token.errorBorderColor,
17358
+ background: token.errorBackgroundColor,
17359
+ boxShadow: "0 0 0 2px ".concat(token.errorFocusShadow)
17360
+ }) : {})), "".concat(name, "PaddingBox"), defineProperty_default()(defineProperty_default()(defineProperty_default()({
17346
17361
  borderRadius: token.borderRadius
17347
17362
  }, "$".concat(name, ":not($").concat(name, "InnerTitle) &"), {
17348
17363
  padding: "".concat(token.paddingY, " ").concat(token.paddingX)
@@ -17417,7 +17432,7 @@ var useCarouselStyle = styled(carousel_carousel, 'carousel');
17417
17432
  '& *': {
17418
17433
  cursor: 'not-allowed'
17419
17434
  }
17420
- }), defineProperty_default()(defineProperty_default()(_ref, "".concat(name, "Underline"), {
17435
+ }), defineProperty_default()(defineProperty_default()(_ref2, "".concat(name, "Underline"), {
17421
17436
  '&&': {
17422
17437
  borderLeftColor: 'transparent',
17423
17438
  borderRightColor: 'transparent',
@@ -55047,7 +55062,8 @@ var InputNumber = function InputNumber(props) {
55047
55062
  value: numberFormatProps.value || '',
55048
55063
  className: classnames_default()(forwardProps.className, inputStyle === null || inputStyle === void 0 ? void 0 : inputStyle.wrapperNumber),
55049
55064
  onKeyDown: onKeyDown,
55050
- addEnd: addEnd
55065
+ addEnd: addEnd,
55066
+ showClear: props.showClear
55051
55067
  }));
55052
55068
  };
55053
55069
  /* harmony default export */ var input_number = (/*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().memo(InputNumber));
@@ -63252,6 +63268,7 @@ var scroll_table_Scroll = function Scroll(props) {
63252
63268
  // 非定高的Table但依旧采用了virtual渲染方式,需要渲染出全部的data
63253
63269
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useLayoutEffect)(function () {
63254
63270
  if (!props.tableRef.current || !props.setFakeVirtual) return;
63271
+ if (props.tableRef.current.style.height || props.tableRef.current.style.flex) return;
63255
63272
  var container = containerRef.current;
63256
63273
  var isContainerVisible = (container === null || container === void 0 ? void 0 : container.offsetParent) !== null;
63257
63274
  if (!isContainerVisible) return;
@@ -64061,7 +64078,9 @@ var useTableVirtual = function useTableVirtual(props) {
64061
64078
  _useState2 = slicedToArray_default()(_useState, 2),
64062
64079
  innerTop = _useState2[0],
64063
64080
  setTop = _useState2[1];
64064
- 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),
64065
64084
  _useState4 = slicedToArray_default()(_useState3, 2),
64066
64085
  scrollHeight = _useState4[0],
64067
64086
  setHeight = _useState4[1];
@@ -64147,6 +64166,9 @@ var useTableVirtual = function useTableVirtual(props) {
64147
64166
  context = _useRef.current;
64148
64167
  var getContentHeight = function getContentHeight(index) {
64149
64168
  if (props.disabled) return 0;
64169
+ if (strictRowHeight) {
64170
+ return strictRowHeight * (index + 1) + props.theadHeight + props.tfootHeight;
64171
+ }
64150
64172
  var sum = 0;
64151
64173
  for (var i = 0; i <= index; i++) {
64152
64174
  sum += context.cachedHeight[i] || props.rowHeight;
@@ -64182,7 +64204,7 @@ var useTableVirtual = function useTableVirtual(props) {
64182
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);
64183
64205
  for (var i = 0; i <= maxIndex; i++) {
64184
64206
  context.rowSpanRows = 0;
64185
- var currentRowHeight = context.cachedHeight[i] || props.rowHeight;
64207
+ var currentRowHeight = strictRowHeight || context.cachedHeight[i] || props.rowHeight;
64186
64208
  sum += currentRowHeight;
64187
64209
  var rowSpanHeight = 0;
64188
64210
  if (rowSpanInfo) {
@@ -64197,13 +64219,13 @@ var useTableVirtual = function useTableVirtual(props) {
64197
64219
  if (rowSpanHeight < scrollContainerHeight) {
64198
64220
  var index = siblingsIndexs[j];
64199
64221
  context.rowSpanRows += 1;
64200
- rowSpanHeight += context.cachedHeight[index] || props.rowHeight;
64222
+ rowSpanHeight += strictRowHeight || context.cachedHeight[index] || props.rowHeight;
64201
64223
  }
64202
64224
  }
64203
64225
  }
64204
64226
  if (scrollTop < sum + rowSpanHeight || i === maxIndex) {
64205
64227
  currentIndex = i;
64206
- var beforeHeight = i === 0 ? 0 : sum - (context.cachedHeight[i] || props.rowHeight);
64228
+ var beforeHeight = i === 0 ? 0 : sum - (strictRowHeight || context.cachedHeight[i] || props.rowHeight);
64207
64229
  top = scrollTop - beforeHeight;
64208
64230
  break;
64209
64231
  }
@@ -64336,10 +64358,10 @@ var useTableVirtual = function useTableVirtual(props) {
64336
64358
  var addonHeight = 0;
64337
64359
  var addonCount = 0;
64338
64360
  for (var i = startIndex + rowsInView; i < props.data.length; i++) {
64339
- var height = context.cachedHeight[i] || props.rowHeight;
64361
+ var height = strictRowHeight || context.cachedHeight[i] || props.rowHeight;
64340
64362
  addonHeight += height;
64341
64363
  addonCount += 1;
64342
- if (addonHeight >= remainHeight + context.cachedHeight[0]) break;
64364
+ if (addonHeight >= remainHeight + (strictRowHeight || context.cachedHeight[0])) break;
64343
64365
  }
64344
64366
  if (addonCount > 0) {
64345
64367
  context.autoAddRows = addonCount;
@@ -65484,7 +65506,6 @@ function useComponentMemo(getValue, condition, shouldUpdate) {
65484
65506
 
65485
65507
 
65486
65508
  function Td(props) {
65487
- var _props$style, _props$style2;
65488
65509
  var col = props.col,
65489
65510
  colSpan = props.colSpan,
65490
65511
  rowSpan = props.rowSpan,
@@ -65496,28 +65517,31 @@ function Td(props) {
65496
65517
  onMouseEnter = props.onMouseEnter,
65497
65518
  onMouseLeave = props.onMouseLeave,
65498
65519
  renderContent = props.renderContent;
65499
- var $td = useComponentMemo(function () {
65500
- var content = renderContent(props.col, props.data);
65501
- return /*#__PURE__*/(0,jsx_runtime.jsx)("td", {
65502
- colSpan: colSpan,
65503
- rowSpan: rowSpan,
65504
- onMouseEnter: onMouseEnter,
65505
- onMouseLeave: onMouseLeave,
65506
- className: className,
65507
- style: props.style,
65508
- dir: direction,
65509
- "data-role": role,
65510
- onClick: onClick,
65511
- children: content
65512
- }, col.key);
65513
- }, [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) {
65514
- if (col.type || col.treeColumnsName) {
65515
- return true;
65516
- }
65517
- return prev.some(function (_, index) {
65518
- return !shallowEqual(prev === null || prev === void 0 ? void 0 : prev[index], next === null || next === void 0 ? void 0 : next[index]);
65519
- }) || !props.scrolling;
65520
- } : 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
+ }
65521
65545
  return $td;
65522
65546
  }
65523
65547
  ;// CONCATENATED MODULE: ../base/src/table/tr.tsx
@@ -65571,12 +65595,12 @@ var Tr = function Tr(props) {
65571
65595
  }
65572
65596
  return undefined;
65573
65597
  };
65574
- var getTdStyle = usePersistFn(function (column, colSpan) {
65598
+ var getTdStyle = function getTdStyle(column, colSpan) {
65575
65599
  var index = column.index;
65576
65600
  var fixedStyle = getFixedStyle(column.fixed, index, colSpan);
65577
65601
  if (!fixedStyle && !column.style) return;
65578
65602
  return objectSpread2_default()(objectSpread2_default()({}, column.style), fixedStyle);
65579
- });
65603
+ };
65580
65604
  var handleCellClick = usePersistFn(function (data, colIndex) {
65581
65605
  if (!props.onCellClick) return;
65582
65606
  props.onCellClick(data, {
@@ -65586,16 +65610,16 @@ var Tr = function Tr(props) {
65586
65610
  });
65587
65611
  });
65588
65612
  var setVirtualRowHeight = usePersistFn(function () {
65613
+ if (props.strictRowHeight) return;
65589
65614
  if (props.setRowHeight && trRef.current) {
65590
- // 祖先元素不可见时(display: none)
65591
- if (!trRef.current.offsetParent) return;
65592
65615
  var expandHeight = expandRef.current ? expandRef.current.getBoundingClientRect().height : 0;
65593
65616
  props.setRowHeight(props.rowIndex, trRef.current.getBoundingClientRect().height + expandHeight);
65594
65617
  }
65595
65618
  });
65596
65619
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(setVirtualRowHeight, [props.expanded, props.rowIndex, props.bodyScrollWidth, props.resizeFlag]);
65597
65620
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
65598
- if (!trRef.current) return;
65621
+ // 祖先元素不可见时(display: none)
65622
+ if (props.strictRowHeight || !trRef.current || !trRef.current.offsetParent) return;
65599
65623
  var cancelObserver = addResizeObserver(trRef.current, setVirtualRowHeight, {
65600
65624
  direction: 'y'
65601
65625
  });
@@ -65641,7 +65665,7 @@ var Tr = function Tr(props) {
65641
65665
  return _ref.apply(this, arguments);
65642
65666
  };
65643
65667
  }());
65644
- var renderTreeExpand = usePersistFn(function (content) {
65668
+ var renderTreeExpand = function renderTreeExpand(content) {
65645
65669
  var treeIndent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 22;
65646
65670
  var level = props.treeExpandLevel.get(props.originKey) || 0;
65647
65671
  var className = tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.expandWrapper;
@@ -65694,8 +65718,8 @@ var Tr = function Tr(props) {
65694
65718
  },
65695
65719
  children: [$expandIconWrapper, content]
65696
65720
  });
65697
- });
65698
- var renderContent = usePersistFn(function (col, data) {
65721
+ };
65722
+ var renderContent = function renderContent(col, data) {
65699
65723
  if (col.type === 'expand' || col.type === 'row-expand') {
65700
65724
  var renderResult = typeof col.render === 'function' ? col.render(props.rawData, props.rowIndex) : undefined;
65701
65725
  if (typeof renderResult !== 'function') return null;
@@ -65763,8 +65787,8 @@ var Tr = function Tr(props) {
65763
65787
  }
65764
65788
  if (col.render === undefined) return null;
65765
65789
  return content;
65766
- });
65767
- var renderTds = usePersistFn(function (cols, data) {
65790
+ };
65791
+ var renderTds = function renderTds(cols, data) {
65768
65792
  var tds = [];
65769
65793
  var skip = 0;
65770
65794
  var lastRowIndex = data.length - 1;
@@ -65781,7 +65805,7 @@ var Tr = function Tr(props) {
65781
65805
  var last = cols[i + (data[i].colSpan || 1) - 1] || {};
65782
65806
  var isRowSpanTd = data[i].rowSpan > 1;
65783
65807
  var shouldBindMouseEvent = props.hover && hasSiblingRowSpan || isRowSpanTd;
65784
- var showCellHover = props.hoverIndex.has(props.rowIndex);
65808
+ var showCellHover = props.hover && props.hoverIndex.has(props.rowIndex);
65785
65809
  if (!showCellHover && data[i].rowSpan > 1) {
65786
65810
  for (var j = 0; j < data[i].rowSpan; j++) {
65787
65811
  if (props.hoverIndex.has(props.rowIndex + j)) {
@@ -65820,7 +65844,7 @@ var Tr = function Tr(props) {
65820
65844
  if (_loop(i)) continue;
65821
65845
  }
65822
65846
  return tds;
65823
- });
65847
+ };
65824
65848
  var renderExpand = function renderExpand() {
65825
65849
  if (!props.expanded) return null;
65826
65850
  var expandCol = props.expandCol;
@@ -65895,7 +65919,10 @@ var Tr = function Tr(props) {
65895
65919
  return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
65896
65920
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("tr", objectSpread2_default()(objectSpread2_default()({
65897
65921
  ref: trRef,
65898
- 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
+ }
65899
65926
  }, props.rowEvents), {}, {
65900
65927
  onClick: handleRowClick,
65901
65928
  children: renderTds(props.columns, props.row)
@@ -65993,20 +66020,24 @@ var Tr = function Tr(props) {
65993
66020
  treeCheckAll: props.treeCheckAll,
65994
66021
  onCellClick: props.onCellClick,
65995
66022
  virtual: props.virtual,
65996
- scrolling: props.scrolling
66023
+ scrolling: props.scrolling,
66024
+ strictRowHeight: props.strictRowHeight
65997
66025
  }, trRenderKey);
65998
66026
  };
65999
- var $tbody = useComponentMemo(function () {
66000
- return /*#__PURE__*/(0,jsx_runtime.jsx)("tbody", {
66001
- children: (props.data || []).map(function (item, index) {
66002
- return renderRow(item, index);
66003
- })
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;
66004
66039
  });
66005
- }, [props.data, currentIndex], props.virtual === 'lazy' ? function (prev, next) {
66006
- return prev.some(function (_, index) {
66007
- return !shallowEqual(prev === null || prev === void 0 ? void 0 : prev[index], next === null || next === void 0 ? void 0 : next[index]);
66008
- }) || !props.scrolling;
66009
- } : undefined);
66040
+ }
66010
66041
  return $tbody;
66011
66042
  });
66012
66043
  ;// CONCATENATED MODULE: ../base/src/table/tfoot.tsx
@@ -66387,6 +66418,7 @@ var emptyRef = {
66387
66418
  colgroup: colgroup,
66388
66419
  rowsInView: props.rowsInView || 20,
66389
66420
  rowHeight: props.rowHeight || 40,
66421
+ strictRowHeight: props.strictRowHeight,
66390
66422
  scrollRef: scrollRef,
66391
66423
  innerRef: tbodyRef,
66392
66424
  scrollLeft: props.scrollLeft,
@@ -66509,7 +66541,8 @@ var emptyRef = {
66509
66541
  bodyScrollWidth: scrollWidth,
66510
66542
  resizeFlag: resizeFlag,
66511
66543
  treeCheckAll: props.treeCheckAll,
66512
- onCellClick: props.onCellClick
66544
+ onCellClick: props.onCellClick,
66545
+ strictRowHeight: props.strictRowHeight
66513
66546
  };
66514
66547
  var headCommonProps = {
66515
66548
  disabled: props.disabled,
@@ -73334,7 +73367,7 @@ var upload_interface = __webpack_require__(8821);
73334
73367
 
73335
73368
 
73336
73369
  /* harmony default export */ var src_0 = ({
73337
- version: '3.9.0-beta.3'
73370
+ version: '3.9.0-beta.5'
73338
73371
  });
73339
73372
  }();
73340
73373
  /******/ return __webpack_exports__;