Skip to content

Commit 8d276f7

Browse files
committed
formatting removed
1 parent 13f7396 commit 8d276f7

File tree

1 file changed

+43
-52
lines changed
  • client/packages/lowcoder-design/src/components

1 file changed

+43
-52
lines changed

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

Lines changed: 43 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import {trans} from 'i18n/design';
2-
import React, {ReactNode, useContext} from 'react';
3-
import styled from 'styled-components';
4-
import {ReactComponent as Packup} from 'icons/icon-Pack-up.svg';
5-
import {labelCss} from './Label';
6-
import {controlItem, ControlNode} from './control';
7-
8-
const SectionItem = styled.div<{$width?: number}>`
1+
import { trans } from "i18n/design";
2+
import React, { ReactNode, useContext } from "react";
3+
import styled from "styled-components";
4+
import { ReactComponent as Packup } from "icons/icon-Pack-up.svg";
5+
import { labelCss } from "./Label";
6+
import { controlItem, ControlNode } from "./control";
7+
8+
const SectionItem = styled.div<{ $width?: number }>`
99
width: ${(props) => (props.$width ? props.$width : 312)}px;
1010
border-bottom: 1px solid #e1e3eb;
1111
@@ -63,14 +63,14 @@ const SectionLabelDiv = styled.div`
6363
}
6464
`;
6565

66-
const ShowChildren = styled.div<{$show?: string; $noMargin?: boolean}>`
67-
display: ${(props) => props.$show || 'none'};
66+
const ShowChildren = styled.div<{ $show?: string; $noMargin?: boolean }>`
67+
display: ${(props) => props.$show || "none"};
6868
flex-direction: column;
6969
gap: 8px;
7070
transition: all 3s;
7171
margin-left: ${(props) => (props.$noMargin ? 0 : 16)}px;
7272
padding-bottom: 16px;
73-
padding-right: ${(props) => (props.$noMargin ? 0 : '16px')};
73+
padding-right: ${(props) => (props.$noMargin ? 0 : "16px")};
7474
`;
7575

7676
interface ISectionConfig<T> {
@@ -95,22 +95,16 @@ export interface PropertySectionContextType {
9595
state: PropertySectionState;
9696
}
9797

98-
export const PropertySectionContext =
99-
React.createContext<PropertySectionContextType>({
100-
toggle: () => {},
101-
compName: '',
102-
state: {},
103-
});
98+
export const PropertySectionContext = React.createContext<PropertySectionContextType>({
99+
toggle: () => {},
100+
compName: "",
101+
state: {},
102+
});
104103

105104
export const BaseSection = (props: ISectionConfig<ReactNode>) => {
106-
const {name} = props;
107-
const {compName, state, toggle} = useContext(PropertySectionContext);
108-
const open =
109-
props.open !== undefined
110-
? props.open
111-
: name
112-
? state[compName]?.[name] !== false
113-
: true;
105+
const { name } = props;
106+
const { compName, state, toggle } = useContext(PropertySectionContext);
107+
const open = props.open !== undefined ? props.open : name ? state[compName]?.[name] !== false : true;
114108

115109
// console.log("open", open, props.open);
116110

@@ -124,47 +118,44 @@ export const BaseSection = (props: ISectionConfig<ReactNode>) => {
124118
return (
125119
<SectionItem $width={props.width} style={props.style}>
126120
{props.name && (
127-
<SectionLabelDiv onClick={handleToggle} className={'section-header'}>
121+
<SectionLabelDiv onClick={handleToggle} className={"section-header"}>
128122
<SectionLabel>{props.name}</SectionLabel>
129-
<div style={{display: 'flex'}}>
123+
<div style={{ display: "flex" }}>
130124
{open && props.additionalButton}
131-
<PackupIcon deg={open ? 'rotate(0deg)' : 'rotate(180deg)'} />
125+
<PackupIcon deg={open ? "rotate(0deg)" : "rotate(180deg)"} />
132126
</div>
133127
</SectionLabelDiv>
134128
)}
135-
<ShowChildren $show={open ? 'flex' : 'none'} $noMargin={props.noMargin}>
129+
<ShowChildren $show={open ? "flex" : "none"} $noMargin={props.noMargin}>
136130
{props.children}
137131
</ShowChildren>
138132
</SectionItem>
139133
);
140134
};
141135

142136
export function Section(props: ISectionConfig<ControlNode>) {
143-
return controlItem(
144-
{filterText: props.name, searchChild: true},
145-
<BaseSection {...props} />
146-
);
137+
return controlItem({ filterText: props.name, searchChild: true }, <BaseSection {...props} />);
147138
}
148139

149140
// common section names
150141
export const sectionNames = {
151-
basic: trans('prop.basic'),
152-
interaction: trans('prop.interaction'),
153-
advanced: trans('prop.advanced'),
154-
validation: trans('prop.validation'),
155-
layout: trans('prop.layout'),
156-
style: trans('prop.style'),
157-
labelStyle: trans('prop.labelStyle'),
158-
animationStyle: trans('prop.animationStyle'),
159-
data: trans('prop.data'),
160-
meetings: trans('prop.meetings'), // added by Falk Wolsky
161-
field: trans('prop.field'),
162-
inputFieldStyle: trans('prop.inputFieldStyle'),
163-
avatarStyle: trans('prop.avatarStyle'),
164-
captionStyle: trans('prop.captionStyle'),
165-
startButtonStyle: trans('prop.startButtonStyle'),
166-
resetButtonStyle: trans('prop.resetButtonStyle'),
167-
headerStyle: trans('prop.headerStyle'),
168-
bodyStyle: trans('prop.bodyStyle'),
169-
badgeStyle: trans('prop.badgeStyle'),
142+
basic: trans("prop.basic"),
143+
interaction: trans("prop.interaction"),
144+
advanced: trans("prop.advanced"),
145+
validation: trans("prop.validation"),
146+
layout: trans("prop.layout"),
147+
style: trans("prop.style"),
148+
labelStyle:trans("prop.labelStyle"),
149+
animationStyle:trans("prop.animationStyle"),
150+
data: trans("prop.data"),
151+
meetings: trans("prop.meetings"), // added by Falk Wolsky
152+
field: trans("prop.field"),
153+
inputFieldStyle:trans("prop.inputFieldStyle"),
154+
avatarStyle:trans("prop.avatarStyle"),
155+
captionStyle:trans("prop.captionStyle"),
156+
startButtonStyle:trans("prop.startButtonStyle"),
157+
resetButtonStyle:trans("prop.resetButtonStyle"),
158+
headerStyle:trans("prop.headerStyle"),
159+
bodyStyle:trans("prop.bodyStyle"),
160+
badgeStyle:trans("prop.badgeStyle"),
170161
};

0 commit comments

Comments
 (0)