@arim-aisdc/public-components 2.3.55 → 2.3.57

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.
@@ -17,7 +17,7 @@ export declare const foramtBaseInfoField: (data: any, dataField: BaseInfoFieldTy
17
17
  value: any;
18
18
  field: string;
19
19
  label?: string;
20
- text: string | Element | JSX.Element;
20
+ text: string | JSX.Element | Element;
21
21
  units?: string;
22
22
  width?: string;
23
23
  labelWidth?: string;
@@ -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) {
@@ -373,7 +373,7 @@ var VirtualRow = function VirtualRow(_ref) {
373
373
  }
374
374
  }, [
375
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]);
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, table.getState().columnSizing]);
377
377
  var rowCom = function rowCom() {
378
378
  var renderCell = function renderCell(cell) {
379
379
  var _cellClassName2;
@@ -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,13 +1,13 @@
1
1
  import { TableMaxColumnType } from "../../type";
2
- export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
3
- export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
4
- export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
5
- export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
2
+ export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
3
+ export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
4
+ export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
5
+ export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
6
6
  declare const customSortFns: {
7
- numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
8
- stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
9
- timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
10
- numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
7
+ numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
8
+ stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
9
+ timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
10
+ numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
11
11
  };
12
12
  export default customSortFns;
13
13
  export type SortFnType = keyof typeof customSortFns | undefined;
@@ -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: import("@tanstack/virtual-core").VirtualItem[];
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
- export var useVirtualCalculations = function useVirtualCalculations(table, config, tableBodyRef) {
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, tableBodyRef.current]);
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
- var virtualRows = config.openVirtualRows ? (rowVirtualizer === null || rowVirtualizer === void 0 ? void 0 : rowVirtualizer.getVirtualItems()) || [] : [];
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,
@@ -106,6 +106,11 @@
106
106
  padding:var(--cell-padding)!important;
107
107
  display: flex;
108
108
  align-items: center;
109
+ .ellipsis {
110
+ overflow: hidden;
111
+ text-overflow: ellipsis;
112
+ white-space: nowrap;
113
+ }
109
114
  }
110
115
  }
111
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "2.3.55",
3
+ "version": "2.3.57",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",