cloud-b2b 1.1.58 → 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 -141
  68. package/es/Card/Card.js +0 -19
  69. package/es/CodeInput/CodeInput.js +0 -123
  70. package/es/Control/Control.js +0 -444
  71. package/es/Control/event.js +0 -43
  72. package/es/Enhance/Dialogs.js +0 -52
  73. package/es/Enhance/Loading.js +0 -131
  74. package/es/Header/Header.js +0 -162
  75. package/es/Header/Vertical.js +0 -106
  76. package/es/ImageView/ImageView.js +0 -100
  77. package/es/Indent/Indent.js +0 -19
  78. package/es/InpurCascader/InputCascader.js +0 -117
  79. package/es/InputEditor/InputEditor.js +0 -173
  80. package/es/InputSearch/InputSearch.js +0 -266
  81. package/es/InputSelect/InputSelect.js +0 -160
  82. package/es/InputTreeSelect/InputTreeSelect.js +0 -121
  83. package/es/InputWriting/InputWriting.js +0 -85
  84. package/es/Layout/Layout.js +0 -201
  85. package/es/LayoutLink/LayoutLink.js +0 -73
  86. package/es/Link/Link.js +0 -85
  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 -200
  91. package/es/Search/Search.js +0 -497
  92. package/es/Sidebar/Sidebar.js +0 -144
  93. package/es/Sidebar2/Sidebar.js +0 -165
  94. package/es/SuperForm/SuperForm.js +0 -598
  95. package/es/SuperForm2/SuperForm.js +0 -687
  96. package/es/SuperIcon/SuperIcon.js +0 -27
  97. package/es/SuperPagination/SuperPagination.js +0 -109
  98. package/es/SuperTab/SuperTab.js +0 -107
  99. package/es/SuperTab2/SuperTab2.js +0 -145
  100. package/es/SuperTable/DragSortRow.js +0 -97
  101. package/es/SuperTable/FilterDropDown.js +0 -164
  102. package/es/SuperTable/SuperTable.js +0 -808
  103. package/es/SuperTable/fixed.js +0 -34
  104. package/es/SuperTable2/SuperTable2.js +0 -926
  105. package/es/SuperTable2/SuperTableCell.js +0 -225
  106. package/es/SuperTable3/FilterDropDown.js +0 -164
  107. package/es/SuperTable3/SuperTable.js +0 -665
  108. package/es/SuperTable3/fixed.js +0 -34
  109. package/es/SuperToolbar/SuperToolbar.js +0 -195
  110. package/es/SuperUpload/SuperUpload.js +0 -356
  111. package/es/Title/Title.js +0 -33
  112. package/es/Viewer/ImageViews.js +0 -258
  113. package/es/Viewer/Viewer.js +0 -122
  114. package/es/WingBlank/WingBlank.js +0 -16
  115. package/es/helper.js +0 -240
  116. package/es/index.js +0 -37
  117. package/es/variables.js +0 -6
  118. package/lib/Area/Area.js +0 -149
  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 -131
  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 -60
  128. package/lib/Enhance/Loading.js +0 -138
  129. package/lib/Enhance/index.js +0 -25
  130. package/lib/Enhance/package.json +0 -6
  131. package/lib/Header/Header.js +0 -169
  132. package/lib/Header/Header.less +0 -95
  133. package/lib/Header/Vertical.js +0 -114
  134. package/lib/Header/Vertical.less +0 -60
  135. package/lib/Header/package.json +0 -6
  136. package/lib/ImageView/ImageView.js +0 -108
  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 -124
  142. package/lib/InpurCascader/package.json +0 -6
  143. package/lib/InputEditor/InputEditor.js +0 -181
  144. package/lib/InputEditor/inputEditor.less +0 -8
  145. package/lib/InputEditor/package.json +0 -6
  146. package/lib/InputSearch/InputSearch.js +0 -274
  147. package/lib/InputSearch/package.json +0 -6
  148. package/lib/InputSelect/InputSelect.js +0 -168
  149. package/lib/InputSelect/package.json +0 -6
  150. package/lib/InputTreeSelect/InputTreeSelect.js +0 -128
  151. package/lib/InputTreeSelect/package.json +0 -6
  152. package/lib/InputWriting/InputWriting.js +0 -93
  153. package/lib/InputWriting/package.json +0 -6
  154. package/lib/Layout/Layout.js +0 -209
  155. package/lib/Layout/Layout.less +0 -28
  156. package/lib/Layout/package.json +0 -6
  157. package/lib/LayoutLink/LayoutLink.js +0 -86
  158. package/lib/LayoutLink/LayoutLink.less +0 -53
  159. package/lib/LayoutLink/package.json +0 -6
  160. package/lib/Link/Link.js +0 -93
  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 -208
  173. package/lib/NumberInput/package.json +0 -6
  174. package/lib/Search/Search.js +0 -510
  175. package/lib/Sidebar/Sidebar.js +0 -152
  176. package/lib/Sidebar/Sidebar.less +0 -78
  177. package/lib/Sidebar/package.json +0 -6
  178. package/lib/Sidebar2/Sidebar.js +0 -173
  179. package/lib/Sidebar2/Sidebar.less +0 -153
  180. package/lib/Sidebar2/package.json +0 -6
  181. package/lib/SuperForm/SuperForm.js +0 -610
  182. package/lib/SuperForm/SuperForm.less +0 -52
  183. package/lib/SuperForm/package.json +0 -6
  184. package/lib/SuperForm2/SuperForm.js +0 -699
  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 -117
  190. package/lib/SuperPagination/package.json +0 -6
  191. package/lib/SuperTab/SuperTab.js +0 -115
  192. package/lib/SuperTab/SuperTab.less +0 -43
  193. package/lib/SuperTab/package.json +0 -6
  194. package/lib/SuperTab2/SuperTab2.js +0 -153
  195. package/lib/SuperTab2/SuperTab2.less +0 -18
  196. package/lib/SuperTab2/package.json +0 -6
  197. package/lib/SuperTable/DragSortRow.js +0 -105
  198. package/lib/SuperTable/DragSortRow.less +0 -17
  199. package/lib/SuperTable/FilterDropDown.js +0 -172
  200. package/lib/SuperTable/FilterDropDown.less +0 -30
  201. package/lib/SuperTable/SuperTable.js +0 -816
  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 -939
  206. package/lib/SuperTable2/SuperTable2.less +0 -118
  207. package/lib/SuperTable2/SuperTableCell.js +0 -230
  208. package/lib/SuperTable2/package.json +0 -6
  209. package/lib/SuperTable3/FilterDropDown.js +0 -172
  210. package/lib/SuperTable3/FilterDropDown.less +0 -29
  211. package/lib/SuperTable3/SuperTable.js +0 -673
  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 -203
  216. package/lib/SuperToolbar/SuperToolbar.less +0 -17
  217. package/lib/SuperToolbar/package.json +0 -6
  218. package/lib/SuperUpload/SuperUpload.js +0 -368
  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 -266
  225. package/lib/Viewer/Viewer.js +0 -130
  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 -246
  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
