Browse Source

添加分页组件

pull/39/head
Yuwei Ba 10 years ago
parent
commit
27c6e03322
  1. 0
      components/pagenation/index.jsx
  2. 19
      components/pagination/demo/basic.md
  3. 19
      components/pagination/demo/changer.md
  4. 19
      components/pagination/demo/jump.md
  5. 19
      components/pagination/demo/more.md
  6. 14
      components/pagination/index.jsx
  7. 0
      components/pagination/index.md
  8. 1
      index.js
  9. 5
      package.json
  10. 1
      style/components/index.less
  11. 499
      style/components/pagination.less

0
components/pagenation/index.jsx

19
components/pagination/demo/basic.md

@ -0,0 +1,19 @@
# 基本
- order: 0
基础分页
---
````jsx
var Pagination = antd.Pagination;
function onChange(page) {
console.log(page);
}
React.render(
<Pagination onChange={onChange} total={50} />,
document.getElementById('components-pagination-demo-basic'));
````

19
components/pagination/demo/changer.md

@ -0,0 +1,19 @@
# 改变
- order: 2
改变每页显示条目数
---
````jsx
var Pagination = antd.Pagination;
function onChange(page) {
console.log(page);
}
React.render(
<Pagination showSizeChanger={true} onChange={onChange} total={500} />,
document.getElementById('components-pagination-demo-changer'));
````

19
components/pagination/demo/jump.md

@ -0,0 +1,19 @@
# 跳转
- order: 3
快速跳转到某一页
---
````jsx
var Pagination = antd.Pagination;
function onChange(page) {
console.log(page);
}
React.render(
<Pagination showQuickJumper={true} onChange={onChange} total={500} />,
document.getElementById('components-pagination-demo-jump'));
````

19
components/pagination/demo/more.md

@ -0,0 +1,19 @@
# 更多
- order: 1
更多分页
---
````jsx
var Pagination = antd.Pagination;
function onChange(page) {
console.log(page);
}
React.render(
<Pagination onChange={onChange} total={500} />,
document.getElementById('components-pagination-demo-more'));
````

14
components/pagination/index.jsx

@ -0,0 +1,14 @@
'use strict';
let Pagination = require('rc-pagination');
let React = require('react');
let prefixCls = 'ant-patination';
class AntPagination extends React.Component {
render() {
return <Pagination className={prefixCls} {...this.props} />;
}
}
module.exports = AntPagination;

0
components/pagenation/index.md → components/pagination/index.md

1
index.js

@ -12,6 +12,7 @@ var antd = {
Select: require('./components/select'),
Breadcrumb: require('./components/breadcrumb'),
Popconfirm: require('./components/popconfirm'),
Pagination: require('./components/pagination'),
confirm: require('./components/modal/confirm'),
Steps: require('./components/steps'),
InputNumber: require('./components/input-number'),

5
package.json

@ -22,13 +22,14 @@
"rc-dropdown": "~1.1.1",
"rc-input-number": "~2.0.1",
"rc-menu": "~3.4.0",
"rc-notification": "~1.0.1",
"rc-pagination": "^1.0.0",
"rc-progress": "~1.0.0",
"rc-select": "~4.2.1",
"rc-steps": "~1.1.3",
"rc-switch": "~1.2.0",
"rc-tabs": "~5.2.0",
"rc-tooltip": "~2.4.0",
"rc-notification": "~1.0.1"
"rc-tooltip": "~2.4.0"
},
"devDependencies": {
"css-animation": "~1.0.3",

1
style/components/index.less

@ -9,6 +9,7 @@
@import "tabs";
@import "tooltip";
@import "popover";
@import "pagination";
@import "form";
@import "loading";
@import "progress";

499
style/components/pagination.less

@ -0,0 +1,499 @@
@prefixClass: rc-pagination;
.@{prefixClass} {
font-size: 12px;
font-family: 'Arial';
&:after {
content: " ";
display: block;
height: 0;
clear: both;
overflow: hidden;
visibility: hidden;
}
.@{prefixClass}-item {
cursor: pointer;
border-radius: 6px;
min-width: 28px;
height: 28px;
line-height: 28px;
text-align: center;
list-style: none;
float: left;
border: 1px solid #d9d9d9;
background-color: #fff;
margin-right: 8px;
a {
text-decoration: none;
color: #666;
}
&:hover {
border-color: #2db7f5;
a {
color: #2db7f5;
}
}
&.active {
background-color: #2db7f5;
border: none;
a {
color: #fff;
}
}
}
.jump-prev, .jump-next {
&:after {
content: "•••";
display: block;
letter-spacing: 2px;
color: #ccc;
font-size: 12px;
margin-top: 1px;
}
&:hover {
&:after {
color: #2db7f5;
}
}
}
.jump-prev {
&:hover {
&:after {
content: "‹‹";
}
}
}
.jump-next {
&:hover {
&:after {
content: "››";
}
}
}
.prev, .jump-prev, .jump-next {
margin-right: 8px;
}
.prev, .next, .jump-prev, .jump-next {
cursor: pointer;
color: #666;
font-size: 10px;
border-radius: 6px;
list-style: none;
min-width: 28px;
height: 28px;
line-height: 28px;
float: left;
text-align: center;
}
.prev, .next {
border: 1px solid #d9d9d9;
a {
color: #666;
}
&.disabled {
cursor: not-allowed;
a {
color: #ccc;
}
}
}
.options {
float: left;
margin-left: 15px;
.size-changer {
float: left;
width: 70px;
}
.quick-jumper {
float: left;
margin-left: 16px;
height: 28px;
line-height: 28px;
input {
margin: 0 8px;
box-sizing: border-box;
background-color: #fff;
border-radius: 6px;
border: 1px solid #d9d9d9;
outline: none;
padding: 3px 12px;
width: 50px;
height: 28px;
&:hover {
border-color: #2db7f5;
}
}
}
}
}
.rc-select {
box-sizing: border-box;
display: inline-block;
margin: 0;
position: relative;
vertical-align: middle;
color: #666;
}
.rc-select ul,
.rc-select li {
margin: 0;
padding: 0;
list-style: none;
}
.rc-select > ul > li > a {
padding: 0;
background-color: #fff;
}
.rc-select-arrow {
height: 26px;
position: absolute;
top: 1px;
right: 1px;
width: 20px;
}
.rc-select-arrow b {
border-color: #999999 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
width: 0;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
left: 50%;
}
.rc-select-selection {
outline: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-webkit-user-select: none;
box-sizing: border-box;
display: block;
background-color: #fff;
border-radius: 6px;
border: 1px solid #d9d9d9;
}
.rc-select-selection:hover {
border-color: #23c0fa;
box-shadow: 0 0 2px rgba(45, 183, 245, 0.8);
}
.rc-select-selection:active {
border-color: #2db7f5;
}
.rc-select-disabled {
color: #ccc;
cursor: not-allowed;
pointer-events: none;
}
.rc-select-disabled .rc-select-selection:hover,
.rc-select-disabled .rc-select-selection:active {
border-color: #d9d9d9;
}
.rc-select-selection--single {
height: 28px;
cursor: pointer;
}
.rc-select-selection--single .rc-select-selection__rendered {
display: block;
overflow: hidden;
text-overflow: ellipsis;
padding-left: 10px;
padding-right: 20px;
line-height: 28px;
}
.rc-select-selection--single .rc-select-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
}
.rc-select-disabled .rc-select-selection__choice__remove {
color: #ccc;
cursor: default;
}
.rc-select-disabled .rc-select-selection__choice__remove:hover {
color: #ccc;
}
.rc-select-search--inline {
float: left;
width: 100%;
}
.rc-select-search--inline .rc-select-search__field {
border: none;
font-size: 100%;
background: transparent;
outline: 0;
width: 100%;
}
.rc-select-search--inline > i {
float: right;
}
.rc-select-selection--multiple {
min-height: 28px;
cursor: text;
}
.rc-select-selection--multiple .rc-select-search--inline {
width: auto;
}
.rc-select-selection--multiple .rc-select-search--inline .rc-select-search__field {
width: 0.75em;
}
.rc-select-selection--multiple .rc-select-selection__rendered {
overflow: hidden;
text-overflow: ellipsis;
padding-left: 8px;
padding-bottom: 2px;
}
.rc-select-selection--multiple .rc-select-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
margin-right: 10px;
}
.rc-select-selection--multiple > ul > li {
margin-top: 4px;
height: 20px;
line-height: 20px;
}
.rc-select-selection--multiple .rc-select-selection__choice {
background-color: #f3f3f3;
border-radius: 4px;
cursor: default;
float: left;
padding: 0 8px;
margin-right: 4px;
}
.rc-select-selection--multiple .rc-select-selection__choice__remove {
color: #919191;
cursor: pointer;
display: inline-block;
font-weight: bold;
padding: 0 0 0 8px;
}
.rc-select-selection--multiple .rc-select-selection__choice__remove:before {
content: '×';
}
.rc-select-selection--multiple .rc-select-selection__choice__remove:hover {
color: #333;
}
.rc-select-dropdown {
display: none;
background-color: white;
border: 1px solid #d9d9d9;
box-shadow: 0 0px 4px #d9d9d9;
border-radius: 4px;
box-sizing: border-box;
width: 100%;
z-index: 100;
position: absolute;
top: 100%;
margin-top: 4px;
outline: none;
}
.rc-select-dropdown .rc-select-menu-item[aria-selected=true] {
background-color: #ddd;
}
.rc-select-dropdown-slide-up-enter {
-webkit-animation-duration: 0.3s;
animation-duration: 0.3s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
display: block !important;
opacity: 0;
-webkit-animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);
animation-timing-function: cubic-bezier(0.08, 0.82, 0.17, 1);
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
.rc-select-dropdown-slide-up-leave {
-webkit-animation-duration: 0.3s;
animation-duration: 0.3s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-transform-origin: 0 0;
-ms-transform-origin: 0 0;
transform-origin: 0 0;
display: block !important;
opacity: 1;
-webkit-animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
animation-timing-function: cubic-bezier(0.6, 0.04, 0.98, 0.34);
-webkit-animation-play-state: paused;
animation-play-state: paused;
}
.rc-select-dropdown-slide-up-enter.rc-select-dropdown-slide-up-enter-active {
-webkit-animation-name: rcDropdownSlideUpIn;
animation-name: rcDropdownSlideUpIn;
-webkit-animation-play-state: running;
animation-play-state: running;
}
.rc-select-dropdown-slide-up-leave.rc-select-dropdown-slide-up-leave-active {
-webkit-animation-name: rcDropdownSlideUpOut;
animation-name: rcDropdownSlideUpOut;
-webkit-animation-play-state: running;
animation-play-state: running;
}
@-webkit-keyframes rcDropdownSlideUpIn {
0% {
opacity: 0;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
100% {
opacity: 1;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
}
@keyframes rcDropdownSlideUpIn {
0% {
opacity: 0;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
100% {
opacity: 1;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
}
@-webkit-keyframes rcDropdownSlideUpOut {
0% {
opacity: 1;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
100% {
opacity: 0;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
}
@keyframes rcDropdownSlideUpOut {
0% {
opacity: 1;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-transform: scaleY(1);
transform: scaleY(1);
}
100% {
opacity: 0;
-webkit-transform-origin: 0% 0%;
transform-origin: 0% 0%;
-webkit-transform: scaleY(0);
transform: scaleY(0);
}
}
.rc-select-search--dropdown {
display: block;
padding: 4px;
}
.rc-select-search--dropdown .rc-select-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box;
border: 1px solid #d9d9d9;
border-radius: 4px;
outline: none;
}
.rc-select-search--dropdown.rc-select-search--hide {
display: none;
}
.rc-select-open .rc-select-arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px;
}
.rc-select-open .rc-select-dropdown {
display: block;
}
.rc-select-menu {
outline: none;
margin-bottom: 0;
padding-left: 0;
list-style: none;
z-index: 9999;
}
.rc-select-menu-item-group-list {
margin: 0;
padding: 0;
}
.rc-select-menu-item-group-list > li.rc-select-menu-item {
padding-left: 20px;
}
.rc-select-menu-item-group-title {
color: #999;
line-height: 1.5;
padding: 8px 10px;
border-bottom: 1px solid #dedede;
}
li.rc-select-menu-item {
margin: 0;
position: relative;
display: block;
padding: 7px 10px;
font-weight: normal;
color: #666666;
white-space: nowrap;
}
li.rc-select-menu-item:hover,
li.rc-select-menu-item-active,
li.rc-select-menu-item-selected {
background-color: rgba(142, 200, 249, 0.1) !important;
}
li.rc-select-menu-item-disabled {
color: #ccc;
cursor: not-allowed;
pointer-events: none;
}
li.rc-select-menu-item-disabled:hover {
color: #ccc;
background-color: #fff;
cursor: not-allowed;
}
li.rc-select-menu-item-divider {
height: 1px;
margin: 1px 0;
overflow: hidden;
background-color: #e5e5e5;
line-height: 0;
}
Loading…
Cancel
Save