From ab0103f33ac8f80be9b0d891a27d66339c39cc10 Mon Sep 17 00:00:00 2001 From: daisy <47104575+linxianxi@users.noreply.github.com> Date: Wed, 21 Jun 2023 19:58:28 +0800 Subject: [PATCH] =?UTF-8?q?feat(Image):=20imageRender=E3=80=81toolbarRende?= =?UTF-8?q?r=E3=80=81onTransform=E3=80=81items=E3=80=81minScale=E3=80=81ma?= =?UTF-8?q?x=E2=80=A6=20(#43075)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(Image): imageRender、toolbarRender、onTransform、items、minScale、maxScale * test: update snapshots * demo: revokeObjectURL url * docs: update * docs: update * docs: update * fix: revert style * docs: update md --- .../__snapshots__/demo-extend.test.ts.snap | 258 ++++++++---------- .../__tests__/__snapshots__/demo.test.ts.snap | 258 ++++++++---------- .../__snapshots__/index.test.tsx.snap | 74 ++--- components/image/demo/imageRender.md | 7 + components/image/demo/imageRender.tsx | 24 ++ .../image/demo/preview-group-visible.tsx | 37 +-- components/image/demo/toolbarRender.md | 7 + components/image/demo/toolbarRender.tsx | 60 ++++ components/image/index.en-US.md | 125 ++++++++- components/image/index.zh-CN.md | 124 ++++++++- components/image/style/index.ts | 9 +- package.json | 2 +- 12 files changed, 602 insertions(+), 383 deletions(-) create mode 100644 components/image/demo/imageRender.md create mode 100644 components/image/demo/imageRender.tsx create mode 100644 components/image/demo/toolbarRender.md create mode 100644 components/image/demo/toolbarRender.tsx diff --git a/components/image/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/image/__tests__/__snapshots__/demo-extend.test.ts.snap index be1651315e..c558a5af87 100644 --- a/components/image/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/image/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -298,6 +298,47 @@ exports[`renders components/image/demo/fallback.tsx extend context correctly 1`] `; +exports[`renders components/image/demo/imageRender.tsx extend context correctly 1`] = ` +
+ +
+
+ + + + Preview +
+
+
+`; + exports[`renders components/image/demo/placeholder.tsx extend context correctly 1`] = `
- -
-
- - - - Preview -
-
-
, +
+ , -] +
+ `; exports[`renders components/image/demo/preview-mask.tsx extend context correctly 1`] = ` @@ -820,3 +747,44 @@ exports[`renders components/image/demo/previewSrc.tsx extend context correctly 1 `; + +exports[`renders components/image/demo/toolbarRender.tsx extend context correctly 1`] = ` +
+ +
+
+ + + + Preview +
+
+
+`; diff --git a/components/image/__tests__/__snapshots__/demo.test.ts.snap b/components/image/__tests__/__snapshots__/demo.test.ts.snap index 4fd5b5d821..5124de5f7d 100644 --- a/components/image/__tests__/__snapshots__/demo.test.ts.snap +++ b/components/image/__tests__/__snapshots__/demo.test.ts.snap @@ -299,6 +299,47 @@ exports[`renders components/image/demo/fallback.tsx correctly 1`] = ` `; +exports[`renders components/image/demo/imageRender.tsx correctly 1`] = ` +
+ +
+
+ + + + Preview +
+
+
+`; + exports[`renders components/image/demo/placeholder.tsx correctly 1`] = `
- -
-
- - - - Preview -
-
-
, +
+ , -] +
+ `; exports[`renders components/image/demo/preview-mask.tsx correctly 1`] = ` @@ -821,3 +748,44 @@ exports[`renders components/image/demo/previewSrc.tsx correctly 1`] = ` `; + +exports[`renders components/image/demo/toolbarRender.tsx correctly 1`] = ` +
+ +
+
+ + + + Preview +
+
+
+`; diff --git a/components/image/__tests__/__snapshots__/index.test.tsx.snap b/components/image/__tests__/__snapshots__/index.test.tsx.snap index 2207aaeeda..6f6d4e020b 100644 --- a/components/image/__tests__/__snapshots__/index.test.tsx.snap +++ b/components/image/__tests__/__snapshots__/index.test.tsx.snap @@ -52,39 +52,40 @@ exports[`Image Default Group preview props 1`] = ` 1 / 1
  • @@ -150,45 +157,39 @@ exports[`Image Default Group preview props 1`] = `
  • diff --git a/components/image/demo/imageRender.md b/components/image/demo/imageRender.md new file mode 100644 index 0000000000..be37917067 --- /dev/null +++ b/components/image/demo/imageRender.md @@ -0,0 +1,7 @@ +## zh-CN + +可以自定义预览内容。 + +## en-US + +You can customize the preview content. diff --git a/components/image/demo/imageRender.tsx b/components/image/demo/imageRender.tsx new file mode 100644 index 0000000000..c3c8dd5fcf --- /dev/null +++ b/components/image/demo/imageRender.tsx @@ -0,0 +1,24 @@ +import { Image } from 'antd'; +import React from 'react'; + +const App: React.FC = () => ( + ( +