@arim-aisdc/public-components 2.3.47 → 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 +1 -1
- package/dist/components/TableMax/TableMax.js +53 -12
- package/dist/components/TableMax/components/ColumnSort/customSortFns.d.ts +8 -8
- 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)
|
|
@@ -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) =>
|
|
3
|
-
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
4
|
-
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
5
|
-
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
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) =>
|
|
8
|
-
stringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
9
|
-
timeSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
10
|
-
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) =>
|
|
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;
|
|
@@ -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
|
/** 行是否可拖动,默认不支持 */
|