From 94aec25ababaa03ebf824936d442d7f23159a58e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E7=88=B1=E5=90=83=E7=99=BD=E8=90=9D?= =?UTF-8?q?=E5=8D=9C?= Date: Fri, 7 Apr 2023 10:17:00 +0800 Subject: [PATCH] feat: ConfigProvider support config `popupOverflow` for scroll logic (#41676) * feat: popupOverflow * test: add test case * docs: preview * docs: update preview * test: update test case --- .dumi/theme/builtins/InlinePopover/index.tsx | 50 + components/cascader/index.tsx | 5 +- .../__snapshots__/popup.test.tsx.snap | 3522 ----------------- .../config-provider/__tests__/popup.test.tsx | 53 +- components/config-provider/context.ts | 3 + components/config-provider/index.en-US.md | 2 +- components/config-provider/index.tsx | 12 +- components/config-provider/index.zh-CN.md | 2 +- components/select/index.tsx | 3 +- components/select/useBuiltinPlacements.tsx | 70 +- components/tree-select/index.tsx | 3 +- 11 files changed, 162 insertions(+), 3563 deletions(-) create mode 100644 .dumi/theme/builtins/InlinePopover/index.tsx diff --git a/.dumi/theme/builtins/InlinePopover/index.tsx b/.dumi/theme/builtins/InlinePopover/index.tsx new file mode 100644 index 000000000000..d2327e8ff4c0 --- /dev/null +++ b/.dumi/theme/builtins/InlinePopover/index.tsx @@ -0,0 +1,50 @@ +import { PictureOutlined } from '@ant-design/icons'; +import { Image, Tooltip, Typography } from 'antd'; +import React from 'react'; +import useLocale from '../../../hooks/useLocale'; + +const locales = { + cn: { + tip: '预览', + }, + en: { + tip: 'Preview', + }, +}; + +export interface InlinePopoverProps { + previewURL?: string; +} + +// 鼠标悬浮弹出 Popover 组件,用于帮助用户更快看到一些属性对应的预览效果 +const InlinePopover: React.FC = (props: InlinePopoverProps) => { + const { previewURL } = props; + + const [locale] = useLocale(locales); + const [visible, setVisible] = React.useState(false); + + return ( + <> + + setVisible(true)}> + + + + + { + setVisible(value); + }, + }} + /> + + ); +}; + +export default InlinePopover; diff --git a/components/cascader/index.tsx b/components/cascader/index.tsx index ef61f2306d4c..f11cdb002e59 100644 --- a/components/cascader/index.tsx +++ b/components/cascader/index.tsx @@ -161,8 +161,7 @@ const Cascader = React.forwardRef((props: CascaderProps, ref: React.Ref, ref: React.Ref -
-
-
-
-
-
-
-
- 0 -
-
-
-
- 1 -
-
-
-
- 2 -
-
-
-
- 3 -
-
-
-
- 4 -
-
-
-
- 5 -
-
-
-
- 6 -
-
-
-
- 7 -
-
-
-
- 8 -
-
-
-
- 9 -
-
-
-
- 10 -
-
-
-
- 11 -
-
-
-
- 12 -
-
-
-
- 13 -
-
-
-
- 14 -
-
-
-
- 15 -
-
-
-
- 16 -
-
-
-
- 17 -
-
-
-
- 18 -
-
-
-
- 19 -
-
-
-
-
-
-
-