cloud-b2b 1.1.57 → 1.1.59

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.
Files changed (308) hide show
  1. package/package.json +44 -22
  2. package/src/Area/Area.js +94 -0
  3. package/src/Card/Card.js +16 -0
  4. package/src/CodeInput/CodeInput.js +76 -0
  5. package/src/Control/Control.js +338 -0
  6. package/src/Control/event.js +45 -0
  7. package/src/Enhance/Dialogs.js +24 -0
  8. package/src/Enhance/Loading.js +83 -0
  9. package/{es → src}/Enhance/index.js +8 -6
  10. package/src/Header/Header.js +149 -0
  11. package/src/Header/Vertical.js +74 -0
  12. package/src/ImageView/ImageView.js +62 -0
  13. package/src/Indent/Indent.js +12 -0
  14. package/src/InpurCascader/InputCascader.js +83 -0
  15. package/src/InputEditor/InputEditor.js +93 -0
  16. package/src/InputSearch/InputSearch.js +186 -0
  17. package/src/InputSelect/InputSelect.js +103 -0
  18. package/src/InputTreeSelect/InputTreeSelect.js +87 -0
  19. package/src/InputWriting/InputWriting.js +65 -0
  20. package/src/Layout/Layout.js +121 -0
  21. package/src/LayoutLink/LayoutLink.js +59 -0
  22. package/src/Link/Link.js +57 -0
  23. package/src/Loading/Loading.js +15 -0
  24. package/src/Loading2/Loading2.js +15 -0
  25. package/src/ModalWithDrag/ModalWithDrag.js +17 -0
  26. package/{es → src}/ModalWithDrag/drag.js +128 -116
  27. package/src/NumberInput/NumberInput.js +137 -0
  28. package/src/Search/Search.js +368 -0
  29. package/src/Search2/Search.js +436 -0
  30. package/{lib/Search → src/Search2}/Search.less +65 -63
  31. package/{lib/Search → src/Search2}/package.json +6 -6
  32. package/src/Sidebar/Sidebar.js +111 -0
  33. package/src/Sidebar2/Sidebar.js +143 -0
  34. package/src/SuperForm/SuperForm.js +519 -0
  35. package/src/SuperForm2/SuperForm.js +588 -0
  36. package/src/SuperIcon/SuperIcon.js +14 -0
  37. package/src/SuperPagination/SuperPagination.js +65 -0
  38. package/src/SuperTab/SuperTab.js +84 -0
  39. package/src/SuperTab2/SuperTab2.js +94 -0
  40. package/src/SuperTable/DragSortRow.js +62 -0
  41. package/src/SuperTable/FilterDropDown.js +111 -0
  42. package/src/SuperTable/SuperTable.js +590 -0
  43. package/src/SuperTable/fixed.js +34 -0
  44. package/src/SuperTable2/SuperTable2.js +624 -0
  45. package/src/SuperTable2/SuperTableCell.js +175 -0
  46. package/src/SuperTable3/FilterDropDown.js +111 -0
  47. package/src/SuperTable3/SuperTable.js +498 -0
  48. package/src/SuperTable3/fixed.js +34 -0
  49. package/src/SuperToolbar/SuperToolbar.js +128 -0
  50. package/src/SuperUpload/SuperUpload.js +137 -0
  51. package/src/Title/Title.js +18 -0
  52. package/src/Viewer/ImageViews.js +220 -0
  53. package/src/Viewer/Viewer.js +97 -0
  54. package/src/WingBlank/WingBlank.js +14 -0
  55. package/src/helper.js +185 -0
  56. package/{es → src}/history.js +6 -6
  57. package/src/index.js +39 -0
  58. package/src/variables.js +5 -0
  59. package/test/index.html +10 -0
  60. package/test/test.js +16 -0
  61. package/test/test.less +12 -0
  62. package/test/webpack.config.js +71 -0
  63. package/tools/babel.config.js +14 -0
  64. package/tools/build.js +70 -0
  65. package/tools/publish.js +9 -0
  66. package/tools/util.js +53 -0
  67. package/es/Area/Area.js +0 -138
  68. package/es/Card/Card.js +0 -19
  69. package/es/CodeInput/CodeInput.js +0 -120
  70. package/es/Control/Control.js +0 -444
  71. package/es/Control/event.js +0 -43
  72. package/es/Enhance/Dialogs.js +0 -49
  73. package/es/Enhance/Loading.js +0 -128
  74. package/es/Header/Header.js +0 -159
  75. package/es/Header/Vertical.js +0 -103
  76. package/es/ImageView/ImageView.js +0 -97
  77. package/es/Indent/Indent.js +0 -19
  78. package/es/InpurCascader/InputCascader.js +0 -114
  79. package/es/InputEditor/InputEditor.js +0 -171
  80. package/es/InputSearch/InputSearch.js +0 -263
  81. package/es/InputSelect/InputSelect.js +0 -157
  82. package/es/InputTreeSelect/InputTreeSelect.js +0 -118
  83. package/es/InputWriting/InputWriting.js +0 -82
  84. package/es/Layout/Layout.js +0 -198
  85. package/es/LayoutLink/LayoutLink.js +0 -73
  86. package/es/Link/Link.js +0 -82
  87. package/es/Loading/Loading.js +0 -13
  88. package/es/Loading2/Loading2.js +0 -9
  89. package/es/ModalWithDrag/ModalWithDrag.js +0 -29
  90. package/es/NumberInput/NumberInput.js +0 -197
  91. package/es/Search/Search.js +0 -494
  92. package/es/Sidebar/Sidebar.js +0 -141
  93. package/es/Sidebar2/Sidebar.js +0 -162
  94. package/es/SuperForm/SuperForm.js +0 -593
  95. package/es/SuperForm2/SuperForm.js +0 -682
  96. package/es/SuperIcon/SuperIcon.js +0 -27
  97. package/es/SuperPagination/SuperPagination.js +0 -106
  98. package/es/SuperTab/SuperTab.js +0 -104
  99. package/es/SuperTab2/SuperTab2.js +0 -142
  100. package/es/SuperTable/DragSortRow.js +0 -94
  101. package/es/SuperTable/FilterDropDown.js +0 -161
  102. package/es/SuperTable/SuperTable.js +0 -805
  103. package/es/SuperTable/fixed.js +0 -34
  104. package/es/SuperTable2/SuperTable2.js +0 -923
  105. package/es/SuperTable2/SuperTableCell.js +0 -215
  106. package/es/SuperTable3/FilterDropDown.js +0 -161
  107. package/es/SuperTable3/SuperTable.js +0 -662
  108. package/es/SuperTable3/fixed.js +0 -34
  109. package/es/SuperToolbar/SuperToolbar.js +0 -192
  110. package/es/SuperUpload/SuperUpload.js +0 -356
  111. package/es/Title/Title.js +0 -33
  112. package/es/Viewer/ImageViews.js +0 -255
  113. package/es/Viewer/Viewer.js +0 -119
  114. package/es/WingBlank/WingBlank.js +0 -16
  115. package/es/helper.js +0 -241
  116. package/es/index.js +0 -37
  117. package/es/variables.js +0 -6
  118. package/lib/Area/Area.js +0 -146
  119. package/lib/Area/package.json +0 -6
  120. package/lib/Card/Card.js +0 -27
  121. package/lib/Card/package.json +0 -6
  122. package/lib/CodeInput/CodeInput.js +0 -128
  123. package/lib/CodeInput/package.json +0 -6
  124. package/lib/Control/Control.js +0 -450
  125. package/lib/Control/event.js +0 -51
  126. package/lib/Control/package.json +0 -6
  127. package/lib/Enhance/Dialogs.js +0 -57
  128. package/lib/Enhance/Loading.js +0 -135
  129. package/lib/Enhance/index.js +0 -25
  130. package/lib/Enhance/package.json +0 -6
  131. package/lib/Header/Header.js +0 -166
  132. package/lib/Header/Header.less +0 -95
  133. package/lib/Header/Vertical.js +0 -111
  134. package/lib/Header/Vertical.less +0 -60
  135. package/lib/Header/package.json +0 -6
  136. package/lib/ImageView/ImageView.js +0 -105
  137. package/lib/ImageView/ImageView.less +0 -14
  138. package/lib/ImageView/package.json +0 -6
  139. package/lib/Indent/Indent.js +0 -27
  140. package/lib/Indent/package.json +0 -6
  141. package/lib/InpurCascader/InputCascader.js +0 -121
  142. package/lib/InpurCascader/package.json +0 -6
  143. package/lib/InputEditor/InputEditor.js +0 -179
  144. package/lib/InputEditor/inputEditor.less +0 -8
  145. package/lib/InputEditor/package.json +0 -6
  146. package/lib/InputSearch/InputSearch.js +0 -271
  147. package/lib/InputSearch/package.json +0 -6
  148. package/lib/InputSelect/InputSelect.js +0 -165
  149. package/lib/InputSelect/package.json +0 -6
  150. package/lib/InputTreeSelect/InputTreeSelect.js +0 -125
  151. package/lib/InputTreeSelect/package.json +0 -6
  152. package/lib/InputWriting/InputWriting.js +0 -90
  153. package/lib/InputWriting/package.json +0 -6
  154. package/lib/Layout/Layout.js +0 -206
  155. package/lib/Layout/Layout.less +0 -28
  156. package/lib/Layout/package.json +0 -6
  157. package/lib/LayoutLink/LayoutLink.js +0 -85
  158. package/lib/LayoutLink/LayoutLink.less +0 -53
  159. package/lib/LayoutLink/package.json +0 -6
  160. package/lib/Link/Link.js +0 -90
  161. package/lib/Link/package.json +0 -6
  162. package/lib/Loading/Loading.js +0 -21
  163. package/lib/Loading/Loading.less +0 -13
  164. package/lib/Loading/package.json +0 -6
  165. package/lib/Loading2/Loading2.js +0 -17
  166. package/lib/Loading2/Loading2.less +0 -19
  167. package/lib/Loading2/package.json +0 -6
  168. package/lib/ModalWithDrag/ModalWithDrag.js +0 -37
  169. package/lib/ModalWithDrag/ModalWithDrag.less +0 -6
  170. package/lib/ModalWithDrag/drag.js +0 -124
  171. package/lib/ModalWithDrag/package.json +0 -6
  172. package/lib/NumberInput/NumberInput.js +0 -205
  173. package/lib/NumberInput/package.json +0 -6
  174. package/lib/Search/Search.js +0 -506
  175. package/lib/Sidebar/Sidebar.js +0 -149
  176. package/lib/Sidebar/Sidebar.less +0 -78
  177. package/lib/Sidebar/package.json +0 -6
  178. package/lib/Sidebar2/Sidebar.js +0 -170
  179. package/lib/Sidebar2/Sidebar.less +0 -153
  180. package/lib/Sidebar2/package.json +0 -6
  181. package/lib/SuperForm/SuperForm.js +0 -604
  182. package/lib/SuperForm/SuperForm.less +0 -52
  183. package/lib/SuperForm/package.json +0 -6
  184. package/lib/SuperForm2/SuperForm.js +0 -693
  185. package/lib/SuperForm2/SuperForm.less +0 -52
  186. package/lib/SuperForm2/package.json +0 -6
  187. package/lib/SuperIcon/SuperIcon.js +0 -35
  188. package/lib/SuperIcon/package.json +0 -6
  189. package/lib/SuperPagination/SuperPagination.js +0 -114
  190. package/lib/SuperPagination/package.json +0 -6
  191. package/lib/SuperTab/SuperTab.js +0 -112
  192. package/lib/SuperTab/SuperTab.less +0 -43
  193. package/lib/SuperTab/package.json +0 -6
  194. package/lib/SuperTab2/SuperTab2.js +0 -150
  195. package/lib/SuperTab2/SuperTab2.less +0 -18
  196. package/lib/SuperTab2/package.json +0 -6
  197. package/lib/SuperTable/DragSortRow.js +0 -102
  198. package/lib/SuperTable/DragSortRow.less +0 -17
  199. package/lib/SuperTable/FilterDropDown.js +0 -169
  200. package/lib/SuperTable/FilterDropDown.less +0 -30
  201. package/lib/SuperTable/SuperTable.js +0 -813
  202. package/lib/SuperTable/SuperTable.less +0 -132
  203. package/lib/SuperTable/fixed.js +0 -42
  204. package/lib/SuperTable/package.json +0 -6
  205. package/lib/SuperTable2/SuperTable2.js +0 -935
  206. package/lib/SuperTable2/SuperTable2.less +0 -118
  207. package/lib/SuperTable2/SuperTableCell.js +0 -220
  208. package/lib/SuperTable2/package.json +0 -6
  209. package/lib/SuperTable3/FilterDropDown.js +0 -169
  210. package/lib/SuperTable3/FilterDropDown.less +0 -29
  211. package/lib/SuperTable3/SuperTable.js +0 -670
  212. package/lib/SuperTable3/SuperTable.less +0 -99
  213. package/lib/SuperTable3/fixed.js +0 -42
  214. package/lib/SuperTable3/package.json +0 -6
  215. package/lib/SuperToolbar/SuperToolbar.js +0 -200
  216. package/lib/SuperToolbar/SuperToolbar.less +0 -17
  217. package/lib/SuperToolbar/package.json +0 -6
  218. package/lib/SuperUpload/SuperUpload.js +0 -367
  219. package/lib/SuperUpload/SuperUpload.less +0 -28
  220. package/lib/SuperUpload/package.json +0 -6
  221. package/lib/Title/Title.js +0 -41
  222. package/lib/Title/Title.less +0 -35
  223. package/lib/Title/package.json +0 -6
  224. package/lib/Viewer/ImageViews.js +0 -263
  225. package/lib/Viewer/Viewer.js +0 -127
  226. package/lib/Viewer/Viewer.less +0 -67
  227. package/lib/Viewer/imgView.less +0 -59
  228. package/lib/Viewer/package.json +0 -7
  229. package/lib/WingBlank/WingBlank.js +0 -24
  230. package/lib/WingBlank/WingBlank.less +0 -12
  231. package/lib/WingBlank/package.json +0 -6
  232. package/lib/adjust.less +0 -89
  233. package/lib/helper.js +0 -247
  234. package/lib/history.js +0 -12
  235. package/lib/index.js +0 -271
  236. package/lib/index.less +0 -31
  237. package/lib/style.less +0 -30
  238. package/lib/variables.js +0 -14
  239. package/lib/variables.less +0 -73
  240. /package/{es → src}/Area/package.json +0 -0
  241. /package/{es → src}/Card/package.json +0 -0
  242. /package/{es → src}/CodeInput/package.json +0 -0
  243. /package/{es → src}/Control/package.json +0 -0
  244. /package/{es → src}/Enhance/package.json +0 -0
  245. /package/{es → src}/Header/Header.less +0 -0
  246. /package/{es → src}/Header/Vertical.less +0 -0
  247. /package/{es → src}/Header/package.json +0 -0
  248. /package/{es → src}/ImageView/ImageView.less +0 -0
  249. /package/{es → src}/ImageView/package.json +0 -0
  250. /package/{es → src}/Indent/package.json +0 -0
  251. /package/{es → src}/InpurCascader/package.json +0 -0
  252. /package/{es → src}/InputEditor/inputEditor.less +0 -0
  253. /package/{es → src}/InputEditor/package.json +0 -0
  254. /package/{es → src}/InputSearch/package.json +0 -0
  255. /package/{es → src}/InputSelect/package.json +0 -0
  256. /package/{es → src}/InputTreeSelect/package.json +0 -0
  257. /package/{es → src}/InputWriting/package.json +0 -0
  258. /package/{es → src}/Layout/Layout.less +0 -0
  259. /package/{es → src}/Layout/package.json +0 -0
  260. /package/{es → src}/LayoutLink/LayoutLink.less +0 -0
  261. /package/{es → src}/LayoutLink/package.json +0 -0
  262. /package/{es → src}/Link/package.json +0 -0
  263. /package/{es → src}/Loading/Loading.less +0 -0
  264. /package/{es → src}/Loading/package.json +0 -0
  265. /package/{es → src}/Loading2/Loading2.less +0 -0
  266. /package/{es → src}/Loading2/package.json +0 -0
  267. /package/{es → src}/ModalWithDrag/ModalWithDrag.less +0 -0
  268. /package/{es → src}/ModalWithDrag/package.json +0 -0
  269. /package/{es → src}/NumberInput/package.json +0 -0
  270. /package/{es → src}/Search/Search.less +0 -0
  271. /package/{es → src}/Search/package.json +0 -0
  272. /package/{es → src}/Sidebar/Sidebar.less +0 -0
  273. /package/{es → src}/Sidebar/package.json +0 -0
  274. /package/{es → src}/Sidebar2/Sidebar.less +0 -0
  275. /package/{es → src}/Sidebar2/package.json +0 -0
  276. /package/{es → src}/SuperForm/SuperForm.less +0 -0
  277. /package/{es → src}/SuperForm/package.json +0 -0
  278. /package/{es → src}/SuperForm2/SuperForm.less +0 -0
  279. /package/{es → src}/SuperForm2/package.json +0 -0
  280. /package/{es → src}/SuperIcon/package.json +0 -0
  281. /package/{es → src}/SuperPagination/package.json +0 -0
  282. /package/{es → src}/SuperTab/SuperTab.less +0 -0
  283. /package/{es → src}/SuperTab/package.json +0 -0
  284. /package/{es → src}/SuperTab2/SuperTab2.less +0 -0
  285. /package/{es → src}/SuperTab2/package.json +0 -0
  286. /package/{es → src}/SuperTable/DragSortRow.less +0 -0
  287. /package/{es → src}/SuperTable/FilterDropDown.less +0 -0
  288. /package/{es → src}/SuperTable/SuperTable.less +0 -0
  289. /package/{es → src}/SuperTable/package.json +0 -0
  290. /package/{es → src}/SuperTable2/SuperTable2.less +0 -0
  291. /package/{es → src}/SuperTable2/package.json +0 -0
  292. /package/{es → src}/SuperTable3/FilterDropDown.less +0 -0
  293. /package/{es → src}/SuperTable3/SuperTable.less +0 -0
  294. /package/{es → src}/SuperTable3/package.json +0 -0
  295. /package/{es → src}/SuperToolbar/SuperToolbar.less +0 -0
  296. /package/{es → src}/SuperToolbar/package.json +0 -0
  297. /package/{es → src}/SuperUpload/SuperUpload.less +0 -0
  298. /package/{es → src}/SuperUpload/package.json +0 -0
  299. /package/{es → src}/Title/Title.less +0 -0
  300. /package/{es → src}/Title/package.json +0 -0
  301. /package/{es → src}/Viewer/Viewer.less +0 -0
  302. /package/{es → src}/Viewer/imgView.less +0 -0
  303. /package/{es → src}/Viewer/package.json +0 -0
  304. /package/{es → src}/WingBlank/WingBlank.less +0 -0
  305. /package/{es → src}/WingBlank/package.json +0 -0
  306. /package/{es → src}/adjust.less +0 -0
  307. /package/{es → src}/style.less +0 -0
  308. /package/{es → src}/variables.less +0 -0
