@arim-aisdc/public-components 2.3.54 → 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.
Files changed (40) hide show
  1. package/dist/components/ConfigProvider/context.d.ts +2 -0
  2. package/dist/components/CustomForm/CustomForm.js +1 -0
  3. package/dist/components/TableMax/TableBody/OriginalRow.d.ts +1 -2
  4. package/dist/components/TableMax/TableBody/OriginalRow.js +3 -8
  5. package/dist/components/TableMax/TableBody/OriginalTableBody.d.ts +1 -1
  6. package/dist/components/TableMax/TableBody/OriginalTableBody.js +1 -8
  7. package/dist/components/TableMax/TableBody/TableBody.js +4 -4
  8. package/dist/components/TableMax/TableBody/VirtualRow.d.ts +1 -2
  9. package/dist/components/TableMax/TableBody/VirtualRow.js +141 -139
  10. package/dist/components/TableMax/TableBody/VirtualTableBody.d.ts +2 -1
  11. package/dist/components/TableMax/TableBody/VirtualTableBody.js +21 -26
  12. package/dist/components/TableMax/TableBody/components/Total.d.ts +1 -2
  13. package/dist/components/TableMax/TableBody/components/Total.js +6 -59
  14. package/dist/components/TableMax/TableBody/components/VirtualTotal.d.ts +0 -0
  15. package/dist/components/TableMax/TableBody/components/VirtualTotal.js +0 -0
  16. package/dist/components/TableMax/TableHeader/TableHeader.js +4 -4
  17. package/dist/components/TableMax/TableHeader/VirtualTableHeader/ColGroup.d.ts +0 -11
  18. package/dist/components/TableMax/TableHeader/VirtualTableHeader/ColGroup.js +47 -32
  19. package/dist/components/TableMax/TableHeader/VirtualTableHeader/index.d.ts +0 -4
  20. package/dist/components/TableMax/TableHeader/VirtualTableHeader/index.js +93 -79
  21. package/dist/components/TableMax/TableHeader/index.d.ts +0 -1
  22. package/dist/components/TableMax/TableHeader/index.js +1 -1
  23. package/dist/components/TableMax/TableMax.js +52 -57
  24. package/dist/components/TableMax/UnifiedTable.d.ts +0 -0
  25. package/dist/components/TableMax/UnifiedTable.js +0 -0
  26. package/dist/components/TableMax/contexts/VirtualScroll/VirtualScrollProvider.d.ts +0 -3
  27. package/dist/components/TableMax/contexts/VirtualScroll/VirtualScrollProvider.js +26 -26
  28. package/dist/components/TableMax/contexts/VirtualScroll/index.d.ts +0 -1
  29. package/dist/components/TableMax/contexts/VirtualScroll/index.js +1 -1
  30. package/dist/components/TableMax/hooks/useTableComponents.d.ts +0 -6
  31. package/dist/components/TableMax/hooks/useTableComponents.js +25 -19
  32. package/dist/components/TableMax/hooks/useVirtualCalculations copy.d.ts +25 -0
  33. package/dist/components/TableMax/hooks/useVirtualCalculations copy.js +106 -0
  34. package/dist/components/TableMax/hooks/useVirtualCalculations.d.ts +2 -9
  35. package/dist/components/TableMax/hooks/useVirtualCalculations.js +53 -48
  36. package/dist/components/TableMax/hooks/useVirtualScroll.d.ts +0 -4
  37. package/dist/components/TableMax/hooks/useVirtualScroll.js +25 -30
  38. package/dist/components/TableMax/tableMax.less +25 -17
  39. package/dist/components/TableMax/utils.js +8 -3
  40. package/package.json +1 -1
@@ -33,6 +33,8 @@ export interface ConfigConsumerProps {
33
33
  openMemo?: boolean;
34
34
  canSelectionUseShift?: boolean;
35
35
  };
36
+ keepAliveActivateKey?: number;
37
+ keepAliveUnactivateKey?: number;
36
38
  }
