@gisce/react-ooui 2.0.0-alpha.55 → 2.0.0-alpha.57
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/react-ooui.es.js +2113 -2116
- package/dist/react-ooui.es.js.map +1 -1
- package/dist/widgets/base/one2many/One2manyInput.d.ts.map +1 -1
- package/dist/widgets/modals/SearchModal.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/DashboardTree.d.ts.map +1 -1
- package/dist/widgets/views/SearchTree.d.ts.map +1 -1
- package/dist/widgets/views/Tree/Tree.d.ts +2 -1
- package/dist/widgets/views/Tree/Tree.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/widgets/base/one2many/One2manyInput.tsx +5 -4
- package/src/widgets/modals/SearchModal.tsx +2 -4
- package/src/widgets/views/Dashboard/DashboardTree.tsx +2 -0
- package/src/widgets/views/SearchTree.tsx +19 -9
- package/src/widgets/views/Tree/Tree.tsx +11 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"One2manyInput.d.ts","sourceRoot":"","sources":["../../../../src/widgets/base/one2many/One2manyInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AACf,OAAO,EACL,QAAQ,IAAI,YAAY,EAKzB,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAE,KAAK,EAAY,MAAM,SAAS,CAAC;AAkB1C,KAAK,aAAa,GAAG;IACnB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB,CAAC;AAQF,KAAK,YAAY,GAAG;IAClB,SAAS,CAAC,EACN,UAAU,GACV,eAAe,GACf,eAAe,GACf,eAAe,GACf,aAAa,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB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|
1
|
-
{"version":3,"file":"SearchModal.d.ts","sourceRoot":"","sources":["../../../src/widgets/modals/SearchModal.tsx"],"names":[],"mappings":"AAYA,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC3C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,oBAAoB,
|
|
1
|
+
{"version":3,"file":"SearchModal.d.ts","sourceRoot":"","sources":["../../../src/widgets/modals/SearchModal.tsx"],"names":[],"mappings":"AAYA,KAAK,oBAAoB,GAAG;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAC3C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,GAAG,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,oBAAoB,4CA2GtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardTree.d.ts","sourceRoot":"","sources":["../../../../src/widgets/views/Dashboard/DashboardTree.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQnD,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/C,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF,iBAAS,aAAa,CAAC,KAAK,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"DashboardTree.d.ts","sourceRoot":"","sources":["../../../../src/widgets/views/Dashboard/DashboardTree.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAY,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQnD,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/C,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF,iBAAS,aAAa,CAAC,KAAK,EAAE,KAAK,kDA+MlC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchTree.d.ts","sourceRoot":"","sources":["../../../src/widgets/views/SearchTree.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SearchTree.d.ts","sourceRoot":"","sources":["../../../src/widgets/views/SearchTree.tsx"],"names":[],"mappings":"AAAA,OAAO,KASN,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAgBnD,KAAK,gBAAgB,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,uBAAuB,CAAC,EAAE,CAAC,eAAe,EAAE,GAAG,KAAK,IAAI,CAAC;CAC1D,CAAC;;AA6TF,wBAAsC"}
|
|
@@ -10,7 +10,8 @@ type Props = {
|
|
|
10
10
|
showPagination?: boolean;
|
|
11
11
|
onRequestPageChange?: (page: number, pageSize?: number) => void;
|
|
12
12
|
onRowClicked?: (record: any) => void;
|
|
13
|
-
|
|
13
|
+
onRowSelectionChange?: (selectedRowKeys: any[]) => void;
|
|
14
|
+
selectedRowKeys?: number[];
|
|
14
15
|
scrollY?: number;
|
|
15
16
|
colorsForResults?: {
|
|
16
17
|
[key: number]: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.d.ts","sourceRoot":"","sources":["../../../../src/widgets/views/Tree/Tree.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAiBnC,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7C,gBAAgB,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC7C,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACtC,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1C,CAAC;AACF,eAAO,MAAM,IAAI,8CAAgB,KAAK,6CAkPpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gisce/react-ooui",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.57",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "20.5.0"
|
|
6
6
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@gisce/fiber-diagram": "^1.1.0-rc.3",
|
|
37
37
|
"@gisce/ooui": "1.0.0-alpha.21",
|
|
38
38
|
"@gisce/react-formiga-components": "^1.0.9-rc.21",
|
|
39
|
-
"@gisce/react-formiga-table": "1.0.0-alpha.
|
|
39
|
+
"@gisce/react-formiga-table": "1.0.0-alpha.12",
|
|
40
40
|
"@monaco-editor/react": "^4.4.5",
|
|
41
41
|
"@tabler/icons-react": "^2.11.0",
|
|
42
42
|
"antd": "^5.5.2",
|
|
@@ -124,6 +124,7 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
fetchDataIfNeeded();
|
|
127
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
127
128
|
}, [items, currentView]);
|
|
128
129
|
|
|
129
130
|
const fetchDataIfNeeded = useCallback(() => {
|
|
@@ -135,10 +136,12 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
135
136
|
) {
|
|
136
137
|
fetchData();
|
|
137
138
|
}
|
|
139
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
138
140
|
}, [items, currentView]);
|
|
139
141
|
|
|
140
142
|
useEffect(() => {
|
|
141
143
|
parseDomain();
|
|
144
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
142
145
|
}, [domain]);
|
|
143
146
|
|
|
144
147
|
const triggerChange = (changedValue: One2manyItem[]) => {
|
|
@@ -626,10 +629,8 @@ const One2manyInput: React.FC<One2manyInputProps> = (
|
|
|
626
629
|
: undefined
|
|
627
630
|
}
|
|
628
631
|
showPagination={false}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
onChange: setSelectedRowKeys,
|
|
632
|
-
}}
|
|
632
|
+
selectedRowKeys={selectedRowKeys}
|
|
633
|
+
onRowSelectionChange={setSelectedRowKeys}
|
|
633
634
|
sorter={sorter}
|
|
634
635
|
onChangeSort={setSorter}
|
|
635
636
|
context={{ ...getContext?.(), ...context }}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useState, useContext } from "react";
|
|
2
2
|
import { Modal, Button, Divider, Row, Space } from "antd";
|
|
3
3
|
import { FormModal } from "./FormModal";
|
|
4
4
|
import SearchTree from "@/widgets/views/SearchTree";
|
|
@@ -65,9 +65,7 @@ export const SearchModal = (props: SearchSelectionProps) => {
|
|
|
65
65
|
treeScrollY={modalHeight * 0.3}
|
|
66
66
|
domain={domain}
|
|
67
67
|
parentContext={context}
|
|
68
|
-
onChangeSelectedRowKeys={
|
|
69
|
-
setSelectedRowKeys(selectedRowKeys);
|
|
70
|
-
}}
|
|
68
|
+
onChangeSelectedRowKeys={setSelectedRowKeys}
|
|
71
69
|
/>
|
|
72
70
|
<Divider />
|
|
73
71
|
<Row justify="end">
|
|
@@ -116,6 +116,7 @@ function DashboardTree(props: Props) {
|
|
|
116
116
|
if (visible) {
|
|
117
117
|
fetchResults();
|
|
118
118
|
}
|
|
119
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
119
120
|
}, [page, offset, initialFetchDone, visible]);
|
|
120
121
|
|
|
121
122
|
const fetchData = async (type: "action" | "model") => {
|
|
@@ -176,6 +177,7 @@ function DashboardTree(props: Props) {
|
|
|
176
177
|
} else if (model) {
|
|
177
178
|
fetchData("model");
|
|
178
179
|
}
|
|
180
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
179
181
|
}, [action, model]);
|
|
180
182
|
|
|
181
183
|
const onRowClickedHandler = (record: any) => {
|
|
@@ -5,6 +5,8 @@ import React, {
|
|
|
5
5
|
useContext,
|
|
6
6
|
forwardRef,
|
|
7
7
|
useImperativeHandle,
|
|
8
|
+
useMemo,
|
|
9
|
+
useCallback,
|
|
8
10
|
} from "react";
|
|
9
11
|
import { Alert, Spin } from "antd";
|
|
10
12
|
|
|
@@ -109,6 +111,14 @@ function SearchTree(props: Props, ref: any) {
|
|
|
109
111
|
setLimit = undefined,
|
|
110
112
|
} = (rootTree ? actionViewContext : {}) || {};
|
|
111
113
|
|
|
114
|
+
const changeSelectedRowKeys = useCallback(
|
|
115
|
+
(newSelectedRowKeys: any[]) => {
|
|
116
|
+
setSelectedRowItems?.(newSelectedRowKeys.map((id: number) => ({ id })));
|
|
117
|
+
onChangeSelectedRowKeys?.(newSelectedRowKeys);
|
|
118
|
+
},
|
|
119
|
+
[onChangeSelectedRowKeys, setSelectedRowItems],
|
|
120
|
+
);
|
|
121
|
+
|
|
112
122
|
const {
|
|
113
123
|
submit,
|
|
114
124
|
clear,
|
|
@@ -170,6 +180,7 @@ function SearchTree(props: Props, ref: any) {
|
|
|
170
180
|
searchNameGetDoneRef.current = false;
|
|
171
181
|
fetchResults();
|
|
172
182
|
}
|
|
183
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
173
184
|
}, [page, offset, initialFetchDone, visible, nameSearch, treeView]);
|
|
174
185
|
|
|
175
186
|
const fetchData = async () => {
|
|
@@ -218,6 +229,7 @@ function SearchTree(props: Props, ref: any) {
|
|
|
218
229
|
|
|
219
230
|
useEffect(() => {
|
|
220
231
|
fetchData();
|
|
232
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
221
233
|
}, [model]);
|
|
222
234
|
|
|
223
235
|
const onSearchTreeLimitChange = (newLimit: number) => {
|
|
@@ -269,11 +281,6 @@ function SearchTree(props: Props, ref: any) {
|
|
|
269
281
|
});
|
|
270
282
|
};
|
|
271
283
|
|
|
272
|
-
function changeSelectedRowKeys(selectedRowKeys: any[]) {
|
|
273
|
-
setSelectedRowItems?.(selectedRowKeys.map((id: number) => ({ id })));
|
|
274
|
-
onChangeSelectedRowKeys?.(selectedRowKeys);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
284
|
async function selectAllRecords() {
|
|
278
285
|
const allIds = await getAllIds();
|
|
279
286
|
setSelectedRowItems?.(allIds.map((id: number) => ({ id })));
|
|
@@ -287,6 +294,11 @@ function SearchTree(props: Props, ref: any) {
|
|
|
287
294
|
return height - (searchFilterHeight + 240);
|
|
288
295
|
}
|
|
289
296
|
|
|
297
|
+
const selectedRowKeys = useMemo(
|
|
298
|
+
() => selectedRowItems?.map((item) => item.id),
|
|
299
|
+
[selectedRowItems],
|
|
300
|
+
);
|
|
301
|
+
|
|
290
302
|
const content = () => {
|
|
291
303
|
if (!treeView || !formView) {
|
|
292
304
|
return null;
|
|
@@ -324,10 +336,8 @@ function SearchTree(props: Props, ref: any) {
|
|
|
324
336
|
scrollY={treeScrollY || calculateTableHeight()}
|
|
325
337
|
colorsForResults={colorsForResults}
|
|
326
338
|
statusForResults={statusForResults}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
onChange: changeSelectedRowKeys,
|
|
330
|
-
}}
|
|
339
|
+
selectedRowKeys={selectedRowKeys}
|
|
340
|
+
onRowSelectionChange={changeSelectedRowKeys}
|
|
331
341
|
sorter={sorter}
|
|
332
342
|
onChangeSort={changeSort}
|
|
333
343
|
onFetchChildrenForRecord={
|
|
@@ -34,7 +34,8 @@ type Props = {
|
|
|
34
34
|
showPagination?: boolean;
|
|
35
35
|
onRequestPageChange?: (page: number, pageSize?: number) => void;
|
|
36
36
|
onRowClicked?: (record: any) => void;
|
|
37
|
-
|
|
37
|
+
onRowSelectionChange?: (selectedRowKeys: any[]) => void;
|
|
38
|
+
selectedRowKeys?: number[];
|
|
38
39
|
scrollY?: number;
|
|
39
40
|
colorsForResults?: { [key: number]: string };
|
|
40
41
|
statusForResults?: { [key: number]: string };
|
|
@@ -58,7 +59,8 @@ export const Tree = memo((props: Props) => {
|
|
|
58
59
|
loading,
|
|
59
60
|
onRowClicked,
|
|
60
61
|
showPagination = true,
|
|
61
|
-
|
|
62
|
+
selectedRowKeys = [],
|
|
63
|
+
onRowSelectionChange,
|
|
62
64
|
scrollY,
|
|
63
65
|
colorsForResults = {},
|
|
64
66
|
statusForResults = {},
|
|
@@ -142,9 +144,7 @@ export const Tree = memo((props: Props) => {
|
|
|
142
144
|
}
|
|
143
145
|
|
|
144
146
|
const numberOfVisibleSelectedRows = items?.filter(
|
|
145
|
-
(entry) =>
|
|
146
|
-
rowSelection?.selectedRowKeys &&
|
|
147
|
-
rowSelection?.selectedRowKeys.includes(entry.id),
|
|
147
|
+
(entry) => selectedRowKeys && selectedRowKeys.includes(entry.id),
|
|
148
148
|
).length;
|
|
149
149
|
|
|
150
150
|
return loading ? null : total === undefined ? (
|
|
@@ -166,9 +166,7 @@ export const Tree = memo((props: Props) => {
|
|
|
166
166
|
<Col span={8} className="text-center">
|
|
167
167
|
<SelectAllRecordsRow
|
|
168
168
|
numberOfVisibleSelectedRows={numberOfVisibleSelectedRows}
|
|
169
|
-
numberOfRealSelectedRows={
|
|
170
|
-
rowSelection?.selectedRowKeys?.length || 0
|
|
171
|
-
}
|
|
169
|
+
numberOfRealSelectedRows={selectedRowKeys?.length || 0}
|
|
172
170
|
numberOfTotalRows={items.length}
|
|
173
171
|
totalRecords={total || 0}
|
|
174
172
|
onSelectAllRecords={onSelectAllRecords}
|
|
@@ -186,7 +184,7 @@ export const Tree = memo((props: Props) => {
|
|
|
186
184
|
onRequestPageChange,
|
|
187
185
|
onSelectAllRecords,
|
|
188
186
|
page,
|
|
189
|
-
|
|
187
|
+
selectedRowKeys,
|
|
190
188
|
showPagination,
|
|
191
189
|
summary,
|
|
192
190
|
total,
|
|
@@ -209,9 +207,9 @@ export const Tree = memo((props: Props) => {
|
|
|
209
207
|
|
|
210
208
|
const summary: string[] = [];
|
|
211
209
|
const sumItems =
|
|
212
|
-
|
|
210
|
+
selectedRowKeys?.length > 0
|
|
213
211
|
? items.filter((result: any) => {
|
|
214
|
-
return
|
|
212
|
+
return selectedRowKeys.includes(result.id);
|
|
215
213
|
})
|
|
216
214
|
: items;
|
|
217
215
|
|
|
@@ -226,7 +224,7 @@ export const Tree = memo((props: Props) => {
|
|
|
226
224
|
});
|
|
227
225
|
|
|
228
226
|
return <div className="p-1 pb-0 pl-2 mt-2 ">{summary.join(", ")}</div>;
|
|
229
|
-
}, [items,
|
|
227
|
+
}, [items, selectedRowKeys, treeOoui]);
|
|
230
228
|
|
|
231
229
|
const dataTable = useMemo(() => {
|
|
232
230
|
if (treeOoui !== null && columns && columns.length > 0) {
|
|
@@ -273,8 +271,7 @@ export const Tree = memo((props: Props) => {
|
|
|
273
271
|
: undefined
|
|
274
272
|
}
|
|
275
273
|
onRowDoubleClick={onRowClicked}
|
|
276
|
-
|
|
277
|
-
onRowSelectionChange={rowSelection?.onChange}
|
|
274
|
+
onRowSelectionChange={onRowSelectionChange}
|
|
278
275
|
onChangeSort={onChangeSort}
|
|
279
276
|
sorter={sorter}
|
|
280
277
|
readonly={readonly}
|