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,813 +0,0 @@
1
- "use strict";
2
-
3
- var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
4
- var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
5
- var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
6
- var _filterInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
7
- var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
8
- var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
9
- var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
10
- var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
11
- var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
12
- var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
13
- _Object$defineProperty(exports, "__esModule", {
14
- value: true
15
- });
16
- exports["default"] = void 0;
17
- var _table = _interopRequireDefault(require("antd/lib/table"));
18
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
19
- var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
20
- var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
21
- var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
22
- var _every = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/every"));
23
- var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
24
- var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
25
- var _setTimeout2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set-timeout"));
26
- var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
27
- var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
28
- var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
29
- var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
30
- var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
31
- var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
32
- var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
33
- var _parseFloat2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-float"));
34
- var _tooltip = _interopRequireDefault(require("antd/lib/tooltip"));
35
- var _objectDestructuringEmpty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectDestructuringEmpty"));
36
- var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
37
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
38
- var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
39
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
40
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
41
- var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
42
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
43
- var _react = _interopRequireDefault(require("react"));
44
- var _propTypes = _interopRequireDefault(require("prop-types"));
45
- var _reactDom = _interopRequireDefault(require("react-dom"));
46
- var _Control = require("../Control");
47
- var _FilterDropDown = _interopRequireDefault(require("./FilterDropDown"));
48
- var _fixed = _interopRequireDefault(require("./fixed"));
49
- var _DragSortRow = _interopRequireDefault(require("./DragSortRow"));
50
- var _variables = _interopRequireDefault(require("../variables"));
51
- var _excluded = ["onRowClick"];
52
- function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty2(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
53
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context9, _context0; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty2(_context9 = ownKeys(Object(t), !0)).call(_context9, function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty2(_context0 = ownKeys(Object(t))).call(_context0, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
54
- function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
55
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
56
- /**
57
- * sorter: [可选],不传表示该列不支持排序;为string表示按字符串排序;为number表示按数字大小排序
58
- * filter: [可选],是否支持过滤,默认为false
59
- * link: [可选],为true表示超链接,内容来至items;为字符串表示超链接,内容就是该字符串;为字符串‘list’表示超链接数组,内容就是该items对应key对象数组的linkTitleKey属性拼接
60
- * linkTitleKey: [可选],当link为'list'表示超链接组时,该值表示要拼接展示的属性key值
61
- * isDateFilterByStartAndEnd: [可选],为true时做过滤操作会显示时间段搜索,默认为false
62
- *
63
- */
64
- var ColType = {
65
- key: _propTypes["default"].string.isRequired,
66
- title: _propTypes["default"].string,
67
- align: _propTypes["default"].oneOf(['left', 'center', 'right']),
68
- sorter: _propTypes["default"].oneOf(['string', 'number']),
69
- filter: _propTypes["default"].bool,
70
- hide: _propTypes["default"].bool,
71
- options: _propTypes["default"].array,
72
- link: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].string]),
73
- linkTitleKey: _propTypes["default"].string,
74
- noWrap: _propTypes["default"].bool,
75
- isDateFilterByStartAndEnd: _propTypes["default"].bool
76
- };
77
- var ItemType = {
78
- checked: _propTypes["default"].bool
79
- };
80
-
81
- /**
82
- * onCheck:点击复选框时触发,原型func(isAll, checked, rowIndex);isolation为true时,原型为onCheck(checkedRows)
83
- * onRadio: 点击单选按钮时触发,原型为func(checkedRows)
84
- * onDoubleClick: 行双击时触发,原型func(rowIndex)
85
- * onLink: 点击超链接时触发,原型为func(key, rowIndex, item)
86
- * onTableChange: 排序信息改变时触发,原型为func(sortInfo, filterInfo)
87
- * onMoveRow:行拖曳排序时触发,原型为func(dragIndex, targetIndex)
88
- */
89
- var CallbackType = {
90
- onCheck: _propTypes["default"].func,
91
- onRadio: _propTypes["default"].func,
92
- onDoubleClick: _propTypes["default"].func,
93
- onLink: _propTypes["default"].func,
94
- onTableChange: _propTypes["default"].func,
95
- onMoveRow: _propTypes["default"].func
96
- };
97
-
98
- /**
99
- * checkbox: [可选],是否有复选框,默认为true
100
- * isPaging: [可选],是否分页,默认为false
101
- * radio: [可选],是否为单选按钮,当checkbox为true时生效,默认值为false
102
- * isolation: [可选],为true时,复选框的选中行采用checkedRows存储
103
- * checkedRows: [可选],选中的行数,radio为true时生效
104
- * index: [可选],是否有序号,默认值为true
105
- * indexTitle:[可选],序号标题,默认为'序号'
106
- * sortInfo: [可选],排序信息,默认为null
107
- * filterInfo: [可选],过滤信息,默认为null
108
- * maxHeight: [可选],设置表格的最大高度
109
- * dragSort: [可选], 为true表示支持行拖曳排序,且不支持行单击选中复选或单选按钮和双击事件,默认为false
110
- * isEmphasized: [可选],是否强调,行字体加粗显示;要实现字体加粗显示除了isEmphasized设置为true之外,加粗行数据里要设置__isEmphasized为true
111
- * isWeaken: [可选],是否弱化行字体置灰显示,除了isWeaken设置为true之外,置灰行数据里要设置__isWeaken为true
112
- * pageTotal: [可选], 为true表示开启表格末行自动汇总表格列数据,默认为false || searchTotal,当开启时,需要汇总的列需设置属性total为true,当dragSort为true时,该选项失效
113
- * searchTotal: [可选], 表格汇总数据对象,该属性不为空时pageTotal默认开启,当dragSort为true时,该选项失效
114
- */
115
- var SuperTable = /*#__PURE__*/function (_React$Component) {
116
- function SuperTable() {
117
- var _context;
118
- var _this;
119
- (0, _classCallCheck2["default"])(this, SuperTable);
120
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
121
- args[_key] = arguments[_key];
122
- }
123
- _this = _callSuper(this, SuperTable, (0, _concat["default"])(_context = []).call(_context, args));
124
- (0, _defineProperty2["default"])(_this, "state", {
125
- filterVisibleKey: ''
126
- });
127
- (0, _defineProperty2["default"])(_this, "onTableChange", function (pagination, filters, sorter) {
128
- var _ref = _this.props.callback || {},
129
- onTableChange = _ref.onTableChange;
130
- var _this$props$filterInf = _this.props.filterInfo,
131
- filterInfo = _this$props$filterInf === void 0 ? null : _this$props$filterInf;
132
- onTableChange && onTableChange(sorter, filterInfo);
133
- });
134
- (0, _defineProperty2["default"])(_this, "onChange", function () {
135
- var selectedKeyArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
136
- var _ref2 = _this.props.callback || {},
137
- onCheck = _ref2.onCheck;
138
- if (onCheck) {
139
- var _this$props = _this.props,
140
- _this$props$items = _this$props.items,
141
- items = _this$props$items === void 0 ? [] : _this$props$items,
142
- _this$props$isWeaken = _this$props.isWeaken,
143
- isWeaken = _this$props$isWeaken === void 0 ? false : _this$props$isWeaken,
144
- pageTotal = _this$props.pageTotal,
145
- searchTotal = _this$props.searchTotal;
146
- var offset = 0;
147
- pageTotal && offset--;
148
- searchTotal && offset--;
149
- var realSlectedList = selectedKeyArr.length > items.length ? (0, _slice["default"])(selectedKeyArr).call(selectedKeyArr, 0, selectedKeyArr.length + offset) : selectedKeyArr;
150
- var selectedKeys = isWeaken ? (0, _filter["default"])(realSlectedList).call(realSlectedList, function (o) {
151
- return !items[o].__isWeaken;
152
- }) : realSlectedList;
153
- var newItems = isWeaken ? (0, _filter["default"])(items).call(items, function (o) {
154
- return !o.__isWeaken;
155
- }) : items;
156
- if (selectedKeys.length === 0) {
157
- onCheck(true, false, -1);
158
- } else if (selectedKeys.length === newItems.length) {
159
- var checked = (0, _every["default"])(newItems).call(newItems, function (o) {
160
- return o.checked;
161
- });
162
- onCheck(true, !checked, -1);
163
- } else {
164
- var defaultSelectedKeys = _this.getSelectedRowKeys(newItems);
165
- if (selectedKeys.length > defaultSelectedKeys.length) {
166
- if (_this.props.isPaging && selectedKeys.length - defaultSelectedKeys.length > 1) {
167
- return onCheck(true, true, -1);
168
- }
169
- onCheck(false, true, selectedKeys[selectedKeys.length - 1]);
170
- } else {
171
- var index = (0, _findIndex["default"])(defaultSelectedKeys).call(defaultSelectedKeys, function (key) {
172
- return !(0, _some["default"])(selectedKeys).call(selectedKeys, function (select) {
173
- return select === key;
174
- });
175
- });
176
- onCheck(false, false, defaultSelectedKeys[index]);
177
- }
178
- }
179
- }
180
- });
181
- (0, _defineProperty2["default"])(_this, "onCheckChange", function (selectedKeys) {
182
- var _ref3 = _this.props.callback || {},
183
- onCheck = _ref3.onCheck;
184
- onCheck && onCheck(selectedKeys);
185
- });
186
- (0, _defineProperty2["default"])(_this, "onRadioChange", function (selectedKeys) {
187
- var _ref4 = _this.props.callback || {},
188
- onRadio = _ref4.onRadio;
189
- onRadio && onRadio(selectedKeys);
190
- });
191
- (0, _defineProperty2["default"])(_this, "onRadioRowClick", function (record) {
192
- var _ref5 = _this.props.callback || {},
193
- onRadio = _ref5.onRadio;
194
- onRadio && onRadio([record.key]);
195
- });
196
- (0, _defineProperty2["default"])(_this, "onRowClick", function (record) {
197
- var _this$props2 = _this.props,
198
- _this$props2$isWeaken = _this$props2.isWeaken,
199
- isWeaken = _this$props2$isWeaken === void 0 ? false : _this$props2$isWeaken,
200
- items = _this$props2.items;
201
- if (items.length <= record.key) return;
202
- clearTimeout(_this.timer);
203
- _this.timer = (0, _setTimeout2["default"])(function () {
204
- var _ref6 = _this.props.callback || {},
205
- onCheck = _ref6.onCheck;
206
- if (onCheck) {
207
- var _this$props3 = _this.props,
208
- isolation = _this$props3.isolation,
209
- _this$props3$checkedR = _this$props3.checkedRows,
210
- checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR;
211
- if (isolation) {
212
- if ((0, _includes["default"])(checkedRows).call(checkedRows, record.key)) {
213
- onCheck((0, _filter["default"])(checkedRows).call(checkedRows, function (key) {
214
- return record.key !== key;
215
- }));
216
- } else {
217
- onCheck((0, _concat["default"])(checkedRows).call(checkedRows, record.key));
218
- }
219
- } else {
220
- var checked = isWeaken && items[record.key].__isWeaken ? false : !record.checked;
221
- onCheck(false, checked, record.key);
222
- }
223
- }
224
- }, 250);
225
- });
226
- (0, _defineProperty2["default"])(_this, "onDoubleClick", function (record) {
227
- clearTimeout(_this.timer);
228
- var _ref7 = _this.props.callback || {},
229
- onDoubleClick = _ref7.onDoubleClick;
230
- onDoubleClick && onDoubleClick(record.key);
231
- });
232
- (0, _defineProperty2["default"])(_this, "onLink", function (key, index, item, e) {
233
- var _ref8 = _this.props.callback || {},
234
- onLink = _ref8.onLink;
235
- onLink && onLink(key, index, item);
236
- e.stopPropagation();
237
- });
238
- (0, _defineProperty2["default"])(_this, "onLinkDouble", function (e) {
239
- e.stopPropagation();
240
- });
241
- (0, _defineProperty2["default"])(_this, "onMoveRow", function (dragIndex, targetIndex) {
242
- var _ref9 = _this.props.callback || {},
243
- onMoveRow = _ref9.onMoveRow;
244
- onMoveRow && onMoveRow(dragIndex, targetIndex);
245
- });
246
- (0, _defineProperty2["default"])(_this, "getSelectedRowKeys", function (items) {
247
- return (0, _reduce["default"])(items).call(items, function (result, item, index) {
248
- item.checked && result.push(index);
249
- return result;
250
- }, []);
251
- });
252
- (0, _defineProperty2["default"])(_this, "getIndexInfo", function () {
253
- var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
254
- var _this$props4 = _this.props,
255
- _this$props4$index = _this$props4.index,
256
- index = _this$props4$index === void 0 ? true : _this$props4$index,
257
- _this$props4$indexTit = _this$props4.indexTitle,
258
- indexTitle = _this$props4$indexTit === void 0 ? '序号' : _this$props4$indexTit;
259
- return index ? [{
260
- key: 'index',
261
- title: indexTitle,
262
- render: function render(text, record, index) {
263
- return items[record.key].__totalIndexTitle || index + 1;
264
- }
265
- }] : [];
266
- });
267
- (0, _defineProperty2["default"])(_this, "setSortInfo", function (col, sortInfo) {
268
- if (col.sorter === 'string') {
269
- col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
270
- col.sorter = function (row1, row2) {
271
- var a = !col.link ? row1[col.key] : row1[col.key].props.children;
272
- var b = !col.link ? row2[col.key] : row2[col.key].props.children;
273
- if (a > b) {
274
- return 1;
275
- } else if (a === b) {
276
- return 0;
277
- } else {
278
- return -1;
279
- }
280
- };
281
- } else if (col.sorter === 'number') {
282
- col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
283
- col.sorter = function (a, b) {
284
- return a[col.key] - b[col.key];
285
- };
286
- } else {
287
- delete col.sorter;
288
- }
289
- });
290
- (0, _defineProperty2["default"])(_this, "setFilterInfo", function (col, filterInfo, visibleKey) {
291
- if ((0, _filter["default"])(col)) {
292
- var _col$isDateFilterBySt = col.isDateFilterByStartAndEnd,
293
- isDateFilterByStartAndEnd = _col$isDateFilterBySt === void 0 ? false : _col$isDateFilterBySt;
294
- var onSearch = function onSearch(value) {
295
- var _ref0 = _this.props.callback || {},
296
- onTableChange = _ref0.onTableChange;
297
- var _this$props$sortInfo = _this.props.sortInfo,
298
- sortInfo = _this$props$sortInfo === void 0 ? null : _this$props$sortInfo;
299
- var newFilterInfo = (0, _assign["default"])({}, filterInfo, (0, _defineProperty2["default"])({}, col.key, value));
300
- _this.setState({
301
- filterVisibleKey: ''
302
- });
303
- onTableChange && onTableChange(sortInfo, newFilterInfo);
304
- };
305
- var value = filterInfo[col.key];
306
- col.filteredValue = value ? [value] : null;
307
- col.filterDropdownVisible = visibleKey === col.key;
308
- var onClose = function onClose() {
309
- _this.setState({
310
- filterVisibleKey: ''
311
- });
312
- };
313
- col.filterDropdown = /*#__PURE__*/_react["default"].createElement(_FilterDropDown["default"], {
314
- value: value,
315
- onSearch: onSearch,
316
- onClose: onClose,
317
- isDateFilterByStartAndEnd: isDateFilterByStartAndEnd
318
- });
319
- col.onFilterDropdownVisibleChange = function (visible) {
320
- if (isDateFilterByStartAndEnd) {
321
- visible && _this.setState({
322
- filterVisibleKey: col.key
323
- });
324
- } else {
325
- _this.setState({
326
- filterVisibleKey: visible ? col.key : ''
327
- });
328
- }
329
- };
330
- col.onFilter = function (value, record) {
331
- var items = _this.getItems();
332
- if (items[record.key].__total) return true;
333
- var content = !col.link ? record[col.key] : record[col.key].props.children;
334
- if (!col.isDateFilterByStartAndEnd) {
335
- var con = (0, _isArray["default"])(content) ? content : String(content);
336
- return (0, _includes["default"])(con).call(con, value);
337
- } else {
338
- return !(value.start && new Date(value.start) > new Date(content) || value.end && value.end < content);
339
- }
340
- };
341
- }
342
- delete col.filter;
343
- });
344
- (0, _defineProperty2["default"])(_this, "linkList", function (key, index, item) {
345
- var linkTitleKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'fileName';
346
- var list = item[key] || [];
347
- return /*#__PURE__*/_react["default"].createElement("div", null, (0, _map["default"])(list).call(list, function (item2, index2) {
348
- var _context2, _context3;
349
- var split = index2 === list.length - 1 ? '' : ',';
350
- var onClick = (0, _bind["default"])(_context2 = _this.onLink).call(_context2, null, key, index, item2);
351
- return /*#__PURE__*/_react["default"].createElement("a", {
352
- key: index2,
353
- onClick: onClick,
354
- onDoubleClick: _this.onLinkDouble
355
- }, (0, _concat["default"])(_context3 = "".concat(item2[linkTitleKey])).call(_context3, split));
356
- }));
357
- });
358
- (0, _defineProperty2["default"])(_this, "waring", function (key, index, item, warningKey) {
359
- var text = item[key] ? item[key] : '';
360
- var color = item[warningKey] == 1 ? 'red' : 'rgba(0, 0, 0, 0.65)';
361
- return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", {
362
- style: {
363
- color: color
364
- }
365
- }, text.title ? text.title : text));
366
- });
367
- (0, _defineProperty2["default"])(_this, "defaultList", function (key, index, item, text, link) {
368
- var _context4;
369
- var onClick = (0, _bind["default"])(_context4 = _this.onLink).call(_context4, null, key, index, item);
370
- if (link && typeof link === 'string') {
371
- return /*#__PURE__*/_react["default"].createElement("a", {
372
- onClick: onClick,
373
- onDoubleClick: _this.onLinkDouble
374
- }, text);
375
- }
376
- return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("p", null, text));
377
- });
378
- (0, _defineProperty2["default"])(_this, "getColumns", function (cols, items) {
379
- var _context5, _context6;
380
- var _this$props5 = _this.props,
381
- sortInfo = _this$props5.sortInfo,
382
- filterInfo = _this$props5.filterInfo;
383
- var filterVisibleKey = _this.state.filterVisibleKey;
384
- return (0, _map["default"])(_context5 = (0, _concat["default"])(_context6 = _this.getIndexInfo(items)).call(_context6, (0, _filter["default"])(cols).call(cols, function (col) {
385
- return !col.hide;
386
- }))).call(_context5, function (_ref1) {
387
- var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref1), _ref1));
388
- col.dataIndex = col.key;
389
- col.className = col.key === 'index' ? 'ant-table-selection-column' : col.align ? (0, _variables["default"])('SuperTable')[col.align] : '';
390
- col.noWrap && (col.className = (0, _variables["default"])('SuperTable').noWrap);
391
- _this.setSortInfo(col, sortInfo || {});
392
- _this.setFilterInfo(col, filterInfo || {}, filterVisibleKey);
393
- if (col.defaultValue) {
394
- col.render = function (text, record, index) {
395
- return _this.defaultList(col.key, index, items[index], col.defaultValue, col.link);
396
- };
397
- } else if (col.link === 'list') {
398
- col.render = function (text, record, index) {
399
- return _this.linkList(col.key, index, items[index], col.linkTitleKey);
400
- };
401
- } else if (col.link && typeof col.link === 'string') {
402
- col.render = function (text, record, index) {
403
- return _this.link(col.key, index, items[index], col.link);
404
- };
405
- } else if (col.isWarning) {
406
- col.render = function (text, record, index) {
407
- return _this.waring(col.key, index, items[index], col.warningKey);
408
- };
409
- } else if (col.tooltip) {
410
- col.render = function (text, record, index) {
411
- return _this.tooltip(col.key, index, items[index], col);
412
- };
413
- }
414
- return col;
415
- });
416
- });
417
- (0, _defineProperty2["default"])(_this, "getText", function (value, options) {
418
- if ((0, _isArray["default"])(value)) {
419
- return (0, _map["default"])(value).call(value, function (v) {
420
- return (0, _Control.getTitle)(v, options);
421
- }).toString();
422
- } else {
423
- return (0, _Control.getTitle)(value, options);
424
- }
425
- });
426
- (0, _defineProperty2["default"])(_this, "link", function (key, index, item, text) {
427
- var _context7;
428
- var onClick = (0, _bind["default"])(_context7 = _this.onLink).call(_context7, null, key, index, item);
429
- return /*#__PURE__*/_react["default"].createElement("a", {
430
- onClick: onClick,
431
- onDoubleClick: _this.onLinkDouble
432
- }, text);
433
- });
434
- (0, _defineProperty2["default"])(_this, "tooltip", function (key, index, item, _ref10) {
435
- var tipLen = _ref10.tooltip,
436
- options = _ref10.options;
437
- var text = _this.getText(item[key], options);
438
- var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
439
- return needTip ? /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
440
- title: text
441
- }, /*#__PURE__*/_react["default"].createElement("span", null, (0, _slice["default"])(text).call(text, 0, tipLen) + '...')) : /*#__PURE__*/_react["default"].createElement("span", null, (0, _isArray["default"])(text) ? text.join(',') : text);
442
- });
443
- (0, _defineProperty2["default"])(_this, "getImgSrc", function (value, options) {
444
- var index = (0, _findIndex["default"])(options).call(options, function (obj) {
445
- return obj.value == value;
446
- });
447
- return index === -1 ? null : options[index].img;
448
- });
449
- /**
450
- *
451
- * @param item{array}:列数据
452
- * @param key{string}:字段key
453
- * @param options{array}:字段options
454
- * @param dataSource{string,array}:数据源,如果列数据有多层则用此决定
455
- */
456
- (0, _defineProperty2["default"])(_this, "getSourceText", function (item, key, options, dataSource) {
457
- var value = {};
458
- if (typeof dataSource === 'string') {
459
- value = item[dataSource] || {};
460
- } else if ((0, _isArray["default"])(dataSource)) {
461
- (0, _forEach["default"])(dataSource).call(dataSource, function (source, index) {
462
- /*如果字段重复则用dataSource取到结果,key不作为取字段的标准*/
463
- if (index === 0) {
464
- value = item[source] || {};
465
- } else {
466
- value = value[source] || {};
467
- }
468
- });
469
- }
470
- /*如果上面已经取到结果则不进入*/
471
- if (typeof value !== 'string') {
472
- value = value[key];
473
- }
474
- return _this.getText(value, options);
475
- });
476
- (0, _defineProperty2["default"])(_this, "getDataSource", function (items, cols) {
477
- return (0, _map["default"])(items).call(items, function (item, index) {
478
- return (0, _reduce["default"])(cols).call(cols, function (result, _ref11) {
479
- var key = _ref11.key,
480
- options = _ref11.options,
481
- link = _ref11.link,
482
- icon = _ref11.icon,
483
- dataSource = _ref11.dataSource;
484
- if (link) {
485
- if (typeof link === 'boolean') {
486
- result[key] = _this.link(key, index, item, _this.getText(item[key], options));
487
- }
488
- } else if (icon) {
489
- var _context8;
490
- //单独的icon列,icon=true数据值根据options获得显示的图片url
491
- var src = _this.getImgSrc(item[key], options);
492
- var onClick = (0, _bind["default"])(_context8 = _this.onLink).call(_context8, null, key, index, item);
493
- result[key] = src ? /*#__PURE__*/_react["default"].createElement("img", {
494
- src: src,
495
- onClick: onClick
496
- }) : '';
497
- } else if (dataSource) {
498
- result[key] = _this.getSourceText(item, key, options, dataSource);
499
- } else {
500
- result[key] = _this.getText(item[key], options);
501
- }
502
- return result;
503
- }, {
504
- key: index,
505
- checked: !!item.checked
506
- });
507
- });
508
- });
509
- (0, _defineProperty2["default"])(_this, "getPropsByCheckbox", function (items) {
510
- var _this$props6 = _this.props,
511
- _this$props6$checkbox = _this$props6.checkbox,
512
- checkbox = _this$props6$checkbox === void 0 ? true : _this$props6$checkbox,
513
- _this$props6$radio = _this$props6.radio,
514
- radio = _this$props6$radio === void 0 ? false : _this$props6$radio,
515
- isolation = _this$props6.isolation,
516
- _this$props6$checkedR = _this$props6.checkedRows,
517
- checkedRows = _this$props6$checkedR === void 0 ? [] : _this$props6$checkedR,
518
- _this$props6$isEmphas = _this$props6.isEmphasized,
519
- isEmphasized = _this$props6$isEmphas === void 0 ? false : _this$props6$isEmphas,
520
- _this$props6$isWeaken = _this$props6.isWeaken,
521
- isWeaken = _this$props6$isWeaken === void 0 ? true : _this$props6$isWeaken;
522
- var rowClassName1 = function rowClassName1(record) {
523
- if (items[record.key].__total) return (0, _variables["default"])('SuperTable').totalRow;
524
- if (items[record.key].__warningRow) return (0, _variables["default"])('SuperTable').warningRow;
525
- return (0, _includes["default"])(checkedRows).call(checkedRows, record.key) ? (0, _variables["default"])('SuperTable').select : '';
526
- };
527
- var rowClassName2 = function rowClassName2(record) {
528
- if (items[record.key].__total) return (0, _variables["default"])('SuperTable').totalRow;
529
- if (items[record.key].__warningRow) return (0, _variables["default"])('SuperTable').warningRow;
530
- if (isEmphasized && items[record.key].__isEmphasized) {
531
- return items[record.key].checked ? (0, _variables["default"])('SuperTable').emphasizedSelectRow : (0, _variables["default"])('SuperTable').emphasizedUnselectRow;
532
- }
533
- if (isWeaken && items[record.key].__isWeaken) {
534
- return items[record.key].checked ? (0, _variables["default"])('SuperTable').weakenedSelectRow : (0, _variables["default"])('SuperTable').weakenedUnselectRow;
535
- }
536
- return items[record.key].checked ? (0, _variables["default"])('SuperTable').select : '';
537
- };
538
- if (checkbox) {
539
- if (radio) {
540
- return {
541
- rowClassName: rowClassName1,
542
- onRowClick: _this.onRadioRowClick,
543
- rowSelection: {
544
- type: 'radio',
545
- selectedRowKeys: checkedRows,
546
- onChange: _this.onRadioChange
547
- }
548
- };
549
- } else if (isolation) {
550
- return {
551
- rowClassName: rowClassName1,
552
- onRowClick: _this.onRowClick,
553
- rowSelection: {
554
- selectedRowKeys: checkedRows,
555
- onChange: _this.onCheckChange,
556
- getCheckboxProps: function getCheckboxProps(record) {
557
- var checked = (0, _includes["default"])(checkedRows).call(checkedRows, record.key);
558
- return {
559
- checked: checked,
560
- disabled: items[record.key].__isWeaken,
561
- style: items[record.key].__total ? {
562
- display: 'none'
563
- } : {}
564
- };
565
- }
566
- }
567
- };
568
- } else {
569
- return {
570
- rowClassName: rowClassName2,
571
- onRowClick: _this.onRowClick,
572
- rowSelection: {
573
- selectedRowKeys: _this.getSelectedRowKeys(items),
574
- onChange: _this.onChange,
575
- getCheckboxProps: function getCheckboxProps(record) {
576
- var checked = isWeaken && items[record.key].__isWeaken ? false : !!record.checked;
577
- return {
578
- checked: checked,
579
- disabled: items[record.key].__isWeaken,
580
- style: items[record.key].__total ? {
581
- display: 'none'
582
- } : {}
583
- };
584
- }
585
- }
586
- };
587
- }
588
- } else {
589
- return {
590
- rowClassName: rowClassName2
591
- };
592
- }
593
- });
594
- (0, _defineProperty2["default"])(_this, "getRowProps", function (onRowClick) {
595
- return function (record) {
596
- return {
597
- onClick: function onClick() {
598
- return onRowClick && onRowClick(record);
599
- },
600
- onDoubleClick: function onDoubleClick() {
601
- return _this.onDoubleClick(record);
602
- }
603
- };
604
- };
605
- });
606
- (0, _defineProperty2["default"])(_this, "getRowPropsForDrag", function () {
607
- return function (record, index) {
608
- return {
609
- index: index,
610
- onMoveRow: _this.onMoveRow
611
- };
612
- };
613
- });
614
- (0, _defineProperty2["default"])(_this, "getItems", function () {
615
- var _this$props7 = _this.props,
616
- items = _this$props7.items,
617
- cols = _this$props7.cols,
618
- _this$props7$dragSort = _this$props7.dragSort,
619
- dragSort = _this$props7$dragSort === void 0 ? false : _this$props7$dragSort,
620
- _this$props7$pageTota = _this$props7.pageTotal,
621
- pageTotal = _this$props7$pageTota === void 0 ? false : _this$props7$pageTota,
622
- searchTotal = _this$props7.searchTotal;
623
- var resItems = items;
624
- if (!dragSort && items.length > 1) {
625
- if (pageTotal || searchTotal) {
626
- var totalItem = (0, _reduce["default"])(cols).call(cols, function (result, _ref12) {
627
- var key = _ref12.key,
628
- _ref12$total = _ref12.total,
629
- total = _ref12$total === void 0 ? false : _ref12$total;
630
- if (total) {
631
- result[key] = (0, _parseFloat2["default"])(Number((0, _reduce["default"])(items).call(items, function (result, item) {
632
- return (0, _parseFloat2["default"])(String(item[key] || 0)) + result;
633
- }, 0)).toFixed(4));
634
- }
635
- return result;
636
- }, {
637
- __total: true,
638
- __totalIndexTitle: '本页汇总'
639
- });
640
- resItems = (0, _concat["default"])(resItems).call(resItems, [totalItem]);
641
- }
642
- if (searchTotal) {
643
- resItems = (0, _concat["default"])(resItems).call(resItems, [_objectSpread(_objectSpread({}, searchTotal), {}, {
644
- __total: true,
645
- __totalIndexTitle: '查询汇总'
646
- })]);
647
- }
648
- }
649
- return resItems;
650
- });
651
- (0, _defineProperty2["default"])(_this, "toTotalFooter", function () {
652
- var _this$props8 = _this.props,
653
- cols = _this$props8.cols,
654
- items = _this$props8.items,
655
- isolation = _this$props8.isolation,
656
- checkedRows = _this$props8.checkedRows;
657
- var totalCols = (0, _filter["default"])(cols).call(cols, function (item) {
658
- return item.total;
659
- });
660
- if (totalCols.length > 0) {
661
- var checkedItems = isolation ? (0, _filter["default"])(items).call(items, function (item, index) {
662
- return (0, _includes["default"])(checkedRows).call(checkedRows, index);
663
- }) : (0, _filter["default"])(items).call(items, function (item) {
664
- return item.checked;
665
- });
666
- var countItems = checkedItems.length ? checkedItems : items;
667
- var totalItems = (0, _map["default"])(totalCols).call(totalCols, function (_ref13) {
668
- var title = _ref13.title,
669
- key = _ref13.key,
670
- _ref13$props = _ref13.props,
671
- props = _ref13$props === void 0 ? {} : _ref13$props;
672
- var value = (0, _reduce["default"])(countItems).call(countItems, function (result, item) {
673
- return (0, _parseFloat2["default"])((result + Number(item[key] || 0)).toFixed(props.precision || 6));
674
- }, 0);
675
- return {
676
- title: title,
677
- value: value
678
- };
679
- });
680
- return /*#__PURE__*/_react["default"].createElement("div", {
681
- style: {
682
- height: '36px',
683
- lineHeight: '36px'
684
- }
685
- }, /*#__PURE__*/_react["default"].createElement("span", {
686
- style: {
687
- marginRight: "15px"
688
- }
689
- }, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), (0, _map["default"])(totalItems).call(totalItems, function (_ref14, index) {
690
- var title = _ref14.title,
691
- value = _ref14.value;
692
- return /*#__PURE__*/_react["default"].createElement("span", {
693
- key: index,
694
- style: {
695
- marginRight: "10px"
696
- }
697
- }, /*#__PURE__*/_react["default"].createElement("span", null, title, ": "), /*#__PURE__*/_react["default"].createElement("span", {
698
- style: {
699
- color: '#01a4ff'
700
- }
701
- }, value));
702
- }));
703
- } else {
704
- return null;
705
- }
706
- });
707
- (0, _defineProperty2["default"])(_this, "getProps", function () {
708
- var _this$props9 = _this.props,
709
- cols = _this$props9.cols,
710
- _this$props9$isPaging = _this$props9.isPaging,
711
- isPaging = _this$props9$isPaging === void 0 ? false : _this$props9$isPaging,
712
- _this$props9$isEmphas = _this$props9.isEmphasized,
713
- isEmphasized = _this$props9$isEmphas === void 0 ? false : _this$props9$isEmphas,
714
- _this$props9$isWeaken = _this$props9.isWeaken,
715
- isWeaken = _this$props9$isWeaken === void 0 ? false : _this$props9$isWeaken,
716
- dragSort = _this$props9.dragSort,
717
- _this$props9$footer = _this$props9.footer,
718
- footer = _this$props9$footer === void 0 ? null : _this$props9$footer;
719
- var items = _this.getItems();
720
- var _this$getPropsByCheck = _this.getPropsByCheckbox(items),
721
- onRowClick = _this$getPropsByCheck.onRowClick,
722
- extraProps = (0, _objectWithoutProperties2["default"])(_this$getPropsByCheck, _excluded);
723
- var renderProps = _objectSpread({
724
- className: !isEmphasized || !isWeaken ? (0, _variables["default"])('SuperTable') : (0, _variables["default"])('SuperTable').noTransition,
725
- columns: _this.getColumns(cols, items),
726
- dataSource: _this.getDataSource(items, cols),
727
- size: 'small',
728
- pagination: isPaging,
729
- scroll: {
730
- x: true
731
- },
732
- onChange: _this.onTableChange,
733
- onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
734
- components: dragSort ? {
735
- body: {
736
- row: _DragSortRow["default"]
737
- }
738
- } : {},
739
- footer: footer ? footer : _this.toTotalFooter
740
- }, extraProps);
741
- return renderProps;
742
- });
743
- (0, _defineProperty2["default"])(_this, "setScroll", function () {
744
- var _this$props0 = _this.props,
745
- maxHeight = _this$props0.maxHeight,
746
- pageTotal = _this$props0.pageTotal,
747
- searchTotal = _this$props0.searchTotal;
748
- if (maxHeight && _this.getItems().length) {
749
- var root = _reactDom["default"].findDOMNode(_this);
750
- var container = root.getElementsByClassName('ant-table-body')[0];
751
- var header = root.getElementsByClassName('ant-table-thead')[0];
752
- var tbody = root.getElementsByClassName('ant-table-tbody')[0];
753
- var pageTotalOffset = searchTotal ? 2 : 1;
754
- var pageTotalElement = pageTotal && tbody && tbody.children ? tbody.children[tbody.children.length - pageTotalOffset] : null;
755
- var searchTotalElement = searchTotal && tbody && tbody.children ? tbody.children[tbody.children.length - 1] : null;
756
- (0, _fixed["default"])(container, header, maxHeight, {
757
- pageTotalElement: pageTotalElement,
758
- searchTotalElement: searchTotalElement
759
- });
760
- }
761
- });
762
- return _this;
763
- }
764
- (0, _inherits2["default"])(SuperTable, _React$Component);
765
- return (0, _createClass2["default"])(SuperTable, [{
766
- key: "shouldComponentUpdate",
767
- value: function shouldComponentUpdate(props, state) {
768
- var _this2 = this;
769
- var keys = ['cols', 'items', 'maxHeight', 'checkedRows', 'sortInfo', 'filterInfo'];
770
- return (0, _some["default"])(keys).call(keys, function (key) {
771
- return props[key] !== _this2.props[key];
772
- }) || state.filterVisibleKey !== this.state.filterVisibleKey;
773
- }
774
- }, {
775
- key: "componentDidMount",
776
- value: function componentDidMount() {
777
- this.setScroll();
778
- }
779
- }, {
780
- key: "componentDidUpdate",
781
- value: function componentDidUpdate() {
782
- this.setScroll();
783
- }
784
- }, {
785
- key: "render",
786
- value: function render() {
787
- return /*#__PURE__*/_react["default"].createElement(_table["default"], (0, _extends2["default"])({}, this.getProps(), {
788
- key: this.props.items.length
789
- }));
790
- }
791
- }]);
792
- }(_react["default"].Component);
793
- (0, _defineProperty2["default"])(SuperTable, "propTypes", {
794
- cols: _propTypes["default"].arrayOf(_propTypes["default"].shape(ColType)).isRequired,
795
- items: _propTypes["default"].arrayOf(_propTypes["default"].shape(ItemType)).isRequired,
796
- isPaging: _propTypes["default"].bool,
797
- checkbox: _propTypes["default"].bool,
798
- radio: _propTypes["default"].bool,
799
- isolation: _propTypes["default"].bool,
800
- checkedRows: _propTypes["default"].array,
801
- index: _propTypes["default"].bool,
802
- indexTitle: _propTypes["default"].string,
803
- sortInfo: _propTypes["default"].object,
804
- filterInfo: _propTypes["default"].object,
805
- maxHeight: _propTypes["default"].string,
806
- callback: _propTypes["default"].shape(CallbackType),
807
- isEmphasized: _propTypes["default"].bool,
808
- isWeaken: _propTypes["default"].bool,
809
- dragSort: _propTypes["default"].bool,
810
- pageTotal: _propTypes["default"].bool,
811
- searchTotal: _propTypes["default"].object
812
- });
813
- var _default = exports["default"] = SuperTable;