@sheinx/base 3.10.2 → 3.10.3-beta.2

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":"AA2BA,OAAO,EAAgB,UAAU,EAAoB,MAAM,cAAc,CAAC;AAgB1E,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,2CA42BxE"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAgB,UAAU,EAAoB,MAAM,cAAc,CAAC;AAgB1E,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,2CAw2BxE"}
@@ -108,8 +108,6 @@ function Table(props) {
108
108
  };
109
109
  var _useRef = (0, _react.useRef)({
110
110
  emptyHeight: 0,
111
- theadHeight: 0,
112
- tfootHeight: 0,
113
111
  scrollingTimer: null
114
112
  }),
115
113
  context = _useRef.current;
@@ -261,16 +259,19 @@ function Table(props) {
261
259
  onChange: inputableData.onChange,
262
260
  disabled: props.disabled
263
261
  });
262
+ var _useState7 = (0, _react.useState)(0),
263
+ _useState8 = _slicedToArray(_useState7, 2),
264
+ theadHeight = _useState8[0],
265
+ setTheadHeight = _useState8[1];
266
+ var _useState9 = (0, _react.useState)(0),
267
+ _useState10 = _slicedToArray(_useState9, 2),
268
+ tfootHeight = _useState10[0],
269
+ setTfootHeight = _useState10[1];
264
270
  var handleTheadAndTfootHeight = (0, _hooks.usePersistFn)(function () {
265
271
  var _theadRef$current, _tfootRef$current;
266
- var theadHeight = (theadRef === null || theadRef === void 0 || (_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0;
267
- var tfootHeight = ((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0;
268
- if (props.sticky) {
269
- context.tfootHeight = tfootHeight;
270
- } else {
271
- context.theadHeight = theadHeight;
272
- context.tfootHeight = tfootHeight;
273
- }
272
+ // sticky 时表头由 Sticky 单独渲染,不计入虚拟列表高度
273
+ if (!props.sticky) setTheadHeight(((_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0);
274
+ setTfootHeight(((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0);
274
275
  });
275
276
  (0, _react.useEffect)(function () {
276
277
  handleTheadAndTfootHeight();
@@ -309,8 +310,8 @@ function Table(props) {
309
310
  innerRef: tbodyRef,
310
311
  scrollLeft: props.scrollLeft,
311
312
  isRtl: isRtl,
312
- theadHeight: context.theadHeight,
313
- tfootHeight: context.tfootHeight,
313
+ theadHeight: theadHeight,
314
+ tfootHeight: tfootHeight,
314
315
  virtualScrollContainer: props.virtualScrollContainer,
315
316
  tableRef: tableRef,
316
317
  externalStickyHeader: !!props.virtualScrollContainer && !!props.sticky
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAgB,UAAU,EAAoB,MAAM,cAAc,CAAC;AAgB1E,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,2CA42BxE"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["table.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAAgB,UAAU,EAAoB,MAAM,cAAc,CAAC;AAgB1E,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,2CAw2BxE"}
@@ -101,8 +101,6 @@ export default function Table(props) {
101
101
  };
102
102
  var _useRef = useRef({
103
103
  emptyHeight: 0,
104
- theadHeight: 0,
105
- tfootHeight: 0,
106
104
  scrollingTimer: null
107
105
  }),
108
106
  context = _useRef.current;
@@ -254,16 +252,19 @@ export default function Table(props) {
254
252
  onChange: inputableData.onChange,
255
253
  disabled: props.disabled
256
254
  });
255
+ var _useState7 = useState(0),
256
+ _useState8 = _slicedToArray(_useState7, 2),
257
+ theadHeight = _useState8[0],
258
+ setTheadHeight = _useState8[1];
259
+ var _useState9 = useState(0),
260
+ _useState10 = _slicedToArray(_useState9, 2),
261
+ tfootHeight = _useState10[0],
262
+ setTfootHeight = _useState10[1];
257
263
  var handleTheadAndTfootHeight = usePersistFn(function () {
258
264
  var _theadRef$current, _tfootRef$current;
259
- var theadHeight = (theadRef === null || theadRef === void 0 || (_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0;
260
- var tfootHeight = ((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0;
261
- if (props.sticky) {
262
- context.tfootHeight = tfootHeight;
263
- } else {
264
- context.theadHeight = theadHeight;
265
- context.tfootHeight = tfootHeight;
266
- }
265
+ // sticky 时表头由 Sticky 单独渲染,不计入虚拟列表高度
266
+ if (!props.sticky) setTheadHeight(((_theadRef$current = theadRef.current) === null || _theadRef$current === void 0 ? void 0 : _theadRef$current.clientHeight) || 0);
267
+ setTfootHeight(((_tfootRef$current = tfootRef.current) === null || _tfootRef$current === void 0 ? void 0 : _tfootRef$current.clientHeight) || 0);
267
268
  });
268
269
  useEffect(function () {
269
270
  handleTheadAndTfootHeight();
@@ -302,8 +303,8 @@ export default function Table(props) {
302
303
  innerRef: tbodyRef,
303
304
  scrollLeft: props.scrollLeft,
304
305
  isRtl: isRtl,
305
- theadHeight: context.theadHeight,
306
- tfootHeight: context.tfootHeight,
306
+ theadHeight: theadHeight,
307
+ tfootHeight: tfootHeight,
307
308
  virtualScrollContainer: props.virtualScrollContainer,
308
309
  tableRef: tableRef,
309
310
  externalStickyHeader: !!props.virtualScrollContainer && !!props.sticky
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sheinx/base",
3
- "version": "3.10.2",
3
+ "version": "3.10.3-beta.2",
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",
13
+ "@sheinx/hooks": "3.10.3-beta.2",
14
14
  "immer": "^10.0.0",
15
15
  "classnames": "^2.0.0",
16
16
  "@shined/reactive": "^0.3.3"