Skip to content

Commit a7e34c9

Browse files
committed
[FIX] GlobalCSS styling for Modals/Drawers
1 parent c8d069f commit a7e34c9

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

client/packages/lowcoder-core/src/eval/utils/evalStyle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function styleNamespace(id: string) {
66

77
export function evalStyle(id: string, css: string[], globalStyle?: boolean) {
88
const styleId = styleNamespace(id);
9-
const prefixId = globalStyle ? id : `#${id}`
9+
const prefixId = globalStyle ? id : `.${id}`;
1010
let compiledCSS = "";
1111
css.forEach((i) => {
1212
if (!i.trim()) {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import { isNumeric } from "util/stringUtils";
2626
import { NameConfig, withExposingConfigs } from "../generators/withExposing";
2727
import { title } from "process";
2828
import { SliderControl } from "../controls/sliderControl";
29+
import clsx from "clsx";
30+
import { useApplicationId } from "util/hooks";
2931

3032
const EventOptions = [closeEvent] as const;
3133

@@ -119,6 +121,7 @@ let TmpDrawerComp = (function () {
119121
const isTopBom = ["top", "bottom"].includes(props.placement);
120122
const { items, ...otherContainerProps } = props.container;
121123
const userViewMode = useUserViewMode();
124+
const appID = useApplicationId();
122125
const resizable = !userViewMode && (!isTopBom || !props.autoHeight);
123126
const onResizeStop = useCallback(
124127
(
@@ -172,7 +175,7 @@ let TmpDrawerComp = (function () {
172175
zIndex={Layers.drawer}
173176
maskClosable={props.maskClosable}
174177
mask={props.showMask}
175-
className={props.className as string}
178+
className={clsx(`app-${appID}`, props.className)}
176179
data-testid={props.dataTestId as string}
177180
>
178181
{props.toggleClose && (

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import { BoolControl } from "comps/controls/boolControl";
2424
import { withDefault } from "comps/generators";
2525
import { SliderControl } from "../controls/sliderControl";
2626
import { getBackgroundStyle } from "@lowcoder-ee/util/styleUtils";
27+
import clsx from "clsx";
28+
import { useApplicationId } from "util/hooks";
2729

2830
const EventOptions = [
2931
{ label: trans("modalComp.open"), value: "open", description: trans("modalComp.openDesc") },
@@ -113,6 +115,7 @@ let TmpModalComp = (function () {
113115
},
114116
(props, dispatch) => {
115117
const userViewMode = useUserViewMode();
118+
const appID = useApplicationId();
116119
const bodyStyle: CSSProperties = { padding: 0 };
117120
const width = transToPxSize(props.width || DEFAULT_WIDTH);
118121
let height = undefined;
@@ -177,7 +180,7 @@ let TmpModalComp = (function () {
177180
zIndex={Layers.modal}
178181
modalRender={(node) => <ModalStyled $style={props.style} $modalScrollbar={props.modalScrollbar}>{node}</ModalStyled>}
179182
mask={props.showMask}
180-
className={props.className as string}
183+
className={clsx(`app-${appID}`, props.className)}
181184
data-testid={props.dataTestId as string}
182185
>
183186
<InnerGrid

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy