Skip to content

Commit

Permalink
feat(DatePicker): Add disabledDate props.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Dec 15, 2017
1 parent 7b8b765 commit 80aec0c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
7 changes: 6 additions & 1 deletion docs/md/cn/calendar.md
Expand Up @@ -26,6 +26,10 @@ class Demo extends Component {

<!--DemoStart-->
```js
function disabledDate(current) {
// 每个月 12 号禁止选中
return current.day === 12;
}
function getListData(value) {
let listData;
switch (value) {
Expand Down Expand Up @@ -78,9 +82,10 @@ class Demo extends Component {
render() {
return (
<Calendar
disabledDate={disabledDate}
weekLabel={['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']}
dateCellRender={dateCellRender}
/>
/>
)
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/calendar/style/index.less
Expand Up @@ -26,4 +26,15 @@
bottom: auto;
text-align: left;
}
.w-datepicker-disable {
&:after {
content: '';
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: #00000008;
}
}
}
7 changes: 2 additions & 5 deletions src/date-picker/style/datepicker.less
Expand Up @@ -125,16 +125,13 @@
td&-sun, td&-sat {
color: #929292;
}
td&-sat {
box-shadow: inset 0 -1px 0 #eaeaea, inset 0 0 0 5px #fafafa;
}
&-days &-disable {
background: #efefef;
background: #f9f9f9;
cursor: not-allowed;
color: #d3d3d3;
box-shadow: inset -1px -1px 0 #eaeaea, inset 0 0 0 0 #fafafa;
&:hover {
background: #efefef;
background: #f9f9f9;
}
}

Expand Down

0 comments on commit 80aec0c

Please sign in to comment.