@arim-aisdc/public-components 2.3.98 → 2.3.99
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/TableMax/TableBody/OriginalRow.js +22 -6
- package/dist/components/TableMax/TableBody/VirtualRow.js +21 -5
- package/dist/components/TableMax/TableHeader/Cell.js +1 -1
- package/dist/components/TableMax/TableMax.d.ts +1 -1
- package/dist/components/TableMax/TableMax.js +1 -1
- package/dist/components/TableMax/components/ColumnEdit/index.d.ts +3 -0
- package/dist/components/TableMax/components/ColumnEdit/index.js +16 -4
- package/dist/components/TableMax/components/ColumnSetting/index.js +1 -1
- package/dist/components/TableMax/components/Export/useTableExport.d.ts +1 -1
- package/dist/components/TableMax/components/Export/useTableExport.js +2 -2
- package/dist/components/TableMax/index.d.ts +1 -2
- package/dist/components/TableMax/index.js +3 -1
- package/package.json +1 -1
|
@@ -79,7 +79,16 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
79
79
|
dateFormat = _useConfig.dateFormat;
|
|
80
80
|
var timerRef = useRef();
|
|
81
81
|
var clickCountRef = useRef(0);
|
|
82
|
-
|
|
82
|
+
// const [tooltipOpen, setTooltipOpen] = useState(false);
|
|
83
|
+
var _useState = useState({}),
|
|
84
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
85
|
+
tooltipStates = _useState2[0],
|
|
86
|
+
setTooltipStates = _useState2[1];
|
|
87
|
+
var handleTooltipChange = function handleTooltipChange(cellId, open) {
|
|
88
|
+
setTooltipStates(function (prev) {
|
|
89
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, cellId, open));
|
|
90
|
+
});
|
|
91
|
+
};
|
|
83
92
|
// 优化:使用useMemo缓存计算结果
|
|
84
93
|
var dropPreviewLineClassName = useMemo(function () {
|
|
85
94
|
if (hoverRowIndex === row.index) {
|
|
@@ -177,6 +186,7 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
177
186
|
// 优化:分离单击和双击逻辑,避免定时器延迟
|
|
178
187
|
var handleRowClick = useCallback(function (evt) {
|
|
179
188
|
clickCountRef.current++;
|
|
189
|
+
setTooltipStates({});
|
|
180
190
|
if (clickCountRef.current === 1) {
|
|
181
191
|
timerRef.current = setTimeout(function () {
|
|
182
192
|
// 单击逻辑
|
|
@@ -297,13 +307,13 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
297
307
|
var handleCellRightClick = useCallback(function (e, cell) {
|
|
298
308
|
onCellContextMenu(e, cell);
|
|
299
309
|
}, [onCellContextMenu]);
|
|
300
|
-
var
|
|
310
|
+
var _useState3 = useState({
|
|
301
311
|
title: ' ',
|
|
302
312
|
color: ''
|
|
303
313
|
}),
|
|
304
|
-
|
|
305
|
-
tooltipConfig =
|
|
306
|
-
setTooltipConfig =
|
|
314
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
315
|
+
tooltipConfig = _useState4[0],
|
|
316
|
+
setTooltipConfig = _useState4[1];
|
|
307
317
|
var onOpenChange = useCallback(function (open) {
|
|
308
318
|
if (open) {
|
|
309
319
|
setTooltipConfig((getRowHoverTipConfig === null || getRowHoverTipConfig === void 0 ? void 0 : getRowHoverTipConfig(row.original)) || {
|
|
@@ -377,6 +387,9 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
377
387
|
}, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell.getContext())), {}, {
|
|
378
388
|
children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
|
|
379
389
|
tableTooltip: tableTooltip,
|
|
390
|
+
cellId: cell.id,
|
|
391
|
+
tooltipOpen: tooltipStates[cell.id] || false,
|
|
392
|
+
onTooltipChange: handleTooltipChange,
|
|
380
393
|
editing: columnEditing,
|
|
381
394
|
dataIndex: accessorKey,
|
|
382
395
|
title: header,
|
|
@@ -409,7 +422,7 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
409
422
|
}
|
|
410
423
|
}, [
|
|
411
424
|
// 依赖项保持不变
|
|
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(), row.getIsExpanded()]);
|
|
425
|
+
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(), row.getIsExpanded(), tooltipStates]);
|
|
413
426
|
var rowCom = function rowCom() {
|
|
414
427
|
var renderCell = function renderCell(cell) {
|
|
415
428
|
var _cellClassName2;
|
|
@@ -449,6 +462,9 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
449
462
|
}, getCellProps === null || getCellProps === void 0 ? void 0 : getCellProps(cell.getContext())), {}, {
|
|
450
463
|
children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
|
|
451
464
|
tableTooltip: tableTooltip,
|
|
465
|
+
cellId: cell.id,
|
|
466
|
+
tooltipOpen: tooltipStates[cell.id] || false,
|
|
467
|
+
onTooltipChange: handleTooltipChange,
|
|
452
468
|
editing: columnEditing,
|
|
453
469
|
dataIndex: accessorKey,
|
|
454
470
|
title: header,
|
|
@@ -80,6 +80,15 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
80
80
|
dateFormat = _useConfig.dateFormat;
|
|
81
81
|
var timerRef = useRef();
|
|
82
82
|
var clickCountRef = useRef(0);
|
|
83
|
+
var _useState = useState({}),
|
|
84
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
85
|
+
tooltipStates = _useState2[0],
|
|
86
|
+
setTooltipStates = _useState2[1];
|
|
87
|
+
var handleTooltipChange = function handleTooltipChange(cellId, open) {
|
|
88
|
+
setTooltipStates(function (prev) {
|
|
89
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, cellId, open));
|
|
90
|
+
});
|
|
91
|
+
};
|
|
83
92
|
|
|
84
93
|
// 拖拽时的鼠标位置跟踪
|
|
85
94
|
var dragStartPosRef = useRef(null);
|
|
@@ -227,6 +236,7 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
227
236
|
// 点击事件处理逻辑
|
|
228
237
|
var handleRowClick = useCallback(function (evt) {
|
|
229
238
|
clickCountRef.current++;
|
|
239
|
+
setTooltipStates({});
|
|
230
240
|
if (clickCountRef.current === 1) {
|
|
231
241
|
timerRef.current = setTimeout(function () {
|
|
232
242
|
if (clickCountRef.current === 1) {
|
|
@@ -344,13 +354,13 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
344
354
|
var rowMouseLeave = useCallback(function () {
|
|
345
355
|
onRowMouseLeave === null || onRowMouseLeave === void 0 || onRowMouseLeave(row);
|
|
346
356
|
}, [row, onRowMouseLeave]);
|
|
347
|
-
var
|
|
357
|
+
var _useState3 = useState({
|
|
348
358
|
title: ' ',
|
|
349
359
|
color: ''
|
|
350
360
|
}),
|
|
351
|
-
|
|
352
|
-
tooltipConfig =
|
|
353
|
-
setTooltipConfig =
|
|
361
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
362
|
+
tooltipConfig = _useState4[0],
|
|
363
|
+
setTooltipConfig = _useState4[1];
|
|
354
364
|
var onOpenChange = useCallback(function (open) {
|
|
355
365
|
if (open) {
|
|
356
366
|
setTooltipConfig((getRowHoverTipConfig === null || getRowHoverTipConfig === void 0 ? void 0 : getRowHoverTipConfig(row.original)) || {
|
|
@@ -425,6 +435,9 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
425
435
|
children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
|
|
426
436
|
width: cell.column.getSize(),
|
|
427
437
|
tableTooltip: tableTooltip,
|
|
438
|
+
cellId: cell.id,
|
|
439
|
+
tooltipOpen: tooltipStates[cell.id] || false,
|
|
440
|
+
onTooltipChange: handleTooltipChange,
|
|
428
441
|
editing: columnEditing,
|
|
429
442
|
dataIndex: accessorKey,
|
|
430
443
|
title: header,
|
|
@@ -452,7 +465,7 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
452
465
|
console.error('Error rendering row:', error);
|
|
453
466
|
return null;
|
|
454
467
|
}
|
|
455
|
-
}, [row, row.id, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, cellClassName, theme, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, rowStyles, row.getVisibleCells(), row.getIsSelected(), row.getIsExpanded(), table.getState().columnSizing]);
|
|
468
|
+
}, [row, row.id, rowEditing, tableId, editting, canRowDrag, disableDragRowIds, isDragging, selectedRowDragging, rowStyle, handleRowClick, rowMouseEnter, rowMouseLeave, rowClassNames, cellClassName, theme, table, handleCellRightClick, getCellProps, tableTooltip, onEditValueChange, dateFormat, rowStyles, row.getVisibleCells(), row.getIsSelected(), row.getIsExpanded(), table.getState().columnSizing, tooltipStates, handleTooltipChange]);
|
|
456
469
|
var rowCom = function rowCom() {
|
|
457
470
|
var renderCell = function renderCell(cell) {
|
|
458
471
|
var _cellClassName2;
|
|
@@ -493,6 +506,9 @@ var VirtualRow = function VirtualRow(_ref) {
|
|
|
493
506
|
children: EditableCell(_objectSpread(_objectSpread({}, cell.column.columnDef), {}, {
|
|
494
507
|
width: cell.column.getSize(),
|
|
495
508
|
tableTooltip: tableTooltip,
|
|
509
|
+
cellId: cell.id,
|
|
510
|
+
tooltipOpen: tooltipStates[cell.id] || false,
|
|
511
|
+
onTooltipChange: handleTooltipChange,
|
|
496
512
|
editing: columnEditing,
|
|
497
513
|
dataIndex: accessorKey,
|
|
498
514
|
title: header,
|
|
@@ -20,7 +20,7 @@ import { Tooltip } from 'antd';
|
|
|
20
20
|
import { useMemo } from 'react';
|
|
21
21
|
import { useDrag, useDrop } from 'react-dnd';
|
|
22
22
|
import { useConfig } from "../../ConfigProvider";
|
|
23
|
-
import { ColumnType } from "../
|
|
23
|
+
import { ColumnType } from "../index";
|
|
24
24
|
import { ColumnFilter } from "../components/ColumnFilterV2";
|
|
25
25
|
import Sort from "../components/ColumnSort";
|
|
26
26
|
import "./index.less";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './tableMax.less';
|
|
3
|
-
import { type TableMaxProps } from './
|
|
3
|
+
import { type TableMaxProps } from './index';
|
|
4
4
|
export type ColumnSizing = Record<string, number>;
|
|
5
5
|
export declare const CACHE_MAX_AGE: number;
|
|
6
6
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<TableMaxProps & React.RefAttributes<unknown>>>;
|
|
@@ -35,7 +35,7 @@ import customSortFns, { setDefaultSortFn } from "./components/ColumnSort/customS
|
|
|
35
35
|
import PaginationV2 from "./components/PaginationV2";
|
|
36
36
|
import { useColumnWidth } from "./hooks/useColumnWidth";
|
|
37
37
|
import "./tableMax.less";
|
|
38
|
-
import { ColumnType } from "./
|
|
38
|
+
import { ColumnType } from "./index";
|
|
39
39
|
import { downloadExcel, getFormatFilters, getFormatFiltersV2, getFormatSorting, operationColumnNoTooltips } from "./utils";
|
|
40
40
|
import { useTableScrollShadow } from "./hooks/useTableScrollShadow";
|
|
41
41
|
import { ExportTableData } from "./components/Export";
|
|
@@ -30,6 +30,9 @@ interface EditableCellProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
30
30
|
editComDisabled?: boolean;
|
|
31
31
|
onEditValueChange?: (field: string, value: any, extra?: any) => void;
|
|
32
32
|
width?: number;
|
|
33
|
+
tooltipOpen?: boolean;
|
|
34
|
+
onTooltipChange?: (cellId: string, open: boolean) => void;
|
|
35
|
+
cellId?: string;
|
|
33
36
|
}
|
|
34
37
|
export declare const EditableCell: React.FC<EditableCellProps>;
|
|
35
38
|
export {};
|
|
@@ -32,7 +32,14 @@ export var EditableCell = function EditableCell(_ref) {
|
|
|
32
32
|
_ref$editComDisabled = _ref.editComDisabled,
|
|
33
33
|
editComDisabled = _ref$editComDisabled === void 0 ? false : _ref$editComDisabled,
|
|
34
34
|
onEditValueChange = _ref.onEditValueChange,
|
|
35
|
-
width = _ref.width
|
|
35
|
+
width = _ref.width,
|
|
36
|
+
tooltipOpen = _ref.tooltipOpen,
|
|
37
|
+
onTooltipChange = _ref.onTooltipChange,
|
|
38
|
+
cellId = _ref.cellId;
|
|
39
|
+
// const [tooltipOpen, setTooltipOpen] = useState(false);
|
|
40
|
+
// const handleClick = () => {
|
|
41
|
+
// setTooltipOpen(false); // 点击时关闭 tooltip
|
|
42
|
+
// };
|
|
36
43
|
var getEditComponent = function getEditComponent(dataIndex) {
|
|
37
44
|
switch (editComType) {
|
|
38
45
|
case InputType.InputNumber:
|
|
@@ -122,9 +129,14 @@ export var EditableCell = function EditableCell(_ref) {
|
|
|
122
129
|
}) : ((_ref2 = ellipsis !== null && ellipsis !== void 0 ? ellipsis : columnTooltip) !== null && _ref2 !== void 0 ? _ref2 : tableTooltip) ? /*#__PURE__*/_jsx(Tooltip, {
|
|
123
130
|
placement: "top",
|
|
124
131
|
title: children,
|
|
125
|
-
mouseEnterDelay: 0.5
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
mouseEnterDelay: 0.5,
|
|
133
|
+
open: tooltipOpen,
|
|
134
|
+
onOpenChange: function onOpenChange(open) {
|
|
135
|
+
return onTooltipChange(cellId, open);
|
|
136
|
+
},
|
|
137
|
+
getPopupContainer: function getPopupContainer() {
|
|
138
|
+
return document.body;
|
|
139
|
+
},
|
|
128
140
|
overlayClassName: "tableMaxCellTooltip",
|
|
129
141
|
children: /*#__PURE__*/_jsx("div", {
|
|
130
142
|
className: "ellipsis",
|
|
@@ -14,7 +14,7 @@ import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 're
|
|
|
14
14
|
import { useDrag, useDrop } from 'react-dnd';
|
|
15
15
|
import { createPortal } from 'react-dom';
|
|
16
16
|
import { useConfig } from "../../../ConfigProvider";
|
|
17
|
-
import { ColumnType } from "../../
|
|
17
|
+
import { ColumnType } from "../../index";
|
|
18
18
|
import "./index.less";
|
|
19
19
|
import { useTranslation } from "../../../../hooks/useTranslation";
|
|
20
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -16,7 +16,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
16
16
|
import { useCallback, useState, useRef } from 'react';
|
|
17
17
|
import * as XLSX from 'xlsx';
|
|
18
18
|
import { message } from 'antd';
|
|
19
|
-
import { ColumnType } from "../../
|
|
19
|
+
import { ColumnType } from "../../index";
|
|
20
20
|
var defaultApplyCellLogic = function defaultApplyCellLogic(value, columnId, originalRow, column) {
|
|
21
21
|
var cell = column.cell,
|
|
22
22
|
accessorKey = column.accessorKey,
|
|
@@ -58,7 +58,6 @@ var defaultApplyCellLogic = function defaultApplyCellLogic(value, columnId, orig
|
|
|
58
58
|
}
|
|
59
59
|
return value !== null && value !== void 0 ? value : '';
|
|
60
60
|
};
|
|
61
|
-
var EnableExportColumnTypeList = [ColumnType.Selection, ColumnType.Darg, ColumnType.PlaceHolder, ColumnType.Expander, ColumnType.Index];
|
|
62
61
|
function fetchWithRetry(_x) {
|
|
63
62
|
return _fetchWithRetry.apply(this, arguments);
|
|
64
63
|
}
|
|
@@ -136,6 +135,7 @@ function _fetchWithRetry() {
|
|
|
136
135
|
return _fetchWithRetry.apply(this, arguments);
|
|
137
136
|
}
|
|
138
137
|
export var useTableExport = function useTableExport() {
|
|
138
|
+
var EnableExportColumnTypeList = [ColumnType.Selection, ColumnType.Darg, ColumnType.PlaceHolder, ColumnType.Expander, ColumnType.Index];
|
|
139
139
|
var _useState = useState(false),
|
|
140
140
|
_useState2 = _slicedToArray(_useState, 2),
|
|
141
141
|
exporting = _useState2[0],
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import TableMax from './TableMax';
|
|
2
|
-
export { ColumnType } from './type';
|
|
3
2
|
export { InputType } from './components/ColumnEdit';
|
|
4
3
|
export { FilterType } from './components/ColumnFilterV2';
|
|
5
4
|
export type { FilterFnType } from './components/ColumnFilterV2';
|
|
6
5
|
export type { SortFnType } from './components/ColumnSort/customSortFns';
|
|
7
|
-
export type
|
|
6
|
+
export { type ColumnPinningConfigType, type ColumnVisibleConfigType, type TableMaxColumnType, type TableMaxProps, ColumnType } from './type';
|
|
8
7
|
export default TableMax;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import TableMax from "./TableMax";
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
// export { ColumnType } from './type';
|
|
3
4
|
export { InputType } from "./components/ColumnEdit";
|
|
4
5
|
export { FilterType } from "./components/ColumnFilterV2";
|
|
6
|
+
export { ColumnType } from "./type";
|
|
5
7
|
export default TableMax;
|