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 in JSONEditor Comp
  • Loading branch information
MenamAfzal committed Aug 7, 2024
commit 8d632f7335d2ace84d8c393ab73cf020df0dfd5c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Section, sectionNames } from "lowcoder-design";
import { ScrollBar, Section, sectionNames } from "lowcoder-design";
import { UICompBuilder } from "../../generators";
import { NameConfigHidden, NameConfig, withExposingConfigs } from "../../generators/withExposing";
import { defaultData } from "./jsonConstants";
Expand Down Expand Up @@ -27,16 +27,12 @@ import { AutoHeightControl, BoolControl } from "@lowcoder-ee/index.sdk";
* JsonEditor Comp
*/

const Wrapper = styled.div<{$height: boolean; $showVerticalScrollbar:boolean}>`
const Wrapper = styled.div<{$height: boolean; $showVerticalScrollbar: boolean}>`
background-color: #fff;
border: 1px solid #d7d9e0;
border-radius: 4px;
overflow-y: scroll;
height: 100%;
&::-webkit-scrollbar {
width: 16px;
display: ${props=>props.$showVerticalScrollbar&&'block !important'};
}
overflow-y: ${props => (props.$showVerticalScrollbar ? 'scroll' : 'auto')};
`;

/**
Expand Down Expand Up @@ -129,12 +125,17 @@ let JsonEditorTmpComp = (function () {
style: props.style,
animationStyle: props.animationStyle,
children: (
<Wrapper
ref={wrapperRef}
onFocus={() => (editContent.current = 'focus')}
$height={props.autoHeight}
$showVerticalScrollbar={props.showVerticalScrollbar}
/>


<ScrollBar hideScrollbar={!props.showVerticalScrollbar}>
<Wrapper
ref={wrapperRef}
onFocus={() => (editContent.current = 'focus')}
$height={props.autoHeight}
$showVerticalScrollbar={props.showVerticalScrollbar}
/>
</ScrollBar>

),
});
})
Expand All @@ -157,8 +158,9 @@ let JsonEditorTmpComp = (function () {
{children.autoHeight.propertyView({ label: trans('prop.height') })}
</Section>
{!children.autoHeight.getView()&&<Section name={sectionNames.layout}>
{children.showVerticalScrollbar.propertyView({label:trans('prop.showVerticalScrollbar')})}
</Section>}
{children.showVerticalScrollbar.propertyView({label: trans('prop.showVerticalScrollbar')})}

</Section>}
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && ( children.label.getPropertyView() )}
{(useContext(EditorContext).editorModeStatus === "layout" || useContext(EditorContext).editorModeStatus === "both") && (
<>
Expand Down
Loading