Skip to content

Commit 4effe28

Browse files
fix icon comp, icon button when no icon is selected
1 parent 8fa22ee commit 4effe28

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

client/packages/lowcoder/src/comps/controls/iconControl.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ export const IconControlView = memo((props: { value: string }) => {
224224
return renderIcon;
225225
}
226226

227-
return <StyledImage src={value} alt="" />;
227+
if (value) {
228+
return <StyledImage src={value} alt="" />;
229+
}
230+
231+
return '';
228232
}, [icon, value, IconDictionary[value]])
229233
});
230234

client/packages/lowcoder/src/comps/controls/iconscoutControl.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export const IconPicker = (props: {
224224
label?: ReactNode;
225225
IconType?: "OnlyAntd" | "All" | "default" | undefined;
226226
}) => {
227+
const draggableRef = useRef<HTMLDivElement>(null);
227228
const [ visible, setVisible ] = useState(false)
228229
const [ loading, setLoading ] = useState(false)
229230
const [ downloading, setDownloading ] = useState(false)
@@ -234,7 +235,7 @@ export const IconPicker = (props: {
234235
const mediaPackSubscription = subscriptions.find(
235236
sub => sub.product === SubscriptionProductsEnum.MEDIAPACKAGE && sub.status === 'active'
236237
);
237-
238+
238239
const onChangeRef = useRef(props.onChange);
239240
onChangeRef.current = props.onChange;
240241

@@ -388,8 +389,8 @@ export const IconPicker = (props: {
388389
}}
389390
destroyTooltipOnHide
390391
content={
391-
<Draggable handle=".dragHandle">
392-
<PopupContainer>
392+
<Draggable handle=".dragHandle" nodeRef={draggableRef}>
393+
<PopupContainer ref={draggableRef}>
393394
<TitleDiv className="dragHandle">
394395
<TitleText>{popupTitle}</TitleText>
395396
<StyledCloseIcon onClick={() => setVisible(false)} />

0 commit comments

Comments
 (0)