@arim-aisdc/public-components 2.3.71 → 2.3.73
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/ConditionExpression/index.d.ts +2 -0
- package/dist/components/ConditionExpression/index.js +8 -5
- package/dist/components/ConfigProvider/context.d.ts +1 -0
- package/dist/components/TableMax/TableBody/VirtualRow.js +1 -1
- package/dist/components/TableMax/TableMax.d.ts +2 -1
- package/dist/components/TableMax/TableMax.js +68 -46
- package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
- package/dist/components/TableMax/components/Export/useTableExport.js +13 -12
- package/dist/components/TableMax/hooks/useColumnWidth.js +1 -1
- package/dist/components/TableMax/type.d.ts +1 -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;
|
|
@@ -31,6 +31,8 @@ export interface ConditionExpressionPropsType {
|
|
|
31
31
|
labelInValue?: boolean;
|
|
32
32
|
/** 是否支持前端筛选 */
|
|
33
33
|
canFrontFilter?: boolean;
|
|
34
|
+
/** 前端筛选函数 */
|
|
35
|
+
frontendFilterOptionFun?: (input: any, option: any) => boolean;
|
|
34
36
|
}
|
|
35
37
|
declare const _default: React.NamedExoticComponent<ConditionExpressionPropsType>;
|
|
36
38
|
export default _default;
|
|
@@ -68,7 +68,8 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
68
68
|
showParameter = _ref$showParameter === void 0 ? true : _ref$showParameter,
|
|
69
69
|
parameterOptions = _ref.parameterOptions,
|
|
70
70
|
labelInValue = _ref.labelInValue,
|
|
71
|
-
canFrontFilter = _ref.canFrontFilter
|
|
71
|
+
canFrontFilter = _ref.canFrontFilter,
|
|
72
|
+
frontendFilterOptionFun = _ref.frontendFilterOptionFun;
|
|
72
73
|
/** 添加条件触发 */
|
|
73
74
|
var addExpression = function addExpression(index) {
|
|
74
75
|
var _conditionExpressionItem = value.map(function (e, i) {
|
|
@@ -167,6 +168,11 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
167
168
|
className: 'condition-all-undelete',
|
|
168
169
|
children: [item === null || item === void 0 ? void 0 : item.map(function (e, i) {
|
|
169
170
|
var _value$index$, _value$index$2, _value$index$3, _value$index$4;
|
|
171
|
+
// 前端筛选逻辑
|
|
172
|
+
var frontendFilterOption = function frontendFilterOption(input, option) {
|
|
173
|
+
var _option$label;
|
|
174
|
+
return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : '').toLowerCase().includes(input.toLowerCase());
|
|
175
|
+
};
|
|
170
176
|
return /*#__PURE__*/_jsxs("div", {
|
|
171
177
|
style: {
|
|
172
178
|
display: 'flex',
|
|
@@ -188,10 +194,7 @@ var ConditionExpression = function ConditionExpression(_ref) {
|
|
|
188
194
|
return dataChange('arguments', data, [index[0], i]);
|
|
189
195
|
},
|
|
190
196
|
showSearch: canFrontFilter,
|
|
191
|
-
filterOption: canFrontFilter ?
|
|
192
|
-
var _option$label;
|
|
193
|
-
return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : '').toLowerCase().includes(input.toLowerCase());
|
|
194
|
-
} : true
|
|
197
|
+
filterOption: canFrontFilter || frontendFilterOptionFun ? frontendFilterOptionFun || frontendFilterOption : true
|
|
195
198
|
})
|
|
196
199
|
}), /*#__PURE__*/_jsx("div", {
|
|
197
200
|
className: 'condition-select-middle',
|
|
@@ -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;
|
|
@@ -5,7 +5,8 @@ export declare enum ColumnType {
|
|
|
5
5
|
Selection = "selection-column",
|
|
6
6
|
Darg = "darg-column",
|
|
7
7
|
PlaceHolder = "placeholder-column",
|
|
8
|
-
Expander = "expander"
|
|
8
|
+
Expander = "expander",
|
|
9
|
+
Index = "inner-index"
|
|
9
10
|
}
|
|
10
11
|
export type ColumnSizing = Record<string, number>;
|
|
11
12
|
export declare const CACHE_MAX_AGE: number;
|
|
@@ -47,6 +47,7 @@ export var ColumnType = /*#__PURE__*/function (ColumnType) {
|
|
|
47
47
|
ColumnType["Darg"] = "darg-column";
|
|
48
48
|
ColumnType["PlaceHolder"] = "placeholder-column";
|
|
49
49
|
ColumnType["Expander"] = "expander";
|
|
50
|
+
ColumnType["Index"] = "inner-index";
|
|
50
51
|
return ColumnType;
|
|
51
52
|
}({});
|
|
52
53
|
export var CACHE_MAX_AGE = 1 * 60 * 60 * 1000;
|
|
@@ -66,6 +67,15 @@ var defaultColumnPinningConfig = {
|
|
|
66
67
|
};
|
|
67
68
|
var initSelectedRowIds = [];
|
|
68
69
|
var initColumnFilters = [];
|
|
70
|
+
var defaultOnSelectAllChange = function defaultOnSelectAllChange() {
|
|
71
|
+
return false;
|
|
72
|
+
};
|
|
73
|
+
var defaultGetRowCanExpand = function defaultGetRowCanExpand() {
|
|
74
|
+
return false;
|
|
75
|
+
};
|
|
76
|
+
var defaultDragBeforeEnd = function defaultDragBeforeEnd() {
|
|
77
|
+
return false;
|
|
78
|
+
};
|
|
69
79
|
var TableMax = function TableMax(_ref) {
|
|
70
80
|
var _JSON$parse;
|
|
71
81
|
var tableId = _ref.tableId,
|
|
@@ -158,15 +168,11 @@ var TableMax = function TableMax(_ref) {
|
|
|
158
168
|
getColumnFiltersData = _ref.getColumnFiltersData,
|
|
159
169
|
saveEditing = _ref.saveEditing,
|
|
160
170
|
_ref$getRowCanExpand = _ref.getRowCanExpand,
|
|
161
|
-
getRowCanExpand = _ref$getRowCanExpand === void 0 ?
|
|
162
|
-
return false;
|
|
163
|
-
} : _ref$getRowCanExpand,
|
|
171
|
+
getRowCanExpand = _ref$getRowCanExpand === void 0 ? defaultGetRowCanExpand : _ref$getRowCanExpand,
|
|
164
172
|
renderSubComponent = _ref.renderSubComponent,
|
|
165
173
|
refInstance = _ref.refInstance,
|
|
166
174
|
_ref$onSelectAllChang = _ref.onSelectAllChange,
|
|
167
|
-
onSelectAllChange = _ref$onSelectAllChang === void 0 ?
|
|
168
|
-
return false;
|
|
169
|
-
} : _ref$onSelectAllChang,
|
|
175
|
+
onSelectAllChange = _ref$onSelectAllChang === void 0 ? defaultOnSelectAllChange : _ref$onSelectAllChang,
|
|
170
176
|
_ref$enableRowSelecti = _ref.enableRowSelection,
|
|
171
177
|
enableRowSelection = _ref$enableRowSelecti === void 0 ? true : _ref$enableRowSelecti,
|
|
172
178
|
onRowMouseEnter = _ref.onRowMouseEnter,
|
|
@@ -182,9 +188,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
182
188
|
_ref$autoHeight = _ref.autoHeight,
|
|
183
189
|
autoHeight = _ref$autoHeight === void 0 ? false : _ref$autoHeight,
|
|
184
190
|
_ref$dragBeforeEnd = _ref.dragBeforeEnd,
|
|
185
|
-
dragBeforeEnd = _ref$dragBeforeEnd === void 0 ?
|
|
186
|
-
return true;
|
|
187
|
-
} : _ref$dragBeforeEnd,
|
|
191
|
+
dragBeforeEnd = _ref$dragBeforeEnd === void 0 ? defaultDragBeforeEnd : _ref$dragBeforeEnd,
|
|
188
192
|
dragBeforeStart = _ref.dragBeforeStart,
|
|
189
193
|
getContextMenu = _ref.getContextMenu,
|
|
190
194
|
onClickContextMenu = _ref.onClickContextMenu,
|
|
@@ -208,7 +212,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
208
212
|
openVirtualColumns = _ref$openVirtualColum === void 0 ? false : _ref$openVirtualColum,
|
|
209
213
|
_ref$openVirtualRows = _ref.openVirtualRows,
|
|
210
214
|
openVirtualRows = _ref$openVirtualRows === void 0 ? false : _ref$openVirtualRows,
|
|
211
|
-
openNullValueFilter = _ref.openNullValueFilter
|
|
215
|
+
openNullValueFilter = _ref.openNullValueFilter,
|
|
216
|
+
openIndexColumn = _ref.openIndexColumn;
|
|
212
217
|
var tableMaxRef = useRef(null);
|
|
213
218
|
// 表格元素
|
|
214
219
|
var tableContentRef = useRef(null);
|
|
@@ -234,14 +239,16 @@ var TableMax = function TableMax(_ref) {
|
|
|
234
239
|
openMemo = _ref2.openMemo,
|
|
235
240
|
globalCanExport = _ref2.canExport,
|
|
236
241
|
canSelectionUseShift = _ref2.canSelectionUseShift,
|
|
237
|
-
openNullValueFilter = _ref2.openNullValueFilter
|
|
242
|
+
openNullValueFilter = _ref2.openNullValueFilter,
|
|
243
|
+
openIndexColumn = _ref2.openIndexColumn;
|
|
238
244
|
return {
|
|
239
245
|
globalCanExport: globalCanExport,
|
|
240
246
|
globalPageSizeOptions: globalPageSizeOptions,
|
|
241
247
|
canSelectionUseShift: canSelectionUseShift,
|
|
242
248
|
cacheMaxAge: cacheMaxAge,
|
|
243
249
|
openMemo: openMemo,
|
|
244
|
-
openNullValueFilter: openNullValueFilter
|
|
250
|
+
openNullValueFilter: openNullValueFilter,
|
|
251
|
+
openIndexColumn: openIndexColumn
|
|
245
252
|
};
|
|
246
253
|
}, [JSON.stringify(tableMax)]);
|
|
247
254
|
|
|
@@ -596,6 +603,21 @@ var TableMax = function TableMax(_ref) {
|
|
|
596
603
|
var recentlyCheckedRow = useRef(null);
|
|
597
604
|
var setColumnsByProps = useCallback(function () {
|
|
598
605
|
var extraColumns = [];
|
|
606
|
+
if (openIndexColumn !== null && openIndexColumn !== void 0 ? openIndexColumn : tableMaxConfig === null || tableMaxConfig === void 0 ? void 0 : tableMaxConfig.openIndexColumn) {
|
|
607
|
+
extraColumns.unshift({
|
|
608
|
+
id: ColumnType.Index,
|
|
609
|
+
tooltip: false,
|
|
610
|
+
accessorKey: ColumnType.Index,
|
|
611
|
+
header: '序号',
|
|
612
|
+
cell: function cell(_ref6) {
|
|
613
|
+
var row = _ref6.row;
|
|
614
|
+
return row.index + 1;
|
|
615
|
+
},
|
|
616
|
+
size: 60,
|
|
617
|
+
enableSorting: false,
|
|
618
|
+
enableColumnFilter: false
|
|
619
|
+
});
|
|
620
|
+
}
|
|
599
621
|
if (getRowCanExpand() && columns.findIndex(function (column) {
|
|
600
622
|
return column.id === 'expander';
|
|
601
623
|
}) === -1) {
|
|
@@ -605,8 +627,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
605
627
|
size: 40,
|
|
606
628
|
tooltip: false,
|
|
607
629
|
enableResizing: false,
|
|
608
|
-
cell: function cell(
|
|
609
|
-
var row =
|
|
630
|
+
cell: function cell(_ref7) {
|
|
631
|
+
var row = _ref7.row;
|
|
610
632
|
return row.getCanExpand() ? /*#__PURE__*/_jsx("div", {
|
|
611
633
|
onClick: function onClick(evt) {
|
|
612
634
|
evt.stopPropagation();
|
|
@@ -627,8 +649,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
627
649
|
id: ColumnType.Selection,
|
|
628
650
|
tooltip: false,
|
|
629
651
|
enableResizing: false,
|
|
630
|
-
header: function header(
|
|
631
|
-
var table =
|
|
652
|
+
header: function header(_ref8) {
|
|
653
|
+
var table = _ref8.table;
|
|
632
654
|
return /*#__PURE__*/_jsx(Checkbox, {
|
|
633
655
|
checked: table.getIsAllRowsSelected(),
|
|
634
656
|
indeterminate: table.getIsSomePageRowsSelected(),
|
|
@@ -639,9 +661,9 @@ var TableMax = function TableMax(_ref) {
|
|
|
639
661
|
}
|
|
640
662
|
});
|
|
641
663
|
},
|
|
642
|
-
cell: function cell(
|
|
643
|
-
var row =
|
|
644
|
-
table =
|
|
664
|
+
cell: function cell(_ref9) {
|
|
665
|
+
var row = _ref9.row,
|
|
666
|
+
table = _ref9.table;
|
|
645
667
|
return /*#__PURE__*/_jsx(Checkbox, {
|
|
646
668
|
checked: row.getIsSelected(),
|
|
647
669
|
disabled: !row.getCanSelect(),
|
|
@@ -967,7 +989,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
967
989
|
|
|
968
990
|
// 保存编辑内容
|
|
969
991
|
var save = /*#__PURE__*/function () {
|
|
970
|
-
var
|
|
992
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
971
993
|
var _tableRows$find2;
|
|
972
994
|
var newRow, _table$getRowModel4, tableRows, originRow;
|
|
973
995
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -990,7 +1012,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
990
1012
|
}, _callee);
|
|
991
1013
|
}));
|
|
992
1014
|
return function save() {
|
|
993
|
-
return
|
|
1015
|
+
return _ref10.apply(this, arguments);
|
|
994
1016
|
};
|
|
995
1017
|
}();
|
|
996
1018
|
var triggerSave = function triggerSave(e) {
|
|
@@ -1231,31 +1253,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
1231
1253
|
return refreshFun === null || refreshFun === void 0 ? void 0 : refreshFun();
|
|
1232
1254
|
}
|
|
1233
1255
|
})
|
|
1234
|
-
}), canEditting && /*#__PURE__*/_jsx("span", {
|
|
1235
|
-
className: canClickEditIcon ? undefined : 'disableBtn',
|
|
1236
|
-
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
1237
|
-
placement: "top",
|
|
1238
|
-
title: '编辑',
|
|
1239
|
-
children: /*#__PURE__*/_jsx("i", {
|
|
1240
|
-
className: "iconfont-other icon-other-bianji handleRightItem",
|
|
1241
|
-
style: {
|
|
1242
|
-
fontSize: '16px',
|
|
1243
|
-
marginRight: 0
|
|
1244
|
-
},
|
|
1245
|
-
onClick: editFun
|
|
1246
|
-
})
|
|
1247
|
-
})
|
|
1248
|
-
}), canDelete && /*#__PURE__*/_jsx(Tooltip, {
|
|
1249
|
-
placement: "top",
|
|
1250
|
-
title: '删除',
|
|
1251
|
-
children: /*#__PURE__*/_jsx("i", {
|
|
1252
|
-
className: "iconfont-table icon-table-delete handleRightItem",
|
|
1253
|
-
style: {
|
|
1254
|
-
fontSize: '16px',
|
|
1255
|
-
marginRight: 0
|
|
1256
|
-
},
|
|
1257
|
-
onClick: handleClickDelete
|
|
1258
|
-
})
|
|
1259
1256
|
}), canFilter && /*#__PURE__*/_jsx(Tooltip, {
|
|
1260
1257
|
placement: "top",
|
|
1261
1258
|
title: '重置筛选',
|
|
@@ -1288,6 +1285,31 @@ var TableMax = function TableMax(_ref) {
|
|
|
1288
1285
|
},
|
|
1289
1286
|
onClick: changeCompactMode
|
|
1290
1287
|
})
|
|
1288
|
+
}), canEditting && /*#__PURE__*/_jsx("span", {
|
|
1289
|
+
className: canClickEditIcon ? undefined : 'disableBtn',
|
|
1290
|
+
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
1291
|
+
placement: "top",
|
|
1292
|
+
title: '编辑',
|
|
1293
|
+
children: /*#__PURE__*/_jsx("i", {
|
|
1294
|
+
className: "iconfont-other icon-other-bianji handleRightItem",
|
|
1295
|
+
style: {
|
|
1296
|
+
fontSize: '16px',
|
|
1297
|
+
marginRight: 0
|
|
1298
|
+
},
|
|
1299
|
+
onClick: editFun
|
|
1300
|
+
})
|
|
1301
|
+
})
|
|
1302
|
+
}), canDelete && /*#__PURE__*/_jsx(Tooltip, {
|
|
1303
|
+
placement: "top",
|
|
1304
|
+
title: '删除',
|
|
1305
|
+
children: /*#__PURE__*/_jsx("i", {
|
|
1306
|
+
className: "iconfont-table icon-table-delete handleRightItem",
|
|
1307
|
+
style: {
|
|
1308
|
+
fontSize: '16px',
|
|
1309
|
+
marginRight: 0
|
|
1310
|
+
},
|
|
1311
|
+
onClick: handleClickDelete
|
|
1312
|
+
})
|
|
1291
1313
|
}), canSetting && /*#__PURE__*/_jsx(ColumnSetting, {
|
|
1292
1314
|
table: table,
|
|
1293
1315
|
tableId: tableId,
|
|
@@ -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;
|
|
@@ -22,6 +22,11 @@ import { useCallback, useState } from 'react';
|
|
|
22
22
|
import * as XLSX from 'xlsx';
|
|
23
23
|
import { message } from 'antd';
|
|
24
24
|
import { ColumnType } from "../../TableMax";
|
|
25
|
+
var DefaultPageParams = {
|
|
26
|
+
skipCount: 0,
|
|
27
|
+
maxResultCount: 1000
|
|
28
|
+
};
|
|
29
|
+
|
|
25
30
|
/**
|
|
26
31
|
* 默认的单元格逻辑转换函数
|
|
27
32
|
*/
|
|
@@ -85,7 +90,6 @@ export var useTableExport = function useTableExport(
|
|
|
85
90
|
_useState2 = _slicedToArray(_useState, 2),
|
|
86
91
|
exporting = _useState2[0],
|
|
87
92
|
setExporting = _useState2[1];
|
|
88
|
-
|
|
89
93
|
/**
|
|
90
94
|
* 根据列配置处理数据
|
|
91
95
|
*/
|
|
@@ -130,7 +134,6 @@ export var useTableExport = function useTableExport(
|
|
|
130
134
|
return processedItem;
|
|
131
135
|
});
|
|
132
136
|
}, []);
|
|
133
|
-
|
|
134
137
|
/**
|
|
135
138
|
* 设置列宽
|
|
136
139
|
*/
|
|
@@ -143,7 +146,6 @@ export var useTableExport = function useTableExport(
|
|
|
143
146
|
};
|
|
144
147
|
});
|
|
145
148
|
}, []);
|
|
146
|
-
|
|
147
149
|
/**
|
|
148
150
|
* 计算列宽
|
|
149
151
|
*/
|
|
@@ -153,7 +155,6 @@ export var useTableExport = function useTableExport(
|
|
|
153
155
|
var width = chineseCharCount * 2 + otherCharCount * 1.1 + 4;
|
|
154
156
|
return Math.min(Math.max(width, 12), 50);
|
|
155
157
|
};
|
|
156
|
-
|
|
157
158
|
/**
|
|
158
159
|
* 主导出函数
|
|
159
160
|
*/
|
|
@@ -174,28 +175,28 @@ export var useTableExport = function useTableExport(
|
|
|
174
175
|
case 5:
|
|
175
176
|
setExporting(true);
|
|
176
177
|
if (!customOptions.getExportDataList) {
|
|
177
|
-
_context.next =
|
|
178
|
+
_context.next = 11;
|
|
178
179
|
break;
|
|
179
180
|
}
|
|
180
181
|
_context.next = 9;
|
|
181
|
-
return customOptions.getExportDataList();
|
|
182
|
+
return customOptions.getExportDataList(DefaultPageParams);
|
|
182
183
|
case 9:
|
|
183
184
|
exportData = _context.sent;
|
|
184
|
-
|
|
185
|
+
if (!(Array.isArray(exportData) && exportData.length > 0)) {
|
|
186
|
+
message.warning('未获取到导出数据');
|
|
187
|
+
}
|
|
188
|
+
case 11:
|
|
185
189
|
if (isIncludeTotalRow && hasTotalRow) {
|
|
186
190
|
exportData = [].concat(_toConsumableArray(exportData), [totalDatas]);
|
|
187
191
|
}
|
|
188
192
|
try {
|
|
189
193
|
finalOptions = _objectSpread({}, customOptions); // 处理数据
|
|
190
|
-
processedData = processDataWithColumns(columns, exportData, isIncludeTotalRow && hasTotalRow); //
|
|
191
|
-
// 创建工作簿
|
|
194
|
+
processedData = processDataWithColumns(columns, exportData, isIncludeTotalRow && hasTotalRow); // 创建工作簿
|
|
192
195
|
workbook = XLSX.utils.book_new();
|
|
193
196
|
worksheet = XLSX.utils.json_to_sheet(processedData); // 设置列宽
|
|
194
197
|
setColumnWidths(columns, worksheet);
|
|
195
|
-
|
|
196
198
|
// 添加到工作簿
|
|
197
199
|
XLSX.utils.book_append_sheet(workbook, worksheet, finalOptions.sheetName);
|
|
198
|
-
|
|
199
200
|
// 生成文件名
|
|
200
201
|
timestamp = new Date().toISOString().slice(0, 10).replace(/-/g, '');
|
|
201
202
|
exportFilename = "".concat(finalOptions.fileName, "_").concat(timestamp, ".xlsx"); // 导出文件
|
|
@@ -207,7 +208,7 @@ export var useTableExport = function useTableExport(
|
|
|
207
208
|
} finally {
|
|
208
209
|
setExporting(false);
|
|
209
210
|
}
|
|
210
|
-
case
|
|
211
|
+
case 13:
|
|
211
212
|
case "end":
|
|
212
213
|
return _context.stop();
|
|
213
214
|
}
|
|
@@ -73,7 +73,7 @@ export var useColumnWidth = function useColumnWidth(_ref) {
|
|
|
73
73
|
*/
|
|
74
74
|
var getAdjustableColumns = useCallback(function (columns) {
|
|
75
75
|
return Object.keys(columns).filter(function (key) {
|
|
76
|
-
return !['expander', 'selection-column'].includes(key);
|
|
76
|
+
return !['expander', 'selection-column', 'inner-index'].includes(key);
|
|
77
77
|
});
|
|
78
78
|
}, []);
|
|
79
79
|
|