37
39
  export declare const DEFAULT_CONTEXT: {
38
40
  theme: string;
@@ -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) {
@@ -32,7 +32,6 @@ type IRowProps = {
32
32
  onRowMouseLeave?: (row: any) => void;
33
33
  onRowMouseClick?: (row: any) => void;
34
34
  onRowMouseDoubleClick?: (row: any) => void;
35
- rowHeight: number;
36
35
  disableDragRowIds?: any[];
37
36
  selectRowWhenClick: boolean;
38
37
  handleEditRowWhenDClick: (row: any) => void;
@@ -58,5 +57,5 @@ type IRowProps = {
58
57
  setRowSelection?: Function;
59
58
  openMemo?: boolean;
60
59
  };
61
- declare const OriginalRow: ({ tableBodyRef, table, tableId, row, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, reorderRow, canRowDrag, rowClassName, cellClassName, rowStyle, getCellProps, editting, rowEditing, renderSubComponent, selectedRowDragging, setSelectedRowDragging, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, rowHeight, disableDragRowIds, selectRowWhenClick, handleEditRowWhenDClick, canEditRowWhenDClick, theme, dragBeforeStart, onCellContextMenu, getRowHoverTipConfig, tableTooltip, changeHoverRow, clearHoverRowIndex, hoverRowIndex, dropSide, onEditValueChange, setRowSelection, openMemo }: IRowProps) => import("react/jsx-runtime").JSX.Element;
60
+ declare const OriginalRow: ({ tableBodyRef, table, tableId, row, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, reorderRow, canRowDrag, rowClassName, cellClassName, rowStyle, getCellProps, editting, rowEditing, renderSubComponent, selectedRowDragging, setSelectedRowDragging, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, handleEditRowWhenDClick, canEditRowWhenDClick, theme, dragBeforeStart, onCellContextMenu, getRowHoverTipConfig, tableTooltip, changeHoverRow, clearHoverRowIndex, hoverRowIndex, dropSide, onEditValueChange, setRowSelection, openMemo }: IRowProps) => import("react/jsx-runtime").JSX.Element;
62
61
  export { OriginalRow };
@@ -59,7 +59,6 @@ var OriginalRow = function OriginalRow(_ref) {
59
59
  onRowMouseLeave = _ref.onRowMouseLeave,
60
60
  onRowMouseClick = _ref.onRowMouseClick,
61
61
  onRowMouseDoubleClick = _ref.onRowMouseDoubleClick,
62
- rowHeight = _ref.rowHeight,
63
62
  disableDragRowIds = _ref.disableDragRowIds,
64
63
  selectRowWhenClick = _ref.selectRowWhenClick,
65
64
  handleEditRowWhenDClick = _ref.handleEditRowWhenDClick,
@@ -371,9 +370,7 @@ var OriginalRow = function OriginalRow(_ref) {
371
370
  })) || []), ['tbody-tr-td']).filter(Boolean).join(' ');
372
371
  return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
373
372
  className: cellClassNames,
374
- style: _objectSpread({
375
- height: rowHeight - 1
376
- }, getPinningStyle(cell, table, false)),
373
+ style: _objectSpread({}, getPinningStyle(cell, table, false)),
377
374
  onContextMenu: function onContextMenu(e) {
378
375
  return handleCellRightClick(e, cell);
379
376
  }
@@ -412,7 +409,7 @@ var OriginalRow = function OriginalRow(_ref) {
412
409
  }
413
410
  }, [
414
411
  // 依赖项保持不变
415
- row, row.id, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, cellClassName, theme, rowHeight, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, row.getVisibleCells(), row.getIsSelected()]);
412
+ row, row.id, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, cellClassName, theme, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, row.getVisibleCells(), row.getIsSelected()]);
416
413
  var rowCom = function rowCom() {
417
414
  var renderCell = function renderCell(cell) {
418
415
  var _cellClassName2;
@@ -445,9 +442,7 @@ var OriginalRow = function OriginalRow(_ref) {
445
442
  })) || []), ['tbody-tr-td']).filter(Boolean).join(' ');
446
443
  return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
447
444
  className: cellClassNames,
448
- style: _objectSpread({
449
- height: rowHeight - 1
450
- }, getPinningStyle(cell, table, false)),
445
+ style: _objectSpread({}, getPinningStyle(cell, table, false)),
451
446
  onContextMenu: function onContextMenu(e) {
452
447
  return handleCellRightClick(e, cell);
453
448
  }
@@ -72,5 +72,5 @@ export type TableBodyPropsType = {
72
72
  setRowSelection: Function;
73
73
  openMemo?: boolean;
74
74
  };
