shineout 3.7.0-beta.7 → 3.7.0-beta.9

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.9'
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.9');
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
@@ -63032,6 +63030,8 @@ var Tr = function Tr(props) {
63032
63030
 
63033
63031
 
63034
63032
 
63033
+
63034
+
63035
63035
  /* harmony default export */ var tbody = (function (props) {
63036
63036
  var _props$columns = props.columns,
63037
63037
  columns = _props$columns === void 0 ? [] : _props$columns,
@@ -63107,11 +63107,25 @@ var Tr = function Tr(props) {
63107
63107
  shouldCellUpdate: props.shouldCellUpdate
63108
63108
  }, trRenderKey);
63109
63109
  };
63110
- return /*#__PURE__*/(0,jsx_runtime.jsx)("tbody", {
63111
- children: (props.data || []).map(function (item, index) {
63112
- return renderRow(item, index);
63113
- })
63114
- });
63110
+ var externalDependencies = typeof_default()(props.shouldCellUpdate) === 'object' && props.shouldCellUpdate.dependencies ? props.shouldCellUpdate.dependencies : [];
63111
+ var updateFn = typeof_default()(props.shouldCellUpdate) === 'object' && 'update' in props.shouldCellUpdate ? props.shouldCellUpdate.update : props.shouldCellUpdate;
63112
+ var $tbody = useMemo(function () {
63113
+ return /*#__PURE__*/(0,jsx_runtime.jsx)("tbody", {
63114
+ children: (props.data || []).map(function (item, index) {
63115
+ return renderRow(item, index);
63116
+ })
63117
+ });
63118
+ }, [props.data, currentIndex].concat(toConsumableArray_default()(externalDependencies)), updateFn ? function (prev, next) {
63119
+ return prev.some(function (_, index) {
63120
+ if (index === 0) {
63121
+ return prev[index].some(function (item, idx) {
63122
+ return updateFn(item, next[index][idx]);
63123
+ });
63124
+ }
63125
+ return !shallowEqual(prev[index], next[index]);
63126
+ }) || !props.scrolling;
63127
+ } : undefined);
63128
+ return $tbody;
63115
63129
  });
63116
63130
  ;// CONCATENATED MODULE: ../base/src/table/tfoot.tsx
63117
63131
 
@@ -63225,6 +63239,8 @@ function TbodyEmpty(_ref) {
63225
63239
 
63226
63240
 
63227
63241
 
63242
+
63243
+
63228
63244
  var table_excluded = ["data"];
63229
63245
 
63230
63246
 
@@ -63268,6 +63284,10 @@ var emptyRef = {
63268
63284
  var headMirrorScrollRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
63269
63285
  var bottomMirrorScrollRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
63270
63286
  var tableRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
63287
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
63288
+ _useState2 = slicedToArray_default()(_useState, 2),
63289
+ scrolling = _useState2[0],
63290
+ setScrolling = _useState2[1];
63271
63291
  var browserScrollbarWidth = useScrollbarWidth();
63272
63292
  if (props.fixed) {
63273
63293
  table_devUseWarning.deprecated('fixed', 'virtual', 'Table');
@@ -63290,7 +63310,8 @@ var emptyRef = {
63290
63310
  };
63291
63311
  var _useRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
63292
63312
  emptyHeight: 0,
63293
- theadAndTfootHeight: 0
63313
+ theadAndTfootHeight: 0,
63314
+ scrollingTimer: null
63294
63315
  }),
63295
63316
  context = _useRef.current;
63296
63317
  var virtual = ((_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.length) && props.rowsInView !== 0 && (!!props.virtual || props.fixed === 'both' || props.fixed === 'y' || props.fixed === 'auto');
@@ -63439,6 +63460,12 @@ var emptyRef = {
63439
63460
  isRtl: isRtl,
63440
63461
  theadAndTfootHeight: context.theadAndTfootHeight
63441
63462
  });
63463
+ var syncHeaderScroll = usePersistFn(function (left) {
63464
+ var _theadRef$current2;
63465
+ if (props.hideHeader || !props.sticky) return;
63466
+ if (!(theadRef !== null && theadRef !== void 0 && (_theadRef$current2 = theadRef.current) !== null && _theadRef$current2 !== void 0 && _theadRef$current2.parentElement)) return;
63467
+ theadRef.current.parentElement.scrollLeft = left;
63468
+ });
63442
63469
 
63443
63470
  // 简单表格的滚动事件
63444
63471
  var handleBodyScroll = usePersistFn(function (e) {
@@ -63458,6 +63485,7 @@ var emptyRef = {
63458
63485
  var y = Math.min(target.scrollTop / maxHeight, 1);
63459
63486
  props.onScroll(x, y, target.scrollLeft, target.scrollTop);
63460
63487
  }
63488
+ syncHeaderScroll(target.scrollLeft);
63461
63489
  });
63462
63490
 
63463
63491
  // 虚拟表格的滚动事件
@@ -63473,6 +63501,14 @@ var emptyRef = {
63473
63501
  if (props.onScroll && typeof props.onScroll === 'function') {
63474
63502
  props.onScroll(info.x, info.y, info.scrollLeft, info.scrollTop);
63475
63503
  }
63504
+ syncHeaderScroll(info.scrollLeft);
63505
+ if (context.scrollingTimer) {
63506
+ clearTimeout(context.scrollingTimer);
63507
+ }
63508
+ setScrolling(true);
63509
+ context.scrollingTimer = setTimeout(function () {
63510
+ setScrolling(false);
63511
+ }, 100);
63476
63512
  });
63477
63513
  var renderEmpty = function renderEmpty() {
63478
63514
  var _props$data2;
@@ -63647,30 +63683,41 @@ var emptyRef = {
63647
63683
  })
63648
63684
  }));
63649
63685
  };
63686
+ var $headTable = /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63687
+ style: {
63688
+ width: width
63689
+ },
63690
+ ref: theadRef,
63691
+ children: [Group, /*#__PURE__*/(0,jsx_runtime.jsx)(thead, objectSpread2_default()({}, headCommonProps))]
63692
+ });
63650
63693
  if (isRenderVirtualTable) {
63651
- var _props$data4, _props$data5;
63694
+ var _props$data4;
63652
63695
  return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
63653
- children: [renderHeadMirrorScroller(), /*#__PURE__*/(0,jsx_runtime.jsxs)(scroll_table, {
63696
+ children: [renderHeadMirrorScroller(), !props.hideHeader && props.sticky && /*#__PURE__*/(0,jsx_runtime.jsx)(StickyWrapper, objectSpread2_default()(objectSpread2_default()({}, stickyProps), {}, {
63697
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
63698
+ className: headWrapperClass,
63699
+ style: {
63700
+ overflow: 'hidden'
63701
+ },
63702
+ children: $headTable
63703
+ })
63704
+ })), /*#__PURE__*/(0,jsx_runtime.jsxs)(scroll_table, {
63705
+ style: {
63706
+ display: 'flex',
63707
+ minWidth: 0,
63708
+ minHeight: 0,
63709
+ flex: 1
63710
+ },
63654
63711
  wrapperRef: scrollRef,
63655
63712
  scrollWidth: width || 1,
63656
63713
  scrollHeight: virtual ? virtualInfo.scrollHeight : tbodyHeight,
63657
63714
  onScroll: handleVirtualScroll,
63658
63715
  defaultHeight: context.emptyHeight,
63659
63716
  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", {
63717
+ children: [!props.hideHeader && !props.sticky && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
63718
+ className: headWrapperClass,
63719
+ children: $headTable
63720
+ }), !!((_props$data4 = props.data) !== null && _props$data4 !== void 0 && _props$data4.length) && /*#__PURE__*/(0,jsx_runtime.jsxs)("table", {
63674
63721
  style: {
63675
63722
  width: width,
63676
63723
  transform: virtualInfo.translateStyle
@@ -63679,7 +63726,8 @@ var emptyRef = {
63679
63726
  children: [Group, /*#__PURE__*/(0,jsx_runtime.jsx)(tbody, objectSpread2_default()(objectSpread2_default()({}, bodyCommonProps), {}, {
63680
63727
  currentIndex: virtualInfo.startIndex,
63681
63728
  data: virtualInfo.data,
63682
- setRowHeight: virtualInfo.setRowHeight
63729
+ setRowHeight: virtualInfo.setRowHeight,
63730
+ scrolling: scrolling
63683
63731
  }))]
63684
63732
  }), showFoot ? /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
63685
63733
  className: footWrapperClass,
@@ -63728,6 +63776,36 @@ var emptyRef = {
63728
63776
  align: "right"
63729
63777
  }, pagination), paginationInfo));
63730
63778
  };
63779
+
63780
+ // handle head and foot scroll
63781
+ var handleHeaderWheel = usePersistFn(function (e) {
63782
+ var _theadRef$current3;
63783
+ var scrollEl = scrollRef.current;
63784
+ if (!scrollEl) return;
63785
+ if (!(theadRef !== null && theadRef !== void 0 && (_theadRef$current3 = theadRef.current) !== null && _theadRef$current3 !== void 0 && _theadRef$current3.parentElement)) return;
63786
+ var max = scrollEl.scrollWidth - scrollEl.clientWidth;
63787
+ var scrollLeft = scrollEl.scrollLeft + e.deltaX;
63788
+ if (scrollLeft === scrollEl.scrollLeft) {
63789
+ return;
63790
+ }
63791
+ e.preventDefault();
63792
+ var left = Math.min(Math.max(scrollLeft, 0), max);
63793
+ scrollEl.scrollLeft = left;
63794
+ theadRef.current.parentElement.scrollLeft = left;
63795
+ });
63796
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
63797
+ // 绑定 wheel 事件
63798
+ if (props.sticky && theadRef.current && theadRef.current.parentElement) {
63799
+ theadRef.current.parentElement.addEventListener('wheel', handleHeaderWheel, {
63800
+ passive: false
63801
+ });
63802
+ }
63803
+ return function () {
63804
+ if (props.sticky && theadRef.current && theadRef.current.parentElement) {
63805
+ theadRef.current.parentElement.removeEventListener('wheel', handleHeaderWheel);
63806
+ }
63807
+ };
63808
+ }, [theadRef.current, props.sticky, isScrollY]);
63731
63809
  var getRenderIndexByData = function getRenderIndexByData(data) {
63732
63810
  var originKey = typeof data === 'string' ? data : getKey(props.keygen, data);
63733
63811
  var index = treeData.findIndex(function (item) {
@@ -63763,7 +63841,7 @@ var emptyRef = {
63763
63841
  });
63764
63842
  return /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
63765
63843
  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)),
