mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
chore: merge master to next
This commit is contained in:
@@ -17,9 +17,11 @@
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
html {
|
||||
#root {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: #eaeaea transparent;
|
||||
overflow-y: auto;
|
||||
height: 100dvh;
|
||||
}
|
||||
|
||||
.rc-footer {
|
||||
|
||||
@@ -1980,6 +1980,33 @@ exports[`renders components/badge/demo/mix.tsx extend context correctly 1`] = `
|
||||
class="ant-badge ant-badge-status ant-badge-not-a-wrapper css-var-test-id"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<span
|
||||
class="ant-badge ant-badge-status ant-badge-not-a-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-badge-status-dot ant-badge-status-success"
|
||||
/>
|
||||
<span
|
||||
class="ant-badge-status-text"
|
||||
>
|
||||
0
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<span
|
||||
class="ant-badge ant-badge-status ant-badge-not-a-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-badge-status-dot ant-badge-status-warning"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1966,6 +1966,33 @@ exports[`renders components/badge/demo/mix.tsx correctly 1`] = `
|
||||
class="ant-badge ant-badge-status ant-badge-not-a-wrapper css-var-test-id"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<span
|
||||
class="ant-badge ant-badge-status ant-badge-not-a-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-badge-status-dot ant-badge-status-success"
|
||||
/>
|
||||
<span
|
||||
class="ant-badge-status-text"
|
||||
>
|
||||
0
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="ant-space-item"
|
||||
>
|
||||
<span
|
||||
class="ant-badge ant-badge-status ant-badge-not-a-wrapper"
|
||||
>
|
||||
<span
|
||||
class="ant-badge-status-dot ant-badge-status-warning"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -44,6 +44,8 @@ const App: React.FC = () => (
|
||||
<Avatar shape="square" size="large" />
|
||||
</Badge>
|
||||
<Badge count={0} color="#f0f" />
|
||||
<Badge status="success" text={0} showZero />
|
||||
<Badge status="warning" text={0} />
|
||||
</Space>
|
||||
</Space>
|
||||
);
|
||||
|
||||
@@ -79,7 +79,8 @@ const InternalBadge = React.forwardRef<HTMLSpanElement, BadgeProps>((props, ref)
|
||||
(count as number) > (overflowCount as number) ? `${overflowCount}+` : count
|
||||
) as string | number | null;
|
||||
|
||||
const isZero = numberedDisplayCount === '0' || numberedDisplayCount === 0;
|
||||
const isZero =
|
||||
numberedDisplayCount === '0' || numberedDisplayCount === 0 || text === '0' || text === 0;
|
||||
|
||||
const ignoreCount = count === null || (isZero && !showZero);
|
||||
|
||||
@@ -94,9 +95,11 @@ const InternalBadge = React.forwardRef<HTMLSpanElement, BadgeProps>((props, ref)
|
||||
const mergedCount = showAsDot ? '' : numberedDisplayCount;
|
||||
|
||||
const isHidden = useMemo(() => {
|
||||
const isEmpty = mergedCount === null || mergedCount === undefined || mergedCount === '';
|
||||
const isEmpty =
|
||||
(mergedCount === null || mergedCount === undefined || mergedCount === '') &&
|
||||
(text === undefined || text === null || text === '');
|
||||
return (isEmpty || (isZero && !showZero)) && !showAsDot;
|
||||
}, [mergedCount, isZero, showZero, showAsDot]);
|
||||
}, [mergedCount, isZero, showZero, showAsDot, text]);
|
||||
|
||||
// Count should be cache in case hidden change it
|
||||
const countRef = useRef(count);
|
||||
@@ -142,8 +145,10 @@ const InternalBadge = React.forwardRef<HTMLSpanElement, BadgeProps>((props, ref)
|
||||
(typeof livingCount === 'string' || typeof livingCount === 'number' ? livingCount : undefined);
|
||||
|
||||
// >>> Status Text
|
||||
const statusTextNode =
|
||||
isHidden || !text ? null : <span className={`${prefixCls}-status-text`}>{text}</span>;
|
||||
const showStatusTextNode = !isHidden && (text === 0 ? showZero : !!text && text !== true);
|
||||
const statusTextNode = !showStatusTextNode ? null : (
|
||||
<span className={`${prefixCls}-status-text`}>{text}</span>
|
||||
);
|
||||
|
||||
// >>> Display Component
|
||||
const displayNode =
|
||||
@@ -198,7 +203,7 @@ const InternalBadge = React.forwardRef<HTMLSpanElement, BadgeProps>((props, ref)
|
||||
className={statusCls}
|
||||
style={{ ...styles?.indicator, ...contextStyles.indicator, ...statusStyle }}
|
||||
/>
|
||||
{text && (
|
||||
{showStatusTextNode && (
|
||||
<span style={{ color: statusTextColor }} className={`${prefixCls}-status-text`}>
|
||||
{text}
|
||||
</span>
|
||||
|
||||
@@ -108710,7 +108710,7 @@ exports[`Locale Provider should display the text as ga 1`] = `
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
>
|
||||
Meán
|
||||
MFómh
|
||||
</button>
|
||||
<button
|
||||
aria-label="Roghnaigh bliain"
|
||||
@@ -108757,13 +108757,13 @@ exports[`Locale Provider should display the text as ga 1`] = `
|
||||
Má
|
||||
</th>
|
||||
<th>
|
||||
Ce
|
||||
Cé
|
||||
</th>
|
||||
<th>
|
||||
Dé
|
||||
</th>
|
||||
<th>
|
||||
hA
|
||||
Ao
|
||||
</th>
|
||||
<th>
|
||||
Sa
|
||||
@@ -110935,7 +110935,7 @@ exports[`Locale Provider should display the text as ga 1`] = `
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
>
|
||||
Meán
|
||||
MFómh
|
||||
</button>
|
||||
<button
|
||||
aria-label="Roghnaigh bliain"
|
||||
@@ -110984,13 +110984,13 @@ exports[`Locale Provider should display the text as ga 1`] = `
|
||||
Má
|
||||
</th>
|
||||
<th>
|
||||
Ce
|
||||
Cé
|
||||
</th>
|
||||
<th>
|
||||
Dé
|
||||
</th>
|
||||
<th>
|
||||
hA
|
||||
Ao
|
||||
</th>
|
||||
<th>
|
||||
Sa
|
||||
@@ -111479,7 +111479,7 @@ exports[`Locale Provider should display the text as ga 1`] = `
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
>
|
||||
Deai
|
||||
DFómh
|
||||
</button>
|
||||
<button
|
||||
aria-label="Roghnaigh bliain"
|
||||
@@ -111526,13 +111526,13 @@ exports[`Locale Provider should display the text as ga 1`] = `
|
||||
Má
|
||||
</th>
|
||||
<th>
|
||||
Ce
|
||||
Cé
|
||||
</th>
|
||||
<th>
|
||||
Dé
|
||||
</th>
|
||||
<th>
|
||||
hA
|
||||
Ao
|
||||
</th>
|
||||
<th>
|
||||
Sa
|
||||
@@ -112592,9 +112592,9 @@ exports[`Locale Provider should display the text as ga 1`] = `
|
||||
</span>
|
||||
<span
|
||||
class="ant-select-selection-item"
|
||||
title="Meán"
|
||||
title="MFómh"
|
||||
>
|
||||
Meán
|
||||
MFómh
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
@@ -112697,13 +112697,13 @@ exports[`Locale Provider should display the text as ga 1`] = `
|
||||
Má
|
||||
</th>
|
||||
<th>
|
||||
Ce
|
||||
Cé
|
||||
</th>
|
||||
<th>
|
||||
Dé
|
||||
</th>
|
||||
<th>
|
||||
hA
|
||||
Ao
|
||||
</th>
|
||||
<th>
|
||||
Sa
|
||||
|
||||
@@ -81,6 +81,7 @@ const localeValues: Locale = {
|
||||
copy: 'Sao chép',
|
||||
copied: 'Đã sao chép',
|
||||
expand: 'Mở rộng',
|
||||
collapse: 'Thu gọn',
|
||||
},
|
||||
Form: {
|
||||
optional: '(Tùy chọn)',
|
||||
@@ -135,6 +136,13 @@ const localeValues: Locale = {
|
||||
QRCode: {
|
||||
expired: 'Mã QR hết hạn',
|
||||
refresh: 'Làm mới',
|
||||
scanned: 'Đã quét',
|
||||
},
|
||||
ColorPicker: {
|
||||
presetEmpty: 'Trống',
|
||||
transparent: 'Trong suốt',
|
||||
singleColor: 'Màu đơn',
|
||||
gradientColor: 'Màu chuyển sắc',
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ demo:
|
||||
|
||||
## When To Use
|
||||
|
||||
To input a value in a range.
|
||||
Used to input a value within a specified range.
|
||||
|
||||
## Examples
|
||||
|
||||
@@ -23,7 +23,7 @@ To input a value in a range.
|
||||
<code src="./demo/event.tsx">Event</code>
|
||||
<code src="./demo/mark.tsx">Graduated slider</code>
|
||||
<code src="./demo/vertical.tsx">Vertical</code>
|
||||
<code src="./demo/show-tooltip.tsx">Control visible of ToolTip</code>
|
||||
<code src="./demo/show-tooltip.tsx">Control visibility of Tooltip</code>
|
||||
<code src="./demo/reverse.tsx">Reverse</code>
|
||||
<code src="./demo/draggableTrack.tsx">Draggable track</code>
|
||||
<code src="./demo/multiple.tsx">Multiple handles</code>
|
||||
@@ -36,22 +36,22 @@ Common props ref:[Common props](/docs/react/common-props)
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| autoFocus | Whether get focus when component mounted | boolean | false | |
|
||||
| autoFocus | Whether to get focus when component is mounted | boolean | false | |
|
||||
| classNames | Semantic structure className | [Record<SemanticDOM, string>](#semantic-dom) | - | 5.10.0 |
|
||||
| defaultValue | The default value of slider. When `range` is false, use number, otherwise, use \[number, number] | number \| \[number, number] | 0 \| \[0, 0] | |
|
||||
| disabled | If true, the slider will not be intractable | boolean | false | |
|
||||
| defaultValue | The default value of the slider. When `range` is false, use number, otherwise, use \[number, number] | number \| \[number, number] | 0 \| \[0, 0] | |
|
||||
| disabled | If true, the slider will not be interactive | boolean | false | |
|
||||
| keyboard | Support using keyboard to move handlers | boolean | true | 5.2.0+ |
|
||||
| dots | Whether the thumb can drag over tick only | boolean | false | |
|
||||
| included | Make effect when `marks` not null, true means containment and false means coordinative | boolean | true | |
|
||||
| marks | Tick mark of Slider, type of key must be `number`, and must in closed interval \[min, max], each mark can declare its own style | object | { number: ReactNode } \| { number: { style: CSSProperties, label: ReactNode } } | |
|
||||
| dots | Whether the thumb can only be dragged to tick marks | boolean | false | |
|
||||
| included | Takes effect when `marks` is not null. True means containment and false means coordinative | boolean | true | |
|
||||
| marks | Tick marks of Slider. The type of key must be `number`, and must be in closed interval \[min, max]. Each mark can declare its own style | object | { number: ReactNode } \| { number: { style: CSSProperties, label: ReactNode } } | |
|
||||
| max | The maximum value the slider can slide to | number | 100 | |
|
||||
| min | The minimum value the slider can slide to | number | 0 | |
|
||||
| orientation | Orientation | `horizontal` \| `vertical` | `horizontal` | |
|
||||
| range | Dual thumb mode | boolean | false | |
|
||||
| range | Enable dual thumb mode for range selection | boolean | false | |
|
||||
| reverse | Reverse the component | boolean | false | |
|
||||
| step | The granularity the slider can step through values. Must greater than 0, and be divided by (max - min) . When `step` is `null` but exist `marks`, the valid point will only be the `mark`, `min` and `max` | number \| null | 1 | |
|
||||
| step | The granularity the slider can step through values. Must be greater than 0, and be divisible by (max - min). When `step` is `null` and `marks` exist, valid points will only be marks, `min` and `max` | number \| null | 1 | |
|
||||
| styles | Semantic structure style | [Record<SemanticDOM, React.CSSProperties>](#semantic-dom) | - | 5.10.0 |
|
||||
| tooltip | The tooltip relate props | [tooltip](#tooltip) | - | 4.23.0 |
|
||||
| tooltip | The tooltip related props | [tooltip](#tooltip) | - | 4.23.0 |
|
||||
| value | The value of slider. When `range` is false, use number, otherwise, use \[number, number] | number \| \[number, number] | - | |
|
||||
| vertical | If true, the slider will be vertical. Simultaneously existing with `orientation`, `orientation` takes priority | boolean | false | |
|
||||
| onChangeComplete | Fire when `mouseup` or `keyup` is fired | (value) => void | - | |
|
||||
@@ -61,8 +61,8 @@ Common props ref:[Common props](/docs/react/common-props)
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| draggableTrack | Whether range track can be drag | boolean | false | - |
|
||||
| editable | Dynamic edit nodes, can't be used with `draggableTrack` | boolean | false | 5.20.0 |
|
||||
| draggableTrack | Whether range track can be dragged | boolean | false | - |
|
||||
| editable | Dynamic edit nodes. Cannot be used with `draggableTrack` | boolean | false | 5.20.0 |
|
||||
| minCount | The minimum count of nodes | number | 0 | 5.20.0 |
|
||||
| maxCount | The maximum count of nodes | number | - | 5.20.0 |
|
||||
|
||||
@@ -71,10 +71,10 @@ Common props ref:[Common props](/docs/react/common-props)
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| autoAdjustOverflow | Whether to automatically adjust the popup position | boolean | true | 5.8.0 |
|
||||
| open | If true, Tooltip will show always, or it will not show anyway, even if dragging or hovering | boolean | - | 4.23.0 |
|
||||
| open | If true, Tooltip will always be visible; if false, it will never be visible, even when dragging or hovering | boolean | - | 4.23.0 |
|
||||
| placement | Set Tooltip display position. Ref [Tooltip](/components/tooltip/) | string | - | 4.23.0 |
|
||||
| getPopupContainer | The DOM container of the Tooltip, the default behavior is to create a div element in body | (triggerNode) => HTMLElement | () => document.body | 4.23.0 |
|
||||
| formatter | Slider will pass its value to `formatter`, and display its value in Tooltip, and hide Tooltip when return value is null | value => ReactNode \| null | IDENTITY | 4.23.0 |
|
||||
| getPopupContainer | The DOM container of the Tooltip. The default behavior is to create a div element in the body | (triggerNode) => HTMLElement | () => document.body | 4.23.0 |
|
||||
| formatter | Slider will pass its value to `formatter`, display its value in Tooltip, and hide the Tooltip when the returned value is null | value => ReactNode \| null | IDENTITY | 4.23.0 |
|
||||
|
||||
## Methods
|
||||
|
||||
|
||||
@@ -166,11 +166,18 @@ export const operationUnit = (token: AliasToken): CSSObject => ({
|
||||
|
||||
...genFocusStyle(token),
|
||||
|
||||
'&:focus, &:hover': {
|
||||
'&:hover': {
|
||||
color: token.colorLinkHover,
|
||||
textDecoration: token.linkHoverDecoration,
|
||||
},
|
||||
|
||||
'&:focus': {
|
||||
color: token.colorLinkHover,
|
||||
textDecoration: token.linkFocusDecoration,
|
||||
},
|
||||
|
||||
'&:active': {
|
||||
color: token.colorLinkActive,
|
||||
textDecoration: token.linkHoverDecoration,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ const CopyBtn: React.FC<CopyBtnProps> = ({
|
||||
const ariaLabel = typeof copyTitle === 'string' ? copyTitle : systemStr;
|
||||
|
||||
return (
|
||||
<Tooltip title={copyTitle} getPopupContainer={(node) => node.parentNode as HTMLElement}>
|
||||
<Tooltip title={copyTitle}>
|
||||
<button
|
||||
type="button"
|
||||
className={classNames(`${prefixCls}-copy`, {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
---
|
||||
group:
|
||||
title: Advanced
|
||||
order: 9
|
||||
order: 1
|
||||
title: React 19 Compatibility
|
||||
tag: New
|
||||
---
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
---
|
||||
group:
|
||||
title: 进阶使用
|
||||
order: 9
|
||||
order: 1
|
||||
title: React 19 兼容
|
||||
tag: New
|
||||
---
|
||||
|
||||
@@ -262,11 +262,11 @@
|
||||
"immer": "^10.1.1",
|
||||
"is-ci": "^4.0.0",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"jest": "^30.0.0",
|
||||
"jest": "^30.1.0",
|
||||
"jest-axe": "^10.0.0",
|
||||
"jest-canvas-mock": "^2.5.2",
|
||||
"jest-environment-jsdom": "^30.0.5",
|
||||
"jest-environment-node": "^30.0.5",
|
||||
"jest-environment-jsdom": "^30.1.0",
|
||||
"jest-environment-node": "^30.1.0",
|
||||
"jest-image-snapshot": "^6.4.0",
|
||||
"jest-puppeteer": "^11.0.0",
|
||||
"jquery": "^3.7.1",
|
||||
|
||||
Reference in New Issue
Block a user