cloud-b2b 1.1.59 → 1.1.61
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/es/Area/Area.js +141 -0
- package/es/Card/Card.js +19 -0
- package/es/CodeInput/CodeInput.js +123 -0
- package/es/Control/Control.js +444 -0
- package/es/Control/event.js +43 -0
- package/es/Enhance/Dialogs.js +52 -0
- package/es/Enhance/Loading.js +131 -0
- package/{src → es}/Enhance/index.js +6 -8
- package/es/Header/Header.js +162 -0
- package/es/Header/Vertical.js +106 -0
- package/es/ImageView/ImageView.js +100 -0
- package/es/Indent/Indent.js +19 -0
- package/es/InpurCascader/InputCascader.js +117 -0
- package/es/InputEditor/InputEditor.js +173 -0
- package/es/InputSearch/InputSearch.js +266 -0
- package/es/InputSelect/InputSelect.js +160 -0
- package/es/InputTreeSelect/InputTreeSelect.js +121 -0
- package/es/InputWriting/InputWriting.js +85 -0
- package/es/Layout/Layout.js +201 -0
- package/es/LayoutLink/LayoutLink.js +73 -0
- package/es/Link/Link.js +85 -0
- package/es/Loading/Loading.js +13 -0
- package/es/Loading2/Loading2.js +9 -0
- package/es/ModalWithDrag/ModalWithDrag.js +29 -0
- package/{src → es}/ModalWithDrag/drag.js +116 -128
- package/es/NumberInput/NumberInput.js +200 -0
- package/es/Search/Search.js +497 -0
- package/es/Search2/Search.js +597 -0
- package/{src → es}/Search2/Search.less +0 -1
- package/es/Sidebar/Sidebar.js +144 -0
- package/es/Sidebar2/Sidebar.js +165 -0
- package/es/SuperForm/SuperForm.js +598 -0
- package/es/SuperForm2/SuperForm.js +687 -0
- package/es/SuperIcon/SuperIcon.js +27 -0
- package/es/SuperPagination/SuperPagination.js +109 -0
- package/es/SuperTab/SuperTab.js +107 -0
- package/es/SuperTab2/SuperTab2.js +145 -0
- package/es/SuperTable/DragSortRow.js +97 -0
- package/es/SuperTable/FilterDropDown.js +164 -0
- package/es/SuperTable/SuperTable.js +808 -0
- package/es/SuperTable/fixed.js +34 -0
- package/es/SuperTable2/SuperTable2.js +926 -0
- package/{src → es}/SuperTable2/SuperTable2.less +2 -1
- package/es/SuperTable2/SuperTableCell.js +234 -0
- package/es/SuperTable3/FilterDropDown.js +164 -0
- package/es/SuperTable3/SuperTable.js +665 -0
- package/es/SuperTable3/fixed.js +34 -0
- package/es/SuperToolbar/SuperToolbar.js +195 -0
- package/es/SuperUpload/SuperUpload.js +356 -0
- package/es/Title/Title.js +33 -0
- package/es/Viewer/ImageViews.js +258 -0
- package/es/Viewer/Viewer.js +122 -0
- package/es/WingBlank/WingBlank.js +16 -0
- package/es/helper.js +240 -0
- package/{src → es}/history.js +6 -6
- package/es/index.js +38 -0
- package/{src → es}/style.less +2 -1
- package/es/variables.js +6 -0
- package/lib/Area/Area.js +149 -0
- package/lib/Area/package.json +6 -0
- package/lib/Card/Card.js +27 -0
- package/lib/Card/package.json +6 -0
- package/lib/CodeInput/CodeInput.js +131 -0
- package/lib/CodeInput/package.json +6 -0
- package/lib/Control/Control.js +450 -0
- package/lib/Control/event.js +51 -0
- package/lib/Control/package.json +6 -0
- package/lib/Enhance/Dialogs.js +60 -0
- package/lib/Enhance/Loading.js +138 -0
- package/lib/Enhance/index.js +25 -0
- package/lib/Enhance/package.json +6 -0
- package/lib/Header/Header.js +169 -0
- package/lib/Header/Header.less +95 -0
- package/lib/Header/Vertical.js +114 -0
- package/lib/Header/Vertical.less +60 -0
- package/lib/Header/package.json +6 -0
- package/lib/ImageView/ImageView.js +108 -0
- package/lib/ImageView/ImageView.less +14 -0
- package/lib/ImageView/package.json +6 -0
- package/lib/Indent/Indent.js +27 -0
- package/lib/Indent/package.json +6 -0
- package/lib/InpurCascader/InputCascader.js +124 -0
- package/lib/InpurCascader/package.json +6 -0
- package/lib/InputEditor/InputEditor.js +181 -0
- package/lib/InputEditor/inputEditor.less +8 -0
- package/lib/InputEditor/package.json +6 -0
- package/lib/InputSearch/InputSearch.js +274 -0
- package/lib/InputSearch/package.json +6 -0
- package/lib/InputSelect/InputSelect.js +168 -0
- package/lib/InputSelect/package.json +6 -0
- package/lib/InputTreeSelect/InputTreeSelect.js +128 -0
- package/lib/InputTreeSelect/package.json +6 -0
- package/lib/InputWriting/InputWriting.js +93 -0
- package/lib/InputWriting/package.json +6 -0
- package/lib/Layout/Layout.js +209 -0
- package/lib/Layout/Layout.less +28 -0
- package/lib/Layout/package.json +6 -0
- package/lib/LayoutLink/LayoutLink.js +86 -0
- package/lib/LayoutLink/LayoutLink.less +53 -0
- package/lib/LayoutLink/package.json +6 -0
- package/lib/Link/Link.js +93 -0
- package/lib/Link/package.json +6 -0
- package/lib/Loading/Loading.js +21 -0
- package/lib/Loading/Loading.less +13 -0
- package/lib/Loading/package.json +6 -0
- package/lib/Loading2/Loading2.js +17 -0
- package/lib/Loading2/Loading2.less +19 -0
- package/lib/Loading2/package.json +6 -0
- package/lib/ModalWithDrag/ModalWithDrag.js +37 -0
- package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
- package/lib/ModalWithDrag/drag.js +124 -0
- package/lib/ModalWithDrag/package.json +6 -0
- package/lib/NumberInput/NumberInput.js +208 -0
- package/lib/NumberInput/package.json +6 -0
- package/lib/Search/Search.js +510 -0
- package/lib/Search/Search.less +63 -0
- package/lib/Search/package.json +6 -0
- package/lib/Search2/Search.js +609 -0
- package/lib/Search2/Search.less +64 -0
- package/lib/Search2/package.json +6 -0
- package/lib/Sidebar/Sidebar.js +152 -0
- package/lib/Sidebar/Sidebar.less +78 -0
- package/lib/Sidebar/package.json +6 -0
- package/lib/Sidebar2/Sidebar.js +173 -0
- package/lib/Sidebar2/Sidebar.less +153 -0
- package/lib/Sidebar2/package.json +6 -0
- package/lib/SuperForm/SuperForm.js +610 -0
- package/lib/SuperForm/SuperForm.less +52 -0
- package/lib/SuperForm/package.json +6 -0
- package/lib/SuperForm2/SuperForm.js +699 -0
- package/lib/SuperForm2/SuperForm.less +52 -0
- package/lib/SuperForm2/package.json +6 -0
- package/lib/SuperIcon/SuperIcon.js +35 -0
- package/lib/SuperIcon/package.json +6 -0
- package/lib/SuperPagination/SuperPagination.js +117 -0
- package/lib/SuperPagination/package.json +6 -0
- package/lib/SuperTab/SuperTab.js +115 -0
- package/lib/SuperTab/SuperTab.less +43 -0
- package/lib/SuperTab/package.json +6 -0
- package/lib/SuperTab2/SuperTab2.js +153 -0
- package/lib/SuperTab2/SuperTab2.less +18 -0
- package/lib/SuperTab2/package.json +6 -0
- package/lib/SuperTable/DragSortRow.js +105 -0
- package/lib/SuperTable/DragSortRow.less +17 -0
- package/lib/SuperTable/FilterDropDown.js +172 -0
- package/lib/SuperTable/FilterDropDown.less +30 -0
- package/lib/SuperTable/SuperTable.js +816 -0
- package/lib/SuperTable/SuperTable.less +132 -0
- package/lib/SuperTable/fixed.js +42 -0
- package/lib/SuperTable/package.json +6 -0
- package/lib/SuperTable2/SuperTable2.js +939 -0
- package/lib/SuperTable2/SuperTable2.less +119 -0
- package/lib/SuperTable2/SuperTableCell.js +239 -0
- package/lib/SuperTable2/package.json +6 -0
- package/lib/SuperTable3/FilterDropDown.js +172 -0
- package/lib/SuperTable3/FilterDropDown.less +29 -0
- package/lib/SuperTable3/SuperTable.js +673 -0
- package/lib/SuperTable3/SuperTable.less +99 -0
- package/lib/SuperTable3/fixed.js +42 -0
- package/lib/SuperTable3/package.json +6 -0
- package/lib/SuperToolbar/SuperToolbar.js +203 -0
- package/lib/SuperToolbar/SuperToolbar.less +17 -0
- package/lib/SuperToolbar/package.json +6 -0
- package/lib/SuperUpload/SuperUpload.js +368 -0
- package/lib/SuperUpload/SuperUpload.less +28 -0
- package/lib/SuperUpload/package.json +6 -0
- package/lib/Title/Title.js +41 -0
- package/lib/Title/Title.less +35 -0
- package/lib/Title/package.json +6 -0
- package/lib/Viewer/ImageViews.js +266 -0
- package/lib/Viewer/Viewer.js +130 -0
- package/lib/Viewer/Viewer.less +67 -0
- package/lib/Viewer/imgView.less +59 -0
- package/lib/Viewer/package.json +7 -0
- package/lib/WingBlank/WingBlank.js +24 -0
- package/lib/WingBlank/WingBlank.less +12 -0
- package/lib/WingBlank/package.json +6 -0
- package/lib/adjust.less +89 -0
- package/lib/helper.js +246 -0
- package/lib/history.js +12 -0
- package/lib/index.js +278 -0
- package/lib/index.less +32 -0
- package/lib/style.less +31 -0
- package/lib/variables.js +14 -0
- package/lib/variables.less +73 -0
- package/package.json +22 -44
- package/src/Area/Area.js +0 -94
- package/src/Card/Card.js +0 -16
- package/src/CodeInput/CodeInput.js +0 -76
- package/src/Control/Control.js +0 -338
- package/src/Control/event.js +0 -45
- package/src/Enhance/Dialogs.js +0 -24
- package/src/Enhance/Loading.js +0 -83
- package/src/Header/Header.js +0 -149
- package/src/Header/Vertical.js +0 -74
- package/src/ImageView/ImageView.js +0 -62
- package/src/Indent/Indent.js +0 -12
- package/src/InpurCascader/InputCascader.js +0 -83
- package/src/InputEditor/InputEditor.js +0 -93
- package/src/InputSearch/InputSearch.js +0 -186
- package/src/InputSelect/InputSelect.js +0 -103
- package/src/InputTreeSelect/InputTreeSelect.js +0 -87
- package/src/InputWriting/InputWriting.js +0 -65
- package/src/Layout/Layout.js +0 -121
- package/src/LayoutLink/LayoutLink.js +0 -59
- package/src/Link/Link.js +0 -57
- package/src/Loading/Loading.js +0 -15
- package/src/Loading2/Loading2.js +0 -15
- package/src/ModalWithDrag/ModalWithDrag.js +0 -17
- package/src/NumberInput/NumberInput.js +0 -137
- package/src/Search/Search.js +0 -368
- package/src/Search2/Search.js +0 -436
- package/src/Sidebar/Sidebar.js +0 -111
- package/src/Sidebar2/Sidebar.js +0 -143
- package/src/SuperForm/SuperForm.js +0 -519
- package/src/SuperForm2/SuperForm.js +0 -588
- package/src/SuperIcon/SuperIcon.js +0 -14
- package/src/SuperPagination/SuperPagination.js +0 -65
- package/src/SuperTab/SuperTab.js +0 -84
- package/src/SuperTab2/SuperTab2.js +0 -94
- package/src/SuperTable/DragSortRow.js +0 -62
- package/src/SuperTable/FilterDropDown.js +0 -111
- package/src/SuperTable/SuperTable.js +0 -590
- package/src/SuperTable/fixed.js +0 -34
- package/src/SuperTable2/SuperTable2.js +0 -624
- package/src/SuperTable2/SuperTableCell.js +0 -175
- package/src/SuperTable3/FilterDropDown.js +0 -111
- package/src/SuperTable3/SuperTable.js +0 -498
- package/src/SuperTable3/fixed.js +0 -34
- package/src/SuperToolbar/SuperToolbar.js +0 -128
- package/src/SuperUpload/SuperUpload.js +0 -137
- package/src/Title/Title.js +0 -18
- package/src/Viewer/ImageViews.js +0 -220
- package/src/Viewer/Viewer.js +0 -97
- package/src/WingBlank/WingBlank.js +0 -14
- package/src/helper.js +0 -185
- package/src/index.js +0 -39
- package/src/variables.js +0 -5
- package/test/index.html +0 -10
- package/test/test.js +0 -16
- package/test/test.less +0 -12
- package/test/webpack.config.js +0 -71
- package/tools/babel.config.js +0 -14
- package/tools/build.js +0 -70
- package/tools/publish.js +0 -9
- package/tools/util.js +0 -53
- /package/{src → es}/Area/package.json +0 -0
- /package/{src → es}/Card/package.json +0 -0
- /package/{src → es}/CodeInput/package.json +0 -0
- /package/{src → es}/Control/package.json +0 -0
- /package/{src → es}/Enhance/package.json +0 -0
- /package/{src → es}/Header/Header.less +0 -0
- /package/{src → es}/Header/Vertical.less +0 -0
- /package/{src → es}/Header/package.json +0 -0
- /package/{src → es}/ImageView/ImageView.less +0 -0
- /package/{src → es}/ImageView/package.json +0 -0
- /package/{src → es}/Indent/package.json +0 -0
- /package/{src → es}/InpurCascader/package.json +0 -0
- /package/{src → es}/InputEditor/inputEditor.less +0 -0
- /package/{src → es}/InputEditor/package.json +0 -0
- /package/{src → es}/InputSearch/package.json +0 -0
- /package/{src → es}/InputSelect/package.json +0 -0
- /package/{src → es}/InputTreeSelect/package.json +0 -0
- /package/{src → es}/InputWriting/package.json +0 -0
- /package/{src → es}/Layout/Layout.less +0 -0
- /package/{src → es}/Layout/package.json +0 -0
- /package/{src → es}/LayoutLink/LayoutLink.less +0 -0
- /package/{src → es}/LayoutLink/package.json +0 -0
- /package/{src → es}/Link/package.json +0 -0
- /package/{src → es}/Loading/Loading.less +0 -0
- /package/{src → es}/Loading/package.json +0 -0
- /package/{src → es}/Loading2/Loading2.less +0 -0
- /package/{src → es}/Loading2/package.json +0 -0
- /package/{src → es}/ModalWithDrag/ModalWithDrag.less +0 -0
- /package/{src → es}/ModalWithDrag/package.json +0 -0
- /package/{src → es}/NumberInput/package.json +0 -0
- /package/{src → es}/Search/Search.less +0 -0
- /package/{src → es}/Search/package.json +0 -0
- /package/{src → es}/Search2/package.json +0 -0
- /package/{src → es}/Sidebar/Sidebar.less +0 -0
- /package/{src → es}/Sidebar/package.json +0 -0
- /package/{src → es}/Sidebar2/Sidebar.less +0 -0
- /package/{src → es}/Sidebar2/package.json +0 -0
- /package/{src → es}/SuperForm/SuperForm.less +0 -0
- /package/{src → es}/SuperForm/package.json +0 -0
- /package/{src → es}/SuperForm2/SuperForm.less +0 -0
- /package/{src → es}/SuperForm2/package.json +0 -0
- /package/{src → es}/SuperIcon/package.json +0 -0
- /package/{src → es}/SuperPagination/package.json +0 -0
- /package/{src → es}/SuperTab/SuperTab.less +0 -0
- /package/{src → es}/SuperTab/package.json +0 -0
- /package/{src → es}/SuperTab2/SuperTab2.less +0 -0
- /package/{src → es}/SuperTab2/package.json +0 -0
- /package/{src → es}/SuperTable/DragSortRow.less +0 -0
- /package/{src → es}/SuperTable/FilterDropDown.less +0 -0
- /package/{src → es}/SuperTable/SuperTable.less +0 -0
- /package/{src → es}/SuperTable/package.json +0 -0
- /package/{src → es}/SuperTable2/package.json +0 -0
- /package/{src → es}/SuperTable3/FilterDropDown.less +0 -0
- /package/{src → es}/SuperTable3/SuperTable.less +0 -0
- /package/{src → es}/SuperTable3/package.json +0 -0
- /package/{src → es}/SuperToolbar/SuperToolbar.less +0 -0
- /package/{src → es}/SuperToolbar/package.json +0 -0
- /package/{src → es}/SuperUpload/SuperUpload.less +0 -0
- /package/{src → es}/SuperUpload/package.json +0 -0
- /package/{src → es}/Title/Title.less +0 -0
- /package/{src → es}/Title/package.json +0 -0
- /package/{src → es}/Viewer/Viewer.less +0 -0
- /package/{src → es}/Viewer/imgView.less +0 -0
- /package/{src → es}/Viewer/package.json +0 -0
- /package/{src → es}/WingBlank/WingBlank.less +0 -0
- /package/{src → es}/WingBlank/package.json +0 -0
- /package/{src → es}/adjust.less +0 -0
- /package/{src → es}/variables.less +0 -0
|
@@ -1,588 +0,0 @@
|
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
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;
|
|
@@ -1,65 +0,0 @@
|
|
|
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;
|