mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 07:56:28 +08:00
update calendar
This commit is contained in:
parent
053cd4b158
commit
1dadd262b9
@ -18,6 +18,7 @@ class Header extends Component {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
|
style={{ width: 75 }}
|
||||||
size={ fullscreen ? null : 'small' }
|
size={ fullscreen ? null : 'small' }
|
||||||
dropdownMatchSelectWidth={false}
|
dropdownMatchSelectWidth={false}
|
||||||
className={`${prefixCls}-year-select`}
|
className={`${prefixCls}-year-select`}
|
||||||
@ -39,6 +40,7 @@ class Header extends Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
|
style={{ width: 70 }}
|
||||||
size={ fullscreen ? null : 'small' }
|
size={ fullscreen ? null : 'small' }
|
||||||
dropdownMatchSelectWidth={false}
|
dropdownMatchSelectWidth={false}
|
||||||
className={`${prefixCls}-month-select`}
|
className={`${prefixCls}-month-select`}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
- order: 0
|
- order: 0
|
||||||
|
|
||||||
最简单的用法。
|
一个通用的日历面板,支持年/月切换。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -10,40 +10,43 @@
|
|||||||
import { Calendar } from 'antd';
|
import { Calendar } from 'antd';
|
||||||
|
|
||||||
function getDateData(value) {
|
function getDateData(value) {
|
||||||
|
|
||||||
let listData;
|
let listData;
|
||||||
switch (value.getDayOfMonth()) {
|
switch (value.getDayOfMonth()) {
|
||||||
case 8:
|
case 8:
|
||||||
listData = [
|
listData = [
|
||||||
{ type: 'warn', content: '这里是警告事项.' },
|
{ type: 'warn', content: '这里是警告事项.' },
|
||||||
{ type: 'normal', content: '这里是普通事项.' }
|
{ type: 'normal', content: '这里是普通事项.' }
|
||||||
]; break;
|
];
|
||||||
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
listData = [
|
listData = [
|
||||||
{ type: 'warn', content: '这里是警告事项.' },
|
{ type: 'warn', content: '这里是警告事项.' },
|
||||||
{ type: 'normal', content: '这里是普通事项.' },
|
{ type: 'normal', content: '这里是普通事项.' },
|
||||||
{ type: 'error', content: '这里是错误事项.' }
|
{ type: 'error', content: '这里是错误事项.' }
|
||||||
]; break;
|
];
|
||||||
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
listData = [
|
listData = [
|
||||||
{ type: 'warn', content: '这里是警告事项.' },
|
{ type: 'warn', content: '这里是警告事项.' },
|
||||||
{ type: 'normal', content: '这里是普通事项.' },
|
{ type: 'normal', content: '这里是普通事项好长啊。。....' },
|
||||||
|
{ type: 'error', content: '这里是错误事项.' },
|
||||||
|
{ type: 'error', content: '这里是错误事项.' },
|
||||||
{ type: 'error', content: '这里是错误事项.' },
|
{ type: 'error', content: '这里是错误事项.' },
|
||||||
{ type: 'error', content: '这里是错误事项.' }
|
{ type: 'error', content: '这里是错误事项.' }
|
||||||
]; break;
|
];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return listData;
|
return listData;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMonthData(value) {
|
||||||
|
if (value.getMonth() === 8) {
|
||||||
|
return 1394;
|
||||||
}
|
}
|
||||||
function onChange(value) {
|
return 0;
|
||||||
console.log('change');
|
|
||||||
}
|
|
||||||
function onTypeChange(type) {
|
|
||||||
console.log('Type change: %s.', type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<div style={{ width: 290, border: '1px solid #d9d9d9', borderRadius: 4 }}><Calendar getDateData={getDateData} onChange={onChange} onTypeChange={onTypeChange} type="date" /></div>
|
<Calendar type="date" getDateData={getDateData} getMonthData={getMonthData} />
|
||||||
, document.getElementById('components-calendar-demo-basic'));
|
, document.getElementById('components-calendar-demo-basic'));
|
||||||
````
|
````
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# 全屏
|
# 卡片模式
|
||||||
|
|
||||||
- order: 3
|
- order: 0
|
||||||
|
|
||||||
变大
|
用于嵌套在空间有限的容器中。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -16,34 +16,38 @@ function getDateData(value) {
|
|||||||
listData = [
|
listData = [
|
||||||
{ type: 'warn', content: '这里是警告事项.' },
|
{ type: 'warn', content: '这里是警告事项.' },
|
||||||
{ type: 'normal', content: '这里是普通事项.' }
|
{ type: 'normal', content: '这里是普通事项.' }
|
||||||
]; break;
|
];
|
||||||
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
listData = [
|
listData = [
|
||||||
{ type: 'warn', content: '这里是警告事项.' },
|
{ type: 'warn', content: '这里是警告事项.' },
|
||||||
{ type: 'normal', content: '这里是普通事项.' },
|
{ type: 'normal', content: '这里是普通事项.' },
|
||||||
{ type: 'error', content: '这里是错误事项.' }
|
{ type: 'error', content: '这里是错误事项.' }
|
||||||
]; break;
|
];
|
||||||
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
listData = [
|
listData = [
|
||||||
{ type: 'warn', content: '这里是警告事项.' },
|
{ type: 'warn', content: '这里是警告事项.' },
|
||||||
{ type: 'normal', content: '这里是普通事项好长啊。。....' },
|
{ type: 'normal', content: '这里是普通事项.' },
|
||||||
{ type: 'error', content: '这里是错误事项.' },
|
|
||||||
{ type: 'error', content: '这里是错误事项.' },
|
|
||||||
{ type: 'error', content: '这里是错误事项.' },
|
{ type: 'error', content: '这里是错误事项.' },
|
||||||
{ type: 'error', content: '这里是错误事项.' }
|
{ type: 'error', content: '这里是错误事项.' }
|
||||||
]; break;
|
];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return listData;
|
return listData;
|
||||||
}
|
}
|
||||||
function getMonthData(value) {
|
|
||||||
if (value.getMonth() === 8) {
|
function onChange(value) {
|
||||||
return 1394;
|
console.log('change');
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
function onTypeChange(type) {
|
||||||
|
console.log('Type change: %s.', type);
|
||||||
}
|
}
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Calendar fullscreen={true} type={'date'} getDateData={getDateData} getMonthData={getMonthData} />
|
<div style={{ width: 290, border: '1px solid #d9d9d9', borderRadius: 4 }}>
|
||||||
, document.getElementById('components-calendar-demo-fullscreen'));
|
<Calendar fullscreen={false} type="date" getDateData={getDateData} onChange={onChange} onTypeChange={onTypeChange} />
|
||||||
|
</div>
|
||||||
|
, document.getElementById('components-calendar-demo-card'));
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|
@ -121,6 +121,7 @@ class NoticeCalendar extends Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NoticeCalendar.propTypes = {
|
NoticeCalendar.propTypes = {
|
||||||
monthCellRender: PropTypes.func,
|
monthCellRender: PropTypes.func,
|
||||||
dateCellRender: PropTypes.func,
|
dateCellRender: PropTypes.func,
|
||||||
@ -139,7 +140,7 @@ NoticeCalendar.defaultProps = {
|
|||||||
locale: CalendarLocale,
|
locale: CalendarLocale,
|
||||||
getMonthData: noop,
|
getMonthData: noop,
|
||||||
getDateData: noop,
|
getDateData: noop,
|
||||||
fullscreen: false,
|
fullscreen: true,
|
||||||
prefixCls: PREFIX_CLS,
|
prefixCls: PREFIX_CLS,
|
||||||
onChange: noop,
|
onChange: noop,
|
||||||
onTypeChange: noop,
|
onTypeChange: noop,
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
# Calendar
|
# Calendar
|
||||||
|
|
||||||
- category: Components
|
- category: Components
|
||||||
|
- type: 展示
|
||||||
- chinese: 日历
|
- chinese: 日历
|
||||||
- cols: 1
|
- cols: 1
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
可以显示代办事项的日历。
|
按照日历形式展示数据的容器。
|
||||||
|
|
||||||
## 何时使用
|
## 何时使用
|
||||||
|
|
||||||
可以显示内容的日历。
|
当数据是日期或按照日期划分时,例如日程、课表、价格日历等,农历等。目前支持年/月切换。
|
||||||
|
|
||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
@ -21,7 +23,7 @@
|
|||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 |
|
||||||
|--------------|----------------|----------|--------------|
|
|--------------|----------------|----------|--------------|
|
||||||
| value | 展示日期 | gregorian-calendar object | 当前日期 |
|
| value | 展示日期 | gregorian-calendar object | 当前日期 |
|
||||||
| fullscreen | 是否全屏显示 | bool | false |
|
| fullscreen | 是否全屏显示 | bool | true |
|
||||||
| getDateData | 获取日的显示数据 | function | 无 |
|
| getDateData | 获取日的显示数据 | function | 无 |
|
||||||
| getMonthData | 获取月的显示数据 | function | 无 |
|
| getMonthData | 获取月的显示数据 | function | 无 |
|
||||||
| dateCellRendar | 自定义渲染日期单元格 | function | 无 |
|
| dateCellRendar | 自定义渲染日期单元格 | function | 无 |
|
||||||
|
@ -17,13 +17,18 @@
|
|||||||
padding: 11px 16px 11px 0;
|
padding: 11px 16px 11px 0;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
|
||||||
|
.ant-select {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
.ant-radio-group {
|
.ant-radio-group {
|
||||||
margin-left: 10px;
|
margin-left: 8px;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
label.ant-radio-button {
|
label.ant-radio-button {
|
||||||
height: 22px;
|
height: 22px;
|
||||||
line-height: 22px;
|
line-height: 20px;
|
||||||
padding: 0 10px;
|
padding: 0 10px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -44,7 +49,7 @@
|
|||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 235px;
|
height: 246px;
|
||||||
}
|
}
|
||||||
|
|
||||||
table, td, th, td {
|
table, td, th, td {
|
||||||
@ -182,8 +187,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
&-fullscreen {
|
&-fullscreen {
|
||||||
.@{notice-calendar-prefix-cls} {
|
.@{notice-calendar-prefix-cls} {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
@ -191,12 +194,14 @@
|
|||||||
table-layout: fixed;
|
table-layout: fixed;
|
||||||
}
|
}
|
||||||
&-header {
|
&-header {
|
||||||
|
.ant-radio-group {
|
||||||
|
margin-left: 16px;
|
||||||
|
}
|
||||||
label.ant-radio-button {
|
label.ant-radio-button {
|
||||||
height: 28px;
|
height: 28px;
|
||||||
line-height: 28px;
|
line-height: 26px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-fullscreen-month,
|
&-fullscreen-month,
|
||||||
&-fullscreen-date {
|
&-fullscreen-date {
|
||||||
margin: 0 4px;
|
margin: 0 4px;
|
||||||
@ -206,6 +211,7 @@
|
|||||||
padding:4px 8px;
|
padding:4px 8px;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
border-top: 2px solid #eee;
|
border-top: 2px solid #eee;
|
||||||
|
transition: background 0.3s ease;
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
background: tint(@primary-color, 90%);
|
background: tint(@primary-color, 90%);
|
||||||
@ -216,6 +222,7 @@
|
|||||||
&-column-header {
|
&-column-header {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
|
padding-bottom: 5px;
|
||||||
}
|
}
|
||||||
&-cell {
|
&-cell {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user