Skip to content

Commit

Permalink
Merge pull request #1353 from chuntungho/feature/image-preview-source
Browse files Browse the repository at this point in the history
support custom image preview soruce
  • Loading branch information
FalkWolsky authored Nov 28, 2024
2 parents f22e381 + f136074 commit 3c88b80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion client/packages/lowcoder/src/comps/comps/imageComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const ContainerImg = (props: RecordConstructorToView<typeof childrenMap>) => {
src={props.src.value}
referrerPolicy="same-origin"
draggable={false}
preview={props.supportPreview}
preview={props.supportPreview ? {src: props.previewSrc || props.src.value } : false}
fallback={DEFAULT_IMG_URL}
onClick={() => props.onEvent("click")}
/>
Expand All @@ -170,6 +170,7 @@ const childrenMap = {
animationStyle: styleControl(AnimationStyle , 'animationStyle'),
autoHeight: withDefault(AutoHeightControl, "fixed"),
supportPreview: BoolControl,
previewSrc: StringControl,
restrictPaddingOnRotation:withDefault(StringControl, 'image')
};

Expand All @@ -193,6 +194,9 @@ let ImageBasicComp = new UICompBuilder(childrenMap, (props) => {
label: trans("image.supportPreview"),
tooltip: trans("image.supportPreviewTip"),
})}
{children.supportPreview.getView() && children.previewSrc.propertyView({
label: trans("image.previewSrc")
})}
</Section>
)}

Expand Down
3 changes: 2 additions & 1 deletion client/packages/lowcoder/src/i18n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,8 @@ export const en = {
"src": "Image Source",
"srcDesc": "The Image Source. Can be an URL, Path or Base64 String. for Example: data:image/png;base64, AAA... CCC",
"supportPreview": "Support Click Preview (zoom)",
"supportPreviewTip": "Effective When the Image Source is Valid"
"supportPreviewTip": "Effective When the Image Source is Valid",
"previewSrc": "Image Preview Source"
},
"progress": {
"value": "Value",
Expand Down
1 change: 1 addition & 0 deletions client/packages/lowcoder/src/i18n/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,7 @@ export const zh: typeof en = {
srcDesc: "图片链接地址",
supportPreview: "支持点击预览",
supportPreviewTip: "仅在图片链接有效时生效",
previewSrc: "图片预览链接"
},
progress: {
...en.progress,
Expand Down

0 comments on commit 3c88b80

Please sign in to comment.