mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-12 20:43:11 +08:00
demo: update demo (#44864)
* demo: update demo * fix: fix snap * update demo
This commit is contained in:
parent
553754b4d2
commit
56fb6178a4
@ -1,43 +1,33 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DatePicker, Space } from 'antd';
|
import { DatePicker, Space, theme } from 'antd';
|
||||||
|
import type { Dayjs } from 'dayjs';
|
||||||
|
import type { CellRenderInfo } from 'rc-picker/es/interface';
|
||||||
|
|
||||||
const { RangePicker } = DatePicker;
|
const App: React.FC = () => {
|
||||||
|
const { token } = theme.useToken();
|
||||||
const App: React.FC = () => (
|
const style: React.CSSProperties = {
|
||||||
<Space direction="vertical" size={12}>
|
border: `1px solid ${token.colorPrimary}`,
|
||||||
<DatePicker
|
borderRadius: '50%',
|
||||||
cellRender={(current, info) => {
|
};
|
||||||
if (info.type !== 'date') return info.originNode;
|
const cellRender = React.useCallback((current: number | Dayjs, info: CellRenderInfo<Dayjs>) => {
|
||||||
if (typeof current === 'number') {
|
if (info.type !== 'date') {
|
||||||
return <div className="ant-picker-cell-inner">{current}</div>;
|
return info.originNode;
|
||||||
}
|
}
|
||||||
return (
|
if (typeof current === 'number') {
|
||||||
<div
|
return <div className="ant-picker-cell-inner">{current}</div>;
|
||||||
className="ant-picker-cell-inner"
|
}
|
||||||
style={current.date() === 1 ? { border: '1px solid #1677ff', borderRadius: '50%' } : {}}
|
return (
|
||||||
>
|
<div className="ant-picker-cell-inner" style={current.date() === 1 ? style : {}}>
|
||||||
{current.date()}
|
{current.date()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}}
|
}, []);
|
||||||
/>
|
return (
|
||||||
<RangePicker
|
<Space size={12} direction="vertical">
|
||||||
cellRender={(current, info) => {
|
<DatePicker cellRender={cellRender} />
|
||||||
if (info.type !== 'date') return info.originNode;
|
<DatePicker.RangePicker cellRender={cellRender} />
|
||||||
if (typeof current === 'number') {
|
</Space>
|
||||||
return <div className="ant-picker-cell-inner">{current}</div>;
|
);
|
||||||
}
|
};
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="ant-picker-cell-inner"
|
|
||||||
style={current.date() === 1 ? { border: '1px solid #1677ff', borderRadius: '50%' } : {}}
|
|
||||||
>
|
|
||||||
{current.date()}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Space>
|
|
||||||
);
|
|
||||||
|
|
||||||
export default App;
|
export default App;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import type { Dayjs } from 'dayjs';
|
import type { Dayjs } from 'dayjs';
|
||||||
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
|
import dayjsGenerateConfig from 'rc-picker/lib/generate/dayjs';
|
||||||
|
|
||||||
import genPurePanel from '../_util/PurePanel';
|
import genPurePanel from '../_util/PurePanel';
|
||||||
import type {
|
import type {
|
||||||
RangePickerProps as BaseRangePickerProps,
|
RangePickerProps as BaseRangePickerProps,
|
||||||
|
@ -56,7 +56,6 @@ dayjs.extend(customParseFormat)
|
|||||||
| changeOnBlur | Trigger `change` when blur. e.g. datetime picker no need click confirm button | boolean | false | 5.5.0 |
|
| changeOnBlur | Trigger `change` when blur. e.g. datetime picker no need click confirm button | boolean | false | 5.5.0 |
|
||||||
| className | The className of picker | string | - | |
|
| className | The className of picker | string | - | |
|
||||||
| clearIcon | The custom clear icon | ReactNode | - | |
|
| clearIcon | The custom clear icon | ReactNode | - | |
|
||||||
| clearText | The clear tooltip of icon | string | clear | |
|
|
||||||
| defaultValue | To set default time | [dayjs](http://day.js.org/) | - | |
|
| defaultValue | To set default time | [dayjs](http://day.js.org/) | - | |
|
||||||
| disabled | Determine whether the TimePicker is disabled | boolean | false | |
|
| disabled | Determine whether the TimePicker is disabled | boolean | false | |
|
||||||
| disabledTime | To specify the time that cannot be selected | [DisabledTime](#disabledtime) | - | 4.19.0 |
|
| disabledTime | To specify the time that cannot be selected | [DisabledTime](#disabledtime) | - | 4.19.0 |
|
||||||
|
@ -56,7 +56,6 @@ dayjs.extend(customParseFormat)
|
|||||||
| changeOnBlur | 失去焦点时触发 `change` 事件,例如 datetime 下不再需要点击确认按钮 | boolean | false | 5.5.0 |
|
| changeOnBlur | 失去焦点时触发 `change` 事件,例如 datetime 下不再需要点击确认按钮 | boolean | false | 5.5.0 |
|
||||||
| className | 选择器类名 | string | - | |
|
| className | 选择器类名 | string | - | |
|
||||||
| clearIcon | 自定义的清除图标 | ReactNode | - | |
|
| clearIcon | 自定义的清除图标 | ReactNode | - | |
|
||||||
| clearText | 清除按钮的提示文案 | string | clear | |
|
|
||||||
| defaultValue | 默认时间 | [dayjs](http://day.js.org/) | - | |
|
| defaultValue | 默认时间 | [dayjs](http://day.js.org/) | - | |
|
||||||
| disabled | 禁用全部操作 | boolean | false | |
|
| disabled | 禁用全部操作 | boolean | false | |
|
||||||
| disabledTime | 不可选择的时间 | [DisabledTime](#disabledtime) | - | 4.19.0 |
|
| disabledTime | 不可选择的时间 | [DisabledTime](#disabledtime) | - | 4.19.0 |
|
||||||
|
Loading…
Reference in New Issue
Block a user