Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React calendar quarter #567

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 96 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ http://react-component.github.io/calendar/examples/index.html
</tr>
<tr>
<td>mode</td>
<td>enum('time', 'date', 'month', 'year', 'decade')</td>
<td>enum('time', 'date', 'month', 'quarter', 'year', 'decade')</td>
<td>'date'</td>
<td>control which kind of panel should be shown</td>
</tr>
Expand Down Expand Up @@ -411,7 +411,7 @@ http://react-component.github.io/calendar/examples/index.html
</tr>
<tr>
<td>mode</td>
<td>enum('date', 'month', 'year', 'decade')[]</td>
<td>enum('date', 'month', 'quarter', 'year', 'decade')[]</td>
<td>['date', 'date']</td>
<td>control which kind of panels should be shown</td>
</tr>
Expand Down Expand Up @@ -536,6 +536,100 @@ http://react-component.github.io/calendar/examples/index.html
</tbody>
</table>

### rc-calendar/lib/QuarterCalendar props

<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width: 100px;">name</th>
<th style="width: 50px;">type</th>
<th style="width: 50px;">default</th>
<th>description</th>
</tr>
</thead>
<tbody>
<tr>
<td>prefixCls</td>
<td>String</td>
<td></td>
<td>prefixCls of this component</td>
</tr>
<tr>
<td>className</td>
<td>String</td>
<td></td>
<td>additional css class of root dom node</td>
</tr>
<tr>
<td>style</td>
<td>Object</td>
<td></td>
<td>additional style of root dom node</td>
</tr>
<tr>
<td>value</td>
<td>moment</td>
<td></td>
<td>current value like input's value</td>
</tr>
<tr>
<td>defaultValue</td>
<td>moment</td>
<td></td>
<td>defaultValue like input's defaultValue</td>
</tr>
<tr>
<td>locale</td>
<td>Object</td>
<td>import from 'rc-calendar/lib/locale/en_US'</td>
<td>calendar locale</td>
</tr>
<tr>
<td>disabledDate</td>
<td>Function(current:moment):Boolean</td>
<td></td>
<td>whether to disable select of current quarter</td>
</tr>
<tr>
<td>onSelect</td>
<td>Function(date: moment)</td>
<td></td>
<td>called when a date is selected from calendar</td>
</tr>
<tr>
<td>quarterCellRender</td>
<td>function</td>
<td></td>
<td>Custom quarter cell render method</td>
</tr>
<tr>
<td>dateCellRender</td>
<td>function</td>
<td></td>
<td>Custom date cell render method</td>
</tr>
<tr>
<td>quarterCellContentRender</td>
<td>function</td>
<td></td>
<td>Custom quarter cell content render method,the content will be appended to the cell.</td>
</tr>
<tr>
<tr>
<td>onChange</td>
<td>Function(date: moment)</td>
<td></td>
<td>called when a date is changed inside calendar (next year/next month/keyboard)</td>
</tr>
<tr>
<td>renderFooter</td>
<td>() => React.Node</td>
<td></td>
<td>extra footer</td>
</tr>
</tbody>
</table>

### rc-calendar/lib/Picker props

<table class="table table-bordered table-striped">
Expand Down
1 change: 1 addition & 0 deletions assets/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import "index/Time";
@import "index/TimePanel";
@import "index/MonthPanel";
@import "index/QuarterPanel";
@import "index/YearPanel";
@import "index/DecadePanel";
@import "common/RangeCalendar";
Expand Down
140 changes: 140 additions & 0 deletions assets/index/QuarterPanel.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
.@{prefixClass}-quarter-panel {
left: 0;
top:0;
bottom: 0;
right: 0;
background: #ffffff;
z-index: 10;
position: absolute;
outline: none;
}

.@{prefixClass}-quarter-panel-hidden {
display: none;
}

.@{prefixClass}-quarter-panel-header {
padding: 0 10px;
height: 34px;
line-height: 30px;
position: relative;
text-align: center;
user-select: none;
-webkit-user-select: none;
border-bottom: 1px solid #ccc;

> a {
font-weight: bold;
display: inline-block;
padding: 4px 5px;
text-align: center;
width: 30px;

&:hover {
cursor: pointer;
color: #23c0fa;
}
}
}

.@{prefixClass}-quarter-panel-prev-year-btn, .@{prefixClass}-quarter-panel-next-year-btn {
position: absolute;
top: 0;
}

.@{prefixClass}-quarter-panel-next-year-btn {
&:after {
content: '»'
}
}

.@{prefixClass}-quarter-panel-prev-year-btn {
user-select: none;
left: 0;

&:after {
content: '«'
}
}

.@{prefixClass}-quarter-panel .@{prefixClass}-quarter-panel-year-select {
width: 180px;
}

.@{prefixClass}-quarter-panel-year-select-arrow {
display: none;
}

.@{prefixClass}-quarter-panel-next-year-btn {
user-select: none;
right: 0;
}

.@{prefixClass}-quarter-panel-body {
padding: 9px 10px 10px;
position: absolute;
top: 34px;
bottom: 0;
}

.@{prefixClass}-quarter-panel-table {
table-layout: fixed;
width: 100%;
height: 100%;
border-collapse: separate;
}

.@{prefixClass}-quarter-panel-cell {
text-align: center;



.@{prefixClass}-quarter-panel-quarter {
display: block;
width: 46px;
margin: 0 auto;
color: #666;
border-radius: 4px 4px;
height: 36px;
padding: 0;
background: transparent;
line-height: 36px;
text-align: center;

&:hover {
background: #ebfaff;
cursor: pointer;
}
}

&-disabled{
.@{prefixClass}-quarter-panel-quarter {
color: #bfbfbf;

&:hover {
background: white;
cursor: not-allowed;
}
}
}
}

.@{prefixClass}-quarter-panel-selected-cell .@{prefixClass}-quarter-panel-quarter {
background: #3fc7fa;
color: #fff;

&:hover {
background: #3fc7fa;
color: #fff;
}
}

.@{prefixClass}-quarter-header-wrap {
position: relative;
height: 108px;
}

.@{prefixClass}-quarter-year-header-wrap {
position: relative;
min-height: 308px;
}
1 change: 1 addition & 0 deletions examples/antd-month-calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Demo extends React.Component {

render() {
const state = this.state;
console.log(cn);
const calendar = (<MonthCalendar
locale={cn ? zhCN : enUS}
style={{ zIndex: 1000 }}
Expand Down
1 change: 1 addition & 0 deletions examples/antd-quarter-calendar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
placeholder
Loading