75
- declare const OriginalTableBody: ({ tableBodyRef, 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 }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
75
+ declare const OriginalTableBody: ({ tableBodyRef, table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, datas, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, dragBeforeStart, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, compactMode, onEditValueChange, hasTotalRow, totalDatas, setRowSelection, openMemo }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
76
76
  export { OriginalTableBody };
@@ -54,7 +54,6 @@ var OriginalTableBody = function OriginalTableBody(_ref) {
54
54
  cellClassName = _ref.cellClassName,
55
55
  rowStyle = _ref.rowStyle,
56
56
  getCellProps = _ref.getCellProps,
57
- rowHeight = _ref.rowHeight,
58
57
  renderSubComponent = _ref.renderSubComponent,
59
58
  onRowMouseEnter = _ref.onRowMouseEnter,
60
59
  onRowMouseLeave = _ref.onRowMouseLeave,
@@ -360,7 +359,6 @@ var OriginalTableBody = function OriginalTableBody(_ref) {
360
359
  onRowMouseLeave: onRowMouseLeave,
361
360
  onRowMouseClick: onRowMouseClick,
362
361
  onRowMouseDoubleClick: onRowMouseDoubleClick,
363
- rowHeight: rowHeight,
364
362
  disableDragRowIds: disableDragRowIds,
365
363
  selectRowWhenClick: selectRowWhenClick,
366
364
  handleEditRowWhenDClick: handleEditRowWhenDClick,
@@ -384,9 +382,6 @@ var OriginalTableBody = function OriginalTableBody(_ref) {
384
382
  var _table$getRowModel$ro;
385
383
  return !loading && datas.length !== 0 && ((_table$getRowModel$ro = table.getRowModel().rows) === null || _table$getRowModel$ro === void 0 ? void 0 : _table$getRowModel$ro.length) !== 0;
386
384
  }, [loading, datas.length, (_table$getRowModel$ro2 = table.getRowModel().rows) === null || _table$getRowModel$ro2 === void 0 ? void 0 : _table$getRowModel$ro2.length]);
387
-
388
- // console.log('rowHeight :>>', rowHeight);
389
-
390
385
  var TableRow = useMemo(function () {
391
386
  return table.getRowModel().rows;
392
387
  }, [table, table.getState().rowSelection]);
@@ -454,7 +449,6 @@ var OriginalTableBody = function OriginalTableBody(_ref) {
454
449
  onRowMouseLeave: onRowMouseLeave,
455
450
  onRowMouseClick: onRowMouseClick,
456
451
  onRowMouseDoubleClick: onRowMouseDoubleClick,
457
- rowHeight: rowHeight,
458
452
  disableDragRowIds: disableDragRowIds,
459
453
  selectRowWhenClick: selectRowWhenClick,
460
454
  handleEditRowWhenDClick: handleEditRowWhenDClick,
@@ -475,8 +469,7 @@ var OriginalTableBody = function OriginalTableBody(_ref) {
475
469
  , /*#__PURE__*/_jsx(_Fragment, {
476
470
  children: hasTotalRow && /*#__PURE__*/_jsx(Total, {
477
471
  table: table,
478
- totalDatas: totalDatas,
479
- rowHeight: rowHeight
472
+ totalDatas: totalDatas
480
473
  })
481
474
  })]
482
475
  })]
@@ -5,11 +5,11 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
6
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import React from 'react';
8
- import { useTableComponents } from "../hooks/useTableComponents";
8
+ import { VirtualTableBody } from "./VirtualTableBody";
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
10
  export var TableBody = function TableBody(props) {
11
- var _useTableComponents = useTableComponents(),
12
- BodyComponent = _useTableComponents.TableBody;
13
- return /*#__PURE__*/_jsx(BodyComponent, _objectSpread({}, props));
11
+ // const { TableBody: BodyComponent } = useTableComponents();
12
+ // return <BodyComponent {...props} />;
13
+ return /*#__PURE__*/_jsx(VirtualTableBody, _objectSpread({}, props));
14
14
  };
15
15
  export default TableBody;
@@ -32,7 +32,6 @@ type IRowProps = {
32
32
  onRowMouseLeave?: (row: any) => void;
33
33
  onRowMouseClick?: (row: any) => void;
34
34
  onRowMouseDoubleClick?: (row: any) => void;
35
- rowHeight: number;
36
35
  disableDragRowIds?: any[];
37
36
  selectRowWhenClick: boolean;
38
37
  handleEditRowWhenDClick: (row: any) => void;
@@ -59,5 +58,5 @@ type IRowProps = {
59
58
  openMemo?: boolean;
60
59
  virtualRowStart?: number;
61
60
  };
62
- declare const VirtualRow: ({ tableBodyRef, table, tableId, row, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, reorderRow, canRowDrag, rowClassName, cellClassName, rowStyle, getCellProps, editting, rowEditing, renderSubComponent, selectedRowDragging, setSelectedRowDragging, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, rowHeight, disableDragRowIds, selectRowWhenClick, handleEditRowWhenDClick, canEditRowWhenDClick, theme, dragBeforeStart, onCellContextMenu, getRowHoverTipConfig, tableTooltip, changeHoverRow, clearHoverRowIndex, hoverRowIndex, dropSide, onEditValueChange, setRowSelection, openMemo, virtualRowStart }: IRowProps) => import("react/jsx-runtime").JSX.Element;
61
+ declare const VirtualRow: ({ tableBodyRef, table, tableId, row, rowSelectedId, setRowSelectedId, rowHighLightId, setRowHighLightId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, reorderRow, canRowDrag, rowClassName, cellClassName, rowStyle, getCellProps, editting, rowEditing, renderSubComponent, selectedRowDragging, setSelectedRowDragging, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, handleEditRowWhenDClick, canEditRowWhenDClick, theme, dragBeforeStart, onCellContextMenu, getRowHoverTipConfig, tableTooltip, changeHoverRow, clearHoverRowIndex, hoverRowIndex, dropSide, onEditValueChange, setRowSelection, openMemo, virtualRowStart }: IRowProps) => import("react/jsx-runtime").JSX.Element;
63
62
  export { VirtualRow };
@@ -26,7 +26,6 @@ import { EditableCell } from "../components/ColumnEdit";
26
26
  import "./index.less";
27
27
  import dayjs from 'dayjs';
28
28
  import { useConfig } from "../../ConfigProvider";
29
- import { useVirtualConfig, useVirtualState } from "../hooks/useVirtualScroll";
30
29
  import { jsx as _jsx } from "react/jsx-runtime";
31
30
  import { Fragment as _Fragment } from "react/jsx-runtime";
32
31
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -60,7 +59,6 @@ var VirtualRow = function VirtualRow(_ref) {
60
59
  onRowMouseLeave = _ref.onRowMouseLeave,
61
60
  onRowMouseClick = _ref.onRowMouseClick,
62
61
  onRowMouseDoubleClick = _ref.onRowMouseDoubleClick,
63
- rowHeight = _ref.rowHeight,
64
62
  disableDragRowIds = _ref.disableDragRowIds,
65
63
  selectRowWhenClick = _ref.selectRowWhenClick,
66
64
  handleEditRowWhenDClick = _ref.handleEditRowWhenDClick,
@@ -83,15 +81,6 @@ var VirtualRow = function VirtualRow(_ref) {
83
81
  var timerRef = useRef();
84
82
  var clickCountRef = useRef(0);
85
83
 
86
- // 使用 Provider 中的虚拟化数据
87
- var config = useVirtualConfig();
88
- var state = useVirtualState();
89
-
90
- // 从 Provider 中获取虚拟化数据
91
- var virtualColumns = state.virtualColumns,
92
- virtualPaddingLeft = state.virtualPaddingLeft,
93
- virtualPaddingRight = state.virtualPaddingRight;
94
-
95
84
  // 优化:使用useMemo缓存计算结果
96
85
  var dropPreviewLineClassName = useMemo(function () {
97
86
  if (hoverRowIndex === row.index) {
@@ -125,21 +114,6 @@ var VirtualRow = function VirtualRow(_ref) {
125
114
  return row.getVisibleCells();
126
115
  }, [row, table.getState().columnVisibility]);
127
116
 
128
- // 分离固定列和可滚动列的单元格
129
- var _useMemo = useMemo(function () {
130
- var leftPinned = row.getLeftVisibleCells();
131
- var rightPinned = row.getRightVisibleCells();
132
- var scrollable = row.getCenterVisibleCells();
133
- return {
134
- leftPinnedCells: leftPinned,
135
- rightPinnedCells: rightPinned,
136
- scrollableCells: scrollable
137
- };
138
- }, [row, table.getState().columnPinning, table.getState().columnVisibility]),
139
- leftPinnedCells = _useMemo.leftPinnedCells,
140
- rightPinnedCells = _useMemo.rightPinnedCells,
141
- scrollableCells = _useMemo.scrollableCells;
142
-
143
117
  // 拖拽相关逻辑保持不变
144
118
  var _useDrop = useDrop({
145
119
  accept: 'TABLE_ROW',
@@ -209,110 +183,6 @@ var VirtualRow = function VirtualRow(_ref) {
209
183
  onCellContextMenu(e, cell);
210
184
  }, [onCellContextMenu]);
211
185
 
212
- // 渲染单个单元格
213
- var renderCell = useCallback(function (cell) {
214
- var _cell$column, _cell$getValue, _cell$getValue2, _cellClassName;
215
- // 确保 cell.column.columnDef 存在
216
- if (!(cell !== null && cell !== void 0 && (_cell$column = cell.column) !== null && _cell$column !== void 0 && _cell$column.columnDef)) {
217
- console.warn('Cell column definition missing', cell);
218
- return null;
219
- }
220
- var _cell$column$columnDe = cell.column.columnDef,
221
- columnEditable = _cell$column$columnDe.editable,
222
- accessorKey = _cell$column$columnDe.accessorKey,
223
- header = _cell$column$columnDe.header,
224
- columnClassName = _cell$column$columnDe.columnClassName,
225
- columnId = _cell$column$columnDe.id,
226
- filterType = _cell$column$columnDe.filterType;
227
- var columnEditing = rowEditing && columnEditable;
228
- var rawValue = (_cell$getValue = (_cell$getValue2 = cell.getValue) === null || _cell$getValue2 === void 0 ? void 0 : _cell$getValue2.call(cell)) !== null && _cell$getValue !== void 0 ? _cell$getValue : '';
229
-
230
- // 检查必要的函数是否存在
231
- if (typeof cell.getContext !== 'function') {
232
- console.warn('cell.getContext is not a function', cell);
233
- return null;
234
- }
235
- var originalContext = cell.getContext();
236
- var enhancedContext = _objectSpread(_objectSpread({}, originalContext), {}, {
237
- getValue: function getValue() {
238
- return rawValue;
239
- },
240
- getFormattedValue: function getFormattedValue() {
241
- var _cell$column$columnDe2;
242
- return isDateColumn(cell.column.columnDef) ? formatDate(rawValue, ((_cell$column$columnDe2 = cell.column.columnDef) === null || _cell$column$columnDe2 === void 0 || (_cell$column$columnDe2 = _cell$column$columnDe2.meta) === null || _cell$column$columnDe2 === void 0 ? void 0 : _cell$column$columnDe2.dateFormat) || dateFormat) : rawValue;
243
- },
244
- renderValue: function renderValue() {
245
- return enhancedContext.getFormattedValue();
246
- }
247
- });
248
- var cellClassNames = [columnEditing ? 'tbody-tr-td-editting' : '', columnClassName ? columnClassName.join(' ') : ''].concat(_toConsumableArray((cellClassName === null || cellClassName === void 0 || (_cellClassName = cellClassName(cell)) === null || _cellClassName === void 0 ? void 0 : _cellClassName.map(function (item) {
249
- return "".concat(item, "-").concat(theme);
250
- })) || []), ['tbody-tr-td']).filter(Boolean).join(' ');
251
- return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
252
- className: cellClassNames,
253
- style: _objectSpread(_objectSpread({
254
- height: rowHeight - 1,
255
- width: "".concat(cell.column.getSize(), "px")
256
- }, getPinningStyle(cell, table, false)), {}, {
257
- boxSizing: 'border-box'
258
- }),
259
- onContextMenu: function onContextMenu(e) {
260
- return handleCellRightClick(e, cell);
261
- }
262
- }, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell.getContext())), {}, {
263
- children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
264
- width: cell.column.getSize(),
265
- tableTooltip: tableTooltip,
266
- editing: columnEditing,
267
- dataIndex: accessorKey,
268
- title: header,
269
- onEditValueChange: onEditValueChange,
270
- children: flexRender(cell.column.columnDef.cell, enhancedContext)
271
- }))
272
- }), cell.id);
273
- }, [rowEditing, cellClassName, theme, rowHeight, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat]);
274
-
275
- // 渲染左侧固定列
276
- var renderLeftPinnedCells = useCallback(function () {
277
- return leftPinnedCells.map(function (cell) {
278
- return renderCell(cell);
279
- });
280
- }, [leftPinnedCells, renderCell]);
281
-
282
- // 渲染右侧固定列
283
- var renderRightPinnedCells = useCallback(function () {
284
- return rightPinnedCells.map(function (cell) {
285
- return renderCell(cell);
286
- });
287
- }, [rightPinnedCells, renderCell]);
288
-
289
- // 渲染虚拟滚动列
290
- var renderVirtualScrollCells = useCallback(function () {
291
- if (!config.openVirtualColumns) {
292
- return scrollableCells.map(function (cell) {
293
- return renderCell(cell);
294
- });
295
- }
296
- return /*#__PURE__*/_jsxs(_Fragment, {
297
- children: [virtualPaddingLeft > 0 && /*#__PURE__*/_jsx("td", {
298
- style: {
299
- width: "".concat(virtualPaddingLeft, "px"),
300
- padding: 0,
301
- border: 'none'
302
- }
303
- }, "virtual-padding-left"), virtualColumns.map(function (virtualColumn) {
304
- var cell = scrollableCells[virtualColumn.index];
305
- return cell ? renderCell(cell) : null;
306
- }), virtualPaddingRight > 0 && /*#__PURE__*/_jsx("td", {
307
- style: {
308
- width: "".concat(virtualPaddingRight, "px"),
309
- padding: 0,
310
- border: 'none'
311
- }
312
- }, "virtual-padding-right")]
313
- });
314
- }, [config.openVirtualColumns, virtualColumns, scrollableCells, virtualPaddingLeft, virtualPaddingRight, renderCell]);
315
-
316
186
  // 行样式(支持虚拟行定位)
