@arim-aisdc/public-components 2.3.75 → 2.3.76
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/BaseInfo/BaseInfo.d.ts +1 -1
- package/dist/components/TableMax/TableBody/OriginalRow.js +1 -1
- package/dist/components/TableMax/TableBody/VirtualRow.d.ts +1 -1
- package/dist/components/TableMax/TableBody/VirtualRow.js +1 -1
- package/dist/components/TableMax/TableBody/components/Total.js +1 -1
- package/dist/components/TableMax/TableMax.js +13 -5
- package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
- package/dist/components/TableMax/hooks/useColumnWidth.d.ts +2 -1
- package/dist/components/TableMax/hooks/useColumnWidth.js +3 -2
- package/dist/components/TableMax/type.d.ts +2 -0
- package/package.json +1 -1
|
@@ -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 |
|
|
20
|
+
text: string | Element | JSX.Element;
|
|
21
21
|
units?: string;
|
|
22
22
|
width?: string;
|
|
23
23
|
labelWidth?: string;
|
|
@@ -409,7 +409,7 @@ var OriginalRow = function OriginalRow(_ref) {
|
|
|
409
409
|
}
|
|
410
410
|
}, [
|
|
411
411
|
// 依赖项保持不变
|
|
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()]);
|
|
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()]);
|
|
413
413
|
var rowCom = function rowCom() {
|
|
414
414
|
var renderCell = function renderCell(cell) {
|
|
415
415
|
var _cellClassName2;
|
|
@@ -58,5 +58,5 @@ type IRowProps = {
|
|
|
58
58
|
openMemo?: boolean;
|
|
59
59
|
virtualRowStart?: number;
|
|
60
60
|
};
|
|
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;
|
|
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;
|
|
62
62
|
export { VirtualRow };
|
|
@@ -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, table.getState().columnSizing]);
|
|
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, row.getIsExpanded(), table.getExpandedRowModel()]);
|
|
377
377
|
var rowCom = function rowCom() {
|
|
378
378
|
var renderCell = function renderCell(cell) {
|
|
379
379
|
var _cellClassName2;
|
|
@@ -213,7 +213,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
213
213
|
_ref$openVirtualRows = _ref.openVirtualRows,
|
|
214
214
|
openVirtualRows = _ref$openVirtualRows === void 0 ? false : _ref$openVirtualRows,
|
|
215
215
|
openNullValueFilter = _ref.openNullValueFilter,
|
|
216
|
-
openIndexColumn = _ref.openIndexColumn
|
|
216
|
+
openIndexColumn = _ref.openIndexColumn,
|
|
217
|
+
version = _ref.version;
|
|
217
218
|
var tableMaxRef = useRef(null);
|
|
218
219
|
// 表格元素
|
|
219
220
|
var tableContentRef = useRef(null);
|
|
@@ -345,7 +346,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
345
346
|
tableKeyPrefixCls: tableKeyPrefixCls,
|
|
346
347
|
columnVisibleConfig: columnVisibleConfig,
|
|
347
348
|
tableKey: tableKey,
|
|
348
|
-
cacheMaxAge: tableMaxConfig.cacheMaxAge
|
|
349
|
+
cacheMaxAge: tableMaxConfig.cacheMaxAge,
|
|
350
|
+
version: version
|
|
349
351
|
}),
|
|
350
352
|
columnSizing = _useColumnWidth.columnSizing,
|
|
351
353
|
initializeColumnSizing = _useColumnWidth.initializeColumnSizing,
|
|
@@ -523,6 +525,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
523
525
|
var setColumnInfoFromCache = function setColumnInfoFromCache(tableColumns) {
|
|
524
526
|
var _localStorage$getItem, _tableMaxConfig$cache, _cache$columnVisibili, _cache$columnPinning$, _cache$columnPinning, _cache$columnPinning$2, _cache$columnPinning2;
|
|
525
527
|
var cache = JSON.parse((_localStorage$getItem = localStorage.getItem(tableKey)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}');
|
|
528
|
+
if (version && version !== (cache === null || cache === void 0 ? void 0 : cache.version)) return;
|
|
526
529
|
if (cache && cache !== null && cache !== void 0 && cache.editTime && +new Date() - cache.editTime > ((_tableMaxConfig$cache = tableMaxConfig.cacheMaxAge) !== null && _tableMaxConfig$cache !== void 0 ? _tableMaxConfig$cache : CACHE_MAX_AGE)) {
|
|
527
530
|
return;
|
|
528
531
|
}
|
|
@@ -623,16 +626,20 @@ var TableMax = function TableMax(_ref) {
|
|
|
623
626
|
}) === -1) {
|
|
624
627
|
extraColumns.unshift({
|
|
625
628
|
id: ColumnType.Expander,
|
|
626
|
-
header:
|
|
627
|
-
size:
|
|
629
|
+
header: '展开/收起',
|
|
630
|
+
size: 80,
|
|
628
631
|
tooltip: false,
|
|
629
632
|
enableResizing: false,
|
|
630
633
|
cell: function cell(_ref7) {
|
|
631
634
|
var row = _ref7.row;
|
|
635
|
+
console.log(row.getIsExpanded(), '3333');
|
|
632
636
|
return row.getCanExpand() ? /*#__PURE__*/_jsx("div", {
|
|
633
637
|
onClick: function onClick(evt) {
|
|
634
638
|
evt.stopPropagation();
|
|
635
639
|
row.getToggleExpandedHandler()();
|
|
640
|
+
// row.toggleExpanded()
|
|
641
|
+
|
|
642
|
+
console.log(row.getIsExpanded(), table.getExpandedRowModel(), '3333');
|
|
636
643
|
},
|
|
637
644
|
style: {
|
|
638
645
|
cursor: 'pointer'
|
|
@@ -842,7 +849,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
842
849
|
columnSorting: tableState.sorting,
|
|
843
850
|
columnSizing: columnSizing,
|
|
844
851
|
editTime: +new Date(),
|
|
845
|
-
editTimeCh: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
852
|
+
editTimeCh: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
853
|
+
version: version
|
|
846
854
|
}));
|
|
847
855
|
}, [table.getState().columnVisibility, table.getState().columnPinning, table.getState().columnOrder, table.getState().columnFilters, table.getState().sorting, enableFilters, headerRowNum, compactMode, columnSizing]);
|
|
848
856
|
var reorderRow = useCallback(function (fromDatas, toDatas) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { TableMaxColumnType } from "../../type";
|
|
2
|
-
export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
3
|
-
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
4
|
-
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
5
|
-
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
2
|
+
export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
3
|
+
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
4
|
+
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
5
|
+
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
6
6
|
declare const customSortFns: {
|
|
7
|
-
numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
8
|
-
stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
9
|
-
timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
10
|
-
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 |
|
|
7
|
+
numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
8
|
+
stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
9
|
+
timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
10
|
+
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | -1 | 0;
|
|
11
11
|
};
|
|
12
12
|
export default customSortFns;
|
|
13
13
|
export type SortFnType = keyof typeof customSortFns | undefined;
|
|
@@ -7,11 +7,12 @@ interface UseColumnWidthProps {
|
|
|
7
7
|
columnVisibleConfig?: Record<string, boolean>;
|
|
8
8
|
tableKey: string;
|
|
9
9
|
cacheMaxAge?: number;
|
|
10
|
+
version?: string;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* 自定义Hook:表格列宽计算和管理
|
|
13
14
|
*/
|
|
14
|
-
export declare const useColumnWidth: ({ tableContentRef, tableId, tableKeyPrefixCls, columnVisibleConfig, tableKey, cacheMaxAge, }: UseColumnWidthProps) => {
|
|
15
|
+
export declare const useColumnWidth: ({ tableContentRef, tableId, tableKeyPrefixCls, columnVisibleConfig, tableKey, cacheMaxAge, version }: UseColumnWidthProps) => {
|
|
15
16
|
columnSizing: ColumnSizing;
|
|
16
17
|
allColumnCount: number;
|
|
17
18
|
onColumnSizingChange: (updater: any) => void;
|
|
@@ -46,7 +46,8 @@ export var useColumnWidth = function useColumnWidth(_ref) {
|
|
|
46
46
|
columnVisibleConfig = _ref$columnVisibleCon === void 0 ? {} : _ref$columnVisibleCon,
|
|
47
47
|
tableKey = _ref.tableKey,
|
|
48
48
|
_ref$cacheMaxAge = _ref.cacheMaxAge,
|
|
49
|
-
cacheMaxAge = _ref$cacheMaxAge === void 0 ? 1 * 60 * 60 * 1000 : _ref$cacheMaxAge
|
|
49
|
+
cacheMaxAge = _ref$cacheMaxAge === void 0 ? 1 * 60 * 60 * 1000 : _ref$cacheMaxAge,
|
|
50
|
+
version = _ref.version;
|
|
50
51
|
var _useState = useState({
|
|
51
52
|
columnSizing: {},
|
|
52
53
|
allColumnSizing: {},
|
|
@@ -218,7 +219,7 @@ export var useColumnWidth = function useColumnWidth(_ref) {
|
|
|
218
219
|
var visibleColumnsSizeMap = {};
|
|
219
220
|
|
|
220
221
|
// 处理缓存过期或无效的情况
|
|
221
|
-
if (!(cache !== null && cache !== void 0 && cache.editTime) || now - cache.editTime > cacheMaxAge) {
|
|
222
|
+
if (version && version !== (cache === null || cache === void 0 ? void 0 : cache.version) || !(cache !== null && cache !== void 0 && cache.editTime) || now - cache.editTime > cacheMaxAge) {
|
|
222
223
|
Object.keys(initColumnsSizeMap).forEach(function (key) {
|
|
223
224
|
if (columnVisibleConfig[key] !== false) {
|
|
224
225
|
visibleColumnsSizeMap[key] = initColumnsSizeMap[key];
|