Skip to content

Commit 9973b1e

Browse files
committed
Modal: Added Main Content Scrollbar
1 parent ac9cb31 commit 9973b1e

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

client/packages/lowcoder/src/comps/hooks/modalComp.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const EventOptions = [
2929
{ label: trans("modalComp.close"), value: "close", description: trans("modalComp.closeDesc") },
3030
] as const;
3131

32-
const getStyle = (style: ModalStyleType) => {
32+
const getStyle = (style: ModalStyleType, modalScrollbar: boolean) => {
3333
return css`
3434
.ant-modal-content {
3535
border-radius: ${style.radius};
@@ -49,6 +49,9 @@ const getStyle = (style: ModalStyleType) => {
4949
background-color: ${style.background};
5050
}
5151
}
52+
div.ant-modal-body div.react-grid-layout::-webkit-scrollbar {
53+
display: ${modalScrollbar ? "block" : "none"};
54+
}
5255
.ant-modal-close {
5356
inset-inline-end: 10px !important;
5457
top: 10px;
@@ -80,8 +83,8 @@ function extractMarginValues(style: ModalStyleType) {
8083
return valuesarray;
8184
}
8285

83-
const ModalStyled = styled.div<{ $style: ModalStyleType }>`
84-
${(props) => props.$style && getStyle(props.$style)}
86+
const ModalStyled = styled.div<{ $style: ModalStyleType, $modalScrollbar: boolean }>`
87+
${(props) => props.$style && getStyle(props.$style, props.$modalScrollbar)}
8588
`;
8689

8790
const ModalWrapper = styled.div`
@@ -105,6 +108,7 @@ let TmpModalComp = (function () {
105108
autoHeight: AutoHeightControl,
106109
title: StringControl,
107110
titleAlign: HorizontalAlignmentControl,
111+
modalScrollbar: withDefault(BoolControl, false),
108112
style: styleControl(ModalStyle),
109113
maskClosable: withDefault(BoolControl, true),
110114
showMask: withDefault(BoolControl, true),
@@ -174,7 +178,7 @@ let TmpModalComp = (function () {
174178
if (open) props.onEvent("open");
175179
}}
176180
zIndex={Layers.modal}
177-
modalRender={(node) => <ModalStyled $style={props.style}>{node}</ModalStyled>}
181+
modalRender={(node) => <ModalStyled $style={props.style} $modalScrollbar={props.modalScrollbar}>{node}</ModalStyled>}
178182
mask={props.showMask}
179183
className={props.className as string}
180184
data-testid={props.dataTestId as string}
@@ -203,6 +207,10 @@ let TmpModalComp = (function () {
203207
label: trans('prop.horizontalGridCells'),
204208
})}
205209
{children.autoHeight.getPropertyView()}
210+
{!children.autoHeight.getView() &&
211+
children.modalScrollbar.propertyView({
212+
label: trans("prop.modalScrollbar")
213+
})}
206214
{!children.autoHeight.getView() &&
207215
children.height.propertyView({
208216
label: trans("modalComp.modalHeight"),

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ export const en = {
204204
"showHorizontalScrollbar" : "Show Horizontal Scrollbar",
205205
"siderScrollbar" : "Show Scrollbars in Sider",
206206
"mainScrollbar": "Show Scrollbars in main content",
207+
"modalScrollbar": "Show Scrollbars in Modal",
207208
"siderRight" : "Show sider on the Right",
208209
"siderWidth" : "Sider Width",
209210
"siderWidthTooltip" : "Sider width supports percentages (%) and pixels (px).",

translations/locales/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ export const en = {
197197
"scrollbar": "Show Scrollbars",
198198
"siderScrollbar": "Show Scrollbars in Sider",
199199
"mainScrollbar": "Show Scrollbars in main content",
200+
"modalScrollbar": "Show Scrollbars in Modal",
200201
"siderRight": "Show sider on the Right",
201202
"siderWidth": "Sider Width",
202203
"siderWidthTooltip": "Sider width supports percentages (%) and pixels (px).",

translations/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ export const en = {
202202
"scrollbar": "Show Scrollbars",
203203
"siderScrollbar" : "Show Scrollbars in Sider",
204204
"mainScrollbar": "Show Scrollbars in main content",
205+
"modalScrollbar": "Show Scrollbars in Modal",
205206
"siderRight" : "Show sider on the Right",
206207
"siderWidth" : "Sider Width",
207208
"siderWidthTooltip" : "Sider width supports percentages (%) and pixels (px).",

0 commit comments

Comments
 (0)