@arim-aisdc/public-components 2.3.48 → 2.3.49
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.
|
@@ -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 | Element |
|
|
20
|
+
text: string | JSX.Element | Element;
|
|
21
21
|
units?: string;
|
|
22
22
|
width?: string;
|
|
23
23
|
labelWidth?: string;
|
|
@@ -616,10 +616,24 @@ var TableMax = function TableMax(_ref) {
|
|
|
616
616
|
var _e$nativeEvent;
|
|
617
617
|
var currentRowIsSelected,
|
|
618
618
|
currentSelectedRows = [],
|
|
619
|
-
currentSelectedRowsOriginal = [],
|
|
620
619
|
allSelectedRows = [];
|
|
621
620
|
var isCanShiftControl = canSelectionUseShift !== null && canSelectionUseShift !== void 0 ? canSelectionUseShift : tableMaxConfig === null || tableMaxConfig === void 0 ? void 0 : tableMaxConfig.canSelectionUseShift;
|
|
622
|
-
if (isCanShiftControl
|
|
621
|
+
if (!isCanShiftControl) {
|
|
622
|
+
var _table$getRowModel;
|
|
623
|
+
row.toggleSelected();
|
|
624
|
+
currentRowIsSelected = !row.getIsSelected();
|
|
625
|
+
allSelectedRows = (_table$getRowModel = table.getRowModel()) === null || _table$getRowModel === void 0 ? void 0 : _table$getRowModel.rows.filter(function (item) {
|
|
626
|
+
if (item.id === row.id) {
|
|
627
|
+
return !row.getIsSelected();
|
|
628
|
+
}
|
|
629
|
+
return item.getIsSelected();
|
|
630
|
+
});
|
|
631
|
+
// 为了兼容之前的逻辑,currentSelectedRows在不使用shift时是对象,使用shift时是数组
|
|
632
|
+
onRowCheckboxClick === null || onRowCheckboxClick === void 0 || onRowCheckboxClick(row, row.original, currentRowIsSelected, allSelectedRows);
|
|
633
|
+
e.stopPropagation();
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
if (e !== null && e !== void 0 && (_e$nativeEvent = e.nativeEvent) !== null && _e$nativeEvent !== void 0 && _e$nativeEvent.shiftKey) {
|
|
623
637
|
var selectionConfig = {};
|
|
624
638
|
var initselectedIndex = recentlyCheckedRow.current;
|
|
625
639
|
var min = Math.min(initselectedIndex || 0, row.index);
|
|
@@ -629,7 +643,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
629
643
|
if (isInRange) {
|
|
630
644
|
var insertMethod = initselectedIndex < row.index ? 'push' : 'unshift';
|
|
631
645
|
currentSelectedRows[insertMethod](row);
|
|
632
|
-
currentSelectedRowsOriginal[insertMethod](row.original);
|
|
633
646
|
}
|
|
634
647
|
if (row.getIsSelected() || isInRange) {
|
|
635
648
|
selectionConfig[row.id] = true;
|
|
@@ -641,12 +654,11 @@ var TableMax = function TableMax(_ref) {
|
|
|
641
654
|
});
|
|
642
655
|
currentRowIsSelected = true;
|
|
643
656
|
} else {
|
|
644
|
-
var _table$
|
|
657
|
+
var _table$getRowModel2;
|
|
645
658
|
row.toggleSelected();
|
|
646
659
|
currentRowIsSelected = !row.getIsSelected();
|
|
647
|
-
currentSelectedRows = row;
|
|
648
|
-
|
|
649
|
-
allSelectedRows = (_table$getRowModel = table.getRowModel()) === null || _table$getRowModel === void 0 ? void 0 : _table$getRowModel.rows.filter(function (item) {
|
|
660
|
+
currentSelectedRows = [row];
|
|
661
|
+
allSelectedRows = (_table$getRowModel2 = table.getRowModel()) === null || _table$getRowModel2 === void 0 ? void 0 : _table$getRowModel2.rows.filter(function (item) {
|
|
650
662
|
if (item.id === row.id) {
|
|
651
663
|
return !row.getIsSelected();
|
|
652
664
|
}
|
|
@@ -654,8 +666,10 @@ var TableMax = function TableMax(_ref) {
|
|
|
654
666
|
});
|
|
655
667
|
}
|
|
656
668
|
recentlyCheckedRow.current = currentRowIsSelected ? row.index : recentlyCheckedRow.current;
|
|
657
|
-
//
|
|
658
|
-
onRowCheckboxClick === null || onRowCheckboxClick === void 0 || onRowCheckboxClick(
|
|
669
|
+
// currentSelectedRows是数组
|
|
670
|
+
onRowCheckboxClick === null || onRowCheckboxClick === void 0 || onRowCheckboxClick(currentSelectedRows, currentSelectedRows.map(function (row) {
|
|
671
|
+
return row.original;
|
|
672
|
+
}), currentRowIsSelected, allSelectedRows);
|
|
659
673
|
// 阻止点击事件冒泡,监听行双击事件时,点击这里会有问题
|
|
660
674
|
e.stopPropagation();
|
|
661
675
|
}
|
|
@@ -917,8 +931,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
917
931
|
if (!canClickEditIcon) return;
|
|
918
932
|
var selectedTableRows = table.getSelectedRowModel().rows;
|
|
919
933
|
var selectedTableRowsLength = selectedTableRows.length;
|
|
920
|
-
var _table$
|
|
921
|
-
tableRows = _table$
|
|
934
|
+
var _table$getRowModel3 = table.getRowModel(),
|
|
935
|
+
tableRows = _table$getRowModel3.rows;
|
|
922
936
|
var selectRow =
|
|
923
937
|
// eslint-disable-next-line eqeqeq
|
|
924
938
|
(canSelection ? (_selectedTableRows = selectedTableRows[selectedTableRowsLength - 1]) === null || _selectedTableRows === void 0 ? void 0 : _selectedTableRows.original : (_tableRows$find = tableRows.find(function (item) {
|
|
@@ -937,7 +951,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
937
951
|
var save = /*#__PURE__*/function () {
|
|
938
952
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
939
953
|
var _tableRows$find2;
|
|
940
|
-
var newRow, _table$
|
|
954
|
+
var newRow, _table$getRowModel4, tableRows, originRow;
|
|
941
955
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
942
956
|
while (1) switch (_context.prev = _context.next) {
|
|
943
957
|
case 0:
|
|
@@ -945,7 +959,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
945
959
|
return form.validateFields();
|
|
946
960
|
case 2:
|
|
947
961
|
newRow = _context.sent;
|
|
948
|
-
_table$
|
|
962
|
+
_table$getRowModel4 = table.getRowModel(), tableRows = _table$getRowModel4.rows; // eslint-disable-next-line eqeqeq
|
|
949
963
|
originRow = ((_tableRows$find2 = tableRows.find(function (item) {
|
|
950
964
|
return item.id == editingRowId;
|
|
951
965
|
})) === null || _tableRows$find2 === void 0 ? void 0 : _tableRows$find2.original) || {}; // eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
@@ -998,8 +1012,8 @@ var TableMax = function TableMax(_ref) {
|
|
|
998
1012
|
} else {
|
|
999
1013
|
var _tableRows$find3;
|
|
1000
1014
|
// 单选
|
|
1001
|
-
var _table$
|
|
1002
|
-
tableRows = _table$
|
|
1015
|
+
var _table$getRowModel5 = table.getRowModel(),
|
|
1016
|
+
tableRows = _table$getRowModel5.rows;
|
|
1003
1017
|
deleteFun === null || deleteFun === void 0 || deleteFun((_tableRows$find3 = tableRows.find(function (item) {
|
|
1004
1018
|
return item.id === rowSelectedId;
|
|
1005
1019
|
})) === null || _tableRows$find3 === void 0 ? void 0 : _tableRows$find3.original);
|
|
@@ -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 | 0 | -1;
|
|
3
|
+
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
|
|
4
|
+
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
|
|
5
|
+
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
|
|
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 | 0 | -1;
|
|
8
|
+
stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
|
|
9
|
+
timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
|
|
10
|
+
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
|
|
11
11
|
};
|
|
12
12
|
export default customSortFns;
|
|
13
13
|
export type SortFnType = keyof typeof customSortFns | undefined;
|