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