@@ -1,598 +0,0 @@
1
- import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
2
- import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
3
- import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
4
- import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
5
- import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
6
- import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
7
- import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
8
- import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
9
- import _Row from "antd/es/row";
10
- import _Col from "antd/es/col";
11
- import _extends from "@babel/runtime-corejs3/helpers/extends";
12
- import _Checkbox from "antd/es/checkbox";
13
- import _Icon from "antd/es/icon";
14
- import _typeof from "@babel/runtime-corejs3/helpers/typeof";
15
- import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
16
- import _createClass from "@babel/runtime-corejs3/helpers/createClass";
17
- import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
18
- import _inherits from "@babel/runtime-corejs3/helpers/inherits";
19
- import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
20
- import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
21
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
22
- import _Form from "antd/es/form";
23
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
24
- import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
25
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
26
- import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
27
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
28
- import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
29
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
30
- function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
31
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context17, _context18; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context17 = ownKeys(Object(t), !0)).call(_context17, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context18 = ownKeys(Object(t))).call(_context18, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
32
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
33
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
34
- import React from 'react';
35
- import PropTypes from 'prop-types';
36
- import ReactDOM from 'react-dom';
37
- import helper from '../helper';
38
- import Control, { getTitle, makeString } from '../Control';
39
- import variables from '../variables';
40
- var FormItem = _Form.Item;
41
- var defaultSize = 'small';
42
- var defaultColNum = 4;
43
- var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg', 'cascader', 'treeSelect'];
44
-
45
- /**
46
- * key:[必须],用于唯一标识该Form下的一个表单元素
47
- * title:[必须],表单元素的标签
48
- * type:[必须],表单元素类型
49
- * required: [可选],是否为必填项
50
- * options: [可选],对象数组(type为readonly,radio,search, searchText,select, selectText时有效)
51
- * span: [可选],占据的列数,默认为1
52
- * showAdd: [可选],是否显示+号,点击+号会触发onAdd事件,默认为false
53
- * rule: [可选],用于设置校验规则
54
- * highLightKeys: [可选],用于设置高亮样式,仅只读字段生效
55
- */
56
- var ControlType = {
57
- key: PropTypes.string.isRequired,
58
- title: PropTypes.string,
59
- type: PropTypes.oneOf(TYPE).isRequired,
60
- required: PropTypes.bool,
61
- options: PropTypes.array,
62
- span: PropTypes.number,
63
- onCheckItem: PropTypes.any,
64
- showAdd: PropTypes.any,
65
- rule: PropTypes.object,
66
- props: PropTypes.object
67
- };
68
- var Controlled = /*#__PURE__*/function (_React$Component) {
69
- _inherits(Controlled, _React$Component);
70
- var _super = _createSuper(Controlled);
71
- function Controlled(props) {
72
- var _this;
73
- _classCallCheck(this, Controlled);
74
- _this = _super.call(this, props);
75
- _defineProperty(_assertThisInitialized(_this), "onChange", function (value) {
76
- var onChange = _this.props.onChange;
77
- _this.setState({
78
- value: value
79
- });
80
- onChange && onChange(value);
81
- });
82
- _this.state = {
83
- value: props.value
84
- };
85
- return _this;
86
- }
87
- _createClass(Controlled, [{
88
- key: "componentWillReceiveProps",
89
- value: function componentWillReceiveProps(nextProps) {
90
- if (this.props.value !== nextProps.value) {
91
- this.setState({
92
- value: nextProps.value
93
- });
94
- }
95
- }
96
- }, {
97
- key: "render",
98
- value: function render() {
99
- var props = _objectSpread(_objectSpread({}, this.props), {}, {
100
- value: this.state.value,
101
- onChange: this.onChange
102
- });
103
- return /*#__PURE__*/React.createElement(Control, props);
104
- }
105
- }]);
106
- return Controlled;
107
- }(React.Component);
108
- /**
109
- * colNum:[可选],表单的列数,默认为4
110
- * readonly: [可选],为true时,所有表单元素都是只读的; 为字符串数组时,用于指定key的表单元素是只读的
111
- * hideControls: [可选],指定key的表单元素被隐藏
112
- * options: [可选],键值对,值与ControlType中options作用相同,但优先级更高
113
- * onChange:内容改变时触发,原型为func(key, value)
114
- * onSearch:搜索框中用户输入时触发,原型为func(key, title, control)
115
- * onAdd: 点击+号时触发,原型为func(key)
116
- * checkable:是否显示checkbox选择框
117
- * onOpenChange:控制日期框显示隐藏回调func(key, open)
118
- * onAreaSearch:联级选择器触发,原型为func(key - 当前联级key, title - 输入值, parentKey - 主体联级key)
119
- * OnFileChange:上传组件触发,原型为func(key,{fileList, fileDeleteList})
120
- */
121
- var SuperForm = /*#__PURE__*/function (_React$Component2) {
122
- _inherits(SuperForm, _React$Component2);
123
- var _super2 = _createSuper(SuperForm);
124
- function SuperForm() {
125
- var _context;
126
- var _this2;
127
- _classCallCheck(this, SuperForm);
128
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
129
- args[_key] = arguments[_key];
130
- }
131
- _this2 = _super2.call.apply(_super2, _concatInstanceProperty(_context = [this]).call(_context, args));
132
- _defineProperty(_assertThisInitialized(_this2), "onAdd", function (key, title) {
133
- var onAdd = _this2.props.onAdd;
134
- onAdd && onAdd(key, title);
135
- });
136
- _defineProperty(_assertThisInitialized(_this2), "onChange", function (key, value) {
137
- var onChange = _this2.props.onChange;
138
- if (onChange) {
139
- _this2.onExitValid(key);
140
- onChange(key, value);
141
- }
142
- });
143
- _defineProperty(_assertThisInitialized(_this2), "onBlur", function (key, value) {
144
- var onChange = _this2.props.onChange;
145
- if (onChange) {
146
- _this2.onExitValid(key);
147
- onChange(key, value);
148
- }
149
- });
150
- _defineProperty(_assertThisInitialized(_this2), "onFileChange", function (_ref, file) {
151
- var key = _ref.key;
152
- var onFileChange = _this2.props.onFileChange;
153
- onFileChange && onFileChange(key, file);
154
- });
155
- _defineProperty(_assertThisInitialized(_this2), "onExitValid", function (key, value) {
156
- if (key === _this2.validKey) {
157
- _this2.validKey = '';
158
- _this2.props.onExitValid();
159
- }
160
- _this2.props.onChangeOperate && _this2.props.onChangeOperate(key, value);
161
- });
162
- // 动态生成getValidState方法
163
- _defineProperty(_assertThisInitialized(_this2), "initValidState", function () {
164
- var _this2$props = _this2.props,
165
- value = _this2$props.value,
166
- valid = _this2$props.valid;
167
- var invalid = function invalid() {
168
- return null;
169
- };
170
- var _valid = function _valid(_ref2) {
171
- var key = _ref2.key,
172
- required = _ref2.required;
173
- if (required) {
174
- if (!value || helper.isEmpty2(value[key]) || !_Array$isArray(value[key]) && _typeof(value[key]) === 'object' && helper.isEmpty(value[key].value)) {
175
- _this2.getValidState = invalid;
176
- _this2.validKey = key;
177
- return 'error';
178
- }
179
- }
180
- return null;
181
- };
182
- _this2.getValidState = valid ? _valid : invalid;
183
- });
184
- _defineProperty(_assertThisInitialized(_this2), "validDate", function (_ref3) {
185
- var key = _ref3.key,
186
- type = _ref3.type;
187
- return function (date) {
188
- var _this2$props$value = _this2.props.value,
189
- value = _this2$props$value === void 0 ? {} : _this2$props$value;
190
- if (!date || !value[key]) {
191
- return false;
192
- } else {
193
- if (type === '>') {
194
- return date.format('YYYY-MM-DD') <= value[key];
195
- } else if (type === '<') {
196
- return date.format('YYYY-MM-DD') >= value[key];
197
- } else {
198
- return false;
199
- }
200
- }
201
- };
202
- });
203
- _defineProperty(_assertThisInitialized(_this2), "getPopupContainer", function () {
204
- var container = _this2.props.container;
205
- if (typeof container === 'undefined') {
206
- return ReactDOM.findDOMNode(_assertThisInitialized(_this2));
207
- } else if (typeof container === 'boolean') {
208
- return document.body;
209
- } else {
210
- return ReactDOM.findDOMNode(container);
211
- }
212
- });
213
- _defineProperty(_assertThisInitialized(_this2), "getMaxWidth", function () {
214
- var _this2$props$colNum = _this2.props.colNum,
215
- colNum = _this2$props$colNum === void 0 ? defaultColNum : _this2$props$colNum;
216
- return colNum * 250;
217
- });
218
- _defineProperty(_assertThisInitialized(_this2), "getContainer", function () {
219
- return _this2.props.getContainer;
220
- });
221
- _defineProperty(_assertThisInitialized(_this2), "getControls", function () {
222
- var _this2$props2 = _this2.props,
223
- hideControls = _this2$props2.hideControls,
224
- controls = _this2$props2.controls;
225
- if (!hideControls) {
226
- return controls;
227
- } else {
228
- return _filterInstanceProperty(controls).call(controls, function (control) {
229
- return !_someInstanceProperty(hideControls).call(hideControls, function (key) {
230
- return control.key === key;
231
- });
232
- });
233
- }
234
- });
235
- _defineProperty(_assertThisInitialized(_this2), "getType", function (_ref4) {
236
- var _context2;
237
- var key = _ref4.key,
238
- type = _ref4.type;
239
- var readonly = _this2.props.readonly;
240
- if (_includesInstanceProperty(_context2 = ['area', 'uploadImg']).call(_context2, type)) {
241
- return type;
242
- } else if (!readonly) {
243
- return type;
244
- } else if (readonly === true) {
245
- return 'readonly';
246
- } else if (_Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
247
- return readonlyKey === key;
248
- })) {
249
- return 'readonly';
250
- } else {
251
- return type;
252
- }
253
- });
254
- _defineProperty(_assertThisInitialized(_this2), "specialProps", function (type, _ref5) {
255
- var key = _ref5.key,
256
- _ref5$props = _ref5.props,
257
- props = _ref5$props === void 0 ? {} : _ref5$props,
258
- originType = _ref5.type;
259
- if (type === 'readonly') {
260
- var _this2$props$highLigh = _this2.props.highLightKeys,
261
- highLightKeys = _this2$props$highLigh === void 0 ? [] : _this2$props$highLigh;
262
- var style = _includesInstanceProperty(highLightKeys).call(highLightKeys, key) ? {
263
- backgroundColor: 'red',
264
- color: 'white'
265
- } : {
266
- backgroundColor: '#f0f0f0'
267
- };
268
- if (originType === 'textArea') {
269
- var _context3;
270
- return {
271
- type: 'textArea',
272
- readonly: true,
273
- style: style,
274
- onBlur: _bindInstanceProperty(_context3 = _this2.onExitValid).call(_context3, _assertThisInitialized(_this2), key)
275
- };
276
- } else {
277
- var _context4;
278
- return {
279
- style: style,
280
- onBlur: _bindInstanceProperty(_context4 = _this2.onExitValid).call(_context4, _assertThisInitialized(_this2), key)
281
- };
282
- }
283
- } else if (type === 'text' || type === 'textArea') {
284
- var _context5, _context6;
285
- return _objectSpread(_objectSpread({}, props), {}, {
286
- onChange: _bindInstanceProperty(_context5 = _this2.onExitValid).call(_context5, _assertThisInitialized(_this2), key),
287
- onBlur: _bindInstanceProperty(_context6 = _this2.onChange).call(_context6, _assertThisInitialized(_this2), key)
288
- });
289
- } else if (type === 'date') {
290
- var _context7, _context8;
291
- var propsObj = _objectSpread(_objectSpread({}, props), {}, {
292
- onChange: _bindInstanceProperty(_context7 = _this2.onBlur).call(_context7, _assertThisInitialized(_this2), key),
293
- onBlur: _bindInstanceProperty(_context8 = _this2.onExitValid).call(_context8, _assertThisInitialized(_this2), key)
294
- });
295
- if (_this2.props.onOpenChange && typeof _this2.props.onOpenChange === 'function') {
296
- var _context9;
297
- propsObj.onOpenChange = _bindInstanceProperty(_context9 = _this2.props.onOpenChange).call(_context9, _assertThisInitialized(_this2), key);
298
- }
299
- return propsObj;
300
- } else if (type === 'area') {
301
- var _context10, _context11;
302
- return _objectSpread(_objectSpread({}, props), {}, {
303
- onChange: _bindInstanceProperty(_context10 = _this2.onBlur).call(_context10, _assertThisInitialized(_this2), key),
304
- onBlur: _bindInstanceProperty(_context11 = _this2.onExitValid).call(_context11, _assertThisInitialized(_this2), key),
305
- onAreaSearch: _this2.props.onAreaSearch
306
- });
307
- } else {
308
- var _context12, _context13;
309
- return _objectSpread(_objectSpread({}, props), {}, {
310
- onChange: _bindInstanceProperty(_context12 = _this2.onBlur).call(_context12, _assertThisInitialized(_this2), key),
311
- onBlur: _bindInstanceProperty(_context13 = _this2.onExitValid).call(_context13, _assertThisInitialized(_this2), key)
312
- });
313
- }
314
- });
315
- _defineProperty(_assertThisInitialized(_this2), "getControlProps", function (control, status) {
316
- var _this2$props$value2 = _this2.props.value,
317
- value = _this2$props$value2 === void 0 ? {} : _this2$props$value2;
318
- var type = _this2.getType(control);
319
- var props = _this2.specialProps(type, control);
320
- return _objectSpread(_objectSpread({
321
- autoFocus: !!status,
322
- type: type
323
- }, props), {}, {
324
- size: defaultSize,
325
- value: makeString(value[control.key])
326
- });
327
- });
328
- _defineProperty(_assertThisInitialized(_this2), "getOptions", function (key, options) {
329
- var higher = _this2.props.options || {};
330
- return higher[key] || options;
331
- });
332
- _defineProperty(_assertThisInitialized(_this2), "toEmpty", function (props) {});
333
- _defineProperty(_assertThisInitialized(_this2), "toText", function (props) {
334
- return /*#__PURE__*/React.createElement(Controlled, props);
335
- });
336
- _defineProperty(_assertThisInitialized(_this2), "toPassword", function (props) {
337
- return /*#__PURE__*/React.createElement(Controlled, props);
338
- });
339
- _defineProperty(_assertThisInitialized(_this2), "toEditor", function (props, control) {
340
- props.inputKey = control.key;
341
- return /*#__PURE__*/React.createElement(Controlled, props);
342
- });
343
- _defineProperty(_assertThisInitialized(_this2), "toSelectWriting", function (props, control) {
344
- return /*#__PURE__*/React.createElement(Controlled, props);
345
- });
346
- _defineProperty(_assertThisInitialized(_this2), "toTextArea", function (props, control) {
347
- if (control.allFullFather) {
348
- props.rows = control.rows;
349
- props.maxLength = control.maxLength;
350
- props.style = {
351
- 'resize': 'none'
352
- };
353
- } else {
354
- props.autoSize = {
355
- minRows: 1,
356
- maxRows: 5
357
- };
358
- }
359
- return /*#__PURE__*/React.createElement(Controlled, props);
360
- });
361
- _defineProperty(_assertThisInitialized(_this2), "toNumber", function (props) {
362
- props.defaultValue = props.value;
363
- delete props.value;
364
- return /*#__PURE__*/React.createElement(Control, props);
365
- });
366
- _defineProperty(_assertThisInitialized(_this2), "toSelect", function (props, _ref6) {
367
- var options = _ref6.options,
368
- key = _ref6.key;
369
- props.getPopupContainer = _this2.getPopupContainer;
370
- props.options = _this2.getOptions(key, options);
371
- props.dropdownMatchSelectWidth = false;
372
- return /*#__PURE__*/React.createElement(Control, props);
373
- });
374
- _defineProperty(_assertThisInitialized(_this2), "createSearchEvent", function (control) {
375
- if (_this2.props.onSearch) {
376
- return function (value) {
377
- return _this2.props.onSearch(control.key, value, control);
378
- };
379
- } else {
380
- return null;
381
- }
382
- });
383
- _defineProperty(_assertThisInitialized(_this2), "toSearch", function (props, control) {
384
- props.getPopupContainer = _this2.getPopupContainer;
385
- props.options = _this2.getOptions(control.key, control.options);
386
- props.onSearch = _this2.createSearchEvent(control);
387
- props.dropdownMatchSelectWidth = false;
388
- return /*#__PURE__*/React.createElement(Control, props);
389
- });
390
- _defineProperty(_assertThisInitialized(_this2), "toDate", function (props, _ref7) {
391
- var rule = _ref7.rule;
392
- props.getCalendarContainer = _this2.getPopupContainer;
393
- props.style = {
394
- width: '100%'
395
- };
396
- rule && (props.disabledDate = _this2.validDate(rule));
397
- return /*#__PURE__*/React.createElement(Control, props);
398
- });
399
- _defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props, _ref8) {
400
- var key = _ref8.key,
401
- options = _ref8.options;
402
- props.options = _this2.getOptions(key, options);
403
- return /*#__PURE__*/React.createElement(Control, props);
404
- });
405
- _defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props, _ref9) {
406
- var options = _ref9.options,
407
- key = _ref9.key;
408
- props.value = getTitle(props.value, _this2.getOptions(key, options));
409
- return /*#__PURE__*/React.createElement(Control, props);
410
- });
411
- _defineProperty(_assertThisInitialized(_this2), "selectSearch", function (props, control) {
412
- props.getPopupContainer = _this2.getPopupContainer;
413
- props.options = _this2.getOptions(control.key, control.options);
414
- props.onSearch = _this2.createSearchEvent(control);
415
- props.dropdownMatchSelectWidth = false;
416
- return /*#__PURE__*/React.createElement(Control, props);
417
- });
418
- _defineProperty(_assertThisInitialized(_this2), "area", function (props, _ref10) {
419
- var key = _ref10.key,
420
- options = _ref10.options;
421
- var readonly = _this2.props.readonly;
422
- props.parentKey = key;
423
- props.options = _this2.getOptions(key, options);
424
- props.dropdownMatchSelectWidth = false;
425
- props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
426
- return readonlyKey === key;
427
- }) ? true : false;
428
- return /*#__PURE__*/React.createElement(Control, props);
429
- });
430
- _defineProperty(_assertThisInitialized(_this2), "uploadImg", function (props, control) {
431
- var _context14;
432
- var readonly = _this2.props.readonly;
433
- props.required = control.required || false;
434
- props.onFileChange = _bindInstanceProperty(_context14 = _this2.onFileChange).call(_context14, _assertThisInitialized(_this2), control);
435
- props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
436
- return readonlyKey === control.key;
437
- }) ? true : false;
438
- return /*#__PURE__*/React.createElement(Control, props);
439
- });
440
- _defineProperty(_assertThisInitialized(_this2), "toCascader", function (props, control) {
441
- var container = _this2.getContainer();
442
- container && (props.getPopupContainer = container);
443
- props.options = control.options || [];
444
- props.onSearch = _this2.createSearchEvent(control);
445
- props.placeholder = props.placeholder || '';
446
- props.loadData = _this2.createSearchEvent(control);
447
- return /*#__PURE__*/React.createElement(Control, props);
448
- });
449
- _defineProperty(_assertThisInitialized(_this2), "toTreeSelect", function (props, filter) {
450
- var container = _this2.getContainer();
451
- container && (props.getPopupContainer = container);
452
- props.options = _this2.getOptions(filter);
453
- props.onSearch = _this2.createSearchEvent(filter);
454
- props.placeholder = filter.placeholder || '';
455
- return /*#__PURE__*/React.createElement(Control, props);
456
- });
457
- _defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
458
- switch (props.type) {
459
- case 'readonly':
460
- return _this2.toReadonly(props, control);
461
- case 'text':
462
- return _this2.toText(props, control);
463
- case 'number':
464
- return _this2.toNumber(props, control);
465
- case 'select':
466
- case 'selectText':
467
- return _this2.toSelect(props, control);
468
- case 'search':
469
- case 'searchText':
470
- return _this2.toSearch(props, control);
471
- case 'date':
472
- return _this2.toDate(props, control);
473
- case 'radioGroup':
474
- return _this2.toRadioGroup(props, control);
475
- case 'textArea':
476
- return _this2.toTextArea(props, control);
477
- case 'password':
478
- return _this2.toPassword(props, control);
479
- case 'editor':
480
- return _this2.toEditor(props, control);
481
- case 'selectWriting':
482
- return _this2.toSelectWriting(props, control);
483
- case 'selectSearch':
484
- return _this2.selectSearch(props, control);
485
- case 'empty':
486
- return _this2.toEmpty(props, control);
487
- case 'area':
488
- return _this2.area(props, control);
489
- case 'uploadImg':
490
- return _this2.uploadImg(props, control);
491
- case 'cascader':
492
- return _this2.toCascader(props, control);
493
- case 'treeSelect':
494
- return _this2.toTreeSelect(props, control);
495
- default:
496
- return 'type error';
497
- }
498
- });
499
- _defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref11, type) {
500
- var title = _ref11.title,
501
- showAdd = _ref11.showAdd,
502
- key = _ref11.key;
503
- if (showAdd && type !== 'readonly') {
504
- var _context15;
505
- var onClick = _bindInstanceProperty(_context15 = _this2.onAdd).call(_context15, _assertThisInitialized(_this2), key, title);
506
- return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
507
- role: "add",
508
- type: "plus-circle-o",
509
- onClick: onClick
510
- }));
511
- } else {
512
- return title;
513
- }
514
- });
515
- _defineProperty(_assertThisInitialized(_this2), "toCol", function (span, control) {
516
- var factor = control.span || 1;
517
- var status = _this2.getValidState(control);
518
- var controlProps = _this2.getControlProps(control, status);
519
- var itemProps = {
520
- label: _this2.toLabel(control, controlProps.type),
521
- required: control.required,
522
- validateStatus: status
523
- };
524
- var _this2$props3 = _this2.props,
525
- checkable = _this2$props3.checkable,
526
- onCheckItem = _this2$props3.onCheckItem;
527
- return control.type !== 'empty' ? /*#__PURE__*/React.createElement(_Col, {
528
- span: span * factor,
529
- key: control.key
530
- }, checkable && /*#__PURE__*/React.createElement(_Checkbox, {
531
- className: variables('SuperForm').checkbox,
532
- onChange: _bindInstanceProperty(onCheckItem).call(onCheckItem, _assertThisInitialized(_this2), control),
533
- checked: control.checked
534
- }), /*#__PURE__*/React.createElement(FormItem, _extends({}, itemProps, {
535
- className: checkable ? variables('SuperForm').formItemWithCheckbox : ''
536
- }), _this2.toControl(controlProps, control))) : /*#__PURE__*/React.createElement(_Col, {
537
- span: span * factor,
538
- key: control.key,
539
- style: {
540
- height: '44px'
541
- }
542
- });
543
- });
544
- _defineProperty(_assertThisInitialized(_this2), "toCols", function () {
545
- var _context16;
546
- var _this2$props4 = _this2.props,
547
- _this2$props4$colNum = _this2$props4.colNum,
548
- colNum = _this2$props4$colNum === void 0 ? defaultColNum : _this2$props4$colNum,
549
- allFullFather = _this2$props4.allFullFather;
550
- if (allFullFather) {
551
- colNum = 1;
552
- }
553
- var span = 24 / colNum;
554
- return _mapInstanceProperty(_context16 = _this2.getControls()).call(_context16, function (control) {
555
- if (allFullFather) {
556
- control.allFullFather = allFullFather;
557
- }
558
- return _this2.toCol(span, control);
559
- });
560
- });
561
- return _this2;
562
- }
563
- _createClass(SuperForm, [{
564
- key: "render",
565
- value: function render() {
566
- this.initValidState();
567
- return /*#__PURE__*/React.createElement("div", {
568
- className: variables('SuperForm')
569
- }, /*#__PURE__*/React.createElement(_Form, {
570
- layout: "vertical",
571
- style: {
572
- maxWidth: this.props.allFullFather ? '100%' : this.getMaxWidth()
573
- }
574
- }, /*#__PURE__*/React.createElement(_Row, {
575
- gutter: 20
576
- }, this.toCols())));
577
- }
578
- }]);
579
- return SuperForm;
580
- }(React.Component);
581
- _defineProperty(SuperForm, "propTypes", {
582
- controls: PropTypes.arrayOf(PropTypes.shape(ControlType)).isRequired,
583
- value: PropTypes.object,
584
- colNum: PropTypes.number,
585
- valid: PropTypes.bool,
586
- readonly: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
587
- hideControls: PropTypes.array,
588
- options: PropTypes.object,
589
- onChange: PropTypes.func,
590
- onSearch: PropTypes.func,
591
- onExitValid: PropTypes.func,
592
- onAdd: PropTypes.func,
593
- checkable: PropTypes.bool,
594
- onOpenChange: PropTypes.func,
595
- onAreaSearch: PropTypes.func,
596
- OnFileChange: PropTypes.func
597
- });
598
- export default SuperForm;