Skip to content

Commit ac126e6

Browse files
committed
added height control in fileViewer
1 parent 908ccf5 commit ac126e6

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

client/packages/lowcoder/src/comps/comps/fileViewerComp.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import { DocumentViewer } from "react-documents";
66
import styled, { css } from "styled-components";
77
import { Section, sectionNames } from "lowcoder-design";
88
import { StringControl } from "../controls/codeControl";
9-
import { UICompBuilder } from "../generators";
9+
import { UICompBuilder, withDefault } from "../generators";
1010
import { NameConfig, NameConfigHidden, withExposingConfigs } from "../generators/withExposing";
1111
import { hiddenPropertyView } from "comps/utils/propertyUtils";
1212
import { trans } from "i18n";
13-
13+
import { AutoHeightControl, BoolControl } from "@lowcoder-ee/index.sdk";
1414
import { useContext } from "react";
1515
import { EditorContext } from "comps/editorState";
1616

@@ -67,6 +67,8 @@ const DraggableFileViewer = (props: { src: string; style: FileViewerStyleType,an
6767
let FileViewerBasicComp = (function () {
6868
const childrenMap = {
6969
src: StringControl,
70+
autoHeight: withDefault(AutoHeightControl,'auto'),
71+
showVerticalScrollbar: withDefault(BoolControl, false),
7072
style: styleControl(FileViewerStyle , 'style'),
7173
animationStyle: styleControl(AnimationStyle , 'animationStyle'),
7274
};
@@ -100,6 +102,14 @@ let FileViewerBasicComp = (function () {
100102
{hiddenPropertyView(children)}
101103
</Section>
102104
)}
105+
<Section name={sectionNames.layout}>
106+
{children.autoHeight.getPropertyView()}
107+
{!children.autoHeight.getView() && (
108+
children.showVerticalScrollbar.propertyView({
109+
label: trans("prop.showVerticalScrollbar"),
110+
})
111+
)}
112+
</Section>
103113

104114
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
105115
<>
@@ -119,7 +129,7 @@ let FileViewerBasicComp = (function () {
119129

120130
FileViewerBasicComp = class extends FileViewerBasicComp {
121131
override autoHeight(): boolean {
122-
return false;
132+
return this.children.autoHeight.getView();
123133
}
124134
};
125135

0 commit comments

Comments
 (0)