@arim-aisdc/public-components 2.3.46 → 2.3.48
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/ConfigProvider/context.d.ts +1 -0
- package/dist/components/CustomForm/UploadImg/index.js +6 -5
- package/dist/components/TableMax/TableMax.js +53 -12
- package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
- package/dist/components/TableMax/components/Export/index.js +0 -1
- package/dist/components/TableMax/type.d.ts +2 -0
- package/package.json +1 -1
|
@@ -114,7 +114,7 @@ var UploadImg = function UploadImg(_ref) {
|
|
|
114
114
|
url = "".concat(item === null || item === void 0 ? void 0 : item.baseUrl, "/api/file-management/file-descriptor/content");
|
|
115
115
|
_context2.prev = 3;
|
|
116
116
|
_context2.next = 6;
|
|
117
|
-
return fetch("".concat(url, "?
|
|
117
|
+
return fetch("".concat(url, "?fileId=").concat(id), {
|
|
118
118
|
method: 'GET',
|
|
119
119
|
headers: {
|
|
120
120
|
Authorization: "Bearer ".concat(item === null || item === void 0 ? void 0 : item.token)
|
|
@@ -232,11 +232,12 @@ var UploadImg = function UploadImg(_ref) {
|
|
|
232
232
|
message.success('上传成功');
|
|
233
233
|
if (item !== null && item !== void 0 && item.multiple) {
|
|
234
234
|
onChange === null || onChange === void 0 || onChange(fileList.map(function (item) {
|
|
235
|
-
|
|
235
|
+
var _item$response;
|
|
236
|
+
return (item === null || item === void 0 || (_item$response = item.response) === null || _item$response === void 0 ? void 0 : _item$response.fileId) || item.response.id;
|
|
236
237
|
}));
|
|
237
238
|
} else {
|
|
238
|
-
var _file$response;
|
|
239
|
-
onChange === null || onChange === void 0 || onChange(file === null || file === void 0 || (_file$response = file.response) === null || _file$response === void 0 ? void 0 : _file$response.id);
|
|
239
|
+
var _file$response, _file$response2;
|
|
240
|
+
onChange === null || onChange === void 0 || onChange((file === null || file === void 0 || (_file$response = file.response) === null || _file$response === void 0 ? void 0 : _file$response.fileId) || (file === null || file === void 0 || (_file$response2 = file.response) === null || _file$response2 === void 0 ? void 0 : _file$response2.id));
|
|
240
241
|
}
|
|
241
242
|
break;
|
|
242
243
|
case 'error':
|
|
@@ -245,7 +246,7 @@ var UploadImg = function UploadImg(_ref) {
|
|
|
245
246
|
case 'removed':
|
|
246
247
|
if (item !== null && item !== void 0 && item.multiple) {
|
|
247
248
|
onChange === null || onChange === void 0 || onChange(fileList.map(function (item) {
|
|
248
|
-
return item.response.id;
|
|
249
|
+
return item.response.fileId || item.response.id;
|
|
249
250
|
}));
|
|
250
251
|
} else {
|
|
251
252
|
onChange === null || onChange === void 0 || onChange('');
|
|
@@ -116,6 +116,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
116
116
|
defaultCompactMode = _ref$defaultCompactMo === void 0 ? false : _ref$defaultCompactMo,
|
|
117
117
|
_ref$canSelection = _ref.canSelection,
|
|
118
118
|
canSelection = _ref$canSelection === void 0 ? false : _ref$canSelection,
|
|
119
|
+
canSelectionUseShift = _ref.canSelectionUseShift,
|
|
119
120
|
_ref$selectionWithout = _ref.selectionWithoutChecked,
|
|
120
121
|
selectionWithoutChecked = _ref$selectionWithout === void 0 ? false : _ref$selectionWithout,
|
|
121
122
|
_ref$canRowDrag = _ref.canRowDrag,
|
|
@@ -223,10 +224,12 @@ var TableMax = function TableMax(_ref) {
|
|
|
223
224
|
globalPageSizeOptions = _ref2.pageSizeOptions,
|
|
224
225
|
cacheMaxAge = _ref2.cacheMaxAge,
|
|
225
226
|
openMemo = _ref2.openMemo,
|
|
226
|
-
globalCanExport = _ref2.canExport
|
|
227
|
+
globalCanExport = _ref2.canExport,
|
|
228
|
+
canSelectionUseShift = _ref2.canSelectionUseShift;
|
|
227
229
|
return {
|
|
228
230
|
globalCanExport: globalCanExport,
|
|
229
231
|
globalPageSizeOptions: globalPageSizeOptions,
|
|
232
|
+
canSelectionUseShift: canSelectionUseShift,
|
|
230
233
|
cacheMaxAge: cacheMaxAge,
|
|
231
234
|
openMemo: openMemo
|
|
232
235
|
};
|
|
@@ -554,6 +557,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
554
557
|
}
|
|
555
558
|
setColumnOrder(arr);
|
|
556
559
|
};
|
|
560
|
+
var recentlyCheckedRow = useRef(null);
|
|
561
|
+
var allCheckedRow = useRef(null);
|
|
557
562
|
var setColumnsByProps = useCallback(function () {
|
|
558
563
|
var extraColumns = [];
|
|
559
564
|
if (getRowCanExpand() && columns.findIndex(function (column) {
|
|
@@ -606,16 +611,51 @@ var TableMax = function TableMax(_ref) {
|
|
|
606
611
|
checked: row.getIsSelected(),
|
|
607
612
|
disabled: !row.getCanSelect(),
|
|
608
613
|
indeterminate: row.getIsSomeSelected(),
|
|
609
|
-
onChange: row.getToggleSelectedHandler(),
|
|
610
|
-
|
|
611
|
-
var
|
|
612
|
-
var
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
614
|
+
// onChange: row.getToggleSelectedHandler(),
|
|
615
|
+
onChange: function onChange(e) {
|
|
616
|
+
var _e$nativeEvent;
|
|
617
|
+
var currentRowIsSelected,
|
|
618
|
+
currentSelectedRows = [],
|
|
619
|
+
currentSelectedRowsOriginal = [],
|
|
620
|
+
allSelectedRows = [];
|
|
621
|
+
var isCanShiftControl = canSelectionUseShift !== null && canSelectionUseShift !== void 0 ? canSelectionUseShift : tableMaxConfig === null || tableMaxConfig === void 0 ? void 0 : tableMaxConfig.canSelectionUseShift;
|
|
622
|
+
if (isCanShiftControl && e !== null && e !== void 0 && (_e$nativeEvent = e.nativeEvent) !== null && _e$nativeEvent !== void 0 && _e$nativeEvent.shiftKey) {
|
|
623
|
+
var selectionConfig = {};
|
|
624
|
+
var initselectedIndex = recentlyCheckedRow.current;
|
|
625
|
+
var min = Math.min(initselectedIndex || 0, row.index);
|
|
626
|
+
var max = Math.max(initselectedIndex || 0, row.index);
|
|
627
|
+
table.getRowModel().rows.map(function (row) {
|
|
628
|
+
var isInRange = row.index >= min && row.index <= max;
|
|
629
|
+
if (isInRange) {
|
|
630
|
+
var insertMethod = initselectedIndex < row.index ? 'push' : 'unshift';
|
|
631
|
+
currentSelectedRows[insertMethod](row);
|
|
632
|
+
currentSelectedRowsOriginal[insertMethod](row.original);
|
|
633
|
+
}
|
|
634
|
+
if (row.getIsSelected() || isInRange) {
|
|
635
|
+
selectionConfig[row.id] = true;
|
|
636
|
+
allSelectedRows.push(row);
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
setRowSelection(function (prev) {
|
|
640
|
+
return _objectSpread(_objectSpread({}, prev), selectionConfig);
|
|
641
|
+
});
|
|
642
|
+
currentRowIsSelected = true;
|
|
643
|
+
} else {
|
|
644
|
+
var _table$getRowModel;
|
|
645
|
+
row.toggleSelected();
|
|
646
|
+
currentRowIsSelected = !row.getIsSelected();
|
|
647
|
+
currentSelectedRows = row;
|
|
648
|
+
currentSelectedRowsOriginal = row.original;
|
|
649
|
+
allSelectedRows = (_table$getRowModel = table.getRowModel()) === null || _table$getRowModel === void 0 ? void 0 : _table$getRowModel.rows.filter(function (item) {
|
|
650
|
+
if (item.id === row.id) {
|
|
651
|
+
return !row.getIsSelected();
|
|
652
|
+
}
|
|
653
|
+
return item.getIsSelected();
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
recentlyCheckedRow.current = currentRowIsSelected ? row.index : recentlyCheckedRow.current;
|
|
657
|
+
// 为了兼容之前的逻辑,currentSelectedRows在不使用shift时是对象,使用shift时是数组
|
|
658
|
+
onRowCheckboxClick === null || onRowCheckboxClick === void 0 || onRowCheckboxClick(currentSelectedRowsOriginal, currentSelectedRows, currentRowIsSelected, allSelectedRows);
|
|
619
659
|
// 阻止点击事件冒泡,监听行双击事件时,点击这里会有问题
|
|
620
660
|
e.stopPropagation();
|
|
621
661
|
}
|
|
@@ -625,7 +665,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
625
665
|
});
|
|
626
666
|
}
|
|
627
667
|
return extraColumns;
|
|
628
|
-
}, [canSelection, selectionWithoutChecked, getRowCanExpand, columns]);
|
|
668
|
+
}, [canSelection, canSelectionUseShift, tableMaxConfig === null || tableMaxConfig === void 0 ? void 0 : tableMaxConfig.canSelectionUseShift, selectionWithoutChecked, getRowCanExpand, columns, rowKey]);
|
|
629
669
|
|
|
630
670
|
// 初始化列
|
|
631
671
|
useEffect(function () {
|
|
@@ -664,6 +704,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
664
704
|
|
|
665
705
|
var _rowSelectionChange = useCallback(debounce(function (rowOriginal, row) {
|
|
666
706
|
if (rowSelectionChange) {
|
|
707
|
+
console.log(rowOriginal, row, 'rowSelectionChange1');
|
|
667
708
|
rowSelectionChange(rowOriginal, row);
|
|
668
709
|
}
|
|
669
710
|
}, 100), [rowSelectionChange]);
|
|
@@ -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;
|
|
@@ -24,7 +24,6 @@ var ExportComp = function ExportComp(_ref) {
|
|
|
24
24
|
var _useTableExport = useTableExport(),
|
|
25
25
|
exporting = _useTableExport.exporting,
|
|
26
26
|
exportTableData = _useTableExport.exportTableData;
|
|
27
|
-
console.log(columns, datas, '4444555555');
|
|
28
27
|
var handleExport = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
29
28
|
var _ref3, _exportConfig$fileNam;
|
|
30
29
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -169,6 +169,8 @@ export type TableMaxProps = {
|
|
|
169
169
|
defaultCompactMode?: boolean;
|
|
170
170
|
/**是否支持多选,默认不支持 */
|
|
171
171
|
canSelection?: boolean;
|
|
172
|
+
/**是否支持shift多选,无默认值,可以在 ConfigProvider配置 */
|
|
173
|
+
canSelectionUseShift?: boolean;
|
|
172
174
|
/**多选不显示勾选框,ctrl shift进行多选 */
|
|
173
175
|
selectionWithoutChecked?: boolean;
|
|
174
176
|
/** 行是否可拖动,默认不支持 */
|