cloud-b2b 1.1.57 → 1.1.59

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