Skip to content

Commit 630b4e5

Browse files
committed
rotation and animation fixes
1 parent 351dee0 commit 630b4e5

26 files changed

+318
-101
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
import { RefControl } from "comps/controls/refControl";
2626

2727
import React, { useContext } from "react";
28+
import { AnimationStyle, styleControl } from "@lowcoder-ee/index.sdk";
2829

2930
const FormLabel = styled(CommonBlueLabel)`
3031
font-size: 13px;
@@ -129,6 +130,7 @@ const ButtonTmpComp = (function () {
129130
prefixIcon: IconControl,
130131
suffixIcon: IconControl,
131132
style: ButtonStyleControl,
133+
animationStyle:styleControl(AnimationStyle),
132134
viewRef: RefControl<HTMLElement>,
133135
};
134136
return new UICompBuilder(childrenMap, (props) => (

client/packages/lowcoder/src/comps/comps/buttonComp/buttonCompConstants.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export function getButtonStyle(buttonStyle: ButtonStyleType) {
1616
border-width:${buttonStyle.borderWidth};
1717
margin: ${buttonStyle.margin};
1818
padding: ${buttonStyle.padding};
19+
rotate: ${buttonStyle.rotation};
1920
&:not(:disabled) {
2021
--antd-wave-shadow-color: ${buttonStyle.border};
2122
border-color: ${buttonStyle.border};

client/packages/lowcoder/src/comps/comps/buttonComp/floatButtonComp.tsx

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { BoolControl } from "comps/controls/boolControl";
33
import { stringExposingStateControl } from "comps/controls/codeStateControl";
44
import { dropdownControl } from "comps/controls/dropdownControl";
55
import { styleControl } from "comps/controls/styleControl";
6-
import { BadgeStyle, BadgeStyleType, FloatButtonStyle, FloatButtonStyleType } from "comps/controls/styleControlConstants";
6+
import { AnimationStyle, AnimationStyleType, BadgeStyle, BadgeStyleType, FloatButtonStyle, FloatButtonStyleType } from "comps/controls/styleControlConstants";
77
import { UICompBuilder } from "comps/generators/uiCompBuilder";
88
import { NameConfig, NameConfigHidden, withExposingConfigs } from "comps/generators/withExposing";
99
import { Section, sectionNames } from "lowcoder-design";
@@ -17,6 +17,12 @@ import styled from "styled-components";
1717
import { ButtonEventHandlerControl } from "comps/controls/eventHandlerControl";
1818
import { manualOptionsControl } from "comps/controls/optionsControl";
1919

20+
const StyledFloatButton = styled(FloatButton)<{
21+
$animationStyle: AnimationStyleType;
22+
}>`
23+
${(props) => props.$animationStyle}
24+
`;
25+
2026
const Wrapper = styled.div<{ $badgeStyle: BadgeStyleType, $style: FloatButtonStyleType}>`
2127
width: 0px;
2228
height: 0px;
@@ -78,6 +84,7 @@ const childrenMap = {
7884
icon: withDefault(IconControl, '/icon:antd/questioncircleoutlined'),
7985
badgeStyle: styleControl(BadgeStyle),
8086
style: styleControl(FloatButtonStyle),
87+
animationStyle: styleControl(AnimationStyle),
8188
buttons: manualOptionsControl(buttonGroupOption, {
8289
initOptions: [
8390
{ id: 0, label: trans("optionsControl.optionI", { i: '1' }), icon: "/icon:antd/filetextoutlined", badge: '1' },
@@ -93,7 +100,8 @@ const childrenMap = {
93100
const FloatButtonView = (props: RecordConstructorToView<typeof childrenMap>) => {
94101
const renderButton = (button: any, onlyOne?: boolean) => {
95102
return !button?.hidden ? (
96-
<FloatButton
103+
<StyledFloatButton
104+
$animationStyle={props.animationStyle}
97105
key={button?.id}
98106
icon={button?.icon}
99107
onClick={() => button.onEvent("click")}
@@ -108,39 +116,46 @@ const FloatButtonView = (props: RecordConstructorToView<typeof childrenMap>) =>
108116
return (
109117
<Wrapper $badgeStyle={props.badgeStyle} $style={props.style}>
110118
{props.buttons.length === 1 ? (renderButton(props.buttons[0], true)) :
111-
(<FloatButton.Group
119+
(<StyledFloatButton.Group
112120
trigger="hover"
113121
icon={props.icon}
114122
shape={props.shape}
115123
badge={{ count: props.buttons.reduce((sum, i) => sum + (i.buttonType === 'custom' && !i.hidden ? i.badge : 0), 0), color: props.badgeStyle.badgeColor, dot: props.dot }}
116124
type={props.buttonTheme}
117125
>
118126
{props.buttons.map((button: any) => renderButton(button))}
119-
</FloatButton.Group>)
127+
</StyledFloatButton.Group>)
120128
}
121129
</Wrapper>
122130
);
123131
};
124132

125133
let FloatButtonBasicComp = (function () {
126-
return new UICompBuilder(childrenMap, (props) => <FloatButtonView {...props} />)
127-
.setPropertyViewFn((children) => (
128-
<>
129-
<Section name={sectionNames.basic}>
130-
{children.buttons.propertyView({})}
131-
{children.icon.propertyView({ label: trans("icon") })}
132-
{children.shape.propertyView({ label: trans("floatButton.buttonShape"), radioButton: true })}
133-
{children.buttonTheme.propertyView({ label: trans("floatButton.buttonTheme"), radioButton: true })}
134-
{children.dot.propertyView({ label: trans("floatButton.dot") })}
135-
</Section>
136-
<Section name={sectionNames.layout}>
137-
{hiddenPropertyView(children)}
138-
</Section>
139-
<Section name={sectionNames.badgeStyle}>{children.badgeStyle.getPropertyView()}</Section>
140-
<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
141-
</>
142-
))
143-
.build();
134+
return new UICompBuilder(childrenMap, (props) => (
135+
<FloatButtonView {...props} />
136+
))
137+
.setPropertyViewFn((children) => (
138+
<>
139+
<Section name={sectionNames.basic}>
140+
{children.buttons.propertyView({})}
141+
{children.icon.propertyView({ label: trans("icon") })}
142+
{children.shape.propertyView({ label: trans("floatButton.buttonShape"), radioButton: true })}
143+
{children.buttonTheme.propertyView({ label: trans("floatButton.buttonTheme"), radioButton: true })}
144+
{children.dot.propertyView({ label: trans("floatButton.dot") })}
145+
</Section>
146+
<Section name={sectionNames.layout}>
147+
{hiddenPropertyView(children)}
148+
</Section>
149+
<Section name={sectionNames.badgeStyle}>{children.badgeStyle.getPropertyView()}</Section>
150+
<Section name={sectionNames.style}>
151+
{children.style.getPropertyView()}
152+
</Section>
153+
<Section name={sectionNames.animationStyle}>
154+
{children.animationStyle.getPropertyView()}
155+
</Section>
156+
</>
157+
))
158+
.build();
144159
})();
145160

146161
FloatButtonBasicComp = class extends FloatButtonBasicComp {

client/packages/lowcoder/src/comps/comps/buttonComp/linkComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const Link = styled(Button)<{
3030
${(props) => props.$animationStyle}
3131
${(props) => `
3232
color: ${props.$style.text};
33+
rotate: ${props.$style.rotation};
3334
margin: ${props.$style.margin};
3435
padding: ${props.$style.padding};
3536
font-size: ${props.$style.textSize};

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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { useRef, useState } from "react";
1313
import ReactResizeDetector from "react-resize-detector";
1414
import { ArrayStringControl } from "comps/controls/codeControl";
1515
import { styleControl } from "comps/controls/styleControl";
16-
import { CarouselStyle } from "comps/controls/styleControlConstants";
16+
import { AnimationStyle, AnimationStyleType, CarouselStyle } from "comps/controls/styleControlConstants";
1717

1818
import { useContext } from "react";
1919
import { EditorContext } from "comps/editorState";
@@ -25,11 +25,13 @@ const CarouselItem = styled.div<{ $src: string }>`
2525
background-size: contain;
2626
`;
2727

28-
const Container = styled.div<{ $bg: string }>`
28+
const Container = styled.div<{$bg: string; $rotation: string; $animationStyle:AnimationStyleType}>`
2929
&,
3030
.ant-carousel {
3131
height: 100%;
3232
background-color: ${(props) => props.$bg};
33+
rotate: ${(props) => props.$rotation};
34+
${props=>props.$animationStyle}
3335
}
3436
`;
3537

@@ -44,6 +46,7 @@ let CarouselBasicComp = (function () {
4446
showDots: withDefault(BoolControl, true),
4547
dotPosition: withDefault(PositionControl, "bottom"),
4648
style: styleControl(CarouselStyle),
49+
animationStyle: styleControl(AnimationStyle),
4750

4851
...formDataChildren,
4952
};
@@ -56,7 +59,12 @@ let CarouselBasicComp = (function () {
5659
}
5760
};
5861
return (
59-
<Container ref={containerRef} $bg={props.style.background}>
62+
<Container
63+
ref={containerRef}
64+
$bg={props.style.background}
65+
$rotation={props.style.rotation}
66+
$animationStyle={props.animationStyle}
67+
>
6068
<ReactResizeDetector onResize={onResize}>
6169
<Carousel
6270
dots={props.showDots}
@@ -100,6 +108,9 @@ let CarouselBasicComp = (function () {
100108
<Section name={sectionNames.style}>
101109
{children.style.getPropertyView()}
102110
</Section>
111+
<Section name={sectionNames.animationStyle}>
112+
{children.animationStyle.getPropertyView()}
113+
</Section>
103114
</>
104115
)}
105116
</>

client/packages/lowcoder/src/comps/comps/containerComp/cardComp.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ const Warpper = styled.div<{
7474
justify-content: space-between;
7575
background-color: ${props => props.$style?.background};
7676
border: ${props => props.$style?.border};
77+
rotate: ${props => props.$style?.rotation};
7778
border-style: ${props => props.$style?.borderStyle};
7879
border-radius: ${props => props.$style?.radius};
7980
border-width: ${props => props.$style?.borderWidth};

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

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { EventData, EventTypeEnum } from "./types";
1212
import { hiddenPropertyView } from "comps/utils/propertyUtils";
1313
import { trans } from "i18n";
1414
import { EditorContext } from "comps/editorState";
15+
import { AnimationStyle, AnimationStyleType, CustomStyle, CustomStyleType, styleControl } from "@lowcoder-ee/index.sdk";
1516

1617
// TODO: eventually to embedd in container so we have styling?
1718
// TODO: support different starter templates for different frameworks (react, ANT, Flutter, Angular, etc)
@@ -67,13 +68,21 @@ const defaultCode = `
6768
type IProps = {
6869
code: string;
6970
model: any;
71+
style: CustomStyleType;
72+
animationStyle:AnimationStyleType
7073
onModelChange: (v: any) => void;
7174
dispatch: (action: CompAction<any>) => void;
7275
};
7376

74-
const Wrapper = styled.div`
77+
const Wrapper = styled.div<{
78+
$style: CustomStyleType;
79+
$animationStyle: AnimationStyleType;
80+
}>`
7581
width: 100%;
7682
height: 100%;
83+
${(props) => props.$style};
84+
rotate: ${(props) => props.$style.rotation};
85+
${(props) => props.$animationStyle};
7786
iframe {
7887
border: 0;
7988
width: 100%;
@@ -196,21 +205,29 @@ function InnerCustomComponent(props: IProps) {
196205
}, [code]);
197206

198207
return (
199-
<Wrapper>
200-
<iframe ref={iframeRef} title="custom-comp" src={trans("customComponent.entryUrl")} />
208+
<Wrapper $style={props.style} $animationStyle={props.animationStyle}>
209+
<iframe
210+
ref={iframeRef}
211+
title="custom-comp"
212+
src={trans('customComponent.entryUrl')}
213+
/>
201214
</Wrapper>
202215
);
203216
}
204217

205218
const childrenMap = {
206219
model: jsonObjectStateControl(defaultModel),
207220
code: withDefault(StringControl, defaultCode),
221+
style:styleControl(CustomStyle),
222+
animationStyle:styleControl(AnimationStyle),
208223
};
209224

210225
const CustomCompBase = new UICompBuilder(childrenMap, (props, dispatch) => {
211226
const { code, model } = props;
212227
return (
213228
<InnerCustomComponent
229+
style={props.style}
230+
animationStyle={props.animationStyle}
214231
code={code}
215232
model={model.value}
216233
onModelChange={(v) => model.onChange(v)}
@@ -226,6 +243,12 @@ const CustomCompBase = new UICompBuilder(childrenMap, (props, dispatch) => {
226243
{children.model.propertyView({ label: trans("customComp.data") })}
227244
{children.code.propertyView({ label: trans("customComp.code"), language: "html" })}
228245
{hiddenPropertyView(children)}
246+
</Section>
247+
<Section name={sectionNames.style}>
248+
{children.style.getPropertyView()}
249+
</Section>
250+
<Section name={sectionNames.animationStyle}>
251+
{children.animationStyle.getPropertyView()}
229252
</Section>
230253
</>
231254
)}

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

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { darkenColor } from "components/colorSelect/colorUtils";
66
import { Section, sectionNames } from "components/Section";
77
import { IconControl } from "comps/controls/iconControl";
88
import { styleControl } from "comps/controls/styleControl";
9-
import { FileStyle, FileStyleType, heightCalculator, widthCalculator } from "comps/controls/styleControlConstants";
9+
import { AnimationStyle, AnimationStyleType, FileStyle, FileStyleType, heightCalculator, widthCalculator } from "comps/controls/styleControlConstants";
1010
import { withMethodExposing } from "comps/generators/withMethodExposing";
1111
import { hasIcon } from "comps/utils";
1212
import { getComponentDocUrl } from "comps/utils/compDocUtil";
@@ -101,6 +101,7 @@ const commonChildren = {
101101
disabled: BoolCodeControl,
102102
onEvent: eventHandlerControl(EventOptions),
103103
style: styleControl(FileStyle),
104+
animationStyle: styleControl(AnimationStyle),
104105
parseFiles: BoolPureControl,
105106
parsedValue: stateComp<Array<JSONValue | null>>([]),
106107
prefixIcon: withDefault(IconControl, "/icon:solid/arrow-up-from-bracket"),
@@ -137,6 +138,7 @@ const getStyle = (style: FileStyleType) => {
137138
return css`
138139
.ant-btn {
139140
border-radius: ${style.radius};
141+
rotate: ${style.rotation};
140142
margin: ${style.margin};
141143
padding: ${style.padding};
142144
width: ${widthCalculator(style.margin)};
@@ -167,9 +169,13 @@ const getStyle = (style: FileStyleType) => {
167169
`;
168170
};
169171

170-
const StyledUpload = styled(AntdUpload)<{ $style: FileStyleType }>`
172+
const StyledUpload = styled(AntdUpload)<{
173+
$style: FileStyleType;
174+
$animationStyle: AnimationStyleType;
175+
}>`
171176
.ant-upload,
172177
.ant-btn {
178+
${(props) => props.$animationStyle}
173179
width: 100%;
174180
display: inline-flex;
175181
justify-content: center;
@@ -185,7 +191,6 @@ const StyledUpload = styled(AntdUpload)<{ $style: FileStyleType }>`
185191
min-height: 1px;
186192
}
187193
}
188-
189194
${(props) => props.$style && getStyle(props.$style)}
190195
`;
191196

@@ -252,6 +257,7 @@ const Upload = (
252257
const hasChildren = hasIcon(props.prefixIcon) || !!props.text || hasIcon(props.suffixIcon);
253258
return (
254259
<StyledUpload
260+
$animationStyle={props.animationStyle}
255261
{...commonProps(props)}
256262
$style={style}
257263
fileList={fileList}
@@ -419,7 +425,10 @@ let FileTmpComp = new UICompBuilder(childrenMap, (props, dispatch) => (
419425
)}
420426

421427
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
422-
<><Section name={sectionNames.style}>{children.style.getPropertyView()}</Section></>
428+
<>
429+
<Section name={sectionNames.style}>{children.style.getPropertyView()}</Section>
430+
<Section name={sectionNames.animationStyle}>{children.animationStyle.getPropertyView()}</Section>
431+
</>
423432
)}
424433
</>
425434
))

0 commit comments

Comments
 (0)