react-page-y
Advanced tools
+51
-55
@@ -1,2 +0,2 @@ | ||
| 'use strict'; | ||
| "use strict"; | ||
@@ -9,11 +9,11 @@ Object.defineProperty(exports, "__esModule", { | ||
| var _react = require('react'); | ||
| var _react = require("react"); | ||
| var _react2 = _interopRequireDefault(_react); | ||
| var _utilsFy = require('utils-fy'); | ||
| var _themeY = require("theme-y"); | ||
| var _style = require('./style'); | ||
| var _reactUtilsY = require("react-utils-y"); | ||
| var _style2 = _interopRequireDefault(_style); | ||
| var _style = require("./style"); | ||
@@ -28,11 +28,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| var defaultTheme = { | ||
| default: "#1489e6", //亮色1///1489e6 | ||
| first: "#5ed0df", //亮色2 | ||
| second: "#ededed", //灰色1 | ||
| third: "#747474" //灰色2 | ||
| var getTheme = function getTheme(_this) { | ||
| // designationTheme 指定的主题, theme redux设置的全局主题, | ||
| var themeName = _this.props.designationTheme || _this.props.theme || "default"; | ||
| var _theme = _this.state.theme[themeName].page; | ||
| return _theme; | ||
| }; | ||
| var PageComponent = function (_Component) { | ||
| _inherits(PageComponent, _Component); | ||
| var PageComponent = function (_Theme) { | ||
| _inherits(PageComponent, _Theme); | ||
@@ -57,3 +57,3 @@ function PageComponent(props) { | ||
| _this2.goPrevClick = function () { | ||
| _this2.handlePrev = function () { | ||
| var cur = _this2.state.current; | ||
@@ -65,3 +65,3 @@ if (cur > 1) { | ||
| _this2.goNext = function () { | ||
| _this2.handleNext = function () { | ||
| var cur = _this2.state.current; | ||
@@ -77,3 +77,3 @@ if (cur < _this2.state.totalPage) { | ||
| _this2.goSwitchChange = function () { | ||
| _this2.handleInputPage = function () { | ||
| var value = _this2.state.goValue; | ||
@@ -91,3 +91,3 @@ if (!/^[1-9]\d*$/.test(value)) { | ||
| _this2.state = { | ||
| var _state = { | ||
| flag: 0, | ||
@@ -99,5 +99,5 @@ current: 1, //当前页码 | ||
| totalPage: 0, //总页数 | ||
| styles: _style2.default.page(defaultTheme), | ||
| oldPageNumber: "" | ||
| }; | ||
| _this2.state = _reactUtilsY._Object.merge(_this2.state || {}, _state); | ||
| return _this2; | ||
@@ -107,10 +107,6 @@ } | ||
| _createClass(PageComponent, [{ | ||
| key: 'componentWillMount', | ||
| value: function componentWillMount() { | ||
| this.setState({ | ||
| styles: _style2.default.page(this.props.themeObj || defaultTheme) | ||
| }); | ||
| } | ||
| key: "componentWillMount", | ||
| value: function componentWillMount() {} | ||
| }, { | ||
| key: 'componentDidMount', | ||
| key: "componentDidMount", | ||
| value: function componentDidMount() { | ||
@@ -126,3 +122,3 @@ var pagesize = this.props.pageSize || 10; | ||
| }, { | ||
| key: 'componentWillReceiveProps', | ||
| key: "componentWillReceiveProps", | ||
| value: function componentWillReceiveProps(nextProps) { | ||
@@ -143,5 +139,5 @@ if (this.state.oldPageNumber != nextProps.pageNumber) { | ||
| }, { | ||
| key: 'render', | ||
| key: "render", | ||
| value: function render() { | ||
| var styles = this.state.styles; | ||
| var styles = _reactUtilsY._Object.merge({}, (0, _style.pageSty)(getTheme(this))); | ||
| //当前页码 | ||
@@ -178,21 +174,21 @@ var cur = this.state.current; | ||
| return _react2.default.createElement( | ||
| 'div', | ||
| "div", | ||
| { style: styles.pageBox }, | ||
| _react2.default.createElement( | ||
| 'div', | ||
| "div", | ||
| { style: styles.pageNumBox }, | ||
| _react2.default.createElement( | ||
| 'a', | ||
| { style: this.state.current == 1 ? _utilsFy.Obj.merge(eval("(" + JSON.stringify(styles.pagebtnBox) + ")"), styles.btnDisabled) : styles.pagebtnBox, | ||
| onClick: this.goPrevClick }, | ||
| "a", | ||
| { style: this.state.current == 1 ? styles.pagebtnDisabled : styles.pagebtnBox, | ||
| onClick: this.handlePrev }, | ||
| "<" | ||
| ), | ||
| _react2.default.createElement( | ||
| 'span', | ||
| { style: styles.pageNumBox }, | ||
| "span", | ||
| { style: styles.pageNumCont }, | ||
| pageNum.map(function (curPageNum, i) { | ||
| return _react2.default.createElement( | ||
| 'a', | ||
| { style: curPageNum.cur ? _utilsFy.Obj.merge(eval("(" + JSON.stringify(styles.numBox) + ")"), styles.numCurrent) : styles.numBox, | ||
| onClick: _this.pageClick.bind(this, curPageNum.num), | ||
| "a", | ||
| { style: curPageNum.cur ? styles.currentNum : styles.numBox, | ||
| onClick: _this.pageClick.bind(_this, curPageNum.num), | ||
| key: i }, | ||
@@ -204,5 +200,5 @@ curPageNum.num | ||
| _react2.default.createElement( | ||
| 'a', | ||
| { style: this.state.current == this.state.totalPage ? _utilsFy.Obj.merge(eval("(" + JSON.stringify(styles.pagebtnBox) + ")"), styles.btnDisabled) : styles.pagebtnBox, | ||
| onClick: this.goNext }, | ||
| "a", | ||
| { style: this.state.current == this.state.totalPage ? styles.pagebtnDisabled : styles.pagebtnBox, | ||
| onClick: this.handleNext }, | ||
| ">" | ||
@@ -212,31 +208,31 @@ ) | ||
| _react2.default.createElement( | ||
| 'div', | ||
| { style: { display: "flex" } }, | ||
| '\u603B\u5171', | ||
| "div", | ||
| { style: styles.textBox }, | ||
| "\u603B\u5171", | ||
| _react2.default.createElement( | ||
| 'span', | ||
| "label", | ||
| null, | ||
| this.state.totalNum | ||
| ), | ||
| '\u6761\uFF0C \u6BCF\u9875', | ||
| "\u6761\uFF0C \u6BCF\u9875", | ||
| _react2.default.createElement( | ||
| 'span', | ||
| "label", | ||
| null, | ||
| this.state.pageSize | ||
| ), | ||
| '\u6761\uFF0C \u5171', | ||
| "\u6761\uFF0C \u5171", | ||
| _react2.default.createElement( | ||
| 'span', | ||
| "label", | ||
| null, | ||
| this.state.totalPage | ||
| ), | ||
| '\u9875\uFF0C \u5230\u7B2C', | ||
| _react2.default.createElement('input', { type: 'text', style: styles.jumpInput, value: this.state.goValue, | ||
| "\u9875\uFF0C \u5230\u7B2C", | ||
| _react2.default.createElement("input", { type: "text", style: styles.inputBox, value: this.state.goValue, | ||
| onChange: this.setGoValue }), | ||
| _react2.default.createElement( | ||
| 'span', | ||
| { style: styles.goVFn, onClick: this.goSwitchChange }, | ||
| '\u8DF3\u8F6C' | ||
| "span", | ||
| { style: styles.jumpBox, onClick: this.handleInputPage }, | ||
| "\u8DF3\u8F6C" | ||
| ), | ||
| '\u9875' | ||
| "\u9875" | ||
| ) | ||
@@ -248,5 +244,5 @@ ); | ||
| return PageComponent; | ||
| }(_react.Component); | ||
| }(_themeY.Theme); | ||
| exports.default = PageComponent; | ||
| //# sourceMappingURL=page.js.map |
+96
-64
@@ -6,67 +6,99 @@ "use strict"; | ||
| }); | ||
| exports.default = { | ||
| page: function page(color) { | ||
| return { | ||
| pageBox: { | ||
| display: "flex", | ||
| justifyContent: "space-between", | ||
| flexWrap: "wrap", | ||
| margin: "1rem 2rem" | ||
| }, | ||
| pageNumBox: { | ||
| display: "flex" | ||
| }, | ||
| pagebtnBox: { | ||
| cursor: "pointer", | ||
| width: "2rem", | ||
| height: "2rem", | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| backgroundColor: "rgb(237, 237, 237)", | ||
| border: "0.08rem solid #e5e5e5" | ||
| }, | ||
| btnDisabled: { | ||
| cursor: "no-drop", | ||
| color: "#ccc" | ||
| }, | ||
| numBox: { | ||
| cursor: "pointer", | ||
| width: "2rem", | ||
| height: "2rem", | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| border: "0.08rem solid #e5e5e5", | ||
| color: "#707070" | ||
| }, | ||
| numCurrent: { | ||
| backgroundColor: color.default, | ||
| color: "#fff" | ||
| }, | ||
| jumpInput: { | ||
| width: "2rem", | ||
| height: "1.5rem", | ||
| border: "0.08rem solid #eee", | ||
| textAlign: "center", | ||
| margin: "0 0.375rem", | ||
| outline: "none", | ||
| padding: "0" | ||
| }, | ||
| goVFn: { | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| background: "#ebae00", | ||
| color: "#fff", | ||
| width: "3rem", | ||
| height: "1.6rem", | ||
| margin: "0 0.5rem", | ||
| fontSize: "1rem", | ||
| borderRadius: "0.2rem", | ||
| cursor: "pointer" | ||
| } | ||
| }; | ||
| } | ||
| exports.pageSty = undefined; | ||
| var _react = require("react"); | ||
| var _react2 = _interopRequireDefault(_react); | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
| var pageSty = function pageSty(_theme) { | ||
| var sty = { | ||
| pageBox: { | ||
| display: "flex", | ||
| justifyContent: "space-between", | ||
| flexWrap: "wrap", | ||
| margin: "1rem 2rem" | ||
| }, | ||
| //分页数 | ||
| pageNumBox: { | ||
| display: "flex" | ||
| }, | ||
| pagebtnBox: { | ||
| cursor: "pointer", | ||
| width: "2rem", | ||
| height: "2rem", | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| backgroundColor: _theme.pagebtnBg, | ||
| color: _theme.pagebtn, | ||
| border: "0.08rem solid " + _theme.pagebtnBg | ||
| }, | ||
| pagebtnDisabled: { | ||
| width: "2rem", | ||
| height: "2rem", | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| backgroundColor: "#e5e5e5", | ||
| border: "0.08rem solid #e5e5e5", | ||
| cursor: "no-drop", | ||
| color: "#ccc" | ||
| }, | ||
| pageNumCont: { | ||
| display: "flex" | ||
| }, | ||
| numBox: { | ||
| cursor: "pointer", | ||
| width: "2rem", | ||
| height: "2rem", | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| border: "0.08rem solid #e5e5e5", | ||
| color: "#707070" | ||
| }, | ||
| currentNum: { | ||
| cursor: "pointer", | ||
| width: "2rem", | ||
| height: "2rem", | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| border: "0.08rem solid #e5e5e5", | ||
| backgroundColor: _theme.currentNumBg, | ||
| color: _theme.currentNum | ||
| }, | ||
| //文本 | ||
| textBox: { | ||
| display: "flex" | ||
| }, | ||
| inputBox: { | ||
| width: "2rem", | ||
| height: "1.5rem", | ||
| border: "0.08rem solid #eee", | ||
| textAlign: "center", | ||
| margin: "0 0.375rem", | ||
| outline: "none", | ||
| padding: "0" | ||
| }, | ||
| jumpBox: { | ||
| display: "flex", | ||
| justifyContent: "center", | ||
| alignItems: "center", | ||
| background: _theme.jumpBg, | ||
| color: "#fff", | ||
| width: "3rem", | ||
| height: "1.6rem", | ||
| margin: "0 0.5rem", | ||
| fontSize: "1rem", | ||
| borderRadius: "0.2rem", | ||
| cursor: "pointer" | ||
| } | ||
| }; | ||
| return sty; | ||
| }; | ||
| exports.pageSty = pageSty; | ||
| //# sourceMappingURL=style.js.map |
+3
-2
| { | ||
| "name": "react-page-y", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "", | ||
@@ -17,5 +17,6 @@ "main": "index.js", | ||
| "dependencies": { | ||
| "utils-fy": "^1.2.2" | ||
| "utils-fy": "^1.2.2", | ||
| "theme-y": "^1.0.4" | ||
| }, | ||
| "devDependencies": {} | ||
| } |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
12988
4.47%309
8.04%0
-100%2
100%+ Added
+ Added