@arim-aisdc/public-components 0.0.9 → 0.0.11
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.
|
@@ -14,7 +14,6 @@ type TableBodyPropsType = {
|
|
|
14
14
|
canFilter: boolean;
|
|
15
15
|
canSelection: boolean;
|
|
16
16
|
selectionWithoutChecked?: boolean;
|
|
17
|
-
tableBodyHeight: number;
|
|
18
17
|
bodyContentHeight: number;
|
|
19
18
|
tableContainerWidth: number;
|
|
20
19
|
selectedRowDragging: boolean;
|
|
@@ -53,5 +52,5 @@ type TableBodyPropsType = {
|
|
|
53
52
|
};
|
|
54
53
|
dragBeforeStart: (datas: any) => boolean;
|
|
55
54
|
};
|
|
56
|
-
declare const TableBody: ({ table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked,
|
|
55
|
+
declare const TableBody: ({ table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, hasVerticalScrollBar, datas, emptyDataHeight, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, pinShadowVisible, dragBeforeStart, }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
57
56
|
export default TableBody;
|
|
@@ -12,7 +12,6 @@ import { useDrop } from 'react-dnd';
|
|
|
12
12
|
import { CustomDragLayer } from "../components/CustomDragerLayer";
|
|
13
13
|
// import RowContent from "../components/RowContent";
|
|
14
14
|
|
|
15
|
-
import { useEffect } from 'react';
|
|
16
15
|
import { createPortal } from 'react-dom';
|
|
17
16
|
import Row from "./Row";
|
|
18
17
|
import "./index.less";
|
|
@@ -31,7 +30,6 @@ var TableBody = function TableBody(_ref) {
|
|
|
31
30
|
onSelectChange = _ref.onSelectChange,
|
|
32
31
|
canSelection = _ref.canSelection,
|
|
33
32
|
selectionWithoutChecked = _ref.selectionWithoutChecked,
|
|
34
|
-
tableBodyHeight = _ref.tableBodyHeight,
|
|
35
33
|
tableContainerWidth = _ref.tableContainerWidth,
|
|
36
34
|
selectedRowDragging = _ref.selectedRowDragging,
|
|
37
35
|
setSelectedRowDragging = _ref.setSelectedRowDragging,
|
|
@@ -239,9 +237,11 @@ var TableBody = function TableBody(_ref) {
|
|
|
239
237
|
}
|
|
240
238
|
return EmptyContent();
|
|
241
239
|
};
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
|
|
241
|
+
// useEffect(() => {
|
|
242
|
+
// console.log(tableBodyHeight, 'tableBodyHeight*******************');
|
|
243
|
+
// }, [tableBodyHeight]);
|
|
244
|
+
|
|
245
245
|
return (
|
|
246
246
|
/*#__PURE__*/
|
|
247
247
|
// 修复筛选数据为空时,滚动条丢失
|
|
@@ -81,8 +81,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
81
81
|
_ref$showSizeChanger = _ref.showSizeChanger,
|
|
82
82
|
showSizeChanger = _ref$showSizeChanger === void 0 ? true : _ref$showSizeChanger,
|
|
83
83
|
changePagination = _ref.changePagination,
|
|
84
|
-
|
|
85
|
-
defaultScrollY = _ref$defaultScrollY === void 0 ? 600 : _ref$defaultScrollY,
|
|
84
|
+
defaultScrollY = _ref.defaultScrollY,
|
|
86
85
|
_ref$columnResizeMode = _ref.columnResizeMode,
|
|
87
86
|
columnResizeMode = _ref$columnResizeMode === void 0 ? 'onChange' : _ref$columnResizeMode,
|
|
88
87
|
rowKey = _ref.rowKey,
|
|
@@ -367,18 +366,19 @@ var TableMax = function TableMax(_ref) {
|
|
|
367
366
|
var _tableHeaderRef$curre;
|
|
368
367
|
setTableHeadHeight(tableHeaderRef === null || tableHeaderRef === void 0 || (_tableHeaderRef$curre = tableHeaderRef.current) === null || _tableHeaderRef$curre === void 0 ? void 0 : _tableHeaderRef$curre.clientHeight);
|
|
369
368
|
}, [tableHeaderRef === null || tableHeaderRef === void 0 || (_tableHeaderRef$curre2 = tableHeaderRef.current) === null || _tableHeaderRef$curre2 === void 0 ? void 0 : _tableHeaderRef$curre2.clientHeight, enableFilters]);
|
|
369
|
+
var bodyContentHeight = useMemo(function () {
|
|
370
|
+
return datas.length * Number(rowHeight);
|
|
371
|
+
}, [datas.length, rowHeight]);
|
|
370
372
|
|
|
371
373
|
/**table-body高度 */
|
|
372
374
|
useEffect(function () {
|
|
373
375
|
var _tableContentRef$curr, _tableContentRef$curr2;
|
|
374
376
|
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;
|
|
375
|
-
setTableBodyHeight(autoHeight ? (tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr2 = tableContentRef.current) === null || _tableContentRef$curr2 === void 0 ? void 0 : _tableContentRef$curr2.clientHeight) - tableHeadHeight - horizontalScrollHeight : defaultScrollY - tableHeadHeight - horizontalScrollHeight);
|
|
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]);
|
|
377
|
+
setTableBodyHeight(autoHeight ? (tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr2 = tableContentRef.current) === null || _tableContentRef$curr2 === void 0 ? void 0 : _tableContentRef$curr2.clientHeight) - tableHeadHeight - horizontalScrollHeight : defaultScrollY ? defaultScrollY - tableHeadHeight - horizontalScrollHeight : bodyContentHeight);
|
|
378
|
+
}, [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]);
|
|
377
379
|
|
|
378
380
|
/**table-body-content 高度 */
|
|
379
|
-
|
|
380
|
-
return datas.length * Number(rowHeight);
|
|
381
|
-
}, [datas.length, rowHeight]);
|
|
381
|
+
|
|
382
382
|
var hasVerticalScrollBar = useMemo(function () {
|
|
383
383
|
return tableBodyHeight - bodyContentHeight + 10 < 0;
|
|
384
384
|
}, [tableBodyHeight, bodyContentHeight]);
|
|
@@ -967,7 +967,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
967
967
|
selectionWithoutChecked: selectionWithoutChecked,
|
|
968
968
|
// scroll,
|
|
969
969
|
// setScroll,
|
|
970
|
-
|
|
970
|
+
// tableBodyHeight,
|
|
971
971
|
// tableHeadHeight,
|
|
972
972
|
// setTableHeadHeight,
|
|
973
973
|
bodyContentHeight: bodyContentHeight,
|
|
@@ -1126,7 +1126,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
1126
1126
|
className: "table-center",
|
|
1127
1127
|
ref: tableContentRef,
|
|
1128
1128
|
style: {
|
|
1129
|
-
height: !autoHeight ? defaultScrollY : 'fix-content'
|
|
1129
|
+
height: !autoHeight && defaultScrollY ? defaultScrollY : 'fix-content'
|
|
1130
1130
|
},
|
|
1131
1131
|
children: [/*#__PURE__*/_jsx("div", {
|
|
1132
1132
|
ref: tableHeaderRef,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
2
|
-
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
3
|
-
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
1
|
+
export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
2
|
+
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
3
|
+
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
4
4
|
declare const customSortFns: {
|
|
5
|
-
numberSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
6
|
-
stringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
7
|
-
timeSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
5
|
+
numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
6
|
+
stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
7
|
+
timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
8
8
|
};
|
|
9
9
|
export default customSortFns;
|
|
10
10
|
export type SortFnType = keyof typeof customSortFns | undefined;
|
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.11",
|
|
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",
|
|
@@ -90,4 +91,4 @@
|
|
|
90
91
|
"authors": [
|
|
91
92
|
"na.xu2278@foxmail.com"
|
|
92
93
|
]
|
|
93
|
-
}
|
|
94
|
+
}
|