mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
Merge branch master into feature-merge-master
This commit is contained in:
commit
b194658e0e
@ -1,9 +1,9 @@
|
||||
import type { CSSProperties } from 'react';
|
||||
import React, { useCallback, useMemo, useState } from 'react';
|
||||
import Icon, * as AntdIcons from '@ant-design/icons';
|
||||
import type { SegmentedProps } from 'antd';
|
||||
import { Affix, Empty, Input, Segmented } from 'antd';
|
||||
import { createStyles, useTheme } from 'antd-style';
|
||||
import type { SegmentedOptions } from 'antd/es/segmented';
|
||||
import { useIntl } from 'dumi';
|
||||
import debounce from 'lodash/debounce';
|
||||
|
||||
@ -28,26 +28,6 @@ const useStyle = createStyles(({ token, css }) => ({
|
||||
`,
|
||||
}));
|
||||
|
||||
const options = (
|
||||
formatMessage: (values: Record<string, string>) => React.ReactNode,
|
||||
): SegmentedProps['options'] => [
|
||||
{
|
||||
value: ThemeType.Outlined,
|
||||
icon: <Icon component={OutlinedIcon} />,
|
||||
label: formatMessage({ id: 'app.docs.components.icon.outlined' }),
|
||||
},
|
||||
{
|
||||
value: ThemeType.Filled,
|
||||
icon: <Icon component={FilledIcon} />,
|
||||
label: formatMessage({ id: 'app.docs.components.icon.filled' }),
|
||||
},
|
||||
{
|
||||
value: ThemeType.TwoTone,
|
||||
icon: <Icon component={TwoToneIcon} />,
|
||||
label: formatMessage({ id: 'app.docs.components.icon.two-tone' }),
|
||||
},
|
||||
];
|
||||
|
||||
interface IconSearchState {
|
||||
theme: ThemeType;
|
||||
searchKey: string;
|
||||
@ -124,14 +104,35 @@ const IconSearch: React.FC = () => {
|
||||
backgroundColor: colorBgContainer,
|
||||
};
|
||||
|
||||
const memoizedOptions = React.useMemo<SegmentedOptions<ThemeType>>(
|
||||
() => [
|
||||
{
|
||||
value: ThemeType.Outlined,
|
||||
icon: <Icon component={OutlinedIcon} />,
|
||||
label: intl.formatMessage({ id: 'app.docs.components.icon.outlined' }),
|
||||
},
|
||||
{
|
||||
value: ThemeType.Filled,
|
||||
icon: <Icon component={FilledIcon} />,
|
||||
label: intl.formatMessage({ id: 'app.docs.components.icon.filled' }),
|
||||
},
|
||||
{
|
||||
value: ThemeType.TwoTone,
|
||||
icon: <Icon component={TwoToneIcon} />,
|
||||
label: intl.formatMessage({ id: 'app.docs.components.icon.two-tone' }),
|
||||
},
|
||||
],
|
||||
[intl],
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="markdown">
|
||||
<Affix offsetTop={anchorTop} onChange={setSearchBarAffixed}>
|
||||
<div className={styles.iconSearchAffix} style={searchBarAffixed ? affixedStyle : {}}>
|
||||
<Segmented
|
||||
<Segmented<ThemeType>
|
||||
size="large"
|
||||
value={displayState.theme}
|
||||
options={options(intl.formatMessage)}
|
||||
options={memoizedOptions}
|
||||
onChange={handleChangeTheme}
|
||||
/>
|
||||
<Input.Search
|
||||
|
4
.github/workflows/preview-deploy.yml
vendored
4
.github/workflows/preview-deploy.yml
vendored
@ -61,7 +61,7 @@ jobs:
|
||||
steps:
|
||||
# We need get PR id first
|
||||
- name: download pr artifact
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
uses: dawidd6/action-download-artifact@v7
|
||||
with:
|
||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
@ -81,7 +81,7 @@ jobs:
|
||||
# Download site artifact
|
||||
- name: download site artifact
|
||||
if: ${{ fromJSON(needs.upstream-workflow-summary.outputs.build-success) }}
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
uses: dawidd6/action-download-artifact@v7
|
||||
with:
|
||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
|
42
.github/workflows/site-deploy.yml
vendored
42
.github/workflows/site-deploy.yml
vendored
@ -11,7 +11,7 @@ permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
build-site:
|
||||
runs-on: ubuntu-latest
|
||||
if: (startsWith(github.ref, 'refs/tags/') && (contains(github.ref_name, '-') == false)) || github.event_name == 'workflow_dispatch'
|
||||
steps:
|
||||
@ -33,6 +33,23 @@ jobs:
|
||||
ANALYZER: 1
|
||||
NODE_OPTIONS: --max_old_space_size=4096
|
||||
|
||||
- name: upload site artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: real-site
|
||||
path: _site/
|
||||
retention-days: 1 # Not need to keep for too long
|
||||
|
||||
deploy-to-pages:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-site
|
||||
steps:
|
||||
- name: download site artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: real-site
|
||||
path: _site
|
||||
|
||||
- name: Get version
|
||||
id: publish-version
|
||||
run: echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')" >> $GITHUB_OUTPUT
|
||||
@ -66,3 +83,26 @@ jobs:
|
||||
- Documentation site for this release: https://ant-design-${{ steps.publish-version.outputs.VERSION }}.surge.sh
|
||||
- Webpack bundle analyzer report page: https://ant-design-${{ steps.publish-version.outputs.VERSION }}.surge.sh/report.html
|
||||
|
||||
# https://github.com/ant-design/ant-design/pull/49213/files#r1625446496
|
||||
upload-to-release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-site
|
||||
steps:
|
||||
- name: download site artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: real-site
|
||||
path: _site
|
||||
|
||||
- name: Tarball site
|
||||
run: |
|
||||
cd ./_site
|
||||
VERSION=$(echo ${{ github.ref_name }} | sed 's/\./-/g')
|
||||
tar -czf ../website.tar.gz --transform 's|^|antd-${VERSION}-website/|' .
|
||||
cd ..
|
||||
|
||||
- name: Upload to Release
|
||||
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
|
||||
with:
|
||||
fail_on_unmatched_files: true
|
||||
files: website.tar.gz
|
||||
|
@ -68,7 +68,7 @@ jobs:
|
||||
|
||||
# We need get persist-index first
|
||||
- name: download image snapshot artifact
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
uses: dawidd6/action-download-artifact@v7
|
||||
with:
|
||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
@ -90,7 +90,7 @@ jobs:
|
||||
- name: download report artifact
|
||||
id: download_report
|
||||
if: ${{ needs.upstream-workflow-summary.outputs.build-status == 'success' || needs.upstream-workflow-summary.outputs.build-status == 'failure' }}
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
uses: dawidd6/action-download-artifact@v7
|
||||
with:
|
||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
|
@ -65,7 +65,7 @@ jobs:
|
||||
|
||||
# We need get persist key first
|
||||
- name: Download Visual Regression Ref
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
uses: dawidd6/action-download-artifact@v7
|
||||
with:
|
||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
@ -79,7 +79,7 @@ jobs:
|
||||
|
||||
- name: Download Visual-Regression Artifact
|
||||
if: ${{ fromJSON(needs.upstream-workflow-summary.outputs.build-success) }}
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
uses: dawidd6/action-download-artifact@v7
|
||||
with:
|
||||
workflow: ${{ github.event.workflow_run.workflow_id }}
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
|
@ -89,7 +89,7 @@ Common props ref:[Common props](/docs/react/common-props)
|
||||
| ghost | Make the collapse borderless and its background transparent | boolean | false | 4.4.0 |
|
||||
| size | Set the size of collapse | `large` \| `middle` \| `small` | `middle` | 5.2.0 |
|
||||
| onChange | Callback function executed when active panel is changed | function | - | |
|
||||
| items | collapse items content | [ItemType](#ItemType) | - | 5.6.0 |
|
||||
| items | collapse items content | [ItemType](#itemtype) | - | 5.6.0 |
|
||||
|
||||
### ItemType
|
||||
|
||||
|
@ -90,7 +90,7 @@ const items: CollapseProps['items'] = [
|
||||
| ghost | 使折叠面板透明且无边框 | boolean | false | 4.4.0 |
|
||||
| size | 设置折叠面板大小 | `large` \| `middle` \| `small` | `middle` | 5.2.0 |
|
||||
| onChange | 切换面板的回调 | function | - | |
|
||||
| items | 折叠项目内容 | [ItemType](#ItemType) | - | 5.6.0 |
|
||||
| items | 折叠项目内容 | [ItemType](#itemtype) | - | 5.6.0 |
|
||||
|
||||
### ItemType
|
||||
|
||||
|
@ -3,6 +3,7 @@ import { CloseOutlined } from '@ant-design/icons';
|
||||
|
||||
import type { SelectProps } from '..';
|
||||
import Select from '..';
|
||||
import Form from '../../form';
|
||||
import { resetWarned } from '../../_util/warning';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
@ -126,6 +127,43 @@ describe('Select', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('clear icon position', () => {
|
||||
it('normal', () => {
|
||||
const { container } = render(
|
||||
<Select allowClear options={[{ value: '1', label: '1' }]} value="1" />,
|
||||
);
|
||||
expect(
|
||||
getComputedStyle(container.querySelector('.ant-select-clear')!).insetInlineEnd,
|
||||
).toEqual('11px');
|
||||
});
|
||||
|
||||
it('hasFeedback, has validateStatus', () => {
|
||||
const { container } = render(
|
||||
<Form>
|
||||
<Form.Item hasFeedback validateStatus="error">
|
||||
<Select allowClear options={[{ value: '1', label: '1' }]} value="1" />,
|
||||
</Form.Item>
|
||||
</Form>,
|
||||
);
|
||||
expect(
|
||||
getComputedStyle(container.querySelector('.ant-select-clear')!).insetInlineEnd,
|
||||
).toEqual('33px');
|
||||
});
|
||||
|
||||
it('hasFeedback, no validateStatus', () => {
|
||||
const { container } = render(
|
||||
<Form>
|
||||
<Form.Item hasFeedback validateStatus="">
|
||||
<Select allowClear options={[{ value: '1', label: '1' }]} value="1" />,
|
||||
</Form.Item>
|
||||
</Form>,
|
||||
);
|
||||
expect(
|
||||
getComputedStyle(container.querySelector('.ant-select-clear')!).insetInlineEnd,
|
||||
).toEqual('11px');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Deprecated', () => {
|
||||
it('should ignore mode="combobox"', () => {
|
||||
const { asFragment } = render(
|
||||
|
@ -205,13 +205,17 @@ const genBaseStyle: GenerateStyle<SelectToken> = (token) => {
|
||||
},
|
||||
|
||||
// ========================= Feedback ==========================
|
||||
[`${componentCls}-has-feedback`]: {
|
||||
[`${componentCls}-clear`]: {
|
||||
insetInlineEnd: token
|
||||
.calc(inputPaddingHorizontalBase)
|
||||
.add(token.fontSize)
|
||||
.add(token.paddingXS)
|
||||
.equal(),
|
||||
[`${componentCls}-status`]: {
|
||||
'&-error, &-warning, &-success, &-validating': {
|
||||
[`&${componentCls}-has-feedback`]: {
|
||||
[`${componentCls}-clear`]: {
|
||||
insetInlineEnd: token
|
||||
.calc(inputPaddingHorizontalBase)
|
||||
.add(token.fontSize)
|
||||
.add(token.paddingXS)
|
||||
.equal(),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -48,7 +48,7 @@ export type SpinType = React.FC<SpinProps> & {
|
||||
let defaultIndicator: React.ReactNode | undefined;
|
||||
|
||||
function shouldDelay(spinning?: boolean, delay?: number): boolean {
|
||||
return !!spinning && !!delay && !isNaN(Number(delay));
|
||||
return !!spinning && !!delay && !Number.isNaN(Number(delay));
|
||||
}
|
||||
|
||||
const Spin: SpinType = (props) => {
|
||||
|
@ -99,6 +99,11 @@ export interface FilterConfirmProps {
|
||||
closeDropdown: boolean;
|
||||
}
|
||||
|
||||
export interface FilterRestProps {
|
||||
confirm?: boolean;
|
||||
closeDropdown?: boolean;
|
||||
}
|
||||
|
||||
export interface FilterDropdownProps {
|
||||
prefixCls: string;
|
||||
setSelectedKeys: (selectedKeys: React.Key[]) => void;
|
||||
@ -108,7 +113,7 @@ export interface FilterDropdownProps {
|
||||
* {closeDropdown: true}
|
||||
*/
|
||||
confirm: (param?: FilterConfirmProps) => void;
|
||||
clearFilters?: () => void;
|
||||
clearFilters?: (param?: FilterRestProps) => void;
|
||||
filters?: ColumnFilterItem[];
|
||||
/** Only close filterDropdown */
|
||||
close: () => void;
|
||||
|
@ -54,8 +54,8 @@ The following APIs are shared by Tooltip, Popconfirm, Popover.
|
||||
| mouseEnterDelay | Delay in seconds, before tooltip is shown on mouse enter | number | 0.1 | |
|
||||
| mouseLeaveDelay | Delay in seconds, before tooltip is hidden on mouse leave | number | 0.1 | |
|
||||
| overlayClassName | Class name of the tooltip card | string | - | |
|
||||
| overlayStyle | Style of the tooltip card | object | - | |
|
||||
| overlayInnerStyle | Style of the tooltip inner content | object | - | |
|
||||
| overlayStyle | Style of the tooltip card | React.CSSProperties | - | |
|
||||
| overlayInnerStyle | Style of the tooltip inner content | React.CSSProperties | - | |
|
||||
| placement | The position of the tooltip relative to the target, which can be one of `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | `top` | |
|
||||
| trigger | Tooltip trigger mode. Could be multiple by passing an array | `hover` \| `focus` \| `click` \| `contextMenu` \| Array<string> | `hover` | |
|
||||
| open | Whether the floating tooltip card is open or not. Use `visible` under 4.23.0 ([why?](/docs/react/faq#why-open)) | boolean | false | 4.23.0 |
|
||||
|
@ -56,8 +56,8 @@ demo:
|
||||
| mouseEnterDelay | 鼠标移入后延时多少才显示 Tooltip,单位:秒 | number | 0.1 | |
|
||||
| mouseLeaveDelay | 鼠标移出后延时多少才隐藏 Tooltip,单位:秒 | number | 0.1 | |
|
||||
| overlayClassName | 卡片类名 | string | - | |
|
||||
| overlayStyle | 卡片样式 | object | - | |
|
||||
| overlayInnerStyle | 卡片内容区域的样式对象 | object | - | |
|
||||
| overlayStyle | 卡片样式 | React.CSSProperties | - | |
|
||||
| overlayInnerStyle | 卡片内容区域的样式对象 | React.CSSProperties | - | |
|
||||
| placement | 气泡框位置,可选 `top` `left` `right` `bottom` `topLeft` `topRight` `bottomLeft` `bottomRight` `leftTop` `leftBottom` `rightTop` `rightBottom` | string | `top` | |
|
||||
| trigger | 触发行为,可选 `hover` \| `focus` \| `click` \| `contextMenu`,可使用数组设置多个触发行为 | string \| string\[] | `hover` | |
|
||||
| open | 用于手动控制浮层显隐,小于 4.23.0 使用 `visible`([为什么?](/docs/react/faq#弹层类组件为什么要统一至-open-属性)) | boolean | false | 4.23.0 |
|
||||
|
14
package.json
14
package.json
@ -108,7 +108,7 @@
|
||||
"@ant-design/colors": "^7.1.0",
|
||||
"@ant-design/cssinjs": "^1.22.0",
|
||||
"@ant-design/cssinjs-utils": "^1.1.1",
|
||||
"@ant-design/icons": "^5.5.1",
|
||||
"@ant-design/icons": "^5.5.2",
|
||||
"@ant-design/react-slick": "~1.1.2",
|
||||
"@babel/runtime": "^7.26.0",
|
||||
"@ctrl/tinycolor": "^3.6.1",
|
||||
@ -126,9 +126,9 @@
|
||||
"rc-dialog": "~9.6.0",
|
||||
"rc-drawer": "~7.2.0",
|
||||
"rc-dropdown": "~4.2.0",
|
||||
"rc-field-form": "~2.5.1",
|
||||
"rc-field-form": "~2.6.0",
|
||||
"rc-image": "~7.11.0",
|
||||
"rc-input": "~1.6.3",
|
||||
"rc-input": "~1.6.4",
|
||||
"rc-input-number": "~9.3.0",
|
||||
"rc-mentions": "~2.17.0",
|
||||
"rc-menu": "~9.16.0",
|
||||
@ -144,7 +144,7 @@
|
||||
"rc-slider": "~11.1.7",
|
||||
"rc-steps": "~6.0.1",
|
||||
"rc-switch": "~4.1.0",
|
||||
"rc-table": "~7.48.1",
|
||||
"rc-table": "~7.49.0",
|
||||
"rc-tabs": "~15.4.0",
|
||||
"rc-textarea": "~1.8.2",
|
||||
"rc-tooltip": "~6.2.1",
|
||||
@ -343,5 +343,11 @@
|
||||
"title": "Ant Design",
|
||||
"tnpm": {
|
||||
"mode": "npm"
|
||||
},
|
||||
"overrides": {
|
||||
"nwsapi": "2.2.13"
|
||||
},
|
||||
"resolutions": {
|
||||
"nwsapi": "2.2.13"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user