cloud-b2b 1.1.52 → 1.1.53

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 (307) hide show
  1. package/es/Area/Area.js +141 -0
  2. package/es/Card/Card.js +19 -0
  3. package/es/CodeInput/CodeInput.js +123 -0
  4. package/es/Control/Control.js +444 -0
  5. package/es/Control/event.js +43 -0
  6. package/es/Enhance/Dialogs.js +52 -0
  7. package/es/Enhance/Loading.js +131 -0
  8. package/{src → es}/Enhance/index.js +6 -8
  9. package/es/Header/Header.js +162 -0
  10. package/es/Header/Vertical.js +106 -0
  11. package/es/ImageView/ImageView.js +100 -0
  12. package/es/Indent/Indent.js +19 -0
  13. package/es/InpurCascader/InputCascader.js +108 -0
  14. package/es/InputEditor/InputEditor.js +173 -0
  15. package/es/InputSearch/InputSearch.js +266 -0
  16. package/es/InputSelect/InputSelect.js +160 -0
  17. package/es/InputTreeSelect/InputTreeSelect.js +121 -0
  18. package/es/InputWriting/InputWriting.js +85 -0
  19. package/es/Layout/Layout.js +201 -0
  20. package/es/LayoutLink/LayoutLink.js +73 -0
  21. package/es/Link/Link.js +85 -0
  22. package/es/Loading/Loading.js +13 -0
  23. package/es/Loading2/Loading2.js +9 -0
  24. package/es/ModalWithDrag/ModalWithDrag.js +29 -0
  25. package/{src → es}/ModalWithDrag/drag.js +116 -128
  26. package/es/NumberInput/NumberInput.js +200 -0
  27. package/es/Search/Search.js +497 -0
  28. package/es/Sidebar/Sidebar.js +144 -0
  29. package/es/Sidebar2/Sidebar.js +165 -0
  30. package/es/SuperForm/SuperForm.js +593 -0
  31. package/es/SuperForm2/SuperForm.js +687 -0
  32. package/es/SuperIcon/SuperIcon.js +27 -0
  33. package/es/SuperPagination/SuperPagination.js +109 -0
  34. package/es/SuperTab/SuperTab.js +107 -0
  35. package/es/SuperTab2/SuperTab2.js +145 -0
  36. package/es/SuperTable/DragSortRow.js +97 -0
  37. package/es/SuperTable/FilterDropDown.js +164 -0
  38. package/es/SuperTable/SuperTable.js +808 -0
  39. package/es/SuperTable/fixed.js +34 -0
  40. package/es/SuperTable2/SuperTable2.js +894 -0
  41. package/es/SuperTable2/SuperTableCell.js +198 -0
  42. package/es/SuperTable3/FilterDropDown.js +164 -0
  43. package/es/SuperTable3/SuperTable.js +665 -0
  44. package/es/SuperTable3/fixed.js +34 -0
  45. package/es/SuperToolbar/SuperToolbar.js +195 -0
  46. package/es/SuperUpload/SuperUpload.js +356 -0
  47. package/es/Title/Title.js +33 -0
  48. package/es/Viewer/ImageViews.js +258 -0
  49. package/es/Viewer/Viewer.js +122 -0
  50. package/es/WingBlank/WingBlank.js +16 -0
  51. package/es/helper.js +240 -0
  52. package/{src → es}/history.js +6 -6
  53. package/es/index.js +37 -0
  54. package/es/variables.js +6 -0
  55. package/lib/Area/Area.js +149 -0
  56. package/lib/Area/package.json +6 -0
  57. package/lib/Card/Card.js +27 -0
  58. package/lib/Card/package.json +6 -0
  59. package/lib/CodeInput/CodeInput.js +131 -0
  60. package/lib/CodeInput/package.json +6 -0
  61. package/lib/Control/Control.js +450 -0
  62. package/lib/Control/event.js +51 -0
  63. package/lib/Control/package.json +6 -0
  64. package/lib/Enhance/Dialogs.js +60 -0
  65. package/lib/Enhance/Loading.js +138 -0
  66. package/lib/Enhance/index.js +25 -0
  67. package/lib/Enhance/package.json +6 -0
  68. package/lib/Header/Header.js +169 -0
  69. package/lib/Header/Header.less +95 -0
  70. package/lib/Header/Vertical.js +114 -0
  71. package/lib/Header/Vertical.less +60 -0
  72. package/lib/Header/package.json +6 -0
  73. package/lib/ImageView/ImageView.js +108 -0
  74. package/lib/ImageView/ImageView.less +14 -0
  75. package/lib/ImageView/package.json +6 -0
  76. package/lib/Indent/Indent.js +27 -0
  77. package/lib/Indent/package.json +6 -0
  78. package/lib/InpurCascader/InputCascader.js +115 -0
  79. package/lib/InpurCascader/package.json +6 -0
  80. package/lib/InputEditor/InputEditor.js +181 -0
  81. package/lib/InputEditor/inputEditor.less +8 -0
  82. package/lib/InputEditor/package.json +6 -0
  83. package/lib/InputSearch/InputSearch.js +274 -0
  84. package/lib/InputSearch/package.json +6 -0
  85. package/lib/InputSelect/InputSelect.js +168 -0
  86. package/lib/InputSelect/package.json +6 -0
  87. package/lib/InputTreeSelect/InputTreeSelect.js +128 -0
  88. package/lib/InputTreeSelect/package.json +6 -0
  89. package/lib/InputWriting/InputWriting.js +93 -0
  90. package/lib/InputWriting/package.json +6 -0
  91. package/lib/Layout/Layout.js +209 -0
  92. package/lib/Layout/Layout.less +28 -0
  93. package/lib/Layout/package.json +6 -0
  94. package/lib/LayoutLink/LayoutLink.js +86 -0
  95. package/lib/LayoutLink/LayoutLink.less +53 -0
  96. package/lib/LayoutLink/package.json +6 -0
  97. package/lib/Link/Link.js +93 -0
  98. package/lib/Link/package.json +6 -0
  99. package/lib/Loading/Loading.js +21 -0
  100. package/lib/Loading/Loading.less +13 -0
  101. package/lib/Loading/package.json +6 -0
  102. package/lib/Loading2/Loading2.js +17 -0
  103. package/lib/Loading2/Loading2.less +19 -0
  104. package/lib/Loading2/package.json +6 -0
  105. package/lib/ModalWithDrag/ModalWithDrag.js +37 -0
  106. package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
  107. package/lib/ModalWithDrag/drag.js +124 -0
  108. package/lib/ModalWithDrag/package.json +6 -0
  109. package/lib/NumberInput/NumberInput.js +208 -0
  110. package/lib/NumberInput/package.json +6 -0
  111. package/lib/Search/Search.js +510 -0
  112. package/lib/Search/Search.less +63 -0
  113. package/lib/Search/package.json +6 -0
  114. package/lib/Sidebar/Sidebar.js +152 -0
  115. package/lib/Sidebar/Sidebar.less +78 -0
  116. package/lib/Sidebar/package.json +6 -0
  117. package/lib/Sidebar2/Sidebar.js +173 -0
  118. package/lib/Sidebar2/Sidebar.less +153 -0
  119. package/lib/Sidebar2/package.json +6 -0
  120. package/lib/SuperForm/SuperForm.js +605 -0
  121. package/lib/SuperForm/SuperForm.less +52 -0
  122. package/lib/SuperForm/package.json +6 -0
  123. package/lib/SuperForm2/SuperForm.js +699 -0
  124. package/lib/SuperForm2/SuperForm.less +52 -0
  125. package/lib/SuperForm2/package.json +6 -0
  126. package/lib/SuperIcon/SuperIcon.js +35 -0
  127. package/lib/SuperIcon/package.json +6 -0
  128. package/lib/SuperPagination/SuperPagination.js +117 -0
  129. package/lib/SuperPagination/package.json +6 -0
  130. package/lib/SuperTab/SuperTab.js +115 -0
  131. package/lib/SuperTab/SuperTab.less +43 -0
  132. package/lib/SuperTab/package.json +6 -0
  133. package/lib/SuperTab2/SuperTab2.js +153 -0
  134. package/lib/SuperTab2/SuperTab2.less +18 -0
  135. package/lib/SuperTab2/package.json +6 -0
  136. package/lib/SuperTable/DragSortRow.js +105 -0
  137. package/lib/SuperTable/DragSortRow.less +17 -0
  138. package/lib/SuperTable/FilterDropDown.js +172 -0
  139. package/lib/SuperTable/FilterDropDown.less +30 -0
  140. package/lib/SuperTable/SuperTable.js +816 -0
  141. package/lib/SuperTable/SuperTable.less +132 -0
  142. package/lib/SuperTable/fixed.js +42 -0
  143. package/lib/SuperTable/package.json +6 -0
  144. package/lib/SuperTable2/SuperTable2.js +907 -0
  145. package/lib/SuperTable2/SuperTable2.less +118 -0
  146. package/lib/SuperTable2/SuperTableCell.js +203 -0
  147. package/lib/SuperTable2/package.json +6 -0
  148. package/lib/SuperTable3/FilterDropDown.js +172 -0
  149. package/lib/SuperTable3/FilterDropDown.less +29 -0
  150. package/lib/SuperTable3/SuperTable.js +673 -0
  151. package/lib/SuperTable3/SuperTable.less +99 -0
  152. package/lib/SuperTable3/fixed.js +42 -0
  153. package/lib/SuperTable3/package.json +6 -0
  154. package/lib/SuperToolbar/SuperToolbar.js +203 -0
  155. package/lib/SuperToolbar/SuperToolbar.less +17 -0
  156. package/lib/SuperToolbar/package.json +6 -0
  157. package/lib/SuperUpload/SuperUpload.js +368 -0
  158. package/lib/SuperUpload/SuperUpload.less +28 -0
  159. package/lib/SuperUpload/package.json +6 -0
  160. package/lib/Title/Title.js +41 -0
  161. package/lib/Title/Title.less +35 -0
  162. package/lib/Title/package.json +6 -0
  163. package/lib/Viewer/ImageViews.js +266 -0
  164. package/lib/Viewer/Viewer.js +130 -0
  165. package/lib/Viewer/Viewer.less +67 -0
  166. package/lib/Viewer/imgView.less +59 -0
  167. package/lib/Viewer/package.json +7 -0
  168. package/lib/WingBlank/WingBlank.js +24 -0
  169. package/lib/WingBlank/WingBlank.less +12 -0
  170. package/lib/WingBlank/package.json +6 -0
  171. package/lib/adjust.less +89 -0
  172. package/lib/helper.js +246 -0
  173. package/lib/history.js +12 -0
  174. package/lib/index.js +271 -0
  175. package/lib/index.less +31 -0
  176. package/lib/style.less +30 -0
  177. package/lib/variables.js +14 -0
  178. package/lib/variables.less +73 -0
  179. package/package.json +22 -44
  180. package/src/Area/Area.js +0 -94
  181. package/src/Card/Card.js +0 -16
  182. package/src/CodeInput/CodeInput.js +0 -76
  183. package/src/Control/Control.js +0 -338
  184. package/src/Control/event.js +0 -45
  185. package/src/Enhance/Dialogs.js +0 -24
  186. package/src/Enhance/Loading.js +0 -83
  187. package/src/Header/Header.js +0 -149
  188. package/src/Header/Vertical.js +0 -74
  189. package/src/ImageView/ImageView.js +0 -62
  190. package/src/Indent/Indent.js +0 -12
  191. package/src/InpurCascader/InputCascader.js +0 -83
  192. package/src/InputEditor/InputEditor.js +0 -93
  193. package/src/InputSearch/InputSearch.js +0 -186
  194. package/src/InputSelect/InputSelect.js +0 -103
  195. package/src/InputTreeSelect/InputTreeSelect.js +0 -87
  196. package/src/InputWriting/InputWriting.js +0 -65
  197. package/src/Layout/Layout.js +0 -121
  198. package/src/LayoutLink/LayoutLink.js +0 -59
  199. package/src/Link/Link.js +0 -57
  200. package/src/Loading/Loading.js +0 -15
  201. package/src/Loading2/Loading2.js +0 -15
  202. package/src/ModalWithDrag/ModalWithDrag.js +0 -17
  203. package/src/NumberInput/NumberInput.js +0 -137
  204. package/src/Search/Search.js +0 -368
  205. package/src/Sidebar/Sidebar.js +0 -111
  206. package/src/Sidebar2/Sidebar.js +0 -143
  207. package/src/SuperForm/SuperForm.js +0 -516
  208. package/src/SuperForm2/SuperForm.js +0 -588
  209. package/src/SuperIcon/SuperIcon.js +0 -14
  210. package/src/SuperPagination/SuperPagination.js +0 -65
  211. package/src/SuperTab/SuperTab.js +0 -84
  212. package/src/SuperTab2/SuperTab2.js +0 -94
  213. package/src/SuperTable/DragSortRow.js +0 -62
  214. package/src/SuperTable/FilterDropDown.js +0 -111
  215. package/src/SuperTable/SuperTable.js +0 -590
  216. package/src/SuperTable/fixed.js +0 -34
  217. package/src/SuperTable2/SuperTable2.js +0 -600
  218. package/src/SuperTable2/SuperTableCell.js +0 -144
  219. package/src/SuperTable3/FilterDropDown.js +0 -111
  220. package/src/SuperTable3/SuperTable.js +0 -498
  221. package/src/SuperTable3/fixed.js +0 -34
  222. package/src/SuperToolbar/SuperToolbar.js +0 -128
  223. package/src/SuperUpload/SuperUpload.js +0 -137
  224. package/src/Title/Title.js +0 -18
  225. package/src/Viewer/ImageViews.js +0 -220
  226. package/src/Viewer/Viewer.js +0 -97
  227. package/src/WingBlank/WingBlank.js +0 -14
  228. package/src/helper.js +0 -185
  229. package/src/index.js +0 -38
  230. package/src/variables.js +0 -5
  231. package/test/index.html +0 -10
  232. package/test/test.js +0 -16
  233. package/test/test.less +0 -12
  234. package/test/webpack.config.js +0 -71
  235. package/tools/babel.config.js +0 -14
  236. package/tools/build.js +0 -70
  237. package/tools/publish.js +0 -9
  238. package/tools/util.js +0 -53
  239. /package/{src → es}/Area/package.json +0 -0
  240. /package/{src → es}/Card/package.json +0 -0
  241. /package/{src → es}/CodeInput/package.json +0 -0
  242. /package/{src → es}/Control/package.json +0 -0
  243. /package/{src → es}/Enhance/package.json +0 -0
  244. /package/{src → es}/Header/Header.less +0 -0
  245. /package/{src → es}/Header/Vertical.less +0 -0
  246. /package/{src → es}/Header/package.json +0 -0
  247. /package/{src → es}/ImageView/ImageView.less +0 -0
  248. /package/{src → es}/ImageView/package.json +0 -0
  249. /package/{src → es}/Indent/package.json +0 -0
  250. /package/{src → es}/InpurCascader/package.json +0 -0
  251. /package/{src → es}/InputEditor/inputEditor.less +0 -0
  252. /package/{src → es}/InputEditor/package.json +0 -0
  253. /package/{src → es}/InputSearch/package.json +0 -0
  254. /package/{src → es}/InputSelect/package.json +0 -0
  255. /package/{src → es}/InputTreeSelect/package.json +0 -0
  256. /package/{src → es}/InputWriting/package.json +0 -0
  257. /package/{src → es}/Layout/Layout.less +0 -0
  258. /package/{src → es}/Layout/package.json +0 -0
  259. /package/{src → es}/LayoutLink/LayoutLink.less +0 -0
  260. /package/{src → es}/LayoutLink/package.json +0 -0
  261. /package/{src → es}/Link/package.json +0 -0
  262. /package/{src → es}/Loading/Loading.less +0 -0
  263. /package/{src → es}/Loading/package.json +0 -0
  264. /package/{src → es}/Loading2/Loading2.less +0 -0
  265. /package/{src → es}/Loading2/package.json +0 -0
  266. /package/{src → es}/ModalWithDrag/ModalWithDrag.less +0 -0
  267. /package/{src → es}/ModalWithDrag/package.json +0 -0
  268. /package/{src → es}/NumberInput/package.json +0 -0
  269. /package/{src → es}/Search/Search.less +0 -0
  270. /package/{src → es}/Search/package.json +0 -0
  271. /package/{src → es}/Sidebar/Sidebar.less +0 -0
  272. /package/{src → es}/Sidebar/package.json +0 -0
  273. /package/{src → es}/Sidebar2/Sidebar.less +0 -0
  274. /package/{src → es}/Sidebar2/package.json +0 -0
  275. /package/{src → es}/SuperForm/SuperForm.less +0 -0
  276. /package/{src → es}/SuperForm/package.json +0 -0
  277. /package/{src → es}/SuperForm2/SuperForm.less +0 -0
  278. /package/{src → es}/SuperForm2/package.json +0 -0
  279. /package/{src → es}/SuperIcon/package.json +0 -0
  280. /package/{src → es}/SuperPagination/package.json +0 -0
  281. /package/{src → es}/SuperTab/SuperTab.less +0 -0
  282. /package/{src → es}/SuperTab/package.json +0 -0
  283. /package/{src → es}/SuperTab2/SuperTab2.less +0 -0
  284. /package/{src → es}/SuperTab2/package.json +0 -0
  285. /package/{src → es}/SuperTable/DragSortRow.less +0 -0
  286. /package/{src → es}/SuperTable/FilterDropDown.less +0 -0
  287. /package/{src → es}/SuperTable/SuperTable.less +0 -0
  288. /package/{src → es}/SuperTable/package.json +0 -0
  289. /package/{src → es}/SuperTable2/SuperTable2.less +0 -0
  290. /package/{src → es}/SuperTable2/package.json +0 -0
  291. /package/{src → es}/SuperTable3/FilterDropDown.less +0 -0
  292. /package/{src → es}/SuperTable3/SuperTable.less +0 -0
  293. /package/{src → es}/SuperTable3/package.json +0 -0
  294. /package/{src → es}/SuperToolbar/SuperToolbar.less +0 -0
  295. /package/{src → es}/SuperToolbar/package.json +0 -0
  296. /package/{src → es}/SuperUpload/SuperUpload.less +0 -0
  297. /package/{src → es}/SuperUpload/package.json +0 -0
  298. /package/{src → es}/Title/Title.less +0 -0
  299. /package/{src → es}/Title/package.json +0 -0
  300. /package/{src → es}/Viewer/Viewer.less +0 -0
  301. /package/{src → es}/Viewer/imgView.less +0 -0
  302. /package/{src → es}/Viewer/package.json +0 -0
  303. /package/{src → es}/WingBlank/WingBlank.less +0 -0
  304. /package/{src → es}/WingBlank/package.json +0 -0
  305. /package/{src → es}/adjust.less +0 -0
  306. /package/{src → es}/style.less +0 -0
  307. /package/{src → es}/variables.less +0 -0
package/package.json CHANGED
@@ -1,44 +1,22 @@
1
- {
2
- "name": "cloud-b2b",
3
- "version": "1.1.52",
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 tools/build",
41
- "publish": "node tools/publish",
42
- "test": "webpack-dev-server --config test/webpack.config.js"
43
- }
44
- }
1
+ {
2
+ "name": "cloud-b2b",
3
+ "version": "1.1.53",
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
+ }
package/src/Area/Area.js DELETED
@@ -1,94 +0,0 @@
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;
package/src/Card/Card.js DELETED
@@ -1,16 +0,0 @@
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
-
@@ -1,76 +0,0 @@
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;
@@ -1,338 +0,0 @@
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};
@@ -1,45 +0,0 @@
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
@@ -1,24 +0,0 @@
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;