shineout 3.7.0-beta.7 → 3.7.0-beta.8

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
@@ -514,5 +514,5 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
514
514
  // 此文件由脚本自动生成,请勿直接修改。
515
515
  // This file was generated automatically by a script. Please do not modify it directly.
516
516
  var _default = exports.default = {
517
- version: '3.7.0-beta.7'
517
+ version: '3.7.0-beta.8'
518
518
  };
package/dist/shineout.js CHANGED
@@ -12217,7 +12217,7 @@ var handleStyle = function handleStyle(style) {
12217
12217
  };
12218
12218
  /* harmony default export */ var jss_style_handleStyle = (handleStyle);
12219
12219
  ;// CONCATENATED MODULE: ../shineout-style/src/version.ts
12220
- /* harmony default export */ var version = ('3.7.0-beta.7');
12220
+ /* harmony default export */ var version = ('3.7.0-beta.8');
12221
12221
  ;// CONCATENATED MODULE: ../shineout-style/src/jss-style/index.tsx
12222
12222
 
12223
12223
 
@@ -60309,7 +60309,6 @@ var extractHeightValue = function extractHeightValue(num) {
60309
60309
  return undefined;
60310
60310
  };
60311
60311
  var scroll_table_Scroll = function Scroll(props) {
60312
- var _scrollRef$current, _scrollRef$current2;
60313
60312
  var containerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
60314
60313
  var scrollRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
60315
60314
  var wrapperRef = useForkRef(scrollRef, props.wrapperRef);
@@ -60340,10 +60339,7 @@ var scroll_table_Scroll = function Scroll(props) {
60340
60339
  flex: 1,
60341
60340
  minWidth: 0,
60342
60341
  minHeight: 0,
60343
- // 原生css sticky机制根据最近的父元素的overflow来决定是否sticky
60344
- // isHeaderSticky: 这种场景非内滚的时候,设置scroll元素的overflow为initial
60345
- // isEmptyContent: 这种场景,把scroll元素的overflow设置为hidden,把overflow: auto转交给下面的container元素
60346
- overflow: props.isEmptyContent ? 'hidden' : props.isHeaderSticky && (scrollRef === null || scrollRef === void 0 || (_scrollRef$current = scrollRef.current) === null || _scrollRef$current === void 0 ? void 0 : _scrollRef$current.scrollHeight) === (scrollRef === null || scrollRef === void 0 || (_scrollRef$current2 = scrollRef.current) === null || _scrollRef$current2 === void 0 ? void 0 : _scrollRef$current2.clientHeight) ? 'initial' : 'auto',
60342
+ overflow: 'auto',
60347
60343
  width: '100%'
60348
60344
  };
60349
60345
  var containerStyle = {
@@ -60352,9 +60348,7 @@ var scroll_table_Scroll = function Scroll(props) {
60352
60348
  display: 'flex',
60353
60349
  position: 'sticky',
60354
60350
  flexDirection: 'column',
60355
- top: 0,
60356
- // isEmptyContent: overflow设置为auto是为了让empty元素可以sticky left:0 生效
60357
- overflow: props.isEmptyContent ? 'auto' : undefined
60351
+ top: 0
60358
60352
  };
60359
60353
 
60360
60354
  // 当滚动容器的高度为 0 时,paddingTop 为 0,避免滚动条抖动现象
@@ -60413,30 +60407,34 @@ var scroll_table_Scroll = function Scroll(props) {
60413
60407
  scrollRef.current.scrollTop += scrollTop;
60414
60408
  }
60415
60409
  });
