cloud-b2b 1.1.50 → 1.1.52

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 (309) 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 -8
  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/src/ModalWithDrag/drag.js +128 -0
  27. package/src/NumberInput/NumberInput.js +137 -0
  28. package/src/Search/Search.js +368 -0
  29. package/src/Sidebar/Sidebar.js +111 -0
  30. package/src/Sidebar2/Sidebar.js +143 -0
  31. package/src/SuperForm/SuperForm.js +516 -0
  32. package/src/SuperForm2/SuperForm.js +588 -0
  33. package/src/SuperIcon/SuperIcon.js +14 -0
  34. package/src/SuperPagination/SuperPagination.js +65 -0
  35. package/src/SuperTab/SuperTab.js +84 -0
  36. package/src/SuperTab2/SuperTab2.js +94 -0
  37. package/src/SuperTable/DragSortRow.js +62 -0
  38. package/src/SuperTable/FilterDropDown.js +111 -0
  39. package/src/SuperTable/SuperTable.js +590 -0
  40. package/src/SuperTable/fixed.js +34 -0
  41. package/src/SuperTable2/SuperTable2.js +600 -0
  42. package/src/SuperTable2/SuperTableCell.js +144 -0
  43. package/src/SuperTable3/FilterDropDown.js +111 -0
  44. package/src/SuperTable3/SuperTable.js +498 -0
  45. package/src/SuperTable3/fixed.js +34 -0
  46. package/src/SuperToolbar/SuperToolbar.js +128 -0
  47. package/src/SuperUpload/SuperUpload.js +137 -0
  48. package/src/Title/Title.js +18 -0
  49. package/src/Viewer/ImageViews.js +220 -0
  50. package/src/Viewer/Viewer.js +97 -0
  51. package/src/WingBlank/WingBlank.js +14 -0
  52. package/src/helper.js +185 -0
  53. package/src/history.js +6 -0
  54. package/src/index.js +38 -0
  55. package/src/variables.js +5 -0
  56. package/test/index.html +10 -0
  57. package/test/test.js +16 -0
  58. package/test/test.less +12 -0
  59. package/test/webpack.config.js +71 -0
  60. package/tools/babel.config.js +14 -0
  61. package/tools/build.js +70 -0
  62. package/tools/publish.js +9 -0
  63. package/tools/util.js +53 -0
  64. package/es/Area/Area.js +0 -170
  65. package/es/Card/Card.js +0 -20
  66. package/es/CodeInput/CodeInput.js +0 -152
  67. package/es/Control/Control.js +0 -496
  68. package/es/Control/event.js +0 -57
  69. package/es/Enhance/Dialogs.js +0 -67
  70. package/es/Enhance/Loading.js +0 -151
  71. package/es/Header/Header.js +0 -194
  72. package/es/Header/Vertical.js +0 -129
  73. package/es/ImageView/ImageView.js +0 -117
  74. package/es/Indent/Indent.js +0 -23
  75. package/es/InpurCascader/InputCascader.js +0 -135
  76. package/es/InputEditor/InputEditor.js +0 -113
  77. package/es/InputSearch/InputSearch.js +0 -311
  78. package/es/InputSelect/InputSelect.js +0 -191
  79. package/es/InputTreeSelect/InputTreeSelect.js +0 -147
  80. package/es/InputWriting/InputWriting.js +0 -107
  81. package/es/Layout/Layout.js +0 -232
  82. package/es/LayoutLink/LayoutLink.js +0 -82
  83. package/es/Link/Link.js +0 -108
  84. package/es/Loading/Loading.js +0 -15
  85. package/es/Loading2/Loading2.js +0 -11
  86. package/es/ModalWithDrag/ModalWithDrag.js +0 -34
  87. package/es/ModalWithDrag/drag.js +0 -133
  88. package/es/NumberInput/NumberInput.js +0 -240
  89. package/es/Search/Search.js +0 -595
  90. package/es/Sidebar/Sidebar.js +0 -165
  91. package/es/Sidebar2/Sidebar.js +0 -192
  92. package/es/SuperForm/SuperForm.js +0 -720
  93. package/es/SuperForm2/SuperForm.js +0 -828
  94. package/es/SuperIcon/SuperIcon.js +0 -30
  95. package/es/SuperPagination/SuperPagination.js +0 -126
  96. package/es/SuperTab/SuperTab.js +0 -130
  97. package/es/SuperTab2/SuperTab2.js +0 -167
  98. package/es/SuperTable/DragSortRow.js +0 -125
  99. package/es/SuperTable/FilterDropDown.js +0 -188
  100. package/es/SuperTable/SuperTable.js +0 -940
  101. package/es/SuperTable/fixed.js +0 -42
  102. package/es/SuperTable2/SuperTable2.js +0 -1019
  103. package/es/SuperTable2/SuperTableCell.js +0 -242
  104. package/es/SuperTable3/FilterDropDown.js +0 -188
  105. package/es/SuperTable3/SuperTable.js +0 -790
  106. package/es/SuperTable3/fixed.js +0 -42
  107. package/es/SuperToolbar/SuperToolbar.js +0 -223
  108. package/es/SuperUpload/SuperUpload.js +0 -434
  109. package/es/Title/Title.js +0 -36
  110. package/es/Viewer/ImageViews.js +0 -311
  111. package/es/Viewer/Viewer.js +0 -149
  112. package/es/WingBlank/WingBlank.js +0 -20
  113. package/es/helper.js +0 -169
  114. package/es/history.js +0 -5
  115. package/es/index.js +0 -37
  116. package/es/variables.js +0 -4
  117. package/lib/Area/Area.js +0 -198
  118. package/lib/Area/package.json +0 -6
  119. package/lib/Card/Card.js +0 -38
  120. package/lib/Card/package.json +0 -6
  121. package/lib/CodeInput/CodeInput.js +0 -179
  122. package/lib/CodeInput/package.json +0 -6
  123. package/lib/Control/Control.js +0 -548
  124. package/lib/Control/event.js +0 -68
  125. package/lib/Control/package.json +0 -6
  126. package/lib/Enhance/Dialogs.js +0 -87
  127. package/lib/Enhance/Loading.js +0 -175
  128. package/lib/Enhance/index.js +0 -35
  129. package/lib/Enhance/package.json +0 -6
  130. package/lib/Header/Header.js +0 -215
  131. package/lib/Header/Header.less +0 -95
  132. package/lib/Header/Vertical.js +0 -150
  133. package/lib/Header/Vertical.less +0 -60
  134. package/lib/Header/package.json +0 -6
  135. package/lib/ImageView/ImageView.js +0 -134
  136. package/lib/ImageView/ImageView.less +0 -14
  137. package/lib/ImageView/package.json +0 -6
  138. package/lib/Indent/Indent.js +0 -38
  139. package/lib/Indent/package.json +0 -6
  140. package/lib/InpurCascader/InputCascader.js +0 -156
  141. package/lib/InpurCascader/package.json +0 -6
  142. package/lib/InputEditor/InputEditor.js +0 -131
  143. package/lib/InputEditor/inputEditor.less +0 -8
  144. package/lib/InputEditor/package.json +0 -6
  145. package/lib/InputSearch/InputSearch.js +0 -327
  146. package/lib/InputSearch/package.json +0 -6
  147. package/lib/InputSelect/InputSelect.js +0 -214
  148. package/lib/InputSelect/package.json +0 -6
  149. package/lib/InputTreeSelect/InputTreeSelect.js +0 -169
  150. package/lib/InputTreeSelect/package.json +0 -6
  151. package/lib/InputWriting/InputWriting.js +0 -123
  152. package/lib/InputWriting/package.json +0 -6
  153. package/lib/Layout/Layout.js +0 -258
  154. package/lib/Layout/Layout.less +0 -28
  155. package/lib/Layout/package.json +0 -6
  156. package/lib/LayoutLink/LayoutLink.js +0 -114
  157. package/lib/LayoutLink/LayoutLink.less +0 -53
  158. package/lib/LayoutLink/package.json +0 -6
  159. package/lib/Link/Link.js +0 -130
  160. package/lib/Link/package.json +0 -6
  161. package/lib/Loading/Loading.js +0 -30
  162. package/lib/Loading/Loading.less +0 -13
  163. package/lib/Loading/package.json +0 -6
  164. package/lib/Loading2/Loading2.js +0 -26
  165. package/lib/Loading2/Loading2.less +0 -19
  166. package/lib/Loading2/package.json +0 -6
  167. package/lib/ModalWithDrag/ModalWithDrag.js +0 -53
  168. package/lib/ModalWithDrag/ModalWithDrag.less +0 -6
  169. package/lib/ModalWithDrag/drag.js +0 -147
  170. package/lib/ModalWithDrag/package.json +0 -6
  171. package/lib/NumberInput/NumberInput.js +0 -262
  172. package/lib/NumberInput/package.json +0 -6
  173. package/lib/Search/Search.js +0 -616
  174. package/lib/Search/Search.less +0 -63
  175. package/lib/Search/package.json +0 -6
  176. package/lib/Sidebar/Sidebar.js +0 -186
  177. package/lib/Sidebar/Sidebar.less +0 -78
  178. package/lib/Sidebar/package.json +0 -6
  179. package/lib/Sidebar2/Sidebar.js +0 -213
  180. package/lib/Sidebar2/Sidebar.less +0 -153
  181. package/lib/Sidebar2/package.json +0 -6
  182. package/lib/SuperForm/SuperForm.js +0 -731
  183. package/lib/SuperForm/SuperForm.less +0 -52
  184. package/lib/SuperForm/package.json +0 -6
  185. package/lib/SuperForm2/SuperForm.js +0 -834
  186. package/lib/SuperForm2/SuperForm.less +0 -52
  187. package/lib/SuperForm2/package.json +0 -6
  188. package/lib/SuperIcon/SuperIcon.js +0 -47
  189. package/lib/SuperIcon/package.json +0 -6
  190. package/lib/SuperPagination/SuperPagination.js +0 -145
  191. package/lib/SuperPagination/package.json +0 -6
  192. package/lib/SuperTab/SuperTab.js +0 -146
  193. package/lib/SuperTab/SuperTab.less +0 -43
  194. package/lib/SuperTab/package.json +0 -6
  195. package/lib/SuperTab2/SuperTab2.js +0 -191
  196. package/lib/SuperTab2/SuperTab2.less +0 -18
  197. package/lib/SuperTab2/package.json +0 -6
  198. package/lib/SuperTable/DragSortRow.js +0 -142
  199. package/lib/SuperTable/DragSortRow.less +0 -17
  200. package/lib/SuperTable/FilterDropDown.js +0 -205
  201. package/lib/SuperTable/FilterDropDown.less +0 -30
  202. package/lib/SuperTable/SuperTable.js +0 -945
  203. package/lib/SuperTable/SuperTable.less +0 -132
  204. package/lib/SuperTable/fixed.js +0 -55
  205. package/lib/SuperTable/package.json +0 -6
  206. package/lib/SuperTable2/SuperTable2.js +0 -1047
  207. package/lib/SuperTable2/SuperTable2.less +0 -118
  208. package/lib/SuperTable2/SuperTableCell.js +0 -258
  209. package/lib/SuperTable2/package.json +0 -6
  210. package/lib/SuperTable3/FilterDropDown.js +0 -205
  211. package/lib/SuperTable3/FilterDropDown.less +0 -29
  212. package/lib/SuperTable3/SuperTable.js +0 -795
  213. package/lib/SuperTable3/SuperTable.less +0 -99
  214. package/lib/SuperTable3/fixed.js +0 -55
  215. package/lib/SuperTable3/package.json +0 -6
  216. package/lib/SuperToolbar/SuperToolbar.js +0 -248
  217. package/lib/SuperToolbar/SuperToolbar.less +0 -17
  218. package/lib/SuperToolbar/package.json +0 -6
  219. package/lib/SuperUpload/SuperUpload.js +0 -481
  220. package/lib/SuperUpload/SuperUpload.less +0 -28
  221. package/lib/SuperUpload/package.json +0 -6
  222. package/lib/Title/Title.js +0 -54
  223. package/lib/Title/Title.less +0 -35
  224. package/lib/Title/package.json +0 -6
  225. package/lib/Viewer/ImageViews.js +0 -323
  226. package/lib/Viewer/Viewer.js +0 -167
  227. package/lib/Viewer/Viewer.less +0 -67
  228. package/lib/Viewer/imgView.less +0 -59
  229. package/lib/Viewer/package.json +0 -7
  230. package/lib/WingBlank/WingBlank.js +0 -37
  231. package/lib/WingBlank/WingBlank.less +0 -12
  232. package/lib/WingBlank/package.json +0 -6
  233. package/lib/adjust.less +0 -89
  234. package/lib/helper.js +0 -204
  235. package/lib/history.js +0 -18
  236. package/lib/index.js +0 -347
  237. package/lib/index.less +0 -31
  238. package/lib/style.less +0 -30
  239. package/lib/variables.js +0 -16
  240. package/lib/variables.less +0 -73
  241. /package/{es → src}/Area/package.json +0 -0
  242. /package/{es → src}/Card/package.json +0 -0
  243. /package/{es → src}/CodeInput/package.json +0 -0
  244. /package/{es → src}/Control/package.json +0 -0
  245. /package/{es → src}/Enhance/package.json +0 -0
  246. /package/{es → src}/Header/Header.less +0 -0
  247. /package/{es → src}/Header/Vertical.less +0 -0
  248. /package/{es → src}/Header/package.json +0 -0
  249. /package/{es → src}/ImageView/ImageView.less +0 -0
  250. /package/{es → src}/ImageView/package.json +0 -0
  251. /package/{es → src}/Indent/package.json +0 -0
  252. /package/{es → src}/InpurCascader/package.json +0 -0
  253. /package/{es → src}/InputEditor/inputEditor.less +0 -0
  254. /package/{es → src}/InputEditor/package.json +0 -0
  255. /package/{es → src}/InputSearch/package.json +0 -0
  256. /package/{es → src}/InputSelect/package.json +0 -0
  257. /package/{es → src}/InputTreeSelect/package.json +0 -0
  258. /package/{es → src}/InputWriting/package.json +0 -0
  259. /package/{es → src}/Layout/Layout.less +0 -0
  260. /package/{es → src}/Layout/package.json +0 -0
  261. /package/{es → src}/LayoutLink/LayoutLink.less +0 -0
  262. /package/{es → src}/LayoutLink/package.json +0 -0
  263. /package/{es → src}/Link/package.json +0 -0
  264. /package/{es → src}/Loading/Loading.less +0 -0
  265. /package/{es → src}/Loading/package.json +0 -0
  266. /package/{es → src}/Loading2/Loading2.less +0 -0
  267. /package/{es → src}/Loading2/package.json +0 -0
  268. /package/{es → src}/ModalWithDrag/ModalWithDrag.less +0 -0
  269. /package/{es → src}/ModalWithDrag/package.json +0 -0
  270. /package/{es → src}/NumberInput/package.json +0 -0
  271. /package/{es → src}/Search/Search.less +0 -0
  272. /package/{es → src}/Search/package.json +0 -0
  273. /package/{es → src}/Sidebar/Sidebar.less +0 -0
  274. /package/{es → src}/Sidebar/package.json +0 -0
  275. /package/{es → src}/Sidebar2/Sidebar.less +0 -0
  276. /package/{es → src}/Sidebar2/package.json +0 -0
  277. /package/{es → src}/SuperForm/SuperForm.less +0 -0
  278. /package/{es → src}/SuperForm/package.json +0 -0
  279. /package/{es → src}/SuperForm2/SuperForm.less +0 -0
  280. /package/{es → src}/SuperForm2/package.json +0 -0
  281. /package/{es → src}/SuperIcon/package.json +0 -0
  282. /package/{es → src}/SuperPagination/package.json +0 -0
  283. /package/{es → src}/SuperTab/SuperTab.less +0 -0
  284. /package/{es → src}/SuperTab/package.json +0 -0
  285. /package/{es → src}/SuperTab2/SuperTab2.less +0 -0
  286. /package/{es → src}/SuperTab2/package.json +0 -0
  287. /package/{es → src}/SuperTable/DragSortRow.less +0 -0
  288. /package/{es → src}/SuperTable/FilterDropDown.less +0 -0
  289. /package/{es → src}/SuperTable/SuperTable.less +0 -0
  290. /package/{es → src}/SuperTable/package.json +0 -0
  291. /package/{es → src}/SuperTable2/SuperTable2.less +0 -0
  292. /package/{es → src}/SuperTable2/package.json +0 -0
  293. /package/{es → src}/SuperTable3/FilterDropDown.less +0 -0
  294. /package/{es → src}/SuperTable3/SuperTable.less +0 -0
  295. /package/{es → src}/SuperTable3/package.json +0 -0
  296. /package/{es → src}/SuperToolbar/SuperToolbar.less +0 -0
  297. /package/{es → src}/SuperToolbar/package.json +0 -0
  298. /package/{es → src}/SuperUpload/SuperUpload.less +0 -0
  299. /package/{es → src}/SuperUpload/package.json +0 -0
  300. /package/{es → src}/Title/Title.less +0 -0
  301. /package/{es → src}/Title/package.json +0 -0
  302. /package/{es → src}/Viewer/Viewer.less +0 -0
  303. /package/{es → src}/Viewer/imgView.less +0 -0
  304. /package/{es → src}/Viewer/package.json +0 -0
  305. /package/{es → src}/WingBlank/WingBlank.less +0 -0
  306. /package/{es → src}/WingBlank/package.json +0 -0
  307. /package/{es → src}/adjust.less +0 -0
  308. /package/{es → src}/style.less +0 -0
  309. /package/{es → src}/variables.less +0 -0
