From 42ff0ea3de9599964531f76d7d14792ec9486c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=8B?= <94534613+BoyYangzai@users.noreply.github.com> Date: Sat, 27 May 2023 20:46:28 +0800 Subject: [PATCH 1/3] docs: add rc-util to top level in codesandbox (#42672) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: tem modify rc-util@latest in codesandbox * fix: tem modify rc-util@:^5.32.0 in codesandbox * fix: add pkgDep info in dumi local pilugin * chore: rename --------- Co-authored-by: 洋 --- .dumi/theme/builtins/Previewer/CodePreviewer.tsx | 4 +++- .dumi/theme/plugin.ts | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx index e119f2fc3e..298fd8bc71 100644 --- a/.dumi/theme/builtins/Previewer/CodePreviewer.tsx +++ b/.dumi/theme/builtins/Previewer/CodePreviewer.tsx @@ -15,6 +15,7 @@ import LZString from 'lz-string'; import Prism from 'prismjs'; import React, { useContext, useEffect, useRef, useState } from 'react'; import CopyToClipboard from 'react-copy-to-clipboard'; +import type { AntdPreviewerProps } from '.'; import useLocation from '../../../hooks/useLocation'; import BrowserFrame from '../../common/BrowserFrame'; import ClientOnly from '../../common/ClientOnly'; @@ -27,7 +28,6 @@ import RiddleIcon from '../../common/RiddleIcon'; import type { SiteContextProps } from '../../slots/SiteContext'; import SiteContext from '../../slots/SiteContext'; import { ping } from '../../utils'; -import type { AntdPreviewerProps } from '.'; const { ErrorBoundary } = Alert; @@ -105,6 +105,7 @@ const CodePreviewer: React.FC = (props) => { filename, version, clientOnly, + pkgDependencyList, } = props; const { pkg } = useSiteData(); @@ -331,6 +332,7 @@ createRoot(document.getElementById('container')).render(); main: 'index.js', dependencies: { ...dependencies, + 'rc-util': pkgDependencyList['rc-util'], react: '^18.0.0', 'react-dom': '^18.0.0', 'react-scripts': '^5.0.0', diff --git a/.dumi/theme/plugin.ts b/.dumi/theme/plugin.ts index 170720ec76..952a23df96 100644 --- a/.dumi/theme/plugin.ts +++ b/.dumi/theme/plugin.ts @@ -3,6 +3,7 @@ import type { IApi, IRoute } from 'dumi'; import ReactTechStack from 'dumi/dist/techStacks/react'; import fs from 'fs'; import sylvanas from 'sylvanas'; +import localPackage from '../../package.json'; /** * extends dumi internal tech stack, for customize previewer props @@ -18,7 +19,9 @@ class AntdReactTechStack extends ReactTechStack { const codePath = opts.fileAbsPath!.replace(/\.\w+$/, '.tsx'); const code = fs.existsSync(codePath) ? fs.readFileSync(codePath, 'utf-8') : ''; + const pkgDependencyList = localPackage.dependencies; + props.pkgDependencyList = pkgDependencyList; props.jsx = sylvanas.parseText(code); if (md) { From 4aa3a4e664dd388787880f594580a53f9dc89b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kiner-tang=28=E6=96=87=E8=BE=89=29?= <1127031143@qq.com> Date: Sat, 27 May 2023 20:50:32 +0800 Subject: [PATCH 2/3] fix(Image): ImagePreviewGroup style optimize (#42675) --- components/image/index.zh-CN.md | 6 +++--- components/image/style/index.ts | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/image/index.zh-CN.md b/components/image/index.zh-CN.md index c5324fccb5..d17b107408 100644 --- a/components/image/index.zh-CN.md +++ b/components/image/index.zh-CN.md @@ -47,17 +47,17 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LVQ3R5JjjJEAAA ```typescript { visible?: boolean; - onVisibleChange?: (visible, prevVisible, current: number) => void; // current 参数v5.3.0后支持 + onVisibleChange?: (visible, prevVisible, current: number) => void; // current 参数 v5.3.0 后支持 getContainer?: string | HTMLElement | (() => HTMLElement); // v4.8.0 src?: string; // v4.10.0 mask?: ReactNode; // v4.9.0 maskClassName?: string; // v4.11.0 - rootClassName?: string; // v5.4.0后支持 + rootClassName?: string; // v5.4.0 后支持 current?: number; // v4.12.0 仅支持 PreviewGroup countRender?: (current: number, total: number) => string // v4.20.0 仅支持 PreviewGroup scaleStep?: number; forceRender?: boolean; - onChange?: (current: number, prevCurrent: number) => void; // v5.3.0后支持 + onChange?: (current: number, prevCurrent: number) => void; // v5.3.0 后支持 } ``` diff --git a/components/image/style/index.ts b/components/image/style/index.ts index 3a290eb0f4..3d26de0fe5 100644 --- a/components/image/style/index.ts +++ b/components/image/style/index.ts @@ -1,10 +1,10 @@ import type { CSSObject } from '@ant-design/cssinjs'; import { TinyColor } from '@ctrl/tinycolor'; import { genModalMaskStyle } from '../../modal/style'; -import { initZoomMotion, initFadeMotion } from '../../style/motion'; +import { resetComponent, textEllipsis } from '../../style'; +import { initFadeMotion, initZoomMotion } from '../../style/motion'; import type { FullToken, GenerateStyle } from '../../theme/internal'; import { genComponentStyleHook, mergeToken } from '../../theme/internal'; -import { resetComponent, textEllipsis } from '../../style'; export interface ComponentToken { zIndexPopup: number; @@ -81,6 +81,7 @@ export const genPreviewOperationsStyle = (token: ImageToken): CSSObject => { padding: paddingSM, cursor: 'pointer', transition: `all ${motionDurationSlow}`, + userSelect: 'none', '&:hover': { background: operationBgHover.toRgbString(), @@ -140,6 +141,7 @@ export const genPreviewSwitchStyle = (token: ImageToken): CSSObject => { cursor: 'pointer', transition: `all ${motionDurationSlow}`, pointerEvents: 'auto', + userSelect: 'none', '&:hover': { background: operationBgHover.toRgbString(), From e6a883c592ff94fb6d9bcf52070f2430812831ad Mon Sep 17 00:00:00 2001 From: Rin <52448921+KurumiRin@users.noreply.github.com> Date: Sun, 28 May 2023 01:36:03 +0800 Subject: [PATCH 3/3] style: optimization code (#42679) * style: optimization code * style: use const replace themestyle init --- components/empty/empty.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/components/empty/empty.tsx b/components/empty/empty.tsx index c382a34ab3..75a4aa5c0b 100644 --- a/components/empty/empty.tsx +++ b/components/empty/empty.tsx @@ -6,14 +6,9 @@ const Empty: React.FC = () => { const [, token] = useToken(); const bgColor = new TinyColor(token.colorBgBase); - let themeStyle: React.CSSProperties = {}; // Dark Theme need more dark of this - if (bgColor.toHsl().l < 0.5) { - themeStyle = { - opacity: 0.65, - }; - } + const themeStyle: React.CSSProperties = bgColor.toHsl().l < 0.5 ? { opacity: 0.65 } : {}; return (