Skip to content

Json components height #1091

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

Merged
merged 16 commits into from
Aug 8, 2024
Prev Previous commit
Next Next commit
scroll fixed
  • Loading branch information
MenamAfzal committed Aug 6, 2024
commit da731f2054568cb3fafead4a30e43b94ebb97e72
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ const Wrapper = styled.div<{$height: boolean; $showVerticalScrollbar:boolean}>`
background-color: #fff;
border: 1px solid #d7d9e0;
border-radius: 4px;
overflow: scroll;
height: ${(props) => (props.$height ? '100%' : '300px')};
overflow-y: scroll;
height: ${(props) => (props.$height ? '100%' : '200px')};
&::-webkit-scrollbar {
width: 16px;
display: ${props=>props.$showVerticalScrollbar&&'block !important'};
Expand Down Expand Up @@ -70,7 +70,7 @@ function fixOldDataSecond(oldData: any) {
const childrenMap = {
value: jsonValueExposingStateControl('value', defaultData),
onEvent: ChangeEventHandlerControl,
autoHeight: AutoHeightControl,
autoHeight: withDefault(AutoHeightControl,'auto'),
showVerticalScrollbar:BoolControl,
label: withDefault(LabelControl, {position: 'column'}),
style: styleControl(JsonEditorStyle, 'style'),
Expand Down Expand Up @@ -156,9 +156,9 @@ let JsonEditorTmpComp = (function () {
<Section name={trans('prop.height')}>
{children.autoHeight.propertyView({ label: trans('prop.height') })}
</Section>
<Section name={sectionNames.layout}>
{!children.autoHeight.getView()&&<Section name={sectionNames.layout}>
{children.showVerticalScrollbar.propertyView({label:trans('prop.showVerticalScrollbar')})}
</Section>
</Section>}
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && ( children.label.getPropertyView() )}
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<>
Expand All @@ -179,7 +179,7 @@ JsonEditorTmpComp = migrateOldData(JsonEditorTmpComp, fixOldDataSecond);

JsonEditorTmpComp = class extends JsonEditorTmpComp {
override autoHeight(): boolean {
return false;
return this.children.autoHeight.getView();
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const JsonExplorerContainer = styled.div<{
let JsonExplorerTmpComp = (function () {
const childrenMap = {
value: withDefault(ArrayOrJSONObjectControl, JSON.stringify(defaultData, null, 2)),
autoHeight: AutoHeightControl,
autoHeight: withDefault(AutoHeightControl, 'auto'),
showVerticalScrollbar:BoolControl,
indent: withDefault(NumberControl, 4),
expandToggle: BoolControl.DEFAULT_TRUE,
Expand Down Expand Up @@ -110,11 +110,11 @@ let JsonExplorerTmpComp = (function () {
<Section name={trans('prop.height')}>
{children.autoHeight.propertyView({label: trans('prop.height')})}
</Section>
<Section name={sectionNames.layout}>
{!children.autoHeight.getView()&&<Section name={sectionNames.layout}>
{children.showVerticalScrollbar.propertyView({
label: trans('prop.showVerticalScrollbar'),
})}
</Section>
</Section>}
{(useContext(EditorContext).editorModeStatus === 'layout' ||
useContext(EditorContext).editorModeStatus === 'both') && (
<>
Expand All @@ -136,7 +136,7 @@ let JsonExplorerTmpComp = (function () {

JsonExplorerTmpComp = class extends JsonExplorerTmpComp {
override autoHeight(): boolean {
return false;
return this.children.autoHeight.getView();
}
};

Expand Down
Loading