@@ -1,1019 +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 _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
10
- import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
11
- import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
12
- import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
13
- import _Table from "antd/es/table";
14
- import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
15
- import _extends from "@babel/runtime-corejs3/helpers/extends";
16
- import _Switch from "antd/es/switch";
17
- import _Button from "antd/es/button";
18
- import _Checkbox from "antd/es/checkbox";
19
- import _Icon from "antd/es/icon";
20
- import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
21
- import _createClass from "@babel/runtime-corejs3/helpers/createClass";
22
- import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
23
- import _inherits from "@babel/runtime-corejs3/helpers/inherits";
24
- import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
25
- import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
26
- import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
27
- var _excluded = ["onRowClick"];
28
-
29
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
30
-
31
- function _unsupportedIterableToArray(o, minLen) { var _context20; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context20 = Object.prototype.toString.call(o)).call(_context20, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
32
-
33
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
34
-
35
- 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; }
36
-
37
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context18, _context19; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context18 = ownKeys(Object(source), !0)).call(_context18, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context19 = ownKeys(Object(source))).call(_context19, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
38
-
39
- import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
40
- import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
41
- import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
42
- import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
43
- import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
44
- import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
45
- import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
46
- import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
47
- import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
48
-
49
- 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); }; }
50
-
51
- 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; } }
52
-
53
- import React from 'react';
54
- import PropTypes from 'prop-types';
55
- import ReactDOM from 'react-dom';
56
- import Control, { getTitle } from '../Control';
57
- import SuperTableCell from './SuperTableCell';
58
- import fixed from '../SuperTable/fixed';
59
- import SuperToolbar from '../SuperToolbar';
60
- import variables from '../variables';
61
- import helper, { getObjectExclude } from '../helper';
62
- import DragSortRow from "../SuperTable/DragSortRow";
63
- var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //存储value
64
- 'selectText', //存储title
65
- 'search', 'searchText', 'selectSearch', //多选下拉搜索
66
- 'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
67
- 'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
68
- 'uploadImg', 'double'];
69
- /**
70
- * key:标识所在列,在一个表格中必须唯一
71
- * title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
72
- * type:嵌入的表单元素类型
73
- * link: 是否为超链接,type未设置时,该属性才生效。为true表示内容来至items,为字符串表示超链接内容就是该字符串
74
- * options: 对象(包含value和title)数组
75
- * props:传递参数给被嵌入的组件
76
- * width: 嵌入的组件的宽度,默认值为100
77
- * align:对齐方式,index默认center,其他类型默认为left
78
- * showAdd: 表头是否显示+号,默认为false,加号会触发onAdd事件
79
- * hide: 为true时隐藏该列
80
- */
81
-
82
- var ColType = {
83
- key: PropTypes.string.isRequired,
84
- title: PropTypes.string.isRequired,
85
- type: PropTypes.oneOf(TypeEnum),
86
- link: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
87
- align: PropTypes.oneOf(['left', 'center', 'right']),
88
- width: PropTypes.number,
89
- options: PropTypes.array,
90
- showAdd: PropTypes.any,
91
- hide: PropTypes.bool,
92
- props: PropTypes.any
93
- };
94
- /**
95
- * onCheck:点击复选框时触发,原型func(rowIndex, keyName, checked)
96
- * onContentChange: 输入框内容改变时触发,原型为function(rowIndex, keyName, value)
97
- * onBlur: 输入框失去焦点时触发,原型为function(rowIndex, keyName, value)
98
- * onSearch:search组件输入内容时触发,原型为function(rowIndex, keyName, value, col)
99
- * onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
100
- * onAdd:点击+号时触发,原型为function(keyName)
101
- * onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
102
- * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
103
- * onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
104
- */
105
-
106
- var CallbackType = {
107
- onExitValid: PropTypes.func,
108
- onCheck: PropTypes.func,
109
- onContentChange: PropTypes.func,
110
- onBlur: PropTypes.func,
111
- onSearch: PropTypes.func,
112
- onLink: PropTypes.func,
113
- onAdd: PropTypes.func,
114
- onRenderCustom: PropTypes.func,
115
- onToolbar: PropTypes.func,
116
- onDoubleClick: PropTypes.func,
117
- onTableFileChange: PropTypes.func,
118
- buildSuperUploadProps: PropTypes.func,
119
- //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
120
- onImgTileClick: PropTypes.func,
121
- //点击img类型标题触发事件
122
- onMoveRow: PropTypes.func
123
- };
124
- /**
125
- * base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
126
- * isEmphasized: [可选],是否强调,行字体加粗显示, 除了isEmphasized设置为true之外,加粗行数据里要设置__isEmphasized为true
127
- */
128
-
129
- var SuperTable2 = /*#__PURE__*/function (_React$Component) {
130
- _inherits(SuperTable2, _React$Component);
131
-
132
- var _super = _createSuper(SuperTable2);
133
-
134
- function SuperTable2() {
135
- var _context;
136
-
137
- var _this;
138
-
139
- _classCallCheck(this, SuperTable2);
140
-
141
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
142
- args[_key] = arguments[_key];
143
- }
144
-
145
- _this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
146
-
147
- _defineProperty(_assertThisInitialized(_this), "onSwitch", function (key, rowIndex) {
148
- return function (value) {
149
- var _ref = _this.props.callback || {},
150
- onContentChange = _ref.onContentChange;
151
-
152
- onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
153
- };
154
- });
155
-
156
- _defineProperty(_assertThisInitialized(_this), "onCheck", function (key, rowIndex) {
157
- return function (e) {
158
- var _ref2 = _this.props.callback || {},
159
- onCheck = _ref2.onCheck;
160
-
161
- onCheck && onCheck(_this.getIndex(rowIndex), key, e.target.checked);
162
- };
163
- });
164
-
165
- _defineProperty(_assertThisInitialized(_this), "onChange", function (key, rowIndex) {
166
- return function (value) {
167
- var _ref3 = _this.props.callback || {},
168
- onContentChange = _ref3.onContentChange;
169
-
170
- _this.closeValid();
171
-
172
- onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
173
- };
174
- });
175
-
176
- _defineProperty(_assertThisInitialized(_this), "onDoubleChange1", function (key, rowIndex) {
177
- return function (doublekey, value) {
178
- var _ref4 = _this.props.callback || {},
179
- onContentChange = _ref4.onContentChange;
180
-
181
- _this.closeValid();
182
-
183
- onContentChange && onContentChange(_this.getIndex(rowIndex), doublekey, value);
184
- };
185
- });
186
-
187
- _defineProperty(_assertThisInitialized(_this), "onSearch", function (key, rowIndex, config) {
188
- return function (value) {
189
- var _ref5 = _this.props.callback || {},
190
- onSearch = _ref5.onSearch;
191
-
192
- onSearch && onSearch(_this.getIndex(rowIndex), key, value, config);
193
- };
194
- });
195
-
196
- _defineProperty(_assertThisInitialized(_this), "onAdd", function (key) {
197
- return function () {
198
- var _ref6 = _this.props.callback || {},
199
- onAdd = _ref6.onAdd;
200
-
201
- onAdd && onAdd(key);
202
- };
203
- });
204
-
205
- _defineProperty(_assertThisInitialized(_this), "onRowAdd", function (key, index) {
206
- return function () {
207
- var _ref7 = _this.props.callback || {},
208
- onLink = _ref7.onLink;
209
-
210
- onLink && onLink(key, index, _this.props.items[index]);
211
- };
212
- });
213
-
214
- _defineProperty(_assertThisInitialized(_this), "onBlur", function (key, rowIndex) {
215
- return function (value) {
216
- var _ref8 = _this.props.callback || {},
217
- onBlur = _ref8.onBlur;
218
-
219
- _this.closeValid();
220
-
221
- onBlur && onBlur(_this.getIndex(rowIndex), key, value);
222
- };
223
- });
224
-
225
- _defineProperty(_assertThisInitialized(_this), "onDoubleClick", function (key, value) {
226
- return function () {
227
- var _ref9 = _this.props.callback || {},
228
- onDoubleClick = _ref9.onDoubleClick;
229
-
230
- onDoubleClick && onDoubleClick(key, value);
231
- };
232
- });
233
-
234
- _defineProperty(_assertThisInitialized(_this), "onImgTileClick", function (col, value, rowIndex) {
235
- return function () {
236
- var _ref10 = _this.props.callback || {},
237
- onImgTileClick = _ref10.onImgTileClick;
238
-
239
- onImgTileClick && onImgTileClick(col, value, rowIndex);
240
- };
241
- });
242
-
243
- _defineProperty(_assertThisInitialized(_this), "onMoveRow", function (dragIndex, targetIndex) {
244
- var _ref11 = _this.props.callback || {},
245
- onMoveRow = _ref11.onMoveRow;
246
-
247
- onMoveRow && onMoveRow(dragIndex, targetIndex);
248
- });
249
-
250
- _defineProperty(_assertThisInitialized(_this), "closeValid", function () {
251
- var _this$props = _this.props,
252
- valid = _this$props.valid,
253
- _this$props$callback = _this$props.callback,
254
- callback = _this$props$callback === void 0 ? {} : _this$props$callback;
255
- valid && callback.onExitValid();
256
- });
257
-
258
- _defineProperty(_assertThisInitialized(_this), "getOptions", function (key, colOptions, index) {
259
- var options = _this.props.items[index].options;
260
- var options2 = _this.props.options;
261
-
262
- if (options && _Array$isArray(options[key])) {
263
- return options[key];
264
- } else if (options2 && _Array$isArray(options2[key])) {
265
- return options2[key];
266
- } else {
267
- return colOptions;
268
- }
269
- });
270
-
271
- _defineProperty(_assertThisInitialized(_this), "validField", function (required, value) {
272
- if (!_this.props.valid || _this.error || !required || value) {
273
- return false;
274
- } else if (typeof value === 'number') {
275
- return false;
276
- } else {
277
- _this.error = true;
278
- return true;
279
- }
280
- });
281
-
282
- _defineProperty(_assertThisInitialized(_this), "renderEditableCell", function (config, value, index) {
283
- var key = config.key,
284
- type = config.type,
285
- options = config.options,
286
- props = config.props,
287
- required = config.required,
288
- width = config.width,
289
- showRowAdd = config.showRowAdd;
290
-
291
- var _this$props$items$ind = _this.props.items[index],
292
- readonly = _this$props$items$ind.readonly,
293
- _this$props$items$ind2 = _this$props$items$ind.isReadonly,
294
- isReadonly = _this$props$items$ind2 === void 0 ? [] : _this$props$items$ind2,
295
- _this$props$items$ind3 = _this$props$items$ind.isRequired,
296
- isRequired = _this$props$items$ind3 === void 0 ? [] : _this$props$items$ind3,
297
- _this$props$items$ind4 = _this$props$items$ind._extraProps,
298
- _extraProps = _this$props$items$ind4 === void 0 ? {} : _this$props$items$ind4;
299
-
300
- var cellProps = {
301
- value: value,
302
- width: width,
303
- items: _this.props.items[index],
304
- type: readonly || _Array$isArray(isReadonly) && _includesInstanceProperty(isReadonly).call(isReadonly, key) || _this.props.readonly ? 'readonly' : type,
305
- props: readonly ? {} : props,
306
- error: _this.validField(required, value),
307
- options: _this.getOptions(key, options, index),
308
- onChange: _this.onChange(key, index),
309
- onSearch: _this.onSearch(key, index, config),
310
- onBlur: _this.onBlur(key, index)
311
- };
312
-
313
- if (showRowAdd && _Array$isArray(isRequired) && _includesInstanceProperty(isRequired).call(isRequired, key)) {
314
- cellProps.error = _this.validField(true, value);
315
- cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
316
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
317
- style: {
318
- color: 'red',
319
- display: 'inline-block'
320
- }
321
- }, "*"), /*#__PURE__*/React.createElement("span", {
322
- style: {
323
- marginLeft: '5px',
324
- display: 'inline-block',
325
- width: 'calc(100% - 12px)'
326
- }
327
- }, /*#__PURE__*/React.createElement(SuperTableCell, cellProps)), /*#__PURE__*/React.createElement("span", {
328
- style: {
329
- color: '#2196f3',
330
- verticalAlign: 'super'
331
- }
332
- }, /*#__PURE__*/React.createElement(_Icon, {
333
- type: "plus-circle-o",
334
- role: "add",
335
- onClick: _this.onRowAdd(key, index)
336
- })));
337
- }
338
-
339
- if (_Array$isArray(isRequired) && _includesInstanceProperty(isRequired).call(isRequired, key)) {
340
- cellProps.error = _this.validField(true, value);
341
- cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
342
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
343
- style: {
344
- color: 'red',
345
- display: 'inline-block'
346
- }
347
- }, "*"), /*#__PURE__*/React.createElement("span", {
348
- style: {
349
- marginLeft: '5px',
350
- display: 'inline-block',
351
- width: 'calc(100% - 12px)'
352
- }
353
- }, /*#__PURE__*/React.createElement(SuperTableCell, cellProps)));
354
- }
355
-
356
- if (showRowAdd) {
357
- return /*#__PURE__*/React.createElement("div", {
358
- style: {
359
- clear: 'both'
360
- }
361
- }, /*#__PURE__*/React.createElement("span", {
362
- style: {
363
- marginRight: '5px',
364
- "float": 'left'
365
- }
366
- }, /*#__PURE__*/React.createElement(SuperTableCell, cellProps)), /*#__PURE__*/React.createElement("span", {
367
- style: {
368
- color: '#2196f3',
369
- verticalAlign: 'middle'
370
- }
371
- }, /*#__PURE__*/React.createElement(_Icon, {
372
- type: "plus-circle-o",
373
- role: "add",
374
- onClick: _this.onRowAdd(key, index)
375
- })));
376
- }
377
-
378
- return /*#__PURE__*/React.createElement(SuperTableCell, cellProps);
379
- });
380
-
381
- _defineProperty(_assertThisInitialized(_this), "renderDoubleEditableCell", function (config, value, index) {
382
- var key = config.key,
383
- type = config.type,
384
- options = config.options,
385
- props = config.props,
386
- required = config.required,
387
- width = config.width,
388
- showRowAdd = config.showRowAdd;
389
-
390
- var _this$props$items$ind5 = _this.props.items[index],
391
- readonly = _this$props$items$ind5.readonly,
392
- _this$props$items$ind6 = _this$props$items$ind5.isReadonly,
393
- isReadonly = _this$props$items$ind6 === void 0 ? [] : _this$props$items$ind6,
394
- _this$props$items$ind7 = _this$props$items$ind5.isRequired,
395
- isRequired = _this$props$items$ind7 === void 0 ? [] : _this$props$items$ind7,
396
- _this$props$items$ind8 = _this$props$items$ind5._extraProps,
397
- _extraProps = _this$props$items$ind8 === void 0 ? {} : _this$props$items$ind8;
398
-
399
- var cellProps = {
400
- value: value,
401
- width: width,
402
- items: _this.props.items[index],
403
- type: readonly || _Array$isArray(isReadonly) && _includesInstanceProperty(isReadonly).call(isReadonly, key) || _this.props.readonly ? 'readonly' : type,
404
- props: readonly ? {} : props,
405
- error: _this.validField(required, value),
406
- options: _this.getOptions(key, options, index),
407
- onChange: _this.onDoubleChange1(key, index),
408
- onSearch: _this.onSearch(key, index, config),
409
- onBlur: _this.onBlur(key, index)
410
- };
411
- return /*#__PURE__*/React.createElement(SuperTableCell, cellProps);
412
- });
413
-
414
- _defineProperty(_assertThisInitialized(_this), "renderLinkCell", function (col, value, record, index) {
415
- if (col.link === 'list') {
416
- var list = value && _Array$isArray(value) ? value : [];
417
- return /*#__PURE__*/React.createElement("div", {
418
- style: {
419
- whiteSpace: 'pre-wrap'
420
- }
421
- }, _mapInstanceProperty(list).call(list, function (item2, index2) {
422
- var _context2;
423
-
424
- var split = index2 === list.length - 1 ? '' : ',';
425
-
426
- var onClick = function onClick() {
427
- var _ref12 = _this.props.callback || {},
428
- onLink = _ref12.onLink;
429
-
430
- onLink && onLink(col.key, index, item2);
431
- };
432
-
433
- return /*#__PURE__*/React.createElement("a", {
434
- key: index2,
435
- onClick: onClick
436
- }, _concatInstanceProperty(_context2 = "".concat(item2[col.linkTitleKey])).call(_context2, split));
437
- }));
438
- } else {
439
- var title = typeof col.link === 'string' ? col.link : value;
440
-
441
- var onClick = function onClick() {
442
- var _ref13 = _this.props.callback || {},
443
- onLink = _ref13.onLink;
444
-
445
- onLink && onLink(col.key, index, record);
446
- };
447
-
448
- return /*#__PURE__*/React.createElement("a", {
449
- style: {
450
- whiteSpace: 'normal',
451
- wordBreak: "break-all"
452
- },
453
- onClick: onClick
454
- }, title);
455
- }
456
- });
457
-
458
- _defineProperty(_assertThisInitialized(_this), "getIndex", function (index) {
459
- return (_this.props.base || 0) + index;
460
- });
461
-
462
- _defineProperty(_assertThisInitialized(_this), "getCellRender", function (col) {
463
- return function (value, record, index) {
464
- var _context3, _context4, _context5, _context6, _context7, _context8, _context9, _context10;
465
-
466
- var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
467
-
468
- if (!realType) {
469
- return /*#__PURE__*/React.createElement("div", {
470
- onDoubleClick: _this.onDoubleClick(col.key, record.key),
471
- style: {
472
- minHeight: '20px',
473
- minWidth: '100px',
474
- maxWidth: "".concat(col.width - 16, "px"),
475
- color: col.isNeedShow ? '#1890ff' : '',
476
- overflow: 'hidden',
477
- textOverflow: 'ellipsis',
478
- display: '-webkit-box',
479
- WebkitLineClamp: 2,
480
- WebkitBoxOrient: "vertical",
481
- whiteSpace: 'break-spaces'
482
- },
483
- title: value
484
- }, value);
485
- }
486
-
487
- switch (realType) {
488
- case 'checkbox':
489
- return /*#__PURE__*/React.createElement(_Checkbox, {
490
- onChange: _this.onCheck(col.key, record.key),
491
- checked: value || false
492
- });
493
-
494
- case 'index':
495
- return _this.getIndex(index) + 1;
496
-
497
- case 'link':
498
- return _this.renderLinkCell(col, value, record, record.key);
499
-
500
- case 'button':
501
- var onClick = _this.props.callback.onLink ? _bindInstanceProperty(_context3 = _this.props.callback.onLink).call(_context3, null, col.key, record.key, record) : undefined;
502
-
503
- if (col.icon === 'add') {
504
- return /*#__PURE__*/React.createElement(_Button, {
505
- onClick: onClick,
506
- type: "primary",
507
- shape: "circle",
508
- size: "small",
509
- ghost: true,
510
- icon: "plus"
511
- });
512
- } else {
513
- return /*#__PURE__*/React.createElement(_Button, {
514
- onClick: onClick,
515
- size: "small",
516
- ghost: true,
517
- type: col.bsStyle
518
- }, record[col.key] || col.typeRelated);
519
- }
520
-
521
- case 'switch':
522
- return typeof value === 'string' ? /*#__PURE__*/React.createElement("div", null, value) : /*#__PURE__*/React.createElement(_Switch, {
523
- checkedChildren: col.props.checkedChildren || '',
524
- unCheckedChildren: col.props.unCheckedChildren || '',
525
- onChange: _this.onSwitch(col.key, record.key),
526
- size: "default",
527
- checked: typeof value === 'number' ? Boolean(value) : value || false,
528
- disabled: !(record._isEdit === true)
529
- });
530
-
531
- case 'custom':
532
- return _this.props.callback.onRenderCustom(record.key, col.key, value, col.props, col);
533
-
534
- case 'toolbar':
535
- //showByKey为true时,每条数据中与按钮key相同的属性值决定按钮是否显示,建议key用下划线开始命名,避免与后台数据冲突
536
- var props = {
537
- onClick: _this.props.callback.onToolbar ? _bindInstanceProperty(_context4 = _this.props.callback.onToolbar).call(_context4, null, col.key, record.key, record) : undefined,
538
- buttons: col.props.showByKey ? _filterInstanceProperty(_context5 = col.props.buttons).call(_context5, function (item) {
539
- return record[item.key] === true;
540
- }) : _filterInstanceProperty(_context6 = col.props.buttons).call(_context6, function (item) {
541
- return item.defaultShow === !record._isEdit;
542
- })
543
- };
544
- return /*#__PURE__*/React.createElement(SuperToolbar, props);
545
-
546
- case 'img':
547
- return value ? typeof value === 'string' ? /*#__PURE__*/React.createElement("img", {
548
- src: _includesInstanceProperty(value).call(value, 'http') ? value : _concatInstanceProperty(_context7 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context7, value),
549
- style: {
550
- width: '80px',
551
- height: '80px'
552
- }
553
- }) : /*#__PURE__*/React.createElement("div", {
554
- role: 'imgBox',
555
- style: {
556
- maxWidth: "".concat(col.width, "px")
557
- }
558
- }, /*#__PURE__*/React.createElement("img", {
559
- src: value.img === '' ? '/productDefault.png' : _includesInstanceProperty(_context8 = value.img).call(_context8, 'http') ? value.img : _concatInstanceProperty(_context9 = "".concat(window.location.origin, "/api/proxy/file-center-service/")).call(_context9, value.img),
560
- onError: function onError(e) {
561
- return e.target.src = '/productDefault.png';
562
- },
563
- style: {
564
- width: '80px',
565
- height: '80px'
566
- }
567
- }), /*#__PURE__*/React.createElement("div", {
568
- style: {
569
- display: 'inline-block'
570
- }
571
- }, /*#__PURE__*/React.createElement("span", {
572
- style: {
573
- display: 'block',
574
- whiteSpace: 'nowrap',
575
- overflow: 'hidden',
576
- textOverflow: 'ellipsis',
577
- width: '100px'
578
- },
579
- onClick: _this.onImgTileClick(col, record, index)
580
- }, value.title), helper.isEmpty2(value.remark) ? null : /*#__PURE__*/React.createElement("span", {
581
- style: {
582
- display: 'block',
583
- whiteSpace: 'nowrap',
584
- overflow: 'hidden',
585
- textOverflow: 'ellipsis',
586
- width: '100px',
587
- color: '#333'
588
- }
589
- }, value.remark))) : /*#__PURE__*/React.createElement("div", null);
590
-
591
- case 'uploadImg':
592
- var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
593
-
594
- var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
595
- onFileChange: _this.props.callback.onTableFileChange ? _bindInstanceProperty(_context10 = _this.props.callback.onTableFileChange).call(_context10, null, col.key, index) : undefined,
596
- type: col.type
597
- }, col.props), _this.props), commonProps), {}, {
598
- value: _this.props.items[index][col.key]
599
- });
600
-
601
- return /*#__PURE__*/React.createElement(Control, uploadProps);
602
-
603
- case 'double':
604
- return _this.renderDoubleEditableCell(_objectSpread(_objectSpread({}, col), {}, {
605
- type: realType
606
- }), value, record.key);
607
-
608
- default:
609
- return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
610
- type: realType
611
- }), value, record.key);
612
- }
613
- };
614
- });
615
-
616
- _defineProperty(_assertThisInitialized(_this), "getCheckedStatus", function (key) {
617
- var has = false,
618
- not = false;
619
- var items = _this.props.items;
620
-
621
- var _iterator = _createForOfIteratorHelper(items),
622
- _step;
623
-
624
- try {
625
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
626
- var item = _step.value;
627
- item[key] ? has = true : not = true;
628
- }
629
- } catch (err) {
630
- _iterator.e(err);
631
- } finally {
632
- _iterator.f();
633
- }
634
-
635
- return {
636
- checked: has && !not,
637
- indeterminate: has && not
638
- };
639
- });
640
-
641
- _defineProperty(_assertThisInitialized(_this), "toAdd", function (key, showAdd) {
642
- if (showAdd) {
643
- var onClick = _this.onAdd(key);
644
-
645
- return /*#__PURE__*/React.createElement(_Icon, {
646
- type: "plus-circle-o",
647
- role: "add",
648
- onClick: onClick
649
- });
650
- } else {
651
- return null;
652
- }
653
- });
654
-
655
- _defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (_ref14) {
656
- var required = _ref14.required,
657
- title = _ref14.title,
658
- type = _ref14.type,
659
- key = _ref14.key,
660
- showAdd = _ref14.showAdd;
661
-
662
- if (type === 'checkbox') {
663
- var status = _this.getCheckedStatus(key);
664
-
665
- return /*#__PURE__*/React.createElement(_Checkbox, _extends({
666
- onChange: _this.onCheck(key, -1)
667
- }, status));
668
- } else {
669
- var className = required ? 'ant-form-item-required' : '';
670
- return /*#__PURE__*/React.createElement("span", {
671
- className: className
672
- }, title, _this.toAdd(key, showAdd));
673
- }
674
- });
675
-
676
- _defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref15) {
677
- var type = _ref15.type,
678
- align = _ref15.align;
679
-
680
- if (type === 'index' || type === 'checkbox') {
681
- return 'ant-table-selection-column';
682
- } else {
683
- return align ? variables('SuperTable2')[align] : '';
684
- }
685
- });
686
-
687
- _defineProperty(_assertThisInitialized(_this), "canReadonly", function (type) {
688
- var _context11;
689
-
690
- return !_includesInstanceProperty(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg', 'double']).call(_context11, type);
691
- });
692
-
693
- _defineProperty(_assertThisInitialized(_this), "getColumns", function (cols) {
694
- var _context12;
695
-
696
- var readonly = _this.props.readonly;
697
- return _mapInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
698
- return !col.hide;
699
- })).call(_context12, function (_ref16, index) {
700
- var _context13;
701
-
702
- var col = _extends({}, _ref16);
703
-
704
- col.className = _this.getColumnClassName(col);
705
- col.title = _this.getColumnTitle(col);
706
- col.dataIndex = col.key;
707
- col.width = col.width ? col.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, col.key) ? 70 : col.type === 'img' ? 200 : 120; // const {props = {}} =
708
- // const {edit = false} = props
709
- // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
710
- // if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
711
- // return col
712
- // }
713
- // }
714
-
715
- col.readonly = readonly;
716
- col.render = _this.getCellRender(col);
717
-
718
- if (col.link) {
719
- col.type = 'link';
720
- col.render = _this.getCellRender(col);
721
- } else if (col.showPrice || col.decimalPlaces) {
722
- col.render = function (text, record, index) {
723
- if (col.showPrice && text) {
724
- text = helper.toThousands(text, col.decimalPlaces ? col.decimalPlaces : 2);
725
- return "\uFFE5".concat(text);
726
- } else {
727
- return text ? "\uFFE5".concat(text.toFixed(2)) : text;
728
- }
729
- };
730
- }
731
-
732
- return col;
733
- });
734
- });
735
-
736
- _defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
737
- return _mapInstanceProperty(items).call(items, function (item, index) {
738
- return _reduceInstanceProperty(cols).call(cols, function (result, _ref17) {
739
- var _context14, _context15;
740
-
741
- var key = _ref17.key,
742
- type = _ref17.type,
743
- options = _ref17.options;
744
-
745
- if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context14 = item.isReadonly).call(_context14, key)) || _includesInstanceProperty(_context15 = ['img', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context15, type)) {
746
- result[key] = item[key];
747
- } else {
748
- result[key] = getTitle(item[key], options);
749
- }
750
-
751
- return result;
752
- }, _objectSpread(_objectSpread({}, item), {}, {
753
- key: index,
754
- disabled: item.isCanConfigHide
755
- }));
756
- });
757
- });
758
-
759
- _defineProperty(_assertThisInitialized(_this), "getPropsByCheckbox", function () {
760
- var _this$props2 = _this.props,
761
- items = _this$props2.items,
762
- _this$props2$isEmphas = _this$props2.isEmphasized,
763
- isEmphasized = _this$props2$isEmphas === void 0 ? false : _this$props2$isEmphas;
764
-
765
- var rowClassName = function rowClassName(record) {
766
- if (isEmphasized && items[record.key].__isEmphasized) {
767
- return items[record.key].checked ? variables('SuperTable2').emphasizedSelectRow : variables('SuperTable2').emphasizedUnselectRow;
768
- }
769
-
770
- return items[record.key].checked ? variables('SuperTable2').select : '';
771
- };
772
-
773
- return {
774
- rowClassName: rowClassName
775
- };
776
- });
777
-
778
- _defineProperty(_assertThisInitialized(_this), "getSelectedRowKeys", function (items) {
779
- return _reduceInstanceProperty(items).call(items, function (result, item, index) {
780
- item.checked && result.push(index);
781
- return result;
782
- }, []);
783
- });
784
-
785
- _defineProperty(_assertThisInitialized(_this), "getPropsByCheckbox2", function (items) {
786
- var _this$props3 = _this.props,
787
- _this$props3$checkbox = _this$props3.checkbox,
788
- checkbox = _this$props3$checkbox === void 0 ? true : _this$props3$checkbox,
789
- _this$props3$radio = _this$props3.radio,
790
- radio = _this$props3$radio === void 0 ? false : _this$props3$radio,
791
- isolation = _this$props3.isolation,
792
- _this$props3$checkedR = _this$props3.checkedRows,
793
- checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR,
794
- _this$props3$isEmphas = _this$props3.isEmphasized,
795
- isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
796
- _this$props3$isWeaken = _this$props3.isWeaken,
797
- isWeaken = _this$props3$isWeaken === void 0 ? true : _this$props3$isWeaken;
798
-
799
- var rowClassName1 = function rowClassName1(record) {
800
- if (items[record.key].__total) return variables('SuperTable').totalRow;
801
- if (items[record.key].__warningRow) return variables('SuperTable').warningRow;
802
- return _includesInstanceProperty(checkedRows).call(checkedRows, record.key) ? variables('SuperTable').select : '';
803
- };
804
-
805
- var rowClassName2 = function rowClassName2(record) {
806
- if (items[record.key].__total) return variables('SuperTable').totalRow;
807
- if (items[record.key].__warningRow) return variables('SuperTable').warningRow;
808
-
809
- if (isEmphasized && items[record.key].__isEmphasized) {
810
- return items[record.key].checked ? variables('SuperTable').emphasizedSelectRow : variables('SuperTable').emphasizedUnselectRow;
811
- }
812
-
813
- if (isWeaken && items[record.key].__isWeaken) {
814
- return items[record.key].checked ? variables('SuperTable').weakenedSelectRow : variables('SuperTable').weakenedUnselectRow;
815
- }
816
-
817
- return items[record.key].checked ? variables('SuperTable').select : '';
818
- };
819
-
820
- if (checkbox) {
821
- if (radio) {
822
- return {
823
- rowClassName: rowClassName1,
824
- onRowClick: _this.onRadioRowClick,
825
- rowSelection: {
826
- type: 'radio',
827
- selectedRowKeys: checkedRows,
828
- onChange: _this.onRadioChange
829
- }
830
- };
831
- } else if (isolation) {
832
- return {
833
- rowClassName: rowClassName1,
834
- onRowClick: _this.onRowClick,
835
- rowSelection: {
836
- selectedRowKeys: checkedRows,
837
- onChange: _this.onCheckChange,
838
- getCheckboxProps: function getCheckboxProps(record) {
839
- var checked = _includesInstanceProperty(checkedRows).call(checkedRows, record.key);
840
-
841
- return {
842
- checked: checked,
843
- disabled: items[record.key].__isWeaken,
844
- style: items[record.key].__total ? {
845
- display: 'none'
846
- } : {}
847
- };
848
- }
849
- }
850
- };
851
- } else {
852
- return {
853
- rowClassName: rowClassName2,
854
- onRowClick: _this.onRowClick,
855
- rowSelection: {
856
- selectedRowKeys: _this.getSelectedRowKeys(items),
857
- onChange: _this.onChange,
858
- getCheckboxProps: function getCheckboxProps(record) {
859
- var checked = isWeaken && items[record.key].__isWeaken ? false : !!record.checked;
860
- return {
861
- checked: checked,
862
- disabled: items[record.key].__isWeaken,
863
- style: items[record.key].__total ? {
864
- display: 'none'
865
- } : {}
866
- };
867
- }
868
- }
869
- };
870
- }
871
- } else {
872
- return {
873
- rowClassName: rowClassName2
874
- };
875
- }
876
- });
877
-
878
- _defineProperty(_assertThisInitialized(_this), "getRowPropsForDrag", function () {
879
- return function (record, index) {
880
- return {
881
- index: index,
882
- onMoveRow: _this.onMoveRow
883
- };
884
- };
885
- });
886
-
887
- _defineProperty(_assertThisInitialized(_this), "getRowProps", function (onRowClick) {
888
- return function (record) {
889
- return {
890
- onClick: function onClick() {
891
- return onRowClick && onRowClick(record);
892
- },
893
- onDoubleClick: function onDoubleClick() {
894
- return _this.onDoubleClick(record);
895
- }
896
- };
897
- };
898
- });
899
-
900
- _defineProperty(_assertThisInitialized(_this), "getProps", function () {
901
- var _context16;
902
-
903
- var _this$props4 = _this.props,
904
- cols = _this$props4.cols,
905
- items = _this$props4.items,
906
- _this$props4$style = _this$props4.style,
907
- style = _this$props4$style === void 0 ? {} : _this$props4$style,
908
- _this$props4$footer = _this$props4.footer,
909
- footer = _this$props4$footer === void 0 ? null : _this$props4$footer,
910
- _this$props4$paginati = _this$props4.pagination,
911
- pagination = _this$props4$paginati === void 0 ? false : _this$props4$paginati,
912
- dragSort = _this$props4.dragSort,
913
- _this$props4$isEmphas = _this$props4.isEmphasized,
914
- isEmphasized = _this$props4$isEmphas === void 0 ? false : _this$props4$isEmphas,
915
- maxHeight = _this$props4.maxHeight,
916
- _this$props4$expanded = _this$props4.expandedRowRender,
917
- expandedRowRender = _this$props4$expanded === void 0 ? undefined : _this$props4$expanded,
918
- _this$props4$onExpand = _this$props4.onExpand,
919
- onExpand = _this$props4$onExpand === void 0 ? undefined : _this$props4$onExpand;
920
-
921
- var widthX = _reduceInstanceProperty(_context16 = _filterInstanceProperty(cols).call(cols, function (col) {
922
- return !col.hide;
923
- })).call(_context16, function (width, item) {
924
- var _context17;
925
-
926
- return width += item.width ? item.width : _includesInstanceProperty(_context17 = ['index', 'checked']).call(_context17, item.key) ? 70 : item.type === 'img' ? 200 : 120;
927
- }, 0);
928
-
929
- var scrollProps = !helper.isEmpty2(expandedRowRender) ? {
930
- expandedRowRender: expandedRowRender
931
- } : {
932
- scroll: {
933
- x: _someInstanceProperty(cols).call(cols, function (item) {
934
- return !helper.isEmpty2(item.fixed);
935
- }) ? widthX : true,
936
- y: maxHeight
937
- }
938
- };
939
-
940
- var _this$getPropsByCheck = _this.getPropsByCheckbox2(items),
941
- onRowClick = _this$getPropsByCheck.onRowClick,
942
- extraProps = _objectWithoutProperties(_this$getPropsByCheck, _excluded);
943
-
944
- return _objectSpread(_objectSpread({
945
- className: !isEmphasized ? variables('SuperTable2') : variables('SuperTable2').noTransition,
946
- columns: _this.getColumns(cols),
947
- dataSource: _this.getDataSource(items, cols),
948
- style: _Object$assign({}, {
949
- whiteSpace: 'nowrap'
950
- }, style),
951
- size: 'small',
952
- pagination: pagination,
953
- footer: footer,
954
- onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
955
- components: dragSort ? {
956
- body: {
957
- row: DragSortRow
958
- }
959
- } : {},
960
- locale: _this.props.emptyText ? {
961
- emptyText: _this.props.emptyText
962
- } : null
963
- }, _this.getPropsByCheckbox()), {}, {
964
- onExpand: onExpand
965
- }, scrollProps);
966
- });
967
-
968
- _defineProperty(_assertThisInitialized(_this), "setScroll", function () {
969
- if (_this.props.maxHeight && _this.props.items.length) {
970
- var root = ReactDOM.findDOMNode(_assertThisInitialized(_this));
971
- var container = root.getElementsByClassName('ant-table-body')[0];
972
- var header = root.getElementsByClassName('ant-table-thead')[0];
973
- fixed(container, header, _this.props.maxHeight);
974
- }
975
- });
976
-
977
- return _this;
978
- }
979
-
980
- _createClass(SuperTable2, [{
981
- key: "componentDidMount",
982
- value: function componentDidMount() {
983
- this.setScroll();
984
- }
985
- }, {
986
- key: "componentDidUpdate",
987
- value: function componentDidUpdate() {
988
- this.setScroll();
989
- }
990
- }, {
991
- key: "render",
992
- value: function render() {
993
- this.error = false;
994
- return /*#__PURE__*/React.createElement(_Table, _extends({}, this.getProps(), {
995
- key: this.props.items.length
996
- }));
997
- }
998
- }]);
999
-
1000
- return SuperTable2;
1001
- }(React.Component);
1002
-
1003
- _defineProperty(SuperTable2, "propTypes", {
1004
- cols: PropTypes.arrayOf(PropTypes.shape(ColType)).isRequired,
1005
- items: PropTypes.array.isRequired,
1006
- base: PropTypes.number,
1007
- options: PropTypes.object,
1008
- valid: PropTypes.bool,
1009
- readonly: PropTypes.bool,
1010
- style: PropTypes.object,
1011
- maxHeight: PropTypes.string,
1012
- emptyText: PropTypes.string,
1013
- footer: PropTypes.func,
1014
- callback: PropTypes.shape(CallbackType),
1015
- isEmphasized: PropTypes.bool,
1016
- dragSort: PropTypes.bool
1017
- });
1018
-
1019
- export default SuperTable2;