@arim-aisdc/public-components 2.3.26 → 2.3.28
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/CenterModal/CenterModal.js +1 -1
- package/dist/components/TableMax/TableBody/Row.d.ts +2 -2
- package/dist/components/TableMax/TableBody/Row.js +1 -1
- package/dist/components/TableMax/TableBody/index.d.ts +3 -4
- package/dist/components/TableMax/TableBody/index.js +8 -6
- package/dist/components/TableMax/TableMax.d.ts +1 -7
- package/dist/components/TableMax/TableMax.js +55 -26
- package/dist/components/TableMax/components/ColumnEdit/index.js +3 -3
- package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
- package/dist/components/TableMax/tableMax.less +43 -41
- package/dist/components/TableMax/utils.js +22 -20
- package/package.json +1 -1
|
@@ -194,7 +194,7 @@ var CenterModal = function CenterModal(_ref) {
|
|
|
194
194
|
onCancel: handleCancel,
|
|
195
195
|
okText: okText,
|
|
196
196
|
footer: hasfooter ? footer : null,
|
|
197
|
-
centered:
|
|
197
|
+
centered: true,
|
|
198
198
|
closeIcon: /*#__PURE__*/_jsx("i", {
|
|
199
199
|
className: "iconfont-other icon-other-close",
|
|
200
200
|
children: " "
|
|
@@ -60,5 +60,5 @@ type IRowProps = {
|
|
|
60
60
|
dropSide: DropSide;
|
|
61
61
|
onEditValueChange?: (field: string, value: any, extra?: any) => void;
|
|
62
62
|
};
|
|
63
|
-
declare const
|
|
64
|
-
export default
|
|
63
|
+
declare const _default: React.MemoExoticComponent<({ 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, shadowColumnInfo, onCellContextMenu, getRowHoverTipConfig, tableTooltip, changeHoverRow, clearHoverRowIndex, hoverRowIndex, dropSide, onEditValueChange, }: IRowProps) => import("react/jsx-runtime").JSX.Element>;
|
|
64
|
+
export default _default;
|
|
@@ -413,7 +413,7 @@ var Row = function Row(_ref) {
|
|
|
413
413
|
})]
|
|
414
414
|
});
|
|
415
415
|
};
|
|
416
|
-
export default Row;
|
|
416
|
+
export default /*#__PURE__*/React.memo(Row);
|
|
417
417
|
function formatDate(dateValue) {
|
|
418
418
|
var pattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "YYYY-MM-DD HH:mm";
|
|
419
419
|
if (!dateValue) return '';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Table } from '@tanstack/react-table';
|
|
2
2
|
import { IMenuOptionsType, OnSelectChangeType } from "../type";
|
|
3
|
-
import { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react';
|
|
3
|
+
import React, { Dispatch, MutableRefObject, ReactNode, SetStateAction } from 'react';
|
|
4
4
|
import './index.less';
|
|
5
5
|
type TableBodyPropsType = {
|
|
6
6
|
tableBodyRef: MutableRefObject<HTMLDivElement> | null;
|
|
@@ -74,6 +74,5 @@ type TableBodyPropsType = {
|
|
|
74
74
|
hasTotalRow?: boolean;
|
|
75
75
|
totalDatas?: any[];
|
|
76
76
|
};
|
|
77
|
-
declare const
|
|
78
|
-
export default
|
|
79
|
-
export declare const MemoizedTableBody: ({ 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, shadowColumnInfo, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, compactMode, onEditValueChange, hasTotalRow, totalDatas }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
declare const _default: React.MemoExoticComponent<({ 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, shadowColumnInfo, getContextMenu, onClickContextMenu, getRowHoverTipConfig, tableTooltip, compactMode, onEditValueChange, hasTotalRow, totalDatas }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element>;
|
|
78
|
+
export default _default;
|
|
@@ -154,7 +154,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
154
154
|
}, [hoverRowIndex, dropSide]);
|
|
155
155
|
|
|
156
156
|
// cell右键菜单
|
|
157
|
-
var handleCellContextMenu = function
|
|
157
|
+
var handleCellContextMenu = useCallback(function (e, cell) {
|
|
158
158
|
// console.log('cell :>> ', cell);
|
|
159
159
|
if (getContextMenu) {
|
|
160
160
|
var options = getContextMenu({
|
|
@@ -171,7 +171,7 @@ var TableBody = function TableBody(_ref) {
|
|
|
171
171
|
});
|
|
172
172
|
e.preventDefault();
|
|
173
173
|
}
|
|
174
|
-
};
|
|
174
|
+
}, [getContextMenu]);
|
|
175
175
|
|
|
176
176
|
// 关闭菜单
|
|
177
177
|
var closeContextMenu = useCallback(function () {
|
|
@@ -431,7 +431,9 @@ var TableBody = function TableBody(_ref) {
|
|
|
431
431
|
})
|
|
432
432
|
);
|
|
433
433
|
};
|
|
434
|
-
export default TableBody;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
434
|
+
export default /*#__PURE__*/React.memo(TableBody);
|
|
435
|
+
|
|
436
|
+
// export const MemoizedTableBody = React.memo(
|
|
437
|
+
// TableBody,
|
|
438
|
+
// (prev, next) => prev.table.options.data === next.table.options.data
|
|
439
|
+
// ) as typeof TableBody
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import { RowData } from '@tanstack/react-table';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import './tableMax.less';
|
|
4
3
|
import { type TableMaxProps } from './type';
|
|
5
|
-
declare module '@tanstack/react-table' {
|
|
6
|
-
interface TableMeta<TData extends RowData> {
|
|
7
|
-
updateData: (rowIndex: number, columnId: string, value: unknown) => void;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
4
|
export declare enum ColumnType {
|
|
11
5
|
Selection = "selection-column",
|
|
12
6
|
Darg = "darg-column",
|
|
@@ -15,5 +9,5 @@ export declare enum ColumnType {
|
|
|
15
9
|
}
|
|
16
10
|
export type ColumnSizing = Record<string, number>;
|
|
17
11
|
export declare const CACHE_MAX_AGE: number;
|
|
18
|
-
declare const _default: React.ForwardRefExoticComponent<TableMaxProps & React.RefAttributes<unknown
|
|
12
|
+
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<TableMaxProps & React.RefAttributes<unknown>>>;
|
|
19
13
|
export default _default;
|
|
@@ -25,8 +25,9 @@ import { Button, Checkbox, Form, Pagination, Upload } from 'antd';
|
|
|
25
25
|
import dayjs from 'dayjs';
|
|
26
26
|
import { cloneDeep, debounce } from 'lodash';
|
|
27
27
|
import React, { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
28
|
+
import { useTranslation } from "../../hooks/useTranslation";
|
|
28
29
|
import { useConfig } from "../ConfigProvider";
|
|
29
|
-
import TableBody
|
|
30
|
+
import TableBody from "./TableBody";
|
|
30
31
|
import TableHeader from "./TableHeader";
|
|
31
32
|
import { InputType } from "./components/ColumnEdit";
|
|
32
33
|
import { setDefaultFilterFn } from "./components/ColumnFilterV2";
|
|
@@ -37,7 +38,6 @@ import PaginationV2 from "./components/PaginationV2";
|
|
|
37
38
|
import { useColumnWidth } from "./hooks/useColumnWidth";
|
|
38
39
|
import "./tableMax.less";
|
|
39
40
|
import { downloadExcel, getFormatFilters, getFormatFiltersV2, getFormatSorting, operationColumnNoTooltips } from "./utils";
|
|
40
|
-
import { useTranslation } from "../../hooks/useTranslation";
|
|
41
41
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
42
42
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
43
43
|
export var ColumnType = /*#__PURE__*/function (ColumnType) {
|
|
@@ -47,29 +47,34 @@ export var ColumnType = /*#__PURE__*/function (ColumnType) {
|
|
|
47
47
|
ColumnType["Expander"] = "expander";
|
|
48
48
|
return ColumnType;
|
|
49
49
|
}({});
|
|
50
|
-
// export const TableContext = createContext<TableContextType>({} as TableContextType);
|
|
51
|
-
|
|
52
50
|
export var CACHE_MAX_AGE = 1 * 60 * 60 * 1000;
|
|
53
51
|
var getCurrentRouterName = function getCurrentRouterName() {
|
|
54
52
|
return window.location.pathname.slice(1);
|
|
55
53
|
};
|
|
54
|
+
|
|
55
|
+
/**将空默认值提升为组件外部的常量,避免引发不必要的渲染 */
|
|
56
|
+
var defaultData = [];
|
|
57
|
+
var defaultColumnVisibleConfig = {};
|
|
58
|
+
var defaultColumnPinningConfig = {
|
|
59
|
+
left: [],
|
|
60
|
+
right: []
|
|
61
|
+
};
|
|
62
|
+
var initSelectedRowIds = [];
|
|
63
|
+
var initColumnFilters = [];
|
|
56
64
|
var TableMax = function TableMax(_ref) {
|
|
57
65
|
var _JSON$parse, _tableContentRef$curr;
|
|
58
66
|
var tableId = _ref.tableId,
|
|
59
67
|
originColumns = _ref.columns,
|
|
60
68
|
_ref$datas = _ref.datas,
|
|
61
|
-
datas = _ref$datas === void 0 ?
|
|
69
|
+
datas = _ref$datas === void 0 ? defaultData : _ref$datas,
|
|
62
70
|
totalCount = _ref.totalCount,
|
|
63
71
|
_ref$columnVisibleCon = _ref.columnVisibleConfig,
|
|
64
|
-
columnVisibleConfig = _ref$columnVisibleCon === void 0 ?
|
|
72
|
+
columnVisibleConfig = _ref$columnVisibleCon === void 0 ? defaultColumnVisibleConfig : _ref$columnVisibleCon,
|
|
65
73
|
_ref$columnPinningCon = _ref.columnPinningConfig,
|
|
66
|
-
columnPinningConfig = _ref$columnPinningCon === void 0 ?
|
|
67
|
-
left: [],
|
|
68
|
-
right: []
|
|
69
|
-
} : _ref$columnPinningCon,
|
|
74
|
+
columnPinningConfig = _ref$columnPinningCon === void 0 ? defaultColumnPinningConfig : _ref$columnPinningCon,
|
|
70
75
|
defaultSelectedRowId = _ref.defaultSelectedRowId,
|
|
71
76
|
_ref$defaultSelectedR = _ref.defaultSelectedRowIds,
|
|
72
|
-
defaultSelectedRowIds = _ref$defaultSelectedR === void 0 ?
|
|
77
|
+
defaultSelectedRowIds = _ref$defaultSelectedR === void 0 ? initSelectedRowIds : _ref$defaultSelectedR,
|
|
73
78
|
selectedRowChange = _ref.selectedRowChange,
|
|
74
79
|
onSelectChange = _ref.onSelectChange,
|
|
75
80
|
rowSelectionChange = _ref.rowSelectionChange,
|
|
@@ -142,7 +147,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
142
147
|
_ref$rowHeight = _ref.rowHeight,
|
|
143
148
|
rowHeight = _ref$rowHeight === void 0 ? 42 : _ref$rowHeight,
|
|
144
149
|
_ref$defaultColumnFil = _ref.defaultColumnFilters,
|
|
145
|
-
defaultColumnFilters = _ref$defaultColumnFil === void 0 ?
|
|
150
|
+
defaultColumnFilters = _ref$defaultColumnFil === void 0 ? initColumnFilters : _ref$defaultColumnFil,
|
|
146
151
|
getColumnFiltersData = _ref.getColumnFiltersData,
|
|
147
152
|
saveEditing = _ref.saveEditing,
|
|
148
153
|
_ref$getRowCanExpand = _ref.getRowCanExpand,
|
|
@@ -207,9 +212,16 @@ var TableMax = function TableMax(_ref) {
|
|
|
207
212
|
tableKeyPrefixCls = _useConfig.tableKeyPrefixCls,
|
|
208
213
|
tableMaxNewPagination = _useConfig.tableMaxNewPagination,
|
|
209
214
|
tableMax = _useConfig.tableMax;
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
215
|
+
var tableMaxConfig = useMemo(function () {
|
|
216
|
+
var _ref2 = tableMax || {},
|
|
217
|
+
globalPageSizeOptions = _ref2.pageSizeOptions,
|
|
218
|
+
cacheMaxAge = _ref2.cacheMaxAge;
|
|
219
|
+
return {
|
|
220
|
+
globalPageSizeOptions: globalPageSizeOptions,
|
|
221
|
+
cacheMaxAge: cacheMaxAge
|
|
222
|
+
};
|
|
223
|
+
}, [JSON.stringify(tableMax)]);
|
|
224
|
+
|
|
213
225
|
// 多选场景下,点击行时是否选中改行。在不展示多选框(selectionWithoutChecked=true)时,会一直为true
|
|
214
226
|
var selectRowWhenClick = useMemo(function () {
|
|
215
227
|
return originSelectRowWhenClick || selectionWithoutChecked;
|
|
@@ -299,7 +311,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
299
311
|
tableKeyPrefixCls: tableKeyPrefixCls,
|
|
300
312
|
columnVisibleConfig: columnVisibleConfig,
|
|
301
313
|
tableKey: tableKey,
|
|
302
|
-
cacheMaxAge: cacheMaxAge
|
|
314
|
+
cacheMaxAge: tableMaxConfig.cacheMaxAge
|
|
303
315
|
}),
|
|
304
316
|
columnSizing = _useColumnWidth.columnSizing,
|
|
305
317
|
initializeColumnSizing = _useColumnWidth.initializeColumnSizing,
|
|
@@ -482,10 +494,10 @@ var TableMax = function TableMax(_ref) {
|
|
|
482
494
|
|
|
483
495
|
/**根据缓存数据设置一些状态 */
|
|
484
496
|
var setColumnInfoFromCache = function setColumnInfoFromCache(tableColumns) {
|
|
485
|
-
var _localStorage$getItem;
|
|
497
|
+
var _localStorage$getItem, _tableMaxConfig$cache;
|
|
486
498
|
var cache = JSON.parse((_localStorage$getItem = localStorage.getItem(tableKey)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}');
|
|
487
499
|
console.log(+cache.editTime, 'cache.editTime');
|
|
488
|
-
if (cache && cache !== null && cache !== void 0 && cache.editTime && +new Date() - cache.editTime > (cacheMaxAge !== null &&
|
|
500
|
+
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)) {
|
|
489
501
|
return;
|
|
490
502
|
}
|
|
491
503
|
var cacheColumnVisibility = cache.columnVisibility,
|
|
@@ -507,7 +519,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
507
519
|
var tableColumnIds = tableColumns === null || tableColumns === void 0 ? void 0 : tableColumns.map(function (column) {
|
|
508
520
|
return column.id;
|
|
509
521
|
});
|
|
510
|
-
if (cacheColumnFilters) {
|
|
522
|
+
if ((cacheColumnFilters === null || cacheColumnFilters === void 0 ? void 0 : cacheColumnFilters.length) > 0) {
|
|
511
523
|
var newColumnFilters = (cacheColumnFilters === null || cacheColumnFilters === void 0 ? void 0 : cacheColumnFilters.filter(function (item) {
|
|
512
524
|
return tableColumnIds.includes(item.id);
|
|
513
525
|
})) || [];
|
|
@@ -666,6 +678,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
666
678
|
|
|
667
679
|
// 筛选回调
|
|
668
680
|
useEffect(function () {
|
|
681
|
+
if ((columns === null || columns === void 0 ? void 0 : columns.length) === 0) return;
|
|
669
682
|
// console.log('columnFilters :>> ', tableId, columnFilters);
|
|
670
683
|
var filteredRowModel = table.getRowModel();
|
|
671
684
|
var filteredData = filteredRowModel.rows.map(function (item) {
|
|
@@ -685,7 +698,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
685
698
|
formatFiltersV2: getFormatFiltersV2(columns, columnFilters) // 动态化查询格式:https://arim-jyzx.coding.net/p/infra/wiki/3252
|
|
686
699
|
});
|
|
687
700
|
}
|
|
688
|
-
}, [JSON.stringify(columnFilters), manualFiltering, tableId]);
|
|
701
|
+
}, [JSON.stringify(columnFilters), columns, manualFiltering, tableId]);
|
|
689
702
|
|
|
690
703
|
// 排序回调
|
|
691
704
|
useEffect(function () {
|
|
@@ -1096,8 +1109,11 @@ var TableMax = function TableMax(_ref) {
|
|
|
1096
1109
|
children: "\u4FDD\u5B58"
|
|
1097
1110
|
})]
|
|
1098
1111
|
})
|
|
1099
|
-
}) : /*#__PURE__*/_jsxs("div", {
|
|
1112
|
+
}) : null, /*#__PURE__*/_jsxs("div", {
|
|
1100
1113
|
className: "table-max-header-right",
|
|
1114
|
+
style: {
|
|
1115
|
+
display: editingRowId ? 'none' : 'flex'
|
|
1116
|
+
},
|
|
1101
1117
|
children: [renderOperateRight ? renderOperateRight : null, canUpload && /*#__PURE__*/_jsx(Upload, _objectSpread(_objectSpread({
|
|
1102
1118
|
className: "upload-btn handleRightItem"
|
|
1103
1119
|
}, uploadProps), {}, {
|
|
@@ -1207,7 +1223,17 @@ var TableMax = function TableMax(_ref) {
|
|
|
1207
1223
|
style: {
|
|
1208
1224
|
width: "100%"
|
|
1209
1225
|
},
|
|
1210
|
-
|
|
1226
|
+
onMouseEnter: function onMouseEnter() {
|
|
1227
|
+
var _tableBodyRef$current2;
|
|
1228
|
+
// 给当前元素添加hover类
|
|
1229
|
+
(_tableBodyRef$current2 = tableBodyRef.current) === null || _tableBodyRef$current2 === void 0 || _tableBodyRef$current2.classList.add('hover-active');
|
|
1230
|
+
},
|
|
1231
|
+
onMouseLeave: function onMouseLeave() {
|
|
1232
|
+
var _tableBodyRef$current3;
|
|
1233
|
+
// 移除当前元素的hover类
|
|
1234
|
+
(_tableBodyRef$current3 = tableBodyRef.current) === null || _tableBodyRef$current3 === void 0 || _tableBodyRef$current3.classList.remove('hover-active');
|
|
1235
|
+
},
|
|
1236
|
+
children: /*#__PURE__*/_jsx(TableBody, _objectSpread({}, tableBodyProps))
|
|
1211
1237
|
})]
|
|
1212
1238
|
})
|
|
1213
1239
|
}), pagination && /*#__PURE__*/_jsx("div", {
|
|
@@ -1215,7 +1241,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
1215
1241
|
children: tableMaxNewPagination ? /*#__PURE__*/_jsx(PaginationV2, {
|
|
1216
1242
|
total: totalCount,
|
|
1217
1243
|
pageSize: pageSize,
|
|
1218
|
-
pageSizeOptions: pageSizeOptions !== null && pageSizeOptions !== void 0 ? pageSizeOptions : globalPageSizeOptions,
|
|
1244
|
+
pageSizeOptions: pageSizeOptions !== null && pageSizeOptions !== void 0 ? pageSizeOptions : tableMaxConfig.globalPageSizeOptions,
|
|
1219
1245
|
showLessItems: showLessItems,
|
|
1220
1246
|
showSizeChanger: showSizeChanger,
|
|
1221
1247
|
curPageDataNum: tableDatas.length,
|
|
@@ -1234,7 +1260,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
1234
1260
|
}
|
|
1235
1261
|
}) : /*#__PURE__*/_jsx(Pagination, {
|
|
1236
1262
|
pageSize: pageSize,
|
|
1237
|
-
pageSizeOptions: pageSizeOptions !== null && pageSizeOptions !== void 0 ? pageSizeOptions : globalPageSizeOptions,
|
|
1263
|
+
pageSizeOptions: pageSizeOptions !== null && pageSizeOptions !== void 0 ? pageSizeOptions : tableMaxConfig.globalPageSizeOptions,
|
|
1238
1264
|
total: totalCount,
|
|
1239
1265
|
defaultPageSize: pageSize,
|
|
1240
1266
|
current: (skipCount || skipCount === 0) && pageSize ? skipCount / pageSize + 1 : 0,
|
|
@@ -1260,8 +1286,11 @@ var TableMax = function TableMax(_ref) {
|
|
|
1260
1286
|
})
|
|
1261
1287
|
});
|
|
1262
1288
|
};
|
|
1263
|
-
|
|
1289
|
+
|
|
1290
|
+
// export default React.forwardRef((props: TableMaxProps, ref) => <TableMax {...props} refInstance={ref} />);
|
|
1291
|
+
|
|
1292
|
+
export default /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
1264
1293
|
return /*#__PURE__*/_jsx(TableMax, _objectSpread(_objectSpread({}, props), {}, {
|
|
1265
1294
|
refInstance: ref
|
|
1266
1295
|
}));
|
|
1267
|
-
});
|
|
1296
|
+
}));
|
|
@@ -2,9 +2,8 @@ import { DatePicker, Form, Input, InputNumber, Tooltip } from 'antd';
|
|
|
2
2
|
import NumberRange from "./components/numberRange";
|
|
3
3
|
import RemoteSelect from "./components/remoteSelect";
|
|
4
4
|
import "./index.less";
|
|
5
|
-
|
|
6
|
-
// 编辑组件类型
|
|
7
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
// 编辑组件类型
|
|
8
7
|
export var InputType = /*#__PURE__*/function (InputType) {
|
|
9
8
|
InputType["InputNumber"] = "InputNumber";
|
|
10
9
|
InputType["NumberRange"] = "NumberRange";
|
|
@@ -13,6 +12,7 @@ export var InputType = /*#__PURE__*/function (InputType) {
|
|
|
13
12
|
InputType["Select"] = "Select";
|
|
14
13
|
return InputType;
|
|
15
14
|
}({});
|
|
15
|
+
var defaultEditOptions = [];
|
|
16
16
|
export var EditableCell = function EditableCell(_ref) {
|
|
17
17
|
var _ref2;
|
|
18
18
|
var editing = _ref.editing,
|
|
@@ -24,7 +24,7 @@ export var EditableCell = function EditableCell(_ref) {
|
|
|
24
24
|
precision = _ref.precision,
|
|
25
25
|
numberMin = _ref.numberMin,
|
|
26
26
|
_ref$editOptions = _ref.editOptions,
|
|
27
|
-
editOptions = _ref$editOptions === void 0 ?
|
|
27
|
+
editOptions = _ref$editOptions === void 0 ? defaultEditOptions : _ref$editOptions,
|
|
28
28
|
ellipsis = _ref.ellipsis,
|
|
29
29
|
columnTooltip = _ref.tooltip,
|
|
30
30
|
tableTooltip = _ref.tableTooltip,
|
|
@@ -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;
|
|
@@ -89,30 +89,30 @@
|
|
|
89
89
|
display: flex;
|
|
90
90
|
border-radius: @global-table-max-center-border-radius;
|
|
91
91
|
|
|
92
|
-
&:hover {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
92
|
+
// &:hover {
|
|
93
|
+
// .scroll {
|
|
94
|
+
// overflow: hidden auto;
|
|
95
|
+
// width: 1rem;
|
|
96
|
+
// flex-shrink: 0;
|
|
97
|
+
// scrollbar-width: thin;
|
|
98
|
+
// position: relative;
|
|
99
|
+
// background: @globalColor0;
|
|
100
|
+
// z-index: 1000;
|
|
101
|
+
// }
|
|
102
|
+
|
|
103
|
+
// .scroll::-webkit-scrollbar-thumb {
|
|
104
|
+
// border: 6px solid transparent;
|
|
105
|
+
// background: @scrollThumb;
|
|
106
|
+
// border-radius: 10px;
|
|
107
|
+
// background-clip: padding-box;
|
|
108
|
+
// }
|
|
109
|
+
|
|
110
|
+
// .scroll::-webkit-scrollbar-thumb:hover {
|
|
111
|
+
// border: 4px solid transparent;
|
|
112
|
+
// background: @scrollThumbHover;
|
|
113
|
+
// background-clip: padding-box;
|
|
114
|
+
// }
|
|
115
|
+
// }
|
|
116
116
|
|
|
117
117
|
.table-center {
|
|
118
118
|
flex: 1;
|
|
@@ -157,36 +157,38 @@
|
|
|
157
157
|
width: 10px;
|
|
158
158
|
height: 10px;
|
|
159
159
|
}
|
|
160
|
+
|
|
161
|
+
&::-webkit-scrollbar-track, &::-webkit-scrollbar-corner {
|
|
162
|
+
background: @global-table-max-scrollbar-track !important;
|
|
163
|
+
}
|
|
160
164
|
|
|
161
165
|
&::-webkit-scrollbar-thumb {
|
|
162
166
|
border-radius: 20px;
|
|
163
167
|
border: 6px solid transparent !important;
|
|
164
|
-
background:
|
|
168
|
+
background: @scrollThumb !important;
|
|
165
169
|
background-clip: padding-box !important;
|
|
166
170
|
}
|
|
167
171
|
|
|
168
|
-
|
|
169
|
-
|
|
172
|
+
}
|
|
173
|
+
.table-body.hover-active {
|
|
174
|
+
&::-webkit-scrollbar-thumb {
|
|
175
|
+
border-radius: 20px;
|
|
176
|
+
border: 2px solid transparent !important;
|
|
177
|
+
background: @scrollThumb !important;
|
|
178
|
+
background-clip: padding-box !important;
|
|
170
179
|
}
|
|
171
180
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
background-clip: padding-box !important;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
&::-webkit-scrollbar-thumb:hover {
|
|
181
|
-
border-radius: 20px;
|
|
182
|
-
border: 1px solid transparent !important;
|
|
183
|
-
background: @scrollThumb !important;
|
|
184
|
-
background-clip: padding-box !important;
|
|
185
|
-
}
|
|
181
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
182
|
+
border-radius: 20px;
|
|
183
|
+
border: 1px solid transparent !important;
|
|
184
|
+
background: @scrollThumb !important;
|
|
185
|
+
background-clip: padding-box !important;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
|
|
190
|
+
|
|
191
|
+
|
|
190
192
|
.table-loading {
|
|
191
193
|
display: flex;
|
|
192
194
|
flex-direction: column;
|
|
@@ -98,19 +98,20 @@ export var setInitColumnsSize = function setInitColumnsSize(tableColumns, column
|
|
|
98
98
|
};
|
|
99
99
|
};
|
|
100
100
|
export var getFormatFilters = function getFormatFilters(columns, originFilters) {
|
|
101
|
-
|
|
101
|
+
console.log('getFormatFilters :>> ', columns, originFilters);
|
|
102
102
|
var formatFilters = {};
|
|
103
|
-
originFilters.forEach(function (filter) {
|
|
103
|
+
originFilters === null || originFilters === void 0 || originFilters.forEach(function (filter) {
|
|
104
104
|
var id = filter.id,
|
|
105
105
|
value = filter.value;
|
|
106
106
|
var curColumn = columns.find(function (item) {
|
|
107
107
|
return item.id === id;
|
|
108
108
|
});
|
|
109
|
-
var
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
format =
|
|
109
|
+
var _ref4 = curColumn || {},
|
|
110
|
+
filterType = _ref4.filterType,
|
|
111
|
+
filterKey = _ref4.filterKey;
|
|
112
|
+
var _ref5 = curColumn.filterComProps || {},
|
|
113
|
+
_ref5$format = _ref5.format,
|
|
114
|
+
format = _ref5$format === void 0 ? defaultDateFormat : _ref5$format;
|
|
114
115
|
// 优先取formattedFilterKey作为key
|
|
115
116
|
var formatKey = filterKey || id;
|
|
116
117
|
if (filterType === FilterType.Date || filterType === FilterType.DateRange) {
|
|
@@ -149,16 +150,17 @@ export var getFormatFilters = function getFormatFilters(columns, originFilters)
|
|
|
149
150
|
* 4. SingleDate/SingleNumber/SingleSelect:Eq
|
|
150
151
|
*/
|
|
151
152
|
export var getFormatFiltersV2 = function getFormatFiltersV2(columns, originFilters) {
|
|
152
|
-
|
|
153
|
+
console.log('getFormatFilters :>> ', columns, originFilters);
|
|
153
154
|
var formatFilters = [];
|
|
154
|
-
originFilters.forEach(function (filter) {
|
|
155
|
+
originFilters === null || originFilters === void 0 || originFilters.forEach(function (filter) {
|
|
155
156
|
var id = filter.id,
|
|
156
157
|
value = filter.value;
|
|
157
158
|
var curColumn = columns.find(function (item) {
|
|
158
159
|
return item.id === id;
|
|
159
160
|
});
|
|
160
|
-
var
|
|
161
|
-
|
|
161
|
+
var _ref6 = curColumn || {},
|
|
162
|
+
filterType = _ref6.filterType,
|
|
163
|
+
filterKey = _ref6.filterKey;
|
|
162
164
|
// const { format = defaultDateFormat } = curColumn.filterComProps || {};
|
|
163
165
|
// 优先取formattedFilterKey作为key
|
|
164
166
|
var formatKey = filterKey || id;
|
|
@@ -216,8 +218,8 @@ export var getFormatSorting = function getFormatSorting(columns, originSorting)
|
|
|
216
218
|
var curColumn = columns.find(function (item) {
|
|
217
219
|
return item.id === sort.id;
|
|
218
220
|
});
|
|
219
|
-
var
|
|
220
|
-
sortingKey =
|
|
221
|
+
var _ref7 = curColumn || {},
|
|
222
|
+
sortingKey = _ref7.sortingKey;
|
|
221
223
|
// 优先取formattedFilterKey作为key
|
|
222
224
|
var formatKey = sortingKey || sort.id;
|
|
223
225
|
return _objectSpread(_objectSpread({}, sort), {}, {
|
|
@@ -242,13 +244,13 @@ export var operationColumnNoTooltips = function operationColumnNoTooltips(column
|
|
|
242
244
|
};
|
|
243
245
|
|
|
244
246
|
//下载
|
|
245
|
-
export var downloadExcel = function downloadExcel(
|
|
246
|
-
var url =
|
|
247
|
-
data =
|
|
248
|
-
title =
|
|
249
|
-
setDownLoading =
|
|
250
|
-
method =
|
|
251
|
-
request =
|
|
247
|
+
export var downloadExcel = function downloadExcel(_ref8) {
|
|
248
|
+
var url = _ref8.url,
|
|
249
|
+
data = _ref8.data,
|
|
250
|
+
title = _ref8.title,
|
|
251
|
+
setDownLoading = _ref8.setDownLoading,
|
|
252
|
+
method = _ref8.method,
|
|
253
|
+
request = _ref8.request;
|
|
252
254
|
setDownLoading(true);
|
|
253
255
|
request(url, {
|
|
254
256
|
method: method || 'post',
|