react-page-y
Advanced tools
+87
-18
@@ -17,2 +17,6 @@ "use strict"; | ||
| var _reactSvgY = require("react-svg-y"); | ||
| var _reactSvgY2 = _interopRequireDefault(_reactSvgY); | ||
| var _style = require("./style"); | ||
@@ -87,2 +91,27 @@ | ||
| _this2.handleChoose = function (e) { | ||
| debugger; | ||
| var myselect = document.getElementById('pageSize'); | ||
| var index = myselect.selectedIndex; | ||
| var pagesize = myselect.options[index].value; | ||
| _this2.setState({ | ||
| pageSize: pagesize, | ||
| totalPage: Math.ceil(_this2.state.totalNum / pagesize), // 总页数 | ||
| showList: !_this2.state.showList | ||
| }); | ||
| console.log(Number(e.target.innerText)); | ||
| }; | ||
| _this2.handleOver = function () { | ||
| _this2.setState({ | ||
| showList: true | ||
| }); | ||
| }; | ||
| _this2.handleOut = function () { | ||
| _this2.setState({ | ||
| showList: false | ||
| }); | ||
| }; | ||
| var _state = { | ||
@@ -95,3 +124,3 @@ flag: 0, | ||
| totalPage: 0, //总页数 | ||
| oldPageNumber: "" | ||
| showList: false | ||
| }; | ||
@@ -110,3 +139,4 @@ _this2.state = _reactUtilsY._Object.merge(_this2.state || {}, _state); | ||
| this.setState({ | ||
| pageSize: pagesize, // 总页数 | ||
| pageSize: pagesize, // 每页数目 | ||
| oldPageSize: pagesize, | ||
| totalNum: this.props.totalNum, // 总记录数 | ||
@@ -129,4 +159,3 @@ current: this.props.pageNumber, // 当前页码 | ||
| totalNum: nextProps.totalNum, // 总记录数 | ||
| totalPage: Math.ceil(nextProps.totalNum / this.state.pageSize), // 总页数 | ||
| oldPageNumber: nextProps.pageNumber | ||
| totalPage: Math.ceil(nextProps.totalNum / this.state.pageSize) // 总页数 | ||
| }); | ||
@@ -203,29 +232,69 @@ } | ||
| { style: styles.textBox }, | ||
| "\u603B\u5171", | ||
| "\u603B\u5171 ", | ||
| _react2.default.createElement( | ||
| "label", | ||
| null, | ||
| this.state.totalNum | ||
| { style: styles.labelN }, | ||
| " ", | ||
| this.state.totalNum, | ||
| " " | ||
| ), | ||
| "\u6761\uFF0C \u6BCF\u9875", | ||
| " \u6761 \u6BCF\u9875", | ||
| _react2.default.createElement( | ||
| "label", | ||
| null, | ||
| this.state.pageSize | ||
| "div", | ||
| { style: styles.pageSizeBox, | ||
| onMouseOver: this.handleOver, | ||
| onMouseOut: this.handleOut | ||
| }, | ||
| _react2.default.createElement( | ||
| "select", | ||
| { id: "pageSize", onChange: this.handleChoose, style: styles.pageSize }, | ||
| _react2.default.createElement( | ||
| "option", | ||
| { value: "10" }, | ||
| "10" | ||
| ), | ||
| _react2.default.createElement( | ||
| "option", | ||
| { value: "20" }, | ||
| "20" | ||
| ), | ||
| _react2.default.createElement( | ||
| "option", | ||
| { value: "30" }, | ||
| "30" | ||
| ), | ||
| _react2.default.createElement( | ||
| "option", | ||
| { value: "50" }, | ||
| "50" | ||
| ), | ||
| _react2.default.createElement( | ||
| "option", | ||
| { value: "100" }, | ||
| "100" | ||
| ) | ||
| ), | ||
| _react2.default.createElement( | ||
| "span", | ||
| { style: styles.svg }, | ||
| _react2.default.createElement(_reactSvgY2.default, { type: "Bottom", width: "1rem", height: "1rem", fill: "#4aa5fe" }) | ||
| ) | ||
| ), | ||
| "\u6761\uFF0C \u5171", | ||
| "\u6761", | ||
| _react2.default.createElement( | ||
| "label", | ||
| null, | ||
| this.state.totalPage | ||
| { style: styles.labelN }, | ||
| "\u5171", | ||
| this.state.totalPage, | ||
| "\u9875" | ||
| ), | ||
| "\u9875\uFF0C \u5230\u7B2C", | ||
| "\u5230\u7B2C", | ||
| _react2.default.createElement("input", { type: "text", style: styles.inputBox, value: this.state.goValue, | ||
| onChange: this.setGoValue }), | ||
| "\u9875", | ||
| _react2.default.createElement( | ||
| "span", | ||
| { style: styles.jumpBox, onClick: this.handleInputPage }, | ||
| "\u8DF3\u8F6C" | ||
| ), | ||
| "\u9875" | ||
| "Go" | ||
| ) | ||
| ) | ||
@@ -232,0 +301,0 @@ ); |
+75
-18
@@ -12,2 +12,8 @@ "use strict"; | ||
| var _reactSvgY = require("react-svg-y"); | ||
| var svg = _interopRequireWildcard(_reactSvgY); | ||
| function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -23,2 +29,25 @@ | ||
| }, | ||
| svg: { | ||
| position: "relative", | ||
| right: "2rem", | ||
| top: "0.5rem" | ||
| }, | ||
| pageSizeBox: { | ||
| display: "flex" | ||
| }, | ||
| //条目数 | ||
| pageSize: { | ||
| paddingLeft: "10px", | ||
| width: "60px", | ||
| height: "28px", | ||
| border: "0.08rem solid #cccccc", | ||
| borderRadius: "2px", | ||
| marginLeft: "8px", | ||
| appearance: "none", | ||
| mozAppearance: "none", | ||
| webkitAppearance: "none", | ||
| background: "url('images/select.png') no-repeat right center", | ||
| fontSize: "14px", | ||
| color: "#666666" | ||
| }, | ||
| //分页数 | ||
@@ -28,3 +57,18 @@ pageNumBox: { | ||
| }, | ||
| showList: { | ||
| listStyle: 'none', | ||
| padding: '0', | ||
| margin: '0.16rem 0', | ||
| textAlign: 'center', | ||
| border: "0.08rem solid", | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| zIndex: '6' | ||
| }, | ||
| showList_none: { | ||
| display: 'none' | ||
| }, | ||
| pagebtnBox: { | ||
| fontSize: "14px", | ||
| cursor: "pointer", | ||
@@ -36,5 +80,5 @@ width: "2rem", | ||
| alignItems: "center", | ||
| backgroundColor: _theme.pagebtnBg, | ||
| color: _theme.pagebtn, | ||
| border: "0.08rem solid " + _theme.pagebtnBg | ||
| color: "#9a9a9a", | ||
| border: "0.08rem solid #cccccc", | ||
| borderRadius: "2px" | ||
| }, | ||
@@ -47,9 +91,10 @@ pagebtnDisabled: { | ||
| alignItems: "center", | ||
| backgroundColor: "#e5e5e5", | ||
| border: "0.08rem solid #e5e5e5", | ||
| borderRadius: "2px", | ||
| cursor: "no-drop", | ||
| color: "#ccc" | ||
| color: "#9a9a9a" | ||
| }, | ||
| pageNumCont: { | ||
| display: "flex" | ||
| display: "flex", | ||
| marginRight: "0.375rem" | ||
| }, | ||
@@ -63,4 +108,6 @@ numBox: { | ||
| alignItems: "center", | ||
| border: "0.08rem solid #e5e5e5", | ||
| color: "#707070" | ||
| border: "0.08rem solid #cccccc", | ||
| borderRadius: "2px", | ||
| color: "#666666", | ||
| marginLeft: "0.375rem" | ||
| }, | ||
@@ -70,2 +117,3 @@ currentNum: { | ||
| width: "2rem", | ||
| marginLeft: "0.375rem", | ||
| height: "2rem", | ||
@@ -75,3 +123,4 @@ display: "flex", | ||
| alignItems: "center", | ||
| border: "0.08rem solid #e5e5e5", | ||
| border: "0.08rem solid #4aa5fe", | ||
| borderRadius: "2px", | ||
| backgroundColor: _theme.currentNumBg, | ||
@@ -82,12 +131,19 @@ color: _theme.currentNum | ||
| textBox: { | ||
| display: "flex" | ||
| alignItems: "center", | ||
| display: "flex", | ||
| fontSize: "14px", | ||
| color: "#666666" | ||
| }, | ||
| labelN: { | ||
| padding: "0 8px" | ||
| }, | ||
| inputBox: { | ||
| width: "2rem", | ||
| height: "1.5rem", | ||
| border: "0.08rem solid #eee", | ||
| width: "38px", | ||
| textAlign: "center", | ||
| margin: "0 0.375rem", | ||
| outline: "none", | ||
| padding: "0" | ||
| padding: "0", | ||
| height: '25.9px', | ||
| border: "0.08rem solid #cccccc", | ||
| borderRadius: "2px" | ||
| }, | ||
@@ -100,8 +156,9 @@ jumpBox: { | ||
| color: "#fff", | ||
| width: "3rem", | ||
| height: "1.6rem", | ||
| width: "40px", | ||
| margin: "0 0.5rem", | ||
| fontSize: "1rem", | ||
| borderRadius: "0.2rem", | ||
| cursor: "pointer" | ||
| cursor: "pointer", | ||
| height: '25.9px', | ||
| border: "0.08rem solid #cccccc", | ||
| borderRadius: "2px" | ||
| } | ||
@@ -108,0 +165,0 @@ }; |
+4
-3
| { | ||
| "name": "react-page-y", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "description": "", | ||
@@ -17,6 +17,7 @@ "main": "index.js", | ||
| "dependencies": { | ||
| "utils-fy": "^1.2.2", | ||
| "theme-y": "^1.0.4" | ||
| "theme-y": "^1.0.8", | ||
| "react-utils-y": "^1.1.1", | ||
| "react-svg-y": "^1.0.2" | ||
| }, | ||
| "devDependencies": {} | ||
| } |
17525
34.93%426
37.86%3
50%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
Updated