cloud-b2b 1.1.46 → 1.1.51
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/package.json +44 -22
- package/src/Area/Area.js +94 -0
- package/src/Card/Card.js +16 -0
- package/src/CodeInput/CodeInput.js +76 -0
- package/src/Control/Control.js +338 -0
- package/src/Control/event.js +45 -0
- package/src/Enhance/Dialogs.js +24 -0
- package/src/Enhance/Loading.js +83 -0
- package/{es → src}/Enhance/index.js +8 -6
- package/src/Header/Header.js +149 -0
- package/src/Header/Vertical.js +74 -0
- package/src/ImageView/ImageView.js +62 -0
- package/src/Indent/Indent.js +12 -0
- package/src/InpurCascader/InputCascader.js +83 -0
- package/src/InputEditor/InputEditor.js +93 -0
- package/src/InputSearch/InputSearch.js +186 -0
- package/src/InputSelect/InputSelect.js +103 -0
- package/src/InputTreeSelect/InputTreeSelect.js +87 -0
- package/src/InputTreeSelect/package.json +6 -0
- package/src/InputWriting/InputWriting.js +65 -0
- package/src/Layout/Layout.js +121 -0
- package/src/LayoutLink/LayoutLink.js +59 -0
- package/src/Link/Link.js +57 -0
- package/src/Loading/Loading.js +15 -0
- package/src/Loading2/Loading2.js +15 -0
- package/src/ModalWithDrag/ModalWithDrag.js +17 -0
- package/{es → src}/ModalWithDrag/drag.js +128 -116
- package/src/NumberInput/NumberInput.js +137 -0
- package/src/Search/Search.js +368 -0
- package/src/Sidebar/Sidebar.js +111 -0
- package/src/Sidebar2/Sidebar.js +143 -0
- package/src/SuperForm/SuperForm.js +516 -0
- package/src/SuperForm2/SuperForm.js +588 -0
- package/src/SuperIcon/SuperIcon.js +14 -0
- package/src/SuperPagination/SuperPagination.js +65 -0
- package/src/SuperTab/SuperTab.js +84 -0
- package/src/SuperTab2/SuperTab2.js +94 -0
- package/src/SuperTable/DragSortRow.js +62 -0
- package/src/SuperTable/FilterDropDown.js +111 -0
- package/src/SuperTable/SuperTable.js +590 -0
- package/src/SuperTable/fixed.js +34 -0
- package/src/SuperTable2/SuperTable2.js +600 -0
- package/src/SuperTable2/SuperTableCell.js +144 -0
- package/src/SuperTable3/FilterDropDown.js +111 -0
- package/src/SuperTable3/SuperTable.js +498 -0
- package/src/SuperTable3/fixed.js +34 -0
- package/src/SuperToolbar/SuperToolbar.js +128 -0
- package/src/SuperUpload/SuperUpload.js +137 -0
- package/src/Title/Title.js +18 -0
- package/src/Viewer/ImageViews.js +220 -0
- package/src/Viewer/Viewer.js +97 -0
- package/src/WingBlank/WingBlank.js +14 -0
- package/src/helper.js +185 -0
- package/{es → src}/history.js +6 -6
- package/src/index.js +38 -0
- package/src/variables.js +5 -0
- package/test/index.html +10 -0
- package/test/test.js +16 -0
- package/test/test.less +12 -0
- package/test/webpack.config.js +71 -0
- package/tools/babel.config.js +14 -0
- package/tools/build.js +70 -0
- package/tools/publish.js +9 -0
- package/tools/util.js +53 -0
- package/es/Area/Area.js +0 -141
- package/es/Card/Card.js +0 -19
- package/es/CodeInput/CodeInput.js +0 -123
- package/es/Control/Control.js +0 -437
- package/es/Control/event.js +0 -43
- package/es/Enhance/Dialogs.js +0 -52
- package/es/Enhance/Loading.js +0 -131
- package/es/Header/Header.js +0 -162
- package/es/Header/Vertical.js +0 -106
- package/es/ImageView/ImageView.js +0 -100
- package/es/Indent/Indent.js +0 -19
- package/es/InpurCascader/InputCascader.js +0 -109
- package/es/InputEditor/InputEditor.js +0 -114
- package/es/InputSearch/InputSearch.js +0 -266
- package/es/InputSelect/InputSelect.js +0 -160
- package/es/InputWriting/InputWriting.js +0 -85
- package/es/Layout/Layout.js +0 -201
- package/es/LayoutLink/LayoutLink.js +0 -73
- package/es/Link/Link.js +0 -85
- package/es/Loading/Loading.js +0 -13
- package/es/Loading2/Loading2.js +0 -9
- package/es/ModalWithDrag/ModalWithDrag.js +0 -29
- package/es/NumberInput/NumberInput.js +0 -200
- package/es/Search/Search.js +0 -485
- package/es/Sidebar/Sidebar.js +0 -144
- package/es/Sidebar2/Sidebar.js +0 -165
- package/es/SuperForm/SuperForm.js +0 -583
- package/es/SuperForm2/SuperForm.js +0 -677
- package/es/SuperIcon/SuperIcon.js +0 -27
- package/es/SuperPagination/SuperPagination.js +0 -109
- package/es/SuperTab/SuperTab.js +0 -107
- package/es/SuperTab2/SuperTab2.js +0 -145
- package/es/SuperTable/DragSortRow.js +0 -97
- package/es/SuperTable/FilterDropDown.js +0 -164
- package/es/SuperTable/SuperTable.js +0 -808
- package/es/SuperTable/fixed.js +0 -34
- package/es/SuperTable2/SuperTable2.js +0 -894
- package/es/SuperTable2/SuperTableCell.js +0 -198
- package/es/SuperTable3/FilterDropDown.js +0 -164
- package/es/SuperTable3/SuperTable.js +0 -665
- package/es/SuperTable3/fixed.js +0 -34
- package/es/SuperToolbar/SuperToolbar.js +0 -195
- package/es/SuperUpload/SuperUpload.js +0 -357
- package/es/Title/Title.js +0 -33
- package/es/Viewer/ImageViews.js +0 -258
- package/es/Viewer/Viewer.js +0 -122
- package/es/WingBlank/WingBlank.js +0 -16
- package/es/helper.js +0 -147
- package/es/index.js +0 -37
- package/es/variables.js +0 -4
- package/lib/Area/Area.js +0 -150
- package/lib/Area/package.json +0 -6
- package/lib/Card/Card.js +0 -28
- package/lib/Card/package.json +0 -6
- package/lib/CodeInput/CodeInput.js +0 -132
- package/lib/CodeInput/package.json +0 -6
- package/lib/Control/Control.js +0 -446
- package/lib/Control/event.js +0 -52
- package/lib/Control/package.json +0 -6
- package/lib/Enhance/Dialogs.js +0 -61
- package/lib/Enhance/Loading.js +0 -139
- package/lib/Enhance/index.js +0 -26
- package/lib/Enhance/package.json +0 -6
- package/lib/Header/Header.js +0 -170
- package/lib/Header/Header.less +0 -95
- package/lib/Header/Vertical.js +0 -115
- package/lib/Header/Vertical.less +0 -60
- package/lib/Header/package.json +0 -6
- package/lib/ImageView/ImageView.js +0 -109
- package/lib/ImageView/ImageView.less +0 -14
- package/lib/ImageView/package.json +0 -6
- package/lib/Indent/Indent.js +0 -28
- package/lib/Indent/package.json +0 -6
- package/lib/InpurCascader/InputCascader.js +0 -117
- package/lib/InpurCascader/package.json +0 -6
- package/lib/InputEditor/InputEditor.js +0 -123
- package/lib/InputEditor/inputEditor.less +0 -8
- package/lib/InputEditor/package.json +0 -6
- package/lib/InputSearch/InputSearch.js +0 -275
- package/lib/InputSearch/package.json +0 -6
- package/lib/InputSelect/InputSelect.js +0 -169
- package/lib/InputSelect/package.json +0 -6
- package/lib/InputWriting/InputWriting.js +0 -94
- package/lib/InputWriting/package.json +0 -6
- package/lib/Layout/Layout.js +0 -210
- package/lib/Layout/Layout.less +0 -28
- package/lib/Layout/package.json +0 -6
- package/lib/LayoutLink/LayoutLink.js +0 -87
- package/lib/LayoutLink/LayoutLink.less +0 -53
- package/lib/LayoutLink/package.json +0 -6
- package/lib/Link/Link.js +0 -94
- package/lib/Link/package.json +0 -6
- package/lib/Loading/Loading.js +0 -22
- package/lib/Loading/Loading.less +0 -13
- package/lib/Loading/package.json +0 -6
- package/lib/Loading2/Loading2.js +0 -18
- package/lib/Loading2/Loading2.less +0 -19
- package/lib/Loading2/package.json +0 -6
- package/lib/ModalWithDrag/ModalWithDrag.js +0 -38
- package/lib/ModalWithDrag/ModalWithDrag.less +0 -6
- package/lib/ModalWithDrag/drag.js +0 -125
- package/lib/ModalWithDrag/package.json +0 -6
- package/lib/NumberInput/NumberInput.js +0 -209
- package/lib/NumberInput/package.json +0 -6
- package/lib/Search/Search.js +0 -499
- package/lib/Search/Search.less +0 -63
- package/lib/Search/package.json +0 -6
- package/lib/Sidebar/Sidebar.js +0 -153
- package/lib/Sidebar/Sidebar.less +0 -78
- package/lib/Sidebar/package.json +0 -6
- package/lib/Sidebar2/Sidebar.js +0 -174
- package/lib/Sidebar2/Sidebar.less +0 -153
- package/lib/Sidebar2/package.json +0 -6
- package/lib/SuperForm/SuperForm.js +0 -596
- package/lib/SuperForm/SuperForm.less +0 -52
- package/lib/SuperForm/package.json +0 -6
- package/lib/SuperForm2/SuperForm.js +0 -690
- package/lib/SuperForm2/SuperForm.less +0 -52
- package/lib/SuperForm2/package.json +0 -6
- package/lib/SuperIcon/SuperIcon.js +0 -36
- package/lib/SuperIcon/package.json +0 -6
- package/lib/SuperPagination/SuperPagination.js +0 -118
- package/lib/SuperPagination/package.json +0 -6
- package/lib/SuperTab/SuperTab.js +0 -116
- package/lib/SuperTab/SuperTab.less +0 -43
- package/lib/SuperTab/package.json +0 -6
- package/lib/SuperTab2/SuperTab2.js +0 -154
- package/lib/SuperTab2/SuperTab2.less +0 -18
- package/lib/SuperTab2/package.json +0 -6
- package/lib/SuperTable/DragSortRow.js +0 -106
- package/lib/SuperTable/DragSortRow.less +0 -17
- package/lib/SuperTable/FilterDropDown.js +0 -173
- package/lib/SuperTable/FilterDropDown.less +0 -30
- package/lib/SuperTable/SuperTable.js +0 -817
- package/lib/SuperTable/SuperTable.less +0 -132
- package/lib/SuperTable/fixed.js +0 -43
- package/lib/SuperTable/package.json +0 -6
- package/lib/SuperTable2/SuperTable2.js +0 -908
- package/lib/SuperTable2/SuperTable2.less +0 -118
- package/lib/SuperTable2/SuperTableCell.js +0 -204
- package/lib/SuperTable2/package.json +0 -6
- package/lib/SuperTable3/FilterDropDown.js +0 -173
- package/lib/SuperTable3/FilterDropDown.less +0 -29
- package/lib/SuperTable3/SuperTable.js +0 -674
- package/lib/SuperTable3/SuperTable.less +0 -99
- package/lib/SuperTable3/fixed.js +0 -43
- package/lib/SuperTable3/package.json +0 -6
- package/lib/SuperToolbar/SuperToolbar.js +0 -204
- package/lib/SuperToolbar/SuperToolbar.less +0 -17
- package/lib/SuperToolbar/package.json +0 -6
- package/lib/SuperUpload/SuperUpload.js +0 -370
- package/lib/SuperUpload/SuperUpload.less +0 -28
- package/lib/SuperUpload/package.json +0 -6
- package/lib/Title/Title.js +0 -42
- package/lib/Title/Title.less +0 -35
- package/lib/Title/package.json +0 -6
- package/lib/Viewer/ImageViews.js +0 -267
- package/lib/Viewer/Viewer.js +0 -131
- package/lib/Viewer/Viewer.less +0 -67
- package/lib/Viewer/imgView.less +0 -59
- package/lib/Viewer/package.json +0 -7
- package/lib/WingBlank/WingBlank.js +0 -25
- package/lib/WingBlank/WingBlank.less +0 -12
- package/lib/WingBlank/package.json +0 -6
- package/lib/adjust.less +0 -89
- package/lib/helper.js +0 -163
- package/lib/history.js +0 -13
- package/lib/index.js +0 -271
- package/lib/index.less +0 -31
- package/lib/style.less +0 -30
- package/lib/variables.js +0 -12
- package/lib/variables.less +0 -73
- /package/{es → src}/Area/package.json +0 -0
- /package/{es → src}/Card/package.json +0 -0
- /package/{es → src}/CodeInput/package.json +0 -0
- /package/{es → src}/Control/package.json +0 -0
- /package/{es → src}/Enhance/package.json +0 -0
- /package/{es → src}/Header/Header.less +0 -0
- /package/{es → src}/Header/Vertical.less +0 -0
- /package/{es → src}/Header/package.json +0 -0
- /package/{es → src}/ImageView/ImageView.less +0 -0
- /package/{es → src}/ImageView/package.json +0 -0
- /package/{es → src}/Indent/package.json +0 -0
- /package/{es → src}/InpurCascader/package.json +0 -0
- /package/{es → src}/InputEditor/inputEditor.less +0 -0
- /package/{es → src}/InputEditor/package.json +0 -0
- /package/{es → src}/InputSearch/package.json +0 -0
- /package/{es → src}/InputSelect/package.json +0 -0
- /package/{es → src}/InputWriting/package.json +0 -0
- /package/{es → src}/Layout/Layout.less +0 -0
- /package/{es → src}/Layout/package.json +0 -0
- /package/{es → src}/LayoutLink/LayoutLink.less +0 -0
- /package/{es → src}/LayoutLink/package.json +0 -0
- /package/{es → src}/Link/package.json +0 -0
- /package/{es → src}/Loading/Loading.less +0 -0
- /package/{es → src}/Loading/package.json +0 -0
- /package/{es → src}/Loading2/Loading2.less +0 -0
- /package/{es → src}/Loading2/package.json +0 -0
- /package/{es → src}/ModalWithDrag/ModalWithDrag.less +0 -0
- /package/{es → src}/ModalWithDrag/package.json +0 -0
- /package/{es → src}/NumberInput/package.json +0 -0
- /package/{es → src}/Search/Search.less +0 -0
- /package/{es → src}/Search/package.json +0 -0
- /package/{es → src}/Sidebar/Sidebar.less +0 -0
- /package/{es → src}/Sidebar/package.json +0 -0
- /package/{es → src}/Sidebar2/Sidebar.less +0 -0
- /package/{es → src}/Sidebar2/package.json +0 -0
- /package/{es → src}/SuperForm/SuperForm.less +0 -0
- /package/{es → src}/SuperForm/package.json +0 -0
- /package/{es → src}/SuperForm2/SuperForm.less +0 -0
- /package/{es → src}/SuperForm2/package.json +0 -0
- /package/{es → src}/SuperIcon/package.json +0 -0
- /package/{es → src}/SuperPagination/package.json +0 -0
- /package/{es → src}/SuperTab/SuperTab.less +0 -0
- /package/{es → src}/SuperTab/package.json +0 -0
- /package/{es → src}/SuperTab2/SuperTab2.less +0 -0
- /package/{es → src}/SuperTab2/package.json +0 -0
- /package/{es → src}/SuperTable/DragSortRow.less +0 -0
- /package/{es → src}/SuperTable/FilterDropDown.less +0 -0
- /package/{es → src}/SuperTable/SuperTable.less +0 -0
- /package/{es → src}/SuperTable/package.json +0 -0
- /package/{es → src}/SuperTable2/SuperTable2.less +0 -0
- /package/{es → src}/SuperTable2/package.json +0 -0
- /package/{es → src}/SuperTable3/FilterDropDown.less +0 -0
- /package/{es → src}/SuperTable3/SuperTable.less +0 -0
- /package/{es → src}/SuperTable3/package.json +0 -0
- /package/{es → src}/SuperToolbar/SuperToolbar.less +0 -0
- /package/{es → src}/SuperToolbar/package.json +0 -0
- /package/{es → src}/SuperUpload/SuperUpload.less +0 -0
- /package/{es → src}/SuperUpload/package.json +0 -0
- /package/{es → src}/Title/Title.less +0 -0
- /package/{es → src}/Title/package.json +0 -0
- /package/{es → src}/Viewer/Viewer.less +0 -0
- /package/{es → src}/Viewer/imgView.less +0 -0
- /package/{es → src}/Viewer/package.json +0 -0
- /package/{es → src}/WingBlank/WingBlank.less +0 -0
- /package/{es → src}/WingBlank/package.json +0 -0
- /package/{es → src}/adjust.less +0 -0
- /package/{es → src}/style.less +0 -0
- /package/{es → src}/variables.less +0 -0
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import ReactDOM from 'react-dom';
|
|
4
|
+
import helper from '../helper';
|
|
5
|
+
import Control, {getTitle, makeString} from '../Control';
|
|
6
|
+
import {Icon, Form, Row, Col, Checkbox, Tooltip} from 'antd';
|
|
7
|
+
import variables from '../variables';
|
|
8
|
+
|
|
9
|
+
const FormItem = Form.Item;
|
|
10
|
+
const defaultSize = 'large';
|
|
11
|
+
const defaultColNum = 4;
|
|
12
|
+
|
|
13
|
+
const TYPE = [
|
|
14
|
+
'readonly',
|
|
15
|
+
'text',
|
|
16
|
+
'search',
|
|
17
|
+
'searchText',
|
|
18
|
+
'select',
|
|
19
|
+
'selectText',
|
|
20
|
+
'radioGroup',
|
|
21
|
+
'number',
|
|
22
|
+
'date',
|
|
23
|
+
'textArea',
|
|
24
|
+
'password',
|
|
25
|
+
'editor',
|
|
26
|
+
'selectWriting',
|
|
27
|
+
'selectSearch',
|
|
28
|
+
'empty',
|
|
29
|
+
'captcha',
|
|
30
|
+
'area',
|
|
31
|
+
'uploadImg',
|
|
32
|
+
'cascader',
|
|
33
|
+
'checkbox',
|
|
34
|
+
'treeSelect'
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* key:[必须],用于唯一标识该Form下的一个表单元素
|
|
39
|
+
* title:[必须],表单元素的标签
|
|
40
|
+
* type:[必须],表单元素类型
|
|
41
|
+
* required: [可选],是否为必填项
|
|
42
|
+
* options: [可选],对象数组(type为readonly,radio,search, searchText,select, selectText时有效)
|
|
43
|
+
* span: [可选],占据的列数,默认为1
|
|
44
|
+
* showAdd: [可选],是否显示+号,点击+号会触发onAdd事件,默认为false
|
|
45
|
+
* rule: [可选],用于设置校验规则
|
|
46
|
+
*/
|
|
47
|
+
const ControlType = {
|
|
48
|
+
key: PropTypes.string.isRequired,
|
|
49
|
+
title: PropTypes.string,
|
|
50
|
+
type: PropTypes.oneOf(TYPE).isRequired,
|
|
51
|
+
required: PropTypes.bool,
|
|
52
|
+
options: PropTypes.array,
|
|
53
|
+
span: PropTypes.number,
|
|
54
|
+
onCheckItem: PropTypes.any,
|
|
55
|
+
showAdd: PropTypes.any,
|
|
56
|
+
rule: PropTypes.object,
|
|
57
|
+
props: PropTypes.object,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
class Controlled extends React.Component {
|
|
61
|
+
constructor(props) {
|
|
62
|
+
super(props);
|
|
63
|
+
this.state = {value: props.value};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
componentWillReceiveProps(nextProps) {
|
|
67
|
+
if (this.props.value !== nextProps.value) {
|
|
68
|
+
this.setState({value: nextProps.value});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
onChange = (value) => {
|
|
73
|
+
const {onChange} = this.props;
|
|
74
|
+
this.setState({value});
|
|
75
|
+
onChange && onChange(value);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
render() {
|
|
79
|
+
const props = {
|
|
80
|
+
...this.props,
|
|
81
|
+
size:'large',
|
|
82
|
+
value: this.state.value,
|
|
83
|
+
onChange: this.onChange
|
|
84
|
+
};
|
|
85
|
+
return <Control {...props} />;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* colNum:[可选],表单的列数,默认为4
|
|
91
|
+
* readonly: [可选],为true时,所有表单元素都是只读的; 为字符串数组时,用于指定key的表单元素是只读的
|
|
92
|
+
* hideControls: [可选],指定key的表单元素被隐藏
|
|
93
|
+
* options: [可选],键值对,值与ControlType中options作用相同,但优先级更高
|
|
94
|
+
* onChange:内容改变时触发,原型为func(key, value)
|
|
95
|
+
* onSearch:搜索框中用户输入时触发,原型为func(key, title, control)
|
|
96
|
+
* onAdd: 点击+号时触发,原型为func(key)
|
|
97
|
+
* checkable:是否显示checkbox选择框
|
|
98
|
+
* onOpenChange:控制日期框显示隐藏回调func(key, open)
|
|
99
|
+
* onAreaSearch:联级选择器触发,原型为func(key - 当前联级key, title - 输入值, parentKey - 主体联级key)
|
|
100
|
+
* onFileChange:上传组件触发,原型为func(key,{fileList, fileDeleteList})
|
|
101
|
+
*/
|
|
102
|
+
class SuperForm2 extends React.Component {
|
|
103
|
+
static propTypes = {
|
|
104
|
+
controls: PropTypes.arrayOf(PropTypes.shape(ControlType)).isRequired,
|
|
105
|
+
value: PropTypes.object,
|
|
106
|
+
colNum: PropTypes.number,
|
|
107
|
+
valid: PropTypes.bool,
|
|
108
|
+
readonly: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
|
|
109
|
+
hideControls: PropTypes.array,
|
|
110
|
+
options: PropTypes.object,
|
|
111
|
+
onChange: PropTypes.func,
|
|
112
|
+
onSearch: PropTypes.func,
|
|
113
|
+
onExitValid: PropTypes.func,
|
|
114
|
+
onAdd: PropTypes.func,
|
|
115
|
+
checkable: PropTypes.bool,
|
|
116
|
+
onOpenChange: PropTypes.func,
|
|
117
|
+
onGetCode: PropTypes.func,
|
|
118
|
+
onFileChange: PropTypes.func,
|
|
119
|
+
onAreaSearch: PropTypes.func,
|
|
120
|
+
buildSuperUploadProps: PropTypes.func, //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
|
|
121
|
+
layout: PropTypes.string,
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
onAdd = (key, title) => {
|
|
125
|
+
const {onAdd} = this.props;
|
|
126
|
+
onAdd && onAdd(key, title);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
onFileChange = ({key}, file) => {
|
|
130
|
+
const {onFileChange} = this.props;
|
|
131
|
+
onFileChange && onFileChange(key, file);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
onChange = (key, value) => {
|
|
135
|
+
const {onChange} = this.props;
|
|
136
|
+
if (onChange) {
|
|
137
|
+
this.onExitValid(key);
|
|
138
|
+
onChange(key, value);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
onGetCode = (key, value) => {
|
|
143
|
+
const {onGetCode} = this.props;
|
|
144
|
+
onGetCode && onGetCode();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
onBlur = (key, value) => {
|
|
148
|
+
const {onChange} = this.props;
|
|
149
|
+
if (onChange) {
|
|
150
|
+
this.onExitValid(key);
|
|
151
|
+
onChange(key, value);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
onExitValid = (key,value) => {
|
|
156
|
+
if (key === this.validKey) {
|
|
157
|
+
this.validKey = '';
|
|
158
|
+
this.props.onExitValid();
|
|
159
|
+
}
|
|
160
|
+
this.props.onChangeOperate && this.props.onChangeOperate(key,value);
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// 动态生成getValidState方法
|
|
164
|
+
initValidState = () => {
|
|
165
|
+
const {value, valid} = this.props;
|
|
166
|
+
const invalid = () => null;
|
|
167
|
+
const _valid = ({key, required}) => {
|
|
168
|
+
if (required) {
|
|
169
|
+
if (!value || helper.isEmpty2(value[key]) || ( !Array.isArray(value[key]) && typeof value[key] === 'object' && helper.isEmpty(value[key].value))) {
|
|
170
|
+
this.getValidState = invalid;
|
|
171
|
+
this.validKey = key;
|
|
172
|
+
return 'error';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
};
|
|
177
|
+
this.getValidState = valid ? _valid : invalid;
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
validDate = ({key, type}) => (date) => {
|
|
181
|
+
const {value={}} = this.props;
|
|
182
|
+
if (!date || !value[key]) {
|
|
183
|
+
return false;
|
|
184
|
+
} else {
|
|
185
|
+
if (type === '>') {
|
|
186
|
+
return date.format('YYYY-MM-DD') < value[key];
|
|
187
|
+
} else if (type === '<') {
|
|
188
|
+
return date.format('YYYY-MM-DD') > value[key];
|
|
189
|
+
} else {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
getPopupContainer = () => {
|
|
196
|
+
const {container} = this.props;
|
|
197
|
+
if (typeof container === 'undefined') {
|
|
198
|
+
return ReactDOM.findDOMNode(this);
|
|
199
|
+
} else if (typeof container === 'boolean') {
|
|
200
|
+
return document.body;
|
|
201
|
+
} else {
|
|
202
|
+
return ReactDOM.findDOMNode(container);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
getMaxWidth = () => {
|
|
207
|
+
const {colNum=defaultColNum} = this.props;
|
|
208
|
+
return colNum * 1200;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
getContainer = () => {
|
|
212
|
+
return this.props.getContainer;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
getControls = () => {
|
|
216
|
+
const {hideControls, controls} = this.props;
|
|
217
|
+
if (!hideControls) {
|
|
218
|
+
return controls;
|
|
219
|
+
} else {
|
|
220
|
+
return controls.filter(control => !hideControls.some(key => control.key === key));
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
getType = ({key, type}) => {
|
|
225
|
+
const {readonly} = this.props;
|
|
226
|
+
if (['area', 'uploadImg'].includes(type)){
|
|
227
|
+
return type;
|
|
228
|
+
} else if (!readonly) {
|
|
229
|
+
return type;
|
|
230
|
+
} else if (readonly === true) {
|
|
231
|
+
return 'readonly';
|
|
232
|
+
} else if (Array.isArray(readonly) && readonly.some(readonlyKey => readonlyKey === key)) {
|
|
233
|
+
return 'readonly';
|
|
234
|
+
} else {
|
|
235
|
+
return type;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
specialProps = (type, {key, props={}, type:originType}) => {
|
|
240
|
+
if (type === 'readonly') {
|
|
241
|
+
if (originType === 'textArea') {
|
|
242
|
+
return {
|
|
243
|
+
type: 'textArea',
|
|
244
|
+
readonly: true,
|
|
245
|
+
onBlur: this.onExitValid.bind(this, key)
|
|
246
|
+
}
|
|
247
|
+
} else if (originType === 'uploadImg') {
|
|
248
|
+
const commonProps = this.props.buildSuperUploadProps ? this.props.buildSuperUploadProps() : {};
|
|
249
|
+
return {
|
|
250
|
+
...props,
|
|
251
|
+
...commonProps,
|
|
252
|
+
readonly: true,
|
|
253
|
+
onBlur: this.onExitValid.bind(this, key)
|
|
254
|
+
};
|
|
255
|
+
} else {
|
|
256
|
+
return {
|
|
257
|
+
onBlur: this.onExitValid.bind(this, key)
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
} else if (type === 'text' || type === 'textArea') {
|
|
261
|
+
return {
|
|
262
|
+
...props,
|
|
263
|
+
onChange: this.onExitValid.bind(this, key),
|
|
264
|
+
onBlur: this.onChange.bind(this, key)
|
|
265
|
+
}
|
|
266
|
+
} else if (type === 'date') {
|
|
267
|
+
const propsObj = {
|
|
268
|
+
...props,
|
|
269
|
+
onChange: this.onBlur.bind(this, key),
|
|
270
|
+
onBlur: this.onExitValid.bind(this, key)
|
|
271
|
+
};
|
|
272
|
+
if (this.props.onOpenChange && typeof this.props.onOpenChange === 'function') {
|
|
273
|
+
propsObj.onOpenChange = this.props.onOpenChange.bind(this, key);
|
|
274
|
+
}
|
|
275
|
+
return propsObj;
|
|
276
|
+
}else if (type === 'captcha'){
|
|
277
|
+
return {
|
|
278
|
+
...props,
|
|
279
|
+
onChange: this.onBlur.bind(this, key),
|
|
280
|
+
onBlur: this.onExitValid.bind(this, key),
|
|
281
|
+
onGetCode: this.onGetCode.bind(this, key)
|
|
282
|
+
}
|
|
283
|
+
} else if (type === 'area'){
|
|
284
|
+
return {
|
|
285
|
+
...props,
|
|
286
|
+
onChange: this.onBlur.bind(this, key),
|
|
287
|
+
onBlur: this.onExitValid.bind(this, key),
|
|
288
|
+
onAreaSearch: this.props.onAreaSearch
|
|
289
|
+
}
|
|
290
|
+
} else if (type === 'uploadImg') {
|
|
291
|
+
const commonProps = this.props.buildSuperUploadProps ? this.props.buildSuperUploadProps() : {};
|
|
292
|
+
return {
|
|
293
|
+
...props,
|
|
294
|
+
...commonProps,
|
|
295
|
+
onChange: this.onBlur.bind(this, key),
|
|
296
|
+
onBlur: this.onExitValid.bind(this, key)
|
|
297
|
+
};
|
|
298
|
+
} else if (type === 'double'){
|
|
299
|
+
return props
|
|
300
|
+
}else {
|
|
301
|
+
return {
|
|
302
|
+
...props,
|
|
303
|
+
onChange: this.onBlur.bind(this, key),
|
|
304
|
+
onBlur: this.onExitValid.bind(this, key)
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
getControlProps = (control, status) => {
|
|
310
|
+
const {value={},readonly} = this.props;
|
|
311
|
+
const type = this.getType(control);
|
|
312
|
+
const props = this.specialProps(type, control);
|
|
313
|
+
return {
|
|
314
|
+
autoFocus: !!status,
|
|
315
|
+
type, ...props,
|
|
316
|
+
size: defaultSize,
|
|
317
|
+
value: makeString(value[control.key]),
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
getOptions = (key, options) => {
|
|
322
|
+
const higher = this.props.options || {};
|
|
323
|
+
return higher[key] || options;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
toEmpty = (props) => {
|
|
327
|
+
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
toText = (props) => {
|
|
331
|
+
return <Controlled {...props} />;
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
toPassword = (props) => {
|
|
335
|
+
return <Controlled {...props} />;
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
toEditor = (props,control) => {
|
|
339
|
+
props.inputKey =control.key
|
|
340
|
+
return <Controlled {...props} />;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
toSelectWriting = (props,control) => {
|
|
344
|
+
return <Controlled {...props} />;
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
toTextArea = (props, control) => {
|
|
349
|
+
if(control.allFullFather){
|
|
350
|
+
props.rows = control.rows;
|
|
351
|
+
props.maxLength = control.maxLength;
|
|
352
|
+
props.style = {
|
|
353
|
+
'resize': 'none'
|
|
354
|
+
};
|
|
355
|
+
}else{
|
|
356
|
+
props.autoSize = {minRows: 1, maxRows: 5};
|
|
357
|
+
}
|
|
358
|
+
return <Controlled {...props} />;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
toNumber = (props) => {
|
|
362
|
+
props.defaultValue = props.value;
|
|
363
|
+
delete props.value;
|
|
364
|
+
return <Control {...props} />;
|
|
365
|
+
};
|
|
366
|
+
toDoubleInput=(props, control, cc)=>{
|
|
367
|
+
props.defaultValue = props.value;
|
|
368
|
+
props.doubleKey = props.key;
|
|
369
|
+
props.doubleValue = helper.getObject(cc, props.key);
|
|
370
|
+
props.onChangeKey1 = this.onChange.bind(this, props.key[0])
|
|
371
|
+
props.onChangeKey2 = this.onChange.bind(this, props.key[1])
|
|
372
|
+
delete props.value;
|
|
373
|
+
return <Control {...props} />;
|
|
374
|
+
}
|
|
375
|
+
toSelect = (props, {options, key}) => {
|
|
376
|
+
props.getPopupContainer = this.getPopupContainer;
|
|
377
|
+
props.options = this.getOptions(key, options);
|
|
378
|
+
props.dropdownMatchSelectWidth = false;
|
|
379
|
+
return <Control {...props} />;
|
|
380
|
+
};
|
|
381
|
+
toTreeSelect = (props,filter) => {
|
|
382
|
+
const container = this.getContainer();
|
|
383
|
+
container && (props.getPopupContainer = container);
|
|
384
|
+
props.options = this.getOptions(filter);
|
|
385
|
+
props.onSearch = this.createSearchEvent(filter);
|
|
386
|
+
props.placeholder = filter.placeholder || '';
|
|
387
|
+
return <Control {...props} />;
|
|
388
|
+
};
|
|
389
|
+
createSearchEvent = (control) => {
|
|
390
|
+
if (this.props.onSearch) {
|
|
391
|
+
return value => this.props.onSearch(control.key, value, control);
|
|
392
|
+
} else {
|
|
393
|
+
return null;
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
createGetCodeEvent = (control) => {
|
|
398
|
+
if (this.props.onGetCode) {
|
|
399
|
+
return value => this.props.onGetCode(control.key, value, control);
|
|
400
|
+
} else {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
};
|
|
404
|
+
|
|
405
|
+
toSearch = (props, control) => {
|
|
406
|
+
props.getPopupContainer = this.getPopupContainer;
|
|
407
|
+
props.options = this.getOptions(control.key, control.options);
|
|
408
|
+
props.onSearch = this.createSearchEvent(control);
|
|
409
|
+
props.dropdownMatchSelectWidth = false;
|
|
410
|
+
props.size = 'large';
|
|
411
|
+
return <Control {...props} />;
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
toDate = (props, {rule}) => {
|
|
415
|
+
props.getCalendarContainer = this.getPopupContainer;
|
|
416
|
+
props.style = {width: '100%'};
|
|
417
|
+
rule && (props.disabledDate = this.validDate(rule));
|
|
418
|
+
return <Control {...props} />;
|
|
419
|
+
};
|
|
420
|
+
|
|
421
|
+
toRadioGroup = (props, {key, options}) => {
|
|
422
|
+
props.options = this.getOptions(key, options);
|
|
423
|
+
return <Control {...props} />;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
captcha = (props, control) => {
|
|
427
|
+
props.onGetCode = this.props.onGetCode;
|
|
428
|
+
return <Control {...props} />
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
toReadonly = (props, {options, key}) => {
|
|
432
|
+
props.value = getTitle(props.value, this.getOptions(key, options));
|
|
433
|
+
return <Control {...props} />;
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
selectSearch = (props, control) => {
|
|
437
|
+
props.getPopupContainer = this.getPopupContainer;
|
|
438
|
+
props.options = this.getOptions(control.key, control.options);
|
|
439
|
+
props.onSearch = this.createSearchEvent(control);
|
|
440
|
+
props.dropdownMatchSelectWidth = false;
|
|
441
|
+
return <Control {...props} />;
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
area = (props, {key,options}) => {
|
|
445
|
+
const {readonly} = this.props;
|
|
446
|
+
props.parentKey = key;
|
|
447
|
+
props.options = this.getOptions(key, options);
|
|
448
|
+
props.dropdownMatchSelectWidth = false;
|
|
449
|
+
props.readonly = readonly === true || Array.isArray(readonly) && readonly.some(readonlyKey => readonlyKey === key) ? true : false;
|
|
450
|
+
return <Control {...props} />;
|
|
451
|
+
};
|
|
452
|
+
|
|
453
|
+
uploadImg = (props, control) => {
|
|
454
|
+
const {readonly} = this.props;
|
|
455
|
+
props.required = control.required || false;
|
|
456
|
+
props.onFileChange = this.onFileChange.bind(this,control);
|
|
457
|
+
props.readonly = readonly === true || Array.isArray(readonly) && readonly.some(readonlyKey => readonlyKey === control.key) ? true : false;
|
|
458
|
+
return <Control {...props} />
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
toCascader = (props, control) => {
|
|
462
|
+
const container = this.getContainer();
|
|
463
|
+
container && (props.getPopupContainer = container);
|
|
464
|
+
props.options = control.options || [];
|
|
465
|
+
props.onSearch = this.createSearchEvent(control);
|
|
466
|
+
props.placeholder = props.placeholder || '';
|
|
467
|
+
props.loadData = this.createSearchEvent(control);
|
|
468
|
+
return <Control {...props} />;
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
toCheckbox = (props, control) => {
|
|
472
|
+
const options = control.options || [];
|
|
473
|
+
return <Checkbox.Group options={options} onChange={this.onBlur.bind(this, control.key)} value={this.props.value[control.key]} />
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
toControl = (props, control) => {
|
|
477
|
+
switch (props.type) {
|
|
478
|
+
case 'readonly':
|
|
479
|
+
return this.toReadonly(props, control);
|
|
480
|
+
case 'double':
|
|
481
|
+
return this.toDoubleInput(props, control, this.props.value);
|
|
482
|
+
case 'text':
|
|
483
|
+
return this.toText(props, control);
|
|
484
|
+
case 'number':
|
|
485
|
+
return this.toNumber(props, control);
|
|
486
|
+
case 'select':
|
|
487
|
+
case 'selectText':
|
|
488
|
+
return this.toSelect(props, control);
|
|
489
|
+
case 'search':
|
|
490
|
+
case 'searchText':
|
|
491
|
+
return this.toSearch(props, control);
|
|
492
|
+
case 'date':
|
|
493
|
+
return this.toDate(props, control);
|
|
494
|
+
case 'radioGroup':
|
|
495
|
+
return this.toRadioGroup(props, control);
|
|
496
|
+
case 'textArea':
|
|
497
|
+
return this.toTextArea(props, control);
|
|
498
|
+
case 'password':
|
|
499
|
+
return this.toPassword(props, control);
|
|
500
|
+
case 'editor':
|
|
501
|
+
return this.toEditor(props, control);
|
|
502
|
+
case 'selectWriting' :
|
|
503
|
+
return this.toSelectWriting(props,control)
|
|
504
|
+
case 'selectSearch':
|
|
505
|
+
return this.selectSearch(props, control);
|
|
506
|
+
case 'empty':
|
|
507
|
+
return this.toEmpty(props, control);
|
|
508
|
+
case 'captcha':
|
|
509
|
+
return this.captcha(props, control);
|
|
510
|
+
case 'area':
|
|
511
|
+
return this.area(props, control);
|
|
512
|
+
case 'uploadImg':
|
|
513
|
+
return this.uploadImg(props, control);
|
|
514
|
+
case 'cascader':
|
|
515
|
+
return this.toCascader(props, control);
|
|
516
|
+
case 'treeSelect':
|
|
517
|
+
return this.toTreeSelect(props, control);
|
|
518
|
+
case 'checkbox':
|
|
519
|
+
return this.toCheckbox(props, control);
|
|
520
|
+
default:
|
|
521
|
+
return 'type error';
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
|
|
525
|
+
toLabel = ({title, showAdd, key,showInfo,showInfoTitle}, type) => {
|
|
526
|
+
if (showAdd && (type !== 'readonly')) {
|
|
527
|
+
const onClick = this.onAdd.bind(this, key, title);
|
|
528
|
+
return <span>{title}<Icon role='add' type='plus-circle-o' onClick={onClick}/></span>;
|
|
529
|
+
} else if (showInfo){
|
|
530
|
+
return <span>{title}<Tooltip title={showInfoTitle}><Icon type="info-circle" /></Tooltip></span>
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
return title;
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
|
|
537
|
+
toCol = (span, control) => {
|
|
538
|
+
const factor = control.span || 1;
|
|
539
|
+
const status = this.getValidState(control);
|
|
540
|
+
const controlProps = this.getControlProps(control, status);
|
|
541
|
+
const itemProps = {
|
|
542
|
+
label: this.toLabel(control, controlProps.type),
|
|
543
|
+
required: control.required,
|
|
544
|
+
validateStatus: status
|
|
545
|
+
};
|
|
546
|
+
const {checkable,onCheckItem} = this.props;
|
|
547
|
+
return control.type !== 'empty' ? (
|
|
548
|
+
<Col span={span * factor} key={control.key}>
|
|
549
|
+
{checkable && <Checkbox className={variables('SuperForm2').checkbox} onChange={onCheckItem.bind(this,control)} checked={control.checked} />}
|
|
550
|
+
<FormItem {...itemProps} className={checkable ? variables('SuperForm2').formItemWithCheckbox : '' } labelCol={{xs:{span: 24},sm:{span:8}}} wrapperCol={{xs:{span:24},sm:{span:16}}}>
|
|
551
|
+
{this.toControl(controlProps, control)}
|
|
552
|
+
</FormItem>
|
|
553
|
+
</Col>
|
|
554
|
+
) : (
|
|
555
|
+
<Col span={span * factor} key={control.key} style={{height: '44px'}}/>
|
|
556
|
+
);
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
toCols = () => {
|
|
560
|
+
let {colNum=defaultColNum,allFullFather} = this.props;
|
|
561
|
+
if(allFullFather){
|
|
562
|
+
colNum = 1;
|
|
563
|
+
}
|
|
564
|
+
const span = 24 / colNum;
|
|
565
|
+
return this.getControls().map(control => {
|
|
566
|
+
if(allFullFather){
|
|
567
|
+
control.allFullFather = allFullFather;
|
|
568
|
+
}
|
|
569
|
+
return this.toCol(span, control)
|
|
570
|
+
});
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
render() {
|
|
574
|
+
this.initValidState();
|
|
575
|
+
const {layout='horizontal'} = this.props;
|
|
576
|
+
return (
|
|
577
|
+
<div className={variables('SuperForm2')}>
|
|
578
|
+
<Form layout={layout} style={{maxWidth: this.props.allFullFather ? '100%' : this.getMaxWidth()}}>
|
|
579
|
+
<Row gutter={20}>
|
|
580
|
+
{this.toCols()}
|
|
581
|
+
</Row>
|
|
582
|
+
</Form>
|
|
583
|
+
</div>
|
|
584
|
+
);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
export default SuperForm2;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {Icon} from 'antd';
|
|
3
|
+
|
|
4
|
+
const SuperIcon = ({type, style={}, ...props}) => {
|
|
5
|
+
if (!type) {
|
|
6
|
+
return <Icon style={style} {...props} />;
|
|
7
|
+
} else if (type.substring(0, 4) !== 'pld-') {
|
|
8
|
+
return <Icon type={type} style={style} {...props} />;
|
|
9
|
+
} else {
|
|
10
|
+
return <i className={`pldicon anticon anticon-${type}`} style={style} />
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default SuperIcon;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import {Pagination} from 'antd';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* maxRecords: 最大记录数
|
|
7
|
+
* selRecords: [可选]已选记录条数
|
|
8
|
+
* currentPage:当前页码
|
|
9
|
+
* pageSize:页面大小
|
|
10
|
+
* align: 分页组件的对齐方式,默认居右
|
|
11
|
+
* pageSizeType: 字符串数组,页面大小规格
|
|
12
|
+
* description:字符串描述,类似'共有{maxRecords}条记录'
|
|
13
|
+
* onPageChange:跳转到新的一页时触发,原型func(pageNumber)
|
|
14
|
+
* onPageSizeChange: 页大小改变时触发,原型func(pageSize, pageNumber)
|
|
15
|
+
*/
|
|
16
|
+
class SuperPagination extends React.Component {
|
|
17
|
+
static propTypes = {
|
|
18
|
+
maxRecords: PropTypes.number,
|
|
19
|
+
selRecords: PropTypes.number,
|
|
20
|
+
currentPage: PropTypes.number,
|
|
21
|
+
pageSize: PropTypes.number,
|
|
22
|
+
align: PropTypes.oneOf(['left', 'right', 'center']),
|
|
23
|
+
pageSizeType: PropTypes.array,
|
|
24
|
+
description: PropTypes.string,
|
|
25
|
+
style: PropTypes.object,
|
|
26
|
+
onPageNumberChange: PropTypes.func,
|
|
27
|
+
onPageSizeChange: PropTypes.func
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
onChange = (page) => {
|
|
31
|
+
const {callback = {}} = this.props;
|
|
32
|
+
const onPageNumberChange = this.props.onPageNumberChange || callback.onPageNumberChange;
|
|
33
|
+
onPageNumberChange && onPageNumberChange(page);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
onShowSizeChange = (current, size) => {
|
|
37
|
+
const {callback = {}} = this.props;
|
|
38
|
+
const onPageSizeChange = this.props.onPageSizeChange || callback.onPageSizeChange;
|
|
39
|
+
onPageSizeChange && onPageSizeChange(size, current || 1);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
render() {
|
|
43
|
+
const {currentPage, maxRecords, pageSize, pageSizeType, align, description, selRecords, page={}, option={}, style={}} = this.props;
|
|
44
|
+
const desp = description || (this.props.config || {}).pageDesp || '';
|
|
45
|
+
const props = {
|
|
46
|
+
current: currentPage || page.currentPage,
|
|
47
|
+
total: maxRecords || page.maxRecords,
|
|
48
|
+
pageSize: pageSize || page.pageSize,
|
|
49
|
+
showSizeChanger: true,
|
|
50
|
+
showQuickJumper: true,
|
|
51
|
+
pageSizeOptions: pageSizeType || option.pageSizeType || [],
|
|
52
|
+
onChange: this.onChange,
|
|
53
|
+
onShowSizeChange: this.onShowSizeChange,
|
|
54
|
+
showTotal: (total) => desp.replace('{maxRecords}', total).replace('{selRecords}', selRecords || 0),
|
|
55
|
+
style: Object.assign({}, style, {
|
|
56
|
+
display: 'inline-block',
|
|
57
|
+
textAlign: 'left',
|
|
58
|
+
verticalAlign: 'top'
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
return <div style={{textAlign: align || 'right'}}><Pagination {...props} /></div>;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default SuperPagination;
|