@sheinx/base 3.7.7-beta.5 → 3.7.7-beta.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAgB,UAAU,EAAE,MAAM,cAAc,CAAC;;AAexD,wBAoqBE"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAgB,UAAU,EAAE,MAAM,cAAc,CAAC;;AAexD,wBA+rBE"}
@@ -93,7 +93,8 @@ var _default = exports.default = function _default(props) {
93
93
  };
94
94
  var _useRef = (0, _react.useRef)({
95
95
  emptyHeight: 0,
96
- theadAndTfootHeight: 0,
96
+ theadHeight: 0,
97
+ tfootHeight: 0,
97
98
  scrollingTimer: null
98
99
  }),
99
100
  context = _useRef.current;
@@ -226,15 +227,38 @@ var _default = exports.default = function _default(props) {
226
227
  onChange: inputableData.onChange,
227
228
  disabled: props.disabled
228
229
  });
229
- (0, _react.useEffect)(function () {
230
+ var handleTheadAndTfootHeight = (0, _hooks.usePersistFn)(function () {
230
231
  var _theadRef$current, _tfootRef$current;
231
232
  var theadHeight = (theadRef === null || theadRef === void 0 || (_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0;
232
233
  var tfootHeight = ((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0;
233
234
  if (props.sticky) {
234
- context.theadAndTfootHeight = tfootHeight;
235
+ context.tfootHeight = tfootHeight;
235
236
  } else {
236
- context.theadAndTfootHeight = theadHeight + tfootHeight;
237
+ context.theadHeight = theadHeight;
238
+ context.tfootHeight = tfootHeight;
239
+ }
240
+ });
241
+ (0, _react.useEffect)(function () {
242
+ handleTheadAndTfootHeight();
243
+ var cancelFunc1;
244
+ if (theadRef !== null && theadRef !== void 0 && theadRef.current) {
245
+ cancelFunc1 = (0, _hooks.addResizeObserver)(theadRef === null || theadRef === void 0 ? void 0 : theadRef.current, handleTheadAndTfootHeight, {
246
+ direction: 'y',
247
+ timer: 10
248
+ });
237
249
  }
250
+ var cancelFunc2;
251
+ if (tfootRef !== null && tfootRef !== void 0 && tfootRef.current) {
252
+ cancelFunc2 = (0, _hooks.addResizeObserver)(tfootRef === null || tfootRef === void 0 ? void 0 : tfootRef.current, handleTheadAndTfootHeight, {
253
+ direction: 'y',
254
+ timer: 10
255
+ });
256
+ }
257
+ return function () {
258
+ var _cancelFunc, _cancelFunc2;
259
+ (_cancelFunc = cancelFunc1) === null || _cancelFunc === void 0 || _cancelFunc();
260
+ (_cancelFunc2 = cancelFunc2) === null || _cancelFunc2 === void 0 || _cancelFunc2();
261
+ };
238
262
  }, [theadRef.current, tfootRef.current]);
239
263
  var virtualInfo = (0, _hooks.useTableVirtual)({
240
264
  disabled: !virtual,
@@ -247,7 +271,8 @@ var _default = exports.default = function _default(props) {
247
271
  innerRef: tbodyRef,
248
272
  scrollLeft: props.scrollLeft,
249
273
  isRtl: isRtl,
250
- theadAndTfootHeight: context.theadAndTfootHeight
274
+ theadHeight: context.theadHeight,
275
+ tfootHeight: context.tfootHeight
251
276
  });
252
277
  var syncHeaderScroll = (0, _hooks.usePersistFn)(function (left) {
253
278
  var _tableRef$current;
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAAgB,UAAU,EAAE,MAAM,cAAc,CAAC;;AAexD,wBAoqBE"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":"AA0BA,OAAO,EAAgB,UAAU,EAAE,MAAM,cAAc,CAAC;;AAexD,wBA+rBE"}
@@ -22,7 +22,7 @@ import AbsoluteContext from "../absolute-list/absolute-context";
22
22
  import Empty from "../empty";
23
23
  import Sticky, { defaultZIndex } from "../sticky";
24
24
  import { useConfig } from "../config";
25
- import { useTableLayout, useTableColumns, useTableFilter, useTableSort, useTableTree, usePersistFn, useListSelect, useInputAble, useTableVirtual, usePaginationList, useLatestObj, useResize, useScrollbarWidth, util } from '@sheinx/hooks';
25
+ import { useTableLayout, useTableColumns, useTableFilter, useTableSort, useTableTree, usePersistFn, useListSelect, useInputAble, useTableVirtual, usePaginationList, useLatestObj, useResize, useScrollbarWidth, util, addResizeObserver } from '@sheinx/hooks';
26
26
  import useTableSelect from "./use-table-select";
27
27
  import Colgroup from "./colgroup";
28
28
  import Thead from "./thead";
@@ -86,7 +86,8 @@ export default (function (props) {
86
86
  };
87
87
  var _useRef = useRef({
88
88
  emptyHeight: 0,
89
- theadAndTfootHeight: 0,
89
+ theadHeight: 0,
90
+ tfootHeight: 0,
90
91
  scrollingTimer: null
91
92
  }),
92
93
  context = _useRef.current;
@@ -219,15 +220,38 @@ export default (function (props) {
219
220
  onChange: inputableData.onChange,
220
221
  disabled: props.disabled
221
222
  });
222
- useEffect(function () {
223
+ var handleTheadAndTfootHeight = usePersistFn(function () {
223
224
  var _theadRef$current, _tfootRef$current;
224
225
  var theadHeight = (theadRef === null || theadRef === void 0 || (_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0;
225
226
  var tfootHeight = ((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0;
226
227
  if (props.sticky) {
227
- context.theadAndTfootHeight = tfootHeight;
228
+ context.tfootHeight = tfootHeight;
228
229
  } else {
229
- context.theadAndTfootHeight = theadHeight + tfootHeight;
230
+ context.theadHeight = theadHeight;
231
+ context.tfootHeight = tfootHeight;
232
+ }
233
+ });
234
+ useEffect(function () {
235
+ handleTheadAndTfootHeight();
236
+ var cancelFunc1;
237
+ if (theadRef !== null && theadRef !== void 0 && theadRef.current) {
238
+ cancelFunc1 = addResizeObserver(theadRef === null || theadRef === void 0 ? void 0 : theadRef.current, handleTheadAndTfootHeight, {
239
+ direction: 'y',
240
+ timer: 10
241
+ });
230
242
  }
243
+ var cancelFunc2;
244
+ if (tfootRef !== null && tfootRef !== void 0 && tfootRef.current) {
245
+ cancelFunc2 = addResizeObserver(tfootRef === null || tfootRef === void 0 ? void 0 : tfootRef.current, handleTheadAndTfootHeight, {
246
+ direction: 'y',
247
+ timer: 10
248
+ });
249
+ }
250
+ return function () {
251
+ var _cancelFunc, _cancelFunc2;
252
+ (_cancelFunc = cancelFunc1) === null || _cancelFunc === void 0 || _cancelFunc();
253
+ (_cancelFunc2 = cancelFunc2) === null || _cancelFunc2 === void 0 || _cancelFunc2();
254
+ };
231
255
  }, [theadRef.current, tfootRef.current]);
232
256
  var virtualInfo = useTableVirtual({
233
257
  disabled: !virtual,
@@ -240,7 +264,8 @@ export default (function (props) {
240
264
  innerRef: tbodyRef,
241
265
  scrollLeft: props.scrollLeft,
242
266
  isRtl: isRtl,
243
- theadAndTfootHeight: context.theadAndTfootHeight
267
+ theadHeight: context.theadHeight,
268
+ tfootHeight: context.tfootHeight
244
269
  });
245
270
  var syncHeaderScroll = usePersistFn(function (left) {
246
271
  var _tableRef$current;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.7.7-beta.5",
3
+ "version": "3.7.7-beta.7",
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.7.7-beta.5",
13
+ "@sheinx/hooks": "3.7.7-beta.7",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.3-alpha.0"