317
187
  var rowStyles = useMemo(function () {
318
188
  var baseStyle = _objectSpread({
@@ -321,7 +191,7 @@ var VirtualRow = function VirtualRow(_ref) {
321
191
  }, rowStyle);
322
192
 
323
193
  // 如果是虚拟行,添加定位样式
324
- if (config.openVirtualRows && virtualRowStart !== undefined) {
194
+ if (virtualRowStart !== undefined) {
325
195
  return _objectSpread(_objectSpread({}, baseStyle), {}, {
326
196
  position: 'absolute',
327
197
  top: 0,
@@ -331,7 +201,7 @@ var VirtualRow = function VirtualRow(_ref) {
331
201
  });
332
202
  }
333
203
  return baseStyle;
334
- }, [isDragging, selectedRowDragging, row.getIsSelected(), canRowDrag, editting, disableDragRowIds, row.id, rowStyle, config.openVirtualRows, virtualRowStart]);
204
+ }, [isDragging, selectedRowDragging, row.getIsSelected(), canRowDrag, editting, disableDragRowIds, row.id, rowStyle, virtualRowStart]);
335
205
 
336
206
  // 点击事件处理逻辑保持不变
337
207
  var handleRowClick = useCallback(function (evt) {
@@ -417,10 +287,142 @@ var VirtualRow = function VirtualRow(_ref) {
417
287
  }
418
288
  };
419
289
  }, []);
