Skip to content

Commit

Permalink
Merge pull request #821 from gisce/sync/v2-to-v2-develop-20250109-103902
Browse files Browse the repository at this point in the history
fix: sync changes from v2 to v2-develop
  • Loading branch information
mguellsegarra authored Jan 9, 2025
2 parents 7204f58 + aa592fe commit ecad8e5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gisce/react-ooui",
"version": "2.47.0-rc.5",
"version": "2.53.3",
"engines": {
"node": "20.5.0"
},
Expand Down
33 changes: 21 additions & 12 deletions src/widgets/views/SearchTreeInfinite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,16 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) {
],
);

const changeSelectedRowItems = useCallback(
(newSelectedRowItems: any[]) => {
setSelectedRowItems?.(newSelectedRowItems);
onChangeSelectedRowKeys?.(newSelectedRowItems.map((item) => item.id));
},
[onChangeSelectedRowKeys, setSelectedRowItems],
);

const changeSelectedRowKeys = useCallback(
(newSelectedRowKeys: any[]) => {
(newSelectedRowKeys: number[]) => {
setSelectedRowItems?.(newSelectedRowKeys.map((id: number) => ({ id })));
onChangeSelectedRowKeys?.(newSelectedRowKeys);
},
Expand Down Expand Up @@ -460,7 +468,7 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) {

const selectAllPromise = async () => {
if (nameSearch) {
setSelectedRowItems?.(lastAssignedResults.current);
changeSelectedRowItems(lastAssignedResults.current);
return;
}

Expand All @@ -476,7 +484,7 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) {
totalItems: totalRows,
},
);
setSelectedRowItems?.(allRowsResults.map((id: number) => ({ id })));
changeSelectedRowItems(allRowsResults.map((id: number) => ({ id })));
};

if (mustSelectAll) {
Expand All @@ -493,9 +501,10 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) {
selectAllPromise();
}
} else {
setSelectedRowItems?.([]);
setSelectedRowItems([]);
}
}, [
changeSelectedRowItems,
domain,
mergedParams,
model,
Expand Down Expand Up @@ -613,11 +622,11 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) {
}, [searchParams, searchVisible]);

const refresh = useCallback(async () => {
setSelectedRowItems?.([]);
changeSelectedRowItems([]);
currentSearchParamsString.current = undefined;
await updateTotalRows();
tableRef?.current?.refresh();
}, [setSelectedRowItems, updateTotalRows]);
}, [changeSelectedRowItems, updateTotalRows]);

useImperativeHandle(ref, () => ({
refreshResults: refresh,
Expand Down Expand Up @@ -658,28 +667,28 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) {
);

const onSearchFilterClear = useCallback(() => {
setSelectedRowItems?.([]);
changeSelectedRowItems([]);
tableRef.current?.unselectAll();
setSearchTreeNameSearch?.(undefined);
setSearchParams?.([]);
setSearchValues?.(undefined);
}, [
setSelectedRowItems,
changeSelectedRowItems,
setSearchTreeNameSearch,
setSearchParams,
setSearchValues,
]);

const onSearchFilterSubmit = useCallback(
({ params, searchValues }: any) => {
setSelectedRowItems?.([]);
changeSelectedRowItems([]);
tableRef.current?.unselectAll();
setSearchTreeNameSearch?.(undefined);
setSearchParams?.(params);
setSearchValues?.(searchValues);
},
[
setSelectedRowItems,
changeSelectedRowItems,
setSearchTreeNameSearch,
setSearchParams,
setSearchValues,
Expand Down Expand Up @@ -713,15 +722,15 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) {

const onSideSearchFilterSubmit = useCallback(
({ params, values }: any) => {
setSelectedRowItems?.([]);
changeSelectedRowItems([]);
tableRef.current?.unselectAll();
setSearchTreeNameSearch?.(undefined);
setSearchParams?.(params);
setSearchValues?.(values);
setSearchVisible?.(false);
},
[
setSelectedRowItems,
changeSelectedRowItems,
setSearchTreeNameSearch,
setSearchParams,
setSearchValues,
Expand Down

0 comments on commit ecad8e5

Please sign in to comment.