Skip to content

Feature/tooltip on animation #929

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 deletions client/packages/lowcoder-design/src/components/Section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from "styled-components";
import { ReactComponent as Packup } from "icons/icon-Pack-up.svg";
import { labelCss } from "./Label";
import { controlItem, ControlNode } from "./control";
import { Tooltip } from "./toolTip";

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

const TooltipWrapper = styled.span`
word-wrap: break-word;
word-break: break-word;
white-space: pre-wrap;
color:#fff;
`;
interface ISectionConfig<T> {
name?: string;
open?: boolean;
Expand All @@ -81,6 +88,7 @@ interface ISectionConfig<T> {
style?: React.CSSProperties;
children: T;
additionalButton?: React.ReactNode;
hasTooltip?: boolean;
}

export interface PropertySectionState {
Expand All @@ -102,7 +110,7 @@ export const PropertySectionContext = React.createContext<PropertySectionContext
});

export const BaseSection = (props: ISectionConfig<ReactNode>) => {
const { name } = props;
const { name,hasTooltip } = props;
const { compName, state, toggle } = useContext(PropertySectionContext);
const open = props.open !== undefined ? props.open : name ? state[compName]?.[name] !== false : true;

Expand All @@ -118,17 +126,35 @@ export const BaseSection = (props: ISectionConfig<ReactNode>) => {
return (
<SectionItem $width={props.width} style={props.style}>
{props.name && (
<SectionLabelDiv onClick={handleToggle} className={"section-header"}>
<SectionLabelDiv onClick={handleToggle} className={'section-header'}>
<SectionLabel>{props.name}</SectionLabel>
<div style={{ display: "flex" }}>
<div style={{display: 'flex'}}>
{open && props.additionalButton}
<PackupIcon deg={open ? "rotate(0deg)" : "rotate(180deg)"} />
<PackupIcon deg={open ? 'rotate(0deg)' : 'rotate(180deg)'} />
</div>
</SectionLabelDiv>
)}
<ShowChildren $show={open ? "flex" : "none"} $noMargin={props.noMargin}>
{props.children}
</ShowChildren>
<Tooltip
title={
hasTooltip && (
<TooltipWrapper>
Here you can enter the animation type codes. Like bounce, swing or
tada. Read more about all possible codes at:{" "}
<a href="https://animate.style">https://animate.style</a>
</TooltipWrapper>
)
}
arrow={{
pointAtCenter: true,
}}
placement="top"
color="#2c2c2c"
getPopupContainer={(node: any) => node.closest('.react-grid-item')}
>
<ShowChildren $show={open ? 'flex' : 'none'} $noMargin={props.noMargin}>
{props.children}
</ShowChildren>
</Tooltip>
</SectionItem>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,38 +293,38 @@ let AutoCompleteCompBase = (function () {
return (
<>
<Section>
{children.autoCompleteType.getView() === "normal" &&
{children.autoCompleteType.getView() === 'normal' &&
children.prefixIcon.propertyView({
label: trans("button.prefixIcon"),
label: trans('button.prefixIcon'),
})}
{children.autoCompleteType.getView() === "normal" &&
{children.autoCompleteType.getView() === 'normal' &&
children.suffixIcon.propertyView({
label: trans("button.suffixIcon"),
label: trans('button.suffixIcon'),
})}
{allowClearPropertyView(children)}
{allowClearPropertyView(children)}
</Section>
<Section name={trans("autoComplete.SectionDataName")}>
<Section name={trans('autoComplete.SectionDataName')}>
{children.items.propertyView({
label: trans("autoComplete.value"),
label: trans('autoComplete.value'),
tooltip: itemsDataTooltip,
placeholder: "[]",
placeholder: '[]',
})}
{getDayJSLocale() === "zh-cn" &&
{getDayJSLocale() === 'zh-cn' &&
children.searchFirstPY.propertyView({
label: trans("autoComplete.searchFirstPY"),
label: trans('autoComplete.searchFirstPY'),
})}
{getDayJSLocale() === "zh-cn" &&
{getDayJSLocale() === 'zh-cn' &&
children.searchCompletePY.propertyView({
label: trans("autoComplete.searchCompletePY"),
label: trans('autoComplete.searchCompletePY'),
})}
{children.searchLabelOnly.propertyView({
label: trans("autoComplete.searchLabelOnly"),
label: trans('autoComplete.searchLabelOnly'),
})}
{children.ignoreCase.propertyView({
label: trans("autoComplete.ignoreCase"),
label: trans('autoComplete.ignoreCase'),
})}
{children.valueOrLabel.propertyView({
label: trans("autoComplete.checkedValueFrom"),
label: trans('autoComplete.checkedValueFrom'),
radioButton: true,
})}
</Section>
Expand All @@ -350,7 +350,10 @@ let AutoCompleteCompBase = (function () {
<Section name={sectionNames.inputFieldStyle}>
{children.inputFieldStyle.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section
name={sectionNames.animationStyle}
hasTooltip={true}
>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ let FloatButtonBasicComp = (function () {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const LinkTmpComp = (function () {
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<>
<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
<Section name={sectionNames.animationStyle}>{children.animationStyle.getPropertyView()}</Section>
<Section name={sectionNames.animationStyle} hasTooltip={true}>{children.animationStyle.getPropertyView()}</Section>
</>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const ToggleTmpComp = (function () {
})}
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/comps/comps/carouselComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ let CarouselBasicComp = (function () {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ let CommentBasicComp = (function () {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section></>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export const ContainerBaseComp = (function () {
<Section name={sectionNames.bodyStyle}>
{children.bodyStyle.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export const ContainerBaseComp = (function () {
<Section name={sectionNames.style}>
{ children.container.stylePropertyView() }
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
{children.container.children.showHeader.getView() && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const ContainerBaseComp = (function () {
<Section name={"Floating Text Style"}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
<Section name={"Container Style"}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ const CustomCompBase = new UICompBuilder(childrenMap, (props, dispatch) => {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export const datePickerControl = new UICompBuilder(childrenMap, (props) => {
<Section name={sectionNames.inputFieldStyle}>
{children.inputFieldStyle.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/comps/comps/dividerComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const DividerComp = migrateOldData(
{children.dashed.propertyView({ label: trans("divider.dashed") })}
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle}hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ let FileTmpComp = new UICompBuilder(childrenMap, (props, dispatch) => (
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<>
<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
<Section name={sectionNames.animationStyle}>{children.animationStyle.getPropertyView()}</Section>
<Section name={sectionNames.animationStyle} hasTooltip={true}>{children.animationStyle.getPropertyView()}</Section>
</>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ let FileViewerBasicComp = (function () {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ const FormBaseComp = (function () {
<Section name={sectionNames.style}>
{children.container.stylePropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
{children.container.children.showHeader.getView() && (
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/comps/comps/iconComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ let IconBasicComp = (function () {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/comps/comps/iframeComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ let IFrameCompBase = new UICompBuilder(
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/comps/comps/imageComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ let ImageBasicComp = new UICompBuilder(childrenMap, (props) => {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ let JsonEditorTmpComp = (function () {
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<>
<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
<Section name={sectionNames.animationStyle}>{children.animationStyle.getPropertyView()}</Section>
<Section name={sectionNames.animationStyle} hasTooltip={true}>{children.animationStyle.getPropertyView()}</Section>
</>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ let JsonExplorerTmpComp = (function () {
label: trans('jsonExplorer.theme'),
})}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ let JsonLottieTmpComp = (function () {
<Section name={sectionNames.style}>
{children.container.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ let FormBasicComp = (function () {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function listPropertyView(compType: ListCompType) {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section></>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ let AudioBasicComp = (function () {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ let VideoBasicComp = (function () {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const NavCompBase = new UICompBuilder(childrenMap, (props) => {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ let NumberInputTmpComp = (function () {
<Section name={sectionNames.inputFieldStyle}>
{children.inputFieldStyle.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const SliderPropertyView = (
<Section name={sectionNames.inputFieldStyle}>
{children.inputFieldStyle.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ let ProgressCircleTmpComp = (function () {
<Section name={sectionNames.style}>
{children.style.getPropertyView()}
</Section>
<Section name={sectionNames.animationStyle}>
<Section name={sectionNames.animationStyle} hasTooltip={true}>
{children.animationStyle.getPropertyView()}
</Section>
</>
Expand Down
Loading
Loading