qbs-react-grid 1.1.7 → 1.1.8
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/es/Table.js +2 -1
- package/es/utils/useTableDimension.d.ts +1 -1
- package/es/utils/useTableDimension.js +5 -6
- package/lib/Table.js +2 -1
- package/lib/utils/useTableDimension.d.ts +1 -1
- package/lib/utils/useTableDimension.js +5 -6
- package/package.json +1 -1
- package/src/Table.tsx +4 -29
- package/src/utils/useTableDimension.ts +7 -7
package/es/Table.js
CHANGED
|
@@ -359,7 +359,7 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
359
359
|
}));
|
|
360
360
|
var styles = _extends({
|
|
361
361
|
width: widthProp || 'auto',
|
|
362
|
-
height: tableBodyHeight ?
|
|
362
|
+
height: tableBodyHeight != null ? tableBodyHeight : getTableHeight()
|
|
363
363
|
}, style);
|
|
364
364
|
var renderRowExpanded = useCallback(function (rowData) {
|
|
365
365
|
var styles = {
|
|
@@ -619,6 +619,7 @@ var Table = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
619
619
|
var bodyHeight = height - headerHeight;
|
|
620
620
|
var bodyStyles = {
|
|
621
621
|
top: headerHeight,
|
|
622
|
+
height: bodyHeight,
|
|
622
623
|
maxHeight: tableBodyHeight,
|
|
623
624
|
minHeight: tableBodyHeight
|
|
624
625
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ElementOffset, RowDataType } from '../@types/common';
|
|
3
3
|
interface TableDimensionProps<Row, Key> {
|
|
4
4
|
data?: readonly Row[];
|
|
5
5
|
rowHeight: number | ((rowData?: Row) => number);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import getWidth from 'dom-lib/getWidth';
|
|
1
|
+
import { ResizeObserver } from '@juggle/resize-observer';
|
|
3
2
|
import getHeight from 'dom-lib/getHeight';
|
|
4
3
|
import getOffset from 'dom-lib/getOffset';
|
|
4
|
+
import getWidth from 'dom-lib/getWidth';
|
|
5
|
+
import debounce from 'lodash/debounce';
|
|
6
|
+
import { useCallback, useRef } from 'react';
|
|
5
7
|
import { SCROLLBAR_WIDTH } from '../constants';
|
|
6
|
-
import
|
|
8
|
+
import isNumberOrTrue from './isNumberOrTrue';
|
|
7
9
|
import useMount from './useMount';
|
|
8
10
|
import useUpdateLayoutEffect from './useUpdateLayoutEffect';
|
|
9
|
-
import isNumberOrTrue from './isNumberOrTrue';
|
|
10
|
-
import debounce from 'lodash/debounce';
|
|
11
11
|
/**
|
|
12
12
|
* The dimension information of the table,
|
|
13
13
|
* including the height, width, scrollable distance and the coordinates of the scroll handle, etc.
|
|
@@ -218,7 +218,6 @@ var useTableDimension = function useTableDimension(props) {
|
|
|
218
218
|
if ((data === null || data === void 0 ? void 0 : data.length) === 0 && autoHeight) {
|
|
219
219
|
return heightProp;
|
|
220
220
|
}
|
|
221
|
-
console.log(heightProp, headerHeight, contentHeight.current, tableHeight.current);
|
|
222
221
|
return autoHeight ? Math.max(headerHeight + contentHeight.current, minHeight) : heightProp;
|
|
223
222
|
};
|
|
224
223
|
return {
|
package/lib/Table.js
CHANGED
|
@@ -366,7 +366,7 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
366
366
|
}));
|
|
367
367
|
var styles = (0, _extends2["default"])({
|
|
368
368
|
width: widthProp || 'auto',
|
|
369
|
-
height: tableBodyHeight ?
|
|
369
|
+
height: tableBodyHeight != null ? tableBodyHeight : getTableHeight()
|
|
370
370
|
}, style);
|
|
371
371
|
var renderRowExpanded = (0, _react.useCallback)(function (rowData) {
|
|
372
372
|
var styles = {
|
|
@@ -626,6 +626,7 @@ var Table = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
626
626
|
var bodyHeight = height - headerHeight;
|
|
627
627
|
var bodyStyles = {
|
|
628
628
|
top: headerHeight,
|
|
629
|
+
height: bodyHeight,
|
|
629
630
|
maxHeight: tableBodyHeight,
|
|
630
631
|
minHeight: tableBodyHeight
|
|
631
632
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ElementOffset, RowDataType } from '../@types/common';
|
|
3
3
|
interface TableDimensionProps<Row, Key> {
|
|
4
4
|
data?: readonly Row[];
|
|
5
5
|
rowHeight: number | ((rowData?: Row) => number);
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports["default"] = void 0;
|
|
6
|
-
var
|
|
7
|
-
var _getWidth = _interopRequireDefault(require("dom-lib/getWidth"));
|
|
6
|
+
var _resizeObserver = require("@juggle/resize-observer");
|
|
8
7
|
var _getHeight = _interopRequireDefault(require("dom-lib/getHeight"));
|
|
9
8
|
var _getOffset = _interopRequireDefault(require("dom-lib/getOffset"));
|
|
9
|
+
var _getWidth = _interopRequireDefault(require("dom-lib/getWidth"));
|
|
10
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
11
|
+
var _react = require("react");
|
|
10
12
|
var _constants = require("../constants");
|
|
11
|
-
var
|
|
13
|
+
var _isNumberOrTrue = _interopRequireDefault(require("./isNumberOrTrue"));
|
|
12
14
|
var _useMount = _interopRequireDefault(require("./useMount"));
|
|
13
15
|
var _useUpdateLayoutEffect = _interopRequireDefault(require("./useUpdateLayoutEffect"));
|
|
14
|
-
var _isNumberOrTrue = _interopRequireDefault(require("./isNumberOrTrue"));
|
|
15
|
-
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
16
16
|
/**
|
|
17
17
|
* The dimension information of the table,
|
|
18
18
|
* including the height, width, scrollable distance and the coordinates of the scroll handle, etc.
|
|
@@ -223,7 +223,6 @@ var useTableDimension = function useTableDimension(props) {
|
|
|
223
223
|
if ((data === null || data === void 0 ? void 0 : data.length) === 0 && autoHeight) {
|
|
224
224
|
return heightProp;
|
|
225
225
|
}
|
|
226
|
-
console.log(heightProp, headerHeight, contentHeight.current, tableHeight.current);
|
|
227
226
|
return autoHeight ? Math.max(headerHeight + contentHeight.current, minHeight) : heightProp;
|
|
228
227
|
};
|
|
229
228
|
return {
|
package/package.json
CHANGED
package/src/Table.tsx
CHANGED
|
@@ -6,40 +6,14 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import React, { useCallback, useImperativeHandle, useReducer, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import CellGroup from './CellGroup';
|
|
9
|
-
import {
|
|
10
|
-
CELL_PADDING_HEIGHT,
|
|
11
|
-
EXPANDED_KEY,
|
|
12
|
-
ROW_HEADER_HEIGHT,
|
|
13
|
-
ROW_HEIGHT,
|
|
14
|
-
SCROLLBAR_WIDTH,
|
|
15
|
-
SORT_TYPE,
|
|
16
|
-
TREE_DEPTH
|
|
17
|
-
} from './constants';
|
|
9
|
+
import { CELL_PADDING_HEIGHT, EXPANDED_KEY, ROW_HEADER_HEIGHT, ROW_HEIGHT, SCROLLBAR_WIDTH, SORT_TYPE, TREE_DEPTH } from './constants';
|
|
18
10
|
import EmptyMessage from './EmptyMessage';
|
|
19
11
|
import Loader from './Loader';
|
|
20
12
|
import MouseArea from './MouseArea';
|
|
21
13
|
import Row, { RowProps } from './Row';
|
|
22
14
|
import Scrollbar, { ScrollbarInstance } from './Scrollbar';
|
|
23
15
|
import TableContext from './TableContext';
|
|
24
|
-
import {
|
|
25
|
-
findAllParents,
|
|
26
|
-
findRowKeys,
|
|
27
|
-
flattenData,
|
|
28
|
-
isRTL,
|
|
29
|
-
isSupportTouchEvent,
|
|
30
|
-
mergeCells,
|
|
31
|
-
resetLeftForCells,
|
|
32
|
-
shouldShowRowByExpanded,
|
|
33
|
-
useAffix,
|
|
34
|
-
useCellDescriptor,
|
|
35
|
-
useClassNames,
|
|
36
|
-
useControlled,
|
|
37
|
-
usePosition,
|
|
38
|
-
useScrollListener,
|
|
39
|
-
useTableDimension,
|
|
40
|
-
useTableRows,
|
|
41
|
-
useUpdateEffect
|
|
42
|
-
} from './utils';
|
|
16
|
+
import { findAllParents, findRowKeys, flattenData, isRTL, isSupportTouchEvent, mergeCells, resetLeftForCells, shouldShowRowByExpanded, useAffix, useCellDescriptor, useClassNames, useControlled, usePosition, useScrollListener, useTableDimension, useTableRows, useUpdateEffect } from './utils';
|
|
43
17
|
|
|
44
18
|
import type {
|
|
45
19
|
StandardProps,
|
|
@@ -593,7 +567,7 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
|
|
|
593
567
|
|
|
594
568
|
const styles = {
|
|
595
569
|
width: widthProp || 'auto',
|
|
596
|
-
height: tableBodyHeight
|
|
570
|
+
height: tableBodyHeight ?? getTableHeight(),
|
|
597
571
|
...style
|
|
598
572
|
};
|
|
599
573
|
|
|
@@ -947,6 +921,7 @@ const Table = React.forwardRef(<Row extends RowDataType, Key>(props: TableProps<
|
|
|
947
921
|
const bodyHeight = height - headerHeight;
|
|
948
922
|
const bodyStyles = {
|
|
949
923
|
top: headerHeight,
|
|
924
|
+
height: bodyHeight,
|
|
950
925
|
maxHeight: tableBodyHeight,
|
|
951
926
|
minHeight: tableBodyHeight
|
|
952
927
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import getWidth from 'dom-lib/getWidth';
|
|
1
|
+
import { ResizeObserver } from '@juggle/resize-observer';
|
|
3
2
|
import getHeight from 'dom-lib/getHeight';
|
|
4
3
|
import getOffset from 'dom-lib/getOffset';
|
|
4
|
+
import getWidth from 'dom-lib/getWidth';
|
|
5
|
+
import debounce from 'lodash/debounce';
|
|
6
|
+
import React, { useCallback, useRef } from 'react';
|
|
7
|
+
|
|
8
|
+
import { ElementOffset, RowDataType } from '../@types/common';
|
|
5
9
|
import { SCROLLBAR_WIDTH } from '../constants';
|
|
6
|
-
import
|
|
10
|
+
import isNumberOrTrue from './isNumberOrTrue';
|
|
7
11
|
import useMount from './useMount';
|
|
8
12
|
import useUpdateLayoutEffect from './useUpdateLayoutEffect';
|
|
9
|
-
import isNumberOrTrue from './isNumberOrTrue';
|
|
10
|
-
import { RowDataType, ElementOffset } from '../@types/common';
|
|
11
|
-
import debounce from 'lodash/debounce';
|
|
12
13
|
|
|
13
14
|
interface TableDimensionProps<Row, Key> {
|
|
14
15
|
data?: readonly Row[];
|
|
@@ -308,7 +309,6 @@ const useTableDimension = <Row extends RowDataType, Key>(props: TableDimensionPr
|
|
|
308
309
|
if (data?.length === 0 && autoHeight) {
|
|
309
310
|
return heightProp;
|
|
310
311
|
}
|
|
311
|
-
console.log(heightProp, headerHeight, contentHeight.current, tableHeight.current);
|
|
312
312
|
|
|
313
313
|
return autoHeight ? Math.max(headerHeight + contentHeight.current, minHeight) : heightProp;
|
|
314
314
|
};
|