mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
Merge pull request #25111 from ant-design/master-to-merge-feature
chore: merge master into feature
This commit is contained in:
commit
93ca6e78a4
13
.github/workflows/sync.yml
vendored
Normal file
13
.github/workflows/sync.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
name: 🔄 Sync packages
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
jobs:
|
||||
sync_packages:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Sync packages
|
||||
uses: LexSwed/npm-package-sync
|
||||
with:
|
||||
registry-to: 'https://npm.pkg.github.com'
|
||||
token-to: ${{ secrets.GITHUB_TOKEN }}
|
@ -1,7 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders ./components/affix/demo/basic.md correctly 1`] = `
|
||||
<div>
|
||||
Array [
|
||||
<div>
|
||||
<div
|
||||
class=""
|
||||
@ -15,8 +15,8 @@ exports[`renders ./components/affix/demo/basic.md correctly 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
</div>,
|
||||
<br />,
|
||||
<div>
|
||||
<div
|
||||
class=""
|
||||
@ -30,8 +30,8 @@ exports[`renders ./components/affix/demo/basic.md correctly 1`] = `
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`renders ./components/affix/demo/debug.md correctly 1`] = `
|
||||
|
@ -22,7 +22,7 @@ const Demo: React.FC = () => {
|
||||
const [bottom, setBottom] = useState(10);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<>
|
||||
<Affix offsetTop={top}>
|
||||
<Button type="primary" onClick={() => setTop(top + 10)}>
|
||||
Affix top
|
||||
@ -34,7 +34,7 @@ const Demo: React.FC = () => {
|
||||
Affix bottom
|
||||
</Button>
|
||||
</Affix>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -19,14 +19,14 @@ cover: https://gw.alipayobjects.com/zos/alicdn/8emPa3fjl/Alert.svg
|
||||
| --- | --- | --- | --- |
|
||||
| afterClose | 关闭动画结束后触发的回调函数 | () => void | - |
|
||||
| banner | 是否用作顶部公告 | boolean | false |
|
||||
| closable | 默认不显示关闭按钮 | boolean | 无 |
|
||||
| closeText | 自定义关闭按钮 | string\|ReactNode | 无 |
|
||||
| description | 警告提示的辅助性文字介绍 | string\|ReactNode | 无 |
|
||||
| closable | 默认不显示关闭按钮 | boolean | - |
|
||||
| closeText | 自定义关闭按钮 | string\|ReactNode | - |
|
||||
| description | 警告提示的辅助性文字介绍 | string\|ReactNode | - |
|
||||
| icon | 自定义图标,`showIcon` 为 `true` 时有效 | ReactNode | - |
|
||||
| message | 警告提示内容 | string\|ReactNode | 无 |
|
||||
| message | 警告提示内容 | string\|ReactNode | - |
|
||||
| showIcon | 是否显示辅助图标 | boolean | false,`banner` 模式下默认值为 true |
|
||||
| type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | string | `info`,`banner` 模式下默认值为 `warning` |
|
||||
| onClose | 关闭时触发的回调函数 | (e: MouseEvent) => void | 无 |
|
||||
| onClose | 关闭时触发的回调函数 | (e: MouseEvent) => void | - |
|
||||
|
||||
### Alert.ErrorBoundary
|
||||
|
||||
|
@ -26,7 +26,7 @@ For displaying anchor hyperlinks on page and jumping between them.
|
||||
| showInkInFixed | Whether show ink-balls in Fixed mode | boolean | false | |
|
||||
| onClick | set the handler to handle `click` event | Function(e: Event, link: Object) | - | |
|
||||
| getCurrentAnchor | Customize the anchor highlight | () => string | - | |
|
||||
| targetOffset | Anchor scroll offset, default as `offsetTop`, [example](#components-anchor-demo-targetOffset) | number | `offsetTop` | |
|
||||
| targetOffset | Anchor scroll offset, default as `offsetTop`, [example](#components-anchor-demo-targetOffset) | number | - | |
|
||||
| onChange | Listening for anchor link change | (currentActiveLink: string) => void | | |
|
||||
|
||||
### Link Props
|
||||
|
@ -27,7 +27,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_1-C1JwsC/Anchor.svg
|
||||
| showInkInFixed | 固定模式是否显示小圆点 | boolean | false | |
|
||||
| onClick | `click` 事件的 handler | Function(e: Event, link: Object) | - | |
|
||||
| getCurrentAnchor | 自定义高亮的锚点 | () => string | - | |
|
||||
| targetOffset | 锚点滚动偏移量,默认与 offsetTop 相同,[例子](#components-anchor-demo-targetOffset) | number | `offsetTop` | |
|
||||
| targetOffset | 锚点滚动偏移量,默认与 offsetTop 相同,[例子](#components-anchor-demo-targetOffset) | number | - | |
|
||||
| onChange | 监听锚点链接改变 | (currentActiveLink: string) => void | | |
|
||||
|
||||
### Link Props
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
&-link {
|
||||
.@{ant-prefix}-anchor-rtl & {
|
||||
padding: 7px 16px 7px 0;
|
||||
padding: @anchor-link-top @anchor-link-left @anchor-link-top 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,17 +23,17 @@ cover: https://gw.alipayobjects.com/zos/alicdn/qtJm4yt45/AutoComplete.svg
|
||||
| children (自定义输入框) | 自定义输入框 | HTMLInputElement <br /><br /> HTMLTextAreaElement <br /><br /> `React.ReactElement<InputProps>` | `<Input />` | |
|
||||
| children (自动完成的数据源) | 自动完成的数据源 | `React.ReactElement<OptionProps>` <br /><br /> `Array<React.ReactElement<OptionProps>>` | - | |
|
||||
| defaultActiveFirstOption | 是否默认高亮第一个选项。 | boolean | true | |
|
||||
| defaultValue | 指定默认选中的条目 | string | 无 | |
|
||||
| defaultValue | 指定默认选中的条目 | string | - | |
|
||||
| disabled | 是否禁用 | boolean | false | |
|
||||
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`。 | boolean or function(inputValue, option) | true | |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codesandbox.io/s/4j168r7jw0) | Function(triggerNode) | () => document.body | |
|
||||
| placeholder | 输入框提示 | string | - | |
|
||||
| value | 指定当前选中的条目 | string | 无 | |
|
||||
| value | 指定当前选中的条目 | string | - | |
|
||||
| onBlur | 失去焦点时的回调 | function() | - | |
|
||||
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | 无 | |
|
||||
| onChange | 选中 option,或 input 的 value 变化时,调用此函数 | function(value) | - | |
|
||||
| onFocus | 获得焦点时的回调 | function() | - | |
|
||||
| onSearch | 搜索补全项的时候调用 | function(value) | 无 | |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | 无 | |
|
||||
| onSearch | 搜索补全项的时候调用 | function(value) | - | |
|
||||
| onSelect | 被选中时调用,参数为选中项的 value 值 | function(value, option) | - | |
|
||||
| defaultOpen | 是否默认展开下拉菜单 | boolean | - | |
|
||||
| open | 是否展开下拉菜单 | boolean | - | |
|
||||
| onDropdownVisibleChange | 展开下拉菜单的回调 | function(open) | - | |
|
||||
|
@ -21,6 +21,6 @@ Badge normally appears in proximity to notifications or user avatars with eye-ca
|
||||
| offset | set offset of the badge dot | `[number, number]` | - | |
|
||||
| overflowCount | Max count to show | number | 99 | |
|
||||
| showZero | Whether to show badge when `count` is zero | boolean | `false` | |
|
||||
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | `''` | |
|
||||
| text | If `status` is set, `text` sets the display text of the status `dot` | string | `''` | |
|
||||
| status | Set Badge as a status dot | `success` \| `processing` \| `default` \| `error` \| `warning` | | |
|
||||
| text | If `status` is set, `text` sets the display text of the status `dot` | string | | |
|
||||
| title | Text to show when hovering over the badge | string | `count` | |
|
||||
|
@ -22,6 +22,6 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/6%26GF9WHwvY/Badge.svg
|
||||
| offset | 设置状态点的位置偏移 | `[number, number]` | - | |
|
||||
| overflowCount | 展示封顶的数字值 | number | 99 | |
|
||||
| showZero | 当数值为 0 时,是否展示 Badge | boolean | false | |
|
||||
| status | 设置 Badge 为状态点 | `success` \| `processing` \| `default` \| `error` \| `warning` | '' | |
|
||||
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | '' | |
|
||||
| status | 设置 Badge 为状态点 | `success` \| `processing` \| `default` \| `error` \| `warning` | | |
|
||||
| text | 在设置了 `status` 的前提下有效,设置状态点的文本 | string | | |
|
||||
| title | 设置鼠标放在状态点上时显示的文字 | string | `count` | |
|
||||
|
@ -32,19 +32,19 @@ To get a customized button, just set `type`/`shape`/`size`/`loading`/`disabled`.
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| disabled | disabled state of button | boolean | `false` | |
|
||||
| ghost | make background transparent and invert text and border colors | boolean | `false` | |
|
||||
| disabled | disabled state of button | boolean | false | |
|
||||
| ghost | make background transparent and invert text and border colors | boolean | false | |
|
||||
| href | redirect url of link button | string | - | |
|
||||
| htmlType | set the original html `type` of `button`, see: [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` | |
|
||||
| icon | set the icon component of button | ReactNode | - | |
|
||||
| loading | set the loading status of button | boolean \| { delay: number } | `false` | |
|
||||
| loading | set the loading status of button | boolean \| { delay: number } | false | |
|
||||
| shape | can be set to `circle`, `round` or omitted | string | - | |
|
||||
| size | set the size of button | `large` \| `middle` \| `small` | | |
|
||||
| target | same as target attribute of a, works when href is specified | string | - | |
|
||||
| type | can be set to `primary` `ghost` `dashed` `danger` `link` `text` or omitted (meaning `default`) | string | `default` | |
|
||||
| type | can be set to `primary` `ghost` `dashed` `danger` `link` `text` | string | - | |
|
||||
| onClick | set the handler to handle `click` event | (event) => void | - | |
|
||||
| block | option to fit button width to its parent width | boolean | `false` | |
|
||||
| danger | set the danger status of button | boolean | `false` | |
|
||||
| block | option to fit button width to its parent width | boolean | false | |
|
||||
| danger | set the danger status of button | boolean | false | |
|
||||
|
||||
It accepts all props which native buttons support.
|
||||
|
||||
|
@ -35,19 +35,19 @@ cover: https://gw.alipayobjects.com/zos/alicdn/fNUKzY1sk/Button.svg
|
||||
|
||||
| 属性 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| disabled | 按钮失效状态 | boolean | `false` | |
|
||||
| disabled | 按钮失效状态 | boolean | false | |
|
||||
| ghost | 幽灵属性,使按钮背景透明 | boolean | false | |
|
||||
| href | 点击跳转的地址,指定此属性 button 的行为和 a 链接一致 | string | - | |
|
||||
| htmlType | 设置 `button` 原生的 `type` 值,可选值请参考 [HTML 标准](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attr-type) | string | `button` | |
|
||||
| icon | 设置按钮的图标组件 | ReactNode | - | |
|
||||
| loading | 设置按钮载入状态 | boolean \| { delay: number } | `false` | |
|
||||
| loading | 设置按钮载入状态 | boolean \| { delay: number } | false | |
|
||||
| shape | 设置按钮形状,可选值为 `circle`、 `round` 或者不设 | string | - | |
|
||||
| size | 设置按钮大小 | `large` \| `middle` \| `small` | 无 | |
|
||||
| size | 设置按钮大小 | `large` \| `middle` \| `small` | - | |
|
||||
| target | 相当于 a 链接的 target 属性,href 存在时生效 | string | - | |
|
||||
| type | 设置按钮类型 | `primary` \| `ghost` \| `dashed` \| `danger` \| `link` \| `text` | - | |
|
||||
| onClick | 点击按钮时的回调 | (event) => void | - | |
|
||||
| block | 将按钮宽度调整为其父宽度的选项 | boolean | `false` | |
|
||||
| danger | 设置危险按钮 | boolean | `false` | |
|
||||
| block | 将按钮宽度调整为其父宽度的选项 | boolean | false | |
|
||||
| danger | 设置危险按钮 | boolean | false | |
|
||||
|
||||
支持原生 button 的其他所有属性。
|
||||
|
||||
|
@ -36,7 +36,7 @@ When data is in the form of dates, such as schedules, timetables, prices calenda
|
||||
| dateFullCellRender | Customize the display of the date cell, the returned content will override the cell | function(date: moment): ReactNode | - | |
|
||||
| defaultValue | The date selected by default | [moment](http://momentjs.com/) | default date | |
|
||||
| disabledDate | Function that specifies the dates that cannot be selected | (currentDate: moment) => boolean | - | |
|
||||
| fullscreen | Whether to display in full-screen | boolean | `true` | |
|
||||
| fullscreen | Whether to display in full-screen | boolean | true | |
|
||||
| locale | The calendar's locale | object | [default](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | |
|
||||
| mode | The display mode of the calendar | `month` \| `year` | `month` | |
|
||||
| monthCellRender | Customize the display of the month cell, the returned content will be appended to the cell | function(date: moment): ReactNode | - | |
|
||||
|
@ -33,21 +33,21 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/dPQmLq08DI/Calendar.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| dateCellRender | 自定义渲染日期单元格,返回内容会被追加到单元格 | function(date: moment): ReactNode | 无 | |
|
||||
| dateFullCellRender | 自定义渲染日期单元格,返回内容覆盖单元格 | function(date: moment): ReactNode | 无 | |
|
||||
| dateCellRender | 自定义渲染日期单元格,返回内容会被追加到单元格 | function(date: moment): ReactNode | - | |
|
||||
| dateFullCellRender | 自定义渲染日期单元格,返回内容覆盖单元格 | function(date: moment): ReactNode | - | |
|
||||
| defaultValue | 默认展示的日期 | [moment](http://momentjs.com/) | 默认日期 | |
|
||||
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | 无 | |
|
||||
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | - | |
|
||||
| fullscreen | 是否全屏显示 | boolean | true | |
|
||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | |
|
||||
| mode | 初始模式,`month/year` | string | month | |
|
||||
| monthCellRender | 自定义渲染月单元格,返回内容会被追加到单元格 | function(date: moment): ReactNode | 无 | |
|
||||
| monthFullCellRender | 自定义渲染月单元格,返回内容覆盖单元格 | function(date: moment): ReactNode | 无 | |
|
||||
| validRange | 设置可以显示的日期 | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | 无 | |
|
||||
| mode | 初始模式,`month/year` | string | `month` | |
|
||||
| monthCellRender | 自定义渲染月单元格,返回内容会被追加到单元格 | function(date: moment): ReactNode | - | |
|
||||
| monthFullCellRender | 自定义渲染月单元格,返回内容覆盖单元格 | function(date: moment): ReactNode | - | |
|
||||
| validRange | 设置可以显示的日期 | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | |
|
||||
| value | 展示日期 | [moment](http://momentjs.com/) | 当前日期 | |
|
||||
| onPanelChange | 日期面板变化回调 | function(date: moment, mode: string) | 无 | |
|
||||
| onSelect | 点击选择日期回调 | function(date: moment) | 无 | |
|
||||
| onChange | 日期变化回调 | function(date: moment) | 无 | |
|
||||
| headerRender | 自定义头部内容 | function(object:{value: moment, type: string, onChange: f(), onTypeChange: f()}) | 无 | |
|
||||
| onPanelChange | 日期面板变化回调 | function(date: moment, mode: string) | - | |
|
||||
| onSelect | 点击选择日期回调 | function(date: moment) | - | |
|
||||
| onChange | 日期变化回调 | function(date: moment) | - | |
|
||||
| headerRender | 自定义头部内容 | function(object:{value: moment, type: string, onChange: f(), onTypeChange: f()}) | - | |
|
||||
|
||||
## FAQ
|
||||
|
||||
|
@ -26,7 +26,7 @@ A card can be used to display content related to a single subject. The content c
|
||||
| activeTabKey | Current TabPane's key | string | - | |
|
||||
| headStyle | Inline style to apply to the card head | CSSProperties | - | |
|
||||
| bodyStyle | Inline style to apply to the card content | CSSProperties | - | |
|
||||
| bordered | Toggles rendering of the border around the card | boolean | `true` | |
|
||||
| bordered | Toggles rendering of the border around the card | boolean | true | |
|
||||
| cover | Card cover | ReactNode | - | |
|
||||
| defaultActiveTabKey | Initial active TabPane's key, if `activeTabKey` is not set. | string | - | |
|
||||
| extra | Content to render in the top-right corner of the card | string\|ReactNode | - | |
|
||||
|
@ -29,12 +29,12 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/NqXt8DJhky/Card.svg
|
||||
| bodyStyle | 内容区域自定义样式 | CSSProperties | - | |
|
||||
| bordered | 是否有边框 | boolean | true | |
|
||||
| cover | 卡片封面 | ReactNode | - | |
|
||||
| defaultActiveTabKey | 初始化选中页签的 key,如果没有设置 activeTabKey | string | 第一个页签 | |
|
||||
| defaultActiveTabKey | 初始化选中页签的 key,如果没有设置 activeTabKey | string | `第一个页签` | |
|
||||
| extra | 卡片右上角的操作区域 | string\|ReactNode | - | |
|
||||
| hoverable | 鼠标移过时可浮起 | boolean | false | |
|
||||
| loading | 当卡片内容还在加载中时,可以用 loading 展示一个占位 | boolean | false | |
|
||||
| tabList | 页签标题列表 | Array<{key: string, tab: ReactNode}> | - | |
|
||||
| tabBarExtraContent | tab bar 上额外的元素 | React.ReactNode | 无 | |
|
||||
| tabBarExtraContent | tab bar 上额外的元素 | React.ReactNode | - | |
|
||||
| size | card 的尺寸 | `default` \| `small` | `default` | |
|
||||
| title | 卡片标题 | string\|ReactNode | - | |
|
||||
| type | 卡片类型,可设置为 `inner` 或 不设置 | string | - | |
|
||||
|
@ -18,10 +18,10 @@ A carousel component. Scales with its container.
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| afterChange | Callback function called after the current index changes | function(current) | - | |
|
||||
| autoplay | Whether to scroll automatically | boolean | `false` | |
|
||||
| autoplay | Whether to scroll automatically | boolean | false | |
|
||||
| beforeChange | Callback function called before the current index changes | function(from, to) | - | |
|
||||
| dotPosition | The position of the dots, which can be one of `top` `bottom` `left` `right` | string | bottom | |
|
||||
| dots | Whether to show the dots at the bottom of the gallery, `object` for `dotsClass` and any others | boolean \| { className?:string } | `true` | |
|
||||
| dots | Whether to show the dots at the bottom of the gallery, `object` for `dotsClass` and any others | boolean \| { className?:string } | true | |
|
||||
| easing | Transition interpolation function name | string | `linear` | |
|
||||
| effect | Transition effect | `scrollx` \| `fade` | `scrollx` | |
|
||||
|
||||
|
@ -18,9 +18,9 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/%24C9tmj978R/Carousel.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| afterChange | 切换面板的回调 | function(current) | 无 | | |
|
||||
| afterChange | 切换面板的回调 | function(current) | - | | |
|
||||
| autoplay | 是否自动切换 | boolean | false | | |
|
||||
| beforeChange | 切换面板的回调 | function(from, to) | 无 | | |
|
||||
| beforeChange | 切换面板的回调 | function(from, to) | - | | |
|
||||
| dotPosition | 面板指示点位置,可选 `top` `bottom` `left` `right` | string | bottom | |
|
||||
| dots | 是否显示面板指示点,如果为 `object` 则同时可以指定 `dotsClass` 或者 | boolean \| { className?:string } | true | | |
|
||||
| easing | 动画效果 | string | linear | | |
|
||||
|
@ -29,12 +29,12 @@ Cascade selection box.
|
||||
| defaultValue | initial selected value | string\[] \| number\[] | \[] | |
|
||||
| disabled | whether disabled select | boolean | false | |
|
||||
| displayRender | render function of displaying selected options | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` | |
|
||||
| expandTrigger | expand current item when click or hover, one of 'click' 'hover' | string | 'click' | |
|
||||
| expandTrigger | expand current item when click or hover, one of 'click' 'hover' | string | `click` | |
|
||||
| expandIcon | customize the current item expand icon | ReactNode | - | 4.4.0 |
|
||||
| fieldNames | custom field name for label and value and children | object | `{ label: 'label', value: 'value', children: 'children' }` | |
|
||||
| getPopupContainer | Parent Node which the selector should be rendered to. Default to `body`. When position issues happen, try to modify it into scrollable content and position it relative.[example](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body | |
|
||||
| loadData | To load option lazily, and it cannot work with `showSearch` | `(selectedOptions) => void` | - | |
|
||||
| notFoundContent | Specify content to show when no result matches. | string | 'Not Found' | |
|
||||
| notFoundContent | Specify content to show when no result matches. | string | `Not Found` | |
|
||||
| options | data options of cascade | [Option](#Option)[] | - | |
|
||||
| placeholder | input placeholder | string | 'Please select' | |
|
||||
| popupClassName | additional className of popup overlay | string | - | |
|
||||
|
@ -30,19 +30,19 @@ cover: https://gw.alipayobjects.com/zos/alicdn/UdS8y8xyZ/Cascader.svg
|
||||
| defaultValue | 默认的选中项 | string\[] \| number\[] | \[] | |
|
||||
| disabled | 禁用 | boolean | false | |
|
||||
| displayRender | 选择后展示的渲染函数 | `(label, selectedOptions) => ReactNode` | `label => label.join(' / ')` | |
|
||||
| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | string | 'click' | |
|
||||
| expandTrigger | 次级菜单的展开方式,可选 'click' 和 'hover' | string | `click` | |
|
||||
| expandIcon | 自定义次级菜单展开图标 | ReactNode | - | 4.4.0 |
|
||||
| fieldNames | 自定义 options 中 label name children 的字段 | object | `{ label: 'label', value: 'value', children: 'children' }` | |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | () => document.body | |
|
||||
| loadData | 用于动态加载选项,无法与 `showSearch` 一起使用 | `(selectedOptions) => void` | - | |
|
||||
| notFoundContent | 当下拉列表为空时显示的内容 | string | 'Not Found' | |
|
||||
| notFoundContent | 当下拉列表为空时显示的内容 | string | `Not Found` | |
|
||||
| options | 可选项数据源 | [Option](#Option)[] | - | |
|
||||
| placeholder | 输入框占位文本 | string | '请选择' | |
|
||||
| popupClassName | 自定义浮层类名 | string | - | |
|
||||
| popupPlacement | 浮层预设位置:`bottomLeft` `bottomRight` `topLeft` `topRight` | Enum | `bottomLeft` | |
|
||||
| popupVisible | 控制浮层显隐 | boolean | - | |
|
||||
| showSearch | 在选择框中显示搜索框 | boolean | false | |
|
||||
| size | 输入框大小 | `large` \| `middle` \| `small` | 无 | |
|
||||
| size | 输入框大小 | `large` \| `middle` \| `small` | - | |
|
||||
| style | 自定义样式 | CSSProperties | - | |
|
||||
| suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | |
|
||||
| value | 指定选中项 | string\[] \| number\[] | - | |
|
||||
|
@ -9,7 +9,7 @@
|
||||
&-item {
|
||||
.@{checkbox-prefix-cls}-group-rtl & {
|
||||
margin-right: 0;
|
||||
margin-left: 8px;
|
||||
margin-left: @checkbox-group-item-margin-right;
|
||||
}
|
||||
&:last-child {
|
||||
.@{checkbox-prefix-cls}-group-rtl & {
|
||||
@ -19,7 +19,7 @@
|
||||
}
|
||||
&-item + &-item {
|
||||
.@{checkbox-prefix-cls}-group-rtl & {
|
||||
margin-left: 8px;
|
||||
margin-left: @checkbox-group-item-margin-right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,21 +21,21 @@ A content area which can be collapsed and expanded.
|
||||
| --- | --- | --- | --- | --- |
|
||||
| activeKey | Key of the active panel | string\[]\|string\| number\[]\|number | No default value. In `accordion` mode, it's the key of the first panel. | |
|
||||
| defaultActiveKey | Key of the initial active panel | string\[]\|string\| number\[]\|number | - | |
|
||||
| bordered | Toggles rendering of the border around the collapse block | boolean | `true` | |
|
||||
| accordion | If `true`, `Collapse` renders as `Accordion` | boolean | `false` | |
|
||||
| bordered | Toggles rendering of the border around the collapse block | boolean | true | |
|
||||
| accordion | If `true`, `Collapse` renders as `Accordion` | boolean | false | |
|
||||
| onChange | Callback function executed when active panel is changed | Function | - | |
|
||||
| expandIcon | allow to customize collapse icon | (panelProps) => ReactNode | - | |
|
||||
| expandIconPosition | Set expand icon position | `left` \| `right` | - | |
|
||||
| destroyInactivePanel | Destroy Inactive Panel | boolean | `false` | |
|
||||
| ghost | make the collapse borderless and its background transparent | boolean | `false` | 4.4.0 |
|
||||
| destroyInactivePanel | Destroy Inactive Panel | boolean | false | |
|
||||
| ghost | make the collapse borderless and its background transparent | boolean | false | 4.4.0 |
|
||||
|
||||
### Collapse.Panel
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| disabled | If `true`, panel cannot be opened or closed | boolean | `false` | |
|
||||
| forceRender | Forced render of content on panel, instead of lazy rending after clicking on header | boolean | `false` | |
|
||||
| disabled | If `true`, panel cannot be opened or closed | boolean | false | |
|
||||
| forceRender | Forced render of content on panel, instead of lazy rending after clicking on header | boolean | false | |
|
||||
| header | Title of the panel | string\|ReactNode | - | |
|
||||
| key | Unique key identifying the panel from among its siblings | string\|number | - | |
|
||||
| showArrow | If `false`, panel will not show arrow icon | boolean | `true` | |
|
||||
| showArrow | If `false`, panel will not show arrow icon | boolean | true | |
|
||||
| extra | extra element in the corner | ReactNode | - | |
|
||||
|
@ -21,14 +21,14 @@ cover: https://gw.alipayobjects.com/zos/alicdn/IxH16B9RD/Collapse.svg
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| activeKey | 当前激活 tab 面板的 key | string\[]\|string\| number\[]\|number | 默认无,accordion 模式下默认第一个元素 | |
|
||||
| defaultActiveKey | 初始化选中面板的 key | string\[]\|string\| number\[]\|number | 无 | |
|
||||
| bordered | 带边框风格的折叠面板 | boolean | `true` | |
|
||||
| accordion | 手风琴模式 | boolean | `false` | |
|
||||
| onChange | 切换面板的回调 | Function | 无 | |
|
||||
| defaultActiveKey | 初始化选中面板的 key | string\[]\|string\| number\[]\|number | - | |
|
||||
| bordered | 带边框风格的折叠面板 | boolean | true | |
|
||||
| accordion | 手风琴模式 | boolean | false | |
|
||||
| onChange | 切换面板的回调 | Function | - | |
|
||||
| expandIcon | 自定义切换图标 | (panelProps) => ReactNode | - | |
|
||||
| expandIconPosition | 设置图标位置 | `left` \| `right` | - | |
|
||||
| destroyInactivePanel | 销毁折叠隐藏的面板 | boolean | `false` | |
|
||||
| ghost | 使折叠面板透明且无边框 | boolean | `false` | 4.4.0 |
|
||||
| destroyInactivePanel | 销毁折叠隐藏的面板 | boolean | false | |
|
||||
| ghost | 使折叠面板透明且无边框 | boolean | false | 4.4.0 |
|
||||
|
||||
### Collapse.Panel
|
||||
|
||||
@ -36,7 +36,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/IxH16B9RD/Collapse.svg
|
||||
| ----------- | ------------------------------------------ | ----------------- | ------ | ---- |
|
||||
| disabled | 禁用后的面板展开与否将无法通过用户交互改变 | boolean | false | |
|
||||
| forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false | |
|
||||
| header | 面板头内容 | string\|ReactNode | 无 | |
|
||||
| key | 对应 activeKey | string\|number | 无 | |
|
||||
| showArrow | 是否展示当前面板上的箭头 | boolean | `true` | |
|
||||
| header | 面板头内容 | string\|ReactNode | - | |
|
||||
| key | 对应 activeKey | string\|number | - | |
|
||||
| showArrow | 是否展示当前面板上的箭头 | boolean | true | |
|
||||
| extra | 自定义渲染每个面板右上角的内容 | ReactNode | - | |
|
||||
|
@ -44,10 +44,10 @@ Some components use dynamic style to support wave effect. You can config `csp` p
|
||||
| form | Set Form common props | { validateMessages?: [ValidateMessages](/components/form/#validateMessages) } | - | |
|
||||
| input | Set Input common props | { autoComplete?: string } | - | 4.2.0 |
|
||||
| renderEmpty | set empty content of components. Ref [Empty](/components/empty/) | Function(componentName: string): ReactNode | - | |
|
||||
| getPopupContainer | to set the container of the popup element. The default is to create a `div` element in `body`. | Function(triggerNode) | `() => document.body` | |
|
||||
| getPopupContainer | to set the container of the popup element. The default is to create a `div` element in `body`. | Function(triggerNode) | () => document.body | |
|
||||
| getTargetContainer | Config Affix, Anchor scroll target container. | () => HTMLElement | () => window | 4.2.0 |
|
||||
| locale | language package setting, you can find the packages in [antd/es/locale](http://unpkg.com/antd/es/locale/) | object | |
|
||||
| prefixCls | set prefix class. `Note:` This will discard default styles from `antd`. | string | ant | |
|
||||
| prefixCls | set prefix class. `Note:` This will discard default styles from `antd`. | string | `ant` | |
|
||||
| pageHeader | Unify the ghost of PageHeader, ref [PageHeader](/components/page-header) | { ghost:boolean } | true | |
|
||||
| direction | set direction of layout. See [demo](#components-config-provider-demo-direction) | `ltr` \| `rtl` | `ltr` | |
|
||||
| space | set Space `size`, ref [Space](/components/space) | { size: `small` \| `middle` \| `large` \| `number` } | - | 4.1.0 |
|
||||
|
@ -48,7 +48,7 @@ return (
|
||||
| getPopupContainer | 弹出框(Select, Tooltip, Menu 等等)渲染父节点,默认渲染到 body 上。 | Function(triggerNode) | () => document.body | |
|
||||
| getTargetContainer | 配置 Affix、Anchor 滚动监听容器。 | () => HTMLElement | () => window | 4.2.0 |
|
||||
| locale | 语言包配置,语言包可到 [antd/es/locale](http://unpkg.com/antd/es/locale/) 目录下寻找 | object | - | |
|
||||
| prefixCls | 设置统一样式前缀。`注意:这将不会应用由 antd 提供的默认样式` | string | ant | |
|
||||
| prefixCls | 设置统一样式前缀。`注意:这将不会应用由 antd 提供的默认样式` | string | `ant` | |
|
||||
| pageHeader | 统一设置 PageHeader 的 ghost,参考 [PageHeader](/components/page-header) | { ghost: boolean } | true | |
|
||||
| direction | 设置文本展示方向。 [示例](#components-config-provider-demo-direction) | `ltr` \| `rtl` | `ltr` | |
|
||||
| space | 设置 Space 的 `size`,参考 [Space](/components/space) | { size: `small` \| `middle` \| `large` \| `number` } | - | 4.1.0 |
|
||||
|
@ -62,7 +62,7 @@ The following APIs are shared by DatePicker, YearPicker, MonthPicker, RangePicke
|
||||
| placeholder | placeholder of date input | string \| \[string,string] | - | |
|
||||
| popupStyle | to customize the style of the popup calendar | CSSProperties | {} | |
|
||||
| size | determine the size of the input box, the height of `large` and `small`, are 40px and 24px respectively, while default size is 32px | `large` \| `middle` \| `small` | - | |
|
||||
| bordered | whether has border style | Boolean | true | |
|
||||
| bordered | whether has border style | boolean | true | |
|
||||
| suffixIcon | The custom suffix icon | ReactNode | - | |
|
||||
| style | to customize the style of the input box | CSSProperties | {} | |
|
||||
| onOpenChange | a callback function, can be executed whether the popup calendar is popped up or closed | function(open) | - | |
|
||||
@ -149,12 +149,12 @@ Added in `4.1.0`.
|
||||
| dateRender | Customize date cell. `info` argument is added in 4.3.0 | function(currentDate: moment, today: moment, info: { range: 'start' \| ''end }) => React.ReactNode | - | |
|
||||
| defaultValue | to set default date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | |
|
||||
| defaultPickerValue | to set default picker date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)\] | - | |
|
||||
| disabled | disable start or end | `[boolean, boolean]` | - | |
|
||||
| disabled | disable start or end | \[boolean, boolean] | - | |
|
||||
| disabledTime | to specify the time that cannot be selected | function(dates: \[moment, moment], partial: `'start'|'end'`) | - | |
|
||||
| format | to set the date format, refer to [moment.js](http://momentjs.com/). When an array is provided, all values are used for parsing and first value is used for formatting. | string \| string[] | "YYYY-MM-DD HH:mm:ss" | |
|
||||
| ranges | preseted ranges for quick selection | { \[range: string]: [moment](http://momentjs.com/)\[] } \| { \[range: string]: () => [moment](http://momentjs.com/)\[] } | - | |
|
||||
| renderExtraFooter | render extra footer in panel | () => React.ReactNode | - | |
|
||||
| separator | set separator between inputs | string | '~' | |
|
||||
| separator | set separator between inputs | string | `~` | |
|
||||
| showTime | to provide an additional time selection | object\|boolean | [TimePicker Options](/components/time-picker/#API) | |
|
||||
| showTime.defaultValue | to set default time of selected date, [demo](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | \[moment(), moment()] | |
|
||||
| value | to set date | \[[moment](http://momentjs.com/), [moment](http://momentjs.com/)] | - | |
|
||||
|
@ -54,20 +54,20 @@ import 'moment/locale/zh-cn';
|
||||
| className | 选择器 className | string | '' | |
|
||||
| dateRender | 自定义日期单元格的内容 | function(currentDate: moment, today: moment) => React.ReactNode | - | |
|
||||
| disabled | 禁用 | boolean | false | |
|
||||
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | 无 | |
|
||||
| disabledDate | 不可选择的日期 | (currentDate: moment) => boolean | - | |
|
||||
| dropdownClassName | 额外的弹出日历 className | string | - | |
|
||||
| getPopupContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | 无 | |
|
||||
| getPopupContainer | 定义浮层的容器,默认为 body 上新建 div | function(trigger) | - | |
|
||||
| locale | 国际化配置 | object | [默认配置](https://github.com/ant-design/ant-design/blob/master/components/date-picker/locale/example.json) | |
|
||||
| mode | 日期面板的状态([设置后无法选择年份/月份?](/docs/react/faq#当我指定了-DatePicker/RangePicker-的-mode-属性后,点击后无法选择年份/月份?)) | `time` \| `date` \| `month` \| `year` \| `decade` | - | |
|
||||
| open | 控制弹层是否展开 | boolean | - | |
|
||||
| picker | 设置选择器类型 | `date` \| `week` \| `month` \| `quarter` (4.1.0) \| `year` | `date` | |
|
||||
| placeholder | 输入框提示文字 | string \| \[string, string] | - | |
|
||||
| popupStyle | 额外的弹出日历样式 | CSSProperties | {} | |
|
||||
| size | 输入框大小,`large` 高度为 40px,`small` 为 24px,默认是 32px | `large` \| `middle` \| `small` | 无 | |
|
||||
| bordered | 是否有边框 | Boolean | true | |
|
||||
| size | 输入框大小,`large` 高度为 40px,`small` 为 24px,默认是 32px | `large` \| `middle` \| `small` | - | |
|
||||
| bordered | 是否有边框 | boolean | true | |
|
||||
| suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | |
|
||||
| style | 自定义输入框样式 | CSSProperties | {} | |
|
||||
| onOpenChange | 弹出日历和关闭日历的回调 | function(open) | 无 | |
|
||||
| onOpenChange | 弹出日历和关闭日历的回调 | function(open) | - | |
|
||||
| onPanelChange | 日历面板切换的回调 | function(value, mode) | - | |
|
||||
| inputReadOnly | 设置输入框为只读(避免在移动设备上打开虚拟键盘) | boolean | false | |
|
||||
|
||||
@ -82,16 +82,16 @@ import 'moment/locale/zh-cn';
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| defaultValue | 默认日期,如果开始时间或结束时间为 `null` 或者 `undefined`,日期范围将是一个开区间 | [moment](http://momentjs.com/) | 无 | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| disabledTime | 不可选择的时间 | function(date) | 无 | |
|
||||
| defaultValue | 默认日期,如果开始时间或结束时间为 `null` 或者 `undefined`,日期范围将是一个开区间 | [moment](http://momentjs.com/) | - | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | - | |
|
||||
| disabledTime | 不可选择的时间 | function(date) | - | |
|
||||
| format | 设置日期格式,为数组时支持多格式匹配,展示以第一个为准。配置参考 [moment.js](http://momentjs.com/) | string \| string[] | "YYYY-MM-DD" | |
|
||||
| renderExtraFooter | 在面板中添加额外的页脚 | (mode) => React.ReactNode | - | |
|
||||
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) | |
|
||||
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/) | moment() | |
|
||||
| showToday | 是否展示“今天”按钮 | boolean | true | |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| onChange | 时间发生变化的回调 | function(date: moment, dateString: string) | 无 | |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | - | |
|
||||
| onChange | 时间发生变化的回调 | function(date: moment, dateString: string) | - | |
|
||||
| onOk | 点击确定按钮的回调 | function() | - | |
|
||||
| onPanelChange | 日期面板变化时的回调 | function(value, mode) | - | |
|
||||
| showNow | 当设定了 `showTime` 的时候,面板是否显示“此刻”按钮 | boolean | - | 4.4.0 |
|
||||
@ -100,11 +100,11 @@ import 'moment/locale/zh-cn';
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | - | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | - | |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY" | |
|
||||
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | - | |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date: moment, dateString: string) | - | |
|
||||
|
||||
### QuarterPicker
|
||||
@ -113,23 +113,23 @@ import 'moment/locale/zh-cn';
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | - | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | - | |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-\QQ" | |
|
||||
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | - | |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date: moment, dateString: string) | - | |
|
||||
|
||||
### MonthPicker
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | - | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | - | |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-MM" | |
|
||||
| monthCellRender | 自定义的月份内容渲染方法 | function(date, locale): ReactNode | - | |
|
||||
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | - | |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date: moment, dateString: string) | - | |
|
||||
|
||||
### WeekPicker
|
||||
@ -137,7 +137,7 @@ import 'moment/locale/zh-cn';
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/) | - | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | 无 | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/) | - | |
|
||||
| format | 展示的日期格式,配置参考 [moment.js](http://momentjs.com/) | string | "YYYY-wo" | |
|
||||
| value | 日期 | [moment](http://momentjs.com/) | - | |
|
||||
| onChange | 时间发生变化的回调,发生在用户选择时间时 | function(date: moment, dateString: string) | - | |
|
||||
@ -149,19 +149,19 @@ import 'moment/locale/zh-cn';
|
||||
| --- | --- | --- | --- | --- |
|
||||
| allowEmpty | 允许起始项部分为空 | \[boolean, boolean] | \[false, false] | |
|
||||
| dateRender | 自定义日期单元格的内容。`info` 参数自 4.3.0 添加 | function(currentDate: moment, today: moment, info: { range: 'start' \| ''end }) => React.ReactNode | - | |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/)\[] | 无 | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/)\[] | 无 | |
|
||||
| disabled | 禁用起始项 | `[boolean, boolean]` | 无 | |
|
||||
| disabledTime | 不可选择的时间 | function(dates: \[moment, moment\], partial: `'start'|'end'`) | 无 | |
|
||||
| defaultValue | 默认日期 | [moment](http://momentjs.com/)\[] | - | |
|
||||
| defaultPickerValue | 默认面板日期 | [moment](http://momentjs.com/)\[] | - | |
|
||||
| disabled | 禁用起始项 | \[boolean, boolean] | - | |
|
||||
| disabledTime | 不可选择的时间 | function(dates: \[moment, moment\], partial: `'start'|'end'`) | - | |
|
||||
| format | 展示的日期格式 | string | "YYYY-MM-DD HH:mm:ss" | |
|
||||
| ranges | 预设时间范围快捷选择 | { \[range: string]: [moment](http://momentjs.com/)\[] } \| { \[range: string]: () => [moment](http://momentjs.com/)\[] } | 无 | |
|
||||
| ranges | 预设时间范围快捷选择 | { \[range: string]: [moment](http://momentjs.com/)\[] } \| { \[range: string]: () => [moment](http://momentjs.com/)\[] } | - | |
|
||||
| renderExtraFooter | 在面板中添加额外的页脚 | () => React.ReactNode | - | |
|
||||
| separator | 设置分隔符 | string | '~' | |
|
||||
| separator | 设置分隔符 | string | `~` | |
|
||||
| showTime | 增加时间选择功能 | Object\|boolean | [TimePicker Options](/components/time-picker/#API) | |
|
||||
| showTime.defaultValue | 设置用户选择日期时默认的时分秒,[例子](#components-date-picker-demo-disabled-date) | [moment](http://momentjs.com/)\[] | \[moment(), moment()] | |
|
||||
| value | 日期 | [moment](http://momentjs.com/)\[] | 无 | |
|
||||
| onCalendarChange | 待选日期发生变化的回调 | function(dates: \[moment, moment\], dateStrings: \[string, string\]) | 无 | |
|
||||
| onChange | 日期范围发生变化的回调 | function(dates: \[moment, moment\], dateStrings: \[string, string\]) | 无 | |
|
||||
| value | 日期 | [moment](http://momentjs.com/)\[] | - | |
|
||||
| onCalendarChange | 待选日期发生变化的回调 | function(dates: \[moment, moment\], dateStrings: \[string, string\]) | - | |
|
||||
| onChange | 日期范围发生变化的回调 | function(dates: \[moment, moment\], dateStrings: \[string, string\]) | - | |
|
||||
|
||||
<style>
|
||||
.code-box-demo .ant-picker {
|
||||
|
@ -597,12 +597,21 @@
|
||||
flex: 1 0 auto;
|
||||
width: 56px;
|
||||
margin: 0;
|
||||
padding: 0 0 194px 0;
|
||||
padding: 0;
|
||||
overflow-y: hidden;
|
||||
text-align: left;
|
||||
list-style: none;
|
||||
transition: background @animation-duration-slow;
|
||||
|
||||
&::after {
|
||||
display: block;
|
||||
height: 224px - @picker-time-panel-cell-height;
|
||||
content: '';
|
||||
.@{picker-prefix-cls}-datetime-panel & {
|
||||
height: 224px - @picker-time-panel-cell-height + 2 * @border-width-base;
|
||||
}
|
||||
}
|
||||
|
||||
&:not(:first-child) {
|
||||
border-left: @border-width-base @border-style-base @picker-border-color;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
font-weight: normal;
|
||||
font-size: @font-size-base;
|
||||
line-height: @line-height-base;
|
||||
text-align: start;
|
||||
|
||||
&::after {
|
||||
& when (@descriptions-item-trailing-colon=true) {
|
||||
@ -74,7 +75,8 @@
|
||||
&-item {
|
||||
padding-bottom: 0;
|
||||
> span {
|
||||
display: inline-block;
|
||||
display: inline-flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr
|
||||
| destroyOnClose | Whether to unmount child components on closing drawer or not. | boolean | false |
|
||||
| forceRender | Prerender Drawer component forcely | boolean | false |
|
||||
| getContainer | Return the mounted node for Drawer. | HTMLElement \| `() => HTMLElement` \| Selectors \| false | 'body' |
|
||||
| mask | Whether to show mask or not. | Boolean | true |
|
||||
| mask | Whether to show mask or not. | boolean | true |
|
||||
| maskClosable | Clicking on the mask (area outside the Drawer) to close the Drawer or not. | boolean | true |
|
||||
| maskStyle | Style for Drawer's mask element. | CSSProperties | {} |
|
||||
| style | Style of wrapper element which **contains mask** compare to `drawerStyle` | CSSProperties | - |
|
||||
@ -41,7 +41,7 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr
|
||||
| placement | The placement of the Drawer. | `top` \| `right` \| `bottom` \| `left` | `right` |
|
||||
| onClose | Specify a callback that will be called when a user clicks mask, close button or Cancel button. | function(e) | - |
|
||||
| afterVisibleChange | Callback after the animation ends when switching drawers. | function(visible) | - |
|
||||
| keyboard | Whether support press esc to close | Boolean | true |
|
||||
| keyboard | Whether support press esc to close | boolean | true |
|
||||
| footer | The footer for Drawer. | ReactNode | - |
|
||||
| footerStyle | Style of the drawer footer part. | CSSProperties | - |
|
||||
|
||||
|
@ -393,7 +393,7 @@ exports[`renders ./components/dropdown/demo/overlay-visible.md correctly 1`] = `
|
||||
`;
|
||||
|
||||
exports[`renders ./components/dropdown/demo/placement.md correctly 1`] = `
|
||||
<div>
|
||||
Array [
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger"
|
||||
type="button"
|
||||
@ -401,7 +401,7 @@ exports[`renders ./components/dropdown/demo/placement.md correctly 1`] = `
|
||||
<span>
|
||||
bottomLeft
|
||||
</span>
|
||||
</button>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger"
|
||||
type="button"
|
||||
@ -409,7 +409,7 @@ exports[`renders ./components/dropdown/demo/placement.md correctly 1`] = `
|
||||
<span>
|
||||
bottomCenter
|
||||
</span>
|
||||
</button>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger"
|
||||
type="button"
|
||||
@ -417,8 +417,8 @@ exports[`renders ./components/dropdown/demo/placement.md correctly 1`] = `
|
||||
<span>
|
||||
bottomRight
|
||||
</span>
|
||||
</button>
|
||||
<br />
|
||||
</button>,
|
||||
<br />,
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger"
|
||||
type="button"
|
||||
@ -426,7 +426,7 @@ exports[`renders ./components/dropdown/demo/placement.md correctly 1`] = `
|
||||
<span>
|
||||
topLeft
|
||||
</span>
|
||||
</button>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger"
|
||||
type="button"
|
||||
@ -434,7 +434,7 @@ exports[`renders ./components/dropdown/demo/placement.md correctly 1`] = `
|
||||
<span>
|
||||
topCenter
|
||||
</span>
|
||||
</button>
|
||||
</button>,
|
||||
<button
|
||||
class="ant-btn ant-dropdown-trigger"
|
||||
type="button"
|
||||
@ -442,8 +442,8 @@ exports[`renders ./components/dropdown/demo/placement.md correctly 1`] = `
|
||||
<span>
|
||||
topRight
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
</button>,
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`renders ./components/dropdown/demo/sub-menu.md correctly 1`] = `
|
||||
|
@ -37,7 +37,7 @@ const menu = (
|
||||
);
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<>
|
||||
<Dropdown overlay={menu} placement="bottomLeft">
|
||||
<Button>bottomLeft</Button>
|
||||
</Dropdown>
|
||||
@ -57,7 +57,7 @@ ReactDOM.render(
|
||||
<Dropdown overlay={menu} placement="topRight">
|
||||
<Button>topRight</Button>
|
||||
</Dropdown>
|
||||
</div>,
|
||||
</>,
|
||||
mountNode,
|
||||
);
|
||||
```
|
||||
|
@ -17,7 +17,7 @@ When there are more than a few options to choose from, you can wrap them in a `D
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| arrow | Whether the dropdown arrow should be visible | boolean | `false` | |
|
||||
| arrow | Whether the dropdown arrow should be visible | boolean | false | |
|
||||
| disabled | Whether the dropdown menu is disabled | boolean | - | |
|
||||
| getPopupContainer | To set the container of the dropdown menu. The default is to create a `div` element in `body`, but you can reset it to the scrolling area and make a relative reposition. [Example on CodePen](https://codepen.io/afc163/pen/zEjNOy?editors=0010). | Function(triggerNode) | `() => document.body` | |
|
||||
| overlay | The dropdown menu | [Menu](/components/menu) \| () => Menu | - | |
|
||||
|
@ -21,7 +21,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/eedWN59yJ/Dropdown.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| arrow | 下拉框箭头是否显示 | boolean | `false` | |
|
||||
| arrow | 下拉框箭头是否显示 | boolean | false | |
|
||||
| disabled | 菜单是否禁用 | boolean | - | |
|
||||
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010) | Function(triggerNode) | `() => document.body` | |
|
||||
| overlay | 菜单 | [Menu](/components/menu) \| () => Menu | - | |
|
||||
|
@ -44,7 +44,7 @@ export interface FormItemProps extends FormItemLabelProps, FormItemInputProps, R
|
||||
noStyle?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
className?: string;
|
||||
children: ChildrenType;
|
||||
children?: ChildrenType;
|
||||
id?: string;
|
||||
hasFeedback?: boolean;
|
||||
validateStatus?: ValidateStatus;
|
||||
|
@ -29,10 +29,10 @@ High performance Form component with data scope management. Including data colle
|
||||
| labelCol | label layout, like `<Col>` component. Set `span` `offset` value like `{span: 3, offset: 12}` or `sm: {span: 3, offset: 12}` | [object](/components/grid/#Col) | - | |
|
||||
| layout | Form layout | `horizontal` \| `vertical` \| `inline` | `horizontal` | |
|
||||
| name | Form name. Will be the prefix of Field `id` | string | - | |
|
||||
| scrollToFirstError | Auto scroll to first failed field when submit | false | - | |
|
||||
| scrollToFirstError | Auto scroll to first failed field when submit | boolean | false | |
|
||||
| size | Set field component size (antd components only) | `small` \| `middle` \| `large` | - | |
|
||||
| validateMessages | Validation prompt template, description [see below](#validateMessages) | [ValidateMessages](https://github.com/react-component/field-form/blob/master/src/utils/messages.ts) | - | |
|
||||
| validateTrigger | Config field validate trigger | string \| string[] | 'onChange' | 4.3.0 |
|
||||
| validateTrigger | Config field validate trigger | string \| string[] | `onChange` | 4.3.0 |
|
||||
| wrapperCol | The layout for input controls, same as `labelCol` | [object](/components/grid/#Col) | - | |
|
||||
| onFinish | Trigger after submitting the form and verifying data successfully | Function(values) | - | |
|
||||
| onFinishFailed | Trigger after submitting the form and verifying data failed | Function({ values, errorFields, outOfDate }) | - | |
|
||||
@ -89,11 +89,11 @@ Form field component for data bidirectional binding, validation, layout, and so
|
||||
| required | Display required style. It will be generated by the validation rule | boolean | false | |
|
||||
| rules | Rules for field validation. Click [here](#components-form-demo-basic) to see an example | [Rule](#Rule)[] | - | |
|
||||
| shouldUpdate | Custom field update logic. See [below](#shouldUpdate) | boolean \| (prevValue, curValue) => boolean | false | |
|
||||
| trigger | When to collect the value of children node | string | onChange | |
|
||||
| trigger | When to collect the value of children node | string | `onChange` | |
|
||||
| validateFirst | Whether stop validate on first rule of error for this field | boolean | false | |
|
||||
| validateStatus | The validation status. If not provided, it will be generated by validation rule. options: 'success' 'warning' 'error' 'validating' | string | - | |
|
||||
| validateTrigger | When to validate the value of children node | string \| string[] | onChange | |
|
||||
| valuePropName | Props of children node, for example, the prop of Switch is 'checked'. This prop is an encapsulation of `getValueProps`, which will be invalid after customizing `getValueProps` | string | 'value' | |
|
||||
| validateTrigger | When to validate the value of children node | string \| string[] | `onChange` | |
|
||||
| valuePropName | Props of children node, for example, the prop of Switch is 'checked'. This prop is an encapsulation of `getValueProps`, which will be invalid after customizing `getValueProps` | string | `value` | |
|
||||
| wrapperCol | The layout for input controls, same as `labelCol`. You can set `wrapperCol` on Form. If both exists, use Item first | [object](/components/grid/#Col) | - | |
|
||||
|
||||
After wrapped by `Form.Item` with `name` property, `value`(or other property defined by `valuePropName`) `onChange`(or other property defined by `trigger`) props will be added to form controls, the flow of form data will be handled by Form which will cause:
|
||||
|
@ -30,10 +30,10 @@ cover: https://gw.alipayobjects.com/zos/alicdn/ORmcdeaoO/Form.svg
|
||||
| labelCol | label 标签布局,同 `<Col>` 组件,设置 `span` `offset` 值,如 `{span: 3, offset: 12}` 或 `sm: {span: 3, offset: 12}` | [object](/components/grid/#Col) | - | |
|
||||
| layout | 表单布局 | `horizontal` \| `vertical` \| `inline` | `horizontal` | |
|
||||
| name | 表单名称,会作为表单字段 `id` 前缀使用 | string | - | |
|
||||
| scrollToFirstError | 提交失败自动滚动到第一个错误字段 | false | - | |
|
||||
| scrollToFirstError | 提交失败自动滚动到第一个错误字段 | boolean | false | |
|
||||
| size | 设置字段组件的尺寸(仅限 antd 组件) | `small` \| `middle` \| `large` | - | |
|
||||
| validateMessages | 验证提示模板,说明[见下](#validateMessages) | [ValidateMessages](https://github.com/react-component/field-form/blob/master/src/utils/messages.ts) | - | |
|
||||
| validateTrigger | 统一设置字段校验规则 | string \| string[] | 'onChange' | 4.3.0 |
|
||||
| validateTrigger | 统一设置字段校验规则 | string \| string[] | `onChange` | 4.3.0 |
|
||||
| wrapperCol | 需要为输入控件设置布局样式时,使用该属性,用法同 labelCol | [object](/components/grid/#Col) | - | |
|
||||
| onFinish | 提交表单且数据验证成功后回调事件 | Function(values) | - | |
|
||||
| onFinishFailed | 提交表单且数据验证失败后回调事件 | Function({ values, errorFields, outOfDate }) | - | |
|
||||
@ -90,11 +90,11 @@ const validateMessages = {
|
||||
| required | 必填样式设置。如不设置,则会根据校验规则自动生成 | boolean | false | |
|
||||
| rules | 校验规则,设置字段的校验逻辑。点击[此处](#components-form-demo-basic)查看示例 | [Rule](#Rule)[] | - | |
|
||||
| shouldUpdate | 自定义字段更新逻辑,说明[见下](#shouldUpdate) | boolean \| (prevValue, curValue) => boolean | false | |
|
||||
| trigger | 设置收集字段值变更的时机 | string | onChange | |
|
||||
| trigger | 设置收集字段值变更的时机 | string | `onChange` | |
|
||||
| validateFirst | 当某一规则校验不通过时,是否停止剩下的规则的校验 | boolean | false | |
|
||||
| validateStatus | 校验状态,如不设置,则会根据校验规则自动生成,可选:'success' 'warning' 'error' 'validating' | string | - | |
|
||||
| validateTrigger | 设置字段校验的时机 | string \| string[] | onChange | |
|
||||
| valuePropName | 子节点的值的属性,如 Switch 的是 'checked'。该属性为 `getValueProps` 的封装,自定义 `getValueProps` 后会失效 | string | 'value' | |
|
||||
| validateTrigger | 设置字段校验的时机 | string \| string[] | `onChange` | |
|
||||
| valuePropName | 子节点的值的属性,如 Switch 的是 'checked'。该属性为 `getValueProps` 的封装,自定义 `getValueProps` 后会失效 | string | `value` | |
|
||||
| wrapperCol | 需要为输入控件设置布局样式时,使用该属性,用法同 `labelCol`。你可以通过 Form 的 `wrapperCol` 进行统一设置。当和 Form 同时设置时,以 Item 为准。 | [object](/components/grid/#Col) | - | |
|
||||
|
||||
被设置了 `name` 属性的 `Form.Item` 包装的控件,表单控件会自动添加 `value`(或 `valuePropName` 指定的其他属性) `onChange`(或 `trigger` 指定的其他属性),数据同步将被 Form 接管,这会导致以下结果:
|
||||
|
@ -25,7 +25,7 @@ ReactDOM.render(<IconDisplay />, mountNode);
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| className | className of Icon | `string` | - | |
|
||||
| className | className of Icon | string | - | |
|
||||
| style | Style properties of icon, like `fontSize` and `color` | CSSProperties | - | |
|
||||
| spin | Rotate icon with animation | boolean | false | |
|
||||
| rotate | Rotate by n degrees (not working in IE9) | number | - | |
|
||||
|
@ -32,7 +32,7 @@ ReactDOM.render(<IconDisplay />, mountNode);
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| className | 设置图标的样式名 | `string` | - | |
|
||||
| className | 设置图标的样式名 | string | - | |
|
||||
| style | 设置图标的样式,例如 `fontSize` 和 `color` | CSSProperties | - | |
|
||||
| spin | 是否有旋转动画 | boolean | false | |
|
||||
| rotate | 图标旋转角度(IE9 无效) | number | - | |
|
||||
|
@ -27,7 +27,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/XOS8qZ0kU/InputNumber.svg
|
||||
| parser | 指定从 `formatter` 里转换回数字的方式,和 `formatter` 搭配使用 | function(string): number | |
|
||||
| precision | 数值精度 | number | |
|
||||
| decimalSeparator | 小数点 | string | |
|
||||
| size | 输入框大小 | `large` \| `middle` \| `small` | 无 |
|
||||
| size | 输入框大小 | `large` \| `middle` \| `small` | - |
|
||||
| step | 每次改变步数,可以为小数 | number\|string | 1 |
|
||||
| value | 当前值 | number | |
|
||||
| onChange | 变化回调 | Function(value: number \| string) | |
|
||||
|
@ -4,6 +4,7 @@ import omit from 'omit.js';
|
||||
import EyeOutlined from '@ant-design/icons/EyeOutlined';
|
||||
import EyeInvisibleOutlined from '@ant-design/icons/EyeInvisibleOutlined';
|
||||
|
||||
import { useState } from 'react';
|
||||
import { ConfigConsumer, ConfigConsumerProps } from '../config-provider';
|
||||
import Input, { InputProps } from './Input';
|
||||
|
||||
@ -14,44 +15,29 @@ export interface PasswordProps extends InputProps {
|
||||
iconRender?: (visible: boolean) => React.ReactNode;
|
||||
}
|
||||
|
||||
export interface PasswordState {
|
||||
visible: boolean;
|
||||
}
|
||||
|
||||
const ActionMap: Record<string, string> = {
|
||||
click: 'onClick',
|
||||
hover: 'onMouseOver',
|
||||
};
|
||||
|
||||
export default class Password extends React.Component<PasswordProps, PasswordState> {
|
||||
input: HTMLInputElement;
|
||||
const Password = React.forwardRef<unknown, PasswordProps>((props, ref) => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
|
||||
static defaultProps = {
|
||||
action: 'click',
|
||||
visibilityToggle: true,
|
||||
iconRender: (visible: boolean) => (visible ? <EyeOutlined /> : <EyeInvisibleOutlined />),
|
||||
};
|
||||
|
||||
state: PasswordState = {
|
||||
visible: false,
|
||||
};
|
||||
|
||||
onVisibleChange = () => {
|
||||
const { disabled } = this.props;
|
||||
const onVisibleChange = () => {
|
||||
const { disabled } = props;
|
||||
if (disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState(({ visible }) => ({ visible: !visible }));
|
||||
setVisible(!visible);
|
||||
};
|
||||
|
||||
getIcon = (prefixCls: string) => {
|
||||
const { action, iconRender = () => null } = this.props;
|
||||
const { visible } = this.state;
|
||||
const getIcon = (prefixCls: string) => {
|
||||
const { action, iconRender = () => null } = props;
|
||||
const iconTrigger = ActionMap[action!] || '';
|
||||
const icon = iconRender(visible);
|
||||
const iconProps = {
|
||||
[iconTrigger]: this.onVisibleChange,
|
||||
[iconTrigger]: onVisibleChange,
|
||||
className: `${prefixCls}-icon`,
|
||||
key: 'passwordIcon',
|
||||
onMouseDown: (e: MouseEvent) => {
|
||||
@ -68,25 +54,7 @@ export default class Password extends React.Component<PasswordProps, PasswordSta
|
||||
return React.cloneElement(React.isValidElement(icon) ? icon : <span>{icon}</span>, iconProps);
|
||||
};
|
||||
|
||||
saveInput = (instance: Input) => {
|
||||
if (instance && instance.input) {
|
||||
this.input = instance.input;
|
||||
}
|
||||
};
|
||||
|
||||
focus() {
|
||||
this.input.focus();
|
||||
}
|
||||
|
||||
blur() {
|
||||
this.input.blur();
|
||||
}
|
||||
|
||||
select() {
|
||||
this.input.select();
|
||||
}
|
||||
|
||||
renderPassword = ({ getPrefixCls }: ConfigConsumerProps) => {
|
||||
const renderPassword = ({ getPrefixCls }: ConfigConsumerProps) => {
|
||||
const {
|
||||
className,
|
||||
prefixCls: customizePrefixCls,
|
||||
@ -94,33 +62,40 @@ export default class Password extends React.Component<PasswordProps, PasswordSta
|
||||
size,
|
||||
visibilityToggle,
|
||||
...restProps
|
||||
} = this.props;
|
||||
} = props;
|
||||
|
||||
const inputPrefixCls = getPrefixCls('input', customizeInputPrefixCls);
|
||||
const prefixCls = getPrefixCls('input-password', customizePrefixCls);
|
||||
|
||||
const suffixIcon = visibilityToggle && this.getIcon(prefixCls);
|
||||
const suffixIcon = visibilityToggle && getIcon(prefixCls);
|
||||
const inputClassName = classNames(prefixCls, className, {
|
||||
[`${prefixCls}-${size}`]: !!size,
|
||||
});
|
||||
|
||||
const props = {
|
||||
const omittedProps = {
|
||||
...omit(restProps, ['suffix', 'iconRender']),
|
||||
type: this.state.visible ? 'text' : 'password',
|
||||
type: visible ? 'text' : 'password',
|
||||
className: inputClassName,
|
||||
prefixCls: inputPrefixCls,
|
||||
suffix: suffixIcon,
|
||||
ref: this.saveInput,
|
||||
};
|
||||
|
||||
if (size) {
|
||||
props.size = size;
|
||||
omittedProps.size = size;
|
||||
}
|
||||
|
||||
return <Input {...props} />;
|
||||
return <Input ref={ref} {...omittedProps} />;
|
||||
};
|
||||
|
||||
render() {
|
||||
return <ConfigConsumer>{this.renderPassword}</ConfigConsumer>;
|
||||
}
|
||||
}
|
||||
return <ConfigConsumer>{renderPassword}</ConfigConsumer>;
|
||||
});
|
||||
|
||||
Password.defaultProps = {
|
||||
action: 'click',
|
||||
visibilityToggle: true,
|
||||
iconRender: (visible: boolean) => (visible ? <EyeOutlined /> : <EyeInvisibleOutlined />),
|
||||
};
|
||||
|
||||
Password.displayName = 'Password';
|
||||
|
||||
export default Password;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import * as React from 'react';
|
||||
import classNames from 'classnames';
|
||||
import { composeRef } from 'rc-util/lib/ref';
|
||||
import SearchOutlined from '@ant-design/icons/SearchOutlined';
|
||||
import LoadingOutlined from '@ant-design/icons/LoadingOutlined';
|
||||
import Input, { InputProps } from './Input';
|
||||
@ -21,8 +22,8 @@ export interface SearchProps extends InputProps {
|
||||
loading?: boolean;
|
||||
}
|
||||
|
||||
const Search = React.forwardRef<unknown, SearchProps>((props, ref) => {
|
||||
const inputRef = (ref as any) || React.createRef<Input>();
|
||||
const Search = React.forwardRef<Input, SearchProps>((props, ref) => {
|
||||
const inputRef = React.useRef<Input>(null);
|
||||
|
||||
const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const { onChange: customOnChange, onSearch: customOnSearch } = props;
|
||||
@ -35,7 +36,7 @@ const Search = React.forwardRef<unknown, SearchProps>((props, ref) => {
|
||||
};
|
||||
|
||||
const onMouseDown: React.MouseEventHandler<HTMLElement> = e => {
|
||||
if (document.activeElement === inputRef.current.input) {
|
||||
if (document.activeElement === inputRef.current?.input) {
|
||||
e.preventDefault();
|
||||
}
|
||||
};
|
||||
@ -46,7 +47,7 @@ const Search = React.forwardRef<unknown, SearchProps>((props, ref) => {
|
||||
return;
|
||||
}
|
||||
if (customOnSearch) {
|
||||
customOnSearch(inputRef.current.input.value, e);
|
||||
customOnSearch(inputRef.current?.input.value!, e);
|
||||
}
|
||||
};
|
||||
|
||||
@ -183,7 +184,7 @@ const Search = React.forwardRef<unknown, SearchProps>((props, ref) => {
|
||||
<SizeContext.Consumer>
|
||||
{size => (
|
||||
<Input
|
||||
ref={inputRef}
|
||||
ref={composeRef<Input>(inputRef, ref)}
|
||||
onPressEnter={onSearch}
|
||||
{...restProps}
|
||||
size={customizeSize || size}
|
||||
|
@ -6,18 +6,27 @@ import focusTest from '../../../tests/shared/focusTest';
|
||||
import mountTest from '../../../tests/shared/mountTest';
|
||||
import rtlTest from '../../../tests/shared/rtlTest';
|
||||
import { sleep } from '../../../tests/utils';
|
||||
import Password from '../Password';
|
||||
|
||||
describe('Input.Password', () => {
|
||||
focusTest(Input.Password);
|
||||
focusTest(Input.Password, { refFocus: true });
|
||||
mountTest(Input.Password);
|
||||
rtlTest(Input.Password);
|
||||
|
||||
it('should get input element from ref', () => {
|
||||
const wrapper = mount(<Input.Password />);
|
||||
expect(wrapper.instance().input instanceof HTMLInputElement).toBe(true);
|
||||
expect(() => {
|
||||
wrapper.instance().select();
|
||||
}).not.toThrow();
|
||||
const ref = React.createRef();
|
||||
const onSelect = jest.fn();
|
||||
|
||||
const wrapper = mount(<Input.Password onSelect={onSelect} ref={ref} />);
|
||||
expect(ref.current.input instanceof HTMLInputElement).toBe(true);
|
||||
wrapper.find('input').simulate('select');
|
||||
expect(onSelect).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should support size', () => {
|
||||
const wrapper = mount(<Password size="large" />);
|
||||
expect(wrapper.find('input').hasClass('ant-input-lg')).toBe(true);
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should change type when click', () => {
|
||||
@ -100,7 +109,7 @@ describe('Input.Password', () => {
|
||||
});
|
||||
|
||||
// https://github.com/ant-design/ant-design/pull/20544#issuecomment-569861679
|
||||
it('should not contain value attribute in input element with defautValue', async () => {
|
||||
it('should not contain value attribute in input element with defaultValue', async () => {
|
||||
const wrapper = mount(<Input.Password defaultValue="value" />);
|
||||
await sleep();
|
||||
expect(wrapper.find('input').at('0').getDOMNode().getAttribute('value')).toBeFalsy();
|
||||
|
@ -201,4 +201,12 @@ describe('Input.Search', () => {
|
||||
expect(prevented).toBeTruthy();
|
||||
expect(document.activeElement).toBe(wrapper.find('input').at(0).getDOMNode());
|
||||
});
|
||||
|
||||
it('not crash when use function ref', () => {
|
||||
const ref = jest.fn();
|
||||
const wrapper = mount(<Search ref={ref} enterButton />);
|
||||
expect(() => {
|
||||
wrapper.find('button').simulate('mousedown');
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
@ -160,3 +160,44 @@ exports[`Input.Password should change type when click 3`] = `
|
||||
</span>
|
||||
</span>
|
||||
`;
|
||||
|
||||
exports[`Input.Password should support size 1`] = `
|
||||
<span
|
||||
class="ant-input-password ant-input-password-large ant-input-affix-wrapper ant-input-affix-wrapper-lg"
|
||||
>
|
||||
<input
|
||||
action="click"
|
||||
class="ant-input ant-input-lg"
|
||||
type="password"
|
||||
value=""
|
||||
/>
|
||||
<span
|
||||
class="ant-input-suffix"
|
||||
>
|
||||
<span
|
||||
aria-label="eye-invisible"
|
||||
class="anticon anticon-eye-invisible ant-input-password-icon"
|
||||
role="img"
|
||||
tabindex="-1"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
data-icon="eye-invisible"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M942.2 486.2Q889.47 375.11 816.7 305l-50.88 50.88C807.31 395.53 843.45 447.4 874.7 512 791.5 684.2 673.4 766 512 766q-72.67 0-133.87-22.38L323 798.75Q408 838 512 838q288.3 0 430.2-300.3a60.29 60.29 0 000-51.5zm-63.57-320.64L836 122.88a8 8 0 00-11.32 0L715.31 232.2Q624.86 186 512 186q-288.3 0-430.2 300.3a60.3 60.3 0 000 51.5q56.69 119.4 136.5 191.41L112.48 835a8 8 0 000 11.31L155.17 889a8 8 0 0011.31 0l712.15-712.12a8 8 0 000-11.32zM149.3 512C232.6 339.8 350.7 258 512 258c54.54 0 104.13 9.36 149.12 28.39l-70.3 70.3a176 176 0 00-238.13 238.13l-83.42 83.42C223.1 637.49 183.3 582.28 149.3 512zm246.7 0a112.11 112.11 0 01146.2-106.69L401.31 546.2A112 112 0 01396 512z"
|
||||
/>
|
||||
<path
|
||||
d="M508 624c-3.46 0-6.87-.16-10.25-.47l-52.82 52.82a176.09 176.09 0 00227.42-227.42l-52.82 52.82c.31 3.38.47 6.79.47 10.25a111.94 111.94 0 01-112 112z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
`;
|
||||
|
@ -2300,7 +2300,7 @@ Array [
|
||||
>
|
||||
<input
|
||||
class="ant-input"
|
||||
placeholder="input search loading deault"
|
||||
placeholder="input search loading default"
|
||||
type="text"
|
||||
value=""
|
||||
/>
|
||||
|
@ -11,7 +11,7 @@ title:
|
||||
|
||||
## en-US
|
||||
|
||||
`autoSize` prop for a `textarea` type of `Input` makes the height to automatically adjust based on the content. An options object can be provided to `autoSize` to specify the minimum and maximum number of lines the textarea will automatically adjust.
|
||||
`autoSize` prop for a `textarea` type of `Input` makes the height to automatically adjust based on the content. An option object can be provided to `autoSize` to specify the minimum and maximum number of lines the textarea will automatically adjust.
|
||||
|
||||
```jsx
|
||||
import { Input } from 'antd';
|
||||
|
@ -13,7 +13,7 @@ title:
|
||||
|
||||
## en-US
|
||||
|
||||
Input.Group example
|
||||
Input.Group example.
|
||||
|
||||
Note: You don't need `Col` to control the width in the `compact` mode.
|
||||
|
||||
|
@ -11,7 +11,7 @@ title:
|
||||
|
||||
## en-US
|
||||
|
||||
Add prefix or suffix icons inside input.
|
||||
Add a prefix or suffix icons inside input.
|
||||
|
||||
```jsx
|
||||
import { Input, Tooltip } from 'antd';
|
||||
|
@ -20,7 +20,7 @@ const { Search } = Input;
|
||||
|
||||
ReactDOM.render(
|
||||
<>
|
||||
<Search placeholder="input search loading deault" loading />
|
||||
<Search placeholder="input search loading default" loading />
|
||||
<br />
|
||||
<br />
|
||||
<Search placeholder="input search loading with enterButton" loading enterButton />
|
||||
|
@ -26,7 +26,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/xS9YEJhfe/Input.svg
|
||||
| id | 输入框的 id | string | |
|
||||
| maxLength | 最大长度 | number | |
|
||||
| prefix | 带有前缀图标的 input | string\|ReactNode | |
|
||||
| size | 控件大小。注:标准表单内的输入框大小限制为 `large`。 | `large` \| `middle` \| `small` | 无 |
|
||||
| size | 控件大小。注:标准表单内的输入框大小限制为 `large`。 | `large` \| `middle` \| `small` | - |
|
||||
| suffix | 带有后缀图标的 input | string\|ReactNode | |
|
||||
| type | 声明 input 类型,同原生 input 标签的 type 属性,见:[MDN](https://developer.mozilla.org/zh-CN/docs/Web/HTML/Element/input#属性)(请直接使用 `Input.TextArea` 代替 `type="textarea"`)。 | string | `text` |
|
||||
| value | 输入框内容 | string | |
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders ./components/layout/demo/basic.md correctly 1`] = `
|
||||
<div>
|
||||
Array [
|
||||
<section
|
||||
class="ant-layout"
|
||||
>
|
||||
@ -20,7 +20,7 @@ exports[`renders ./components/layout/demo/basic.md correctly 1`] = `
|
||||
>
|
||||
Footer
|
||||
</footer>
|
||||
</section>
|
||||
</section>,
|
||||
<section
|
||||
class="ant-layout"
|
||||
>
|
||||
@ -53,7 +53,7 @@ exports[`renders ./components/layout/demo/basic.md correctly 1`] = `
|
||||
>
|
||||
Footer
|
||||
</footer>
|
||||
</section>
|
||||
</section>,
|
||||
<section
|
||||
class="ant-layout"
|
||||
>
|
||||
@ -86,7 +86,7 @@ exports[`renders ./components/layout/demo/basic.md correctly 1`] = `
|
||||
>
|
||||
Footer
|
||||
</footer>
|
||||
</section>
|
||||
</section>,
|
||||
<section
|
||||
class="ant-layout"
|
||||
>
|
||||
@ -119,8 +119,8 @@ exports[`renders ./components/layout/demo/basic.md correctly 1`] = `
|
||||
Footer
|
||||
</footer>
|
||||
</section>
|
||||
</section>
|
||||
</div>
|
||||
</section>,
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`renders ./components/layout/demo/custom-trigger.md correctly 1`] = `
|
||||
|
@ -19,7 +19,7 @@ import { Layout } from 'antd';
|
||||
const { Header, Footer, Sider, Content } = Layout;
|
||||
|
||||
ReactDOM.render(
|
||||
<div>
|
||||
<>
|
||||
<Layout>
|
||||
<Header>Header</Header>
|
||||
<Content>Content</Content>
|
||||
@ -52,7 +52,7 @@ ReactDOM.render(
|
||||
<Footer>Footer</Footer>
|
||||
</Layout>
|
||||
</Layout>
|
||||
</div>,
|
||||
</>,
|
||||
mountNode,
|
||||
);
|
||||
```
|
||||
|
@ -88,7 +88,7 @@ The sidebar.
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| breakpoint | [breakpoints](/components/grid#Col) of the responsive layout | `xs` \| `sm` \| `md` \| `lg` \| `xl` \| `xxl` } | - |
|
||||
| breakpoint | [breakpoints](/components/grid/#Col) of the responsive layout | `xs` \| `sm` \| `md` \| `lg` \| `xl` \| `xxl` } | - |
|
||||
| className | container className | string | - |
|
||||
| collapsed | to set the current status | boolean | - |
|
||||
| collapsedWidth | width of the collapsed sidebar, by setting to `0` a special trigger will appear | number | 80 |
|
||||
@ -100,7 +100,7 @@ The sidebar.
|
||||
| trigger | specify the customized trigger, set to null to hide the trigger | string\|ReactNode | - |
|
||||
| width | width of the sidebar | number\|string | 200 |
|
||||
| onCollapse | the callback function, executed by clicking the trigger or activating the responsive layout | (collapsed, type) => {} | - |
|
||||
| onBreakpoint | the callback function, executed when [breakpoints](/components/grid#API) changed | (broken) => {} | - |
|
||||
| onBreakpoint | the callback function, executed when [breakpoints](/components/grid/#API) changed | (broken) => {} | - |
|
||||
| zeroWidthTriggerStyle | to customize the styles of the special trigger that appears when `collapsedWidth` is 0 | object | - |
|
||||
|
||||
#### breakpoint width
|
||||
|
@ -89,7 +89,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/hzEndUVEx/Layout.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| breakpoint | 触发响应式布局的[断点](/components/grid-cn/#Col) | `xs` \| `sm` \| `md` \| `lg` \| `xl` \| `xxl` | - |
|
||||
| breakpoint | 触发响应式布局的[断点](/components/grid/#Col) | `xs` \| `sm` \| `md` \| `lg` \| `xl` \| `xxl` | - |
|
||||
| className | 容器 className | string | - |
|
||||
| collapsed | 当前收起状态 | boolean | - |
|
||||
| collapsedWidth | 收缩宽度,设置为 0 会出现特殊 trigger | number | 80 |
|
||||
@ -101,7 +101,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/hzEndUVEx/Layout.svg
|
||||
| trigger | 自定义 trigger,设置为 null 时隐藏 trigger | string\|ReactNode | - |
|
||||
| width | 宽度 | number\|string | 200 |
|
||||
| onCollapse | 展开-收起时的回调函数,有点击 trigger 以及响应式反馈两种方式可以触发 | (collapsed, type) => {} | - |
|
||||
| onBreakpoint | 触发响应式布局[断点](/components/grid#API)时的回调 | (broken) => {} | - |
|
||||
| onBreakpoint | 触发响应式布局[断点](/components/grid/#API)时的回调 | (broken) => {} | - |
|
||||
| zeroWidthTriggerStyle | 指定当 `collapsedWidth` 为 0 时出现的特殊 trigger 的样式 | object | - |
|
||||
|
||||
#### breakpoint width
|
||||
|
@ -253538,7 +253538,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
>
|
||||
Th09
|
||||
Thg 09
|
||||
</button>
|
||||
<button
|
||||
class="ant-picker-year-btn"
|
||||
@ -255595,7 +255595,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
>
|
||||
Th09
|
||||
Thg 09
|
||||
</button>
|
||||
<button
|
||||
class="ant-picker-year-btn"
|
||||
@ -256133,7 +256133,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
|
||||
tabindex="-1"
|
||||
type="button"
|
||||
>
|
||||
Th10
|
||||
Thg 10
|
||||
</button>
|
||||
<button
|
||||
class="ant-picker-year-btn"
|
||||
@ -257154,7 +257154,7 @@ exports[`Locale Provider should display the text as vi 1`] = `
|
||||
<span
|
||||
class="ant-select-selection-item"
|
||||
>
|
||||
Th09
|
||||
Thg 09
|
||||
</span>
|
||||
</div>
|
||||
<span
|
||||
|
@ -20,6 +20,7 @@ const localeValues: Locale = {
|
||||
filterTitle: 'Filter menu',
|
||||
filterConfirm: 'OK',
|
||||
filterReset: 'Reset',
|
||||
filterEmptyText: 'No filters',
|
||||
selectAll: 'Select current page',
|
||||
selectInvert: 'Invert current page',
|
||||
selectionAll: 'Select all data',
|
||||
|
@ -21,6 +21,7 @@ const localeValues: Locale = {
|
||||
filterTitle: '筛选',
|
||||
filterConfirm: '确定',
|
||||
filterReset: '重置',
|
||||
filterEmptyText: '无筛选项',
|
||||
selectAll: '全选当页',
|
||||
selectInvert: '反选当页',
|
||||
selectionAll: '全选所有',
|
||||
|
@ -20,6 +20,7 @@ const localeValues: Locale = {
|
||||
filterTitle: '篩選器',
|
||||
filterConfirm: '確定',
|
||||
filterReset: '重置',
|
||||
filterEmptyText: '無篩選項',
|
||||
selectAll: '全部選取',
|
||||
selectInvert: '反向選取',
|
||||
selectionAll: '全選所有',
|
||||
|
@ -23,13 +23,13 @@ When need to mention someone or something.
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| autoFocus | Auto get focus when component mounted | boolean | `false` |
|
||||
| autoFocus | Auto get focus when component mounted | boolean | false |
|
||||
| defaultValue | Default value | string | |
|
||||
| filterOption | Customize filter option logic | false \| (input: string, option: OptionProps) => boolean | |
|
||||
| notFoundContent | Set mentions content when not match | ReactNode | 'Not Found' |
|
||||
| placement | Set popup placement | `top` \| `bottom` | `bottom` |
|
||||
| prefix | Set trigger prefix keyword | string \| string[] | '@' |
|
||||
| split | Set split string before and after selected mention | string | ' ' |
|
||||
| prefix | Set trigger prefix keyword | string \| string[] | `@` |
|
||||
| split | Set split string before and after selected mention | string | `` |
|
||||
| validateSearch | Customize trigger search logic | (text: string, props: MentionsProps) => void | |
|
||||
| value | Set value of mentions | string | |
|
||||
| onChange | Trigger when value changed | (text: string) => void | |
|
||||
@ -53,4 +53,4 @@ When need to mention someone or something.
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| children | suggestion content | ReactNode | |
|
||||
| value | value of suggestion, the value will insert into input filed while selected | string | '' |
|
||||
| value | value of suggestion, the value will insert into input filed while selected | string | |
|
||||
|
@ -24,13 +24,13 @@ cover: https://gw.alipayobjects.com/zos/alicdn/jPE-itMFM/Mentions.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| --- | --- | --- | --- |
|
||||
| autoFocus | 自动获得焦点 | boolean | `false` |
|
||||
| autoFocus | 自动获得焦点 | boolean | false |
|
||||
| defaultValue | 默认值 | string | |
|
||||
| filterOption | 自定义过滤逻辑 | false \| (input: string, option: OptionProps) => boolean | |
|
||||
| notFoundContent | 当下拉列表为空时显示的内容 | ReactNode | 'Not Found' |
|
||||
| placement | 弹出层展示位置 | `top` \| `bottom` | `bottom` |
|
||||
| prefix | 设置触发关键字 | string \| string[] | '@' |
|
||||
| split | 设置选中项前后分隔符 | string | ' ' |
|
||||
| prefix | 设置触发关键字 | string \| string[] | `@` |
|
||||
| split | 设置选中项前后分隔符 | string | `` |
|
||||
| validateSearch | 自定义触发验证逻辑 | (text: string, props: MentionsProps) => void | |
|
||||
| value | 设置值 | string | |
|
||||
| onChange | 值改变时触发 | (text: string) => void | |
|
||||
@ -54,4 +54,4 @@ cover: https://gw.alipayobjects.com/zos/alicdn/jPE-itMFM/Mentions.svg
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| -------- | -------------- | --------- | ------ |
|
||||
| children | 选项内容 | ReactNode | |
|
||||
| value | 选择时填充的值 | string | '' |
|
||||
| value | 选择时填充的值 | string | |
|
||||
|
@ -47,7 +47,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3XZcjGpvK/Menu.svg
|
||||
| onClick | 点击 MenuItem 调用此函数 | function({ item, key, keyPath, domEvent }) | - | |
|
||||
| onDeselect | 取消选中时调用,仅在 multiple 生效 | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
|
||||
| onOpenChange | SubMenu 展开/关闭的回调 | function(openKeys: string\[]) | noop | |
|
||||
| onSelect | 被选中时调用 | function({ item, key, keyPath, selectedKeys, domEvent }) | 无 | |
|
||||
| onSelect | 被选中时调用 | function({ item, key, keyPath, selectedKeys, domEvent }) | - | |
|
||||
| overflowedIndicator | 自定义 Menu 折叠时的图标 | ReactNode | - | |
|
||||
|
||||
> More options in [rc-menu](https://github.com/react-component/menu#api)
|
||||
|
@ -50,7 +50,7 @@
|
||||
.@{iconfont-css-prefix} {
|
||||
.@{menu-prefix-cls}-rtl & {
|
||||
margin-right: auto;
|
||||
margin-left: 10px;
|
||||
margin-left: @menu-icon-margin-right;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,4 +87,4 @@ message.config({
|
||||
| getContainer | Return the mount node for Message | () => HTMLElement | () => document.body |
|
||||
| maxCount | max message show, drop oldest if exceed limit | number | - |
|
||||
| top | distance from top | number | 24 |
|
||||
| rtl | whether to enable RTL mode | boolean | `false` |
|
||||
| rtl | whether to enable RTL mode | boolean | false |
|
||||
|
@ -88,4 +88,4 @@ message.config({
|
||||
| getContainer | 配置渲染节点的输出位置 | () => HTMLElement | () => document.body |
|
||||
| maxCount | 最大显示数, 超过限制时,最早的消息会被自动关闭 | number | - |
|
||||
| top | 消息距离顶部的位置 | number | 24 |
|
||||
| rtl | 是否开启 RTL 模式 | boolean | `false` |
|
||||
| rtl | 是否开启 RTL 模式 | boolean | false |
|
||||
|
@ -18,7 +18,7 @@ When requiring users to interact with the application, but without jumping to a
|
||||
| afterClose | Specify a function that will be called when modal is closed completely. | function | - |
|
||||
| bodyStyle | Body style for modal body element. Such as height, padding etc. | CSSProperties | {} |
|
||||
| cancelText | Text of the Cancel button | string\|ReactNode | `Cancel` |
|
||||
| centered | Centered Modal | Boolean | `false` |
|
||||
| centered | Centered Modal | boolean | false |
|
||||
| closable | Whether a close (x) button is visible on top right of the modal dialog or not | boolean | true |
|
||||
| closeIcon | custom close icon | ReactNode | `<CloseOutlined />` |
|
||||
| confirmLoading | Whether to apply loading visual effect for OK button or not | boolean | false |
|
||||
@ -26,7 +26,7 @@ When requiring users to interact with the application, but without jumping to a
|
||||
| footer | Footer content, set as `footer={null}` when you don't need default buttons | string\|ReactNode | OK and Cancel buttons |
|
||||
| forceRender | Force render Modal | boolean | false |
|
||||
| getContainer | Return the mount node for Modal | HTMLElement \| `() => HTMLElement` \| Selectors \| false | document.body |
|
||||
| mask | Whether show mask or not. | Boolean | true |
|
||||
| mask | Whether show mask or not. | boolean | true |
|
||||
| maskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | boolean | true |
|
||||
| maskStyle | Style for modal's mask element. | object | {} |
|
||||
| okText | Text of the OK button | string\|ReactNode | `OK` |
|
||||
@ -64,13 +64,13 @@ The items listed above are all functions, expecting a settings object as paramet
|
||||
| --- | --- | --- | --- | --- |
|
||||
| autoFocusButton | Specify which button to autofocus | null\| `ok` \| `cancel` | `ok` | |
|
||||
| cancelText | Text of the Cancel button with Modal.confirm | string | `Cancel` | |
|
||||
| centered | Centered Modal | Boolean | `false` | |
|
||||
| centered | Centered Modal | boolean | false | |
|
||||
| className | className of container | string | - | |
|
||||
| content | Content | string\|ReactNode | - | |
|
||||
| icon | custom icon | ReactNode | [<QuestionCircle /\>](/components/icon/) | 3.12.0 |
|
||||
| keyboard | Whether support press esc to close | Boolean | true | |
|
||||
| mask | Whether show mask or not. | Boolean | true | |
|
||||
| maskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | Boolean | `false` | |
|
||||
| keyboard | Whether support press esc to close | boolean | true | |
|
||||
| mask | Whether show mask or not. | boolean | true | |
|
||||
| maskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | boolean | false | |
|
||||
| okText | Text of the OK button | string | `OK` | |
|
||||
| okType | Button `type` of the OK button | string | `primary` | |
|
||||
| okButtonProps | The ok button props | [ButtonProps](/components/button/#API) | - | |
|
||||
|
@ -21,7 +21,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3StSdUlSH/Modal.svg
|
||||
| afterClose | Modal 完全关闭后的回调 | function | - |
|
||||
| bodyStyle | Modal body 样式 | object | {} |
|
||||
| cancelText | 取消按钮文字 | string\|ReactNode | 取消 |
|
||||
| centered | 垂直居中展示 Modal | Boolean | `false` |
|
||||
| centered | 垂直居中展示 Modal | boolean | false |
|
||||
| closable | 是否显示右上角的关闭按钮 | boolean | true |
|
||||
| closeIcon | 自定义关闭图标 | ReactNode | `<CloseOutlined />` |
|
||||
| confirmLoading | 确定按钮 loading | boolean | false |
|
||||
@ -30,11 +30,11 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3StSdUlSH/Modal.svg
|
||||
| forceRender | 强制渲染 Modal | boolean | false |
|
||||
| getContainer | 指定 Modal 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| `() => HTMLElement` \| Selectors \| false | document.body |
|
||||
| keyboard | 是否支持键盘 esc 关闭 | boolean | true |
|
||||
| mask | 是否展示遮罩 | Boolean | true |
|
||||
| mask | 是否展示遮罩 | boolean | true |
|
||||
| maskClosable | 点击蒙层是否允许关闭 | boolean | true |
|
||||
| maskStyle | 遮罩样式 | object | {} |
|
||||
| okText | 确认按钮文字 | string\|ReactNode | 确定 |
|
||||
| okType | 确认按钮类型 | string | primary |
|
||||
| okType | 确认按钮类型 | string | `primary` |
|
||||
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button/#API) | - |
|
||||
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button/#API) | - |
|
||||
| style | 可用于设置浮层的样式,调整浮层位置等 | CSSProperties | - |
|
||||
@ -68,13 +68,13 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3StSdUlSH/Modal.svg
|
||||
| --- | --- | --- | --- | --- |
|
||||
| autoFocusButton | 指定自动获得焦点的按钮 | null\| `ok` \| `cancel` | `ok` | |
|
||||
| cancelText | 设置 Modal.confirm 取消按钮文字 | string | 取消 | |
|
||||
| centered | 垂直居中展示 Modal | Boolean | `false` | |
|
||||
| centered | 垂直居中展示 Modal | boolean | false | |
|
||||
| className | 容器类名 | string | - | |
|
||||
| content | 内容 | string\|ReactNode | - | |
|
||||
| icon | 自定义图标 | ReactNode | [<QuestionCircle /\>](/components/icon/) | 3.12.0 |
|
||||
| maskClosable | 点击蒙层是否允许关闭 | Boolean | `false` | |
|
||||
| maskClosable | 点击蒙层是否允许关闭 | boolean | false | |
|
||||
| okText | 确认按钮文字 | string | 确定 | |
|
||||
| okType | 确认按钮类型 | string | primary | |
|
||||
| okType | 确认按钮类型 | string | `primary` | |
|
||||
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button/#API) | - | |
|
||||
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button/#API) | - | |
|
||||
| title | 标题 | string\|ReactNode | - | |
|
||||
|
@ -72,7 +72,7 @@ notification.config({
|
||||
| getContainer | Return the mount node for Notification | () => HTMLNode | () => document.body |
|
||||
| placement | Position of Notification, can be one of `topLeft` `topRight` `bottomLeft` `bottomRight` | string | `topRight` |
|
||||
| top | Distance from the top of the viewport, when `placement` is `topRight` or `topLeft` (unit: pixels). | number | 24 |
|
||||
| rtl | whether to enable RTL mode | boolean | `false` |
|
||||
| rtl | whether to enable RTL mode | boolean | false |
|
||||
|
||||
## FAQ
|
||||
|
||||
|
@ -44,7 +44,7 @@ config 参数如下:
|
||||
| message | 通知提醒标题,必选 | string\|ReactNode | - |
|
||||
| onClose | 当通知关闭时触发 | Function | - |
|
||||
| onClick | 点击通知时触发的回调函数 | Function | - |
|
||||
| placement | 弹出位置,可选 `topLeft` `topRight` `bottomLeft` `bottomRight` | string | topRight |
|
||||
| placement | 弹出位置,可选 `topLeft` `topRight` `bottomLeft` `bottomRight` | string | `topRight` |
|
||||
| style | 自定义内联样式 | [React.CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |
|
||||
| top | 消息从顶部弹出时,距离顶部的位置,单位像素。 | number | 24 |
|
||||
|
||||
@ -71,9 +71,9 @@ notification.config({
|
||||
| closeIcon | 自定义关闭图标 | ReactNode | - |
|
||||
| duration | 默认自动关闭延时,单位秒 | number | 4.5 |
|
||||
| getContainer | 配置渲染节点的输出位置 | () => HTMLNode | () => document.body |
|
||||
| placement | 弹出位置,可选 `topLeft` `topRight` `bottomLeft` `bottomRight` | string | topRight |
|
||||
| placement | 弹出位置,可选 `topLeft` `topRight` `bottomLeft` `bottomRight` | string | `topRight` |
|
||||
| top | 消息从顶部弹出时,距离顶部的位置,单位像素。 | number | 24 |
|
||||
| rtl | 是否开启 RTL 模式 | boolean | `false` |
|
||||
| rtl | 是否开启 RTL 模式 | boolean | false |
|
||||
|
||||
## FAQ
|
||||
|
||||
|
@ -20,7 +20,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/fjMCD9xRq/Popconfirm.svg
|
||||
| --- | --- | --- | --- |
|
||||
| cancelText | 取消按钮文字 | string | 取消 |
|
||||
| okText | 确认按钮文字 | string | 确定 |
|
||||
| okType | 确认按钮类型 | string | primary |
|
||||
| okType | 确认按钮类型 | string | `primary` |
|
||||
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button/#API) | - |
|
||||
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button/#API) | - |
|
||||
| title | 确认框的描述 | string\|ReactNode\|() => ReactNode | - |
|
||||
|
@ -18,8 +18,8 @@ cover: https://gw.alipayobjects.com/zos/alicdn/1PNL1p_cO/Popover.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| ------- | -------- | ---------------------------------- | ------ | ---- |
|
||||
| content | 卡片内容 | string\|ReactNode\|() => ReactNode | 无 | |
|
||||
| title | 卡片标题 | string\|ReactNode\|() => ReactNode | 无 | |
|
||||
| content | 卡片内容 | string\|ReactNode\|() => ReactNode | - | |
|
||||
| title | 卡片标题 | string\|ReactNode\|() => ReactNode | - | |
|
||||
|
||||
更多属性请参考 [Tooltip](/components/tooltip/#API)。
|
||||
|
||||
|
@ -31,15 +31,15 @@ cover: https://gw.alipayobjects.com/zos/alicdn/8cYb5seNB/Radio.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| defaultValue | 默认选中的值 | any | | |
|
||||
| disabled | 禁选所有子单选器 | boolean | false | |
|
||||
| name | RadioGroup 下所有 `input[type="radio"]` 的 `name` 属性 | string | | |
|
||||
| options | 以配置形式设置子元素 | string\[] \| Array<{ label: string value: string disabled?: boolean }> | | |
|
||||
| size | 大小,只对按钮样式生效 | `large` \| `middle` \| `small` | 无 | |
|
||||
| value | 用于设置当前选中的值 | any | | |
|
||||
| onChange | 选项变化时的回调函数 | Function(e:Event) | | |
|
||||
| defaultValue | 默认选中的值 | any | | |
|
||||
| disabled | 禁选所有子单选器 | boolean | false | | |
|
||||
| name | RadioGroup 下所有 `input[type="radio"]` 的 `name` 属性 | string | | |
|
||||
| options | 以配置形式设置子元素 | string\[] \| Array<{ label: string value: string disabled?: boolean }> | | |
|
||||
| size | 大小,只对按钮样式生效 | `large` \| `middle` \| `small` | - | |
|
||||
| value | 用于设置当前选中的值 | any | | |
|
||||
| onChange | 选项变化时的回调函数 | Function(e:Event) | | |
|
||||
| optionType | 用于设置 Radio `options` 类型 | `default` \| `button` | `default` | 4.4.0 |
|
||||
| buttonStyle | RadioButton 的风格样式,目前有描边和填色两种风格 | `outline` \| `solid` | `outline` | |
|
||||
| buttonStyle | RadioButton 的风格样式,目前有描边和填色两种风格 | `outline` \| `solid` | `outline` | |
|
||||
|
||||
## 方法
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
.@{radio-prefix-cls}-wrapper {
|
||||
&&-rtl {
|
||||
margin-right: 0;
|
||||
margin-left: 8px;
|
||||
margin-left: @radio-wrapper-margin-right;
|
||||
direction: rtl;
|
||||
}
|
||||
}
|
||||
|
@ -45,8 +45,8 @@ Select component to select value from options.
|
||||
| mode | Set mode of Select | `multiple` \| `tags` | - | |
|
||||
| notFoundContent | Specify content to show when no result matches.. | ReactNode | 'Not Found' | |
|
||||
| options | Select options. Will get better perf than jsx definition | { label, value }[] | - | |
|
||||
| optionFilterProp | Which prop value of option will be used for filter if filterOption is true | string | value | |
|
||||
| optionLabelProp | Which prop value of option will render as content of select. [Example](https://codesandbox.io/s/antd-reproduction-template-tk678) | string | 'children' | |
|
||||
| optionFilterProp | Which prop value of option will be used for filter if filterOption is true | string | `value` | |
|
||||
| optionLabelProp | Which prop value of option will render as content of select. [Example](https://codesandbox.io/s/antd-reproduction-template-tk678) | string | `children` | |
|
||||
| placeholder | Placeholder of select | string\|ReactNode | - | |
|
||||
| showArrow | Whether to show the drop-down arrow | boolean | true | |
|
||||
| showSearch | Whether show search input in single mode. | boolean | false | |
|
||||
|
@ -46,12 +46,12 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_0XzgOis7/Select.svg
|
||||
| mode | 设置 Select 的模式为多选或标签 | `multiple` \| `tags` | - | |
|
||||
| notFoundContent | 当下拉列表为空时显示的内容 | ReactNode | 'Not Found' | |
|
||||
| options | 数据化配置选项内容,相比 jsx 定义会获得更好的渲染性能 | { label, value }[] | - | |
|
||||
| optionFilterProp | 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索。[示例](https://codesandbox.io/s/antd-reproduction-template-tk678) | string | value | |
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | 'children' | |
|
||||
| optionFilterProp | 搜索时过滤对应的 option 属性,如设置为 children 表示对内嵌内容进行搜索。[示例](https://codesandbox.io/s/antd-reproduction-template-tk678) | string | `value` | |
|
||||
| optionLabelProp | 回填到选择框的 Option 的属性值,默认是 Option 的子元素。比如在子元素需要高亮效果时,此值可以设为 `value`。 | string | `children` | |
|
||||
| placeholder | 选择框默认文字 | string | - | |
|
||||
| showArrow | 是否显示下拉小箭头 | boolean | true | |
|
||||
| showSearch | 使单选模式可搜索 | boolean | false | |
|
||||
| size | 选择框大小 | `large` \| `middle` \| `small` | 无 | |
|
||||
| size | 选择框大小 | `large` \| `middle` \| `small` | - | |
|
||||
| suffixIcon | 自定义的选择框后缀图标 | ReactNode | - | |
|
||||
| removeIcon | 自定义的多选框清除图标 | ReactNode | - | |
|
||||
| clearIcon | 自定义的多选框清空图标 | ReactNode | - | |
|
||||
@ -98,7 +98,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/_0XzgOis7/Select.svg
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| ----- | ---- | --------------------- | ------ | ---- |
|
||||
| key | | string | - | |
|
||||
| label | 组名 | string\|React.Element | 无 | |
|
||||
| label | 组名 | string\|React.Element | - | |
|
||||
|
||||
## FAQ
|
||||
|
||||
|
@ -20,7 +20,7 @@ Display statistic number.
|
||||
| ---------------- | ----------------------------- | -------------------- | ------- | ------- |
|
||||
| decimalSeparator | decimal separator | string | . | |
|
||||
| formatter | customize value display logic | (value) => ReactNode | - | |
|
||||
| groupSeparator | group separator | string | , | |
|
||||
| groupSeparator | group separator | string | `,` | |
|
||||
| precision | precision of input value | number | - | |
|
||||
| prefix | prefix node of value | string \| ReactNode | - | |
|
||||
| suffix | suffix node of value | string \| ReactNode | - | |
|
||||
@ -32,7 +32,7 @@ Display statistic number.
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| format | Format as [moment](http://momentjs.com/) | string | 'HH:mm:ss' | |
|
||||
| format | Format as [moment](http://momentjs.com/) | string | `HH:mm:ss` | |
|
||||
| onFinish | Trigger when time's up | () => void | - | |
|
||||
| prefix | prefix node of value | string \| ReactNode | - | |
|
||||
| suffix | suffix node of value | string \| ReactNode | - | |
|
||||
|
@ -21,7 +21,7 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/rcBNhLBrKbE/Statistic.svg
|
||||
| ---------------- | ---------------- | -------------------- | ------ | ---- |
|
||||
| decimalSeparator | 设置小数点 | string | . | |
|
||||
| formatter | 自定义数值展示 | (value) => ReactNode | - | |
|
||||
| groupSeparator | 设置千分位标识符 | string | , | |
|
||||
| groupSeparator | 设置千分位标识符 | string | `,` | |
|
||||
| precision | 数值精度 | number | - | |
|
||||
| prefix | 设置数值的前缀 | string \| ReactNode | - | |
|
||||
| suffix | 设置数值的后缀 | string \| ReactNode | - | |
|
||||
@ -33,7 +33,7 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/rcBNhLBrKbE/Statistic.svg
|
||||
|
||||
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| format | 格式化倒计时展示,参考 [moment](http://momentjs.com/) | string | 'HH:mm:ss' | |
|
||||
| format | 格式化倒计时展示,参考 [moment](http://momentjs.com/) | string | `HH:mm:ss` | |
|
||||
| onFinish | 倒计时完成时触发 | () => void | - | |
|
||||
| prefix | 设置数值的前缀 | string \| ReactNode | - | |
|
||||
| suffix | 设置数值的后缀 | string \| ReactNode | - | |
|
||||
|
@ -48,7 +48,7 @@ cover: https://gw.alipayobjects.com/zos/antfincdn/UZYqMizXHaj/Steps.svg
|
||||
| --- | --- | --- | --- | --- |
|
||||
| description | 步骤的详情描述,可选 | string\|ReactNode | - | |
|
||||
| icon | 步骤图标的类型,可选 | ReactNode | - | |
|
||||
| status | 指定状态。当不配置该属性时,会使用 Steps 的 `current` 来自动指定状态。可选:`wait` `process` `finish` `error` | string | wait | |
|
||||
| status | 指定状态。当不配置该属性时,会使用 Steps 的 `current` 来自动指定状态。可选:`wait` `process` `finish` `error` | string | `wait` | |
|
||||
| title | 标题 | string\|ReactNode | - | |
|
||||
| subTitle | 子标题 | string\|ReactNode | - | |
|
||||
| disabled | 禁用点击 | boolean | false | |
|
||||
|
@ -9,10 +9,10 @@
|
||||
.colorPaletteMixin() {
|
||||
@functions: ~`(function() {
|
||||
var hueStep = 2;
|
||||
var saturationStep = 16;
|
||||
var saturationStep2 = 5;
|
||||
var brightnessStep1 = 5;
|
||||
var brightnessStep2 = 15;
|
||||
var saturationStep = 0.16;
|
||||
var saturationStep2 = 0.05;
|
||||
var brightnessStep1 = 0.05;
|
||||
var brightnessStep2 = 0.15;
|
||||
var lightColorCount = 5;
|
||||
var darkColorCount = 4;
|
||||
|
||||
@ -33,28 +33,34 @@
|
||||
var getSaturation = function(hsv, i, isLight) {
|
||||
var saturation;
|
||||
if (isLight) {
|
||||
saturation = Math.round(hsv.s * 100) - saturationStep * i;
|
||||
saturation = hsv.s - saturationStep * i;
|
||||
} else if (i === darkColorCount) {
|
||||
saturation = Math.round(hsv.s * 100) + saturationStep;
|
||||
saturation = hsv.s + saturationStep;
|
||||
} else {
|
||||
saturation = Math.round(hsv.s * 100) + saturationStep2 * i;
|
||||
saturation = hsv.s + saturationStep2 * i;
|
||||
}
|
||||
if (saturation > 100) {
|
||||
saturation = 100;
|
||||
if (saturation > 1) {
|
||||
saturation = 1;
|
||||
}
|
||||
if (isLight && i === lightColorCount && saturation > 10) {
|
||||
saturation = 10;
|
||||
if (isLight && i === lightColorCount && saturation > 0.1) {
|
||||
saturation = 0.1;
|
||||
}
|
||||
if (saturation < 6) {
|
||||
saturation = 6;
|
||||
if (saturation < 0.06) {
|
||||
saturation = 0.06;
|
||||
}
|
||||
return Math.round(saturation);
|
||||
return Number(saturation.toFixed(2));
|
||||
};
|
||||
var getValue = function(hsv, i, isLight) {
|
||||
var value;
|
||||
if (isLight) {
|
||||
return Math.round(hsv.v * 100) + brightnessStep1 * i;
|
||||
value = hsv.v + brightnessStep1 * i;
|
||||
}else{
|
||||
value = hsv.v - brightnessStep2 * i
|
||||
}
|
||||
return Math.round(hsv.v * 100) - brightnessStep2 * i;
|
||||
if (value > 1) {
|
||||
value = 1;
|
||||
}
|
||||
return Number(value.toFixed(2))
|
||||
};
|
||||
|
||||
this.colorPalette = function(color, index) {
|
||||
|
@ -281,7 +281,9 @@
|
||||
|
||||
// Anchor
|
||||
// ---
|
||||
@anchor-link-padding: 4px 0 4px 16px;
|
||||
@anchor-link-top: 4px;
|
||||
@anchor-link-left: 16px;
|
||||
@anchor-link-padding: @anchor-link-top 0 @anchor-link-top @anchor-link-left;
|
||||
|
||||
// Tabs
|
||||
// ---
|
||||
|
@ -449,7 +449,9 @@
|
||||
// ---
|
||||
@anchor-bg: @component-background;
|
||||
@anchor-border-color: @border-color-split;
|
||||
@anchor-link-padding: 7px 0 7px 16px;
|
||||
@anchor-link-top: 7px;
|
||||
@anchor-link-left: 16px;
|
||||
@anchor-link-padding: @anchor-link-top 0 @anchor-link-top @anchor-link-left;
|
||||
|
||||
// Tooltip
|
||||
// ---
|
||||
|
@ -22,7 +22,7 @@ Switching Selector.
|
||||
| defaultChecked | to set the initial state | boolean | false |
|
||||
| disabled | Disable switch | boolean | false |
|
||||
| loading | loading state of switch | boolean | false |
|
||||
| size | the size of the `Switch`, options: `default` `small` | string | default |
|
||||
| size | the size of the `Switch`, options: `default` `small` | string | `default` |
|
||||
| unCheckedChildren | content to be shown when the state is unchecked | string\|ReactNode | |
|
||||
| onChange | trigger when the checked state is changing | Function(checked: boolean, event: Event) | |
|
||||
| onClick | trigger when clicked | Function(checked: boolean, event: Event) | |
|
||||
|
@ -23,7 +23,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/zNdJQMhfm/Switch.svg
|
||||
| defaultChecked | 初始是否选中 | boolean | false |
|
||||
| disabled | 是否禁用 | boolean | false |
|
||||
| loading | 加载中的开关 | boolean | false |
|
||||
| size | 开关大小,可选值:`default` `small` | string | default |
|
||||
| size | 开关大小,可选值:`default` `small` | string | `default` |
|
||||
| unCheckedChildren | 非选中时的内容 | string\|ReactNode | |
|
||||
| onChange | 变化时回调函数 | Function(checked: boolean, event: Event) | |
|
||||
| onClick | 点击时回调函数 | Function(checked: boolean, event: Event) | |
|
||||
|
@ -81,6 +81,19 @@ describe('Table.filter', () => {
|
||||
expect(dropdownWrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('renders empty menu correctly', () => {
|
||||
const wrapper = mount(createTable({
|
||||
columns: [
|
||||
{
|
||||
...column,
|
||||
filters: [],
|
||||
},
|
||||
],
|
||||
}));
|
||||
wrapper.find('span.ant-dropdown-trigger').simulate('click', nativeEvent);
|
||||
expect(wrapper.find('Empty').length).toBe(1);
|
||||
});
|
||||
|
||||
it('renders radio filter correctly', () => {
|
||||
const wrapper = mount(
|
||||
createTable({
|
||||
|
@ -1748,7 +1748,7 @@ exports[`renders ./components/table/demo/drag-sorting-handler.md correctly 1`] =
|
||||
`;
|
||||
|
||||
exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
<div>
|
||||
Array [
|
||||
<form
|
||||
class="ant-form ant-form-inline components-table-demo-control-bar"
|
||||
style="margin-bottom:16px"
|
||||
@ -2600,7 +2600,7 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</form>,
|
||||
<div
|
||||
class="ant-table-wrapper"
|
||||
>
|
||||
@ -2775,101 +2775,63 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
class="ant-table-cell ant-table-column-has-sorters"
|
||||
>
|
||||
<div
|
||||
class="ant-table-filter-column"
|
||||
class="ant-table-column-sorters-with-tooltip"
|
||||
>
|
||||
<span
|
||||
class="ant-table-filter-column-title"
|
||||
>
|
||||
<div
|
||||
class="ant-table-column-sorters-with-tooltip"
|
||||
>
|
||||
<div
|
||||
class="ant-table-column-sorters"
|
||||
>
|
||||
<span>
|
||||
Action
|
||||
</span>
|
||||
<span
|
||||
class="ant-table-column-sorter ant-table-column-sorter-full"
|
||||
>
|
||||
<span
|
||||
class="ant-table-column-sorter-inner"
|
||||
>
|
||||
<span
|
||||
aria-label="caret-up"
|
||||
class="anticon anticon-caret-up ant-table-column-sorter-up"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
data-icon="caret-up"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="0 0 1024 1024"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<span
|
||||
aria-label="caret-down"
|
||||
class="anticon anticon-caret-down ant-table-column-sorter-down"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
data-icon="caret-down"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="0 0 1024 1024"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
<span
|
||||
class="ant-table-filter-trigger-container"
|
||||
<div
|
||||
class="ant-table-column-sorters"
|
||||
>
|
||||
<span>
|
||||
Action
|
||||
</span>
|
||||
<span
|
||||
class="ant-table-filter-trigger ant-dropdown-trigger"
|
||||
role="button"
|
||||
tabindex="-1"
|
||||
class="ant-table-column-sorter ant-table-column-sorter-full"
|
||||
>
|
||||
<span
|
||||
aria-label="filter"
|
||||
class="anticon anticon-filter"
|
||||
role="img"
|
||||
class="ant-table-column-sorter-inner"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
data-icon="filter"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
<span
|
||||
aria-label="caret-up"
|
||||
class="anticon anticon-caret-up ant-table-column-sorter-up"
|
||||
role="img"
|
||||
>
|
||||
<path
|
||||
d="M349 838c0 17.7 14.2 32 31.8 32h262.4c17.6 0 31.8-14.3 31.8-32V642H349v196zm531.1-684H143.9c-24.5 0-39.8 26.7-27.5 48l221.3 376h348.8l221.3-376c12.1-21.3-3.2-48-27.7-48z"
|
||||
/>
|
||||
</svg>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
data-icon="caret-up"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="0 0 1024 1024"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M858.9 689L530.5 308.2c-9.4-10.9-27.5-10.9-37 0L165.1 689c-12.2 14.2-1.2 35 18.5 35h656.8c19.7 0 30.7-20.8 18.5-35z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
<span
|
||||
aria-label="caret-down"
|
||||
class="anticon anticon-caret-down ant-table-column-sorter-down"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
data-icon="caret-down"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="0 0 1024 1024"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M840.4 300H183.6c-19.7 0-30.7 20.8-18.5 35l328.4 380.8c9.4 10.9 27.5 10.9 37 0L858.9 335c12.2-14.2 1.2-35-18.5-35z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
@ -3805,8 +3767,8 @@ exports[`renders ./components/table/demo/dynamic-settings.md correctly 1`] = `
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`renders ./components/table/demo/edit-cell.md correctly 1`] = `
|
||||
@ -10541,6 +10503,414 @@ exports[`renders ./components/table/demo/multiple-sorter.md correctly 1`] = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`renders ./components/table/demo/nest-table-border-debug.md correctly 1`] = `
|
||||
Array [
|
||||
<form
|
||||
class="ant-form ant-form-inline components-table-demo-control-bar"
|
||||
style="margin-bottom:16px"
|
||||
>
|
||||
<div
|
||||
class="ant-row ant-form-item"
|
||||
>
|
||||
<div
|
||||
class="ant-col ant-form-item-label"
|
||||
>
|
||||
<label
|
||||
class=""
|
||||
title="Root Table Bordered"
|
||||
>
|
||||
Root Table Bordered
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="ant-col ant-form-item-control"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control-input"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control-input-content"
|
||||
>
|
||||
<button
|
||||
aria-checked="true"
|
||||
class="ant-switch ant-switch-checked"
|
||||
role="switch"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="ant-switch-handle"
|
||||
/>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-row ant-form-item"
|
||||
>
|
||||
<div
|
||||
class="ant-col ant-form-item-label"
|
||||
>
|
||||
<label
|
||||
class=""
|
||||
title="Child Table Bordered"
|
||||
>
|
||||
Child Table Bordered
|
||||
</label>
|
||||
</div>
|
||||
<div
|
||||
class="ant-col ant-form-item-control"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control-input"
|
||||
>
|
||||
<div
|
||||
class="ant-form-item-control-input-content"
|
||||
>
|
||||
<button
|
||||
aria-checked="true"
|
||||
class="ant-switch ant-switch-checked"
|
||||
role="switch"
|
||||
type="button"
|
||||
>
|
||||
<div
|
||||
class="ant-switch-handle"
|
||||
/>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>,
|
||||
<div
|
||||
class="ant-table-wrapper components-table-demo-nested"
|
||||
>
|
||||
<div
|
||||
class="ant-spin-nested-loading"
|
||||
>
|
||||
<div
|
||||
class="ant-spin-container"
|
||||
>
|
||||
<div
|
||||
class="ant-table ant-table-bordered"
|
||||
>
|
||||
<div
|
||||
class="ant-table-title"
|
||||
>
|
||||
cool
|
||||
</div>
|
||||
<div
|
||||
class="ant-table-container"
|
||||
>
|
||||
<div
|
||||
class="ant-table-content"
|
||||
>
|
||||
<table
|
||||
style="table-layout:auto"
|
||||
>
|
||||
<colgroup>
|
||||
<col
|
||||
class="ant-table-expand-icon-col"
|
||||
/>
|
||||
</colgroup>
|
||||
<thead
|
||||
class="ant-table-thead"
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class="ant-table-cell ant-table-row-expand-icon-cell"
|
||||
/>
|
||||
<th
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Name
|
||||
</th>
|
||||
<th
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Platform
|
||||
</th>
|
||||
<th
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Version
|
||||
</th>
|
||||
<th
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Upgraded
|
||||
</th>
|
||||
<th
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Creator
|
||||
</th>
|
||||
<th
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Date
|
||||
</th>
|
||||
<th
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Action
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody
|
||||
class="ant-table-tbody"
|
||||
>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
data-row-key="0"
|
||||
>
|
||||
<td
|
||||
class="ant-table-cell ant-table-row-expand-icon-cell"
|
||||
>
|
||||
<button
|
||||
aria-label="Expand row"
|
||||
class="ant-table-row-expand-icon ant-table-row-expand-icon-collapsed"
|
||||
type="button"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Screem
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
iOS
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
10.3.4.5654
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
500
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Jack
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
2014-12-24 23:12:00
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a>
|
||||
Publish
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
data-row-key="1"
|
||||
>
|
||||
<td
|
||||
class="ant-table-cell ant-table-row-expand-icon-cell"
|
||||
>
|
||||
<button
|
||||
aria-label="Expand row"
|
||||
class="ant-table-row-expand-icon ant-table-row-expand-icon-collapsed"
|
||||
type="button"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Screem
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
iOS
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
10.3.4.5654
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
500
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Jack
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
2014-12-24 23:12:00
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a>
|
||||
Publish
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr
|
||||
class="ant-table-row ant-table-row-level-0"
|
||||
data-row-key="2"
|
||||
>
|
||||
<td
|
||||
class="ant-table-cell ant-table-row-expand-icon-cell"
|
||||
>
|
||||
<button
|
||||
aria-label="Expand row"
|
||||
class="ant-table-row-expand-icon ant-table-row-expand-icon-collapsed"
|
||||
type="button"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Screem
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
iOS
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
10.3.4.5654
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
500
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
Jack
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
2014-12-24 23:12:00
|
||||
</td>
|
||||
<td
|
||||
class="ant-table-cell"
|
||||
>
|
||||
<a>
|
||||
Publish
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="ant-table-footer"
|
||||
>
|
||||
cool
|
||||
</div>
|
||||
</div>
|
||||
<ul
|
||||
class="ant-pagination ant-table-pagination ant-table-pagination-right"
|
||||
unselectable="unselectable"
|
||||
>
|
||||
<li
|
||||
aria-disabled="true"
|
||||
class="ant-pagination-prev ant-pagination-disabled"
|
||||
title="Previous Page"
|
||||
>
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
disabled=""
|
||||
>
|
||||
<span
|
||||
aria-label="left"
|
||||
class="anticon anticon-left"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
data-icon="left"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M724 218.3V141c0-6.7-7.7-10.4-12.9-6.3L260.3 486.8a31.86 31.86 0 000 50.3l450.8 352.1c5.3 4.1 12.9.4 12.9-6.3v-77.3c0-4.9-2.3-9.6-6.1-12.6l-360-281 360-281.1c3.8-3 6.1-7.7 6.1-12.6z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
class="ant-pagination-item ant-pagination-item-1 ant-pagination-item-active"
|
||||
tabindex="0"
|
||||
title="1"
|
||||
>
|
||||
<a>
|
||||
1
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
aria-disabled="true"
|
||||
class="ant-pagination-next ant-pagination-disabled"
|
||||
title="Next Page"
|
||||
>
|
||||
<a
|
||||
class="ant-pagination-item-link"
|
||||
disabled=""
|
||||
>
|
||||
<span
|
||||
aria-label="right"
|
||||
class="anticon anticon-right"
|
||||
role="img"
|
||||
>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
class=""
|
||||
data-icon="right"
|
||||
fill="currentColor"
|
||||
focusable="false"
|
||||
height="1em"
|
||||
viewBox="64 64 896 896"
|
||||
width="1em"
|
||||
>
|
||||
<path
|
||||
d="M765.7 486.8L314.9 134.7A7.97 7.97 0 00302 141v77.3c0 4.9 2.3 9.6 6.1 12.6l360 281.1-360 281.1c-3.9 3-6.1 7.7-6.1 12.6V883c0 6.7 7.7 10.4 12.9 6.3l450.8-352.1a31.96 31.96 0 000-50.4z"
|
||||
/>
|
||||
</svg>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>,
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`renders ./components/table/demo/nested-table.md correctly 1`] = `
|
||||
<div
|
||||
class="ant-table-wrapper components-table-demo-nested"
|
||||
|
@ -46,8 +46,6 @@ const columns = [
|
||||
title: 'Action',
|
||||
key: 'action',
|
||||
sorter: true,
|
||||
filters: [],
|
||||
onFilter: () => {},
|
||||
render: () => (
|
||||
<span>
|
||||
<a style={{ marginRight: 16 }}>Delete</a>
|
||||
@ -160,7 +158,7 @@ class Demo extends React.Component {
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<>
|
||||
<Form
|
||||
layout="inline"
|
||||
className="components-table-demo-control-bar"
|
||||
@ -250,7 +248,7 @@ class Demo extends React.Component {
|
||||
dataSource={state.hasData ? data : null}
|
||||
scroll={scroll}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ title:
|
||||
|
||||
对某一列数据进行排序,通过指定列的 `sorter` 函数即可启动排序按钮。`sorter: function(rowA, rowB) { ... }`, rowA、rowB 为比较的两个行数据。
|
||||
|
||||
`sortDirections: ['ascend' | 'descend']`改变每列可用的排序方式,切换排序时按数组内容依次切换,设置在 table props 上时对所有列生效。
|
||||
`sortDirections: ['ascend' | 'descend']`改变每列可用的排序方式,切换排序时按数组内容依次切换,设置在 table props 上时对所有列生效。你可以通过设置 `['ascend', 'descend', 'ascend']` 禁止排序恢复到默认状态。
|
||||
|
||||
使用 `defaultSortOrder` 属性,设置列的默认排序顺序。
|
||||
|
||||
@ -23,7 +23,7 @@ Uses `defaultFilteredValue` to make a column filtered by default.
|
||||
|
||||
Use `sorter` to make a column sortable. `sorter` can be a function of the type `function(a, b) { ... }` for sorting data locally.
|
||||
|
||||
`sortDirections: ['ascend' | 'descend']` defines available sort methods for each columns, effective for all columns when set on table props.
|
||||
`sortDirections: ['ascend' | 'descend']` defines available sort methods for each columns, effective for all columns when set on table props. You can set as `['ascend', 'descend', 'ascend']` to prevent sorter back to default status.
|
||||
|
||||
Uses `defaultSortOrder` to make a column sorted by default.
|
||||
|
||||
|
129
components/table/demo/nest-table-border-debug.md
Normal file
129
components/table/demo/nest-table-border-debug.md
Normal file
@ -0,0 +1,129 @@
|
||||
---
|
||||
order: 98
|
||||
title:
|
||||
en-US: Nested Bordered Table Debug
|
||||
zh-CN: 嵌套带边框的表格 Debug
|
||||
debug: true
|
||||
---
|
||||
|
||||
## zh-CN
|
||||
|
||||
看看边框的样式是不是影响到别的表格。
|
||||
|
||||
## en-US
|
||||
|
||||
To see if bordered style applied to other tables.
|
||||
|
||||
```jsx
|
||||
import { Table, Badge, Menu, Dropdown, Switch, Form } from 'antd';
|
||||
import { DownOutlined } from '@ant-design/icons';
|
||||
|
||||
const menu = (
|
||||
<Menu>
|
||||
<Menu.Item>Action 1</Menu.Item>
|
||||
<Menu.Item>Action 2</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
function NestedTable() {
|
||||
const createExpandedRowRender = bordered => {
|
||||
return () => {
|
||||
const columns = [
|
||||
{ title: 'Date', dataIndex: 'date', key: 'date' },
|
||||
{ title: 'Name', dataIndex: 'name', key: 'name' },
|
||||
{
|
||||
title: 'Status',
|
||||
key: 'state',
|
||||
render: () => (
|
||||
<span>
|
||||
<Badge status="success" />
|
||||
Finished
|
||||
</span>
|
||||
),
|
||||
},
|
||||
{ title: 'Upgrade Status', dataIndex: 'upgradeNum', key: 'upgradeNum' },
|
||||
{
|
||||
title: 'Action',
|
||||
dataIndex: 'operation',
|
||||
key: 'operation',
|
||||
render: () => (
|
||||
<span className="table-operation">
|
||||
<a>Pause</a>
|
||||
<a>Stop</a>
|
||||
<Dropdown overlay={menu}>
|
||||
<a>
|
||||
More <DownOutlined />
|
||||
</a>
|
||||
</Dropdown>
|
||||
</span>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
const data = [];
|
||||
for (let i = 0; i < 3; ++i) {
|
||||
data.push({
|
||||
key: i,
|
||||
date: '2014-12-24 23:12:00',
|
||||
name: 'This is production name',
|
||||
upgradeNum: 'Upgraded: 56',
|
||||
});
|
||||
}
|
||||
return <Table columns={columns} dataSource={data} pagination={false} bordered={bordered} />;
|
||||
};
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{ title: 'Name', dataIndex: 'name', key: 'name' },
|
||||
{ title: 'Platform', dataIndex: 'platform', key: 'platform' },
|
||||
{ title: 'Version', dataIndex: 'version', key: 'version' },
|
||||
{ title: 'Upgraded', dataIndex: 'upgradeNum', key: 'upgradeNum' },
|
||||
{ title: 'Creator', dataIndex: 'creator', key: 'creator' },
|
||||
{ title: 'Date', dataIndex: 'createdAt', key: 'createdAt' },
|
||||
{ title: 'Action', key: 'operation', render: () => <a>Publish</a> },
|
||||
];
|
||||
|
||||
const data = [];
|
||||
for (let i = 0; i < 3; ++i) {
|
||||
data.push({
|
||||
key: i,
|
||||
name: 'Screem',
|
||||
platform: 'iOS',
|
||||
version: '10.3.4.5654',
|
||||
upgradeNum: 500,
|
||||
creator: 'Jack',
|
||||
createdAt: '2014-12-24 23:12:00',
|
||||
});
|
||||
}
|
||||
|
||||
const [rootTableBordered, setRootTableBordered] = React.useState(true);
|
||||
const [childTableBordered, setChildTableBordered] = React.useState(true);
|
||||
return (
|
||||
<>
|
||||
<Form
|
||||
layout="inline"
|
||||
className="components-table-demo-control-bar"
|
||||
style={{ marginBottom: 16 }}
|
||||
>
|
||||
<Form.Item label="Root Table Bordered">
|
||||
<Switch checked={rootTableBordered} onChange={v => setRootTableBordered(v)} />
|
||||
</Form.Item>
|
||||
<Form.Item label="Child Table Bordered">
|
||||
<Switch checked={childTableBordered} onChange={v => setChildTableBordered(v)} />
|
||||
</Form.Item>
|
||||
</Form>
|
||||
<Table
|
||||
title={() => 'cool'}
|
||||
footer={() => 'cool'}
|
||||
className="components-table-demo-nested"
|
||||
columns={columns}
|
||||
expandable={{ expandedRowRender: createExpandedRowRender(childTableBordered) }}
|
||||
dataSource={data}
|
||||
bordered={rootTableBordered}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
ReactDOM.render(<NestedTable />, mountNode);
|
||||
```
|
@ -124,13 +124,7 @@ const columns = [
|
||||
{ title: 'F', dataIndex: 'key', width: 100 },
|
||||
];
|
||||
|
||||
const data = [];
|
||||
|
||||
for (let i = 0; i < 100000; i += 1) {
|
||||
data.push({
|
||||
key: i,
|
||||
});
|
||||
}
|
||||
const data = Array.from({ length: 100000 }, (_, key) => ({ key }));
|
||||
|
||||
ReactDOM.render(
|
||||
<VirtualTable columns={columns} dataSource={data} scroll={{ y: 300, x: '100vw' }} />,
|
||||
|
@ -7,6 +7,7 @@ import Menu from '../../../menu';
|
||||
import Checkbox from '../../../checkbox';
|
||||
import Radio from '../../../radio';
|
||||
import Dropdown from '../../../dropdown';
|
||||
import Empty from '../../../empty';
|
||||
import { ColumnType, ColumnFilterItem, Key, TableLocale, GetPopupContainer } from '../../interface';
|
||||
import FilterDropdownMenuWrapper from './FilterWrapper';
|
||||
import { FilterState } from '.';
|
||||
@ -19,12 +20,33 @@ function hasSubMenu(filters: ColumnFilterItem[]) {
|
||||
return filters.some(({ children }) => children);
|
||||
}
|
||||
|
||||
function renderFilterItems(
|
||||
filters: ColumnFilterItem[],
|
||||
prefixCls: string,
|
||||
filteredKeys: Key[],
|
||||
multiple: boolean,
|
||||
) {
|
||||
function renderFilterItems({
|
||||
filters,
|
||||
prefixCls,
|
||||
filteredKeys,
|
||||
filterMultiple,
|
||||
locale,
|
||||
}: {
|
||||
filters: ColumnFilterItem[];
|
||||
prefixCls: string;
|
||||
filteredKeys: Key[];
|
||||
filterMultiple: boolean;
|
||||
locale: TableLocale;
|
||||
}) {
|
||||
if (filters.length === 0) {
|
||||
return (
|
||||
<Empty
|
||||
image={Empty.PRESENTED_IMAGE_SIMPLE}
|
||||
description={locale.filterEmptyText}
|
||||
style={{
|
||||
margin: '16px 0',
|
||||
}}
|
||||
imageStyle={{
|
||||
height: 24,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return filters.map((filter, index) => {
|
||||
const key = String(filter.value);
|
||||
|
||||
@ -35,12 +57,18 @@ function renderFilterItems(
|
||||
title={filter.text}
|
||||
popupClassName={`${prefixCls}-dropdown-submenu`}
|
||||
>
|
||||
{renderFilterItems(filter.children, prefixCls, filteredKeys, multiple)}
|
||||
{renderFilterItems({
|
||||
filters: filter.children,
|
||||
prefixCls,
|
||||
filteredKeys,
|
||||
filterMultiple,
|
||||
locale,
|
||||
})}
|
||||
</SubMenu>
|
||||
);
|
||||
}
|
||||
|
||||
const Component = multiple ? Checkbox : Radio;
|
||||
const Component = filterMultiple ? Checkbox : Radio;
|
||||
|
||||
return (
|
||||
<MenuItem key={filter.value !== undefined ? key : index}>
|
||||
@ -202,12 +230,13 @@ function FilterDropdown<RecordType>(props: FilterDropdownProps<RecordType>) {
|
||||
openKeys={openKeys}
|
||||
onOpenChange={onOpenChange}
|
||||
>
|
||||
{renderFilterItems(
|
||||
column.filters || [],
|
||||
{renderFilterItems({
|
||||
filters: column.filters || [],
|
||||
prefixCls,
|
||||
getFilteredKeysSync(),
|
||||
filteredKeys: getFilteredKeysSync(),
|
||||
filterMultiple,
|
||||
)}
|
||||
locale,
|
||||
})}
|
||||
</Menu>
|
||||
<div className={`${prefixCls}-dropdown-btns`}>
|
||||
<Button type="link" size="small" disabled={selectedKeys.length === 0} onClick={onReset}>
|
||||
|
@ -61,20 +61,20 @@ const columns = [
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| tableLayout | [table-layout](https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout) attribute of table element | - \| `auto` \| `fixed` | -<hr />`fixed` when header/columns are fixed, or using `column.ellipsis` |
|
||||
| bordered | Whether to show all table borders | boolean | `false` |
|
||||
| bordered | Whether to show all table borders | boolean | false |
|
||||
| columns | Columns of table | [ColumnsType](#Column)\[] | - |
|
||||
| components | Override default table elements | [TableComponents](https://git.io/fANxz) | - |
|
||||
| dataSource | Data record array to be displayed | object\[] | - |
|
||||
| expandable | Config expandable content | [expandable](#expandable) | - |
|
||||
| footer | Table footer renderer | Function(currentPageData) | - |
|
||||
| loading | Loading status of table | boolean\|[object](/components/spin/#API) ([more](https://github.com/ant-design/ant-design/issues/4544#issuecomment-271533135)) | `false` |
|
||||
| loading | Loading status of table | boolean\|[object](/components/spin/#API) ([more](https://github.com/ant-design/ant-design/issues/4544#issuecomment-271533135)) | false |
|
||||
| locale | i18n text including filter, sort, empty text, etc | object | filterConfirm: 'Ok' <br> filterReset: 'Reset' <br> emptyText: 'No Data' <br> [Default](https://github.com/ant-design/ant-design/issues/575#issuecomment-159169511) |
|
||||
| pagination | Config of pagination. You can ref table pagination [config](#pagination) or full [`pagination`](/components/pagination/) document, hide it by setting it to `false` | object | - |
|
||||
| rowClassName | Row's className | Function(record, index):string | - |
|
||||
| rowKey | Row's unique key, could be a string or function that returns a string | string\|Function(record):string | `key` |
|
||||
| rowSelection | Row selection [config](#rowSelection) | object | null |
|
||||
| scroll | Whether the table can be scrollable, [config](#scroll) | object | - |
|
||||
| showHeader | Whether to show table header | boolean | `true` |
|
||||
| showHeader | Whether to show table header | boolean | true |
|
||||
| size | Size of table | `default` \| `middle` \| `small` | `default` |
|
||||
| summary | Summary content | (currentData) => ReactNode | - |
|
||||
| title | Table title renderer | Function(currentPageData) | - |
|
||||
@ -83,7 +83,7 @@ const columns = [
|
||||
| onRow | Set props on per row | Function(record, index) | - |
|
||||
| getPopupContainer | the render container of dropdowns in table | (triggerNode) => HTMLElement | `() => TableHtmlElement` |
|
||||
| sortDirections | supported sort way, could be `'ascend'`, `'descend'` | Array | `['ascend', 'descend']` |
|
||||
| showSorterTooltip | header show next sorter direction tooltip | boolean | `true` |
|
||||
| showSorterTooltip | header show next sorter direction tooltip | boolean | true |
|
||||
|
||||
#### onRow usage
|
||||
|
||||
@ -123,12 +123,12 @@ One of the Table `columns` prop for describing the table's columns, Column has t
|
||||
| defaultSortOrder | Default order of sorted values | `ascend` \| `descend` | - | |
|
||||
| filterDropdown | Customized filter overlay | ReactNode \| (props: [FilterDropdownProps](https://git.io/fjP5h)) => ReactNode | - | |
|
||||
| filterDropdownVisible | Whether `filterDropdown` is visible | boolean | - | |
|
||||
| filtered | Whether the `dataSource` is filtered | boolean | `false` | |
|
||||
| filtered | Whether the `dataSource` is filtered | boolean | false | |
|
||||
| filteredValue | Controlled filtered value, filter icon will highlight | string\[] | - | |
|
||||
| filterIcon | Customized filter icon | ReactNode\|(filtered: boolean) => ReactNode | `false` | |
|
||||
| filterMultiple | Whether multiple filters can be selected | boolean | `true` | |
|
||||
| filterIcon | Customized filter icon | ReactNode\|(filtered: boolean) => ReactNode | false | |
|
||||
| filterMultiple | Whether multiple filters can be selected | boolean | true | |
|
||||
| filters | Filter menu config | object\[] | - | |
|
||||
| fixed | (IE not support) Set column to be fixed: `true`(same as left) `'left'` `'right'` | boolean\|string | `false` | |
|
||||
| fixed | (IE not support) Set column to be fixed: `true`(same as left) `'left'` `'right'` | boolean\|string | false | |
|
||||
| key | Unique key of this column, you can ignore this prop if you've set a unique `dataIndex` | string | - | |
|
||||
| render | Renderer of the table cell. The return value should be a ReactNode, or an object for [colSpan/rowSpan config](#components-table-demo-colspan-rowspan) | Function(text, record, index) {} | - | |
|
||||
| responsive | The list of breakpoints at which to display this column. Always visible if not set. | [Breakpoint](https://github.com/ant-design/ant-design/blob/015109b42b85c63146371b4e32b883cf97b088e8/components/_util/responsiveObserve.ts#L1)\[] | - | 4.2.0 |
|
||||
@ -142,7 +142,7 @@ One of the Table `columns` prop for describing the table's columns, Column has t
|
||||
| onFilter | Callback executed when the confirm filter button is clicked | Function | - | |
|
||||
| onFilterDropdownVisibleChange | Callback executed when `filterDropdownVisible` is changed | function(visible) {} | - | |
|
||||
| onHeaderCell | Set props on per header cell | Function(column) | - | |
|
||||
| showSorterTooltip | header show next sorter direction tooltip, override `showSorterTooltip` in table | boolean | `true` | |
|
||||
| showSorterTooltip | header show next sorter direction tooltip, override `showSorterTooltip` in table | boolean | true | |
|
||||
|
||||
### ColumnGroup
|
||||
|
||||
@ -167,13 +167,13 @@ Properties for expandable.
|
||||
| Property | Description | Type | Default |
|
||||
| --- | --- | --- | --- |
|
||||
| childrenColumnName | The column contains children to display | string\[] | children |
|
||||
| defaultExpandAllRows | Expand all rows initially | boolean | `false` |
|
||||
| defaultExpandAllRows | Expand all rows initially | boolean | false |
|
||||
| defaultExpandedRowKeys | Initial expanded row keys | string\[] | - |
|
||||
| expandIcon | Customize row expand Icon. Ref [example](https://codesandbox.io/s/fervent-bird-nuzpr) | Function(props):ReactNode | - |
|
||||
| expandIconColumnIndex | Customize expand icon column index | number | - |
|
||||
| expandedRowKeys | Current expanded row keys | string\[] | - |
|
||||
| expandedRowRender | Expanded container render for each row | Function(record, index, indent, expanded):ReactNode | - |
|
||||
| expandRowByClick | Whether to expand row by clicking anywhere in the whole row | boolean | `false` |
|
||||
| expandRowByClick | Whether to expand row by clicking anywhere in the whole row | boolean | false |
|
||||
| indentSize | Indent size in pixels of tree data | number | 15 |
|
||||
| rowExpandable | Enable row can be expandable | (record) => boolean | - |
|
||||
| onExpand | Callback executed when the row expand icon is clicked | Function(expanded, record) | - |
|
||||
@ -185,11 +185,11 @@ Properties for row selection.
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| columnWidth | Set the width of the selection column | string\|number | `60px` | |
|
||||
| columnTitle | Set the title of the selection column | string\|ReactNode | - | |
|
||||
| fixed | Fixed selection column on the left | boolean | - | |
|
||||
| getCheckboxProps | Get Checkbox or Radio props | Function(record) | - | |
|
||||
| hideSelectAll | Hide the selectAll checkbox and custom selection | boolean | `false` | 4.3 |
|
||||
| columnWidth | Set the width of the selection column | string\|number | `60px` | 4.0 |
|
||||
| columnTitle | Set the title of the selection column | string\|React.ReactNode | - | 4.0 |
|
||||
| fixed | Fixed selection column on the left | boolean | - | 4.0 |
|
||||
| getCheckboxProps | Get Checkbox or Radio props | Function(record) | - | 4.0 |
|
||||
| hideSelectAll | Hide the selectAll checkbox and custom selection | boolean | false | 4.3 |
|
||||
| preserveSelectedRowKeys | Keep selection `key` even when it removed from `dataSource` | boolean | - | 4.4 |
|
||||
| renderCell | Renderer of the table cell. Same as `render` in column | Function(checked, record, index, originNode) {} | - | 4.1 |
|
||||
| selectedRowKeys | Controlled selected row keys | string\[]\|number[] | \[] | |
|
||||
|
@ -76,7 +76,7 @@ const columns = [
|
||||
| locale | 默认文案设置,目前包括排序、过滤、空数据文案 | object | filterConfirm: '确定' <br> filterReset: '重置' <br> emptyText: '暂无数据' <br> [默认值](https://github.com/ant-design/ant-design/issues/575#issuecomment-159169511) |
|
||||
| pagination | 分页器,参考[配置项](#pagination)或 [pagination](/components/pagination/) 文档,设为 false 时不展示和进行分页 | object | - |
|
||||
| rowClassName | 表格行的类名 | Function(record, index):string | - |
|
||||
| rowKey | 表格行 key 的取值,可以是字符串或一个函数 | string\|Function(record):string | 'key' |
|
||||
| rowKey | 表格行 key 的取值,可以是字符串或一个函数 | string\|Function(record):string | `key` |
|
||||
| rowSelection | 表格行是否可选择,[配置项](#rowSelection) | object | - |
|
||||
| scroll | 表格是否可滚动,也可以指定滚动区域的宽、高,[配置项](#scroll) | object | - |
|
||||
| showHeader | 是否显示表头 | boolean | true |
|
||||
@ -88,7 +88,7 @@ const columns = [
|
||||
| onRow | 设置行属性 | Function(record, index) | - |
|
||||
| getPopupContainer | 设置表格内各类浮层的渲染节点,如筛选菜单 | (triggerNode) => HTMLElement | `() => TableHtmlElement` |
|
||||
| sortDirections | 支持的排序方式,取值为 `'ascend'` `'descend'` | Array | `['ascend', 'descend']` |
|
||||
| showSorterTooltip | 表头是否显示下一次排序的 tooltip 提示 | boolean | `true` |
|
||||
| showSorterTooltip | 表头是否显示下一次排序的 tooltip 提示 | boolean | true |
|
||||
|
||||
#### onRow 用法
|
||||
|
||||
@ -147,7 +147,7 @@ const columns = [
|
||||
| onFilter | 本地模式下,确定筛选的运行函数 | Function | - | |
|
||||
| onFilterDropdownVisibleChange | 自定义筛选菜单可见变化时调用 | function(visible) {} | - | |
|
||||
| onHeaderCell | 设置头部单元格属性 | Function(column) | - | |
|
||||
| showSorterTooltip | 表头显示下一次排序的 tooltip 提示, 覆盖 table 中`showSorterTooltip` | boolean | `true` | |
|
||||
| showSorterTooltip | 表头显示下一次排序的 tooltip 提示, 覆盖 table 中`showSorterTooltip` | boolean | true | |
|
||||
|
||||
### ColumnGroup
|
||||
|
||||
@ -178,7 +178,7 @@ const columns = [
|
||||
| expandIconColumnIndex | 自定义展开按钮的列顺序 | number | - |
|
||||
| expandedRowKeys | 展开的行,控制属性 | string\[] | - |
|
||||
| expandedRowRender | 额外的展开行 | Function(record, index, indent, expanded):ReactNode | - |
|
||||
| expandRowByClick | 通过点击行来展开子行 | boolean | `false` |
|
||||
| expandRowByClick | 通过点击行来展开子行 | boolean | false |
|
||||
| indentSize | 展示树形数据时,每层缩进的宽度,以 px 为单位 | number | 15 |
|
||||
| rowExpandable | 设置是否允许行展开 | (record) => boolean | - |
|
||||
| onExpand | 点击展开图标时触发 | Function(expanded, record) | - |
|
||||
|
@ -25,6 +25,7 @@ export interface TableLocale {
|
||||
filterTitle?: string;
|
||||
filterConfirm?: React.ReactNode;
|
||||
filterReset?: React.ReactNode;
|
||||
filterEmptyText?: React.ReactNode;
|
||||
emptyText?: React.ReactNode | (() => React.ReactNode);
|
||||
selectAll?: React.ReactNode;
|
||||
selectInvert?: React.ReactNode;
|
||||
|
@ -5,79 +5,114 @@
|
||||
|
||||
.@{table-prefix-cls}.@{table-prefix-cls}-bordered {
|
||||
// ============================ Title =============================
|
||||
.@{table-prefix-cls}-title {
|
||||
> .@{table-prefix-cls}-title {
|
||||
border: @table-border;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
// ============================= Cell =============================
|
||||
thead > tr > th,
|
||||
tbody > tr > td,
|
||||
tfoot > tr > th,
|
||||
tfoot > tr > td {
|
||||
border-right: @table-border;
|
||||
}
|
||||
> .@{table-prefix-cls}-container {
|
||||
// ============================ Content ============================
|
||||
border: @table-border;
|
||||
border-right: 0;
|
||||
border-bottom: 0;
|
||||
|
||||
// Fixed right should provides additional border
|
||||
.@{table-prefix-cls}-cell-fix-right-first::after {
|
||||
border-right: @table-border;
|
||||
}
|
||||
> .@{table-prefix-cls}-content,
|
||||
> .@{table-prefix-cls}-header,
|
||||
> .@{table-prefix-cls}-body {
|
||||
> table {
|
||||
// ============================= Cell =============================
|
||||
> thead > tr > th,
|
||||
> tbody > tr > td,
|
||||
> tfoot > tr > th,
|
||||
> tfoot > tr > td {
|
||||
border-right: @table-border;
|
||||
}
|
||||
// ============================ Header ============================
|
||||
> thead {
|
||||
> tr:not(:last-child) > th {
|
||||
border-bottom: @border-width-base @border-style-base @border-color-split;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================ Header ============================
|
||||
table > {
|
||||
thead {
|
||||
> tr:not(:last-child) > th {
|
||||
border-bottom: @border-width-base @border-style-base @border-color-split;
|
||||
// Fixed right should provides additional border
|
||||
> thead > tr,
|
||||
> tbody > tr,
|
||||
> tfoot > tr {
|
||||
> .@{table-prefix-cls}-cell-fix-right-first::after {
|
||||
border-right: @table-border;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ========================== Expandable ==========================
|
||||
> table > tbody > tr > td {
|
||||
> .@{table-prefix-cls}-expanded-row-fixed {
|
||||
margin: -@table-padding-vertical (-@table-padding-horizontal - @border-width-base);
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: @border-width-base;
|
||||
bottom: 0;
|
||||
border-right: @table-border;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =========================== Content ============================
|
||||
.@{table-prefix-cls}-container {
|
||||
border: @table-border;
|
||||
border-right: 0;
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
// ========================== Expandable ==========================
|
||||
.@{table-prefix-cls}-expanded-row-fixed {
|
||||
margin: -@table-padding-vertical (-@table-padding-horizontal - @border-width-base);
|
||||
|
||||
&::after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: @border-width-base;
|
||||
bottom: 0;
|
||||
border-right: @table-border;
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
|
||||
&.@{table-prefix-cls}-scroll-horizontal {
|
||||
tr.@{table-prefix-cls}-expanded-row,
|
||||
tr.@{table-prefix-cls}-placeholder {
|
||||
> td {
|
||||
border-right: 0;
|
||||
> .@{table-prefix-cls}-container > .@{table-prefix-cls}-body {
|
||||
> table > tbody {
|
||||
> tr.@{table-prefix-cls}-expanded-row,
|
||||
> tr.@{table-prefix-cls}-placeholder {
|
||||
> td {
|
||||
border-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Size related
|
||||
&.@{table-prefix-cls}-middle {
|
||||
.@{table-prefix-cls}-expanded-row-fixed {
|
||||
margin: -@table-padding-vertical-md (-@table-padding-horizontal-md - @border-width-base);
|
||||
> .@{table-prefix-cls}-container {
|
||||
> .@{table-prefix-cls}-content,
|
||||
> .@{table-prefix-cls}-body {
|
||||
> table > tbody > tr > td {
|
||||
> .@{table-prefix-cls}-expanded-row-fixed {
|
||||
margin: -@table-padding-vertical-md (-@table-padding-horizontal-md - @border-width-base);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&.@{table-prefix-cls}-small {
|
||||
.@{table-prefix-cls}-expanded-row-fixed {
|
||||
margin: -@table-padding-vertical-sm (-@table-padding-horizontal-sm - @border-width-base);
|
||||
> .@{table-prefix-cls}-container {
|
||||
> .@{table-prefix-cls}-content,
|
||||
> .@{table-prefix-cls}-body {
|
||||
> table > tbody > tr > td {
|
||||
> .@{table-prefix-cls}-expanded-row-fixed {
|
||||
margin: -@table-padding-vertical-sm (-@table-padding-horizontal-sm - @border-width-base);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================ Footer ============================
|
||||
.@{table-prefix-cls}-footer {
|
||||
> .@{table-prefix-cls}-footer {
|
||||
border: @table-border;
|
||||
border-top: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.@{table-prefix-cls}-cell {
|
||||
// ============================ Nested ============================
|
||||
.@{table-prefix-cls}-container:first-child {
|
||||
// :first-child to avoid the case when bordered and title is set
|
||||
border-top: 0;
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@
|
||||
&-extra {
|
||||
.@{table-wrapepr-rtl-cls} & {
|
||||
right: auto;
|
||||
left: -10px;
|
||||
left: @table-selection-extra-right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ Ant Design has 3 types of Tabs for different situations.
|
||||
| --- | --- | --- | --- | --- |
|
||||
| addIcon | Customize add icon | ReactNode | - | 4.4.0 |
|
||||
| activeKey | Current TabPane's key | string | - | |
|
||||
| animated | Whether to change tabs with animation. Only works while `tabPosition="top"\|"bottom"` | boolean \| {inkBar:boolean, tabPane:boolean} | `true`, `false` when `type="card"` | |
|
||||
| animated | Whether to change tabs with animation. Only works while `tabPosition="top"\|"bottom"` | boolean \| {inkBar:boolean, tabPane:boolean} | true, false when `type="card"` | |
|
||||
| renderTabBar | replace the TabBar | (props: DefaultTabBarProps, DefaultTabBar: React.ComponentClass) => React.ReactElement | - | |
|
||||
| defaultActiveKey | Initial active TabPane's key, if `activeKey` is not set. | string | - | |
|
||||
| hideAdd | Hide plus icon or not. Only works while `type="editable-card"` | boolean | `false` | |
|
||||
| hideAdd | Hide plus icon or not. Only works while `type="editable-card"` | boolean | false | |
|
||||
| size | preset tab bar size | `large` \| `default` \| `small` | `default` | |
|
||||
| centered | Centers tabs | boolean | false | 4.4.0 |
|
||||
| tabBarExtraContent | Extra content in tab bar | React.ReactNode | - | |
|
||||
|
@ -31,13 +31,13 @@ Ant Design 依次提供了三级选项卡,分别用于不同的场景。
|
||||
| renderTabBar | 替换 TabBar,用于二次封装标签头 | (props: DefaultTabBarProps, DefaultTabBar: React.ComponentClass) => React.ReactElement | - | |
|
||||
| defaultActiveKey | 初始化选中面板的 key,如果没有设置 activeKey | string | 第一个面板 | |
|
||||
| hideAdd | 是否隐藏加号图标,在 `type="editable-card"` 时有效 | boolean | false | |
|
||||
| size | 大小,提供 `large` `default` 和 `small` 三种大小 | string | 'default' | |
|
||||
| size | 大小,提供 `large` `default` 和 `small` 三种大小 | string | `default` | |
|
||||
| centered | 标签居中展示 | boolean | false | 4.4.0 |
|
||||
| tabBarExtraContent | tab bar 上额外的元素 | React.ReactNode | - | |
|
||||
| tabBarGutter | tabs 之间的间隙 | number | - | |
|
||||
| tabBarStyle | tab bar 的样式对象 | object | - | |
|
||||
| tabPosition | 页签位置,可选值有 `top` `right` `bottom` `left` | string | 'top' | |
|
||||
| type | 页签的基本样式,可选 `line`、`card` `editable-card` 类型 | string | 'line' | |
|
||||
| tabPosition | 页签位置,可选值有 `top` `right` `bottom` `left` | string | `top` | |
|
||||
| type | 页签的基本样式,可选 `line`、`card` `editable-card` 类型 | string | `line` | |
|
||||
| onChange | 切换面板的回调 | Function(activeKey) {} | - | |
|
||||
| onEdit | 新增和删除页签的回调,在 `type="editable-card"` 时有效 | (targetKey, action): void | - | |
|
||||
| onTabClick | tab 被点击的回调 | Function(key: string, event: MouseEvent) | - | |
|
||||
@ -49,6 +49,6 @@ Ant Design 依次提供了三级选项卡,分别用于不同的场景。
|
||||
| 参数 | 说明 | 类型 | 默认值 |
|
||||
| ----------- | ----------------------------------------------- | ----------------- | ------ |
|
||||
| forceRender | 被隐藏时是否渲染 DOM 结构 | boolean | false |
|
||||
| key | 对应 activeKey | string | 无 |
|
||||
| tab | 选项卡头显示文字 | string\|ReactNode | 无 |
|
||||
| closeIcon | 自定义关闭图标,`在 type="editable-card"`时有效 | ReactNode | 无 |
|
||||
| key | 对应 activeKey | string | - |
|
||||
| tab | 选项卡头显示文字 | string\|ReactNode | - |
|
||||
| closeIcon | 自定义关闭图标,`在 type="editable-card"`时有效 | ReactNode | - |
|
||||
|
@ -191,6 +191,8 @@
|
||||
&-content {
|
||||
&-holder {
|
||||
flex: auto;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
display: flex;
|
||||
|
@ -19,16 +19,16 @@ Tag for categorizing or markup.
|
||||
|
||||
| Property | Description | Type | Default | Version |
|
||||
| --------- | ------------------------------------ | ----------- | ------- | ------- |
|
||||
| closable | Whether the Tag can be closed | boolean | `false` | |
|
||||
| closable | Whether the Tag can be closed | boolean | false | |
|
||||
| color | Color of the Tag | string | - | |
|
||||
| closeIcon | custom close icon | ReactNode | - | 4.4.0 |
|
||||
| onClose | Callback executed when tag is closed | (e) => void | - | |
|
||||
| visible | Whether the Tag is closed or not | boolean | `true` | |
|
||||
| visible | Whether the Tag is closed or not | boolean | true | |
|
||||
| icon | Set the icon of tag | ReactNode | - | |
|
||||
|
||||
### Tag.CheckableTag
|
||||
|
||||
| Property | Description | Type | Default |
|
||||
| -------- | ----------------------------------------------- | ----------------- | ------- |
|
||||
| checked | Checked status of Tag | boolean | `false` |
|
||||
| checked | Checked status of Tag | boolean | false |
|
||||
| onChange | Callback executed when Tag is checked/unchecked | (checked) => void | - |
|
||||
|
@ -23,7 +23,7 @@ cover: https://gw.alipayobjects.com/zos/alicdn/cH1BOLfxC/Tag.svg
|
||||
| color | 标签色 | string | - | |
|
||||
| closeIcon | 自定义关闭按钮 | ReactNode | - | 4.4.0 |
|
||||
| onClose | 关闭时的回调 | (e) => void | - | |
|
||||
| visible | 是否显示标签 | boolean | `true` | |
|
||||
| visible | 是否显示标签 | boolean | true | |
|
||||
| icon | 设置图标 | ReactNode | - | |
|
||||
|
||||
### Tag.CheckableTag
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user