@arim-aisdc/public-components 2.3.55 → 2.3.56
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/dist/components/ConfigProvider/context.d.ts +2 -0
- package/dist/components/CustomForm/CustomForm.js +1 -0
- package/dist/components/TableMax/TableBody/VirtualTableBody.d.ts +2 -1
- package/dist/components/TableMax/TableBody/VirtualTableBody.js +3 -2
- package/dist/components/TableMax/TableMax.js +2 -1
- package/dist/components/TableMax/UnifiedTable.d.ts +0 -0
- package/dist/components/TableMax/UnifiedTable.js +0 -0
- package/dist/components/TableMax/hooks/useVirtualCalculations.d.ts +2 -2
- package/dist/components/TableMax/hooks/useVirtualCalculations.js +50 -6
- package/dist/components/TableMax/tableMax.less +5 -0
- package/package.json +1 -1
|
@@ -260,6 +260,7 @@ var CustomForm = function CustomForm(_ref, ref) {
|
|
|
260
260
|
case CustomFormItemType.TextArea:
|
|
261
261
|
element = /*#__PURE__*/_jsx(TextArea, {
|
|
262
262
|
rows: item.rows,
|
|
263
|
+
disabled: item.disabled,
|
|
263
264
|
placeholder: item.inputTips,
|
|
264
265
|
maxLength: item.maxLength,
|
|
265
266
|
onChange: function onChange(e) {
|
|
@@ -70,6 +70,7 @@ type TableBodyPropsType = {
|
|
|
70
70
|
openMemo?: boolean;
|
|
71
71
|
openVirtualColumns?: boolean;
|
|
72
72
|
openVirtualRows?: boolean;
|
|
73
|
+
tableKey: string;
|
|
73
74
|
};
|
|
74
|
-
declare const VirtualTableBody: ({ tableBodyRef, tableContentRef, table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, datas, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, dragBeforeStart, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, compactMode, onEditValueChange, hasTotalRow, totalDatas, setRowSelection, openMemo, openVirtualRows, }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
75
|
+
declare const VirtualTableBody: ({ tableBodyRef, tableContentRef, table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, datas, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, dragBeforeStart, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, compactMode, onEditValueChange, hasTotalRow, totalDatas, setRowSelection, openMemo, openVirtualRows, tableKey }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
75
76
|
export { VirtualTableBody };
|
|
@@ -78,13 +78,14 @@ var VirtualTableBody = function VirtualTableBody(_ref) {
|
|
|
78
78
|
setRowSelection = _ref.setRowSelection,
|
|
79
79
|
openMemo = _ref.openMemo,
|
|
80
80
|
_ref$openVirtualRows = _ref.openVirtualRows,
|
|
81
|
-
openVirtualRows = _ref$openVirtualRows === void 0 ? false : _ref$openVirtualRows
|
|
81
|
+
openVirtualRows = _ref$openVirtualRows === void 0 ? false : _ref$openVirtualRows,
|
|
82
|
+
tableKey = _ref.tableKey;
|
|
82
83
|
var _useConfig = useConfig(),
|
|
83
84
|
root = _useConfig.root;
|
|
84
85
|
var headerGroups = table.getHeaderGroups();
|
|
85
86
|
var headers = (headerGroups === null || headerGroups === void 0 || (_headerGroups = headerGroups[headerGroups.length - 1]) === null || _headerGroups === void 0 ? void 0 : _headerGroups.headers) || [];
|
|
86
87
|
var visibleColumns = table.getVisibleLeafColumns();
|
|
87
|
-
var _useVirtualCalculatio = useVirtualCalculations(table, {
|
|
88
|
+
var _useVirtualCalculatio = useVirtualCalculations(table, tableKey, {
|
|
88
89
|
openVirtualRows: openVirtualRows,
|
|
89
90
|
rowHeight: rowHeight
|
|
90
91
|
}, tableBodyRef),
|
|
@@ -1143,7 +1143,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
1143
1143
|
totalDatas: totalDatas,
|
|
1144
1144
|
setRowSelection: setRowSelection,
|
|
1145
1145
|
openMemo: openMemo !== null && openMemo !== void 0 ? openMemo : tableMaxConfig === null || tableMaxConfig === void 0 ? void 0 : tableMaxConfig.openMemo,
|
|
1146
|
-
openVirtualRows: openVirtualRows
|
|
1146
|
+
openVirtualRows: openVirtualRows,
|
|
1147
|
+
tableKey: tableKey
|
|
1147
1148
|
};
|
|
1148
1149
|
var changeCompactMode = function changeCompactMode() {
|
|
1149
1150
|
changeCompactModeStyle(!compactMode);
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { VirtualScrollConfig } from '../contexts';
|
|
2
|
-
export declare const useVirtualCalculations: (table: any, config: VirtualScrollConfig, tableBodyRef: React.RefObject<HTMLDivElement>) => {
|
|
2
|
+
export declare const useVirtualCalculations: (table: any, tableKey: string, config: VirtualScrollConfig, tableBodyRef: React.RefObject<HTMLDivElement>) => {
|
|
3
3
|
state: {
|
|
4
4
|
rowVirtualizer: import("@tanstack/virtual-core").Virtualizer<HTMLDivElement, Element>;
|
|
5
|
-
virtualRows:
|
|
5
|
+
virtualRows: any[];
|
|
6
6
|
};
|
|
7
7
|
isVirtualEnabled: boolean;
|
|
8
8
|
};
|
|
@@ -1,14 +1,44 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1
7
|
// hooks/useVirtualCalculations.ts
|
|
2
|
-
import { useEffect, useMemo } from 'react';
|
|
8
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
3
9
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
4
|
-
|
|
10
|
+
import { useConfig } from "../../ConfigProvider";
|
|
11
|
+
export var useVirtualCalculations = function useVirtualCalculations(table, tableKey, config, tableBodyRef) {
|
|
12
|
+
var _rowVirtualizer$getVi;
|
|
5
13
|
var isVirtualEnabled = shouldEnableVirtualization(config);
|
|
14
|
+
var _useConfig = useConfig(),
|
|
15
|
+
keepAliveActivateKey = _useConfig.keepAliveActivateKey,
|
|
16
|
+
keepAliveUnactivateKey = _useConfig.keepAliveUnactivateKey;
|
|
17
|
+
// 监听页面激活状态
|
|
18
|
+
var _useState = useState(0),
|
|
19
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
20
|
+
virtualizerRefreshKey = _useState2[0],
|
|
21
|
+
setVirtualizerRefreshKey = _useState2[1];
|
|
22
|
+
var lastVirtualRows = useRef([]);
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
if (keepAliveActivateKey) {
|
|
25
|
+
console.log('检测到页面激活,刷新虚拟化器:', keepAliveActivateKey);
|
|
26
|
+
setVirtualizerRefreshKey(function (prev) {
|
|
27
|
+
return prev + 1;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}, [keepAliveActivateKey]);
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
if (keepAliveUnactivateKey) {
|
|
33
|
+
console.log('检测到页面挂起,缓存数据:', keepAliveUnactivateKey);
|
|
34
|
+
lastVirtualRows.current = virtualRows;
|
|
35
|
+
}
|
|
36
|
+
}, [keepAliveUnactivateKey]);
|
|
6
37
|
|
|
7
38
|
// 行虚拟化配置 - 包含 rowHeight 依赖
|
|
8
39
|
var rows = table.getRowModel().rows;
|
|
9
40
|
var rowVirtualizerConfig = useMemo(function () {
|
|
10
41
|
if (!config.openVirtualRows) return null;
|
|
11
|
-
console.log(config, 'config111');
|
|
12
42
|
return {
|
|
13
43
|
count: rows.length,
|
|
14
44
|
estimateSize: function estimateSize() {
|
|
@@ -18,21 +48,35 @@ export var useVirtualCalculations = function useVirtualCalculations(table, confi
|
|
|
18
48
|
getScrollElement: function getScrollElement() {
|
|
19
49
|
return tableBodyRef.current;
|
|
20
50
|
},
|
|
21
|
-
overscan: config.rowOverscan || 10
|
|
51
|
+
overscan: config.rowOverscan || 10,
|
|
52
|
+
key: virtualizerRefreshKey
|
|
22
53
|
};
|
|
23
54
|
}, [config.openVirtualRows, rows.length, config.rowHeight,
|
|
24
55
|
// 关键:包含 rowHeight 依赖
|
|
25
|
-
config.rowOverscan,
|
|
56
|
+
config.rowOverscan, virtualizerRefreshKey, tableKey]);
|
|
26
57
|
var rowVirtualizer = rowVirtualizerConfig ? useVirtualizer(rowVirtualizerConfig) : null;
|
|
27
58
|
|
|
28
59
|
// 响应 rowHeight 变化
|
|
29
60
|
useEffect(function () {
|
|
30
61
|
if (rowVirtualizer && config.openVirtualRows) {
|
|
31
62
|
// 当 rowHeight 变化时,重新测量所有行
|
|
63
|
+
console.log('rowHeight数据变化,重新测量', rows.length);
|
|
32
64
|
rowVirtualizer.measure();
|
|
65
|
+
console.log('rowVirtualizer.measure1');
|
|
33
66
|
}
|
|
34
67
|
}, [config.rowHeight, rowVirtualizer, config.openVirtualRows]);
|
|
35
|
-
|
|
68
|
+
|
|
69
|
+
// 响应数据变化
|
|
70
|
+
useEffect(function () {
|
|
71
|
+
if (rowVirtualizer && config.openVirtualRows && rows.length > 0) {
|
|
72
|
+
console.log('数据变化,重新测量', rows.length);
|
|
73
|
+
setTimeout(function () {
|
|
74
|
+
rowVirtualizer.measure();
|
|
75
|
+
console.log('rowVirtualizer.measure2');
|
|
76
|
+
}, 50);
|
|
77
|
+
}
|
|
78
|
+
}, [rows.length, rowVirtualizer, config.openVirtualRows]);
|
|
79
|
+
var virtualRows = config.openVirtualRows ? (_rowVirtualizer$getVi = rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.getVirtualItems()) !== null && _rowVirtualizer$getVi !== void 0 ? _rowVirtualizer$getVi : lastVirtualRows.current : [];
|
|
36
80
|
var state = useMemo(function () {
|
|
37
81
|
return {
|
|
38
82
|
rowVirtualizer: rowVirtualizer,
|