60416
- return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute({
60417
- role: 'scroll'
60418
- })), {}, {
60419
- style: scrollerStyle,
60420
- onScroll: handleScroll,
60421
- ref: wrapperRef,
60422
- onMouseDown: function onMouseDown() {
60423
- context.isMouseDown = true;
60424
- },
60425
- onMouseUp: function onMouseUp() {
60426
- context.isMouseDown = false;
60427
- },
60428
- children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute({
60429
- role: 'scroll-container'
60410
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
60411
+ className: props.className,
60412
+ style: props.style,
60413
+ children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute({
60414
+ role: 'scroll'
60430
60415
  })), {}, {
60431
- style: containerStyle,
60432
- ref: containerRef,
60433
- onScroll: handleInnerScroll,
60434
- children: props.children
60435
- })), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
60436
- style: placeStyle,
60437
- children: "\xA0"
60438
- })]
60439
- }));
60416
+ style: scrollerStyle,
60417
+ onScroll: handleScroll,
60418
+ ref: wrapperRef,
60419
+ onMouseDown: function onMouseDown() {
60420
+ context.isMouseDown = true;
60421
+ },
60422
+ onMouseUp: function onMouseUp() {
60423
+ context.isMouseDown = false;
60424
+ },
60425
+ children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", objectSpread2_default()(objectSpread2_default()({}, getDataAttribute({
60426
+ role: 'scroll-container'
60427
+ })), {}, {
60428
+ style: containerStyle,
60429
+ ref: containerRef,
60430
+ onScroll: handleInnerScroll,
60431
+ children: props.children
60432
+ })), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
60433
+ style: placeStyle,
60434
+ children: "\xA0"
60435
+ })]
60436
+ }))
60437
+ });
60440
60438
  };
60441
60439
  /* harmony default export */ var scroll_table = (scroll_table_Scroll);
60442
60440
  ;// CONCATENATED MODULE: ../hooks/src/common/use-scrollbar-width/index.ts
@@ -63225,6 +63223,7 @@ function TbodyEmpty(_ref) {
63225
63223
 
63226
63224
 
63227
63225
 
63226
+
63228
63227
  var table_excluded = ["data"];
63229
63228
 
63230
63229
 
@@ -63439,6 +63438,12 @@ var emptyRef = {
63439
63438
  isRtl: isRtl,
63440
63439
  theadAndTfootHeight: context.theadAndTfootHeight
63441
63440
  });
63441
+ var syncHeaderScroll = usePersistFn(function (left) {
63442
+ var _theadRef$current2;
63443
+ if (props.hideHeader || !props.sticky) return;
63444
+ if (!(theadRef !== null && theadRef !== void 0 && (_theadRef$current2 = theadRef.current) !== null && _theadRef$current2 !== void 0 && _theadRef$current2.parentElement)) return;
63445
+ theadRef.current.parentElement.scrollLeft = left;
63446
+ });
63442
63447
 
63443
63448
  // 简单表格的滚动事件
63444
63449
  var handleBodyScroll = usePersistFn(function (e) {
@@ -63458,6 +63463,7 @@ var emptyRef = {
63458
63463
  var y = Math.min(target.scrollTop / maxHeight, 1);
63459
63464
  props.onScroll(x, y, target.scrollLeft, target.scrollTop);
63460
63465
  }
63466
+ syncHeaderScroll(target.scrollLeft);
63461
63467
  });
63462
63468
 
63463
63469
  // 虚拟表格的滚动事件
@@ -63473,6 +63479,7 @@ var emptyRef = {
63473
63479
  if (props.onScroll && typeof props.onScroll === 'function') {
63474
63480
  props.onScroll(info.x, info.y, info.scrollLeft, info.scrollTop);
63475
63481
  }
63482
+ syncHeaderScroll(info.scrollLeft);
63476
63483
  });
63477
63484
  var renderEmpty = function renderEmpty() {
63478
63485
  var _props$data2;
@@ -63647,30 +63654,41 @@ var emptyRef = {
63647
63654
  })
63648
63655
  }));
63649
63656
  };
63657
+ var $headTable = /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63658
+ style: {
63659
+ width: width
63660
+ },
63661
+ ref: theadRef,
63662
+ children: [Group, /*#__PURE__*/(0,jsx_runtime.jsx)(thead, objectSpread2_default()({}, headCommonProps))]
63663
+ });
63650
63664
  if (isRenderVirtualTable) {
63651
- var _props$data4, _props$data5;
63665
+ var _props$data4;
63652
63666
  return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
63653
- children: [renderHeadMirrorScroller(), /*#__PURE__*/(0,jsx_runtime.jsxs)(scroll_table, {
63667
+ children: [renderHeadMirrorScroller(), !props.hideHeader && props.sticky && /*#__PURE__*/(0,jsx_runtime.jsx)(StickyWrapper, objectSpread2_default()(objectSpread2_default()({}, stickyProps), {}, {
63668
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
63669
+ className: headWrapperClass,
63670
+ style: {
63671
+ overflow: 'hidden'
63672
+ },
63673
+ children: $headTable
63674
+ })
63675
+ })), /*#__PURE__*/(0,jsx_runtime.jsxs)(scroll_table, {
63676
+ style: {
63677
+ display: 'flex',
63678
+ minWidth: 0,
63679
+ minHeight: 0,
63680
+ flex: 1
63681
+ },
63654
63682
  wrapperRef: scrollRef,
63655
63683
  scrollWidth: width || 1,
63656
63684
  scrollHeight: virtual ? virtualInfo.scrollHeight : tbodyHeight,
63657
63685
  onScroll: handleVirtualScroll,
63658
63686
  defaultHeight: context.emptyHeight,
63659
63687
  isScrollY: isScrollY,
63660
- isEmptyContent: !((_props$data4 = props.data) !== null && _props$data4 !== void 0 && _props$data4.length),
63661
- isHeaderSticky: stickyProps === null || stickyProps === void 0 ? void 0 : stickyProps.css,
63662
- children: [!props.hideHeader && /*#__PURE__*/(0,jsx_runtime.jsx)(StickyWrapper, objectSpread2_default()(objectSpread2_default()({}, props.sticky ? stickyProps : {}), {}, {
63663
- children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
63664
- className: headWrapperClass,
63665
- children: /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63666
- style: {
63667
- width: width
63668
- },
63669
- ref: theadRef,
63670
- children: [Group, /*#__PURE__*/(0,jsx_runtime.jsx)(thead, objectSpread2_default()({}, headCommonProps))]
63671
- })
63672
- })
63673
- })), !!((_props$data5 = props.data) !== null && _props$data5 !== void 0 && _props$data5.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63688
+ children: [!props.hideHeader && !props.sticky && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
63689
+ className: headWrapperClass,
63690
+ children: $headTable
63691
+ }), !!((_props$data4 = props.data) !== null && _props$data4 !== void 0 && _props$data4.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63674
63692
  style: {
63675
63693
  width: width,
63676
63694
  transform: virtualInfo.translateStyle
@@ -63728,6 +63746,36 @@ var emptyRef = {
63728
63746
  align: "right"
63729
63747
  }, pagination), paginationInfo));
63730
63748
  };
63749
+
63750
+ // handle head and foot scroll
63751
+ var handleHeaderWheel = usePersistFn(function (e) {
63752
+ var _theadRef$current3;
63753
+ var scrollEl = scrollRef.current;
63754
+ if (!scrollEl) return;
63755
+ if (!(theadRef !== null && theadRef !== void 0 && (_theadRef$current3 = theadRef.current) !== null && _theadRef$current3 !== void 0 && _theadRef$current3.parentElement)) return;
63756
+ var max = scrollEl.scrollWidth - scrollEl.clientWidth;
63757
+ var scrollLeft = scrollEl.scrollLeft + e.deltaX;
63758
+ if (scrollLeft === scrollEl.scrollLeft) {
63759
+ return;
63760
+ }
63761
+ e.preventDefault();
63762
+ var left = Math.min(Math.max(scrollLeft, 0), max);
63763
+ scrollEl.scrollLeft = left;
63764
+ theadRef.current.parentElement.scrollLeft = left;
63765
+ });
63766
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
63767
+ // 绑定 wheel 事件
63768
+ if (props.sticky && theadRef.current && theadRef.current.parentElement) {
63769
+ theadRef.current.parentElement.addEventListener('wheel', handleHeaderWheel, {
63770
+ passive: false
63771
+ });
63772
+ }
63773
+ return function () {
63774
+ if (props.sticky && theadRef.current && theadRef.current.parentElement) {
63775
+ theadRef.current.parentElement.removeEventListener('wheel', handleHeaderWheel);
63776
+ }
63777
+ };
63778
+ }, [theadRef.current, props.sticky, isScrollY]);
63731
63779
  var getRenderIndexByData = function getRenderIndexByData(data) {
63732
63780
  var originKey = typeof data === 'string' ? data : getKey(props.keygen, data);
63733
63781
  var index = treeData.findIndex(function (item) {
@@ -63763,7 +63811,7 @@ var emptyRef = {
63763
63811
  });
63764
63812
  return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
63765
63813
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", objectSpread2_default()(objectSpread2_default()({
63766
- className: classnames_default()(tableWrapperClass, floatLeft && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.floatLeft), floatRight && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.floatRight), props.sticky && (tableClasses === null || tableClasses === void 0 ? void 0 : tableClasses.sticky)),
63814
+ className: classnames_default()(tableWrapperClass, defineProperty_default()(defineProperty_default()(defineProperty_default()({}, tableClasses.sticky, props.sticky), tableClasses.floatLeft, floatLeft), tableClasses.floatRight, floatRight)),
63767
63815
  style: objectSpread2_default()({
63768
63816
  height: defaultHeight
63769
63817
  }, props.style)
