@arim-aisdc/public-components 2.3.79 → 2.3.81
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.
|
@@ -524,9 +524,22 @@ var TableMax = function TableMax(_ref) {
|
|
|
524
524
|
/**根据缓存数据设置一些状态 */
|
|
525
525
|
var setColumnInfoFromCache = function setColumnInfoFromCache(tableColumns) {
|
|
526
526
|
var _localStorage$getItem, _tableMaxConfig$cache, _cache$columnVisibili, _cache$columnPinning$, _cache$columnPinning, _cache$columnPinning$2, _cache$columnPinning2;
|
|
527
|
+
var newColumnOrder = tableColumns === null || tableColumns === void 0 ? void 0 : tableColumns.map(function (column) {
|
|
528
|
+
return column.id;
|
|
529
|
+
});
|
|
530
|
+
var arr = newColumnOrder;
|
|
531
|
+
if (!tableId) {
|
|
532
|
+
setColumnOrder(arr);
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
527
535
|
var cache = JSON.parse((_localStorage$getItem = localStorage.getItem(tableKey)) !== null && _localStorage$getItem !== void 0 ? _localStorage$getItem : '{}');
|
|
528
|
-
if (version && version !== (cache === null || cache === void 0 ? void 0 : cache.version))
|
|
536
|
+
if (version && version !== (cache === null || cache === void 0 ? void 0 : cache.version)) {
|
|
537
|
+
setColumnOrder(arr);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
;
|
|
529
541
|
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)) {
|
|
542
|
+
setColumnOrder(arr);
|
|
530
543
|
return;
|
|
531
544
|
}
|
|
532
545
|
var columnsIdSet = new Set(tableColumns.map(function (column) {
|
|
@@ -592,10 +605,6 @@ var TableMax = function TableMax(_ref) {
|
|
|
592
605
|
right: Array.from(new Set(_toConsumableArray(cacheColumnPinning.right)))
|
|
593
606
|
});
|
|
594
607
|
}
|
|
595
|
-
var newColumnOrder = tableColumns === null || tableColumns === void 0 ? void 0 : tableColumns.map(function (column) {
|
|
596
|
-
return column.id;
|
|
597
|
-
});
|
|
598
|
-
var arr = newColumnOrder;
|
|
599
608
|
if (cacheColumnOrder && tableColumns.length === cacheColumnOrder.length && cacheColumnOrder.filter(function (columnId) {
|
|
600
609
|
return !newColumnOrder.includes(columnId);
|
|
601
610
|
}).length === 0) {
|
|
@@ -762,7 +771,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
762
771
|
var _column$columns;
|
|
763
772
|
return (column === null || column === void 0 ? void 0 : column.columns) && ((_column$columns = column.columns) === null || _column$columns === void 0 ? void 0 : _column$columns.length) > 0;
|
|
764
773
|
}) > -1);
|
|
765
|
-
}, [columns]);
|
|
774
|
+
}, [columns, tableId]);
|
|
766
775
|
var _rowSelectionChange = useCallback(debounce(function (rowOriginal, row) {
|
|
767
776
|
if (rowSelectionChange) {
|
|
768
777
|
// console.log(rowOriginal, row, 'rowSelectionChange1')
|
|
@@ -837,7 +846,9 @@ var TableMax = function TableMax(_ref) {
|
|
|
837
846
|
|
|
838
847
|
/**缓存table数据 */
|
|
839
848
|
useUpdateEffect(function () {
|
|
849
|
+
if (!tableId) return;
|
|
840
850
|
var tableState = table.getState();
|
|
851
|
+
debugger;
|
|
841
852
|
localStorage.setItem(tableKey, JSON.stringify({
|
|
842
853
|
enableFilters: enableFilters,
|
|
843
854
|
headerRowNum: headerRowNum,
|
|
@@ -852,7 +863,7 @@ var TableMax = function TableMax(_ref) {
|
|
|
852
863
|
editTimeCh: dayjs().format('YYYY-MM-DD HH:mm:ss'),
|
|
853
864
|
version: version
|
|
854
865
|
}));
|
|
855
|
-
}, [table.getState().columnVisibility, table.getState().columnPinning, table.getState().columnOrder, table.getState().columnFilters, table.getState().sorting, enableFilters, headerRowNum, compactMode, columnSizing]);
|
|
866
|
+
}, [table.getState().columnVisibility, table.getState().columnPinning, table.getState().columnOrder, table.getState().columnFilters, table.getState().sorting, enableFilters, headerRowNum, compactMode, columnSizing, tableId]);
|
|
856
867
|
var reorderRow = useCallback(function (fromDatas, toDatas) {
|
|
857
868
|
var draggedRow = fromDatas.draggedRow,
|
|
858
869
|
isMultipleDrag = fromDatas.isMultipleDrag,
|
|
@@ -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) => 0 | 1 | -1;
|
|
3
|
+
export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
4
|
+
export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
5
|
+
export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
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) => 0 | 1 | -1;
|
|
8
|
+
stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
9
|
+
timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
10
|
+
numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
|
|
11
11
|
};
|
|
12
12
|
export default customSortFns;
|
|
13
13
|
export type SortFnType = keyof typeof customSortFns | undefined;
|