cloud-b2b 1.1.50 → 1.1.51

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