Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe1affe

Browse files
fix: show component sectios open in right panel in search state
1 parent2bf6d87 commitfe1affe

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

‎client/packages/lowcoder/src/pages/editor/right/uiCompPanel.tsx‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
RightPanelContentWrapper,
1414
}from"pages/editor/right/styledComponent";
1515
import{tableDragClassName}from"pages/tutorials/tutorialsConstant";
16-
importReact,{useContext,useMemo,useState}from"react";
16+
importReact,{useContext,useEffect,useMemo,useState}from"react";
1717
importstyledfrom"styled-components";
1818
import{
1919
BaseSection,
@@ -99,6 +99,7 @@ Object.keys(uiCompCategoryNames).forEach((cat) => {
9999
exportconstUICompPanel=()=>{
100100
const{ onDrag, searchValue}=useContext(RightContext);
101101
const[propertySectionState,setPropertySectionState]=useState<PropertySectionState>(initialState);
102+
const[searchedPropertySectionState,setSearchedPropertySectionState]=useState<PropertySectionState>({});
102103

103104
constcategories=useMemo(()=>{
104105
constcats:Record<string,[string,UICompManifest][]>=Object.fromEntries(
@@ -113,11 +114,18 @@ export const UICompPanel = () => {
113114
},[]);
114115

115116
constpropertySectionContextValue=useMemo<PropertySectionContextType>(()=>{
117+
conststate=searchValue
118+
?searchedPropertySectionState
119+
:propertySectionState;
120+
constsetStateFn=searchValue
121+
?setSearchedPropertySectionState
122+
:setPropertySectionState;
123+
116124
return{
117125
compName:stateCompName,
118-
state:propertySectionState,
126+
state,
119127
toggle:(compName:string,sectionName:string)=>{
120-
setPropertySectionState((oldState)=>{
128+
setStateFn((oldState)=>{
121129
constnextSectionState:PropertySectionState={ ...oldState};
122130
constcompState=nextSectionState[compName]||{};
123131
compState[sectionName]=compState[sectionName]===false;
@@ -126,7 +134,13 @@ export const UICompPanel = () => {
126134
});
127135
},
128136
};
129-
},[propertySectionState]);
137+
},[searchValue,propertySectionState,searchedPropertySectionState]);
138+
139+
useEffect(()=>{
140+
if(!searchValue){
141+
setSearchedPropertySectionState({})
142+
}
143+
},[searchValue])
130144

131145
constcompList=useMemo(
132146
()=>
@@ -187,7 +201,6 @@ export const UICompPanel = () => {
187201

188202
return(
189203
<RightPanelContentWrapper>
190-
{/* {compList.length > 0 ? compList : <EmptyCompContent />} */}
191204
<PropertySectionContext.Provider
192205
value={propertySectionContextValue}
193206
>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp