cloud-b2b 1.1.46 → 1.1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (304) 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/InputTreeSelect/package.json +6 -0
  20. package/src/InputWriting/InputWriting.js +65 -0
  21. package/src/Layout/Layout.js +121 -0
  22. package/src/LayoutLink/LayoutLink.js +59 -0
  23. package/src/Link/Link.js +57 -0
  24. package/src/Loading/Loading.js +15 -0
  25. package/src/Loading2/Loading2.js +15 -0
  26. package/src/ModalWithDrag/ModalWithDrag.js +17 -0
  27. package/{es → src}/ModalWithDrag/drag.js +128 -116
  28. package/src/NumberInput/NumberInput.js +137 -0
  29. package/src/Search/Search.js +368 -0
  30. package/src/Sidebar/Sidebar.js +111 -0
  31. package/src/Sidebar2/Sidebar.js +143 -0
  32. package/src/SuperForm/SuperForm.js +516 -0
  33. package/src/SuperForm2/SuperForm.js +588 -0
  34. package/src/SuperIcon/SuperIcon.js +14 -0
  35. package/src/SuperPagination/SuperPagination.js +65 -0
  36. package/src/SuperTab/SuperTab.js +84 -0
  37. package/src/SuperTab2/SuperTab2.js +94 -0
  38. package/src/SuperTable/DragSortRow.js +62 -0
  39. package/src/SuperTable/FilterDropDown.js +111 -0
  40. package/src/SuperTable/SuperTable.js +590 -0
  41. package/src/SuperTable/fixed.js +34 -0
  42. package/src/SuperTable2/SuperTable2.js +600 -0
  43. package/src/SuperTable2/SuperTableCell.js +144 -0
  44. package/src/SuperTable3/FilterDropDown.js +111 -0
  45. package/src/SuperTable3/SuperTable.js +498 -0
  46. package/src/SuperTable3/fixed.js +34 -0
  47. package/src/SuperToolbar/SuperToolbar.js +128 -0
  48. package/src/SuperUpload/SuperUpload.js +137 -0
  49. package/src/Title/Title.js +18 -0
  50. package/src/Viewer/ImageViews.js +220 -0
  51. package/src/Viewer/Viewer.js +97 -0
  52. package/src/WingBlank/WingBlank.js +14 -0
  53. package/src/helper.js +185 -0
  54. package/{es → src}/history.js +6 -6
  55. package/src/index.js +38 -0
  56. package/src/variables.js +5 -0
  57. package/test/index.html +10 -0
  58. package/test/test.js +16 -0
  59. package/test/test.less +12 -0
  60. package/test/webpack.config.js +71 -0
  61. package/tools/babel.config.js +14 -0
  62. package/tools/build.js +70 -0
  63. package/tools/publish.js +9 -0
  64. package/tools/util.js +53 -0
  65. package/es/Area/Area.js +0 -141
  66. package/es/Card/Card.js +0 -19
  67. package/es/CodeInput/CodeInput.js +0 -123
  68. package/es/Control/Control.js +0 -437
  69. package/es/Control/event.js +0 -43
  70. package/es/Enhance/Dialogs.js +0 -52
  71. package/es/Enhance/Loading.js +0 -131
  72. package/es/Header/Header.js +0 -162
  73. package/es/Header/Vertical.js +0 -106
  74. package/es/ImageView/ImageView.js +0 -100
  75. package/es/Indent/Indent.js +0 -19
  76. package/es/InpurCascader/InputCascader.js +0 -109
  77. package/es/InputEditor/InputEditor.js +0 -114
  78. package/es/InputSearch/InputSearch.js +0 -266
  79. package/es/InputSelect/InputSelect.js +0 -160
  80. package/es/InputWriting/InputWriting.js +0 -85
  81. package/es/Layout/Layout.js +0 -201
  82. package/es/LayoutLink/LayoutLink.js +0 -73
  83. package/es/Link/Link.js +0 -85
  84. package/es/Loading/Loading.js +0 -13
  85. package/es/Loading2/Loading2.js +0 -9
  86. package/es/ModalWithDrag/ModalWithDrag.js +0 -29
  87. package/es/NumberInput/NumberInput.js +0 -200
  88. package/es/Search/Search.js +0 -485
  89. package/es/Sidebar/Sidebar.js +0 -144
  90. package/es/Sidebar2/Sidebar.js +0 -165
  91. package/es/SuperForm/SuperForm.js +0 -583
  92. package/es/SuperForm2/SuperForm.js +0 -677
  93. package/es/SuperIcon/SuperIcon.js +0 -27
  94. package/es/SuperPagination/SuperPagination.js +0 -109
  95. package/es/SuperTab/SuperTab.js +0 -107
  96. package/es/SuperTab2/SuperTab2.js +0 -145
  97. package/es/SuperTable/DragSortRow.js +0 -97
  98. package/es/SuperTable/FilterDropDown.js +0 -164
  99. package/es/SuperTable/SuperTable.js +0 -808
  100. package/es/SuperTable/fixed.js +0 -34
  101. package/es/SuperTable2/SuperTable2.js +0 -894
  102. package/es/SuperTable2/SuperTableCell.js +0 -198
  103. package/es/SuperTable3/FilterDropDown.js +0 -164
  104. package/es/SuperTable3/SuperTable.js +0 -665
  105. package/es/SuperTable3/fixed.js +0 -34
  106. package/es/SuperToolbar/SuperToolbar.js +0 -195
  107. package/es/SuperUpload/SuperUpload.js +0 -357
  108. package/es/Title/Title.js +0 -33
  109. package/es/Viewer/ImageViews.js +0 -258
  110. package/es/Viewer/Viewer.js +0 -122
  111. package/es/WingBlank/WingBlank.js +0 -16
  112. package/es/helper.js +0 -147
  113. package/es/index.js +0 -37
  114. package/es/variables.js +0 -4
  115. package/lib/Area/Area.js +0 -150
  116. package/lib/Area/package.json +0 -6
  117. package/lib/Card/Card.js +0 -28
  118. package/lib/Card/package.json +0 -6
  119. package/lib/CodeInput/CodeInput.js +0 -132
  120. package/lib/CodeInput/package.json +0 -6
  121. package/lib/Control/Control.js +0 -446
  122. package/lib/Control/event.js +0 -52
  123. package/lib/Control/package.json +0 -6
  124. package/lib/Enhance/Dialogs.js +0 -61
  125. package/lib/Enhance/Loading.js +0 -139
  126. package/lib/Enhance/index.js +0 -26
  127. package/lib/Enhance/package.json +0 -6
  128. package/lib/Header/Header.js +0 -170
  129. package/lib/Header/Header.less +0 -95
  130. package/lib/Header/Vertical.js +0 -115
  131. package/lib/Header/Vertical.less +0 -60
  132. package/lib/Header/package.json +0 -6
  133. package/lib/ImageView/ImageView.js +0 -109
  134. package/lib/ImageView/ImageView.less +0 -14
  135. package/lib/ImageView/package.json +0 -6
  136. package/lib/Indent/Indent.js +0 -28
  137. package/lib/Indent/package.json +0 -6
  138. package/lib/InpurCascader/InputCascader.js +0 -117
  139. package/lib/InpurCascader/package.json +0 -6
  140. package/lib/InputEditor/InputEditor.js +0 -123
  141. package/lib/InputEditor/inputEditor.less +0 -8
  142. package/lib/InputEditor/package.json +0 -6
  143. package/lib/InputSearch/InputSearch.js +0 -275
  144. package/lib/InputSearch/package.json +0 -6
  145. package/lib/InputSelect/InputSelect.js +0 -169
  146. package/lib/InputSelect/package.json +0 -6
  147. package/lib/InputWriting/InputWriting.js +0 -94
  148. package/lib/InputWriting/package.json +0 -6
  149. package/lib/Layout/Layout.js +0 -210
  150. package/lib/Layout/Layout.less +0 -28
  151. package/lib/Layout/package.json +0 -6
  152. package/lib/LayoutLink/LayoutLink.js +0 -87
  153. package/lib/LayoutLink/LayoutLink.less +0 -53
  154. package/lib/LayoutLink/package.json +0 -6
  155. package/lib/Link/Link.js +0 -94
  156. package/lib/Link/package.json +0 -6
  157. package/lib/Loading/Loading.js +0 -22
  158. package/lib/Loading/Loading.less +0 -13
  159. package/lib/Loading/package.json +0 -6
  160. package/lib/Loading2/Loading2.js +0 -18
  161. package/lib/Loading2/Loading2.less +0 -19
  162. package/lib/Loading2/package.json +0 -6
  163. package/lib/ModalWithDrag/ModalWithDrag.js +0 -38
  164. package/lib/ModalWithDrag/ModalWithDrag.less +0 -6
  165. package/lib/ModalWithDrag/drag.js +0 -125
  166. package/lib/ModalWithDrag/package.json +0 -6
  167. package/lib/NumberInput/NumberInput.js +0 -209
  168. package/lib/NumberInput/package.json +0 -6
  169. package/lib/Search/Search.js +0 -499
  170. package/lib/Search/Search.less +0 -63
  171. package/lib/Search/package.json +0 -6
  172. package/lib/Sidebar/Sidebar.js +0 -153
  173. package/lib/Sidebar/Sidebar.less +0 -78
  174. package/lib/Sidebar/package.json +0 -6
  175. package/lib/Sidebar2/Sidebar.js +0 -174
  176. package/lib/Sidebar2/Sidebar.less +0 -153
  177. package/lib/Sidebar2/package.json +0 -6
  178. package/lib/SuperForm/SuperForm.js +0 -596
  179. package/lib/SuperForm/SuperForm.less +0 -52
  180. package/lib/SuperForm/package.json +0 -6
  181. package/lib/SuperForm2/SuperForm.js +0 -690
  182. package/lib/SuperForm2/SuperForm.less +0 -52
  183. package/lib/SuperForm2/package.json +0 -6
  184. package/lib/SuperIcon/SuperIcon.js +0 -36
  185. package/lib/SuperIcon/package.json +0 -6
  186. package/lib/SuperPagination/SuperPagination.js +0 -118
  187. package/lib/SuperPagination/package.json +0 -6
  188. package/lib/SuperTab/SuperTab.js +0 -116
  189. package/lib/SuperTab/SuperTab.less +0 -43
  190. package/lib/SuperTab/package.json +0 -6
  191. package/lib/SuperTab2/SuperTab2.js +0 -154
  192. package/lib/SuperTab2/SuperTab2.less +0 -18
  193. package/lib/SuperTab2/package.json +0 -6
  194. package/lib/SuperTable/DragSortRow.js +0 -106
  195. package/lib/SuperTable/DragSortRow.less +0 -17
  196. package/lib/SuperTable/FilterDropDown.js +0 -173
  197. package/lib/SuperTable/FilterDropDown.less +0 -30
  198. package/lib/SuperTable/SuperTable.js +0 -817
  199. package/lib/SuperTable/SuperTable.less +0 -132
  200. package/lib/SuperTable/fixed.js +0 -43
  201. package/lib/SuperTable/package.json +0 -6
  202. package/lib/SuperTable2/SuperTable2.js +0 -908
  203. package/lib/SuperTable2/SuperTable2.less +0 -118
  204. package/lib/SuperTable2/SuperTableCell.js +0 -204
  205. package/lib/SuperTable2/package.json +0 -6
  206. package/lib/SuperTable3/FilterDropDown.js +0 -173
  207. package/lib/SuperTable3/FilterDropDown.less +0 -29
  208. package/lib/SuperTable3/SuperTable.js +0 -674
  209. package/lib/SuperTable3/SuperTable.less +0 -99
  210. package/lib/SuperTable3/fixed.js +0 -43
  211. package/lib/SuperTable3/package.json +0 -6
  212. package/lib/SuperToolbar/SuperToolbar.js +0 -204
  213. package/lib/SuperToolbar/SuperToolbar.less +0 -17
  214. package/lib/SuperToolbar/package.json +0 -6
  215. package/lib/SuperUpload/SuperUpload.js +0 -370
  216. package/lib/SuperUpload/SuperUpload.less +0 -28
  217. package/lib/SuperUpload/package.json +0 -6
  218. package/lib/Title/Title.js +0 -42
  219. package/lib/Title/Title.less +0 -35
  220. package/lib/Title/package.json +0 -6
  221. package/lib/Viewer/ImageViews.js +0 -267
  222. package/lib/Viewer/Viewer.js +0 -131
  223. package/lib/Viewer/Viewer.less +0 -67
  224. package/lib/Viewer/imgView.less +0 -59
  225. package/lib/Viewer/package.json +0 -7
  226. package/lib/WingBlank/WingBlank.js +0 -25
  227. package/lib/WingBlank/WingBlank.less +0 -12
  228. package/lib/WingBlank/package.json +0 -6
  229. package/lib/adjust.less +0 -89
  230. package/lib/helper.js +0 -163
  231. package/lib/history.js +0 -13
  232. package/lib/index.js +0 -271
  233. package/lib/index.less +0 -31
  234. package/lib/style.less +0 -30
  235. package/lib/variables.js +0 -12
  236. package/lib/variables.less +0 -73
  237. /package/{es → src}/Area/package.json +0 -0
  238. /package/{es → src}/Card/package.json +0 -0
  239. /package/{es → src}/CodeInput/package.json +0 -0
  240. /package/{es → src}/Control/package.json +0 -0
  241. /package/{es → src}/Enhance/package.json +0 -0
  242. /package/{es → src}/Header/Header.less +0 -0
  243. /package/{es → src}/Header/Vertical.less +0 -0
  244. /package/{es → src}/Header/package.json +0 -0
  245. /package/{es → src}/ImageView/ImageView.less +0 -0
  246. /package/{es → src}/ImageView/package.json +0 -0
  247. /package/{es → src}/Indent/package.json +0 -0
  248. /package/{es → src}/InpurCascader/package.json +0 -0
  249. /package/{es → src}/InputEditor/inputEditor.less +0 -0
  250. /package/{es → src}/InputEditor/package.json +0 -0
  251. /package/{es → src}/InputSearch/package.json +0 -0
  252. /package/{es → src}/InputSelect/package.json +0 -0
  253. /package/{es → src}/InputWriting/package.json +0 -0
  254. /package/{es → src}/Layout/Layout.less +0 -0
  255. /package/{es → src}/Layout/package.json +0 -0
  256. /package/{es → src}/LayoutLink/LayoutLink.less +0 -0
  257. /package/{es → src}/LayoutLink/package.json +0 -0
  258. /package/{es → src}/Link/package.json +0 -0
  259. /package/{es → src}/Loading/Loading.less +0 -0
  260. /package/{es → src}/Loading/package.json +0 -0
  261. /package/{es → src}/Loading2/Loading2.less +0 -0
  262. /package/{es → src}/Loading2/package.json +0 -0
  263. /package/{es → src}/ModalWithDrag/ModalWithDrag.less +0 -0
  264. /package/{es → src}/ModalWithDrag/package.json +0 -0
  265. /package/{es → src}/NumberInput/package.json +0 -0
  266. /package/{es → src}/Search/Search.less +0 -0
  267. /package/{es → src}/Search/package.json +0 -0
  268. /package/{es → src}/Sidebar/Sidebar.less +0 -0
  269. /package/{es → src}/Sidebar/package.json +0 -0
  270. /package/{es → src}/Sidebar2/Sidebar.less +0 -0
  271. /package/{es → src}/Sidebar2/package.json +0 -0
  272. /package/{es → src}/SuperForm/SuperForm.less +0 -0
  273. /package/{es → src}/SuperForm/package.json +0 -0
  274. /package/{es → src}/SuperForm2/SuperForm.less +0 -0
  275. /package/{es → src}/SuperForm2/package.json +0 -0
  276. /package/{es → src}/SuperIcon/package.json +0 -0
  277. /package/{es → src}/SuperPagination/package.json +0 -0
  278. /package/{es → src}/SuperTab/SuperTab.less +0 -0
  279. /package/{es → src}/SuperTab/package.json +0 -0
  280. /package/{es → src}/SuperTab2/SuperTab2.less +0 -0
  281. /package/{es → src}/SuperTab2/package.json +0 -0
  282. /package/{es → src}/SuperTable/DragSortRow.less +0 -0
  283. /package/{es → src}/SuperTable/FilterDropDown.less +0 -0
  284. /package/{es → src}/SuperTable/SuperTable.less +0 -0
  285. /package/{es → src}/SuperTable/package.json +0 -0
  286. /package/{es → src}/SuperTable2/SuperTable2.less +0 -0
  287. /package/{es → src}/SuperTable2/package.json +0 -0
  288. /package/{es → src}/SuperTable3/FilterDropDown.less +0 -0
  289. /package/{es → src}/SuperTable3/SuperTable.less +0 -0
  290. /package/{es → src}/SuperTable3/package.json +0 -0
  291. /package/{es → src}/SuperToolbar/SuperToolbar.less +0 -0
  292. /package/{es → src}/SuperToolbar/package.json +0 -0
  293. /package/{es → src}/SuperUpload/SuperUpload.less +0 -0
  294. /package/{es → src}/SuperUpload/package.json +0 -0
  295. /package/{es → src}/Title/Title.less +0 -0
  296. /package/{es → src}/Title/package.json +0 -0
  297. /package/{es → src}/Viewer/Viewer.less +0 -0
  298. /package/{es → src}/Viewer/imgView.less +0 -0
  299. /package/{es → src}/Viewer/package.json +0 -0
  300. /package/{es → src}/WingBlank/WingBlank.less +0 -0
  301. /package/{es → src}/WingBlank/package.json +0 -0
  302. /package/{es → src}/adjust.less +0 -0
  303. /package/{es → src}/style.less +0 -0
  304. /package/{es → src}/variables.less +0 -0
@@ -1,583 +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(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context17, _context18; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context17 = ownKeys(Object(source), !0)).call(_context17, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context18 = ownKeys(Object(source))).call(_context18, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
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'];
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), "onExitValid", function (key, value) {
151
- if (key === _this2.validKey) {
152
- _this2.validKey = '';
153
- _this2.props.onExitValid();
154
- }
155
- _this2.props.onChangeOperate && _this2.props.onChangeOperate(key, value);
156
- });
157
- // 动态生成getValidState方法
158
- _defineProperty(_assertThisInitialized(_this2), "initValidState", function () {
159
- var _this2$props = _this2.props,
160
- value = _this2$props.value,
161
- valid = _this2$props.valid;
162
- var invalid = function invalid() {
163
- return null;
164
- };
165
- var _valid = function _valid(_ref) {
166
- var key = _ref.key,
167
- required = _ref.required;
168
- if (required) {
169
- if (!value || helper.isEmpty2(value[key]) || !_Array$isArray(value[key]) && _typeof(value[key]) === 'object' && helper.isEmpty(value[key].value)) {
170
- _this2.getValidState = invalid;
171
- _this2.validKey = key;
172
- return 'error';
173
- }
174
- }
175
- return null;
176
- };
177
- _this2.getValidState = valid ? _valid : invalid;
178
- });
179
- _defineProperty(_assertThisInitialized(_this2), "validDate", function (_ref2) {
180
- var key = _ref2.key,
181
- type = _ref2.type;
182
- return function (date) {
183
- var _this2$props$value = _this2.props.value,
184
- value = _this2$props$value === void 0 ? {} : _this2$props$value;
185
- if (!date || !value[key]) {
186
- return false;
187
- } else {
188
- if (type === '>') {
189
- return date.format('YYYY-MM-DD') <= value[key];
190
- } else if (type === '<') {
191
- return date.format('YYYY-MM-DD') >= value[key];
192
- } else {
193
- return false;
194
- }
195
- }
196
- };
197
- });
198
- _defineProperty(_assertThisInitialized(_this2), "getPopupContainer", function () {
199
- var container = _this2.props.container;
200
- if (typeof container === 'undefined') {
201
- return ReactDOM.findDOMNode(_assertThisInitialized(_this2));
202
- } else if (typeof container === 'boolean') {
203
- return document.body;
204
- } else {
205
- return ReactDOM.findDOMNode(container);
206
- }
207
- });
208
- _defineProperty(_assertThisInitialized(_this2), "getMaxWidth", function () {
209
- var _this2$props$colNum = _this2.props.colNum,
210
- colNum = _this2$props$colNum === void 0 ? defaultColNum : _this2$props$colNum;
211
- return colNum * 250;
212
- });
213
- _defineProperty(_assertThisInitialized(_this2), "getContainer", function () {
214
- return _this2.props.getContainer;
215
- });
216
- _defineProperty(_assertThisInitialized(_this2), "getControls", function () {
217
- var _this2$props2 = _this2.props,
218
- hideControls = _this2$props2.hideControls,
219
- controls = _this2$props2.controls;
220
- if (!hideControls) {
221
- return controls;
222
- } else {
223
- return _filterInstanceProperty(controls).call(controls, function (control) {
224
- return !_someInstanceProperty(hideControls).call(hideControls, function (key) {
225
- return control.key === key;
226
- });
227
- });
228
- }
229
- });
230
- _defineProperty(_assertThisInitialized(_this2), "getType", function (_ref3) {
231
- var _context2;
232
- var key = _ref3.key,
233
- type = _ref3.type;
234
- var readonly = _this2.props.readonly;
235
- if (_includesInstanceProperty(_context2 = ['area', 'uploadImg']).call(_context2, type)) {
236
- return type;
237
- } else if (!readonly) {
238
- return type;
239
- } else if (readonly === true) {
240
- return 'readonly';
241
- } else if (_Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
242
- return readonlyKey === key;
243
- })) {
244
- return 'readonly';
245
- } else {
246
- return type;
247
- }
248
- });
249
- _defineProperty(_assertThisInitialized(_this2), "specialProps", function (type, _ref4) {
250
- var key = _ref4.key,
251
- _ref4$props = _ref4.props,
252
- props = _ref4$props === void 0 ? {} : _ref4$props,
253
- originType = _ref4.type;
254
- if (type === 'readonly') {
255
- var _this2$props$highLigh = _this2.props.highLightKeys,
256
- highLightKeys = _this2$props$highLigh === void 0 ? [] : _this2$props$highLigh;
257
- var style = _includesInstanceProperty(highLightKeys).call(highLightKeys, key) ? {
258
- backgroundColor: 'red',
259
- color: 'white'
260
- } : {
261
- backgroundColor: '#f0f0f0'
262
- };
263
- if (originType === 'textArea') {
264
- var _context3;
265
- return {
266
- type: 'textArea',
267
- readonly: true,
268
- style: style,
269
- onBlur: _bindInstanceProperty(_context3 = _this2.onExitValid).call(_context3, _assertThisInitialized(_this2), key)
270
- };
271
- } else {
272
- var _context4;
273
- return {
274
- style: style,
275
- onBlur: _bindInstanceProperty(_context4 = _this2.onExitValid).call(_context4, _assertThisInitialized(_this2), key)
276
- };
277
- }
278
- } else if (type === 'text' || type === 'textArea') {
279
- var _context5, _context6;
280
- return _objectSpread(_objectSpread({}, props), {}, {
281
- onChange: _bindInstanceProperty(_context5 = _this2.onExitValid).call(_context5, _assertThisInitialized(_this2), key),
282
- onBlur: _bindInstanceProperty(_context6 = _this2.onChange).call(_context6, _assertThisInitialized(_this2), key)
283
- });
284
- } else if (type === 'date') {
285
- var _context7, _context8;
286
- var propsObj = _objectSpread(_objectSpread({}, props), {}, {
287
- onChange: _bindInstanceProperty(_context7 = _this2.onBlur).call(_context7, _assertThisInitialized(_this2), key),
288
- onBlur: _bindInstanceProperty(_context8 = _this2.onExitValid).call(_context8, _assertThisInitialized(_this2), key)
289
- });
290
- if (_this2.props.onOpenChange && typeof _this2.props.onOpenChange === 'function') {
291
- var _context9;
292
- propsObj.onOpenChange = _bindInstanceProperty(_context9 = _this2.props.onOpenChange).call(_context9, _assertThisInitialized(_this2), key);
293
- }
294
- return propsObj;
295
- } else if (type === 'area') {
296
- var _context10, _context11;
297
- return _objectSpread(_objectSpread({}, props), {}, {
298
- onChange: _bindInstanceProperty(_context10 = _this2.onBlur).call(_context10, _assertThisInitialized(_this2), key),
299
- onBlur: _bindInstanceProperty(_context11 = _this2.onExitValid).call(_context11, _assertThisInitialized(_this2), key),
300
- onAreaSearch: _this2.props.onAreaSearch
301
- });
302
- } else {
303
- var _context12, _context13;
304
- return _objectSpread(_objectSpread({}, props), {}, {
305
- onChange: _bindInstanceProperty(_context12 = _this2.onBlur).call(_context12, _assertThisInitialized(_this2), key),
306
- onBlur: _bindInstanceProperty(_context13 = _this2.onExitValid).call(_context13, _assertThisInitialized(_this2), key)
307
- });
308
- }
309
- });
310
- _defineProperty(_assertThisInitialized(_this2), "getControlProps", function (control, status) {
311
- var _this2$props$value2 = _this2.props.value,
312
- value = _this2$props$value2 === void 0 ? {} : _this2$props$value2;
313
- var type = _this2.getType(control);
314
- var props = _this2.specialProps(type, control);
315
- return _objectSpread(_objectSpread({
316
- autoFocus: !!status,
317
- type: type
318
- }, props), {}, {
319
- size: defaultSize,
320
- value: makeString(value[control.key])
321
- });
322
- });
323
- _defineProperty(_assertThisInitialized(_this2), "getOptions", function (key, options) {
324
- var higher = _this2.props.options || {};
325
- return higher[key] || options;
326
- });
327
- _defineProperty(_assertThisInitialized(_this2), "toEmpty", function (props) {});
328
- _defineProperty(_assertThisInitialized(_this2), "toText", function (props) {
329
- return /*#__PURE__*/React.createElement(Controlled, props);
330
- });
331
- _defineProperty(_assertThisInitialized(_this2), "toPassword", function (props) {
332
- return /*#__PURE__*/React.createElement(Controlled, props);
333
- });
334
- _defineProperty(_assertThisInitialized(_this2), "toEditor", function (props, control) {
335
- props.inputKey = control.key;
336
- return /*#__PURE__*/React.createElement(Controlled, props);
337
- });
338
- _defineProperty(_assertThisInitialized(_this2), "toSelectWriting", function (props, control) {
339
- return /*#__PURE__*/React.createElement(Controlled, props);
340
- });
341
- _defineProperty(_assertThisInitialized(_this2), "toTextArea", function (props, control) {
342
- if (control.allFullFather) {
343
- props.rows = control.rows;
344
- props.maxLength = control.maxLength;
345
- props.style = {
346
- 'resize': 'none'
347
- };
348
- } else {
349
- props.autoSize = {
350
- minRows: 1,
351
- maxRows: 5
352
- };
353
- }
354
- return /*#__PURE__*/React.createElement(Controlled, props);
355
- });
356
- _defineProperty(_assertThisInitialized(_this2), "toNumber", function (props) {
357
- props.defaultValue = props.value;
358
- delete props.value;
359
- return /*#__PURE__*/React.createElement(Control, props);
360
- });
361
- _defineProperty(_assertThisInitialized(_this2), "toSelect", function (props, _ref5) {
362
- var options = _ref5.options,
363
- key = _ref5.key;
364
- props.getPopupContainer = _this2.getPopupContainer;
365
- props.options = _this2.getOptions(key, options);
366
- props.dropdownMatchSelectWidth = false;
367
- return /*#__PURE__*/React.createElement(Control, props);
368
- });
369
- _defineProperty(_assertThisInitialized(_this2), "createSearchEvent", function (control) {
370
- if (_this2.props.onSearch) {
371
- return function (value) {
372
- return _this2.props.onSearch(control.key, value, control);
373
- };
374
- } else {
375
- return null;
376
- }
377
- });
378
- _defineProperty(_assertThisInitialized(_this2), "toSearch", function (props, control) {
379
- props.getPopupContainer = _this2.getPopupContainer;
380
- props.options = _this2.getOptions(control.key, control.options);
381
- props.onSearch = _this2.createSearchEvent(control);
382
- props.dropdownMatchSelectWidth = false;
383
- return /*#__PURE__*/React.createElement(Control, props);
384
- });
385
- _defineProperty(_assertThisInitialized(_this2), "toDate", function (props, _ref6) {
386
- var rule = _ref6.rule;
387
- props.getCalendarContainer = _this2.getPopupContainer;
388
- props.style = {
389
- width: '100%'
390
- };
391
- rule && (props.disabledDate = _this2.validDate(rule));
392
- return /*#__PURE__*/React.createElement(Control, props);
393
- });
394
- _defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props, _ref7) {
395
- var key = _ref7.key,
396
- options = _ref7.options;
397
- props.options = _this2.getOptions(key, options);
398
- return /*#__PURE__*/React.createElement(Control, props);
399
- });
400
- _defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props, _ref8) {
401
- var options = _ref8.options,
402
- key = _ref8.key;
403
- props.value = getTitle(props.value, _this2.getOptions(key, options));
404
- return /*#__PURE__*/React.createElement(Control, props);
405
- });
406
- _defineProperty(_assertThisInitialized(_this2), "selectSearch", function (props, control) {
407
- props.getPopupContainer = _this2.getPopupContainer;
408
- props.options = _this2.getOptions(control.key, control.options);
409
- props.onSearch = _this2.createSearchEvent(control);
410
- props.dropdownMatchSelectWidth = false;
411
- return /*#__PURE__*/React.createElement(Control, props);
412
- });
413
- _defineProperty(_assertThisInitialized(_this2), "area", function (props, _ref9) {
414
- var key = _ref9.key,
415
- options = _ref9.options;
416
- var readonly = _this2.props.readonly;
417
- props.parentKey = key;
418
- props.options = _this2.getOptions(key, options);
419
- props.dropdownMatchSelectWidth = false;
420
- props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
421
- return readonlyKey === key;
422
- }) ? true : false;
423
- return /*#__PURE__*/React.createElement(Control, props);
424
- });
425
- _defineProperty(_assertThisInitialized(_this2), "uploadImg", function (props, control) {
426
- var _context14;
427
- var readonly = _this2.props.readonly;
428
- props.required = control.required || false;
429
- props.onFileChange = _bindInstanceProperty(_context14 = _this2.onFileChange).call(_context14, _assertThisInitialized(_this2), control);
430
- props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
431
- return readonlyKey === control.key;
432
- }) ? true : false;
433
- return /*#__PURE__*/React.createElement(Control, props);
434
- });
435
- _defineProperty(_assertThisInitialized(_this2), "toCascader", function (props, control) {
436
- var container = _this2.getContainer();
437
- container && (props.getPopupContainer = container);
438
- props.options = control.options || [];
439
- props.onSearch = _this2.createSearchEvent(control);
440
- props.placeholder = props.placeholder || '';
441
- props.loadData = _this2.createSearchEvent(control);
442
- return /*#__PURE__*/React.createElement(Control, props);
443
- });
444
- _defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
445
- switch (props.type) {
446
- case 'readonly':
447
- return _this2.toReadonly(props, control);
448
- case 'text':
449
- return _this2.toText(props, control);
450
- case 'number':
451
- return _this2.toNumber(props, control);
452
- case 'select':
453
- case 'selectText':
454
- return _this2.toSelect(props, control);
455
- case 'search':
456
- case 'searchText':
457
- return _this2.toSearch(props, control);
458
- case 'date':
459
- return _this2.toDate(props, control);
460
- case 'radioGroup':
461
- return _this2.toRadioGroup(props, control);
462
- case 'textArea':
463
- return _this2.toTextArea(props, control);
464
- case 'password':
465
- return _this2.toPassword(props, control);
466
- case 'editor':
467
- return _this2.toEditor(props, control);
468
- case 'selectWriting':
469
- return _this2.toSelectWriting(props, control);
470
- case 'selectSearch':
471
- return _this2.selectSearch(props, control);
472
- case 'empty':
473
- return _this2.toEmpty(props, control);
474
- case 'area':
475
- return _this2.area(props, control);
476
- case 'uploadImg':
477
- return _this2.uploadImg(props, control);
478
- case 'cascader':
479
- return _this2.toCascader(props, control);
480
- default:
481
- return 'type error';
482
- }
483
- });
484
- _defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref10, type) {
485
- var title = _ref10.title,
486
- showAdd = _ref10.showAdd,
487
- key = _ref10.key;
488
- if (showAdd && type !== 'readonly') {
489
- var _context15;
490
- var onClick = _bindInstanceProperty(_context15 = _this2.onAdd).call(_context15, _assertThisInitialized(_this2), key, title);
491
- return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
492
- role: "add",
493
- type: "plus-circle-o",
494
- onClick: onClick
495
- }));
496
- } else {
497
- return title;
498
- }
499
- });
500
- _defineProperty(_assertThisInitialized(_this2), "toCol", function (span, control) {
501
- var factor = control.span || 1;
502
- var status = _this2.getValidState(control);
503
- var controlProps = _this2.getControlProps(control, status);
504
- var itemProps = {
505
- label: _this2.toLabel(control, controlProps.type),
506
- required: control.required,
507
- validateStatus: status
508
- };
509
- var _this2$props3 = _this2.props,
510
- checkable = _this2$props3.checkable,
511
- onCheckItem = _this2$props3.onCheckItem;
512
- return control.type !== 'empty' ? /*#__PURE__*/React.createElement(_Col, {
513
- span: span * factor,
514
- key: control.key
515
- }, checkable && /*#__PURE__*/React.createElement(_Checkbox, {
516
- className: variables('SuperForm').checkbox,
517
- onChange: _bindInstanceProperty(onCheckItem).call(onCheckItem, _assertThisInitialized(_this2), control),
518
- checked: control.checked
519
- }), /*#__PURE__*/React.createElement(FormItem, _extends({}, itemProps, {
520
- className: checkable ? variables('SuperForm').formItemWithCheckbox : ''
521
- }), _this2.toControl(controlProps, control))) : /*#__PURE__*/React.createElement(_Col, {
522
- span: span * factor,
523
- key: control.key,
524
- style: {
525
- height: '44px'
526
- }
527
- });
528
- });
529
- _defineProperty(_assertThisInitialized(_this2), "toCols", function () {
530
- var _context16;
531
- var _this2$props4 = _this2.props,
532
- _this2$props4$colNum = _this2$props4.colNum,
533
- colNum = _this2$props4$colNum === void 0 ? defaultColNum : _this2$props4$colNum,
534
- allFullFather = _this2$props4.allFullFather;
535
- if (allFullFather) {
536
- colNum = 1;
537
- }
538
- var span = 24 / colNum;
539
- return _mapInstanceProperty(_context16 = _this2.getControls()).call(_context16, function (control) {
540
- if (allFullFather) {
541
- control.allFullFather = allFullFather;
542
- }
543
- return _this2.toCol(span, control);
544
- });
545
- });
546
- return _this2;
547
- }
548
- _createClass(SuperForm, [{
549
- key: "render",
550
- value: function render() {
551
- this.initValidState();
552
- return /*#__PURE__*/React.createElement("div", {
553
- className: variables('SuperForm')
554
- }, /*#__PURE__*/React.createElement(_Form, {
555
- layout: "vertical",
556
- style: {
557
- maxWidth: this.props.allFullFather ? '100%' : this.getMaxWidth()
558
- }
559
- }, /*#__PURE__*/React.createElement(_Row, {
560
- gutter: 20
561
- }, this.toCols())));
562
- }
563
- }]);
564
- return SuperForm;
565
- }(React.Component);
566
- _defineProperty(SuperForm, "propTypes", {
567
- controls: PropTypes.arrayOf(PropTypes.shape(ControlType)).isRequired,
568
- value: PropTypes.object,
569
- colNum: PropTypes.number,
570
- valid: PropTypes.bool,
571
- readonly: PropTypes.oneOfType([PropTypes.bool, PropTypes.array]),
572
- hideControls: PropTypes.array,
573
- options: PropTypes.object,
574
- onChange: PropTypes.func,
575
- onSearch: PropTypes.func,
576
- onExitValid: PropTypes.func,
577
- onAdd: PropTypes.func,
578
- checkable: PropTypes.bool,
579
- onOpenChange: PropTypes.func,
580
- onAreaSearch: PropTypes.func,
581
- OnFileChange: PropTypes.func
582
- });
583
- export default SuperForm;