1
- import { Section , sectionNames } from "lowcoder-design" ;
1
+ import { ScrollBar , Section , sectionNames } from "lowcoder-design" ;
2
2
import { UICompBuilder } from "../../generators" ;
3
3
import { NameConfigHidden , NameConfig , withExposingConfigs } from "../../generators/withExposing" ;
4
4
import { defaultData } from "./jsonConstants" ;
@@ -27,16 +27,12 @@ import { AutoHeightControl, BoolControl } from "@lowcoder-ee/index.sdk";
27
27
* JsonEditor Comp
28
28
*/
29
29
30
- const Wrapper = styled . div < { $height : boolean ; $showVerticalScrollbar :boolean } > `
30
+ const Wrapper = styled . div < { $height : boolean ; $showVerticalScrollbar : boolean } > `
31
31
background-color: #fff;
32
32
border: 1px solid #d7d9e0;
33
33
border-radius: 4px;
34
- overflow-y: scroll;
35
34
height: 100%;
36
- &::-webkit-scrollbar {
37
- width: 16px;
38
- display: ${ props => props . $showVerticalScrollbar && 'block !important' } ;
39
- }
35
+ overflow-y: ${ props => ( props . $showVerticalScrollbar ? 'scroll' : 'auto' ) } ;
40
36
` ;
41
37
42
38
/**
@@ -129,12 +125,17 @@ let JsonEditorTmpComp = (function () {
129
125
style : props . style ,
130
126
animationStyle : props . animationStyle ,
131
127
children : (
132
- < Wrapper
133
- ref = { wrapperRef }
134
- onFocus = { ( ) => ( editContent . current = 'focus' ) }
135
- $height = { props . autoHeight }
136
- $showVerticalScrollbar = { props . showVerticalScrollbar }
137
- />
128
+
129
+
130
+ < ScrollBar hideScrollbar = { ! props . showVerticalScrollbar } >
131
+ < Wrapper
132
+ ref = { wrapperRef }
133
+ onFocus = { ( ) => ( editContent . current = 'focus' ) }
134
+ $height = { props . autoHeight }
135
+ $showVerticalScrollbar = { props . showVerticalScrollbar }
136
+ />
137
+ </ ScrollBar >
138
+
138
139
) ,
139
140
} ) ;
140
141
} )
@@ -157,8 +158,9 @@ let JsonEditorTmpComp = (function () {
157
158
{ children . autoHeight . propertyView ( { label : trans ( 'prop.height' ) } ) }
158
159
</ Section >
159
160
{ ! children . autoHeight . getView ( ) && < Section name = { sectionNames . layout } >
160
- { children . showVerticalScrollbar . propertyView ( { label :trans ( 'prop.showVerticalScrollbar' ) } ) }
161
- </ Section > }
161
+ { children . showVerticalScrollbar . propertyView ( { label : trans ( 'prop.showVerticalScrollbar' ) } ) }
162
+
163
+ </ Section > }
162
164
{ ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && ( children . label . getPropertyView ( ) ) }
163
165
{ ( useContext ( EditorContext ) . editorModeStatus === "layout" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
164
166
< >
0 commit comments