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