@gisce/react-ooui 0.7.0 → 0.7.1
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/helpers/treeHelper.d.ts +6 -1
- package/dist/helpers/treeHelper.d.ts.map +1 -1
- package/dist/helpers/treeHelper.js +27 -1
- package/dist/helpers/treeHelper.js.map +1 -1
- package/dist/index.js +62 -1
- package/dist/index.js.LICENSE.txt +15 -0
- package/dist/widgets/views/Dashboard/DashboardTree.d.ts.map +1 -1
- package/dist/widgets/views/Dashboard/DashboardTree.js +11 -27
- package/dist/widgets/views/Dashboard/DashboardTree.js.map +1 -1
- package/dist/widgets/views/Form.d.ts.map +1 -1
- package/dist/widgets/views/Form.js +15 -48
- package/dist/widgets/views/Form.js.map +1 -1
- package/dist/widgets/views/SearchTree.d.ts.map +1 -1
- package/dist/widgets/views/SearchTree.js +39 -40
- package/dist/widgets/views/SearchTree.js.map +1 -1
- package/dist/widgets/views/Tree.d.ts +1 -1
- package/dist/widgets/views/Tree.d.ts.map +1 -1
- package/dist/widgets/views/Tree.js +6 -28
- package/dist/widgets/views/Tree.js.map +1 -1
- package/package.json +4 -1
- package/src/helpers/treeHelper.ts +41 -0
- package/src/stories/views/SearchTree.stories.tsx +324 -162
- package/src/widgets/views/Dashboard/DashboardTree.tsx +13 -36
- package/src/widgets/views/Form.tsx +8 -52
- package/src/widgets/views/SearchTree.tsx +43 -49
- package/src/widgets/views/Tree.tsx +12 -45
|
@@ -5,7 +5,7 @@ import Tree from "@/widgets/views/Tree";
|
|
|
5
5
|
import { FormView, TreeView } from "@/types/index";
|
|
6
6
|
import ConnectionProvider from "@/ConnectionProvider";
|
|
7
7
|
|
|
8
|
-
import { getColorMap, getTree } from "@/helpers/treeHelper";
|
|
8
|
+
import { getColorMap, getTree, sortResults } from "@/helpers/treeHelper";
|
|
9
9
|
|
|
10
10
|
const DEFAULT_SEARCH_LIMIT = 80;
|
|
11
11
|
|
|
@@ -117,7 +117,12 @@ function DashboardTree(props: Props) {
|
|
|
117
117
|
setTotalItems(totalItems);
|
|
118
118
|
setColorsForResults(getColorMap(attrsEvaluated));
|
|
119
119
|
|
|
120
|
-
const resultsSorted = sortResults(
|
|
120
|
+
const resultsSorted = sortResults({
|
|
121
|
+
resultsToSort: results,
|
|
122
|
+
sorter: sorter,
|
|
123
|
+
fields: { ...treeView!.fields, ...formView!.fields },
|
|
124
|
+
});
|
|
125
|
+
|
|
121
126
|
setResults(resultsSorted);
|
|
122
127
|
};
|
|
123
128
|
|
|
@@ -211,38 +216,6 @@ function DashboardTree(props: Props) {
|
|
|
211
216
|
});
|
|
212
217
|
};
|
|
213
218
|
|
|
214
|
-
function sortResults(resultsToSort: any[], sorter: any) {
|
|
215
|
-
if (!sorter) {
|
|
216
|
-
return resultsToSort;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
const { field, order } = sorter;
|
|
220
|
-
const fields = { ...treeView!.fields, ...formView!.fields };
|
|
221
|
-
const type = fields[field].type;
|
|
222
|
-
|
|
223
|
-
const sortFn = (a: any, b: any) => {
|
|
224
|
-
let aItem = a[field] || "",
|
|
225
|
-
bItem = b[field] || "";
|
|
226
|
-
|
|
227
|
-
if (type === "many2one") {
|
|
228
|
-
aItem = a[field]?.value || "";
|
|
229
|
-
bItem = b[field]?.value || "";
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (aItem === bItem) {
|
|
233
|
-
return 0;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (order === "ascend") {
|
|
237
|
-
return aItem > bItem ? 1 : -1;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
return aItem < bItem ? 1 : -1;
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
return resultsToSort.sort(sortFn);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
219
|
const content = () => {
|
|
247
220
|
if (!treeView || !formView) {
|
|
248
221
|
return null;
|
|
@@ -257,7 +230,6 @@ function DashboardTree(props: Props) {
|
|
|
257
230
|
showPagination={false}
|
|
258
231
|
total={totalItems}
|
|
259
232
|
limit={limitRef.current}
|
|
260
|
-
disableScroll
|
|
261
233
|
page={page}
|
|
262
234
|
treeView={treeView}
|
|
263
235
|
results={results}
|
|
@@ -265,9 +237,14 @@ function DashboardTree(props: Props) {
|
|
|
265
237
|
loading={tableRefreshing}
|
|
266
238
|
onRowClicked={onRowClickedHandler}
|
|
267
239
|
colorsForResults={colorsForResults}
|
|
240
|
+
sorter={sorter}
|
|
268
241
|
onChangeSort={(newSorter) => {
|
|
269
242
|
setSorter?.(newSorter);
|
|
270
|
-
const sortedResults = sortResults(
|
|
243
|
+
const sortedResults = sortResults({
|
|
244
|
+
resultsToSort: results,
|
|
245
|
+
sorter: newSorter,
|
|
246
|
+
fields: { ...treeView.fields, ...formView.fields },
|
|
247
|
+
});
|
|
271
248
|
setResults(sortedResults);
|
|
272
249
|
}}
|
|
273
250
|
/>
|
|
@@ -6,7 +6,7 @@ import React, {
|
|
|
6
6
|
useRef,
|
|
7
7
|
useContext,
|
|
8
8
|
} from "react";
|
|
9
|
-
import { Form as FormOoui
|
|
9
|
+
import { Form as FormOoui } from "@gisce/ooui";
|
|
10
10
|
import {
|
|
11
11
|
Form as AntForm,
|
|
12
12
|
Button,
|
|
@@ -115,7 +115,6 @@ function Form(props: FormProps, ref: any) {
|
|
|
115
115
|
const [fields, setFields] = useState<any>();
|
|
116
116
|
const formModalContext = useContext(FormModalContext) as FormModalContextType;
|
|
117
117
|
const [containerWidth, setContainerWidth] = useState<any>();
|
|
118
|
-
const [defaultGetCalled, setDefaultGetCalled] = useState<boolean>(false);
|
|
119
118
|
|
|
120
119
|
const createdId = useRef<number>();
|
|
121
120
|
const originalFormValues = useRef<any>({});
|
|
@@ -183,15 +182,6 @@ function Form(props: FormProps, ref: any) {
|
|
|
183
182
|
fetchData();
|
|
184
183
|
}, [id, model, valuesProps, formViewProps, visible]);
|
|
185
184
|
|
|
186
|
-
useEffect(() => {
|
|
187
|
-
if (defaultGetCalled) {
|
|
188
|
-
checkFieldsChanges({
|
|
189
|
-
elementHasLostFocus: true,
|
|
190
|
-
});
|
|
191
|
-
setDefaultGetCalled(false);
|
|
192
|
-
}
|
|
193
|
-
}, [defaultGetCalled]);
|
|
194
|
-
|
|
195
185
|
const onSubmitSucceed = (id?: number, values?: any, formValues?: any) => {
|
|
196
186
|
setFormHasChanges?.(false);
|
|
197
187
|
setFormIsSaving?.(false);
|
|
@@ -347,7 +337,6 @@ function Form(props: FormProps, ref: any) {
|
|
|
347
337
|
let values;
|
|
348
338
|
let _fields;
|
|
349
339
|
let _arch;
|
|
350
|
-
let hasDefaultGetCalled;
|
|
351
340
|
|
|
352
341
|
setFormIsLoading?.(true);
|
|
353
342
|
setError(undefined);
|
|
@@ -363,13 +352,10 @@ function Form(props: FormProps, ref: any) {
|
|
|
363
352
|
if (valuesProps) {
|
|
364
353
|
values = valuesProps;
|
|
365
354
|
} else {
|
|
366
|
-
({
|
|
367
|
-
values,
|
|
368
|
-
defaultGetCalled: hasDefaultGetCalled,
|
|
369
|
-
} = await fetchValuesFromApi({
|
|
355
|
+
values = await fetchValuesFromApi({
|
|
370
356
|
fields: _fields,
|
|
371
357
|
arch: _arch!,
|
|
372
|
-
})
|
|
358
|
+
});
|
|
373
359
|
}
|
|
374
360
|
|
|
375
361
|
if (actionDomain) {
|
|
@@ -379,18 +365,9 @@ function Form(props: FormProps, ref: any) {
|
|
|
379
365
|
originalFormValues.current = processValues(values, _fields);
|
|
380
366
|
|
|
381
367
|
parseForm({ fields: _fields, arch: _arch!, values });
|
|
382
|
-
assignNewValuesToForm({
|
|
383
|
-
values,
|
|
384
|
-
fields: _fields,
|
|
385
|
-
reset: true,
|
|
386
|
-
isDefaultGet: hasDefaultGetCalled,
|
|
387
|
-
});
|
|
368
|
+
assignNewValuesToForm({ values, fields: _fields, reset: true });
|
|
388
369
|
setFormIsLoading?.(false);
|
|
389
370
|
setFormHasChanges?.(false);
|
|
390
|
-
|
|
391
|
-
if (hasDefaultGetCalled) {
|
|
392
|
-
setDefaultGetCalled(true);
|
|
393
|
-
}
|
|
394
371
|
};
|
|
395
372
|
|
|
396
373
|
function setOriginalValue(field: string, value: any) {
|
|
@@ -443,12 +420,10 @@ function Form(props: FormProps, ref: any) {
|
|
|
443
420
|
values: newValues,
|
|
444
421
|
fields,
|
|
445
422
|
reset,
|
|
446
|
-
isDefaultGet = false,
|
|
447
423
|
}: {
|
|
448
424
|
values: any;
|
|
449
425
|
fields: any;
|
|
450
426
|
reset: boolean;
|
|
451
|
-
isDefaultGet?: boolean;
|
|
452
427
|
}) => {
|
|
453
428
|
const currentValues = reset ? {} : antForm.getFieldsValue(true);
|
|
454
429
|
const mergedValues = { ...currentValues, ...newValues };
|
|
@@ -465,10 +440,7 @@ function Form(props: FormProps, ref: any) {
|
|
|
465
440
|
};
|
|
466
441
|
});
|
|
467
442
|
|
|
468
|
-
|
|
469
|
-
lastAssignedValues.current = valuesProcessed;
|
|
470
|
-
}
|
|
471
|
-
|
|
443
|
+
lastAssignedValues.current = valuesProcessed;
|
|
472
444
|
antForm.setFields(fieldsToUpdate);
|
|
473
445
|
};
|
|
474
446
|
|
|
@@ -480,8 +452,6 @@ function Form(props: FormProps, ref: any) {
|
|
|
480
452
|
arch: string;
|
|
481
453
|
}) => {
|
|
482
454
|
let values = {};
|
|
483
|
-
let defaultGetCalled = false;
|
|
484
|
-
|
|
485
455
|
if (getCurrentId()!) {
|
|
486
456
|
values = (
|
|
487
457
|
await ConnectionProvider.getHandler().readObjects({
|
|
@@ -506,9 +476,8 @@ function Form(props: FormProps, ref: any) {
|
|
|
506
476
|
} else {
|
|
507
477
|
setAttachments?.([]);
|
|
508
478
|
values = await getDefaultValues(fields);
|
|
509
|
-
defaultGetCalled = true;
|
|
510
479
|
}
|
|
511
|
-
return
|
|
480
|
+
return values;
|
|
512
481
|
};
|
|
513
482
|
|
|
514
483
|
const submitApi = async (options?: { callOnSubmitSucceed?: boolean }) => {
|
|
@@ -802,20 +771,7 @@ function Form(props: FormProps, ref: any) {
|
|
|
802
771
|
) {
|
|
803
772
|
onSubmitSucceed?.(getCurrentId(), getValues(), getFormValues());
|
|
804
773
|
} else if (response.type) {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
if (response.context) {
|
|
808
|
-
responseContext = parseContext({
|
|
809
|
-
context: response.context,
|
|
810
|
-
fields,
|
|
811
|
-
values: getValues(),
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
await runAction({
|
|
816
|
-
actionData: response,
|
|
817
|
-
context: { ...context, ...responseContext },
|
|
818
|
-
});
|
|
774
|
+
await runAction({ actionData: response, context });
|
|
819
775
|
} else {
|
|
820
776
|
await fetchValues();
|
|
821
777
|
}
|
|
@@ -866,9 +822,9 @@ function Form(props: FormProps, ref: any) {
|
|
|
866
822
|
fields,
|
|
867
823
|
values: getValues(),
|
|
868
824
|
context: {
|
|
825
|
+
...context,
|
|
869
826
|
...parentContext,
|
|
870
827
|
...formOoui?.context,
|
|
871
|
-
...context,
|
|
872
828
|
},
|
|
873
829
|
onRefreshParentValues: () => {
|
|
874
830
|
fetchValues();
|
|
@@ -5,6 +5,7 @@ import React, {
|
|
|
5
5
|
useContext,
|
|
6
6
|
forwardRef,
|
|
7
7
|
useImperativeHandle,
|
|
8
|
+
useCallback,
|
|
8
9
|
} from "react";
|
|
9
10
|
import { Alert, Spin } from "antd";
|
|
10
11
|
|
|
@@ -17,7 +18,7 @@ import {
|
|
|
17
18
|
ActionViewContext,
|
|
18
19
|
ActionViewContextType,
|
|
19
20
|
} from "@/context/ActionViewContext";
|
|
20
|
-
import { getColorMap, getTree } from "@/helpers/treeHelper";
|
|
21
|
+
import { getColorMap, getTree, sortResults } from "@/helpers/treeHelper";
|
|
21
22
|
import useWindowDimensions from "@/hooks/useWindowDimensions";
|
|
22
23
|
import Measure from "react-measure";
|
|
23
24
|
import { mergeSearchFields } from "@/helpers/formHelper";
|
|
@@ -94,6 +95,8 @@ function SearchTree(props: Props, ref: any) {
|
|
|
94
95
|
const actionDomain = useRef<any>([]);
|
|
95
96
|
const [searchFilterHeight, setSearchFilterHeight] = useState<number>(200);
|
|
96
97
|
|
|
98
|
+
const originalResults = useRef<any[]>([]);
|
|
99
|
+
|
|
97
100
|
const { height } = useWindowDimensions();
|
|
98
101
|
|
|
99
102
|
const actionViewContext = useContext(
|
|
@@ -114,7 +117,6 @@ function SearchTree(props: Props, ref: any) {
|
|
|
114
117
|
setTotalItems: setActionViewTotalItems = undefined,
|
|
115
118
|
setSearchTreeNameSearch = undefined,
|
|
116
119
|
setTreeIsLoading = undefined,
|
|
117
|
-
treeIsLoading = false,
|
|
118
120
|
} = (rootTree ? actionViewContext : {}) || {};
|
|
119
121
|
|
|
120
122
|
useImperativeHandle(ref, () => ({
|
|
@@ -131,16 +133,16 @@ function SearchTree(props: Props, ref: any) {
|
|
|
131
133
|
};
|
|
132
134
|
|
|
133
135
|
function setResults(results: any) {
|
|
134
|
-
setResultsActionView?.(results);
|
|
135
|
-
setResultsInternal(results);
|
|
136
|
+
setResultsActionView?.([...results]);
|
|
137
|
+
setResultsInternal([...results]);
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
|
|
140
|
+
const getResults = useCallback(() => {
|
|
139
141
|
if (!resultsActionView) {
|
|
140
142
|
return resultsInternal;
|
|
141
143
|
}
|
|
142
144
|
return resultsActionView;
|
|
143
|
-
}
|
|
145
|
+
}, [resultsActionView, resultsInternal]);
|
|
144
146
|
|
|
145
147
|
const searchByNameSearch = async () => {
|
|
146
148
|
const searchResults = await ConnectionProvider.getHandler().nameSearch({
|
|
@@ -175,12 +177,21 @@ function SearchTree(props: Props, ref: any) {
|
|
|
175
177
|
);
|
|
176
178
|
const resultsData = resultsWithData[0];
|
|
177
179
|
|
|
180
|
+
originalResults.current = [...resultsData];
|
|
181
|
+
|
|
178
182
|
setColorsForResults(getColorMap(resultsWithData[1]));
|
|
179
|
-
setResults(resultsData);
|
|
180
183
|
|
|
181
184
|
const newResultIds = resultsData.map((item: any) => item.id);
|
|
182
185
|
|
|
183
|
-
const resultsSorted =
|
|
186
|
+
const resultsSorted =
|
|
187
|
+
sorter !== undefined
|
|
188
|
+
? sortResults({
|
|
189
|
+
resultsToSort: resultsData,
|
|
190
|
+
sorter,
|
|
191
|
+
fields: { ...treeView!.fields, ...formView!.fields },
|
|
192
|
+
})
|
|
193
|
+
: [...originalResults.current];
|
|
194
|
+
|
|
184
195
|
setResults(resultsSorted);
|
|
185
196
|
|
|
186
197
|
if (newResultIds.length > 0) {
|
|
@@ -251,7 +262,17 @@ function SearchTree(props: Props, ref: any) {
|
|
|
251
262
|
setActionViewTotalItems?.(totalItems);
|
|
252
263
|
setColorsForResults(getColorMap(attrsEvaluated));
|
|
253
264
|
|
|
254
|
-
|
|
265
|
+
originalResults.current = [...results];
|
|
266
|
+
|
|
267
|
+
const resultsSorted =
|
|
268
|
+
sorter !== undefined
|
|
269
|
+
? sortResults({
|
|
270
|
+
resultsToSort: results,
|
|
271
|
+
sorter: sorter,
|
|
272
|
+
fields: { ...treeView!.fields, ...formView!.fields },
|
|
273
|
+
})
|
|
274
|
+
: [...originalResults.current];
|
|
275
|
+
|
|
255
276
|
setResults(resultsSorted);
|
|
256
277
|
|
|
257
278
|
if (resultsActionView && resultsSorted.length > 0) {
|
|
@@ -418,49 +439,14 @@ function SearchTree(props: Props, ref: any) {
|
|
|
418
439
|
});
|
|
419
440
|
};
|
|
420
441
|
|
|
421
|
-
function changeSelectedRowKeys(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
setSelectedRowItems?.(items);
|
|
442
|
+
function changeSelectedRowKeys(selectedRowItems: any[]) {
|
|
443
|
+
setSelectedRowItems?.(selectedRowItems);
|
|
444
|
+
const selectedRowKeys = selectedRowItems.map((entry: any) => entry.id);
|
|
427
445
|
onChangeSelectedRowKeys?.(selectedRowKeys);
|
|
428
446
|
}
|
|
429
447
|
|
|
430
448
|
function calculateTableHeight() {
|
|
431
|
-
return height - (searchFilterHeight +
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
function sortResults(resultsToSort: any[], sorter: any) {
|
|
435
|
-
if (!sorter) {
|
|
436
|
-
return resultsToSort;
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
const { field, order } = sorter;
|
|
440
|
-
const fields = { ...treeView!.fields, ...formView!.fields };
|
|
441
|
-
const type = fields[field].type;
|
|
442
|
-
|
|
443
|
-
const sortFn = (a: any, b: any) => {
|
|
444
|
-
let aItem = a[field] || "",
|
|
445
|
-
bItem = b[field] || "";
|
|
446
|
-
|
|
447
|
-
if (type === "many2one") {
|
|
448
|
-
aItem = a[field]?.value || "";
|
|
449
|
-
bItem = b[field]?.value || "";
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
if (aItem === bItem) {
|
|
453
|
-
return 0;
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (order === "ascend") {
|
|
457
|
-
return aItem > bItem ? 1 : -1;
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
return aItem < bItem ? 1 : -1;
|
|
461
|
-
};
|
|
462
|
-
|
|
463
|
-
return resultsToSort.sort(sortFn);
|
|
449
|
+
return height - (searchFilterHeight + 210);
|
|
464
450
|
}
|
|
465
451
|
|
|
466
452
|
const content = () => {
|
|
@@ -520,9 +506,17 @@ function SearchTree(props: Props, ref: any) {
|
|
|
520
506
|
selectedRowKeys: selectedRowItems?.map((item) => item.id),
|
|
521
507
|
onChange: changeSelectedRowKeys,
|
|
522
508
|
}}
|
|
509
|
+
sorter={sorter}
|
|
523
510
|
onChangeSort={(newSorter) => {
|
|
524
511
|
setSorter?.(newSorter);
|
|
525
|
-
const sortedResults =
|
|
512
|
+
const sortedResults =
|
|
513
|
+
newSorter !== undefined
|
|
514
|
+
? sortResults({
|
|
515
|
+
resultsToSort: getResults(),
|
|
516
|
+
sorter: newSorter,
|
|
517
|
+
fields: { ...treeView.fields, ...formView.fields },
|
|
518
|
+
})
|
|
519
|
+
: [...originalResults.current];
|
|
526
520
|
setResults(sortedResults);
|
|
527
521
|
}}
|
|
528
522
|
/>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useContext, useEffect, useRef, useState } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { Pagination, Checkbox, Space, Row, Col, Spin } from "antd";
|
|
3
3
|
import { getTree, getTableColumns, getTableItems } from "@/helpers/treeHelper";
|
|
4
4
|
import { Tree as TreeOoui } from "@gisce/ooui";
|
|
5
5
|
|
|
@@ -9,17 +9,8 @@ import { Many2oneSuffix } from "../base/many2one/Many2oneSuffix";
|
|
|
9
9
|
import { calculateColumnsWidth } from "@/helpers/dynamicColumnsHelper";
|
|
10
10
|
import { parseFloatToString } from "@/helpers/timeHelper";
|
|
11
11
|
import { ProgressBarInput } from "../base/ProgressBar";
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
interface TableProps {
|
|
15
|
-
minHeight: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const StyledTable = styled(Table)`
|
|
19
|
-
.ant-table-body {
|
|
20
|
-
min-height: ${(props: TableProps) => props.minHeight}px;
|
|
21
|
-
}
|
|
22
|
-
`;
|
|
12
|
+
import { Table as GisceTable } from "@gisce/react-formiga-table";
|
|
13
|
+
import useDeepCompareEffect from "use-deep-compare-effect";
|
|
23
14
|
|
|
24
15
|
type Props = {
|
|
25
16
|
total: number;
|
|
@@ -35,7 +26,7 @@ type Props = {
|
|
|
35
26
|
scrollY?: number;
|
|
36
27
|
colorsForResults?: { [key: number]: string };
|
|
37
28
|
onChangeSort?: (results: any) => void;
|
|
38
|
-
|
|
29
|
+
sorter?: any;
|
|
39
30
|
};
|
|
40
31
|
|
|
41
32
|
const booleanComponentFn = (value: boolean): React.ReactElement => {
|
|
@@ -94,7 +85,7 @@ function Tree(props: Props): React.ReactElement {
|
|
|
94
85
|
scrollY,
|
|
95
86
|
colorsForResults = {},
|
|
96
87
|
onChangeSort,
|
|
97
|
-
|
|
88
|
+
sorter,
|
|
98
89
|
} = props;
|
|
99
90
|
|
|
100
91
|
const [items, setItems] = useState<Array<any>>([]);
|
|
@@ -119,6 +110,7 @@ function Tree(props: Props): React.ReactElement {
|
|
|
119
110
|
float_time: floatTimeComponent,
|
|
120
111
|
image: imageComponent,
|
|
121
112
|
});
|
|
113
|
+
|
|
122
114
|
setColumns(columns);
|
|
123
115
|
}, [treeView]);
|
|
124
116
|
|
|
@@ -220,32 +212,12 @@ function Tree(props: Props): React.ReactElement {
|
|
|
220
212
|
) : (
|
|
221
213
|
<div>
|
|
222
214
|
{pagination()}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
<div key={result.id}>
|
|
226
|
-
<br />
|
|
227
|
-
<span>{result.name}</span>
|
|
228
|
-
</div>
|
|
229
|
-
);
|
|
230
|
-
})} */}
|
|
231
|
-
<StyledTable
|
|
232
|
-
minHeight={adjustedHeight!}
|
|
215
|
+
<GisceTable
|
|
216
|
+
height={adjustedHeight!}
|
|
233
217
|
columns={dataTable.columns}
|
|
234
|
-
scroll={
|
|
235
|
-
disableScroll
|
|
236
|
-
? undefined
|
|
237
|
-
: { x: dataTable.tableWidth, y: adjustedHeight }
|
|
238
|
-
}
|
|
239
|
-
size="small"
|
|
240
218
|
dataSource={items}
|
|
241
|
-
pagination={false}
|
|
242
219
|
loading={loading}
|
|
243
|
-
|
|
244
|
-
return `cursor-pointer select-none record-row-${record.id}`;
|
|
245
|
-
}}
|
|
246
|
-
rowKey={(item: any) => {
|
|
247
|
-
return item.id;
|
|
248
|
-
}}
|
|
220
|
+
loadingComponent={<Spin />}
|
|
249
221
|
onRow={(record: any) => {
|
|
250
222
|
let style = undefined;
|
|
251
223
|
|
|
@@ -260,14 +232,9 @@ function Tree(props: Props): React.ReactElement {
|
|
|
260
232
|
},
|
|
261
233
|
};
|
|
262
234
|
}}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
onChangeSort?.(undefined);
|
|
267
|
-
} else {
|
|
268
|
-
onChangeSort?.(sorter);
|
|
269
|
-
}
|
|
270
|
-
}}
|
|
235
|
+
onRowSelectionChange={rowSelection?.onChange}
|
|
236
|
+
onChangeSort={onChangeSort}
|
|
237
|
+
sorter={sorter}
|
|
271
238
|
/>
|
|
272
239
|
{getSums()}
|
|
273
240
|
</div>
|