Skip to content

container add scroll Switch #337

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

Closed
Closed
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
容器组件添加滚动条开关
container add scroll Switch
  • Loading branch information
mousheng committed Aug 9, 2023
commit 2a55403526c781eb934ece4e8970d6350ff14229
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ import { disabledPropertyView, hiddenPropertyView } from "comps/utils/propertyUt
import { trans } from "i18n";
import { BoolCodeControl } from "comps/controls/codeControl";
import { DisabledContext } from "comps/generators/uiCompBuilder";
import { BoolControl } from "@lowcoder-ee/comps/controls/boolControl";

export const ContainerBaseComp = (function () {
const childrenMap = {
disabled: BoolCodeControl,
showScroll: BoolControl.DEFAULT_TRUE,
};
return new ContainerCompBuilder(childrenMap, (props, dispatch) => {
return (
Expand All @@ -32,6 +34,8 @@ export const ContainerBaseComp = (function () {
<Section name={sectionNames.interaction}>{disabledPropertyView(children)}</Section>
<Section name={sectionNames.layout}>
{children.container.getPropertyView()}
{!children.container.children.autoHeight.getView() && children.showScroll.propertyView({
label: trans("container.showScroll")})}
{hiddenPropertyView(children)}
</Section>
<Section name={sectionNames.style}>{children.container.stylePropertyView()}</Section>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ const BodyInnerGrid = styled(InnerGrid)<{
showBorder: boolean;
backgroundColor: string;
borderColor: string;
showScroll?: boolean;
}>`
border-top: ${(props) => `${props.showBorder ? 1 : 0}px solid ${props.borderColor}`};
flex: 1;
overflow: ${(props) => `${props.showScroll ? 'auto' : 'hidden'}`};
${(props) => props.backgroundColor && `background-color: ${props.backgroundColor};`}
border-radius: 0;
`;
Expand All @@ -59,6 +61,7 @@ const FooterInnerGrid = styled(InnerGrid)<{

export type TriContainerProps = TriContainerViewProps & {
hintPlaceholder?: ReactNode;
showScroll?: boolean;
};

export function TriContainer(props: TriContainerProps) {
Expand Down Expand Up @@ -110,6 +113,7 @@ export function TriContainer(props: TriContainerProps) {
hintPlaceholder={props.hintPlaceholder ?? HintPlaceHolder}
backgroundColor={style?.background}
borderColor={style?.border}
showScroll={props?.showScroll}
style={{padding: style.containerbodypadding}}
/>
</BackgroundColorContext.Provider>
Expand Down
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1355,6 +1355,7 @@ export const en = {
},
container: {
title: "Container title",
showScroll: "Show scroll",
},
drawer: {
placement: "Drawer placement",
Expand Down
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/i18n/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,7 @@ selectionControl: {
},
container: {
title: "容器标题",
showScroll: "显示滚动条",
},
drawer: {
placement: "抽屉位置",
Expand Down