290
+ var rowComMemo = useMemo(function () {
291
+ // 添加数据验证
292
+ if (!(row !== null && row !== void 0 && row.getVisibleCells)) {
293
+ console.warn('Row data not ready');
294
+ return null;
295
+ }
296
+ var renderCell = function renderCell(cell) {
297
+ var _cell$column, _cell$getValue, _cell$getValue2, _cellClassName;
298
+ // 确保 cell.column.columnDef 存在
299
+ if (!(cell !== null && cell !== void 0 && (_cell$column = cell.column) !== null && _cell$column !== void 0 && _cell$column.columnDef)) {
300
+ console.warn('Cell column definition missing', cell);
301
+ return null;
302
+ }
303
+ var _cell$column$columnDe = cell.column.columnDef,
304
+ columnEditable = _cell$column$columnDe.editable,
305
+ accessorKey = _cell$column$columnDe.accessorKey,
306
+ header = _cell$column$columnDe.header,
307
+ columnClassName = _cell$column$columnDe.columnClassName,
308
+ columnId = _cell$column$columnDe.id,
309
+ filterType = _cell$column$columnDe.filterType;
310
+
311
+ // 多重保障确保列ID不为undefined
312
+ var safeColumnId = columnId || accessorKey || (cell === null || cell === void 0 ? void 0 : cell.id) || "cell-".concat(Math.random().toString(36).slice(2, 9));
313
+ var columnEditing = rowEditing && columnEditable;
314
+ var rawValue = (_cell$getValue = (_cell$getValue2 = cell.getValue) === null || _cell$getValue2 === void 0 ? void 0 : _cell$getValue2.call(cell)) !== null && _cell$getValue !== void 0 ? _cell$getValue : '';
315
+
316
+ // 检查必要的函数是否存在
317
+ if (typeof cell.getContext !== 'function') {
318
+ console.warn('cell.getContext is not a function', cell);
319
+ return null;
320
+ }
321
+ var originalContext = cell.getContext();
322
+ var enhancedContext = _objectSpread(_objectSpread({}, originalContext), {}, {
323
+ getValue: function getValue() {
324
+ return rawValue;
325
+ },
326
+ getFormattedValue: function getFormattedValue() {
327
+ var _cell$column$columnDe2;
328
+ return isDateColumn(cell.column.columnDef) ? formatDate(rawValue, ((_cell$column$columnDe2 = cell.column.columnDef) === null || _cell$column$columnDe2 === void 0 || (_cell$column$columnDe2 = _cell$column$columnDe2.meta) === null || _cell$column$columnDe2 === void 0 ? void 0 : _cell$column$columnDe2.dateFormat) || dateFormat) : rawValue;
329
+ },
330
+ renderValue: function renderValue() {
331
+ return enhancedContext.getFormattedValue();
332
+ }
333
+ });
334
+ var cellClassNames = [columnEditing ? 'tbody-tr-td-editting' : '', columnClassName ? columnClassName.join(' ') : ''].concat(_toConsumableArray((cellClassName === null || cellClassName === void 0 || (_cellClassName = cellClassName(cell)) === null || _cellClassName === void 0 ? void 0 : _cellClassName.map(function (item) {
335
+ return "".concat(item, "-").concat(theme);
336
+ })) || []), ['tbody-tr-td']).filter(Boolean).join(' ');
337
+ return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
338
+ className: cellClassNames,
339
+ style: _objectSpread({}, getPinningStyle(cell, table, false)),
340
+ onContextMenu: function onContextMenu(e) {
341
+ return handleCellRightClick(e, cell);
342
+ }
343
+ }, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell.getContext())), {}, {
344
+ children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
345
+ width: cell.column.getSize(),
346
+ tableTooltip: tableTooltip,
347
+ editing: columnEditing,
348
+ dataIndex: accessorKey,
349
+ title: header,
350
+ onEditValueChange: onEditValueChange,
351
+ children: flexRender(cell.column.columnDef.cell, enhancedContext)
352
+ }))
353
+ }), cell.id);
354
+ };
355
+ try {
356
+ var cells = row.getVisibleCells();
357
+ return /*#__PURE__*/_jsx("tr", {
358
+ id: rowEditing ? "".concat(tableId, "-tbody-tr-editing") : undefined,
359
+ ref: function ref(node) {
360
+ dropRef(node && !editting ? node : null);
361
+ dragRef(node && canRowDrag && !editting && !(disableDragRowIds !== null && disableDragRowIds !== void 0 && disableDragRowIds.includes(row.id)) ? node : null);
362
+ },
363
+ style: rowStyles,
364
+ onClick: handleRowClick,
365
+ onMouseEnter: rowMouseEnter,
366
+ onMouseLeave: rowMouseLeave,
367
+ className: rowClassNames,
368
+ children: cells.map(renderCell)
369
+ });
370
+ } catch (error) {
371
+ console.error('Error rendering row:', error);
372
+ return null;
373
+ }
374
+ }, [
375
+ // 依赖项保持不变
376
+ row, row.id, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, cellClassName, theme, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, row.getVisibleCells(), row.getIsSelected(), rowStyles]);
377
+ var rowCom = function rowCom() {
378
+ var renderCell = function renderCell(cell) {
379
+ var _cellClassName2;
380
+ var _cell$column$columnDe3 = cell.column.columnDef,
381
+ columnEditable = _cell$column$columnDe3.editable,
382
+ accessorKey = _cell$column$columnDe3.accessorKey,
383
+ header = _cell$column$columnDe3.header,
384
+ columnClassName = _cell$column$columnDe3.columnClassName,
385
+ id = _cell$column$columnDe3.id,
386
+ filterType = _cell$column$columnDe3.filterType;
387
+ var columnEditing = rowEditing && columnEditable;
388
+ var rawValue = cell.getValue();
420
389
 
421
- // 渲染行的主要内容
422
- var renderRowContent = useCallback(function () {
423
- return /*#__PURE__*/_jsxs("tr", {
390
+ // 创建增强上下文
391
+ var originalContext = cell.getContext();
392
+ var enhancedContext = _objectSpread(_objectSpread({}, originalContext), {}, {
393
+ getValue: function getValue() {
394
+ return rawValue;
395
+ },
396
+ getFormattedValue: function getFormattedValue() {
397
+ var _cell$column$columnDe4;
398
+ return isDateColumn(cell.column.columnDef) ? formatDate(rawValue, ((_cell$column$columnDe4 = cell.column.columnDef) === null || _cell$column$columnDe4 === void 0 || (_cell$column$columnDe4 = _cell$column$columnDe4.meta) === null || _cell$column$columnDe4 === void 0 ? void 0 : _cell$column$columnDe4.dateFormat) || dateFormat) : rawValue;
399
+ },
400
+ renderValue: function renderValue() {
401
+ return enhancedContext.getFormattedValue();
402
+ }
403
+ });
404
+ var cellClassNames = [columnEditing ? 'tbody-tr-td-editting' : '', columnClassName ? columnClassName.join(' ') : ''].concat(_toConsumableArray((cellClassName === null || cellClassName === void 0 || (_cellClassName2 = cellClassName(cell)) === null || _cellClassName2 === void 0 ? void 0 : _cellClassName2.map(function (item) {
405
+ return "".concat(item, "-").concat(theme);
406
+ })) || []), ['tbody-tr-td']).filter(Boolean).join(' ');
407
+ return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
408
+ className: cellClassNames,
409
+ style: _objectSpread({}, getPinningStyle(cell, table, false)),
410
+ onContextMenu: function onContextMenu(e) {
411
+ return handleCellRightClick(e, cell);
412
+ }
413
+ }, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell.getContext())), {}, {
414
+ children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
415
+ width: cell.column.getSize(),
416
+ tableTooltip: tableTooltip,
417
+ editing: columnEditing,
418
+ dataIndex: accessorKey,
419
+ title: header,
420
+ onEditValueChange: onEditValueChange,
421
+ children: flexRender(cell.column.columnDef.cell, enhancedContext)
422
+ }))
423
+ }), cell.id);
424
+ };
425
+ return /*#__PURE__*/_jsx("tr", {
424
426
  id: rowEditing ? "".concat(tableId, "-tbody-tr-editing") : undefined,
425
427
  ref: function ref(node) {
426
428
  dropRef(node && !editting ? node : null);
@@ -431,9 +433,9 @@ var VirtualRow = function VirtualRow(_ref) {
431
433
  onMouseEnter: rowMouseEnter,
432
434
  onMouseLeave: rowMouseLeave,
433
435
  className: rowClassNames,
434
- children: [renderLeftPinnedCells(), renderVirtualScrollCells(), renderRightPinnedCells()]
436
+ children: row.getVisibleCells().map(renderCell)
435
437
  });
436
- }, [rowEditing, tableId, editting, canRowDrag, disableDragRowIds, row.id, rowStyles, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, renderLeftPinnedCells, renderVirtualScrollCells, renderRightPinnedCells, virtualRowStart]);
438
+ };
437
439
  return /*#__PURE__*/_jsxs(_Fragment, {
438
440
  children: [!!getRowHoverTipConfig ? /*#__PURE__*/_jsx(Tooltip, _objectSpread(_objectSpread({}, tooltipConfig), {}, {
439
441
  onOpenChange: onOpenChange,
@@ -444,8 +446,8 @@ var VirtualRow = function VirtualRow(_ref) {
444
446
  getPopupContainer: function getPopupContainer() {
445
447
  return tableBodyRef.current || document.body;
446
448
  },
447
- children: renderRowContent()
448
- })) : renderRowContent(), row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
449
+ children: openMemo ? rowComMemo : rowCom()
450
+ })) : openMemo ? rowComMemo : rowCom(), row.getIsExpanded() && /*#__PURE__*/_jsx("tr", {
449
451
  className: "tbody-tr-subrow",
450
452
  children: /*#__PURE__*/_jsx("td", {
451
453
  colSpan: visibleCells.length,
@@ -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, openVirtualColumns, }: 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 };
@@ -20,11 +20,11 @@ import { createPortal } from 'react-dom';
20
20
  import { useConfig } from "../../ConfigProvider";
21
21
  import Empty from "../../Empty";
22
22
  import { VirtualRow } from "./VirtualRow";
23
+ import { OriginalRow } from "./OriginalRow";
23
24
  import ContextMenu from "./contextMenu/ContextMenu";
24
25
  import "./index.less";
25
26
  import { Total } from "./components/Total";
26
- import { ColGroup } from "../TableHeader/VirtualTableHeader/ColGroup";
27
- import { useVirtualConfig, useVirtualState } from "../hooks/useVirtualScroll";
27
+ import { useVirtualCalculations } from "../hooks/useVirtualCalculations";
28
28
  import { jsx as _jsx } from "react/jsx-runtime";
29
29
  import { jsxs as _jsxs } from "react/jsx-runtime";
30
30
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -77,25 +77,22 @@ var VirtualTableBody = function VirtualTableBody(_ref) {
77
77
  totalDatas = _ref.totalDatas,
78
78
  setRowSelection = _ref.setRowSelection,
79
79
  openMemo = _ref.openMemo,
80
- _ref$openVirtualColum = _ref.openVirtualColumns,
81
- openVirtualColumns = _ref$openVirtualColum === void 0 ? false : _ref$openVirtualColum;
80
+ _ref$openVirtualRows = _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 config = useVirtualConfig();
88
- var state = useVirtualState();
89
- var openVirtualRows = config.openVirtualRows;
88
+ var _useVirtualCalculatio = useVirtualCalculations(table, tableKey, {
89
+ openVirtualRows: openVirtualRows,
90
+ rowHeight: rowHeight
91
+ }, tableBodyRef),
92
+ state = _useVirtualCalculatio.state;
90
93
 
91
94
  // 从 Provider 中获取虚拟化数据
92
- var leftPinnedColumns = state.leftPinnedColumns,
93
- rightPinnedColumns = state.rightPinnedColumns,
94
- scrollableColumns = state.scrollableColumns,
95
- virtualColumns = state.virtualColumns,
96
- virtualPaddingLeft = state.virtualPaddingLeft,
97
- virtualPaddingRight = state.virtualPaddingRight,
98
- rowVirtualizer = state.rowVirtualizer,
95
+ var rowVirtualizer = state.rowVirtualizer,
99
96
  virtualRows = state.virtualRows;
100
97
  var _useState = useState({
101
98
  visible: false,
@@ -273,7 +270,6 @@ var VirtualTableBody = function VirtualTableBody(_ref) {
273
270
  onRowMouseLeave: onRowMouseLeave,
274
271
  onRowMouseClick: onRowMouseClick,
275
272
  onRowMouseDoubleClick: onRowMouseDoubleClick,
276
- rowHeight: rowHeight,
277
273
  disableDragRowIds: disableDragRowIds,
278
274
  selectRowWhenClick: selectRowWhenClick,
279
275
  handleEditRowWhenDClick: handleEditRowWhenDClick,
@@ -304,7 +300,7 @@ var VirtualTableBody = function VirtualTableBody(_ref) {
304
300
  var renderNormalRows = function renderNormalRows() {
305
301
  return table.getRowModel().rows.map(function (row) {
306
302
  var rowEditing = row.id === editingRowId;
307
- return /*#__PURE__*/_jsx(VirtualRow, {
303
+ return /*#__PURE__*/_jsx(OriginalRow, {
308
304
  tableBodyRef: tableBodyRef,
309
305
  table: table,
310
306
  tableId: tableId,
@@ -335,7 +331,6 @@ var VirtualTableBody = function VirtualTableBody(_ref) {
335
331
  onRowMouseLeave: onRowMouseLeave,
336
332
  onRowMouseClick: onRowMouseClick,
337
333
  onRowMouseDoubleClick: onRowMouseDoubleClick,
338
- rowHeight: rowHeight,
339
334
  disableDragRowIds: disableDragRowIds,
340
335
  selectRowWhenClick: selectRowWhenClick,
341
336
  handleEditRowWhenDClick: handleEditRowWhenDClick,
@@ -377,13 +372,14 @@ var VirtualTableBody = function VirtualTableBody(_ref) {
377
372
  // }}
378
373
  ,
379
374
  children: /*#__PURE__*/_jsxs("table", {
380
- children: [/*#__PURE__*/_jsx(ColGroup, {
381
- leftPinnedColumns: leftPinnedColumns,
382
- scrollableColumns: scrollableColumns,
383
- rightPinnedColumns: rightPinnedColumns,
384
- virtualColumns: virtualColumns,
385
- virtualPaddingLeft: virtualPaddingLeft,
386
- virtualPaddingRight: virtualPaddingRight
375
+ children: [/*#__PURE__*/_jsx("colgroup", {
376
+ children: headers.map(function (header) {
377
+ var _header$column;
378
+ var size = (header === null || header === void 0 || (_header$column = header.column) === null || _header$column === void 0 ? void 0 : _header$column.getSize()) || 120;
379
+ return /*#__PURE__*/_jsx("col", {
380
+ width: size
381
+ }, header.id);
382
+ })
387
383
  }), /*#__PURE__*/_jsxs("tbody", {
388
384
  id: "table-max-tableBody-tbody-".concat(tableId),
389
385
  style: {
@@ -393,8 +389,7 @@ var VirtualTableBody = function VirtualTableBody(_ref) {
393
389
  },
394
390
  children: [openVirtualRows ? renderVirtualRows() : renderNormalRows(), hasTotalRow && /*#__PURE__*/_jsx(Total, {
395
391
  table: table,
396
- totalDatas: totalDatas,
397
- rowHeight: rowHeight
392
+ totalDatas: totalDatas
398
393
  })]
399
394
  })]
400
395
  })
@@ -1,6 +1,5 @@
1
1
  import '../../TableBody/index.less';
2
- export declare const Total: ({ table, totalDatas, rowHeight }: {
2
+ export declare const Total: ({ table, totalDatas, }: {
3
3
  table: any;
4
4
  totalDatas: any;
5
- rowHeight: any;
6
5
  }) => import("react/jsx-runtime").JSX.Element;