Skip to content

Commit a3f9e29

Browse files
committed
tooltip added to autocomplete
1 parent b9c42b5 commit a3f9e29

File tree

2 files changed

+45
-23
lines changed

2 files changed

+45
-23
lines changed

client/packages/lowcoder-design/src/components/Section.tsx

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import styled from "styled-components";
44
import { ReactComponent as Packup } from "icons/icon-Pack-up.svg";
55
import { labelCss } from "./Label";
66
import { controlItem, ControlNode } from "./control";
7+
import { Tooltip } from "./toolTip";
78

89
const SectionItem = styled.div<{ $width?: number }>`
910
width: ${(props) => (props.$width ? props.$width : 312)}px;
@@ -73,6 +74,12 @@ const ShowChildren = styled.div<{ $show?: string; $noMargin?: boolean }>`
7374
padding-right: ${(props) => (props.$noMargin ? 0 : "16px")};
7475
`;
7576

77+
const TooltipWrapper = styled.a`
78+
word-wrap: break-word;
79+
word-break: break-word;
80+
white-space: pre-wrap;
81+
color:#fff;
82+
`;
7683
interface ISectionConfig<T> {
7784
name?: string;
7885
open?: boolean;
@@ -81,6 +88,7 @@ interface ISectionConfig<T> {
8188
style?: React.CSSProperties;
8289
children: T;
8390
additionalButton?: React.ReactNode;
91+
tooltip?:string
8492
}
8593

8694
export interface PropertySectionState {
@@ -102,7 +110,8 @@ export const PropertySectionContext = React.createContext<PropertySectionContext
102110
});
103111

104112
export const BaseSection = (props: ISectionConfig<ReactNode>) => {
105-
const { name } = props;
113+
const { name,tooltip } = props;
114+
console.log("🚀 ~ BaseSection ~ name:", name)
106115
const { compName, state, toggle } = useContext(PropertySectionContext);
107116
const open = props.open !== undefined ? props.open : name ? state[compName]?.[name] !== false : true;
108117

@@ -118,17 +127,27 @@ export const BaseSection = (props: ISectionConfig<ReactNode>) => {
118127
return (
119128
<SectionItem $width={props.width} style={props.style}>
120129
{props.name && (
121-
<SectionLabelDiv onClick={handleToggle} className={"section-header"}>
130+
<SectionLabelDiv onClick={handleToggle} className={'section-header'}>
122131
<SectionLabel>{props.name}</SectionLabel>
123-
<div style={{ display: "flex" }}>
132+
<div style={{display: 'flex'}}>
124133
{open && props.additionalButton}
125-
<PackupIcon deg={open ? "rotate(0deg)" : "rotate(180deg)"} />
134+
<PackupIcon deg={open ? 'rotate(0deg)' : 'rotate(180deg)'} />
126135
</div>
127136
</SectionLabelDiv>
128137
)}
129-
<ShowChildren $show={open ? "flex" : "none"} $noMargin={props.noMargin}>
130-
{props.children}
131-
</ShowChildren>
138+
<Tooltip
139+
title={tooltip && <TooltipWrapper href={tooltip}>{tooltip}</TooltipWrapper>}
140+
arrow={{
141+
pointAtCenter: true,
142+
}}
143+
placement="top"
144+
color="#2c2c2c"
145+
getPopupContainer={(node: any) => node.closest('.react-grid-item')}
146+
>
147+
<ShowChildren $show={open ? 'flex' : 'none'} $noMargin={props.noMargin}>
148+
{props.children}
149+
</ShowChildren>
150+
</Tooltip>
132151
</SectionItem>
133152
);
134153
};

client/packages/lowcoder/src/comps/comps/autoCompleteComp/autoCompleteComp.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -293,38 +293,38 @@ let AutoCompleteCompBase = (function () {
293293
return (
294294
<>
295295
<Section>
296-
{children.autoCompleteType.getView() === "normal" &&
296+
{children.autoCompleteType.getView() === 'normal' &&
297297
children.prefixIcon.propertyView({
298-
label: trans("button.prefixIcon"),
298+
label: trans('button.prefixIcon'),
299299
})}
300-
{children.autoCompleteType.getView() === "normal" &&
300+
{children.autoCompleteType.getView() === 'normal' &&
301301
children.suffixIcon.propertyView({
302-
label: trans("button.suffixIcon"),
302+
label: trans('button.suffixIcon'),
303303
})}
304-
{allowClearPropertyView(children)}
304+
{allowClearPropertyView(children)}
305305
</Section>
306-
<Section name={trans("autoComplete.SectionDataName")}>
306+
<Section name={trans('autoComplete.SectionDataName')}>
307307
{children.items.propertyView({
308-
label: trans("autoComplete.value"),
308+
label: trans('autoComplete.value'),
309309
tooltip: itemsDataTooltip,
310-
placeholder: "[]",
310+
placeholder: '[]',
311311
})}
312-
{getDayJSLocale() === "zh-cn" &&
312+
{getDayJSLocale() === 'zh-cn' &&
313313
children.searchFirstPY.propertyView({
314-
label: trans("autoComplete.searchFirstPY"),
314+
label: trans('autoComplete.searchFirstPY'),
315315
})}
316-
{getDayJSLocale() === "zh-cn" &&
316+
{getDayJSLocale() === 'zh-cn' &&
317317
children.searchCompletePY.propertyView({
318-
label: trans("autoComplete.searchCompletePY"),
318+
label: trans('autoComplete.searchCompletePY'),
319319
})}
320320
{children.searchLabelOnly.propertyView({
321-
label: trans("autoComplete.searchLabelOnly"),
321+
label: trans('autoComplete.searchLabelOnly'),
322322
})}
323323
{children.ignoreCase.propertyView({
324-
label: trans("autoComplete.ignoreCase"),
324+
label: trans('autoComplete.ignoreCase'),
325325
})}
326326
{children.valueOrLabel.propertyView({
327-
label: trans("autoComplete.checkedValueFrom"),
327+
label: trans('autoComplete.checkedValueFrom'),
328328
radioButton: true,
329329
})}
330330
</Section>
@@ -350,7 +350,10 @@ let AutoCompleteCompBase = (function () {
350350
<Section name={sectionNames.inputFieldStyle}>
351351
{children.inputFieldStyle.getPropertyView()}
352352
</Section>
353-
<Section name={sectionNames.animationStyle}>
353+
<Section
354+
name={sectionNames.animationStyle}
355+
tooltip="https://animate.style/"
356+
>
354357
{children.animationStyle.getPropertyView()}
355358
</Section>
356359
</>

0 commit comments

Comments
 (0)