63844
+ className: classnames_default()(tableWrapperClass, defineProperty_default()(defineProperty_default()(defineProperty_default()({}, tableClasses.sticky, props.sticky), tableClasses.floatLeft, floatLeft), tableClasses.floatRight, floatRight)),
63767
63845
  style: objectSpread2_default()({
63768
63846
  height: defaultHeight
63769
63847
  }, props.style)
@@ -64482,7 +64560,7 @@ var TabsHeader = function TabsHeader(props) {
64482
64560
 
64483
64561
 
64484
64562
 
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"];
64563
+ 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
64564
 
64487
64565
 
64488
64566
 
@@ -64539,6 +64617,7 @@ var Tabs = function Tabs(props) {
64539
64617
  color = props.color,
64540
64618
  sticky = props.sticky,
64541
64619
  allowNonPanel = props.allowNonPanel,
64620
+ renderTabsHeader = props.renderTabsHeader,
64542
64621
  tabsClassName = props.className,
64543
64622
  rest = objectWithoutProperties_default()(props, tabs_excluded);
64544
64623
  var shape = shapeProps && shapeProps !== 'bordered' ? shapeProps : 'card';
@@ -64699,10 +64778,18 @@ var Tabs = function Tabs(props) {
64699
64778
  className: classnames_default()(stickyClassName, sticky.className)
64700
64779
  });
64701
64780
  }
64781
+ if (renderTabsHeader) {
64782
+ return renderTabsHeader( /*#__PURE__*/(0,jsx_runtime.jsx)(src_sticky_sticky, objectSpread2_default()(objectSpread2_default()({}, stickyProps), {}, {
64783
+ children: header
64784
+ })), props);
64785
+ }
64702
64786
  return /*#__PURE__*/(0,jsx_runtime.jsx)(src_sticky_sticky, objectSpread2_default()(objectSpread2_default()({}, stickyProps), {}, {
64703
64787
  children: header
64704
64788
  }));
64705
64789
  }
64790
+ if (renderTabsHeader) {
64791
+ return renderTabsHeader(header, props);
64792
+ }
64706
64793
  return header;
64707
64794
  };
64708
64795
  var renderTabs = function renderTabs() {
@@ -70114,7 +70201,7 @@ var upload_interface = __webpack_require__(8821);
70114
70201
 
70115
70202
 
70116
70203
  /* harmony default export */ var src_0 = ({
70117
- version: '3.7.0-beta.7'
70204
+ version: '3.7.0-beta.9'
70118
70205
  });
70119
70206
  }();
70120
70207
  /******/ return __webpack_exports__;