From aa592fe0dd0b39e08c660f7f68e8ca11596d8b52 Mon Sep 17 00:00:00 2001 From: mguellsegarra <5711443+mguellsegarra@users.noreply.github.com> Date: Thu, 9 Jan 2025 10:39:03 +0000 Subject: [PATCH] fix: sync changes from v2 to v2-develop --- package-lock.json | 4 +-- package.json | 2 +- src/widgets/views/SearchTreeInfinite.tsx | 33 +++++++++++++++--------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index f58105dc..80444f94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gisce/react-ooui", - "version": "2.47.0-rc.5", + "version": "2.53.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gisce/react-ooui", - "version": "2.47.0-rc.5", + "version": "2.53.3", "dependencies": { "@ant-design/colors": "^7.2.0", "@ant-design/plots": "^1.0.9", diff --git a/package.json b/package.json index 4b1edf1f..3ec4b6b8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gisce/react-ooui", - "version": "2.47.0-rc.5", + "version": "2.53.3", "engines": { "node": "20.5.0" }, diff --git a/src/widgets/views/SearchTreeInfinite.tsx b/src/widgets/views/SearchTreeInfinite.tsx index edda4270..e91ed2d6 100644 --- a/src/widgets/views/SearchTreeInfinite.tsx +++ b/src/widgets/views/SearchTreeInfinite.tsx @@ -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); }, @@ -460,7 +468,7 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) { const selectAllPromise = async () => { if (nameSearch) { - setSelectedRowItems?.(lastAssignedResults.current); + changeSelectedRowItems(lastAssignedResults.current); return; } @@ -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) { @@ -493,9 +501,10 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) { selectAllPromise(); } } else { - setSelectedRowItems?.([]); + setSelectedRowItems([]); } }, [ + changeSelectedRowItems, domain, mergedParams, model, @@ -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, @@ -658,13 +667,13 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) { ); const onSearchFilterClear = useCallback(() => { - setSelectedRowItems?.([]); + changeSelectedRowItems([]); tableRef.current?.unselectAll(); setSearchTreeNameSearch?.(undefined); setSearchParams?.([]); setSearchValues?.(undefined); }, [ - setSelectedRowItems, + changeSelectedRowItems, setSearchTreeNameSearch, setSearchParams, setSearchValues, @@ -672,14 +681,14 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) { const onSearchFilterSubmit = useCallback( ({ params, searchValues }: any) => { - setSelectedRowItems?.([]); + changeSelectedRowItems([]); tableRef.current?.unselectAll(); setSearchTreeNameSearch?.(undefined); setSearchParams?.(params); setSearchValues?.(searchValues); }, [ - setSelectedRowItems, + changeSelectedRowItems, setSearchTreeNameSearch, setSearchParams, setSearchValues, @@ -713,7 +722,7 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) { const onSideSearchFilterSubmit = useCallback( ({ params, values }: any) => { - setSelectedRowItems?.([]); + changeSelectedRowItems([]); tableRef.current?.unselectAll(); setSearchTreeNameSearch?.(undefined); setSearchParams?.(params); @@ -721,7 +730,7 @@ function SearchTreeInfiniteComp(props: SearchTreeInfiniteProps, ref: any) { setSearchVisible?.(false); }, [ - setSelectedRowItems, + changeSelectedRowItems, setSearchTreeNameSearch, setSearchParams, setSearchValues,