Skip to content

Commit 3c88b80

Browse files
authored
Merge pull request #1353 from chuntungho/feature/image-preview-source
support custom image preview soruce
2 parents f22e381 + f136074 commit 3c88b80

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const ContainerImg = (props: RecordConstructorToView<typeof childrenMap>) => {
151151
src={props.src.value}
152152
referrerPolicy="same-origin"
153153
draggable={false}
154-
preview={props.supportPreview}
154+
preview={props.supportPreview ? {src: props.previewSrc || props.src.value } : false}
155155
fallback={DEFAULT_IMG_URL}
156156
onClick={() => props.onEvent("click")}
157157
/>
@@ -170,6 +170,7 @@ const childrenMap = {
170170
animationStyle: styleControl(AnimationStyle , 'animationStyle'),
171171
autoHeight: withDefault(AutoHeightControl, "fixed"),
172172
supportPreview: BoolControl,
173+
previewSrc: StringControl,
173174
restrictPaddingOnRotation:withDefault(StringControl, 'image')
174175
};
175176

@@ -193,6 +194,9 @@ let ImageBasicComp = new UICompBuilder(childrenMap, (props) => {
193194
label: trans("image.supportPreview"),
194195
tooltip: trans("image.supportPreviewTip"),
195196
})}
197+
{children.supportPreview.getView() && children.previewSrc.propertyView({
198+
label: trans("image.previewSrc")
199+
})}
196200
</Section>
197201
)}
198202

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2039,7 +2039,8 @@ export const en = {
20392039
"src": "Image Source",
20402040
"srcDesc": "The Image Source. Can be an URL, Path or Base64 String. for Example: data:image/png;base64, AAA... CCC",
20412041
"supportPreview": "Support Click Preview (zoom)",
2042-
"supportPreviewTip": "Effective When the Image Source is Valid"
2042+
"supportPreviewTip": "Effective When the Image Source is Valid",
2043+
"previewSrc": "Image Preview Source"
20432044
},
20442045
"progress": {
20452046
"value": "Value",

client/packages/lowcoder/src/i18n/locales/zh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,7 @@ export const zh: typeof en = {
15631563
srcDesc: "图片链接地址",
15641564
supportPreview: "支持点击预览",
15651565
supportPreviewTip: "仅在图片链接有效时生效",
1566+
previewSrc: "图片预览链接"
15661567
},
15671568
progress: {
15681569
...en.progress,

0 commit comments

Comments
 (0)