@@ -14,6 +14,7 @@ import { useContext, useEffect } from "react";
14
14
import { AnimationStyle , AnimationStyleType } from "@lowcoder-ee/comps/controls/styleControlConstants" ;
15
15
import { styleControl } from "@lowcoder-ee/comps/controls/styleControl" ;
16
16
import { useMergeCompStyles } from "@lowcoder-ee/util/hooks" ;
17
+ import { AutoHeightControl } from "@lowcoder-ee/index.sdk" ;
17
18
18
19
/**
19
20
* JsonExplorer Comp
@@ -40,9 +41,10 @@ const bgColorMap = {
40
41
const JsonExplorerContainer = styled . div < {
41
42
$theme : keyof typeof bgColorMap ;
42
43
$animationStyle : AnimationStyleType ;
44
+ $height : boolean
43
45
} > `
44
46
${ ( props ) => props . $animationStyle }
45
- height: 100%;
47
+ height: ${ props => props . $height ? ' 100%' : '300px' } ;
46
48
overflow-y: scroll;
47
49
background-color: ${ ( props ) => bgColorMap [ props . $theme ] || "#ffffff" } ;
48
50
border: 1px solid #d7d9e0;
@@ -53,6 +55,7 @@ const JsonExplorerContainer = styled.div<{
53
55
let JsonExplorerTmpComp = ( function ( ) {
54
56
const childrenMap = {
55
57
value : withDefault ( ArrayOrJSONObjectControl , JSON . stringify ( defaultData , null , 2 ) ) ,
58
+ autoHeight : AutoHeightControl ,
56
59
indent : withDefault ( NumberControl , 4 ) ,
57
60
expandToggle : BoolControl . DEFAULT_TRUE ,
58
61
theme : dropdownControl ( themeOptions , 'shapeshifter:inverted' ) ,
@@ -63,6 +66,7 @@ let JsonExplorerTmpComp = (function () {
63
66
64
67
return (
65
68
< JsonExplorerContainer
69
+ $height = { props . autoHeight }
66
70
$theme = { props . theme as keyof typeof bgColorMap }
67
71
$animationStyle = { props . animationStyle }
68
72
>
@@ -81,7 +85,7 @@ let JsonExplorerTmpComp = (function () {
81
85
return (
82
86
< >
83
87
< Section name = { sectionNames . basic } >
84
- { children . value . propertyView ( { label : trans ( "export.jsonEditorDesc" ) } ) }
88
+ { children . value . propertyView ( { label : trans ( "export.jsonEditorDesc" ) } ) }
85
89
</ Section >
86
90
87
91
{ ( useContext ( EditorContext ) . editorModeStatus === "logic" || useContext ( EditorContext ) . editorModeStatus === "both" ) && (
@@ -96,7 +100,9 @@ let JsonExplorerTmpComp = (function () {
96
100
{ children . indent . propertyView ( { label : trans ( "jsonExplorer.indent" ) } ) }
97
101
</ Section >
98
102
) }
99
-
103
+ < Section name = { trans ( 'prop.height' ) } >
104
+ { children . autoHeight . propertyView ( { label : trans ( 'prop.height' ) } ) }
105
+ </ Section >
100
106
{ ( useContext ( EditorContext ) . editorModeStatus === 'layout' ||
101
107
useContext ( EditorContext ) . editorModeStatus === 'both' ) && (
102
108
< >
0 commit comments