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

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,wBA4rBE"}
@@ -226,7 +226,7 @@ var _default = exports.default = function _default(props) {
226
226
  onChange: inputableData.onChange,
227
227
  disabled: props.disabled
228
228
  });
229
- (0, _react.useEffect)(function () {
229
+ var handleTheadAndTfootHeight = (0, _hooks.usePersistFn)(function () {
230
230
  var _theadRef$current, _tfootRef$current;
231
231
  var theadHeight = (theadRef === null || theadRef === void 0 || (_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0;
232
232
  var tfootHeight = ((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0;
@@ -235,6 +235,28 @@ var _default = exports.default = function _default(props) {
235
235
  } else {
236
236
  context.theadAndTfootHeight = theadHeight + tfootHeight;
237
237
  }
238
+ });
239
+ (0, _react.useEffect)(function () {
240
+ handleTheadAndTfootHeight();
241
+ var cancelFunc1;
242
+ if (theadRef !== null && theadRef !== void 0 && theadRef.current) {
243
+ cancelFunc1 = (0, _hooks.addResizeObserver)(theadRef === null || theadRef === void 0 ? void 0 : theadRef.current, handleTheadAndTfootHeight, {
244
+ direction: 'y',
245
+ timer: 10
246
+ });
247
+ }
248
+ var cancelFunc2;
249
+ if (tfootRef !== null && tfootRef !== void 0 && tfootRef.current) {
250
+ cancelFunc2 = (0, _hooks.addResizeObserver)(tfootRef === null || tfootRef === void 0 ? void 0 : tfootRef.current, handleTheadAndTfootHeight, {
251
+ direction: 'y',
252
+ timer: 10
253
+ });
254
+ }
255
+ return function () {
256
+ var _cancelFunc, _cancelFunc2;
257
+ (_cancelFunc = cancelFunc1) === null || _cancelFunc === void 0 || _cancelFunc();
258
+ (_cancelFunc2 = cancelFunc2) === null || _cancelFunc2 === void 0 || _cancelFunc2();
259
+ };
238
260
  }, [theadRef.current, tfootRef.current]);
239
261
  var virtualInfo = (0, _hooks.useTableVirtual)({
240
262
  disabled: !virtual,
@@ -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,wBA4rBE"}
@@ -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";
@@ -219,7 +219,7 @@ export default (function (props) {
219
219
  onChange: inputableData.onChange,
220
220
  disabled: props.disabled
221
221
  });
222
- useEffect(function () {
222
+ var handleTheadAndTfootHeight = usePersistFn(function () {
223
223
  var _theadRef$current, _tfootRef$current;
224
224
  var theadHeight = (theadRef === null || theadRef === void 0 || (_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0;
225
225
  var tfootHeight = ((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0;
@@ -228,6 +228,28 @@ export default (function (props) {
228
228
  } else {
229
229
  context.theadAndTfootHeight = theadHeight + tfootHeight;
230
230
  }
231
+ });
232
+ useEffect(function () {
233
+ handleTheadAndTfootHeight();
234
+ var cancelFunc1;
235
+ if (theadRef !== null && theadRef !== void 0 && theadRef.current) {
236
+ cancelFunc1 = addResizeObserver(theadRef === null || theadRef === void 0 ? void 0 : theadRef.current, handleTheadAndTfootHeight, {
237
+ direction: 'y',
238
+ timer: 10
239
+ });
240
+ }
241
+ var cancelFunc2;
242
+ if (tfootRef !== null && tfootRef !== void 0 && tfootRef.current) {
243
+ cancelFunc2 = addResizeObserver(tfootRef === null || tfootRef === void 0 ? void 0 : tfootRef.current, handleTheadAndTfootHeight, {
244
+ direction: 'y',
245
+ timer: 10
246
+ });
247
+ }
248
+ return function () {
249
+ var _cancelFunc, _cancelFunc2;
250
+ (_cancelFunc = cancelFunc1) === null || _cancelFunc === void 0 || _cancelFunc();
251
+ (_cancelFunc2 = cancelFunc2) === null || _cancelFunc2 === void 0 || _cancelFunc2();
252
+ };
231
253
  }, [theadRef.current, tfootRef.current]);
232
254
  var virtualInfo = useTableVirtual({
233
255
  disabled: !virtual,
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.6",
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.6",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.1.3-alpha.0"