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) { 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 ( 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(),