easy3wmui 0.0.42-beta1 → 0.0.42-beta3
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 +17 -4
- package/assets/mFormPage.css +6 -0
- package/assets/mGridPage.css +3 -4
- package/lib/Easy3wMButton/index.less +3 -3
- package/lib/Easy3wMCaptcha/index.js +80 -80
- package/lib/Easy3wMCard/index.less +3 -3
- package/lib/Easy3wMFormPage/index.js +1 -1
- package/lib/Easy3wMFormPage/index.less +45 -46
- package/lib/Easy3wMGlobalFooter/index.less +1 -1
- package/lib/Easy3wMGridPage/index copy.js +298 -0
- package/lib/Easy3wMGridPage/index.js +193 -186
- package/lib/Easy3wMGridPage/index.less +5 -5
- package/lib/Easy3wMSpin/index.less +13 -13
- package/lib/Easy3wMUserLayout/index.less +9 -9
- package/package.json +1 -1
- package/lib/Easy3wMForm/index.less +0 -9
package/assets/index.css
CHANGED
|
@@ -72,6 +72,14 @@
|
|
|
72
72
|
border-top: 0;
|
|
73
73
|
border-bottom: 0;
|
|
74
74
|
}
|
|
75
|
+
:root:root .adm-form .adm-list-item-content-extra {
|
|
76
|
+
padding: 12px 0;
|
|
77
|
+
}
|
|
78
|
+
:root:root .adm-form .adm-form-item.adm-form-item-horizontal .adm-list-item-content-extra {
|
|
79
|
+
-ms-flex-item-align: auto;
|
|
80
|
+
-ms-grid-row-align: auto;
|
|
81
|
+
align-self: auto;
|
|
82
|
+
}
|
|
75
83
|
:root:root .adm-form .adm-form-footer {
|
|
76
84
|
padding: 12px;
|
|
77
85
|
}
|
|
@@ -225,17 +233,22 @@
|
|
|
225
233
|
-ms-flex: none;
|
|
226
234
|
flex: none;
|
|
227
235
|
}
|
|
236
|
+
#Easy3wMFormPage .adm-picker-view-mask {
|
|
237
|
+
z-index: 1;
|
|
238
|
+
}
|
|
239
|
+
#Easy3wMFormPage .adm-stepper {
|
|
240
|
+
width: 100%;
|
|
241
|
+
}
|
|
228
242
|
#Easy3wMGridPage .easy3wMGridPageStepper {
|
|
229
243
|
display: -ms-flexbox;
|
|
230
244
|
display: flex;
|
|
231
245
|
-ms-flex-direction: row;
|
|
232
246
|
flex-direction: row;
|
|
233
|
-
-ms-flex-align: center;
|
|
234
|
-
align-items: center;
|
|
235
247
|
-ms-flex-pack: justify;
|
|
236
248
|
justify-content: space-between;
|
|
237
|
-
|
|
238
|
-
|
|
249
|
+
-ms-flex-align: center;
|
|
250
|
+
align-items: center;
|
|
251
|
+
background: #fff;
|
|
239
252
|
}
|
|
240
253
|
#Easy3wMGridPage .adm-collapse-panel-content > .adm-collapse-panel-content-inner > .adm-list-item > .adm-list-item-content > .adm-list-item-content-main {
|
|
241
254
|
-ms-flex: auto;
|
package/assets/mFormPage.css
CHANGED
package/assets/mGridPage.css
CHANGED
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
display: flex;
|
|
4
4
|
-ms-flex-direction: row;
|
|
5
5
|
flex-direction: row;
|
|
6
|
-
-ms-flex-align: center;
|
|
7
|
-
align-items: center;
|
|
8
6
|
-ms-flex-pack: justify;
|
|
9
7
|
justify-content: space-between;
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
-ms-flex-align: center;
|
|
9
|
+
align-items: center;
|
|
10
|
+
background: #fff;
|
|
12
11
|
}
|
|
13
12
|
#Easy3wMGridPage .adm-collapse-panel-content > .adm-collapse-panel-content-inner > .adm-list-item > .adm-list-item-content > .adm-list-item-content-main {
|
|
14
13
|
-ms-flex: auto;
|
|
@@ -31,91 +31,91 @@ var _antdMobile = require('antd-mobile');
|
|
|
31
31
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
32
32
|
|
|
33
33
|
var Easy3wMCaptcha = function (_Component) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
34
|
+
(0, _inherits3['default'])(Easy3wMCaptcha, _Component);
|
|
35
|
+
|
|
36
|
+
function Easy3wMCaptcha(props) {
|
|
37
|
+
(0, _classCallCheck3['default'])(this, Easy3wMCaptcha);
|
|
38
|
+
|
|
39
|
+
var _this = (0, _possibleConstructorReturn3['default'])(this, _Component.call(this, props));
|
|
40
|
+
|
|
41
|
+
_this.renderCode = function () {
|
|
42
|
+
var expression = '';
|
|
43
|
+
var result = '';
|
|
44
|
+
if (_this.props.captchaType === 'Calculation') {
|
|
45
|
+
// 计算
|
|
46
|
+
result = 0;
|
|
47
|
+
var Calpre = Math.round(Math.random() * 100);
|
|
48
|
+
var Calafter = Math.round(Math.random() * 100);
|
|
49
|
+
var codeCal = ['-', '+', 'x'];
|
|
50
|
+
var i = Math.round(Math.random() * 2);
|
|
51
|
+
switch (codeCal[i]) {
|
|
52
|
+
case '-':
|
|
53
|
+
expression = Calpre + '-' + Calafter;
|
|
54
|
+
result = Calpre - Calafter;
|
|
55
|
+
break;
|
|
56
|
+
case '+':
|
|
57
|
+
expression = Calpre + '+' + Calafter;
|
|
58
|
+
result = Calpre + Calafter;
|
|
59
|
+
break;
|
|
60
|
+
case 'x':
|
|
61
|
+
expression = Calpre + 'x' + Calafter;
|
|
62
|
+
result = Calpre * Calafter;
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
} else if (_this.props.captchaType === 'Normal') {
|
|
68
|
+
// 正常
|
|
69
|
+
result = '';
|
|
70
|
+
var strBx = 'ABCDEFGHJKMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz23456789';
|
|
71
|
+
var codeNormal = strBx.split('');
|
|
72
|
+
for (var _i = 0; _i < _this.props.csize; _i += 1) {
|
|
73
|
+
result += codeNormal[Math.round(Math.random() * (strBx.length - 1))];
|
|
74
|
+
}
|
|
75
|
+
expression = result.toLowerCase(); // 表达式小写化
|
|
76
|
+
}
|
|
77
|
+
_this.props.touchCaptchaResult(expression); // 将验证码返回给调用组件
|
|
78
|
+
_this.setState({
|
|
79
|
+
expression: expression
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
_this.state = {
|
|
84
|
+
expression: '' // 表达示
|
|
85
|
+
};
|
|
86
|
+
return _this;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
Easy3wMCaptcha.prototype.componentDidMount = function componentDidMount() {
|
|
90
|
+
this.renderCode();
|
|
91
|
+
};
|
|
92
|
+
// 生成随机码
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
Easy3wMCaptcha.prototype.render = function render() {
|
|
96
|
+
var expression = this.state.expression;
|
|
97
|
+
|
|
98
|
+
return _react2['default'].createElement(
|
|
99
|
+
_button2['default'],
|
|
100
|
+
{
|
|
101
|
+
size: 'small',
|
|
102
|
+
onClick: this.renderCode,
|
|
103
|
+
htmlType: 'button'
|
|
104
|
+
},
|
|
105
|
+
expression
|
|
106
|
+
);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return Easy3wMCaptcha;
|
|
110
110
|
}(_react.Component);
|
|
111
111
|
|
|
112
112
|
Easy3wMCaptcha.defaultProps = {
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
csize: 4, // 验证码长度
|
|
114
|
+
captchaType: 'Normal' // 正常验证码类型
|
|
115
115
|
};
|
|
116
116
|
Easy3wMCaptcha.propTypes = { // 限制变量类型
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
csize: _propTypes2['default'].number,
|
|
118
|
+
captchaType: _propTypes2['default'].oneOf(['Calculation', 'Normal'])
|
|
119
119
|
};
|
|
120
120
|
exports['default'] = Easy3wMCaptcha;
|
|
121
121
|
module.exports = exports['default'];
|
|
@@ -176,7 +176,7 @@ var Easy3wMFormPage = function (_Component) {
|
|
|
176
176
|
value = (0, _moment2['default'])(value, dateWeekDayFormat).format(dateWeekDayZHCNFormat);
|
|
177
177
|
} else if (numberFormat) {
|
|
178
178
|
// 数字格式化千分位化
|
|
179
|
-
(0, _numeral2['default'])(value).format('0,0.00');
|
|
179
|
+
value = (0, _numeral2['default'])(value).format('0,0.00');
|
|
180
180
|
}
|
|
181
181
|
} else {
|
|
182
182
|
// 编辑
|
|
@@ -1,49 +1,48 @@
|
|
|
1
1
|
#Easy3wMFormPage {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
2
|
+
.pointer { // 鼠标形状:手形
|
|
3
|
+
cursor: pointer;
|
|
4
|
+
}
|
|
5
|
+
.pointerGray { // 鼠标形状:手形 文字:灰色
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
color: #999
|
|
8
|
+
}
|
|
9
|
+
.adm-input-element {
|
|
10
|
+
border: 1px solid #d9d9d9;
|
|
11
|
+
}
|
|
12
|
+
.adm-input-element:focus, .adm-input-element:hover {
|
|
13
|
+
border-color: var(--adm-color-primary);
|
|
14
|
+
}
|
|
15
|
+
.adm-text-area-element {
|
|
16
|
+
border: 1px solid #d9d9d9;
|
|
17
|
+
}
|
|
18
|
+
.adm-text-area-element:focus, .adm-text-area-element:hover {
|
|
19
|
+
border-color: var(--adm-color-primary);
|
|
20
|
+
}
|
|
21
|
+
.adm-rate {
|
|
22
|
+
--star-size: 14px
|
|
23
|
+
}
|
|
24
|
+
.adm-radio, .adm-checkbox {
|
|
25
|
+
--icon-size: 14px;
|
|
26
|
+
--font-size: 14px;
|
|
27
|
+
}
|
|
28
|
+
.adm-switch {
|
|
29
|
+
--height: 20.8px;
|
|
30
|
+
}
|
|
31
|
+
.adm-slider {
|
|
32
|
+
padding: 0;
|
|
33
|
+
}
|
|
34
|
+
.adm-list-default .adm-list-body {
|
|
35
|
+
border-top: 0;
|
|
36
|
+
border-bottom: 0;
|
|
37
|
+
}
|
|
38
|
+
.adm-list-item {
|
|
39
|
+
border-bottom: var(--border-bottom);
|
|
40
|
+
margin: 0 12px;
|
|
41
|
+
padding-left: 0;
|
|
42
42
|
word-break: break-word;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
43
|
+
}
|
|
44
|
+
.adm-list-item-content {
|
|
45
|
+
border-top: 0;
|
|
46
|
+
padding-right: 0;
|
|
47
|
+
}
|
|
49
48
|
}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
var _extends2 = require('babel-runtime/helpers/extends');
|
|
6
|
+
|
|
7
|
+
var _extends3 = _interopRequireDefault(_extends2);
|
|
8
|
+
|
|
9
|
+
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
|
10
|
+
|
|
11
|
+
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
|
12
|
+
|
|
13
|
+
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
|
|
14
|
+
|
|
15
|
+
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
|
16
|
+
|
|
17
|
+
var _inherits2 = require('babel-runtime/helpers/inherits');
|
|
18
|
+
|
|
19
|
+
var _inherits3 = _interopRequireDefault(_inherits2);
|
|
20
|
+
|
|
21
|
+
var _react = require('react');
|
|
22
|
+
|
|
23
|
+
var _react2 = _interopRequireDefault(_react);
|
|
24
|
+
|
|
25
|
+
var _numeral = require('numeral');
|
|
26
|
+
|
|
27
|
+
var _numeral2 = _interopRequireDefault(_numeral);
|
|
28
|
+
|
|
29
|
+
var _easy3wmui = require('easy3wmui');
|
|
30
|
+
|
|
31
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
32
|
+
|
|
33
|
+
// import Easy3wMCollapse from '../Easy3wMCollapse';
|
|
34
|
+
// import Easy3wMEmpty from '../Easy3wMEmpty';
|
|
35
|
+
// import Easy3wMStepper from '../Easy3wMStepper';
|
|
36
|
+
// import Easy3wMList from '../Easy3wMList';
|
|
37
|
+
// import Easy3wMCard from '../Easy3wMCard';
|
|
38
|
+
// import Easy3wMSpace from '../Easy3wMSpace';
|
|
39
|
+
|
|
40
|
+
var Panel = _easy3wmui.Easy3wMCollapse.Panel;
|
|
41
|
+
var Item = _easy3wmui.Easy3wMList.Item;
|
|
42
|
+
|
|
43
|
+
var Easy3wMGridPage = function (_Component) {
|
|
44
|
+
(0, _inherits3['default'])(Easy3wMGridPage, _Component);
|
|
45
|
+
|
|
46
|
+
function Easy3wMGridPage(props) {
|
|
47
|
+
(0, _classCallCheck3['default'])(this, Easy3wMGridPage);
|
|
48
|
+
|
|
49
|
+
var _this = (0, _possibleConstructorReturn3['default'])(this, _Component.call(this, props));
|
|
50
|
+
|
|
51
|
+
_this.onChange = function (current) {
|
|
52
|
+
_this.setState({
|
|
53
|
+
currentIndex: current
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
_this.touchFormatData = function (dataItem, columnItem) {
|
|
58
|
+
var key = columnItem.key,
|
|
59
|
+
dataIndex = columnItem.dataIndex,
|
|
60
|
+
numberFormat = columnItem.numberFormat;
|
|
61
|
+
|
|
62
|
+
var fieldId = dataIndex || key;
|
|
63
|
+
var value = dataItem[fieldId];
|
|
64
|
+
if (value || value === false || value === 0) {
|
|
65
|
+
// value值存在 Boolean()值为false的7个特殊值 undefined, null, false, NaN, '', 0, -0
|
|
66
|
+
if (numberFormat) {
|
|
67
|
+
var thousandthValue = (0, _numeral2['default'])(dataItem[fieldId]).format('0,0.00');
|
|
68
|
+
value = thousandthValue;
|
|
69
|
+
}
|
|
70
|
+
return value;
|
|
71
|
+
} else {
|
|
72
|
+
// value值不存在
|
|
73
|
+
return '';
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
_this.renderEasy3wMGridPage = function (dataList) {
|
|
78
|
+
var currentIndex = _this.state.currentIndex;
|
|
79
|
+
var _this$props = _this.props,
|
|
80
|
+
_this$props$panelProp = _this$props.panelProps,
|
|
81
|
+
panelProps = _this$props$panelProp === undefined ? {} : _this$props$panelProp,
|
|
82
|
+
_this$props$listProps = _this$props.listProps,
|
|
83
|
+
listProps = _this$props$listProps === undefined ? {} : _this$props$listProps,
|
|
84
|
+
_this$props$itemProps = _this$props.itemProps,
|
|
85
|
+
itemProps = _this$props$itemProps === undefined ? {} : _this$props$itemProps,
|
|
86
|
+
_this$props$columns = _this$props.columns,
|
|
87
|
+
columns = _this$props$columns === undefined ? [] : _this$props$columns,
|
|
88
|
+
panelTitle = _this$props.panelTitle,
|
|
89
|
+
panelKey = _this$props.panelKey,
|
|
90
|
+
_this$props$expandedR = _this$props.expandedRowRender,
|
|
91
|
+
expandedRowRender = _this$props$expandedR === undefined ? function () {} : _this$props$expandedR,
|
|
92
|
+
collapseFlag = _this$props.collapseFlag;
|
|
93
|
+
// collapseProps 折叠面板容器参数
|
|
94
|
+
// panelProps 折叠面板参数
|
|
95
|
+
// emptyProps 空状态参数
|
|
96
|
+
// stepperProps 步进器参数
|
|
97
|
+
// listProps 列表参数
|
|
98
|
+
// itemProps 列表项参数
|
|
99
|
+
// columns 字段列表
|
|
100
|
+
// dataList 列表数据
|
|
101
|
+
// totalResult 列表记录数量
|
|
102
|
+
// panelTitle panel标题 数据类型:string或function
|
|
103
|
+
// panelKey panel唯一标识 数据类型:string或function
|
|
104
|
+
// expandedRowRender 可扩展行
|
|
105
|
+
|
|
106
|
+
if (collapseFlag) {
|
|
107
|
+
return dataList.map(function (item, index) {
|
|
108
|
+
var title = typeof panelTitle === 'function' ? panelTitle(item, index) : item[panelTitle] || '';
|
|
109
|
+
var key = typeof panelKey === 'function' ? panelKey(item, index) : item[panelKey] || index;
|
|
110
|
+
return (// 折叠面板
|
|
111
|
+
_react2['default'].createElement(
|
|
112
|
+
Panel,
|
|
113
|
+
(0, _extends3['default'])({}, panelProps, { title: title, key: key }),
|
|
114
|
+
_this.renderEasy3wMGridPageItem(item, index)
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
return _this.renderEasy3wMGridPageItem(dataList[currentIndex - 1], currentIndex - 1);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
_this.renderEasy3wMGridPageItem = function (dataItem, index) {
|
|
124
|
+
var children = dataItem.children;
|
|
125
|
+
var _this$props2 = _this.props,
|
|
126
|
+
_this$props2$panelPro = _this$props2.panelProps,
|
|
127
|
+
panelProps = _this$props2$panelPro === undefined ? {} : _this$props2$panelPro,
|
|
128
|
+
_this$props2$listProp = _this$props2.listProps,
|
|
129
|
+
listProps = _this$props2$listProp === undefined ? {} : _this$props2$listProp,
|
|
130
|
+
_this$props2$itemProp = _this$props2.itemProps,
|
|
131
|
+
itemProps = _this$props2$itemProp === undefined ? {} : _this$props2$itemProp,
|
|
132
|
+
_this$props2$columns = _this$props2.columns,
|
|
133
|
+
columns = _this$props2$columns === undefined ? [] : _this$props2$columns,
|
|
134
|
+
panelTitle = _this$props2.panelTitle,
|
|
135
|
+
panelKey = _this$props2.panelKey,
|
|
136
|
+
_this$props2$expanded = _this$props2.expandedRowRender,
|
|
137
|
+
expandedRowRender = _this$props2$expanded === undefined ? function () {} : _this$props2$expanded;
|
|
138
|
+
// collapseProps 折叠面板容器参数
|
|
139
|
+
// panelProps 折叠面板参数
|
|
140
|
+
// emptyProps 空状态参数
|
|
141
|
+
// stepperProps 步进器参数
|
|
142
|
+
// listProps 列表参数
|
|
143
|
+
// itemProps 列表项参数
|
|
144
|
+
// columns 字段列表
|
|
145
|
+
// dataList 列表数据
|
|
146
|
+
// totalResult 列表记录数量
|
|
147
|
+
// panelTitle panel标题
|
|
148
|
+
// panelKey panel唯一标识
|
|
149
|
+
// expandedRowRender 可扩展行
|
|
150
|
+
|
|
151
|
+
return (// 单项数据
|
|
152
|
+
_react2['default'].createElement(
|
|
153
|
+
_easy3wmui.Easy3wMList,
|
|
154
|
+
listProps,
|
|
155
|
+
columns.map(function (column) {
|
|
156
|
+
if (column.children) {
|
|
157
|
+
return _react2['default'].createElement(
|
|
158
|
+
_easy3wmui.Easy3wMList,
|
|
159
|
+
(0, _extends3['default'])({ mode: 'card' }, listProps, { header: column.title }),
|
|
160
|
+
column.children.map(function (childrenColumn) {
|
|
161
|
+
var type = childrenColumn.type;
|
|
162
|
+
|
|
163
|
+
var childrenFieldId = childrenColumn.dataIndex || childrenColumn.key;
|
|
164
|
+
var childrenExtra = childrenColumn.render ? childrenColumn.render(dataItem[childrenFieldId], dataItem, index) : _this.touchFormatData(dataItem, childrenColumn);
|
|
165
|
+
if (type === 'longText') {
|
|
166
|
+
return _react2['default'].createElement(Item, (0, _extends3['default'])({ className: 'e3wmLongText' }, itemProps, { title: childrenColumn.title, description: childrenExtra }));
|
|
167
|
+
} else {
|
|
168
|
+
return _react2['default'].createElement(Item, (0, _extends3['default'])({}, itemProps, { title: childrenColumn.title, extra: childrenExtra }));
|
|
169
|
+
}
|
|
170
|
+
})
|
|
171
|
+
);
|
|
172
|
+
} else {
|
|
173
|
+
var title = column.title,
|
|
174
|
+
key = column.key,
|
|
175
|
+
dataIndex = column.dataIndex,
|
|
176
|
+
type = column.type;
|
|
177
|
+
|
|
178
|
+
var fieldId = dataIndex || key;
|
|
179
|
+
var extra = column.render ? column.render(dataItem[fieldId], dataItem, index) : _this.touchFormatData(dataItem, column);
|
|
180
|
+
if (type === 'longText') {
|
|
181
|
+
return _react2['default'].createElement(Item, (0, _extends3['default'])({ className: 'e3wmLongText' }, itemProps, { title: title, description: extra }));
|
|
182
|
+
} else {
|
|
183
|
+
return _react2['default'].createElement(Item, (0, _extends3['default'])({}, itemProps, { title: title, extra: extra }));
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}),
|
|
187
|
+
children ? _this.renderEasy3wMGridPage(children) : '',
|
|
188
|
+
expandedRowRender ? expandedRowRender(dataItem) : ''
|
|
189
|
+
)
|
|
190
|
+
);
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
_this.state = {
|
|
194
|
+
currentIndex: 1, // 当前显示内容数据的索引
|
|
195
|
+
paginationInfo: { // 分页
|
|
196
|
+
offset: 1,
|
|
197
|
+
limit: 10
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
return _this;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
Easy3wMGridPage.prototype.componentWillUnmount = function componentWillUnmount() {};
|
|
204
|
+
// 切换行数据
|
|
205
|
+
|
|
206
|
+
// 数据格式化
|
|
207
|
+
|
|
208
|
+
// 渲染列表
|
|
209
|
+
|
|
210
|
+
// 渲染列表单项
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
Easy3wMGridPage.prototype.render = function render() {
|
|
214
|
+
var _props = this.props,
|
|
215
|
+
_props$collapseProps = _props.collapseProps,
|
|
216
|
+
collapseProps = _props$collapseProps === undefined ? {} : _props$collapseProps,
|
|
217
|
+
_props$emptyProps = _props.emptyProps,
|
|
218
|
+
emptyProps = _props$emptyProps === undefined ? {} : _props$emptyProps,
|
|
219
|
+
_props$panelProps = _props.panelProps,
|
|
220
|
+
panelProps = _props$panelProps === undefined ? {} : _props$panelProps,
|
|
221
|
+
_props$stepperProps = _props.stepperProps,
|
|
222
|
+
stepperProps = _props$stepperProps === undefined ? {} : _props$stepperProps,
|
|
223
|
+
_props$dataList = _props.dataList,
|
|
224
|
+
dataList = _props$dataList === undefined ? [] : _props$dataList,
|
|
225
|
+
totalResult = _props.totalResult,
|
|
226
|
+
collapseFlag = _props.collapseFlag;
|
|
227
|
+
// collapseProps 折叠面板容器参数
|
|
228
|
+
// panelProps 折叠面板参数
|
|
229
|
+
// emptyProps 空状态参数
|
|
230
|
+
// stepperProps 步进器参数
|
|
231
|
+
// listProps 列表参数
|
|
232
|
+
// itemProps 列表项参数
|
|
233
|
+
// columns 字段列表
|
|
234
|
+
// dataList 列表数据
|
|
235
|
+
// totalResult 列表记录数量
|
|
236
|
+
// panelTitle panel标题
|
|
237
|
+
// panelKey panel唯一标识
|
|
238
|
+
// collapseFlag 是否折叠面板 true 是 false 否
|
|
239
|
+
|
|
240
|
+
var currentIndex = this.state.currentIndex;
|
|
241
|
+
|
|
242
|
+
return _react2['default'].createElement(
|
|
243
|
+
'div',
|
|
244
|
+
{ id: 'Easy3wMGridPage' },
|
|
245
|
+
dataList && dataList.length ? _react2['default'].createElement(
|
|
246
|
+
'div',
|
|
247
|
+
null,
|
|
248
|
+
collapseFlag ? _react2['default'].createElement(
|
|
249
|
+
_easy3wmui.Easy3wMCollapse,
|
|
250
|
+
collapseProps,
|
|
251
|
+
this.renderEasy3wMGridPage(dataList)
|
|
252
|
+
) : _react2['default'].createElement(
|
|
253
|
+
'div',
|
|
254
|
+
null,
|
|
255
|
+
this.renderEasy3wMGridPage(dataList)
|
|
256
|
+
)
|
|
257
|
+
) : // 空状态
|
|
258
|
+
_react2['default'].createElement(
|
|
259
|
+
_easy3wmui.Easy3wMCard,
|
|
260
|
+
null,
|
|
261
|
+
_react2['default'].createElement(_easy3wmui.Easy3wMEmpty, (0, _extends3['default'])({}, emptyProps, { description: emptyProps.description || '暂无数据' }))
|
|
262
|
+
),
|
|
263
|
+
dataList && dataList.length && !collapseFlag ? _react2['default'].createElement(
|
|
264
|
+
_easy3wmui.Easy3wMCard,
|
|
265
|
+
null,
|
|
266
|
+
_react2['default'].createElement(
|
|
267
|
+
'div',
|
|
268
|
+
{ className: 'easy3wMGridPageStepper' },
|
|
269
|
+
_react2['default'].createElement(
|
|
270
|
+
_easy3wmui.Easy3wMSpace,
|
|
271
|
+
null,
|
|
272
|
+
_react2['default'].createElement(
|
|
273
|
+
'span',
|
|
274
|
+
null,
|
|
275
|
+
'\u5171',
|
|
276
|
+
dataList.length,
|
|
277
|
+
'\u6761'
|
|
278
|
+
),
|
|
279
|
+
_react2['default'].createElement(_easy3wmui.Easy3wMStepper, (0, _extends3['default'])({}, stepperProps, {
|
|
280
|
+
step: 1 // 每次改变步数,可以为小数
|
|
281
|
+
, digits: 0 // 格式化到小数点后固定位数,设置为 0 表示格式化到整数
|
|
282
|
+
, min: 1 // 最小值
|
|
283
|
+
, max: dataList.length // 最大值
|
|
284
|
+
, inputReadOnly: true // 输入框是否只读
|
|
285
|
+
, onChange: this.onChange // 变化时的回调
|
|
286
|
+
, value: currentIndex // 当前数,受控值
|
|
287
|
+
}))
|
|
288
|
+
)
|
|
289
|
+
)
|
|
290
|
+
) : null
|
|
291
|
+
);
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
return Easy3wMGridPage;
|
|
295
|
+
}(_react.Component);
|
|
296
|
+
|
|
297
|
+
exports['default'] = Easy3wMGridPage;
|
|
298
|
+
module.exports = exports['default'];
|
|
@@ -30,10 +30,10 @@ var _numeral = require('numeral');
|
|
|
30
30
|
|
|
31
31
|
var _numeral2 = _interopRequireDefault(_numeral);
|
|
32
32
|
|
|
33
|
-
var _antdMobileIcons = require('antd-mobile-icons');
|
|
34
|
-
|
|
35
33
|
var _antdMobile = require('antd-mobile');
|
|
36
34
|
|
|
35
|
+
var _antdMobileIcons = require('antd-mobile-icons');
|
|
36
|
+
|
|
37
37
|
var _easy3wmui = require('easy3wmui');
|
|
38
38
|
|
|
39
39
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
|
|
@@ -56,157 +56,29 @@ var Easy3wMGridPage = function (_Component) {
|
|
|
56
56
|
|
|
57
57
|
var _this = (0, _possibleConstructorReturn3['default'])(this, _Component.call(this, props));
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
_this.setState({
|
|
61
|
-
currentIndex: current
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
_this.touchFormatData = function (dataItem, columnItem) {
|
|
66
|
-
var key = columnItem.key,
|
|
67
|
-
dataIndex = columnItem.dataIndex,
|
|
68
|
-
numberFormat = columnItem.numberFormat;
|
|
69
|
-
|
|
70
|
-
var fieldId = dataIndex || key;
|
|
71
|
-
var value = dataItem[fieldId];
|
|
72
|
-
if (value || value === false || value === 0) {
|
|
73
|
-
// value值存在 Boolean()值为false的7个特殊值 undefined, null, false, NaN, '', 0, -0
|
|
74
|
-
if (numberFormat) {
|
|
75
|
-
var thousandthValue = (0, _numeral2['default'])(dataItem[fieldId]).format('0,0.00');
|
|
76
|
-
value = thousandthValue;
|
|
77
|
-
}
|
|
78
|
-
return value;
|
|
79
|
-
} else {
|
|
80
|
-
// value值不存在
|
|
81
|
-
return '';
|
|
82
|
-
}
|
|
83
|
-
};
|
|
59
|
+
_initialiseProps.call(_this);
|
|
84
60
|
|
|
85
|
-
|
|
86
|
-
var currentIndex = _this.state.currentIndex;
|
|
87
|
-
var _this$props = _this.props,
|
|
88
|
-
_this$props$panelProp = _this$props.panelProps,
|
|
89
|
-
panelProps = _this$props$panelProp === undefined ? {} : _this$props$panelProp,
|
|
90
|
-
_this$props$listProps = _this$props.listProps,
|
|
91
|
-
listProps = _this$props$listProps === undefined ? {} : _this$props$listProps,
|
|
92
|
-
_this$props$itemProps = _this$props.itemProps,
|
|
93
|
-
itemProps = _this$props$itemProps === undefined ? {} : _this$props$itemProps,
|
|
94
|
-
_this$props$columns = _this$props.columns,
|
|
95
|
-
columns = _this$props$columns === undefined ? [] : _this$props$columns,
|
|
96
|
-
panelTitle = _this$props.panelTitle,
|
|
97
|
-
panelKey = _this$props.panelKey,
|
|
98
|
-
_this$props$expandedR = _this$props.expandedRowRender,
|
|
99
|
-
expandedRowRender = _this$props$expandedR === undefined ? function () {} : _this$props$expandedR,
|
|
100
|
-
collapseFlag = _this$props.collapseFlag;
|
|
101
|
-
// collapseProps 折叠面板容器参数
|
|
102
|
-
// panelProps 折叠面板参数
|
|
103
|
-
// emptyProps 空状态参数
|
|
104
|
-
// stepperProps 步进器参数
|
|
105
|
-
// listProps 列表参数
|
|
106
|
-
// itemProps 列表项参数
|
|
107
|
-
// columns 字段列表
|
|
108
|
-
// dataList 列表数据
|
|
109
|
-
// totalResult 列表记录数量
|
|
110
|
-
// panelTitle panel标题 数据类型:string或function
|
|
111
|
-
// panelKey panel唯一标识 数据类型:string或function
|
|
112
|
-
// expandedRowRender 可扩展行
|
|
113
|
-
|
|
114
|
-
if (collapseFlag) {
|
|
115
|
-
return dataList.map(function (item, index) {
|
|
116
|
-
var title = typeof panelTitle === 'function' ? panelTitle(item, index) : item[panelTitle] || '';
|
|
117
|
-
var key = typeof panelKey === 'function' ? panelKey(item, index) : item[panelKey] || index;
|
|
118
|
-
return (// 折叠面板
|
|
119
|
-
_react2['default'].createElement(
|
|
120
|
-
Panel,
|
|
121
|
-
(0, _extends3['default'])({}, panelProps, { title: title, key: key }),
|
|
122
|
-
_this.renderEasy3wMGridPageItem(item, index)
|
|
123
|
-
)
|
|
124
|
-
);
|
|
125
|
-
});
|
|
126
|
-
} else {
|
|
127
|
-
return _this.renderEasy3wMGridPageItem(dataList[currentIndex - 1], currentIndex - 1);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
_this.renderEasy3wMGridPageItem = function (dataItem, index) {
|
|
132
|
-
var children = dataItem.children;
|
|
133
|
-
var _this$props2 = _this.props,
|
|
134
|
-
_this$props2$panelPro = _this$props2.panelProps,
|
|
135
|
-
panelProps = _this$props2$panelPro === undefined ? {} : _this$props2$panelPro,
|
|
136
|
-
_this$props2$listProp = _this$props2.listProps,
|
|
137
|
-
listProps = _this$props2$listProp === undefined ? {} : _this$props2$listProp,
|
|
138
|
-
_this$props2$itemProp = _this$props2.itemProps,
|
|
139
|
-
itemProps = _this$props2$itemProp === undefined ? {} : _this$props2$itemProp,
|
|
140
|
-
_this$props2$columns = _this$props2.columns,
|
|
141
|
-
columns = _this$props2$columns === undefined ? [] : _this$props2$columns,
|
|
142
|
-
panelTitle = _this$props2.panelTitle,
|
|
143
|
-
panelKey = _this$props2.panelKey,
|
|
144
|
-
_this$props2$expanded = _this$props2.expandedRowRender,
|
|
145
|
-
expandedRowRender = _this$props2$expanded === undefined ? function () {} : _this$props2$expanded;
|
|
146
|
-
// collapseProps 折叠面板容器参数
|
|
147
|
-
// panelProps 折叠面板参数
|
|
148
|
-
// emptyProps 空状态参数
|
|
149
|
-
// stepperProps 步进器参数
|
|
150
|
-
// listProps 列表参数
|
|
151
|
-
// itemProps 列表项参数
|
|
152
|
-
// columns 字段列表
|
|
153
|
-
// dataList 列表数据
|
|
154
|
-
// totalResult 列表记录数量
|
|
155
|
-
// panelTitle panel标题
|
|
156
|
-
// panelKey panel唯一标识
|
|
157
|
-
// expandedRowRender 可扩展行
|
|
158
|
-
|
|
159
|
-
return (// 单项数据
|
|
160
|
-
_react2['default'].createElement(
|
|
161
|
-
_easy3wmui.Easy3wMList,
|
|
162
|
-
listProps,
|
|
163
|
-
columns.map(function (column) {
|
|
164
|
-
if (column.children) {
|
|
165
|
-
return _react2['default'].createElement(
|
|
166
|
-
_easy3wmui.Easy3wMList,
|
|
167
|
-
(0, _extends3['default'])({ mode: 'card' }, listProps, { header: column.title }),
|
|
168
|
-
column.children.map(function (childrenColumn) {
|
|
169
|
-
var type = childrenColumn.type;
|
|
170
|
-
|
|
171
|
-
var childrenFieldId = childrenColumn.dataIndex || childrenColumn.key;
|
|
172
|
-
var childrenExtra = childrenColumn.render ? childrenColumn.render(dataItem[childrenFieldId], dataItem, index) : _this.touchFormatData(dataItem, childrenColumn);
|
|
173
|
-
if (type === 'longText') {
|
|
174
|
-
return _react2['default'].createElement(Item, (0, _extends3['default'])({ className: 'e3wmLongText' }, itemProps, { title: childrenColumn.title, description: childrenExtra }));
|
|
175
|
-
} else {
|
|
176
|
-
return _react2['default'].createElement(Item, (0, _extends3['default'])({}, itemProps, { title: childrenColumn.title, extra: childrenExtra }));
|
|
177
|
-
}
|
|
178
|
-
})
|
|
179
|
-
);
|
|
180
|
-
} else {
|
|
181
|
-
var title = column.title,
|
|
182
|
-
key = column.key,
|
|
183
|
-
dataIndex = column.dataIndex,
|
|
184
|
-
type = column.type;
|
|
185
|
-
|
|
186
|
-
var fieldId = dataIndex || key;
|
|
187
|
-
var extra = column.render ? column.render(dataItem[fieldId], dataItem, index) : _this.touchFormatData(dataItem, column);
|
|
188
|
-
if (type === 'longText') {
|
|
189
|
-
return _react2['default'].createElement(Item, (0, _extends3['default'])({ className: 'e3wmLongText' }, itemProps, { title: title, description: extra }));
|
|
190
|
-
} else {
|
|
191
|
-
return _react2['default'].createElement(Item, (0, _extends3['default'])({}, itemProps, { title: title, extra: extra }));
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}),
|
|
195
|
-
children ? _this.renderEasy3wMGridPage(children) : '',
|
|
196
|
-
expandedRowRender ? expandedRowRender(dataItem) : ''
|
|
197
|
-
)
|
|
198
|
-
);
|
|
199
|
-
};
|
|
61
|
+
var collapseFlag = _this.props.collapseFlag;
|
|
200
62
|
|
|
201
63
|
_this.state = {
|
|
202
|
-
|
|
64
|
+
// 分页信息 折叠面板形式每页10条,非折叠面板每页1条
|
|
65
|
+
offset: 1, // 当前分页
|
|
66
|
+
limit: collapseFlag ? 10 : 1 // 每页条数
|
|
67
|
+
// paginationInfo: { // 分页
|
|
68
|
+
// offset: 1,
|
|
69
|
+
// limit: 10,
|
|
70
|
+
// },
|
|
203
71
|
};
|
|
204
72
|
return _this;
|
|
205
73
|
}
|
|
206
74
|
|
|
207
75
|
Easy3wMGridPage.prototype.componentWillUnmount = function componentWillUnmount() {};
|
|
208
|
-
//
|
|
76
|
+
// --------------------------------------------- 分页 start ---------------------------------------------
|
|
77
|
+
// 切换页数
|
|
209
78
|
|
|
79
|
+
// 触发查询
|
|
80
|
+
|
|
81
|
+
// --------------------------------------------- 分页 end -----------------------------------------------
|
|
210
82
|
// 数据格式化
|
|
211
83
|
|
|
212
84
|
// 渲染列表
|
|
@@ -222,14 +94,17 @@ var Easy3wMGridPage = function (_Component) {
|
|
|
222
94
|
collapseProps = _props$collapseProps === undefined ? {} : _props$collapseProps,
|
|
223
95
|
_props$emptyProps = _props.emptyProps,
|
|
224
96
|
emptyProps = _props$emptyProps === undefined ? {} : _props$emptyProps,
|
|
225
|
-
_props$panelProps = _props.panelProps,
|
|
226
|
-
panelProps = _props$panelProps === undefined ? {} : _props$panelProps,
|
|
227
|
-
_props$stepperProps = _props.stepperProps,
|
|
228
|
-
stepperProps = _props$stepperProps === undefined ? {} : _props$stepperProps,
|
|
229
97
|
_props$dataList = _props.dataList,
|
|
230
98
|
dataList = _props$dataList === undefined ? [] : _props$dataList,
|
|
231
|
-
|
|
232
|
-
|
|
99
|
+
collapseFlag = _props.collapseFlag,
|
|
100
|
+
needPaginationFlag = _props.needPaginationFlag;
|
|
101
|
+
var totalResult = this.props.totalResult;
|
|
102
|
+
|
|
103
|
+
if (totalResult) {
|
|
104
|
+
// 有总数就使用总数,无总数直接使用数组长度
|
|
105
|
+
} else if (dataList && dataList.length) {
|
|
106
|
+
totalResult = dataList.length;
|
|
107
|
+
}
|
|
233
108
|
// collapseProps 折叠面板容器参数
|
|
234
109
|
// panelProps 折叠面板参数
|
|
235
110
|
// emptyProps 空状态参数
|
|
@@ -242,8 +117,9 @@ var Easy3wMGridPage = function (_Component) {
|
|
|
242
117
|
// panelTitle panel标题
|
|
243
118
|
// panelKey panel唯一标识
|
|
244
119
|
// collapseFlag 是否折叠面板 true 是 false 否
|
|
245
|
-
|
|
246
|
-
|
|
120
|
+
var _state = this.state,
|
|
121
|
+
offset = _state.offset,
|
|
122
|
+
limit = _state.limit;
|
|
247
123
|
|
|
248
124
|
return _react2['default'].createElement(
|
|
249
125
|
'div',
|
|
@@ -266,60 +142,191 @@ var Easy3wMGridPage = function (_Component) {
|
|
|
266
142
|
null,
|
|
267
143
|
_react2['default'].createElement(_easy3wmui.Easy3wMEmpty, (0, _extends3['default'])({}, emptyProps, { description: emptyProps.description || '暂无数据' }))
|
|
268
144
|
),
|
|
269
|
-
|
|
270
|
-
'div',
|
|
271
|
-
{ className: 'easy3wMGridPageStepper' },
|
|
272
|
-
_react2['default'].createElement(
|
|
273
|
-
_easy3wmui.Easy3wMSpace,
|
|
274
|
-
null,
|
|
275
|
-
_react2['default'].createElement(
|
|
276
|
-
'span',
|
|
277
|
-
null,
|
|
278
|
-
'\u5171',
|
|
279
|
-
dataList.length,
|
|
280
|
-
'\u6761'
|
|
281
|
-
),
|
|
282
|
-
_react2['default'].createElement(_easy3wmui.Easy3wMStepper, (0, _extends3['default'])({}, stepperProps, {
|
|
283
|
-
step: 1 // 每次改变步数,可以为小数
|
|
284
|
-
, digits: 0 // 格式化到小数点后固定位数,设置为 0 表示格式化到整数
|
|
285
|
-
, min: 1 // 最小值
|
|
286
|
-
, max: dataList.length // 最大值
|
|
287
|
-
, inputReadOnly: true // 输入框是否只读
|
|
288
|
-
, onChange: this.onChange // 变化时的回调
|
|
289
|
-
, value: currentIndex // 当前数,受控值
|
|
290
|
-
}))
|
|
291
|
-
)
|
|
292
|
-
) : null,
|
|
293
|
-
totalResult && collapseFlag ? _react2['default'].createElement(
|
|
145
|
+
totalResult && !collapseFlag || collapseFlag && needPaginationFlag && totalResult ? _react2['default'].createElement(
|
|
294
146
|
'div',
|
|
295
147
|
{ className: 'easy3wMGridPageStepper' },
|
|
296
148
|
_react2['default'].createElement(
|
|
297
149
|
_button2['default'],
|
|
298
|
-
{ color: 'default', fill: '
|
|
150
|
+
{ color: 'default', fill: 'none', onClick: function onClick() {
|
|
299
151
|
return _this2.onChange('minus');
|
|
300
|
-
}, disabled:
|
|
301
|
-
_react2['default'].createElement(_antdMobileIcons.
|
|
152
|
+
}, disabled: offset === 1 },
|
|
153
|
+
_react2['default'].createElement(_antdMobileIcons.LeftOutline, null)
|
|
302
154
|
),
|
|
303
155
|
_react2['default'].createElement(
|
|
304
156
|
'span',
|
|
305
157
|
null,
|
|
306
|
-
|
|
158
|
+
offset,
|
|
307
159
|
'/',
|
|
308
|
-
Math.ceil(totalResult /
|
|
160
|
+
Math.ceil(totalResult / limit),
|
|
161
|
+
' \u5171',
|
|
162
|
+
totalResult,
|
|
163
|
+
'\u6761'
|
|
309
164
|
),
|
|
310
165
|
_react2['default'].createElement(
|
|
311
166
|
_button2['default'],
|
|
312
|
-
{ color: 'default', fill: '
|
|
167
|
+
{ color: 'default', fill: 'none', onClick: function onClick() {
|
|
313
168
|
return _this2.onChange('add');
|
|
314
|
-
}, disabled:
|
|
315
|
-
_react2['default'].createElement(_antdMobileIcons.
|
|
169
|
+
}, disabled: offset === Math.ceil(totalResult / limit) },
|
|
170
|
+
_react2['default'].createElement(_antdMobileIcons.RightOutline, null)
|
|
316
171
|
)
|
|
317
|
-
) :
|
|
172
|
+
) : ''
|
|
318
173
|
);
|
|
319
174
|
};
|
|
320
175
|
|
|
321
176
|
return Easy3wMGridPage;
|
|
322
177
|
}(_react.Component);
|
|
323
178
|
|
|
179
|
+
var _initialiseProps = function _initialiseProps() {
|
|
180
|
+
var _this3 = this;
|
|
181
|
+
|
|
182
|
+
this.onChange = function (operationType) {
|
|
183
|
+
var offset = _this3.state.offset;
|
|
184
|
+
|
|
185
|
+
if (operationType === 'minus') {
|
|
186
|
+
offset -= 1;
|
|
187
|
+
} else if (operationType === 'add') {
|
|
188
|
+
offset += 1;
|
|
189
|
+
}
|
|
190
|
+
_this3.setState({
|
|
191
|
+
offset: offset // 当前页
|
|
192
|
+
}, _this3.touchSearch);
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
this.touchSearch = function () {
|
|
196
|
+
var handleSearch = _this3.props.handleSearch;
|
|
197
|
+
var _state2 = _this3.state,
|
|
198
|
+
offset = _state2.offset,
|
|
199
|
+
limit = _state2.limit;
|
|
200
|
+
|
|
201
|
+
if (handleSearch && typeof handleSearch === 'function') {
|
|
202
|
+
handleSearch({ offset: offset, limit: limit });
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
this.touchFormatData = function (dataItem, columnItem) {
|
|
207
|
+
var key = columnItem.key,
|
|
208
|
+
dataIndex = columnItem.dataIndex,
|
|
209
|
+
numberFormat = columnItem.numberFormat;
|
|
210
|
+
|
|
211
|
+
var fieldId = dataIndex || key;
|
|
212
|
+
var value = dataItem[fieldId];
|
|
213
|
+
if (value || value === false || value === 0) {
|
|
214
|
+
// value值存在 Boolean()值为false的7个特殊值 undefined, null, false, NaN, '', 0, -0
|
|
215
|
+
if (numberFormat) {
|
|
216
|
+
var thousandthValue = (0, _numeral2['default'])(dataItem[fieldId]).format('0,0.00');
|
|
217
|
+
value = thousandthValue;
|
|
218
|
+
}
|
|
219
|
+
return value;
|
|
220
|
+
} else {
|
|
221
|
+
// value值不存在
|
|
222
|
+
return '';
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
this.renderEasy3wMGridPage = function (dataList) {
|
|
227
|
+
var offset = _this3.state.offset;
|
|
228
|
+
var _props2 = _this3.props,
|
|
229
|
+
_props2$panelProps = _props2.panelProps,
|
|
230
|
+
panelProps = _props2$panelProps === undefined ? {} : _props2$panelProps,
|
|
231
|
+
panelTitle = _props2.panelTitle,
|
|
232
|
+
panelKey = _props2.panelKey,
|
|
233
|
+
collapseFlag = _props2.collapseFlag;
|
|
234
|
+
// collapseProps 折叠面板容器参数
|
|
235
|
+
// panelProps 折叠面板参数
|
|
236
|
+
// emptyProps 空状态参数
|
|
237
|
+
// stepperProps 步进器参数
|
|
238
|
+
// listProps 列表参数
|
|
239
|
+
// itemProps 列表项参数
|
|
240
|
+
// columns 字段列表
|
|
241
|
+
// dataList 列表数据
|
|
242
|
+
// totalResult 列表记录数量
|
|
243
|
+
// panelTitle panel标题 数据类型:string或function
|
|
244
|
+
// panelKey panel唯一标识 数据类型:string或function
|
|
245
|
+
// expandedRowRender 可扩展行
|
|
246
|
+
|
|
247
|
+
if (collapseFlag) {
|
|
248
|
+
return dataList.map(function (item, index) {
|
|
249
|
+
var title = typeof panelTitle === 'function' ? panelTitle(item, index) : item[panelTitle] || '';
|
|
250
|
+
var key = typeof panelKey === 'function' ? panelKey(item, index) : item[panelKey] || index;
|
|
251
|
+
return (// 折叠面板
|
|
252
|
+
_react2['default'].createElement(
|
|
253
|
+
Panel,
|
|
254
|
+
(0, _extends3['default'])({}, panelProps, { title: title, key: key }),
|
|
255
|
+
_this3.renderEasy3wMGridPageItem(item, index)
|
|
256
|
+
)
|
|
257
|
+
);
|
|
258
|
+
});
|
|
259
|
+
} else {
|
|
260
|
+
return _this3.renderEasy3wMGridPageItem(dataList[offset - 1], offset - 1);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
this.renderEasy3wMGridPageItem = function (dataItem, index) {
|
|
265
|
+
var children = dataItem.children;
|
|
266
|
+
var _props3 = _this3.props,
|
|
267
|
+
_props3$listProps = _props3.listProps,
|
|
268
|
+
listProps = _props3$listProps === undefined ? {} : _props3$listProps,
|
|
269
|
+
_props3$itemProps = _props3.itemProps,
|
|
270
|
+
itemProps = _props3$itemProps === undefined ? {} : _props3$itemProps,
|
|
271
|
+
_props3$columns = _props3.columns,
|
|
272
|
+
columns = _props3$columns === undefined ? [] : _props3$columns,
|
|
273
|
+
_props3$expandedRowRe = _props3.expandedRowRender,
|
|
274
|
+
expandedRowRender = _props3$expandedRowRe === undefined ? function () {} : _props3$expandedRowRe;
|
|
275
|
+
// collapseProps 折叠面板容器参数
|
|
276
|
+
// panelProps 折叠面板参数
|
|
277
|
+
// emptyProps 空状态参数
|
|
278
|
+
// stepperProps 步进器参数
|
|
279
|
+
// listProps 列表参数
|
|
280
|
+
// itemProps 列表项参数
|
|
281
|
+
// columns 字段列表
|
|
282
|
+
// dataList 列表数据
|
|
283
|
+
// totalResult 列表记录数量
|
|
284
|
+
// panelTitle panel标题
|
|
285
|
+
// panelKey panel唯一标识
|
|
286
|
+
// expandedRowRender 可扩展行
|
|
287
|
+
|
|
288
|
+
return (// 单项数据
|
|
289
|
+
_react2['default'].createElement(
|
|
290
|
+
_easy3wmui.Easy3wMList,
|
|
291
|
+
listProps,
|
|
292
|
+
columns.map(function (column) {
|
|
293
|
+
if (column.children) {
|
|
294
|
+
return _react2['default'].createElement(
|
|
295
|
+
_easy3wmui.Easy3wMList,
|
|
296
|
+
(0, _extends3['default'])({ mode: 'card' }, listProps, { header: column.title }),
|
|
297
|
+
column.children.map(function (childrenColumn) {
|
|
298
|
+
var type = childrenColumn.type;
|
|
299
|
+
|
|
300
|
+
var childrenFieldId = childrenColumn.dataIndex || childrenColumn.key;
|
|
301
|
+
var childrenExtra = childrenColumn.render ? childrenColumn.render(dataItem[childrenFieldId], dataItem, index) : _this3.touchFormatData(dataItem, childrenColumn);
|
|
302
|
+
if (type === 'longText') {
|
|
303
|
+
return _react2['default'].createElement(Item, (0, _extends3['default'])({ className: 'e3wmLongText' }, itemProps, { title: childrenColumn.title, description: childrenExtra }));
|
|
304
|
+
} else {
|
|
305
|
+
return _react2['default'].createElement(Item, (0, _extends3['default'])({}, itemProps, { title: childrenColumn.title, extra: childrenExtra }));
|
|
306
|
+
}
|
|
307
|
+
})
|
|
308
|
+
);
|
|
309
|
+
} else {
|
|
310
|
+
var title = column.title,
|
|
311
|
+
key = column.key,
|
|
312
|
+
dataIndex = column.dataIndex,
|
|
313
|
+
type = column.type;
|
|
314
|
+
|
|
315
|
+
var fieldId = dataIndex || key;
|
|
316
|
+
var extra = column.render ? column.render(dataItem[fieldId], dataItem, index) : _this3.touchFormatData(dataItem, column);
|
|
317
|
+
if (type === 'longText') {
|
|
318
|
+
return _react2['default'].createElement(Item, (0, _extends3['default'])({ className: 'e3wmLongText' }, itemProps, { title: title, description: extra }));
|
|
319
|
+
} else {
|
|
320
|
+
return _react2['default'].createElement(Item, (0, _extends3['default'])({}, itemProps, { title: title, extra: extra }));
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}),
|
|
324
|
+
children ? _this3.renderEasy3wMGridPage(children) : '',
|
|
325
|
+
expandedRowRender ? expandedRowRender(dataItem) : ''
|
|
326
|
+
)
|
|
327
|
+
);
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
|
|
324
331
|
exports['default'] = Easy3wMGridPage;
|
|
325
332
|
module.exports = exports['default'];
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#Easy3wMSpin { // 锁屏加载
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
position: fixed;
|
|
3
|
+
background: rgba(255, 255, 255, 0);
|
|
4
|
+
top: 0;
|
|
5
|
+
bottom: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
right: 0;
|
|
8
|
+
z-index: 9999;
|
|
9
|
+
.spinLoading { // 内容
|
|
10
|
+
position: relative;
|
|
11
|
+
left: 50%;
|
|
12
|
+
top: 50%;
|
|
13
|
+
--size: 48px;
|
|
14
|
+
}
|
|
15
15
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#Easy3wMUserLayout {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
.Easy3wMUserLayoutContent { // 内容
|
|
3
|
+
background-color: #f0f2f5;
|
|
4
|
+
width: 100%;
|
|
5
|
+
min-height: 100%;
|
|
6
|
+
background-repeat: no-repeat;
|
|
7
|
+
background-position: center;
|
|
8
|
+
background-size: 100%;
|
|
9
|
+
padding: 40px 0 0 0;
|
|
10
|
+
}
|
|
11
11
|
}
|
package/package.json
CHANGED