@sheinx/base 3.10.2-beta.3 → 3.10.2-beta.4

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.
@@ -744,6 +744,7 @@ function Table(props) {
744
744
  };
745
745
 
746
746
  // handle head and foot scroll
747
+ // 使用 passive: true 监听 wheel,不调用 preventDefault,避免阻塞合成器线程(优化 INP)
747
748
  var handleHeaderWheel = (0, _hooks.usePersistFn)(function (e) {
748
749
  var _theadRef$current2;
749
750
  var scrollEl = scrollRef.current;
@@ -754,7 +755,6 @@ function Table(props) {
754
755
  if (scrollLeft === scrollEl.scrollLeft) {
755
756
  return;
756
757
  }
757
- e.preventDefault();
758
758
  var left = Math.min(Math.max(scrollLeft, 0), max);
759
759
  scrollEl.scrollLeft = left;
760
760
  theadRef.current.parentElement.scrollLeft = left;
@@ -766,10 +766,10 @@ function Table(props) {
766
766
  syncHeaderScroll(((_scrollRef$current10 = scrollRef.current) === null || _scrollRef$current10 === void 0 ? void 0 : _scrollRef$current10.scrollLeft) || 0);
767
767
  }, [isScrollX, props.sticky, $empty]);
768
768
  (0, _react.useEffect)(function () {
769
- // 绑定 wheel 事件
769
+ // 绑定 wheel 事件(passive: true 不阻塞合成器线程)
770
770
  if (props.sticky && theadRef.current && theadRef.current.parentElement) {
771
771
  theadRef.current.parentElement.addEventListener('wheel', handleHeaderWheel, {
772
- passive: false
772
+ passive: true
773
773
  });
774
774
  }
775
775
  return function () {
@@ -737,6 +737,7 @@ export default function Table(props) {
737
737
  };
738
738
 
739
739
  // handle head and foot scroll
740
+ // 使用 passive: true 监听 wheel,不调用 preventDefault,避免阻塞合成器线程(优化 INP)
740
741
  var handleHeaderWheel = usePersistFn(function (e) {
741
742
  var _theadRef$current2;
742
743
  var scrollEl = scrollRef.current;
@@ -747,7 +748,6 @@ export default function Table(props) {
747
748
  if (scrollLeft === scrollEl.scrollLeft) {
748
749
  return;
749
750
  }
750
- e.preventDefault();
751
751
  var left = Math.min(Math.max(scrollLeft, 0), max);
752
752
  scrollEl.scrollLeft = left;
753
753
  theadRef.current.parentElement.scrollLeft = left;
@@ -759,10 +759,10 @@ export default function Table(props) {
759
759
  syncHeaderScroll(((_scrollRef$current10 = scrollRef.current) === null || _scrollRef$current10 === void 0 ? void 0 : _scrollRef$current10.scrollLeft) || 0);
760
760
  }, [isScrollX, props.sticky, $empty]);
761
761
  useEffect(function () {
762
- // 绑定 wheel 事件
762
+ // 绑定 wheel 事件(passive: true 不阻塞合成器线程)
763
763
  if (props.sticky && theadRef.current && theadRef.current.parentElement) {
764
764
  theadRef.current.parentElement.addEventListener('wheel', handleHeaderWheel, {
765
- passive: false
765
+ passive: true
766
766
  });
767
767
  }
768
768
  return function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.10.2-beta.3",
3
+ "version": "3.10.2-beta.4",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "license": "MIT",
@@ -10,7 +10,7 @@
10
10
  "module": "./esm/index.js",
11
11
  "typings": "./cjs/index.d.ts",
12
12
  "dependencies": {
13
- "@sheinx/hooks": "3.10.2-beta.3",
13
+ "@sheinx/hooks": "3.10.2-beta.4",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.3.3"