mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 14:13:37 +08:00
chore: merge master into feature
This commit is contained in:
commit
bc5752eb6f
@ -22,7 +22,7 @@ const GlobalDemoStyles: React.FC = () => {
|
|||||||
.code-box {
|
.code-box {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 100%;
|
width: calc(100% - ${token.lineWidth * 2}px);
|
||||||
margin: 0 0 16px;
|
margin: 0 0 16px;
|
||||||
background-color: ${token.colorBgContainer};
|
background-color: ${token.colorBgContainer};
|
||||||
border: 1px solid ${token.colorSplit};
|
border: 1px solid ${token.colorSplit};
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React, { useCallback, useEffect, useMemo } from 'react';
|
import React, { useCallback, useEffect, useMemo, Suspense } from 'react';
|
||||||
import dayjs from 'dayjs';
|
|
||||||
import {
|
import {
|
||||||
createCache,
|
createCache,
|
||||||
extractStyle,
|
extractStyle,
|
||||||
@ -18,11 +17,12 @@ import { DarkContext } from '../../hooks/useDark';
|
|||||||
import useLayoutState from '../../hooks/useLayoutState';
|
import useLayoutState from '../../hooks/useLayoutState';
|
||||||
import useLocation from '../../hooks/useLocation';
|
import useLocation from '../../hooks/useLocation';
|
||||||
import type { ThemeName } from '../common/ThemeSwitch';
|
import type { ThemeName } from '../common/ThemeSwitch';
|
||||||
import ThemeSwitch from '../common/ThemeSwitch';
|
|
||||||
import SiteThemeProvider from '../SiteThemeProvider';
|
import SiteThemeProvider from '../SiteThemeProvider';
|
||||||
import type { SiteContextProps } from '../slots/SiteContext';
|
import type { SiteContextProps } from '../slots/SiteContext';
|
||||||
import SiteContext from '../slots/SiteContext';
|
import SiteContext from '../slots/SiteContext';
|
||||||
|
|
||||||
|
const ThemeSwitch = React.lazy(() => import('../common/ThemeSwitch'));
|
||||||
|
|
||||||
type Entries<T> = { [K in keyof T]: [K, T[K]] }[keyof T][];
|
type Entries<T> = { [K in keyof T]: [K, T[K]] }[keyof T][];
|
||||||
type SiteState = Partial<Omit<SiteContextProps, 'updateSiteContext'>>;
|
type SiteState = Partial<Omit<SiteContextProps, 'updateSiteContext'>>;
|
||||||
|
|
||||||
@ -101,15 +101,15 @@ const GlobalLayout: React.FC = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const _theme = searchParams.getAll('theme') as ThemeName[];
|
const _theme = searchParams.getAll('theme') as ThemeName[];
|
||||||
const _direction = searchParams.get('direction') as DirectionType;
|
const _direction = searchParams.get('direction') as DirectionType;
|
||||||
const storedBannerVisibleLastTime =
|
// const storedBannerVisibleLastTime =
|
||||||
localStorage && localStorage.getItem(ANT_DESIGN_NOT_SHOW_BANNER);
|
// localStorage && localStorage.getItem(ANT_DESIGN_NOT_SHOW_BANNER);
|
||||||
const storedBannerVisible =
|
// const storedBannerVisible =
|
||||||
storedBannerVisibleLastTime && dayjs().diff(dayjs(storedBannerVisibleLastTime), 'day') >= 1;
|
// storedBannerVisibleLastTime && dayjs().diff(dayjs(storedBannerVisibleLastTime), 'day') >= 1;
|
||||||
|
|
||||||
setSiteState({
|
setSiteState({
|
||||||
theme: _theme,
|
theme: _theme,
|
||||||
direction: _direction === 'rtl' ? 'rtl' : 'ltr',
|
direction: _direction === 'rtl' ? 'rtl' : 'ltr',
|
||||||
bannerVisible: storedBannerVisibleLastTime ? !!storedBannerVisible : true,
|
// bannerVisible: storedBannerVisibleLastTime ? !!storedBannerVisible : true,
|
||||||
});
|
});
|
||||||
// Handle isMobile
|
// Handle isMobile
|
||||||
updateMobileMode();
|
updateMobileMode();
|
||||||
@ -174,10 +174,12 @@ const GlobalLayout: React.FC = () => {
|
|||||||
content = (
|
content = (
|
||||||
<App>
|
<App>
|
||||||
{outlet}
|
{outlet}
|
||||||
<ThemeSwitch
|
<Suspense>
|
||||||
value={theme}
|
<ThemeSwitch
|
||||||
onChange={(nextTheme) => updateSiteConfig({ theme: nextTheme })}
|
value={theme}
|
||||||
/>
|
onChange={(nextTheme) => updateSiteConfig({ theme: nextTheme })}
|
||||||
|
/>
|
||||||
|
</Suspense>
|
||||||
</App>
|
</App>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ export interface SiteContextProps {
|
|||||||
|
|
||||||
const SiteContext = React.createContext<SiteContextProps>({
|
const SiteContext = React.createContext<SiteContextProps>({
|
||||||
isMobile: false,
|
isMobile: false,
|
||||||
bannerVisible: true,
|
bannerVisible: false,
|
||||||
direction: 'ltr',
|
direction: 'ltr',
|
||||||
theme: ['light'],
|
theme: ['light'],
|
||||||
updateSiteConfig: () => {},
|
updateSiteConfig: () => {},
|
||||||
|
@ -16,6 +16,13 @@ tag: vVERSION
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 5.12.7
|
||||||
|
|
||||||
|
`2024-01-02`
|
||||||
|
|
||||||
|
- 🐞 MISC: Fix error caused by upgrading `@ctrl/tinycolor@4.0.2`. [#46744](https://github.com/ant-design/ant-design/pull/46744) [@MadCcc](https://github.com/MadCcc)
|
||||||
|
- 🐞 Fix Mentions item height bug. [#46737](https://github.com/ant-design/ant-design/pull/46737)
|
||||||
|
|
||||||
## 5.12.6
|
## 5.12.6
|
||||||
|
|
||||||
`2023-12-30`
|
`2023-12-30`
|
||||||
|
@ -16,6 +16,13 @@ tag: vVERSION
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 5.12.7
|
||||||
|
|
||||||
|
`2024-01-02`
|
||||||
|
|
||||||
|
- 🐞 MISC: 修复升级 `@ctrl/tinycolor@4.0.2` 导致的错误。[#46744](https://github.com/ant-design/ant-design/pull/46744) [@MadCcc](https://github.com/MadCcc)
|
||||||
|
- 🐞 修复 Mentions 选项高度偏大的问题。[#46737](https://github.com/ant-design/ant-design/pull/46737)
|
||||||
|
|
||||||
## 5.12.6
|
## 5.12.6
|
||||||
|
|
||||||
`2023-12-30`
|
`2023-12-30`
|
||||||
|
@ -16,7 +16,7 @@ export type PanelPickType = Exclude<PickType, 'checkable'> | 'multiple' | 'rootC
|
|||||||
|
|
||||||
export type CascaderPanelProps = Pick<CascaderProps, PanelPickType>;
|
export type CascaderPanelProps = Pick<CascaderProps, PanelPickType>;
|
||||||
|
|
||||||
export default function CascaderPanel(props: CascaderPanelProps) {
|
const CascaderPanel: React.FC<CascaderPanelProps> = (props) => {
|
||||||
const {
|
const {
|
||||||
prefixCls: customizePrefixCls,
|
prefixCls: customizePrefixCls,
|
||||||
className,
|
className,
|
||||||
@ -63,4 +63,6 @@ export default function CascaderPanel(props: CascaderPanelProps) {
|
|||||||
loadingIcon={loadingIcon}
|
loadingIcon={loadingIcon}
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export default CascaderPanel;
|
||||||
|
@ -5,8 +5,8 @@ import type {
|
|||||||
DefaultOptionType,
|
DefaultOptionType,
|
||||||
FieldNames,
|
FieldNames,
|
||||||
MultipleCascaderProps as RcMultipleCascaderProps,
|
MultipleCascaderProps as RcMultipleCascaderProps,
|
||||||
ShowSearchType,
|
|
||||||
SingleCascaderProps as RcSingleCascaderProps,
|
SingleCascaderProps as RcSingleCascaderProps,
|
||||||
|
ShowSearchType,
|
||||||
} from 'rc-cascader';
|
} from 'rc-cascader';
|
||||||
import RcCascader from 'rc-cascader';
|
import RcCascader from 'rc-cascader';
|
||||||
import type { Placement } from 'rc-select/lib/BaseSelect';
|
import type { Placement } from 'rc-select/lib/BaseSelect';
|
||||||
@ -26,6 +26,8 @@ import useCSSVarCls from '../config-provider/hooks/useCSSVarCls';
|
|||||||
import useSize from '../config-provider/hooks/useSize';
|
import useSize from '../config-provider/hooks/useSize';
|
||||||
import type { SizeType } from '../config-provider/SizeContext';
|
import type { SizeType } from '../config-provider/SizeContext';
|
||||||
import { FormItemInputContext } from '../form/context';
|
import { FormItemInputContext } from '../form/context';
|
||||||
|
import type { Variant } from '../form/hooks/useVariants';
|
||||||
|
import useVariant from '../form/hooks/useVariants';
|
||||||
import mergedBuiltinPlacements from '../select/mergedBuiltinPlacements';
|
import mergedBuiltinPlacements from '../select/mergedBuiltinPlacements';
|
||||||
import useSelectStyle from '../select/style';
|
import useSelectStyle from '../select/style';
|
||||||
import useIcons from '../select/useIcons';
|
import useIcons from '../select/useIcons';
|
||||||
@ -36,8 +38,6 @@ import useCheckable from './hooks/useCheckable';
|
|||||||
import useColumnIcons from './hooks/useColumnIcons';
|
import useColumnIcons from './hooks/useColumnIcons';
|
||||||
import CascaderPanel from './Panel';
|
import CascaderPanel from './Panel';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
import type { Variant } from '../form/hooks/useVariants';
|
|
||||||
import useVariant from '../form/hooks/useVariants';
|
|
||||||
|
|
||||||
// Align the design since we use `rc-select` in root. This help:
|
// Align the design since we use `rc-select` in root. This help:
|
||||||
// - List search content will show all content
|
// - List search content will show all content
|
||||||
@ -348,10 +348,7 @@ const Cascader = React.forwardRef<CascaderRef, CascaderProps<any>>((props, ref)
|
|||||||
checkable={checkable}
|
checkable={checkable}
|
||||||
dropdownClassName={mergedDropdownClassName}
|
dropdownClassName={mergedDropdownClassName}
|
||||||
dropdownPrefixCls={customizePrefixCls || cascaderPrefixCls}
|
dropdownPrefixCls={customizePrefixCls || cascaderPrefixCls}
|
||||||
dropdownStyle={{
|
dropdownStyle={{ ...restProps.dropdownStyle, zIndex }}
|
||||||
...restProps.dropdownStyle,
|
|
||||||
zIndex,
|
|
||||||
}}
|
|
||||||
choiceTransitionName={getTransitionName(rootPrefixCls, '', choiceTransitionName)}
|
choiceTransitionName={getTransitionName(rootPrefixCls, '', choiceTransitionName)}
|
||||||
transitionName={getTransitionName(rootPrefixCls, 'slide-up', transitionName)}
|
transitionName={getTransitionName(rootPrefixCls, 'slide-up', transitionName)}
|
||||||
getPopupContainer={getPopupContainer || getContextPopupContainer}
|
getPopupContainer={getPopupContainer || getContextPopupContainer}
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
|
import * as React from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { Popup } from 'rc-tooltip';
|
import { Popup } from 'rc-tooltip';
|
||||||
import * as React from 'react';
|
|
||||||
import type { PopoverProps } from '.';
|
|
||||||
import { ConfigContext } from '../config-provider';
|
|
||||||
|
|
||||||
|
import type { PopoverProps } from '.';
|
||||||
import { getRenderPropValue } from '../_util/getRenderPropValue';
|
import { getRenderPropValue } from '../_util/getRenderPropValue';
|
||||||
|
import { ConfigContext } from '../config-provider';
|
||||||
import useStyle from './style';
|
import useStyle from './style';
|
||||||
|
|
||||||
export const getOverlay = (
|
export const getOverlay = (
|
||||||
prefixCls: string,
|
prefixCls?: string,
|
||||||
title?: PopoverProps['title'],
|
title?: PopoverProps['title'],
|
||||||
content?: PopoverProps['content'],
|
content?: PopoverProps['content'],
|
||||||
) => {
|
) => {
|
||||||
if (!title && !content) return undefined;
|
if (!title && !content) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{title && <div className={`${prefixCls}-title`}>{getRenderPropValue(title)}</div>}
|
{title && <div className={`${prefixCls}-title`}>{getRenderPropValue(title)}</div>}
|
||||||
@ -54,7 +56,7 @@ export const RawPurePanel: React.FC<RawPurePanelProps> = (props) => {
|
|||||||
>
|
>
|
||||||
<div className={`${prefixCls}-arrow`} />
|
<div className={`${prefixCls}-arrow`} />
|
||||||
<Popup {...props} className={hashId} prefixCls={prefixCls}>
|
<Popup {...props} className={hashId} prefixCls={prefixCls}>
|
||||||
{children || getOverlay(prefixCls!, title, content)}
|
{children || getOverlay(prefixCls, title, content)}
|
||||||
</Popup>
|
</Popup>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
import demoTest, { rootPropsTest } from '../../../tests/shared/demoTest';
|
||||||
|
|
||||||
demoTest('popover', {
|
demoTest('popover', {
|
||||||
@ -12,7 +13,5 @@ rootPropsTest(
|
|||||||
<span />
|
<span />
|
||||||
</Popover>
|
</Popover>
|
||||||
),
|
),
|
||||||
{
|
{ findRootElements: () => document.querySelector('.ant-popover')! },
|
||||||
findRootElements: () => document.querySelector('.ant-popover')!,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
|
@ -1,39 +1,38 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import Popover from '..';
|
import Popover from '..';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import { fireEvent, render } from '../../../tests/utils';
|
import { fireEvent, render } from '../../../tests/utils';
|
||||||
import ConfigProvider from '../../config-provider';
|
import ConfigProvider from '../../config-provider';
|
||||||
|
import type { TooltipRef } from '../../tooltip';
|
||||||
|
|
||||||
|
const { _InternalPanelDoNotUseOrYouWillBeFired: InternalPanelDoNotUseOrYouWillBeFired } = Popover;
|
||||||
|
|
||||||
describe('Popover', () => {
|
describe('Popover', () => {
|
||||||
mountTest(Popover);
|
mountTest(Popover);
|
||||||
|
|
||||||
it('should show overlay when trigger is clicked', () => {
|
it('should show overlay when trigger is clicked', () => {
|
||||||
const ref = React.createRef<any>();
|
const ref = React.createRef<TooltipRef>();
|
||||||
|
const { container } = render(
|
||||||
const popover = render(
|
|
||||||
<Popover ref={ref} content="console.log('hello world')" title="code" trigger="click">
|
<Popover ref={ref} content="console.log('hello world')" title="code" trigger="click">
|
||||||
<span>show me your code</span>
|
<span>show me your code</span>
|
||||||
</Popover>,
|
</Popover>,
|
||||||
);
|
);
|
||||||
|
expect(container.querySelector('.ant-popover-inner-content')).toBeFalsy();
|
||||||
expect(popover.container.querySelector('.ant-popover-inner-content')).toBeFalsy();
|
fireEvent.click(container.querySelector('span')!);
|
||||||
fireEvent.click(popover.container.querySelector('span')!);
|
expect(container.querySelector('.ant-popover-inner-content')).toBeTruthy();
|
||||||
expect(popover.container.querySelector('.ant-popover-inner-content')).toBeTruthy();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shows content for render functions', () => {
|
it('shows content for render functions', () => {
|
||||||
const renderTitle = () => 'some-title';
|
const renderTitle = () => 'some-title';
|
||||||
const renderContent = () => 'some-content';
|
const renderContent = () => 'some-content';
|
||||||
const ref = React.createRef<any>();
|
const ref = React.createRef<TooltipRef>();
|
||||||
|
const { container } = render(
|
||||||
const popover = render(
|
|
||||||
<Popover ref={ref} content={renderContent} title={renderTitle} trigger="click">
|
<Popover ref={ref} content={renderContent} title={renderTitle} trigger="click">
|
||||||
<span>show me your code </span>
|
<span>show me your code </span>
|
||||||
</Popover>,
|
</Popover>,
|
||||||
);
|
);
|
||||||
|
fireEvent.click(container.querySelector('span')!);
|
||||||
fireEvent.click(popover.container.querySelector('span')!);
|
|
||||||
|
|
||||||
const popup = document.querySelector('.ant-popover')!;
|
const popup = document.querySelector('.ant-popover')!;
|
||||||
expect(popup).not.toBe(null);
|
expect(popup).not.toBe(null);
|
||||||
expect(popup.innerHTML).toContain('some-title');
|
expect(popup.innerHTML).toContain('some-title');
|
||||||
@ -80,13 +79,19 @@ describe('Popover', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it(`should be rendered correctly in RTL direction`, () => {
|
it(`should be rendered correctly in RTL direction`, () => {
|
||||||
const wrapper = render(
|
const { container } = render(
|
||||||
<ConfigProvider direction="rtl">
|
<ConfigProvider direction="rtl">
|
||||||
<Popover title="RTL" open>
|
<Popover title="RTL" open>
|
||||||
<span>show me your Rtl demo</span>
|
<span>show me your Rtl demo</span>
|
||||||
</Popover>
|
</Popover>
|
||||||
</ConfigProvider>,
|
</ConfigProvider>,
|
||||||
);
|
);
|
||||||
expect(Array.from(wrapper.container.children)).toMatchSnapshot();
|
expect(Array.from<Element>(container.children)).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should right work when content is null & title is null', () => {
|
||||||
|
expect(() => {
|
||||||
|
render(<InternalPanelDoNotUseOrYouWillBeFired content={null} title={null} trigger="click" />);
|
||||||
|
}).not.toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -289,7 +289,6 @@ const InternalSelect = <
|
|||||||
listHeight={listHeight}
|
listHeight={listHeight}
|
||||||
listItemHeight={listItemHeight}
|
listItemHeight={listItemHeight}
|
||||||
mode={mode}
|
mode={mode}
|
||||||
maxCount={isMultiple ? maxCount : undefined}
|
|
||||||
prefixCls={prefixCls}
|
prefixCls={prefixCls}
|
||||||
placement={memoPlacement}
|
placement={memoPlacement}
|
||||||
direction={direction}
|
direction={direction}
|
||||||
@ -303,6 +302,7 @@ const InternalSelect = <
|
|||||||
dropdownClassName={mergedPopupClassName}
|
dropdownClassName={mergedPopupClassName}
|
||||||
disabled={mergedDisabled}
|
disabled={mergedDisabled}
|
||||||
dropdownStyle={{ ...dropdownStyle, zIndex }}
|
dropdownStyle={{ ...dropdownStyle, zIndex }}
|
||||||
|
maxCount={isMultiple ? maxCount : undefined}
|
||||||
tagRender={isMultiple ? tagRender : undefined}
|
tagRender={isMultiple ? tagRender : undefined}
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
@ -13,4 +13,4 @@ export type CompoundedStatistic = typeof Statistic & CompoundedComponent;
|
|||||||
|
|
||||||
(Statistic as CompoundedStatistic).Countdown = Countdown;
|
(Statistic as CompoundedStatistic).Countdown = Countdown;
|
||||||
|
|
||||||
export default Statistic as CompoundedStatistic;
|
export default (Statistic as CompoundedStatistic);
|
@ -56,10 +56,7 @@ const CheckableTag = React.forwardRef<HTMLSpanElement, CheckableTagProps>((props
|
|||||||
<span
|
<span
|
||||||
{...restProps}
|
{...restProps}
|
||||||
ref={ref}
|
ref={ref}
|
||||||
style={{
|
style={{ ...style, ...tag?.style }}
|
||||||
...style,
|
|
||||||
...tag?.style,
|
|
||||||
}}
|
|
||||||
className={cls}
|
className={cls}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
/>,
|
/>,
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import type * as React from 'react';
|
import type * as React from 'react';
|
||||||
import toArray from 'rc-util/lib/Children/toArray';
|
import toArray from 'rc-util/lib/Children/toArray';
|
||||||
|
|
||||||
import type { TimelineItemProps } from './TimelineItem';
|
import type { TimelineItemProps } from './TimelineItem';
|
||||||
|
|
||||||
function useItems(items?: TimelineItemProps[], children?: React.ReactNode): TimelineItemProps[] {
|
function useItems(items?: TimelineItemProps[], children?: React.ReactNode): TimelineItemProps[] {
|
||||||
if (items && Array.isArray(items)) return items;
|
if (items && Array.isArray(items)) {
|
||||||
|
return items;
|
||||||
|
}
|
||||||
return toArray(children).map((ele: React.ReactElement<any>) => ({
|
return toArray(children).map((ele: React.ReactElement<any>) => ({
|
||||||
children: ele?.props?.children ?? '',
|
children: ele?.props?.children ?? '',
|
||||||
...ele.props,
|
...ele.props,
|
@ -451,7 +451,9 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
|
|||||||
|
|
||||||
// Copy
|
// Copy
|
||||||
const renderCopy = () => {
|
const renderCopy = () => {
|
||||||
if (!enableCopy) return;
|
if (!enableCopy) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const { tooltips, icon } = copyConfig;
|
const { tooltips, icon } = copyConfig;
|
||||||
|
|
||||||
@ -467,7 +469,10 @@ const Base = React.forwardRef<HTMLElement, BlockProps>((props, ref) => {
|
|||||||
return (
|
return (
|
||||||
<Tooltip key="copy" title={copyTitle}>
|
<Tooltip key="copy" title={copyTitle}>
|
||||||
<TransButton
|
<TransButton
|
||||||
className={classNames(`${prefixCls}-copy`, copied && `${prefixCls}-copy-success`)}
|
className={classNames(`${prefixCls}-copy`, {
|
||||||
|
[`${prefixCls}-copy-success`]: copied,
|
||||||
|
[`${prefixCls}-copy-icon-only`]: children === null || children === undefined,
|
||||||
|
})}
|
||||||
onClick={onCopyClick}
|
onClick={onCopyClick}
|
||||||
aria-label={ariaLabel}
|
aria-label={ariaLabel}
|
||||||
>
|
>
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
7
components/typography/demo/copyable.md
Normal file
7
components/typography/demo/copyable.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## zh-CN
|
||||||
|
|
||||||
|
提供可复制的交互能力。
|
||||||
|
|
||||||
|
## en-US
|
||||||
|
|
||||||
|
Make Typography copyable.
|
24
components/typography/demo/copyable.tsx
Normal file
24
components/typography/demo/copyable.tsx
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { SmileFilled, SmileOutlined } from '@ant-design/icons';
|
||||||
|
import { Typography } from 'antd';
|
||||||
|
|
||||||
|
const { Paragraph, Text } = Typography;
|
||||||
|
|
||||||
|
const App: React.FC = () => (
|
||||||
|
<>
|
||||||
|
<Paragraph copyable>This is a copyable text.</Paragraph>
|
||||||
|
<Paragraph copyable={{ text: 'Hello, Ant Design!' }}>Replace copy text.</Paragraph>
|
||||||
|
<Paragraph
|
||||||
|
copyable={{
|
||||||
|
icon: [<SmileOutlined key="copy-icon" />, <SmileFilled key="copied-icon" />],
|
||||||
|
tooltips: ['click here', 'you clicked!!'],
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Custom Copy icon and replace tooltips text.
|
||||||
|
</Paragraph>
|
||||||
|
<Paragraph copyable={{ tooltips: false }}>Hide Copy tooltips.</Paragraph>
|
||||||
|
<Text copyable />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
|
||||||
|
export default App;
|
7
components/typography/demo/editable.md
Normal file
7
components/typography/demo/editable.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
## zh-CN
|
||||||
|
|
||||||
|
提供可编辑的交互能力。
|
||||||
|
|
||||||
|
## en-US
|
||||||
|
|
||||||
|
Make Typography editable.
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useState, useMemo } from 'react';
|
import React, { useState, useMemo } from 'react';
|
||||||
import { CheckOutlined, HighlightOutlined, SmileFilled, SmileOutlined } from '@ant-design/icons';
|
import { CheckOutlined, HighlightOutlined } from '@ant-design/icons';
|
||||||
import { Divider, Radio, Typography } from 'antd';
|
import { Radio, Typography } from 'antd';
|
||||||
|
|
||||||
const { Paragraph } = Typography;
|
const { Paragraph } = Typography;
|
||||||
|
|
||||||
@ -136,18 +136,6 @@ const App: React.FC = () => {
|
|||||||
<Typography.Title editable level={5} style={{ margin: 0 }}>
|
<Typography.Title editable level={5} style={{ margin: 0 }}>
|
||||||
h5. Ant Design
|
h5. Ant Design
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
<Divider />
|
|
||||||
<Paragraph copyable>This is a copyable text.</Paragraph>
|
|
||||||
<Paragraph copyable={{ text: 'Hello, Ant Design!' }}>Replace copy text.</Paragraph>
|
|
||||||
<Paragraph
|
|
||||||
copyable={{
|
|
||||||
icon: [<SmileOutlined key="copy-icon" />, <SmileFilled key="copied-icon" />],
|
|
||||||
tooltips: ['click here', 'you clicked!!'],
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Custom Copy icon and replace tooltips text.
|
|
||||||
</Paragraph>
|
|
||||||
<Paragraph copyable={{ tooltips: false }}>Hide Copy tooltips.</Paragraph>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
@ -1,7 +0,0 @@
|
|||||||
## zh-CN
|
|
||||||
|
|
||||||
提供可编辑和可复制等额外的交互能力。
|
|
||||||
|
|
||||||
## en-US
|
|
||||||
|
|
||||||
Provide additional interactive capacity of editable and copyable.
|
|
@ -20,7 +20,8 @@ Basic text writing, including headings, body text, lists, and more.
|
|||||||
<code src="./demo/title.tsx">Title Component</code>
|
<code src="./demo/title.tsx">Title Component</code>
|
||||||
<code src="./demo/paragraph-debug.tsx" debug>Title and Paragraph</code>
|
<code src="./demo/paragraph-debug.tsx" debug>Title and Paragraph</code>
|
||||||
<code src="./demo/text.tsx">Text and Link Component</code>
|
<code src="./demo/text.tsx">Text and Link Component</code>
|
||||||
<code src="./demo/interactive.tsx">Interactive</code>
|
<code src="./demo/editable.tsx">Editable</code>
|
||||||
|
<code src="./demo/copyable.tsx">Copyable</code>
|
||||||
<code src="./demo/ellipsis.tsx">Ellipsis</code>
|
<code src="./demo/ellipsis.tsx">Ellipsis</code>
|
||||||
<code src="./demo/ellipsis-middle.tsx">Ellipsis from middle</code>
|
<code src="./demo/ellipsis-middle.tsx">Ellipsis from middle</code>
|
||||||
<code src="./demo/ellipsis-debug.tsx" debug>Ellipsis Debug</code>
|
<code src="./demo/ellipsis-debug.tsx" debug>Ellipsis Debug</code>
|
||||||
|
@ -21,7 +21,8 @@ coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*LT2jR41Uj2EAAA
|
|||||||
<code src="./demo/title.tsx">标题组件</code>
|
<code src="./demo/title.tsx">标题组件</code>
|
||||||
<code src="./demo/paragraph-debug.tsx" debug>标题与段落</code>
|
<code src="./demo/paragraph-debug.tsx" debug>标题与段落</code>
|
||||||
<code src="./demo/text.tsx">文本与超链接组件</code>
|
<code src="./demo/text.tsx">文本与超链接组件</code>
|
||||||
<code src="./demo/interactive.tsx">可交互</code>
|
<code src="./demo/editable.tsx">可编辑</code>
|
||||||
|
<code src="./demo/copyable.tsx">可复制</code>
|
||||||
<code src="./demo/ellipsis.tsx">省略号</code>
|
<code src="./demo/ellipsis.tsx">省略号</code>
|
||||||
<code src="./demo/ellipsis-middle.tsx">省略中间</code>
|
<code src="./demo/ellipsis-middle.tsx">省略中间</code>
|
||||||
<code src="./demo/ellipsis-debug.tsx" debug>省略号 Debug</code>
|
<code src="./demo/ellipsis-debug.tsx" debug>省略号 Debug</code>
|
||||||
|
@ -222,7 +222,7 @@ export const getEditableStyles: GenerateStyle<TypographyToken, CSSObject> = (tok
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getCopyableStyles: GenerateStyle<TypographyToken, CSSObject> = (token) => ({
|
export const getCopyableStyles: GenerateStyle<TypographyToken, CSSObject> = (token) => ({
|
||||||
'&-copy-success': {
|
[`${token.componentCls}-copy-success`]: {
|
||||||
[`
|
[`
|
||||||
&,
|
&,
|
||||||
&:hover,
|
&:hover,
|
||||||
@ -230,6 +230,9 @@ export const getCopyableStyles: GenerateStyle<TypographyToken, CSSObject> = (tok
|
|||||||
color: token.colorSuccess,
|
color: token.colorSuccess,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
[`${token.componentCls}-copy-icon-only`]: {
|
||||||
|
marginInlineStart: 0,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const getEllipsisStyles = (): CSSObject => ({
|
export const getEllipsisStyles = (): CSSObject => ({
|
||||||
|
@ -71,4 +71,4 @@ With CSS variable mode, the method of modifying the theme is the same as before,
|
|||||||
| Properties | Description | Type | Default | Version |
|
| Properties | Description | Type | Default | Version |
|
||||||
| --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
| prefix | Prefix of CSS Variables | string | `ant` | 5.12.0 |
|
| prefix | Prefix of CSS Variables | string | `ant` | 5.12.0 |
|
||||||
| key | The unique key of theme. Automaticly set by `useId` in React 18, but need to be set manually in React 17 or 16 | string | `useId` in React 18 | 5.12.0 |
|
| key | The unique key of theme. Automatically set by `useId` in React 18, but need to be set manually in React 17 or 16 | string | `useId` in React 18 | 5.12.0 |
|
||||||
|
25
package.json
25
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "antd",
|
"name": "antd",
|
||||||
"version": "5.12.6",
|
"version": "5.12.7",
|
||||||
"description": "An enterprise-class UI design language and React components implementation",
|
"description": "An enterprise-class UI design language and React components implementation",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"ant",
|
"ant",
|
||||||
@ -113,17 +113,16 @@
|
|||||||
"not dead"
|
"not dead"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/colors": "^7.0.1",
|
"@ant-design/colors": "^7.0.2",
|
||||||
"@ant-design/cssinjs": "^1.18.2",
|
"@ant-design/cssinjs": "^1.18.2",
|
||||||
"@ant-design/icons": "^5.2.6",
|
"@ant-design/icons": "^5.2.6",
|
||||||
"@ant-design/react-slick": "~1.0.2",
|
"@ant-design/react-slick": "~1.0.2",
|
||||||
"@babel/runtime": "^7.23.6",
|
"@ctrl/tinycolor": "^3.6.1",
|
||||||
"@ctrl/tinycolor": "^4.0.2",
|
"@rc-component/color-picker": "~1.5.1",
|
||||||
"@rc-component/color-picker": "~1.5.0",
|
|
||||||
"@rc-component/mutate-observer": "^1.1.0",
|
"@rc-component/mutate-observer": "^1.1.0",
|
||||||
"@rc-component/tour": "~1.12.0",
|
"@rc-component/tour": "~1.12.0",
|
||||||
"@rc-component/trigger": "^1.18.2",
|
"@rc-component/trigger": "^1.18.2",
|
||||||
"classnames": "^2.5.0",
|
"classnames": "^2.5.1",
|
||||||
"copy-to-clipboard": "^3.3.3",
|
"copy-to-clipboard": "^3.3.3",
|
||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"qrcode.react": "^3.1.0",
|
"qrcode.react": "^3.1.0",
|
||||||
@ -184,7 +183,7 @@
|
|||||||
"@testing-library/dom": "^9.3.3",
|
"@testing-library/dom": "^9.3.3",
|
||||||
"@testing-library/jest-dom": "^6.1.6",
|
"@testing-library/jest-dom": "^6.1.6",
|
||||||
"@testing-library/react": "^14.1.2",
|
"@testing-library/react": "^14.1.2",
|
||||||
"@testing-library/user-event": "^14.5.1",
|
"@testing-library/user-event": "^14.5.2",
|
||||||
"@types/ali-oss": "^6.16.11",
|
"@types/ali-oss": "^6.16.11",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/gtag.js": "^0.0.18",
|
"@types/gtag.js": "^0.0.18",
|
||||||
@ -199,7 +198,7 @@
|
|||||||
"@types/jsdom": "^21.1.6",
|
"@types/jsdom": "^21.1.6",
|
||||||
"@types/lodash": "^4.14.202",
|
"@types/lodash": "^4.14.202",
|
||||||
"@types/minimist": "^1.2.5",
|
"@types/minimist": "^1.2.5",
|
||||||
"@types/node": "^20.10.5",
|
"@types/node": "^20.10.6",
|
||||||
"@types/nprogress": "^0.2.3",
|
"@types/nprogress": "^0.2.3",
|
||||||
"@types/pixelmatch": "^5.2.6",
|
"@types/pixelmatch": "^5.2.6",
|
||||||
"@types/pngjs": "^6.0.4",
|
"@types/pngjs": "^6.0.4",
|
||||||
@ -215,10 +214,10 @@
|
|||||||
"@types/tar": "^6.1.10",
|
"@types/tar": "^6.1.10",
|
||||||
"@types/throttle-debounce": "^5.0.2",
|
"@types/throttle-debounce": "^5.0.2",
|
||||||
"@types/warning": "^3.0.3",
|
"@types/warning": "^3.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.16.0",
|
"@typescript-eslint/eslint-plugin": "^6.17.0",
|
||||||
"@typescript-eslint/parser": "^6.16.0",
|
"@typescript-eslint/parser": "^6.17.0",
|
||||||
"ali-oss": "^6.19.0",
|
"ali-oss": "^6.19.0",
|
||||||
"antd-img-crop": "^4.18.0",
|
"antd-img-crop": "^4.21.0",
|
||||||
"antd-style": "^3.6.1",
|
"antd-style": "^3.6.1",
|
||||||
"antd-token-previewer": "^2.0.5",
|
"antd-token-previewer": "^2.0.5",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
@ -237,7 +236,7 @@
|
|||||||
"eslint-import-resolver-typescript": "^3.6.1",
|
"eslint-import-resolver-typescript": "^3.6.1",
|
||||||
"eslint-plugin-compat": "^4.2.0",
|
"eslint-plugin-compat": "^4.2.0",
|
||||||
"eslint-plugin-import": "^2.29.1",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-jest": "^27.6.0",
|
"eslint-plugin-jest": "^27.6.1",
|
||||||
"eslint-plugin-jsx-a11y": "^6.8.0",
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||||
"eslint-plugin-lodash": "^7.4.0",
|
"eslint-plugin-lodash": "^7.4.0",
|
||||||
"eslint-plugin-markdown": "^3.0.1",
|
"eslint-plugin-markdown": "^3.0.1",
|
||||||
@ -324,7 +323,7 @@
|
|||||||
"tar-fs": "^3.0.4",
|
"tar-fs": "^3.0.4",
|
||||||
"terser": "^5.26.0",
|
"terser": "^5.26.0",
|
||||||
"tsx": "^4.7.0",
|
"tsx": "^4.7.0",
|
||||||
"typedoc": "^0.25.4",
|
"typedoc": "^0.25.6",
|
||||||
"typescript": "~5.3.3",
|
"typescript": "~5.3.3",
|
||||||
"vanilla-jsoneditor": "^0.21.1",
|
"vanilla-jsoneditor": "^0.21.1",
|
||||||
"vanilla-tilt": "^1.8.1",
|
"vanilla-tilt": "^1.8.1",
|
||||||
|
@ -53,6 +53,7 @@ const DEPRECIATED_VERSION = {
|
|||||||
'5.11.2': ['https://github.com/ant-design/ant-design/issues/46005'],
|
'5.11.2': ['https://github.com/ant-design/ant-design/issues/46005'],
|
||||||
'5.11.4': ['https://github.com/ant-design/ant-design/pull/46103'],
|
'5.11.4': ['https://github.com/ant-design/ant-design/pull/46103'],
|
||||||
'5.12.3': ['https://github.com/ant-design/ant-design/issues/46525'],
|
'5.12.3': ['https://github.com/ant-design/ant-design/issues/46525'],
|
||||||
|
'5.12.6': ['https://github.com/ant-design/ant-design/issues/46719'],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
function matchDeprecated(v: string) {
|
function matchDeprecated(v: string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user