@arim-aisdc/public-components 0.0.9 → 0.0.10
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.
|
@@ -368,17 +368,25 @@ var TableMax = function TableMax(_ref) {
|
|
|
368
368
|
setTableHeadHeight(tableHeaderRef === null || tableHeaderRef === void 0 || (_tableHeaderRef$curre = tableHeaderRef.current) === null || _tableHeaderRef$curre === void 0 ? void 0 : _tableHeaderRef$curre.clientHeight);
|
|
369
369
|
}, [tableHeaderRef === null || tableHeaderRef === void 0 || (_tableHeaderRef$curre2 = tableHeaderRef.current) === null || _tableHeaderRef$curre2 === void 0 ? void 0 : _tableHeaderRef$curre2.clientHeight, enableFilters]);
|
|
370
370
|
|
|
371
|
-
/**table
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}, [table.getTotalSize(), defaultScrollY, autoHeight, tableContentRef === null || tableContentRef === void 0 ? void 0 : tableContentRef.current, tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr3 = tableContentRef.current) === null || _tableContentRef$curr3 === void 0 ? void 0 : _tableContentRef$curr3.clientHeight, tableHeadHeight]);
|
|
371
|
+
/**table 高度 */
|
|
372
|
+
var _useState39 = useState(defaultScrollY),
|
|
373
|
+
_useState40 = _slicedToArray(_useState39, 2),
|
|
374
|
+
tableHeight = _useState40[0],
|
|
375
|
+
setTableHeight = _useState40[1];
|
|
377
376
|
|
|
378
377
|
/**table-body-content 高度 */
|
|
379
378
|
var bodyContentHeight = useMemo(function () {
|
|
380
379
|
return datas.length * Number(rowHeight);
|
|
381
380
|
}, [datas.length, rowHeight]);
|
|
381
|
+
|
|
382
|
+
/**table-body高度 */
|
|
383
|
+
useEffect(function () {
|
|
384
|
+
var _tableContentRef$curr, _tableContentRef$curr2;
|
|
385
|
+
var horizontalScrollHeight = table.getTotalSize() > (tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr = tableContentRef.current) === null || _tableContentRef$curr === void 0 ? void 0 : _tableContentRef$curr.offsetWidth) ? 10 : 0;
|
|
386
|
+
var bodyHeight = defaultScrollY - tableHeadHeight - horizontalScrollHeight;
|
|
387
|
+
setTableBodyHeight(autoHeight ? (tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr2 = tableContentRef.current) === null || _tableContentRef$curr2 === void 0 ? void 0 : _tableContentRef$curr2.clientHeight) - tableHeadHeight - horizontalScrollHeight : bodyContentHeight ? Math.min(bodyHeight, bodyContentHeight) : bodyHeight);
|
|
388
|
+
setTableHeight(bodyHeight < bodyContentHeight ? defaultScrollY : bodyContentHeight + tableHeadHeight + horizontalScrollHeight);
|
|
389
|
+
}, [table.getTotalSize(), defaultScrollY, autoHeight, tableContentRef === null || tableContentRef === void 0 ? void 0 : tableContentRef.current, tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr3 = tableContentRef.current) === null || _tableContentRef$curr3 === void 0 ? void 0 : _tableContentRef$curr3.clientHeight, tableHeadHeight, bodyContentHeight]);
|
|
382
390
|
var hasVerticalScrollBar = useMemo(function () {
|
|
383
391
|
return tableBodyHeight - bodyContentHeight + 10 < 0;
|
|
384
392
|
}, [tableBodyHeight, bodyContentHeight]);
|
|
@@ -1126,7 +1134,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
1126
1134
|
className: "table-center",
|
|
1127
1135
|
ref: tableContentRef,
|
|
1128
1136
|
style: {
|
|
1129
|
-
height: !autoHeight ?
|
|
1137
|
+
height: !autoHeight ? tableHeight : 'fix-content'
|
|
1130
1138
|
},
|
|
1131
1139
|
children: [/*#__PURE__*/_jsx("div", {
|
|
1132
1140
|
ref: tableHeaderRef,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arim-aisdc/public-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "前端组件库",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@tanstack/react-table": "^8.9.1",
|
|
50
50
|
"ahooks": "^3.7.8",
|
|
51
51
|
"css-vars-ponyfill": "^2.4.8",
|
|
52
|
+
"f": "^1.4.0",
|
|
52
53
|
"fs": "^0.0.1-security",
|
|
53
54
|
"lodash": "^4.17.21",
|
|
54
55
|
"path": "^0.12.7",
|