es-grid-template 1.9.71 → 1.9.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/es/ali-table/Grid.d.ts +2 -1
- package/es/ali-table/Grid.js +12 -5
- package/es/ali-table/InternalTable.js +45 -94
- package/es/ali-table/base-table/cell/HeaderEditCell.js +4 -1
- package/es/ali-table/base-table/renderFilter.js +13 -5
- package/es/ali-table/base-table/styles.d.ts +6 -0
- package/es/ali-table/base-table/styles.js +5 -2
- package/es/ali-table/pipeline/features/columnCustom.d.ts +1 -0
- package/es/ali-table/pipeline/features/columnCustom.js +38 -25
- package/es/ali-table/pipeline/features/hiddenColumns.d.ts +1 -0
- package/es/ali-table/pipeline/features/hiddenColumns.js +9 -3
- package/es/ali-table/pipeline/features/treeSelect.js +3 -3
- package/es/ali-table/utils/constants.d.ts +3 -1
- package/es/ali-table/utils/constants.js +5 -2
- package/es/ali-table/utils/utility.d.ts +1 -0
- package/es/ali-table/utils/utility.js +8 -1
- package/es/grid-component/hooks/constant.js +4 -0
- package/es/group-component/hook/useColumns.js +2 -2
- package/es/group-component/hook/utils.d.ts +3 -3
- package/es/group-component/hook/utils.js +3 -0
- package/es/table-component/ColumnsConfig.js +6 -4
- package/es/table-component/TableContainer.js +1 -0
- package/es/table-component/TableContainerEdit.js +1 -0
- package/es/table-component/hook/utils.js +3 -0
- package/es/table-component/table/Grid.js +2 -2
- package/es/table-component/table/TableWrapper.js +97 -33
- package/es/table-virtuoso/hook/utils.js +3 -0
- package/lib/ali-table/Grid.d.ts +2 -1
- package/lib/ali-table/Grid.js +12 -4
- package/lib/ali-table/InternalTable.js +45 -94
- package/lib/ali-table/base-table/cell/HeaderEditCell.js +4 -1
- package/lib/ali-table/base-table/renderFilter.js +13 -5
- package/lib/ali-table/base-table/styles.d.ts +6 -0
- package/lib/ali-table/base-table/styles.js +5 -2
- package/lib/ali-table/pipeline/features/columnCustom.d.ts +1 -0
- package/lib/ali-table/pipeline/features/columnCustom.js +38 -25
- package/lib/ali-table/pipeline/features/hiddenColumns.d.ts +1 -0
- package/lib/ali-table/pipeline/features/hiddenColumns.js +9 -3
- package/lib/ali-table/pipeline/features/treeSelect.js +3 -3
- package/lib/ali-table/utils/constants.d.ts +3 -1
- package/lib/ali-table/utils/constants.js +6 -3
- package/lib/ali-table/utils/utility.d.ts +1 -0
- package/lib/ali-table/utils/utility.js +10 -2
- package/lib/grid-component/hooks/constant.js +4 -0
- package/lib/group-component/hook/useColumns.js +2 -2
- package/lib/group-component/hook/utils.js +3 -0
- package/lib/table-component/ColumnsConfig.js +6 -4
- package/lib/table-component/TableContainer.js +1 -0
- package/lib/table-component/TableContainerEdit.js +1 -0
- package/lib/table-component/hook/utils.js +3 -0
- package/lib/table-component/table/Grid.js +2 -2
- package/lib/table-component/table/TableWrapper.js +97 -33
- package/lib/table-virtuoso/hook/utils.js +3 -0
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export declare const stateKeyResize = "columnResize";
|
|
2
2
|
export declare const stateKeyFilter = "columnsFilter";
|
|
3
|
+
export declare const stateKeyColumnFilter = "columnFilter";
|
|
3
4
|
export declare const stateKeySorter = "columnsSorter";
|
|
4
5
|
export declare const stateKeyVisible = "visible";
|
|
5
6
|
export declare const stateKeyTooltip = "tooltip";
|
|
6
7
|
export declare const stateKeyPagination = "pagination";
|
|
7
|
-
export declare const
|
|
8
|
+
export declare const stateKeyVisibleKeys = "columnVisibleKeys";
|
|
9
|
+
export declare const stateKeyGroupKeys = "columnGroupKeys";
|
|
8
10
|
export declare const stateKeyFocusedCell = "focusedCell";
|
|
9
11
|
export declare const stateKeyIsEditing = "isEditing";
|
|
10
12
|
export declare const stateKeyStartPasteCell = "startPasteCell";
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export const stateKeyResize = 'columnResize';
|
|
2
|
-
export const stateKeyFilter = 'columnsFilter';
|
|
2
|
+
export const stateKeyFilter = 'columnsFilter'; // array all state
|
|
3
|
+
export const stateKeyColumnFilter = 'columnFilter'; // current column filter state
|
|
4
|
+
|
|
3
5
|
export const stateKeySorter = 'columnsSorter';
|
|
4
6
|
export const stateKeyVisible = 'visible';
|
|
5
7
|
export const stateKeyTooltip = 'tooltip';
|
|
6
8
|
export const stateKeyPagination = 'pagination';
|
|
7
|
-
export const
|
|
9
|
+
export const stateKeyVisibleKeys = 'columnVisibleKeys';
|
|
10
|
+
export const stateKeyGroupKeys = 'columnGroupKeys';
|
|
8
11
|
|
|
9
12
|
// Key for Edit
|
|
10
13
|
|
|
@@ -24,4 +24,5 @@ export declare function updateOrInsert<T extends Row>(dataArray: T[], dataFilter
|
|
|
24
24
|
export declare function filterVisibleColumns<T extends ColumnTable>(columns: T[]): T[];
|
|
25
25
|
export declare const sortByType: (arr: ColumnTable[], rowDnd?: RowDnd) => ColumnTable[];
|
|
26
26
|
export declare function getVisibleColumnFields<T extends ColumnTable>(columns: T[]): string[];
|
|
27
|
+
export declare const getOnlyInA: (a: string[], b: string[]) => string[];
|
|
27
28
|
export {};
|
|
@@ -94,6 +94,9 @@ export const shouldIncludeOptimized = (item, queries, ignoreAccents = true) => {
|
|
|
94
94
|
case 'contains':
|
|
95
95
|
condition = ignoreAccents === false ? itemValue?.includes(value) : itemStr.includes(compareValue);
|
|
96
96
|
break;
|
|
97
|
+
case 'notcontains':
|
|
98
|
+
condition = ignoreAccents === false ? !itemValue?.includes(value) : !itemStr.includes(compareValue);
|
|
99
|
+
break;
|
|
97
100
|
case 'startswith':
|
|
98
101
|
condition = ignoreAccents === false ? itemValue?.startsWith(value) : itemStr.startsWith(compareValue);
|
|
99
102
|
break;
|
|
@@ -692,4 +695,8 @@ export function getVisibleColumnFields(columns) {
|
|
|
692
695
|
};
|
|
693
696
|
traverse(columns);
|
|
694
697
|
return result;
|
|
695
|
-
}
|
|
698
|
+
}
|
|
699
|
+
export const getOnlyInA = (a, b) => {
|
|
700
|
+
const setB = new Set(b);
|
|
701
|
+
return a.filter(item => !setB.has(item));
|
|
702
|
+
};
|
|
@@ -204,12 +204,12 @@ export const toggleRowSelection = props => {
|
|
|
204
204
|
} else {
|
|
205
205
|
// chưa selected
|
|
206
206
|
|
|
207
|
-
const checkedRows = [...prevSelected, row];
|
|
207
|
+
const checkedRows = [...prevSelected, row.original];
|
|
208
208
|
setIsSelectionChange({
|
|
209
209
|
isChange: true,
|
|
210
210
|
type: 'rowSelected',
|
|
211
211
|
rowData: row.original,
|
|
212
|
-
rowsData: selectionSettings?.type === 'single' ? [row] : checkedRows
|
|
212
|
+
rowsData: selectionSettings?.type === 'single' ? [row.original] : checkedRows
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
return;
|
|
@@ -196,10 +196,10 @@ export declare const fixColumnsLeft: <RecordType>(columns: ColumnTable<RecordTyp
|
|
|
196
196
|
value: any;
|
|
197
197
|
rowData: RecordType;
|
|
198
198
|
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNode);
|
|
199
|
-
onCellStyles?: Omit<CSSProperties, "
|
|
200
|
-
onCellHeaderStyles?: Omit<CSSProperties, "
|
|
199
|
+
onCellStyles?: Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position"> | ((cellValue: any, cell: import("@tanstack/react-table").Cell<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position">);
|
|
200
|
+
onCellHeaderStyles?: Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position"> | ((cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position">);
|
|
201
201
|
onCell?: (rowData: RecordType, index: number) => import("react").TdHTMLAttributes<HTMLTableCellElement>;
|
|
202
|
-
onCellFooterStyles?: Omit<CSSProperties, "
|
|
202
|
+
onCellFooterStyles?: Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position"> | ((cellValue: any, cell: import("@tanstack/react-table").Header<RecordType, unknown>) => Omit<CSSProperties, "left" | "right" | "display" | "width" | "minWidth" | "position">);
|
|
203
203
|
getValue?: (row: any, rowIndex: number) => any;
|
|
204
204
|
getCellProps?: (value: any, row: any, rowIndex: number) => import("./../../grid-component/type").CellProps;
|
|
205
205
|
headerCellProps?: import("./../../grid-component/type").CellProps;
|
|
@@ -801,6 +801,9 @@ export const shouldInclude = (item, queries) => {
|
|
|
801
801
|
case "contains":
|
|
802
802
|
condition = itemStr?.includes(queryStr);
|
|
803
803
|
break;
|
|
804
|
+
case "notcontains":
|
|
805
|
+
condition = !itemStr?.includes(queryStr);
|
|
806
|
+
break;
|
|
804
807
|
case "startswith":
|
|
805
808
|
condition = itemStr?.startsWith(queryStr);
|
|
806
809
|
break;
|
|
@@ -60,6 +60,7 @@ export const ColumnsConfig = props => {
|
|
|
60
60
|
};
|
|
61
61
|
const handleAccept = () => {
|
|
62
62
|
triggerChangeColumns?.(tmpColumn, [], 'columnChoose');
|
|
63
|
+
setCurrentRow('');
|
|
63
64
|
onClose();
|
|
64
65
|
};
|
|
65
66
|
const handleChange = newElemt => {
|
|
@@ -109,10 +110,11 @@ export const ColumnsConfig = props => {
|
|
|
109
110
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Input, {
|
|
110
111
|
defaultValue: value,
|
|
111
112
|
allowClear: true,
|
|
113
|
+
autoFocus: true,
|
|
112
114
|
onBlur: e => {
|
|
113
115
|
const newData = {
|
|
114
116
|
...rowData,
|
|
115
|
-
|
|
117
|
+
headerText: e.target.value
|
|
116
118
|
};
|
|
117
119
|
handleChange(newData);
|
|
118
120
|
}
|
|
@@ -209,7 +211,7 @@ export const ColumnsConfig = props => {
|
|
|
209
211
|
} = args;
|
|
210
212
|
if (currentRow === rowData.field) {
|
|
211
213
|
return /*#__PURE__*/React.createElement(InputNumber, {
|
|
212
|
-
defaultValue: value,
|
|
214
|
+
defaultValue: value ?? 150,
|
|
213
215
|
style: {
|
|
214
216
|
width: '100%'
|
|
215
217
|
},
|
|
@@ -217,13 +219,13 @@ export const ColumnsConfig = props => {
|
|
|
217
219
|
onBlur: e => {
|
|
218
220
|
const newData = {
|
|
219
221
|
...rowData,
|
|
220
|
-
|
|
222
|
+
width: e.target.value ? Number(e.target.value) : 150
|
|
221
223
|
};
|
|
222
224
|
handleChange(newData);
|
|
223
225
|
}
|
|
224
226
|
});
|
|
225
227
|
}
|
|
226
|
-
return /*#__PURE__*/React.createElement("span", null, value);
|
|
228
|
+
return /*#__PURE__*/React.createElement("span", null, value ?? 150, "px");
|
|
227
229
|
}
|
|
228
230
|
}];
|
|
229
231
|
const handleReset = () => {
|
|
@@ -1069,6 +1069,9 @@ export const shouldInclude = (item, queries, ignoreAccents) => {
|
|
|
1069
1069
|
case "contains":
|
|
1070
1070
|
condition = ignoreAccents === false ? itemValue?.includes(value) : itemStr?.includes(queryStr);
|
|
1071
1071
|
break;
|
|
1072
|
+
case "notcontains":
|
|
1073
|
+
condition = ignoreAccents === false ? !itemValue?.includes(value) : !itemStr?.includes(queryStr);
|
|
1074
|
+
break;
|
|
1072
1075
|
case "startswith":
|
|
1073
1076
|
condition = ignoreAccents === false ? itemValue?.startsWith(value) : itemStr?.startsWith(queryStr);
|
|
1074
1077
|
break;
|
|
@@ -64,8 +64,8 @@ const Grid = props => {
|
|
|
64
64
|
const [columnResizeMode] = React.useState('onChange');
|
|
65
65
|
const [columnResizeDirection] = React.useState('ltr');
|
|
66
66
|
const [paginationState, setPagination] = React.useState({
|
|
67
|
-
pageIndex: pagination && pagination
|
|
68
|
-
pageSize: pagination && pagination
|
|
67
|
+
pageIndex: pagination && pagination?.currentPage ? pagination.currentPage - 1 : 0,
|
|
68
|
+
pageSize: pagination && pagination?.pageSize ? pagination.pageSize : 20
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
// const [rowSelection, setRowSelection] = React.useState<RowSelectionState>({})
|
|
@@ -7,7 +7,6 @@ import { Tooltip } from "react-tooltip";
|
|
|
7
7
|
import ContextMenu from "../ContextMenu";
|
|
8
8
|
import React, { useContext } from "react";
|
|
9
9
|
import { TableContext } from "../useContext";
|
|
10
|
-
import { isNullOrUndefined } from "../hook/utils";
|
|
11
10
|
const TableWrapper = props => {
|
|
12
11
|
const {
|
|
13
12
|
id,
|
|
@@ -40,6 +39,12 @@ const TableWrapper = props => {
|
|
|
40
39
|
const menuRef = React.useRef(null);
|
|
41
40
|
const loadingRef = React.useRef(false);
|
|
42
41
|
const hasMoreRef = React.useRef(true);
|
|
42
|
+
const pendingPageRef = React.useRef(null);
|
|
43
|
+
const pendingDataLengthRef = React.useRef(0);
|
|
44
|
+
const sawLoadingRef = React.useRef(false);
|
|
45
|
+
const lastScrollTopRef = React.useRef(0);
|
|
46
|
+
// const directionRef = React.useRef<'up' | 'down' | null>(null);
|
|
47
|
+
|
|
43
48
|
const {
|
|
44
49
|
windowSize
|
|
45
50
|
} = useContext(TableContext);
|
|
@@ -48,6 +53,23 @@ const TableWrapper = props => {
|
|
|
48
53
|
pageSize,
|
|
49
54
|
total
|
|
50
55
|
} = pagination ?? {};
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
if (pendingPageRef.current === null) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (loading) {
|
|
61
|
+
sawLoadingRef.current = true;
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const pageLoaded = currentPage >= pendingPageRef.current;
|
|
65
|
+
const dataLoaded = dataSource.length !== pendingDataLengthRef.current;
|
|
66
|
+
const requestFinished = sawLoadingRef.current;
|
|
67
|
+
if (pageLoaded || dataLoaded || requestFinished) {
|
|
68
|
+
loadingRef.current = false;
|
|
69
|
+
pendingPageRef.current = null;
|
|
70
|
+
sawLoadingRef.current = false;
|
|
71
|
+
}
|
|
72
|
+
}, [currentPage, dataSource.length, loading]);
|
|
51
73
|
const [menuVisible, setMenuVisible] = React.useState(false);
|
|
52
74
|
const [selectedRowData, setSelectedRowData] = React.useState(undefined);
|
|
53
75
|
const [position, setPosition] = React.useState({
|
|
@@ -74,46 +96,88 @@ const TableWrapper = props => {
|
|
|
74
96
|
const loadData = page => {
|
|
75
97
|
if (!hasMoreRef.current || loadingRef.current || loading) return;
|
|
76
98
|
loadingRef.current = true;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}, 10);
|
|
99
|
+
pendingPageRef.current = page;
|
|
100
|
+
pendingDataLengthRef.current = dataSource.length;
|
|
101
|
+
next?.();
|
|
102
|
+
if (pageSize && total && page * pageSize >= total) {
|
|
103
|
+
hasMoreRef.current = false;
|
|
104
|
+
}
|
|
84
105
|
};
|
|
85
106
|
const handleNext = () => {
|
|
86
107
|
loadData(currentPage + 1);
|
|
87
108
|
};
|
|
88
109
|
const handleScroll = e => {
|
|
89
|
-
if (infiniteScroll) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
e.preventDefault();
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
const {
|
|
96
|
-
scrollHeight: tbScrollHeight,
|
|
97
|
-
scrollTop,
|
|
98
|
-
clientHeight
|
|
99
|
-
} = e.currentTarget;
|
|
100
|
-
const abc = clientHeight * (isNullOrUndefined(onEndReachedThreshold) ? 0.1 : onEndReachedThreshold ?? 0);
|
|
110
|
+
// if (infiniteScroll) {
|
|
111
|
+
// const current = e.currentTarget.scrollTop;
|
|
112
|
+
// const last = lastScrollTopRef.current;
|
|
101
113
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
114
|
+
// if (loadingRef.current || loading || dataSource?.length === 0 || current === last) {
|
|
115
|
+
|
|
116
|
+
// e.stopPropagation()
|
|
117
|
+
// e.preventDefault()
|
|
118
|
+
// return
|
|
119
|
+
// }
|
|
120
|
+
|
|
121
|
+
// const { scrollHeight: tbScrollHeight, scrollTop, clientHeight } = e.currentTarget;
|
|
122
|
+
|
|
123
|
+
// const abc = clientHeight * (isNullOrUndefined(onEndReachedThreshold) ? 0.1 : onEndReachedThreshold ?? 0)
|
|
124
|
+
|
|
125
|
+
// // const isEnd = scrollTop + clientHeight >= tbScrollHeight - 50;
|
|
126
|
+
// const isEnd = scrollTop + clientHeight >= tbScrollHeight - abc;
|
|
127
|
+
|
|
128
|
+
// if (isEnd && !loadingRef.current && hasMoreRef.current && dataSource?.length > 0) {
|
|
129
|
+
|
|
130
|
+
// handleNext()
|
|
131
|
+
|
|
132
|
+
// }
|
|
133
|
+
// }
|
|
134
|
+
|
|
135
|
+
// if (e.target.scrollLeft >= 0 && e.target.scrollLeft + e.target.clientWidth < e.target.scrollWidth) {
|
|
136
|
+
// e.target.classList.add('ui-rc-table-ping-right')
|
|
137
|
+
// } else {
|
|
138
|
+
// e.target.classList.remove('ui-rc-table-ping-right')
|
|
139
|
+
// }
|
|
140
|
+
|
|
141
|
+
// if ((e.target.scrollLeft ?? 0) > 0) {
|
|
142
|
+
// e.target.classList.add('ui-rc-table-ping-left')
|
|
143
|
+
// } else {
|
|
144
|
+
// e.target.classList.remove('ui-rc-table-ping-left')
|
|
145
|
+
// }
|
|
146
|
+
|
|
147
|
+
const target = e.currentTarget;
|
|
148
|
+
|
|
149
|
+
// Horizontal scroll
|
|
150
|
+
const {
|
|
151
|
+
scrollLeft,
|
|
152
|
+
clientWidth,
|
|
153
|
+
scrollWidth,
|
|
154
|
+
clientHeight
|
|
155
|
+
} = target;
|
|
156
|
+
target.classList.toggle('ui-rc-table-ping-left', scrollLeft > 0);
|
|
157
|
+
target.classList.toggle('ui-rc-table-ping-right', scrollLeft + clientWidth < scrollWidth);
|
|
158
|
+
if (!infiniteScroll) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const {
|
|
162
|
+
scrollTop,
|
|
163
|
+
scrollHeight
|
|
164
|
+
} = target;
|
|
165
|
+
const last = lastScrollTopRef.current;
|
|
166
|
+
|
|
167
|
+
// Update ngay
|
|
168
|
+
lastScrollTopRef.current = scrollTop;
|
|
169
|
+
|
|
170
|
+
// Chỉ xử lý khi scroll DOWN
|
|
171
|
+
if (scrollTop <= last) {
|
|
172
|
+
return;
|
|
107
173
|
}
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
} else {
|
|
111
|
-
e.target.classList.remove('ui-rc-table-ping-right');
|
|
174
|
+
if (loadingRef.current || loading || !dataSource?.length || !hasMoreRef.current) {
|
|
175
|
+
return;
|
|
112
176
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
177
|
+
const thresholdRatio = onEndReachedThreshold ?? 0.1;
|
|
178
|
+
const threshold = clientHeight * thresholdRatio;
|
|
179
|
+
if (scrollTop + clientHeight >= scrollHeight - threshold) {
|
|
180
|
+
handleNext();
|
|
117
181
|
}
|
|
118
182
|
};
|
|
119
183
|
const onContextMenu = args => event => {
|
|
@@ -849,6 +849,9 @@ export const shouldInclude = (item, queries) => {
|
|
|
849
849
|
case "contains":
|
|
850
850
|
condition = itemStr?.includes(queryStr);
|
|
851
851
|
break;
|
|
852
|
+
case "notcontains":
|
|
853
|
+
condition = !itemStr?.includes(queryStr);
|
|
854
|
+
break;
|
|
852
855
|
case "startswith":
|
|
853
856
|
condition = itemStr?.startsWith(queryStr);
|
|
854
857
|
break;
|
package/lib/ali-table/Grid.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ declare const Grid: React.ForwardRefExoticComponent<Omit<TableProps, "useVirtual
|
|
|
12
12
|
pipeline: TablePipeline;
|
|
13
13
|
originData: any[];
|
|
14
14
|
originColumns: any[];
|
|
15
|
-
setVisibleKeys: Dispatch<SetStateAction<any>>;
|
|
16
15
|
useVirtual?: VirtualEnum | {
|
|
17
16
|
horizontal?: VirtualEnum;
|
|
18
17
|
vertical?: VirtualEnum;
|
|
@@ -22,5 +21,7 @@ declare const Grid: React.ForwardRefExoticComponent<Omit<TableProps, "useVirtual
|
|
|
22
21
|
toolbarItemTopRight?: ToolbarItem[];
|
|
23
22
|
toolbarItemsTop?: ToolbarItem[];
|
|
24
23
|
toolbarItemsBottom?: ToolbarItem[];
|
|
24
|
+
isDataTree?: boolean;
|
|
25
|
+
setColumns: Dispatch<SetStateAction<any>>;
|
|
25
26
|
} & React.RefAttributes<BaseTable>>;
|
|
26
27
|
export default Grid;
|
package/lib/ali-table/Grid.js
CHANGED
|
@@ -23,6 +23,7 @@ var _styles2 = require("./base-table/styles");
|
|
|
23
23
|
var _ColumnsConfig = require("../table-component/ColumnsConfig");
|
|
24
24
|
var _utils = require("../table-component/hook/utils");
|
|
25
25
|
var _utility = require("./utils/utility");
|
|
26
|
+
var _constants = require("./utils/constants");
|
|
26
27
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
27
28
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
28
29
|
// import type { TableProps } from "../table-component"
|
|
@@ -64,9 +65,11 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
64
65
|
onRowStyles,
|
|
65
66
|
showColumnChoose,
|
|
66
67
|
originColumns,
|
|
68
|
+
striped,
|
|
69
|
+
isDataTree,
|
|
67
70
|
// columns,
|
|
68
71
|
groupColumns,
|
|
69
|
-
setVisibleKeys,
|
|
72
|
+
// setVisibleKeys,
|
|
70
73
|
footerDataSource,
|
|
71
74
|
loading,
|
|
72
75
|
useVirtual,
|
|
@@ -78,7 +81,8 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
78
81
|
toolbarItemsBottom,
|
|
79
82
|
toolbarItemTopRight,
|
|
80
83
|
toolbarItemsTop,
|
|
81
|
-
onChooseColumns
|
|
84
|
+
onChooseColumns,
|
|
85
|
+
setColumns
|
|
82
86
|
} = props;
|
|
83
87
|
const {
|
|
84
88
|
cssVariables
|
|
@@ -169,12 +173,14 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
169
173
|
}, []);
|
|
170
174
|
const triggerChangeColumns = (cols, keys, type) => {
|
|
171
175
|
const abc = (0, _utility.getVisibleColumnFields)(cols);
|
|
172
|
-
setVisibleKeys(abc)
|
|
176
|
+
// setVisibleKeys(abc)
|
|
177
|
+
pipeline.setStateAtKey(_constants.stateKeyVisibleKeys, abc);
|
|
173
178
|
if (type === 'cellClick') {
|
|
174
179
|
|
|
175
180
|
// setColumns(cols)
|
|
176
181
|
} else {
|
|
177
|
-
|
|
182
|
+
console.log('setColumns');
|
|
183
|
+
setColumns(cols);
|
|
178
184
|
// pipeline.columns(cols)
|
|
179
185
|
|
|
180
186
|
// const aa = flatColumns2(columns).map((it) => it.field)
|
|
@@ -353,6 +359,8 @@ const Grid = /*#__PURE__*/_react.default.forwardRef((props, ref) => {
|
|
|
353
359
|
...prevRowProps,
|
|
354
360
|
className: (0, _classnames.default)(``, {
|
|
355
361
|
[`${prefix}-grid-row-parent`]: row.children && row.children.length > 0 || Array.isArray(row.children),
|
|
362
|
+
[`${prefix}-grid-row-odd`]: !editAble && !isDataTree && striped && rowIndex % 2 === 1,
|
|
363
|
+
[`${prefix}-grid-row-even`]: !editAble && !isDataTree && striped && rowIndex % 2 === 0,
|
|
356
364
|
'no-hover': editAble
|
|
357
365
|
}),
|
|
358
366
|
style: {
|