package/package.json CHANGED
@@ -1,22 +1,44 @@
1
- {
2
- "name": "cloud-b2b",
3
- "version": "1.1.57",
4
- "description": "A react component library dependent antd",
5
- "keywords": [
6
- "react",
7
- "component",
8
- "antd"
9
- ],
10
- "author": "pxj",
11
- "license": "ISC",
12
- "dependencies": {
13
- "@babel/runtime-corejs3": "^7.26.10",
14
- "antd": "^3.26.19",
15
- "history": "^4.5.0",
16
- "prop-types": "^15.7.2",
17
- "react": "^16.8.2",
18
- "react-dom": "^16.8.2"
19
- },
20
- "main": "lib/index.js",
21
- "module": "es/index.js"
22
- }
1
+ {
2
+ "name": "cloud-b2b",
3
+ "version": "1.1.59",
4
+ "description": "A react component library dependent antd",
5
+ "keywords": [
6
+ "react",
7
+ "component",
8
+ "antd"
9
+ ],
10
+ "author": "pxj",
11
+ "license": "ISC",
12
+ "devDependencies": {
13
+ "@babel/core": "^7.11.5",
14
+ "@babel/plugin-proposal-class-properties": "^7.10.4",
15
+ "@babel/plugin-proposal-export-default-from": "^7.10.4",
16
+ "@babel/plugin-transform-react-jsx-self": "^7.16.7",
17
+ "@babel/plugin-transform-react-jsx-source": "^7.16.7",
18
+ "@babel/plugin-transform-runtime": "^7.11.5",
19
+ "@babel/preset-env": "^7.11.5",
20
+ "@babel/preset-react": "^7.10.4",
21
+ "babel-loader": "^8.1.0",
22
+ "babel-plugin-import": "1.13.1",
23
+ "css-loader": "^4.3.0",
24
+ "less": "^3.12.2",
25
+ "less-loader": "^5.0.0",
26
+ "style-loader": "^1.2.1",
27
+ "webpack": "^4.44.2",
28
+ "webpack-cli": "^3.3.11",
29
+ "webpack-dev-server": "^3.11.1"
30
+ },
31
+ "dependencies": {
32
+ "@babel/runtime-corejs3": "^7.26.10",
33
+ "antd": "^3.26.19",
34
+ "history": "^4.5.0",
35
+ "prop-types": "^15.7.2",
36
+ "react": "^16.8.2",
37
+ "react-dom": "^16.8.2"
38
+ },
39
+ "scripts": {
40
+ "build": "node --no-deprecation tools/build",
41
+ "publish": "node tools/publish",
42
+ "test": "webpack-dev-server --config test/webpack.config.js"
43
+ }
44
+ }
@@ -0,0 +1,94 @@
1
+ import React from 'react';
2
+ import {Input,Row,Col,Button} from 'antd';
3
+ import PropTypes from 'prop-types';
4
+ import helper from '../helper';
5
+ import Control from '../Control';
6
+
7
+ const PROPS = {
8
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]),
9
+ onChange: PropTypes.func,
10
+ onBlur: PropTypes.func,
11
+ onParentChange:PropTypes.func,
12
+ child:PropTypes.Array
13
+ };
14
+
15
+ const PROPS_KEYS = Object.keys(PROPS);
16
+
17
+ class Area extends React.Component {
18
+
19
+ constructor(props) {
20
+ super(props);
21
+ this.state = {value: props.value || {},options:props.options || {}};
22
+ };
23
+
24
+ componentWillReceiveProps(props) {
25
+ if (props.value !== this.props.value) {
26
+ this.setState({value: props.value || {}});
27
+ }
28
+ }
29
+
30
+ onChange = (key, keyValue) => {
31
+ const {onParentChange,child, value={}} = this.props;
32
+ let newValue = {};
33
+ newValue[key] = keyValue;
34
+ let CheckValue,checkIndex;
35
+ child.map((item,index) => {
36
+ if (item.key === key){
37
+ checkIndex = index;
38
+ }
39
+ CheckValue = index > checkIndex ? '' : value[item.key];
40
+ newValue[item.key] = item.key === key ? keyValue : CheckValue;
41
+ });
42
+ this.setState({value: {...this.state.value,...newValue}},() => onParentChange && onParentChange(this.state.value))
43
+ };
44
+
45
+ onSearch = (key, control, parentKey,KeyValue) => {
46
+ const {onAreaSearch,child,value={}} = this.props;
47
+ let flag = true;
48
+ child.map((item,index) => {
49
+ if (item.key === key && index !== 0){
50
+ const upKey = child[index-1].key;
51
+ if (index !== 0 && (helper.isEmpty2(value[upKey]) || Object.keys(value[upKey]).length === 0)){
52
+ flag = false
53
+ };
54
+ }
55
+ });
56
+ return flag ? onAreaSearch && onAreaSearch(key, KeyValue, parentKey) : helper.showError('请输入上级选择器');
57
+ };
58
+
59
+ render() {
60
+ const {child,parentKey,options = {},readonly = false, value={}} = this.props;
61
+ return (
62
+ <Row>
63
+ {child.map((item,index) => {
64
+ let childOptions = [];
65
+ if (Object.keys(options).includes(item.key)){
66
+ if (index === 0){
67
+ childOptions = options[item.key]
68
+ } else{
69
+ const upKey = child[index-1].key;
70
+ childOptions = helper.isEmpty2(value[upKey]) || Object.keys(value[upKey]).length === 0 ? [] : options[item.key]
71
+ }
72
+ }
73
+ const props = {
74
+ ...item,
75
+ onSearch:this.onSearch.bind(this,item.key,item,parentKey),
76
+ onChange:this.onChange.bind(this,item.key),
77
+ options: childOptions,
78
+ value: value[item.key] && value[item.key].title ? value[item.key].title : value[item.key],
79
+ type: readonly ? 'readonly' : item.type,
80
+ searchWhenClick: true
81
+ };
82
+ return (
83
+ <Col span={24 / child.length} key={item.key}>
84
+ <Control {...props}/>
85
+ </Col>
86
+ )
87
+ })}
88
+
89
+ </Row>
90
+ );
91
+ }
92
+ }
93
+
94
+ export default Area;
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import classNames from 'classnames';
3
+
4
+ const Card = React.forwardRef(({ children, className, noPadding, ...other }, ref) => {
5
+ const padding = !noPadding ? true : null;
6
+ return (
7
+ <div className={classNames('pld-card', className)} data-padding={padding} {...other} ref={ref}>
8
+ {children}
9
+ </div>
10
+ );
11
+ });
12
+
13
+
14
+ export default Card;
15
+
16
+
@@ -0,0 +1,76 @@
1
+ import React from 'react';
2
+ import {Input,Row,Col,Button} from 'antd';
3
+ import PropTypes from 'prop-types';
4
+ import helper from '../helper';
5
+
6
+ const PROPS = {
7
+ filter: PropTypes.bool,
8
+ remark: PropTypes.bool,
9
+ searchWhenClick: PropTypes.bool,
10
+ noSearchWhenTypo: PropTypes.bool,
11
+ options: PropTypes.array,
12
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]),
13
+ inputRef: PropTypes.func,
14
+ onChange: PropTypes.func,
15
+ onBlur: PropTypes.func,
16
+ onSelect: PropTypes.func,
17
+ onSearch: PropTypes.func
18
+ };
19
+
20
+ const PROPS_KEYS = Object.keys(PROPS);
21
+
22
+ class CodeInput extends React.Component {
23
+
24
+ constructor(props) {
25
+ super(props);
26
+ this.state = {value: props.value,time:0,};
27
+ };
28
+
29
+ onGetCode = async () => {
30
+ // const url = await helper.fetchJson();
31
+ const {onGetCode} = this.props;
32
+ if (await (onGetCode && onGetCode())){
33
+ this.setState({time:this.props.time || 60});
34
+ let that = this;
35
+ const s = setInterval(function () {
36
+ that.setState({time:that.state.time -= 1}) ;
37
+ if (that.state.time === 0) {
38
+ clearInterval(s);
39
+ }
40
+ }, 1000);
41
+ };
42
+ }
43
+
44
+ btnProps = (props) => {
45
+ const btnProps = Object.assign(helper.getObjectExclude(props,['onGetCode']));
46
+ return {
47
+ ...btnProps,
48
+ size:'large',
49
+ disabled:this.state.time !== 0,
50
+ onClick:this.onGetCode
51
+ }
52
+ };
53
+
54
+ inputProps = (props) => {
55
+ const inpPros = Object.assign(helper.getObjectExclude(props,['onGetCode', 'value']));
56
+ return {
57
+ ...inpPros,
58
+ size:'large',
59
+ defaultValue: props.value || ''
60
+ }
61
+ }
62
+
63
+
64
+ render() {
65
+ const {inputKey, readonly, value} = this.props;
66
+ const {time} = this.state;
67
+ return (
68
+ <div style={{display:'flex'}}>
69
+ <Input {...this.inputProps(this.props)}/>
70
+ <Button {...this.btnProps(this.props)}>{time === 0 ? `获取验证码` : `${time}s获取验证码`}</Button>
71
+ </div>
72
+ );
73
+ }
74
+ }
75
+
76
+ export default CodeInput;
@@ -0,0 +1,338 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import ReactDOM from 'react-dom';
4
+ import {Input, Select, DatePicker, Radio} from 'antd';
5
+ import InputSearch from '../InputSearch';
6
+ import NumberInput from '../NumberInput';
7
+ import InputEditor from '../InputEditor';
8
+ import InputSelect from '../InputSelect';
9
+ import InputWriting from '../InputWriting';
10
+ import InpurCascader from '../InpurCascader';
11
+ import InputTreeSelect from '../InputTreeSelect';
12
+ import moment from 'moment';
13
+ import eventWrapper from './event';
14
+ import CodeInput from '../CodeInput';
15
+ import SuperUpload from '../SuperUpload';
16
+ import Area from '../Area/Area';
17
+
18
+ const SelectOption = Select.Option;
19
+ const TextArea = Input.TextArea;
20
+ const RadioGroup = Radio.Group;
21
+
22
+ moment.locale('zh-cn');
23
+
24
+ const getTitleOptions = (options) => {
25
+ const existTitles = [];
26
+ if (options) {
27
+ return options.reduce((result, option) => {
28
+ if (existTitles.includes(option.title)) {
29
+ return result;
30
+ } else {
31
+ existTitles.push(option.title);
32
+ result.push({...option, value: option.title, originValue: option.value});
33
+ return result;
34
+ }
35
+ }, []);
36
+ } else {
37
+ return options;
38
+ }
39
+ };
40
+
41
+ // 设置组件焦点
42
+ const setFocus = (element, type) => {
43
+ if (element) {
44
+ if (element.focus) {
45
+ element.focus();
46
+ } else if (type === 'select' || type === 'selectText') {
47
+ ReactDOM.findDOMNode(element).firstChild.focus();
48
+ } else if (type === 'search' || type === 'searchText' || type === 'date') {
49
+ ReactDOM.findDOMNode(element).getElementsByTagName('input')[0].focus();
50
+ }
51
+ }
52
+ };
53
+
54
+ const toOption = ({value, title}, index) => {
55
+ return <SelectOption key={index} value={String(value)}>{title}</SelectOption>;
56
+ };
57
+
58
+ const toRadio = ({value, title, disabled=false}, index) => {
59
+ return <Radio key={index} value={String(value)} disabled={disabled}>{title}</Radio>;
60
+ };
61
+
62
+ // 文本输入框
63
+ const text = (props) => {
64
+ if (props.value || props.defaultValue) {
65
+ props.title = props.value || props.defaultValue;
66
+ }
67
+ return <Input {...props} />;
68
+ };
69
+
70
+ // 密码输入框
71
+ const password = (props) => {
72
+ props.type = 'password';
73
+ return <Input {...props} />;
74
+ };
75
+
76
+ // 多行文本输入框
77
+ const textArea = (props) => {
78
+ if (props.readonly) {
79
+ delete props.readonly;
80
+ props.readOnly = true;
81
+ props.style = Object.assign(props.style || {}, {backgroundColor: '#f0f0f0'});
82
+ }
83
+ return <TextArea {...props} />;
84
+ };
85
+
86
+ //双选输入框
87
+ const double = (props) => {
88
+ if (props.ref) {
89
+ props.inputRef = props.ref;
90
+ delete props.ref;
91
+ }
92
+ const {doubleKey, onChange} = props;
93
+ const props1={...props,defaultValue:props.doubleValue[props.doubleKey[0]], onChange: props.onChangeKey1}
94
+ const props2={...props,defaultValue:props.doubleValue[props.doubleKey[1]], onChange: props.onChangeKey2}
95
+ return <div style={{display:'flex'}}>
96
+ <NumberInput key={doubleKey[0]} {...props1} />~
97
+ <NumberInput key={doubleKey[1]} {...props2} />
98
+ </div>
99
+ }
100
+
101
+ // 只读框
102
+ const readonly = (props) => {
103
+ props.readOnly = true;
104
+ props.style = Object.assign(props.style || {}, {backgroundColor: '#f0f0f0'});
105
+ if (props.value || props.defaultValue) {
106
+ props.title = props.value || props.defaultValue;
107
+ }
108
+ return <Input {...props}/>;
109
+ };
110
+
111
+ // 数字输入框
112
+ const number = (props) => {
113
+ if (props.ref) {
114
+ props.inputRef = props.ref;
115
+ delete props.ref;
116
+ }
117
+ return <NumberInput {...props} />;
118
+ };
119
+
120
+ const isMatch = (inputValue, option) => {
121
+ return option.props.children.indexOf(inputValue) !== -1;
122
+ };
123
+
124
+ // 下拉选择框
125
+ const select = (props) => {
126
+ const options = props.options || [];
127
+ delete props.options;
128
+ props.showSearch = true;
129
+ props.filterOption = isMatch;
130
+ (props.allowClear !== false) && (props.allowClear = true);
131
+ if (props.mode === 'multiple') {
132
+ !props.value && typeof props.value !== 'undefined' && (props.value = []);
133
+ !props.defaultValue && typeof props.defaultValue !== 'undefined' && (props.defaultValue = []);
134
+ }else {
135
+ props.value && typeof props.value === 'object' && (props.value = JSON.stringify(props.value));
136
+ props.defaultValue && typeof props.defaultValue === 'object' && (props.defaultValue = JSON.stringify(props.defaultValue));
137
+ if (props.value !== true && props.value !== false && props.value !== '' && props.value !== undefined) {
138
+ props.value = String(props.value);
139
+ }
140
+ }
141
+ return <Select {...props}>{options.map(toOption)}</Select>;
142
+ };
143
+
144
+ const area = (props) => {
145
+ const areaProps = {
146
+ ...props,
147
+ onParentChange:props.onChange,
148
+ }
149
+ return <Area {...areaProps} />
150
+ }
151
+
152
+
153
+ // 下拉选择框-取title作为值
154
+ const selectText = (props) => {
155
+ const options = getTitleOptions(props.options) || [];
156
+ delete props.options;
157
+ props.showSearch = true;
158
+ props.filterOption = isMatch;
159
+ (props.allowClear !== false) && (props.allowClear = true);
160
+ if (props.mode === 'multiple') {
161
+ !props.value && typeof props.value !== 'undefined' && (props.value = []);
162
+ !props.defaultValue && typeof props.defaultValue !== 'undefined' && (props.defaultValue = []);
163
+ }else {
164
+ props.value && typeof props.value === 'object' && (props.value = JSON.stringify(props.value));
165
+ props.defaultValue && typeof props.defaultValue === 'object' && (props.defaultValue = JSON.stringify(props.defaultValue));
166
+ }
167
+ return <Select {...props}>{options.map(toOption)}</Select>;
168
+ };
169
+
170
+ // 搜索框
171
+ const search = (props) => {
172
+ if (props.ref) {
173
+ props.inputRef = props.ref;
174
+ delete props.ref;
175
+ }
176
+ return <InputSearch {...props} />;
177
+ };
178
+
179
+ // 搜索框-值取title
180
+ const searchText = (props) => {
181
+ if (props.ref) {
182
+ props.inputRef = props.ref;
183
+ delete props.ref;
184
+ }
185
+ props.options = getTitleOptions(props.options);
186
+ return <InputSearch {...props} />;
187
+ };
188
+
189
+ // 多选下拉搜索
190
+ const selectSearch = (props) => {
191
+ !props.value && typeof props.value !== 'undefined' && (props.value = []);
192
+ return <InputSelect {...props} />;
193
+ };
194
+
195
+ // 多选手写下拉 不支持title,value形式
196
+ const selectWriting = (props) => {
197
+ !props.value && typeof props.value !== 'undefined' && (props.value = []);
198
+ return <InputWriting {...props} />;
199
+ };
200
+
201
+ // 日期选择框
202
+ const date = (props) => {
203
+ const origin = props.onChange;
204
+ const { MonthPicker } = DatePicker;
205
+
206
+ if (typeof props.value !== 'undefined') {
207
+ props.value = !props.value ? undefined : moment(props.value);
208
+ }
209
+ if (typeof props.defaultValue !== 'undefined') {
210
+ props.defaultValue = !props.defaultValue ? undefined : moment(props.defaultValue);
211
+ }
212
+ if (props.showTime) {
213
+ props.format = 'YYYY-MM-DD HH:mm:ss';
214
+ props.placeholder = '请选择时间';
215
+ if (typeof props.showTime === 'boolean') {
216
+ props.showTime = '00:00:00';
217
+ }
218
+ if (props.showTime !== 'current') {
219
+ props.showTime = {defaultValue: moment(props.showTime, 'HH:mm:ss')};
220
+ } else {
221
+ props.showTime = true;
222
+ }
223
+ }
224
+ if (props.onChange) {
225
+ props.onChange = (date, str) => origin(str)
226
+ }
227
+ if(props.month){
228
+ props.format = 'YYYY-MM';
229
+ props.placeholder = '请选择日期';
230
+ return <div onBlur={props.onBlur}><MonthPicker {...props} /></div>;
231
+ }
232
+ return <div onBlur={props.onBlur}><DatePicker {...props} /></div>;
233
+ };
234
+
235
+ // 单选按钮组
236
+ const radioGroup = ({options = [], ...props}) => {
237
+ const origin = props.onChange;
238
+ props.style = {borderSpacing: 0};
239
+ typeof props.value === 'number' && (props.value = String(props.value));
240
+ typeof props.defaultValue === 'number' && (props.defaultValue = String(props.defaultValue));
241
+ if (props.onChange) {
242
+ props.onChange = (e) => origin(e.target.value);
243
+ }
244
+ return <RadioGroup {...props}>{options.map(toRadio)}</RadioGroup>;
245
+ };
246
+
247
+ // 富文本编辑器
248
+ const editor = (props) => {
249
+ return <InputEditor {...props}/>
250
+ };
251
+
252
+ //级联选择下拉
253
+ const cascader = (props) => {
254
+ !props.value && typeof props.value !== 'undefined' && (props.value = []);
255
+ return <InpurCascader {...props}/>
256
+ };
257
+ //树型结构
258
+ const treeSelect = (props) => {
259
+ !props.value && typeof props.value !== 'undefined' && (props.value = []);
260
+ return <InputTreeSelect {...props}/>
261
+ };
262
+ const captcha = (props) => {
263
+ if (props.ref) {
264
+ props.inputRef = props.ref;
265
+ delete props.ref;
266
+ }
267
+ return <CodeInput {...props}/>
268
+ }
269
+
270
+ const uploadImg = (props) => {
271
+ const uploadProps = {
272
+ ...props,
273
+ fileList:props.value || [],
274
+ readonly:props.readonly || false
275
+ };
276
+ return <SuperUpload {...uploadProps} />
277
+ };
278
+
279
+ // 支持的控件类型
280
+ const controls = {
281
+ text, textArea, readonly, number, select, selectText, search, searchText, date, radioGroup,password,editor,
282
+ selectSearch,selectWriting,cascader,captcha,area,uploadImg,double,treeSelect
283
+ };
284
+
285
+ const Control = ({type, autoFocus, ...props}) => {
286
+ const ref = autoFocus ? e => setFocus(e, type) : null;
287
+ const {doubleKey=undefined,onChangeKey1=undefined,onChangeKey2=undefined,doubleValue={}} = props
288
+ return controls[type](Object.assign(eventWrapper(props), type === 'double' ? {ref,doubleKey, onChangeKey1, onChangeKey2,doubleValue } : {ref }));
289
+ };
290
+
291
+ Control.propTypes = {
292
+ type: PropTypes.string.isRequired,
293
+ autoFocus: PropTypes.bool,
294
+ onChange: PropTypes.func,
295
+ onSearch: PropTypes.func,
296
+ onBlur: PropTypes.func,
297
+ onGetCode:PropTypes.func
298
+ };
299
+
300
+ // 依据value查找对应的标题
301
+ const getTitle = (value, options = []) => {
302
+ if (typeof value === 'undefined') {
303
+ return '';
304
+ } else if (typeof value === 'object') {
305
+ if (Array.isArray(value)) {
306
+ if (options && options.length > 0) {
307
+ // 处理多选字典下拉变成只读的情况:
308
+ return value.reduce((val, it) => {
309
+ const item = options.find(o => o.value === it);
310
+ if (item) {
311
+ val += ` ${item.title}`;
312
+ }
313
+ return val;
314
+ }, '').trim();
315
+ }
316
+ return value;
317
+ } else {
318
+ return value ? value.title : '';
319
+ }
320
+ } else {
321
+ const index = options.findIndex(obj => String(obj.value) === String(value));
322
+ return index === -1 ? value : options[index].title;
323
+ }
324
+ };
325
+
326
+ // 确保value的值为字符串(包含value和title的对象除外)
327
+ const makeString = (value) => {
328
+ if (value === null || typeof value === 'undefined') {
329
+ return '';
330
+ } else if (typeof value === 'number') {
331
+ return String(value);
332
+ } else {
333
+ return value;
334
+ }
335
+ };
336
+
337
+ export default Control;
338
+ export {getTitle, makeString};
@@ -0,0 +1,45 @@
1
+ import {getObjectExclude} from '../helper';
2
+
3
+ class EventHandler {
4
+ constructor(props) {
5
+ this.props = props;
6
+ }
7
+
8
+ toValue = (event='') => {
9
+ if (event === null) {
10
+ return '';
11
+ } else {
12
+ return event.nativeEvent ? event.target.value : event;
13
+ }
14
+ };
15
+
16
+ onChange = (event) => {
17
+ this.props.onChange(this.toValue(event));
18
+ };
19
+
20
+ onBlur = (event) => {
21
+ this.props.onBlur(this.toValue(event), event);
22
+ };
23
+
24
+ onSearch = (event) => {
25
+ this.props.onSearch(this.toValue(event));
26
+ };
27
+ }
28
+
29
+ const replaceEvent = (props, handler) => {
30
+ const events = ['onChange', 'onBlur', 'onSearch'];
31
+ let callback = events.reduce((result, event) => {
32
+ if (props[event]) {
33
+ result[event] = handler[event];
34
+ }
35
+ return result;
36
+ }, {});
37
+ return Object.assign({}, getObjectExclude(props, events), callback);
38
+ };
39
+
40
+ const eventWrapper = (props) => {
41
+ const handler = new EventHandler(props);
42
+ return replaceEvent(props, handler);
43
+ };
44
+
45
+ export default eventWrapper
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import {getObjectExclude} from '../helper';
3
+
4
+ const Enhance = (Container, keys, Dialogs, noContainer=false) => class extends React.Component {
5
+ toDialogs = () => {
6
+ return keys.reduce((result, key, index) => {
7
+ const Dialog = Dialogs[index];
8
+ this.props[key] && result.push(<Dialog key={key} container={this} />);
9
+ return result;
10
+ }, []);
11
+ };
12
+
13
+ render() {
14
+ const props = getObjectExclude(this.props, keys);
15
+ return (
16
+ <div className={noContainer ? null : 'modal-container'}>
17
+ <Container {...props}/>
18
+ {this.toDialogs()}
19
+ </div>
20
+ )
21
+ }
22
+ };
23
+
24
+ export default Enhance;