easy3wmui 0.0.42 → 0.0.43-beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/assets/index.css CHANGED
@@ -490,3 +490,39 @@
490
490
  padding-left: 24px;
491
491
  padding-right: 24px;
492
492
  }
493
+ #Easy3wMPagination .easy3wMGridPageStepper {
494
+ display: -ms-flexbox;
495
+ display: flex;
496
+ -ms-flex-direction: row;
497
+ flex-direction: row;
498
+ -ms-flex-align: center;
499
+ align-items: center;
500
+ -ms-flex-pack: justify;
501
+ justify-content: space-between;
502
+ padding: 12px;
503
+ }
504
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtn {
505
+ -ms-flex: 1;
506
+ flex: 1;
507
+ border: 1px solid #000;
508
+ color: #000;
509
+ cursor: pointer;
510
+ text-align: center;
511
+ padding: 7px 0;
512
+ margin-right: 3px;
513
+ }
514
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtn:last-child {
515
+ margin-right: 0;
516
+ }
517
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtn.emgpsBtnDisable {
518
+ border: 1px solid #999;
519
+ color: #999;
520
+ cursor: not-allowed;
521
+ }
522
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtn.emgpsBtnActive {
523
+ border: 1px solid var(--adm-color-primary);
524
+ color: var(--adm-color-primary);
525
+ }
526
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtnNo {
527
+ display: none;
528
+ }
@@ -0,0 +1,36 @@
1
+ #Easy3wMPagination .easy3wMGridPageStepper {
2
+ display: -ms-flexbox;
3
+ display: flex;
4
+ -ms-flex-direction: row;
5
+ flex-direction: row;
6
+ -ms-flex-align: center;
7
+ align-items: center;
8
+ -ms-flex-pack: justify;
9
+ justify-content: space-between;
10
+ padding: 12px;
11
+ }
12
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtn {
13
+ -ms-flex: 1;
14
+ flex: 1;
15
+ border: 1px solid #000;
16
+ color: #000;
17
+ cursor: pointer;
18
+ text-align: center;
19
+ padding: 7px 0;
20
+ margin-right: 3px;
21
+ }
22
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtn:last-child {
23
+ margin-right: 0;
24
+ }
25
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtn.emgpsBtnDisable {
26
+ border: 1px solid #999;
27
+ color: #999;
28
+ cursor: not-allowed;
29
+ }
30
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtn.emgpsBtnActive {
31
+ border: 1px solid var(--adm-color-primary);
32
+ color: var(--adm-color-primary);
33
+ }
34
+ #Easy3wMPagination .easy3wMGridPageStepper .emgpsBtnNo {
35
+ display: none;
36
+ }
@@ -0,0 +1,283 @@
1
+ 'use strict';
2
+
3
+ exports.__esModule = true;
4
+
5
+ var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
6
+
7
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
8
+
9
+ var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
10
+
11
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
12
+
13
+ var _inherits2 = require('babel-runtime/helpers/inherits');
14
+
15
+ var _inherits3 = _interopRequireDefault(_inherits2);
16
+
17
+ var _react = require('react');
18
+
19
+ var _react2 = _interopRequireDefault(_react);
20
+
21
+ var _dva = require('dva');
22
+
23
+ var _antdMobileIcons = require('antd-mobile-icons');
24
+
25
+ var _Easy3wMCard = require('../Easy3wMCard');
26
+
27
+ var _Easy3wMCard2 = _interopRequireDefault(_Easy3wMCard);
28
+
29
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
30
+
31
+ var Easy3wMPagination = function (_PureComponent) {
32
+ (0, _inherits3['default'])(Easy3wMPagination, _PureComponent);
33
+
34
+ function Easy3wMPagination(props) {
35
+ (0, _classCallCheck3['default'])(this, Easy3wMPagination);
36
+
37
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _PureComponent.call(this, props));
38
+
39
+ _this.onChange = function (num, notFetchFlag) {
40
+ var _this$props = _this.props,
41
+ intData = _this$props.intData,
42
+ touchFetch = _this$props.touchFetch;
43
+
44
+ var intTotalPage = Math.ceil(intData / 10);
45
+ // const intTotalPage = 99999;
46
+ var offset = _this.state.offset;
47
+
48
+ if (typeof num === 'string') {
49
+ offset += Number(num);
50
+ } else {
51
+ offset = num;
52
+ }
53
+ if (offset < 1) {
54
+ offset = 1;
55
+ } else if (offset > intTotalPage) {
56
+ offset = intTotalPage;
57
+ }
58
+ _this.setState({
59
+ offset: offset // 当前页
60
+ }, function () {
61
+ if (notFetchFlag) {// true 不查询 false 查询
62
+ // 不查询
63
+ } else if (touchFetch && typeof touchFetch === 'function') {
64
+ touchFetch();
65
+ }
66
+ });
67
+ };
68
+
69
+ _this.touchCreatePageNum = function (intTotalPage, offset, index) {
70
+ var btnNum = intTotalPage > 999 ? 5 : 7;
71
+ /*
72
+ intTotalPage 总页数
73
+ offset 当前分页
74
+ btnNum 按钮数量
75
+ intTotalPage <= btnNum
76
+ <,1,2,3,4,5,6,7,> 删除6,7
77
+ intTotalPage > btnNum
78
+ offset - 3 <= 1
79
+ <,1,2,3,4,5,+5,intTotalPage,> 删除第三及倒数第三个按钮
80
+ intTotalPage > btnNum
81
+ offset - 3 > 1 && offset + 3 < intTotalPage
82
+ <,1,-5,6,7,8,+5,intTotalPage,> 删除第三及倒数第三个按钮
83
+ intTotalPage > btnNum
84
+ offset - 3 > 1 && offset + 3 >= intTotalPage
85
+ <,1,-5,6,7,8,9,intTotalPage,> 删除第三及倒数第三个按钮
86
+ */
87
+ if (intTotalPage <= btnNum) {
88
+ return index;
89
+ } else if (btnNum === 5 && intTotalPage > btnNum && offset - 2 < 1) {
90
+ if (index === 4) {
91
+ return '+5';
92
+ } else {
93
+ return index;
94
+ }
95
+ } else if (btnNum === 5 && intTotalPage > btnNum && offset - 2 >= 1 && offset + 2 <= intTotalPage) {
96
+ if (index === 4) {
97
+ return '+5';
98
+ } else if (index === 2) {
99
+ return '-5';
100
+ } else {
101
+ return offset;
102
+ }
103
+ } else if (btnNum === 5 && offset - 2 >= 1 && offset + 2 > intTotalPage) {
104
+ if (index === 2) {
105
+ // <1,-5,6,7,8>
106
+ return '-5';
107
+ } else if (index === 3) {
108
+ return intTotalPage - 2;
109
+ } else if (index === 4) {
110
+ return intTotalPage - 1;
111
+ }
112
+ } else if (btnNum === 7 && intTotalPage > btnNum && offset - 3 <= 1) {
113
+ if (index === 6) {
114
+ // 1,2,3,4,5,+5,intTotalPage
115
+ return '+5';
116
+ } else {
117
+ return index;
118
+ }
119
+ } else if (btnNum === 7 && intTotalPage > btnNum && offset - 3 > 1 && offset + 3 < intTotalPage) {
120
+ if (index === 2) {
121
+ return '-5';
122
+ } else if (index === 3) {
123
+ return offset - 1;
124
+ } else if (index === 4) {
125
+ return offset;
126
+ } else if (index === 5) {
127
+ return offset + 1;
128
+ } else if (index === 6) {
129
+ return '+5';
130
+ }
131
+ } else if (btnNum === 7 && intTotalPage > btnNum && offset - 3 > 1 && offset + 3 >= intTotalPage) {
132
+ if (index === 2) {
133
+ return '-5';
134
+ } else if (index === 3) {
135
+ return intTotalPage - 4;
136
+ } else if (index === 4) {
137
+ return intTotalPage - 3;
138
+ } else if (index === 5) {
139
+ return intTotalPage - 2;
140
+ } else if (index === 6) {
141
+ return intTotalPage - 1;
142
+ }
143
+ }
144
+ };
145
+
146
+ var bidPureComponent = _this.props.bidPureComponent;
147
+
148
+ if (bidPureComponent && typeof bidPureComponent === 'function') {
149
+ bidPureComponent(_this);
150
+ }
151
+ _this.state = {
152
+ offset: 1 // 当前页
153
+ };
154
+ return _this;
155
+ }
156
+
157
+ Easy3wMPagination.prototype.componentDidMount = function componentDidMount() {};
158
+
159
+ Easy3wMPagination.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
160
+ var offset = this.state.offset;
161
+ var intData = nextProps.intData;
162
+ // const { intData } = this.props;
163
+
164
+ var intTotalPage = Math.ceil(intData / 10);
165
+ // 查询之后发现,当前页数大于最大页数 (情况:1、录入查询条件,直接选择了最后一个分页,最终当前页数大于最大页数)
166
+ if (intData !== this.props.intData && offset > intTotalPage) {
167
+ this.setState({
168
+ offset: intTotalPage
169
+ });
170
+ }
171
+ };
172
+
173
+ Easy3wMPagination.prototype.componentWillUnmount = function componentWillUnmount() {};
174
+ // --------------------------------------------- 分页 start ---------------------------------------------
175
+ // 切换页数
176
+
177
+ // 生成分页数字
178
+
179
+
180
+ // --------------------------------------------- 分页 end -----------------------------------------------
181
+ Easy3wMPagination.prototype.render = function render() {
182
+ var _this2 = this;
183
+
184
+ var intData = this.props.intData;
185
+ var offset = this.state.offset;
186
+
187
+ var intTotalPage = Math.ceil(intData / 10);
188
+ var btn2 = this.touchCreatePageNum(intTotalPage, offset, 2);
189
+ var btnText2 = typeof btn2 === 'string' ? _react2['default'].createElement(_antdMobileIcons.MoreOutline, null) : btn2;
190
+ var btn3 = this.touchCreatePageNum(intTotalPage, offset, 3);
191
+ var btnText3 = typeof btn3 === 'string' ? _react2['default'].createElement(_antdMobileIcons.MoreOutline, null) : btn3;
192
+ var btn4 = this.touchCreatePageNum(intTotalPage, offset, 4);
193
+ var btnText4 = typeof btn4 === 'string' ? _react2['default'].createElement(_antdMobileIcons.MoreOutline, null) : btn4;
194
+ var btn5 = this.touchCreatePageNum(intTotalPage, offset, 5);
195
+ var btnText5 = typeof btn5 === 'string' ? _react2['default'].createElement(_antdMobileIcons.MoreOutline, null) : btn5;
196
+ var btn6 = this.touchCreatePageNum(intTotalPage, offset, 6);
197
+ var btnText6 = typeof btn6 === 'string' ? _react2['default'].createElement(_antdMobileIcons.MoreOutline, null) : btn6;
198
+ return _react2['default'].createElement(
199
+ 'div',
200
+ { id: 'Easy3wMPagination' },
201
+ _react2['default'].createElement(
202
+ _Easy3wMCard2['default'],
203
+ null,
204
+ _react2['default'].createElement(
205
+ 'div',
206
+ { className: 'easy3wMGridPageStepper' },
207
+ _react2['default'].createElement(
208
+ 'span',
209
+ { className: 'emgpsBtn ' + (offset === 1 ? 'emgpsBtnDisable' : ''), onClick: offset === 1 ? function () {} : function () {
210
+ return _this2.onChange(offset - 1);
211
+ } },
212
+ _react2['default'].createElement(_antdMobileIcons.LeftOutline, null)
213
+ ),
214
+ _react2['default'].createElement(
215
+ 'span',
216
+ { className: 'emgpsBtn ' + (offset === 1 ? 'emgpsBtnActive' : ''), onClick: offset === 1 ? function () {} : function () {
217
+ return _this2.onChange(1);
218
+ } },
219
+ '1'
220
+ ),
221
+ _react2['default'].createElement(
222
+ 'span',
223
+ { className: 'emgpsBtn ' + (offset === btn2 ? 'emgpsBtnActive' : '') + ' ' + (btn2 >= intTotalPage ? 'emgpsBtnNo' : ''), onClick: offset === btn2 ? function () {} : function () {
224
+ return _this2.onChange(btn2);
225
+ } },
226
+ btnText2
227
+ ),
228
+ _react2['default'].createElement(
229
+ 'span',
230
+ { className: 'emgpsBtn ' + (offset === btn3 ? 'emgpsBtnActive' : '') + ' ' + (btn3 >= intTotalPage ? 'emgpsBtnNo' : ''), onClick: offset === btn3 ? function () {} : function () {
231
+ return _this2.onChange(btn3);
232
+ } },
233
+ btnText3
234
+ ),
235
+ _react2['default'].createElement(
236
+ 'span',
237
+ { className: 'emgpsBtn ' + (offset === btn4 ? 'emgpsBtnActive' : '') + ' ' + (btn4 >= intTotalPage ? 'emgpsBtnNo' : ''), onClick: offset === btn4 ? function () {} : function () {
238
+ return _this2.onChange(btn4);
239
+ } },
240
+ btnText4
241
+ ),
242
+ _react2['default'].createElement(
243
+ 'span',
244
+ { className: 'emgpsBtn ' + (offset === btn5 ? 'emgpsBtnActive' : '') + ' ' + (btn5 >= intTotalPage || intTotalPage > 999 ? 'emgpsBtnNo' : ''), onClick: offset === btn5 ? function () {} : function () {
245
+ return _this2.onChange(btn5);
246
+ } },
247
+ btnText5
248
+ ),
249
+ _react2['default'].createElement(
250
+ 'span',
251
+ { className: 'emgpsBtn ' + (offset === btn6 ? 'emgpsBtnActive' : '') + ' ' + (btn6 >= intTotalPage || intTotalPage > 999 ? 'emgpsBtnNo' : ''), onClick: offset === btn6 ? function () {} : function () {
252
+ return _this2.onChange(btn6);
253
+ } },
254
+ btnText6
255
+ ),
256
+ _react2['default'].createElement(
257
+ 'span',
258
+ { className: 'emgpsBtn ' + (offset === intTotalPage ? 'emgpsBtnActive' : '') + ' ' + (intTotalPage > 1 ? '' : 'emgpsBtnNo'), onClick: offset === intTotalPage ? function () {} : function () {
259
+ return _this2.onChange(intTotalPage);
260
+ } },
261
+ intTotalPage
262
+ ),
263
+ _react2['default'].createElement(
264
+ 'span',
265
+ { className: 'emgpsBtn ' + (offset === intTotalPage ? 'emgpsBtnDisable' : ''), onClick: offset === intTotalPage ? function () {} : function () {
266
+ return _this2.onChange(offset + 1);
267
+ } },
268
+ _react2['default'].createElement(_antdMobileIcons.RightOutline, null)
269
+ )
270
+ )
271
+ )
272
+ );
273
+ };
274
+
275
+ return Easy3wMPagination;
276
+ }(_react.PureComponent);
277
+
278
+ exports['default'] = (0, _dva.connect)(function (state) {
279
+ return {
280
+ loading: state.loading
281
+ };
282
+ })(Easy3wMPagination);
283
+ module.exports = exports['default'];
package/lib/index.js CHANGED
@@ -209,6 +209,15 @@ Object.defineProperty(exports, 'Easy3wMPageIndicator', {
209
209
  }
210
210
  });
211
211
 
212
+ var _Easy3wMPagination = require('./Easy3wMPagination');
213
+
214
+ Object.defineProperty(exports, 'Easy3wMPagination', {
215
+ enumerable: true,
216
+ get: function get() {
217
+ return _interopRequireDefault(_Easy3wMPagination)['default'];
218
+ }
219
+ });
220
+
212
221
  var _Easy3wMSteps = require('./Easy3wMSteps');
213
222
 
214
223
  Object.defineProperty(exports, 'Easy3wMSteps', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy3wmui",
3
- "version": "0.0.42",
3
+ "version": "0.0.43-beta2",
4
4
  "description": "easy3wmui components for react",
5
5
  "keywords": [
6
6
  "react",