@@ -64482,7 +64530,7 @@ var TabsHeader = function TabsHeader(props) {
64482
64530
 
64483
64531
 
64484
64532
 
64485
- var tabs_excluded = ["jssStyle", "align", "children", "shape", "position", "lazy", "autoFill", "hideSplit", "collapsible", "defaultCollapsed", "onChange", "extra", "border", "splitColor", "tabBarExtraContent", "background", "activeBackground", "inactiveBackground", "defaultActive", "tabBarStyle", "color", "sticky", "allowNonPanel", "className"];
64533
+ var tabs_excluded = ["jssStyle", "align", "children", "shape", "position", "lazy", "autoFill", "hideSplit", "collapsible", "defaultCollapsed", "onChange", "extra", "border", "splitColor", "tabBarExtraContent", "background", "activeBackground", "inactiveBackground", "defaultActive", "tabBarStyle", "color", "sticky", "allowNonPanel", "renderTabsHeader", "className"];
64486
64534
 
64487
64535
 
64488
64536
 
@@ -64539,6 +64587,7 @@ var Tabs = function Tabs(props) {
64539
64587
  color = props.color,
64540
64588
  sticky = props.sticky,
64541
64589
  allowNonPanel = props.allowNonPanel,
64590
+ renderTabsHeader = props.renderTabsHeader,
64542
64591
  tabsClassName = props.className,
64543
64592
  rest = objectWithoutProperties_default()(props, tabs_excluded);
64544
64593
  var shape = shapeProps && shapeProps !== 'bordered' ? shapeProps : 'card';
@@ -64699,10 +64748,18 @@ var Tabs = function Tabs(props) {
64699
64748
  className: classnames_default()(stickyClassName, sticky.className)
64700
64749
  });
64701
64750
  }
64751
+ if (renderTabsHeader) {
64752
+ return renderTabsHeader( /*#__PURE__*/(0,jsx_runtime.jsx)(src_sticky_sticky, objectSpread2_default()(objectSpread2_default()({}, stickyProps), {}, {
64753
+ children: header
64754
+ })), props);
64755
+ }
64702
64756
  return /*#__PURE__*/(0,jsx_runtime.jsx)(src_sticky_sticky, objectSpread2_default()(objectSpread2_default()({}, stickyProps), {}, {
64703
64757
  children: header
64704
64758
  }));
64705
64759
  }
64760
+ if (renderTabsHeader) {
64761
+ return renderTabsHeader(header, props);
64762
+ }
64706
64763
  return header;
64707
64764
  };
64708
64765
  var renderTabs = function renderTabs() {
@@ -70114,7 +70171,7 @@ var upload_interface = __webpack_require__(8821);
70114
70171
 
70115
70172
 
70116
70173
  /* harmony default export */ var src_0 = ({
70117
- version: '3.7.0-beta.7'
70174
+ version: '3.7.0-beta.8'
70118
70175
  });
70119
70176
  }();
70120
70177
  /******/ return __webpack_exports__;