Skip to content

Commit c984e21

Browse files
committed
condition updated
1 parent c7ed2c3 commit c984e21

File tree

7 files changed

+46
-20
lines changed

7 files changed

+46
-20
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { formDataChildren, FormDataPropertyView } from "./formComp/formDataConst
1111
import { PositionControl } from "comps/controls/dropdownControl";
1212
import { useRef, useState } from "react";
1313
import ReactResizeDetector from "react-resize-detector";
14-
import { ArrayStringControl } from "comps/controls/codeControl";
14+
import { ArrayStringControl, StringControl } from "comps/controls/codeControl";
1515
import { styleControl } from "comps/controls/styleControl";
1616
import { AnimationStyle, AnimationStyleType, CarouselStyle } from "comps/controls/styleControlConstants";
1717

@@ -47,7 +47,7 @@ let CarouselBasicComp = (function () {
4747
dotPosition: withDefault(PositionControl, "bottom"),
4848
style: styleControl(CarouselStyle),
4949
animationStyle: styleControl(AnimationStyle),
50-
restrictPaddingOnRotation:withDefault(BoolControl, true),
50+
restrictPaddingOnRotation:withDefault(StringControl, 'imageCarousel'),
5151
...formDataChildren,
5252
};
5353
return new UICompBuilder(childrenMap, (props) => {

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { trans } from "i18n";
1313

1414
import { useContext } from "react";
1515
import { EditorContext } from "comps/editorState";
16-
import { BoolControl } from "../controls/boolControl";
1716

1817
const getStyle = (style: FileViewerStyleType) => {
1918
return css`
@@ -71,7 +70,7 @@ let FileViewerBasicComp = (function () {
7170
src: StringControl,
7271
style: styleControl(FileViewerStyle),
7372
animationStyle: styleControl(AnimationStyle),
74-
restrictPaddingOnRotation: withDefault(BoolControl, true),
73+
restrictPaddingOnRotation: withDefault(StringControl, 'fileViewer'),
7574
};
7675
return new UICompBuilder(childrenMap, (props) => {
7776
if (isEmpty(props.src)) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import { DEFAULT_IMG_URL } from "util/stringUtils";
3333

3434
import { useContext } from "react";
3535
import { EditorContext } from "comps/editorState";
36+
import { StringControl } from "../controls/codeControl";
3637

3738
const Container = styled.div<{ $style: ImageStyleType | undefined,$animationStyle:AnimationStyleType }>`
3839
height: 100%;
@@ -169,7 +170,7 @@ const childrenMap = {
169170
animationStyle: styleControl(AnimationStyle),
170171
autoHeight: withDefault(AutoHeightControl, "fixed"),
171172
supportPreview: BoolControl,
172-
restrictPaddingOnRotation:withDefault(BoolControl, true)
173+
restrictPaddingOnRotation:withDefault(StringControl, 'image')
173174
};
174175

175176
let ImageBasicComp = new UICompBuilder(childrenMap, (props) => {

client/packages/lowcoder/src/comps/comps/mediaComp/videoComp.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { AnimationStyle, AnimationStyleType, AudioStyle, ImageStyle, ImageStyleT
1010
import { BoolControl } from "comps/controls/boolControl";
1111
import { withDefault } from "../../generators/simpleGenerators";
1212
import { playIcon } from "lowcoder-design";
13-
import { RangeControl } from "../../controls/codeControl";
13+
import { RangeControl, StringControl } from "../../controls/codeControl";
1414
import { hiddenPropertyView } from "comps/utils/propertyUtils";
1515
import { trans } from "i18n";
1616
import { Video } from "lowcoder-design";
@@ -120,7 +120,7 @@ const childrenMap = {
120120
playbackRate: RangeControl.closed(1, 2, 1),
121121
currentTimeStamp: numberExposingStateControl("currentTimeStamp", 0),
122122
duration: numberExposingStateControl("duration"),
123-
restrictPaddingOnRotation:withDefault(BoolControl, true),
123+
restrictPaddingOnRotation:withDefault(StringControl, 'video'),
124124
...mediaCommonChildren,
125125
};
126126

client/packages/lowcoder/src/comps/comps/meetingComp/controlButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ const childrenMap = {
187187
prefixIcon: IconControl,
188188
style: ButtonStyleControl,
189189
viewRef: RefControl<HTMLElement>,
190-
restrictPaddingOnRotation:withDefault(BoolControl, true)
190+
restrictPaddingOnRotation:withDefault(StringControl, 'controlButton')
191191
};
192192

193193
let ButtonTmpComp = (function () {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const childrenMap = {
3333
image: StringControl,
3434
style: styleControl(QRCodeStyle),
3535
animationStyle: styleControl(AnimationStyle),
36-
restrictPaddingOnRotation: withDefault(BoolControl, true),
36+
restrictPaddingOnRotation: withDefault(StringControl, 'qrCode'),
3737
};
3838

3939
const QRCodeView = (props: RecordConstructorToView<typeof childrenMap>) => {

client/packages/lowcoder/src/comps/generators/uiCompBuilder.tsx

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,11 @@ function UIView(props: {
251251
const restrictPaddingOnRotation = defaultChildren.hasOwnProperty('restrictPaddingOnRotation');
252252
let rotationVal = null
253253
let boxShadowVal = null;
254+
let restrictPaddingOnRotationVal=null;
254255
if (isNotContainer) {
255256
rotationVal = defaultChildren.style.children?.rotation?.valueAndMsg.value;
256257
boxShadowVal = defaultChildren.style?.children?.boxShadow?.valueAndMsg?.value;
258+
restrictPaddingOnRotationVal = defaultChildren?.restrictPaddingOnRotation?.valueAndMsg?.value;
257259
}
258260
return (
259261
<div
@@ -264,17 +266,41 @@ function UIView(props: {
264266
width: '100%',
265267
height: '100%',
266268
margin: '0px',
267-
padding: (
268-
(rotationVal === null || rotationVal === undefined || restrictPaddingOnRotation) &&
269-
(boxShadowVal === null || boxShadowVal === undefined || boxShadowVal === '0px')
270-
) ? '0px' // Both rotation and box-shadow are empty or restricted
271-
: rotationVal !== '' && rotationVal !== '0deg' // Rotation applied
272-
? (boxShadowVal === null || boxShadowVal === undefined || boxShadowVal === '0px')?`calc(min(50%, ${Math.abs(rotationVal.replace('deg', '')) / 90} * 100%)) 0px`:(boxShadowVal !== '' && boxShadowVal !== '0px') // Both rotation and box-shadow applied
273-
? `calc(min(50%, ${Math.abs(rotationVal.replace('deg', '') + parseFloat(boxShadowVal.replace('px', ''))) / 90} * 100%)) 0px`
274-
: `calc(min(50%, ${Math.abs(rotationVal.replace('deg', '')) / 90} * 100%)) 0px` // Only rotation applied
275-
: (boxShadowVal === null || boxShadowVal === undefined || boxShadowVal === '0px')?'0px':(boxShadowVal !== '' && boxShadowVal !== '0px') // Box-shadow applied
276-
? `calc(min(50%, ${Math.abs(parseFloat(boxShadowVal.replace('px', ''))) / 90} * 100%)) 0px`
277-
: '0px' // Default value if neither rotation nor box-shadow is applied
269+
padding:
270+
(rotationVal === null ||
271+
rotationVal === undefined ||
272+
restrictPaddingOnRotation) &&
273+
(boxShadowVal === null ||
274+
boxShadowVal === undefined ||
275+
boxShadowVal === '0px')
276+
? restrictPaddingOnRotationVal === 'qrCode'
277+
? '50% 0px'
278+
: restrictPaddingOnRotationVal === 'image'
279+
? '10% 0px'
280+
: restrictPaddingOnRotationVal === 'imageCarousel'
281+
? '35% 0px'
282+
: restrictPaddingOnRotationVal === 'fileViewer'
283+
? '65% 0px'
284+
: restrictPaddingOnRotationVal === 'controlButton'
285+
? '50% 0px'
286+
: restrictPaddingOnRotationVal === 'video'
287+
? '26% 0px'
288+
: '0px' // Both rotation and box-shadow are empty or restricted
289+
: rotationVal !== '' && rotationVal !== '0deg' // Rotation applied
290+
? boxShadowVal === null ||
291+
boxShadowVal === undefined ||
292+
boxShadowVal === '0px'
293+
? `calc(min(50%, ${Math.abs(rotationVal.replace('deg', '')) / 90} * 100%)) 0px`
294+
: boxShadowVal !== '' && boxShadowVal !== '0px' // Both rotation and box-shadow applied
295+
? `calc(min(50%, ${Math.abs(rotationVal.replace('deg', '') + parseFloat(boxShadowVal.replace('px', ''))) / 90} * 100%)) 0px`
296+
: `calc(min(50%, ${Math.abs(rotationVal.replace('deg', '')) / 90} * 100%)) 0px` // Only rotation applied
297+
: boxShadowVal === null ||
298+
boxShadowVal === undefined ||
299+
boxShadowVal === '0px'
300+
? '0px'
301+
: boxShadowVal !== '' && boxShadowVal !== '0px' // Box-shadow applied
302+
? `calc(min(50%, ${Math.abs(parseFloat(boxShadowVal.replace('px', ''))) / 90} * 100%)) 0px`
303+
: '0px', // Default value if neither rotation nor box-shadow is applied
278304
}}
279305
>
280306
<HidableView hidden={childrenProps.hidden as boolean}>

0 commit comments

Comments
 (0)