@hi-ui/hiui 2.15.11 → 2.15.12

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 (344) hide show
  1. package/es/_util/SwitchVersion.js +40 -0
  2. package/es/_util/depreactedPropsCompat.js +58 -0
  3. package/es/_util/index.js +31 -0
  4. package/es/_util/warning.js +2 -2
  5. package/es/alert/Alert.js +126 -0
  6. package/es/alert/__tests__/index.test.js +84 -0
  7. package/es/alert/index.js +6 -147
  8. package/es/alert/style/index.css +1 -1
  9. package/es/badge/Badge.js +82 -0
  10. package/es/badge/__tests__/index.test.js +82 -0
  11. package/es/badge/index.js +9 -87
  12. package/es/badge/style/index.css +1 -1
  13. package/es/badge/style/index.js +0 -0
  14. package/es/breadcrumb/__tests__/index.test.js +61 -0
  15. package/es/breadcrumb/index.js +85 -0
  16. package/es/breadcrumb/style/index.css +1 -0
  17. package/es/button/Button.js +62 -60
  18. package/es/button/ButtonGroup.js +24 -40
  19. package/es/button/IconLoading.js +6 -6
  20. package/es/button/__tests__/index.test.js +221 -0
  21. package/es/button/index.js +3 -2
  22. package/es/button/style/index.css +1 -1
  23. package/es/card/__tests__/index.test.js +179 -0
  24. package/es/card/index.js +61 -57
  25. package/es/card/style/index.css +1 -1
  26. package/es/carousel/__tests__/index.test.js +104 -0
  27. package/es/carousel/index.js +219 -0
  28. package/es/carousel/style/index.css +1 -0
  29. package/es/carousel/style/index.js +3 -0
  30. package/es/cascader/Cascader.js +190 -133
  31. package/es/cascader/Menu.js +168 -0
  32. package/es/cascader/__tests__/index.test.js +392 -0
  33. package/es/cascader/index.js +5 -2
  34. package/es/cascader/style/cascader.css +1 -1
  35. package/es/cascader/style/menu.css +1 -1
  36. package/es/checkbox/Checkbox.js +136 -0
  37. package/es/checkbox/Group.js +194 -0
  38. package/es/checkbox/__tests__/index.test.js +226 -0
  39. package/es/checkbox/checkbox-legacy/Base.js +212 -0
  40. package/es/checkbox/checkbox-legacy/CheckBox.js +157 -0
  41. package/es/checkbox/checkbox-legacy/index.js +15 -0
  42. package/es/checkbox/checkbox-legacy/style/index.css +1 -0
  43. package/es/checkbox/checkbox-legacy/style/index.js +3 -0
  44. package/es/checkbox/index.js +13 -4
  45. package/es/checkbox/style/index.css +1 -1
  46. package/es/collapse/__tests__/index.test.js +111 -0
  47. package/es/collapse/index.js +88 -110
  48. package/es/collapse/style/index.css +1 -1
  49. package/es/confirm/index.js +39 -60
  50. package/es/context/index.js +45 -51
  51. package/es/counter/Counter.js +339 -0
  52. package/es/counter/__tests__/index.test.js +134 -0
  53. package/es/counter/counter-legacy/index.js +267 -0
  54. package/es/counter/index.js +6 -270
  55. package/es/counter/style/index.css +1 -1
  56. package/es/date-picker/BasePicker.js +380 -302
  57. package/es/date-picker/Calender.js +326 -98
  58. package/es/date-picker/DatePanel.js +194 -213
  59. package/es/date-picker/DatePicker.js +143 -47
  60. package/es/date-picker/DateRangePanel.js +272 -208
  61. package/es/date-picker/Modal.js +18 -32
  62. package/es/date-picker/Time.js +231 -345
  63. package/es/date-picker/TimeList.js +246 -0
  64. package/es/date-picker/TimePanel.js +28 -41
  65. package/es/date-picker/TimePeriodPanel.js +27 -46
  66. package/es/date-picker/TimePicker.js +44 -46
  67. package/es/date-picker/TimeRangePanel.js +33 -51
  68. package/es/date-picker/Type.js +5 -1
  69. package/es/date-picker/WeekRangePanel.js +254 -175
  70. package/es/date-picker/YMRangePanel.js +364 -0
  71. package/es/date-picker/__tests__/index.test.js +956 -0
  72. package/es/date-picker/constants.js +14 -28
  73. package/es/date-picker/dateUtil.js +221 -52
  74. package/es/date-picker/datepicker-legacy/BasePicker.js +511 -0
  75. package/es/date-picker/datepicker-legacy/Calender.js +422 -0
  76. package/es/date-picker/datepicker-legacy/DatePanel.js +455 -0
  77. package/es/date-picker/datepicker-legacy/DatePicker.js +103 -0
  78. package/es/date-picker/datepicker-legacy/DateRangePanel.js +488 -0
  79. package/es/date-picker/datepicker-legacy/Modal.js +67 -0
  80. package/es/date-picker/datepicker-legacy/Time.js +405 -0
  81. package/es/date-picker/datepicker-legacy/TimePanel.js +85 -0
  82. package/es/date-picker/datepicker-legacy/TimePeriodPanel.js +118 -0
  83. package/es/date-picker/datepicker-legacy/TimePicker.js +78 -0
  84. package/es/date-picker/datepicker-legacy/TimeRangePanel.js +90 -0
  85. package/es/date-picker/datepicker-legacy/Type.js +31 -0
  86. package/es/date-picker/datepicker-legacy/WeekRangePanel.js +337 -0
  87. package/es/date-picker/datepicker-legacy/constants.js +79 -0
  88. package/es/date-picker/datepicker-legacy/dateUtil.js +258 -0
  89. package/es/date-picker/datepicker-legacy/index.js +15 -0
  90. package/es/date-picker/datepicker-legacy/local.js +11 -0
  91. package/es/date-picker/datepicker-legacy/style/index.css +1 -0
  92. package/es/date-picker/datepicker-legacy/style/index.js +3 -0
  93. package/es/date-picker/datepicker-legacy/style/timepicker.css +1 -0
  94. package/es/date-picker/datepicker-legacy/util.js +60 -0
  95. package/es/date-picker/index.js +5 -2
  96. package/es/date-picker/style/index.css +1 -1
  97. package/es/date-picker/toLunar.js +172 -0
  98. package/es/date-picker/util.js +101 -8
  99. package/es/dropdown/Dropdown.js +191 -203
  100. package/es/dropdown/DropdownButton.js +102 -0
  101. package/es/dropdown/DropdownMenu.js +107 -0
  102. package/es/dropdown/DropdownMenuItem.js +172 -0
  103. package/es/dropdown/__tests__/index.test.js +313 -0
  104. package/es/dropdown/index.js +69 -4
  105. package/es/dropdown/style/index.css +1 -1
  106. package/es/dropdown/style/index.js +0 -2
  107. package/es/dropdown/{__test__ → tests}/index.test.js +7 -7
  108. package/es/dropdown/utils.js +35 -0
  109. package/es/ficon/index.js +16 -30
  110. package/es/form/Form.js +176 -0
  111. package/es/form/{item.js → Item.js} +52 -60
  112. package/es/form/__tests__/index.test.js +571 -0
  113. package/es/form/index.js +6 -171
  114. package/es/form/style/index.css +1 -1
  115. package/es/grid/__tests__/index.test.js +100 -0
  116. package/es/grid/index.js +36 -56
  117. package/es/icon/index.js +23 -38
  118. package/es/index.js +61 -9
  119. package/es/input/Input.js +400 -0
  120. package/es/input/__tests__/index.test.js +376 -0
  121. package/es/input/index.js +26 -347
  122. package/es/input/input-legacy/index.js +341 -0
  123. package/es/input/input-legacy/util.js +176 -0
  124. package/es/input/style/index.css +1 -1
  125. package/es/input/util.js +26 -18
  126. package/es/lib/withDragDropContext.js +2 -2
  127. package/es/loading/Loading.js +173 -0
  128. package/es/loading/__tests__/index.test.js +110 -0
  129. package/es/loading/index.js +5 -129
  130. package/es/loading/style/index.css +0 -0
  131. package/es/loading/style/index.js +0 -0
  132. package/es/locales/en-US.js +45 -9
  133. package/es/locales/index.js +16 -2
  134. package/es/locales/zh-CN.js +46 -10
  135. package/es/locales/zh-Hant-HK.js +123 -0
  136. package/es/locales/zh-Hant-TW.js +125 -0
  137. package/es/menu/Item.js +34 -51
  138. package/es/menu/Menu.js +414 -0
  139. package/es/menu/SubMenu.js +63 -90
  140. package/es/menu/Title.js +37 -51
  141. package/es/menu/__tests__/index.test.js +274 -0
  142. package/es/menu/index.js +12 -419
  143. package/es/menu/style/index.css +1 -1
  144. package/es/message/__tests__/index.test.js +71 -0
  145. package/es/message/index.js +58 -0
  146. package/es/message/style/index.css +1 -0
  147. package/es/message/style/index.js +5 -0
  148. package/es/modal/__tests__/index.test.js +178 -0
  149. package/es/modal/index.js +85 -77
  150. package/es/modal/style/index.css +1 -1
  151. package/es/nav-menu/NavMenu.js +44 -61
  152. package/es/nav-menu/__test__/index.test.js +8 -8
  153. package/es/nav-menu/__tests__/index.test.js +23 -0
  154. package/es/nav-menu/index.js +2 -2
  155. package/es/notice/Notice.js +136 -0
  156. package/es/notice/NoticeContainer.js +107 -0
  157. package/es/notice/__tests__/index.test.js +174 -0
  158. package/es/notice/index.js +66 -0
  159. package/es/notice/style/index.css +1 -0
  160. package/es/notice/style/index.js +5 -0
  161. package/es/notification/HandleNotification/index.js +216 -0
  162. package/es/notification/HandleNotification/style/index.css +1 -0
  163. package/es/notification/HandleNotification/style/index.js +5 -0
  164. package/es/notification/__tests__/index.test.js +114 -0
  165. package/es/notification/index.js +68 -231
  166. package/es/notification/style/index.css +1 -1
  167. package/es/notification/style/index.js +0 -0
  168. package/es/pagination/Pager.js +7 -9
  169. package/es/pagination/Pagination.js +134 -133
  170. package/es/pagination/__tests__/index.test.js +244 -0
  171. package/es/pagination/index.js +9 -8
  172. package/es/pagination/style/index.css +1 -1
  173. package/es/panel/index.js +28 -46
  174. package/es/popover/__test__/index.test.js +10 -10
  175. package/es/popover/__tests__/index.test.js +152 -0
  176. package/es/popover/index.js +77 -83
  177. package/es/popper/index.js +68 -64
  178. package/es/popper/style/index.css +1 -1
  179. package/es/preview/index.js +529 -0
  180. package/es/preview/style/index.css +1 -0
  181. package/es/preview/style/index.js +3 -0
  182. package/es/progress/BarProgress.js +107 -43
  183. package/es/progress/CircleProgress.js +13 -14
  184. package/es/progress/DashboardProgress.js +11 -13
  185. package/es/progress/Progress.js +102 -0
  186. package/es/progress/__tests__/index.test.js +131 -0
  187. package/es/progress/index.js +8 -100
  188. package/es/progress/style/index.css +1 -1
  189. package/es/radio/Group.js +199 -0
  190. package/es/radio/Radio.js +147 -0
  191. package/es/radio/__tests__/index.test.js +127 -0
  192. package/es/radio/index.js +10 -216
  193. package/es/radio/{__test__ → radio-legacy/__test__}/index.test.js +13 -13
  194. package/es/radio/radio-legacy/index.js +214 -0
  195. package/es/radio/radio-legacy/style/index.css +1 -0
  196. package/es/radio/radio-legacy/style/index.js +3 -0
  197. package/es/radio/style/index.css +1 -1
  198. package/es/rate/Icons.js +70 -70
  199. package/es/rate/Rate.js +75 -108
  200. package/es/rate/__tests__/index.test.js +124 -0
  201. package/es/rate/index.js +5 -2
  202. package/es/rate/style/index.css +1 -1
  203. package/es/select/Select.js +330 -265
  204. package/es/select/SelectDropdown.js +223 -79
  205. package/es/select/SelectInput.js +120 -91
  206. package/es/select/__tests__/index.test.js +505 -0
  207. package/es/select/index.js +6 -4
  208. package/es/select/select-legacy/Option.js +78 -0
  209. package/es/select/select-legacy/Select.js +702 -0
  210. package/es/select/select-legacy/SelectDropdown.js +157 -0
  211. package/es/select/select-legacy/SelectInput.js +308 -0
  212. package/es/select/select-legacy/common.js +19 -0
  213. package/es/select/select-legacy/index.js +16 -0
  214. package/es/select/style/select-dropdown.css +1 -1
  215. package/es/select/style/select-input.css +1 -1
  216. package/es/stepper/Stepper.js +147 -0
  217. package/es/stepper/__tests__/index.test.js +161 -0
  218. package/es/stepper/index.js +21 -127
  219. package/es/stepper/style/index.css +1 -1
  220. package/es/style/icon/diyIcon.css +1 -1
  221. package/es/style/icon/index.css +1 -1
  222. package/es/switch/__tests__/index.test.js +68 -0
  223. package/es/switch/index.js +26 -46
  224. package/es/switch/style/index.css +1 -1
  225. package/es/table/Body.js +294 -0
  226. package/es/table/ClickOuterside.js +95 -0
  227. package/es/table/Footer.js +171 -0
  228. package/es/table/Header.js +320 -0
  229. package/es/table/TableContent.js +101 -0
  230. package/es/table/__tests__/index.test.js +129 -0
  231. package/es/table/checkbox/index.js +36 -47
  232. package/es/table/checkbox/style/index.css +1 -0
  233. package/es/table/checkbox/style/index.js +3 -0
  234. package/es/table/index.js +269 -314
  235. package/es/table/menu/index.js +34 -44
  236. package/es/table/prefix.js +2 -2
  237. package/es/table/style/Table.css +1 -1
  238. package/es/table/style/index.css +1 -1
  239. package/es/tabs/ItemDropdown.js +45 -65
  240. package/es/tabs/TabPane.js +26 -44
  241. package/es/tabs/Tabs.js +110 -111
  242. package/es/tabs/__tests__/index.test.js +329 -0
  243. package/es/tabs/index.js +9 -3
  244. package/es/tabs/style/index.css +1 -1
  245. package/es/tabs/tabs-legacy/ItemDropdown.js +162 -0
  246. package/es/tabs/tabs-legacy/TabPane.js +70 -0
  247. package/es/tabs/tabs-legacy/Tabs.js +291 -0
  248. package/es/tabs/tabs-legacy/index.js +18 -0
  249. package/es/tabs/tabs-legacy/style/index.css +1 -0
  250. package/es/tabs/tabs-legacy/style/index.js +3 -0
  251. package/es/tag/__tests__/index.test.js +46 -0
  252. package/es/tag/index.js +86 -0
  253. package/es/tag/style/index.css +1 -0
  254. package/es/tag/style/index.js +3 -0
  255. package/es/timeline/__tests__/index.test.js +198 -0
  256. package/es/timeline/index.js +206 -136
  257. package/es/timeline/style/index.css +1 -1
  258. package/es/tooltip/__tests__/index.test.js +166 -0
  259. package/es/tooltip/index.js +93 -52
  260. package/es/tooltip/style/index.css +1 -1
  261. package/es/transfer/Item.js +73 -71
  262. package/es/transfer/Transfer.js +558 -0
  263. package/es/transfer/__tests__/index.test.js +210 -0
  264. package/es/transfer/index.js +4 -443
  265. package/es/transfer/style/index.css +1 -1
  266. package/es/tree/IconLoading.js +38 -0
  267. package/es/tree/Tree.js +94 -111
  268. package/es/tree/TreeDivider.js +6 -6
  269. package/es/tree/TreeItem.js +217 -123
  270. package/es/tree/TreeNode.js +472 -333
  271. package/es/tree/__tests__/index.test.js +599 -0
  272. package/es/tree/index.js +9 -2
  273. package/es/tree/style/index.css +1 -1
  274. package/es/tree/tree-legacy/Tree.js +330 -0
  275. package/es/tree/tree-legacy/TreeDivider.js +25 -0
  276. package/es/tree/tree-legacy/TreeItem.js +326 -0
  277. package/es/tree/tree-legacy/TreeNode.js +711 -0
  278. package/es/tree/tree-legacy/index.js +13 -0
  279. package/es/tree/tree-legacy/style/index.css +1 -0
  280. package/es/tree/tree-legacy/style/index.js +3 -0
  281. package/es/tree/tree-legacy/util.js +434 -0
  282. package/es/tree/util.js +8 -256
  283. package/es/upload/Upload.js +292 -200
  284. package/es/upload/UploadAvatar.js +61 -79
  285. package/es/upload/UploadClick.js +62 -60
  286. package/es/upload/UploadDrag.js +63 -66
  287. package/es/upload/UploadPhoto.js +86 -75
  288. package/es/upload/UploadPictureCard.js +53 -60
  289. package/es/upload/__tests__/index.test.js +760 -0
  290. package/es/upload/index.js +8 -71
  291. package/es/upload/main.js +83 -0
  292. package/es/upload/style/index.css +1 -1
  293. package/es/upload/tool.js +0 -1
  294. package/es/upload/{Preview.js → upload-legacy/Preview.js} +48 -62
  295. package/es/upload/upload-legacy/Upload.js +431 -0
  296. package/es/upload/upload-legacy/UploadAvatar.js +318 -0
  297. package/es/upload/upload-legacy/UploadClick.js +121 -0
  298. package/es/upload/upload-legacy/UploadDrag.js +176 -0
  299. package/es/upload/upload-legacy/UploadPhoto.js +179 -0
  300. package/es/upload/upload-legacy/UploadPictureCard.js +122 -0
  301. package/es/upload/upload-legacy/index.js +67 -0
  302. package/es/upload/upload-legacy/style/index.css +1 -0
  303. package/es/upload/upload-legacy/style/index.js +5 -0
  304. package/es/upload/upload-legacy/tool.js +84 -0
  305. package/es/watermark/index.js +97 -0
  306. package/es/watermark/watermark.js +263 -0
  307. package/package.json +1 -1
  308. package/es/alert/__test__/index.test.js +0 -67
  309. package/es/button/__test__/index.test.js +0 -29
  310. package/es/cascader/__test__/index.test.js +0 -283
  311. package/es/cascader/menu.js +0 -155
  312. package/es/checkbox/Base.js +0 -205
  313. package/es/checkbox/CheckBox.js +0 -185
  314. package/es/collapse/__test__/index.test.js +0 -58
  315. package/es/counter/__test__/index.test.js +0 -52
  316. package/es/menu/ItemGroup.js +0 -81
  317. package/es/modal/__test__/index.test.js +0 -123
  318. package/es/notification/__test__/index.test.js +0 -56
  319. package/es/pagination/__test__/index.test.js +0 -140
  320. package/es/rate/__test__/index.test.js +0 -54
  321. package/es/select/Option.js +0 -93
  322. package/es/select/__test__/index.test.js +0 -429
  323. package/es/style/color/colors.css +0 -0
  324. package/es/style/index.css +0 -0
  325. package/es/style/mixins/colors.css +0 -0
  326. package/es/style/mixins/index.css +0 -0
  327. package/es/style/theme/dark.css +0 -0
  328. package/es/style/theme/default.css +0 -0
  329. package/es/switch/__test__/index.test.js +0 -39
  330. package/es/table/__test__/index.test.js +0 -73
  331. package/es/table/body.js +0 -318
  332. package/es/table/clickOuterside.js +0 -115
  333. package/es/table/footer.js +0 -196
  334. package/es/table/header.js +0 -337
  335. package/es/table/pover.js +0 -154
  336. package/es/table/tableContent.js +0 -120
  337. package/es/timeline/__test__/index.test.js +0 -49
  338. package/es/timeline/foldingItem.js +0 -82
  339. package/es/tooltip/__test__/index.test.js +0 -67
  340. package/es/transfer/__test__/index.test.js +0 -11
  341. /package/es/{style → breadcrumb/style}/index.js +0 -0
  342. /package/es/checkbox/{common.js → checkbox-legacy/common.js} +0 -0
  343. /package/es/upload/{style → upload-legacy/style}/preview.css +0 -0
  344. /package/es/upload/{style → upload-legacy/style}/preview.js +0 -0
package/es/table/body.js DELETED
@@ -1,318 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _icon = _interopRequireDefault(require("../icon"));
11
-
12
- require("../icon/style");
13
-
14
- var _prefix = _interopRequireDefault(require("./prefix"));
15
-
16
- var _footer = _interopRequireDefault(require("./footer"));
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
20
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
21
-
22
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
-
26
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
27
-
28
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
29
-
30
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
31
-
32
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
33
-
34
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
35
-
36
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
37
-
38
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
39
-
40
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
41
-
42
- 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); }; }
43
-
44
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
45
-
46
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
47
-
48
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
49
-
50
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
51
-
52
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
53
-
54
- // 点击后会展开的那个图标
55
- var Expand = /*#__PURE__*/function (_Component) {
56
- _inherits(Expand, _Component);
57
-
58
- var _super = _createSuper(Expand);
59
-
60
- function Expand(props) {
61
- var _this;
62
-
63
- _classCallCheck(this, Expand);
64
-
65
- _this = _super.call(this, props);
66
-
67
- _defineProperty(_assertThisInitialized(_this), "handleClick", function (e) {
68
- var _this$props = _this.props,
69
- addExpand = _this$props.addExpand,
70
- colItem = _this$props.colItem,
71
- index = _this$props.index,
72
- rowItem = _this$props.rowItem;
73
- addExpand(e, rowItem, index, colItem);
74
- });
75
-
76
- _this.state = {
77
- open: false
78
- };
79
- return _this;
80
- }
81
-
82
- _createClass(Expand, [{
83
- key: "render",
84
- value: function render() {
85
- var rowItem = this.props.rowItem;
86
- return /*#__PURE__*/_react["default"].createElement("div", {
87
- onClick: this.handleClick,
88
- "data-open": false
89
- }, rowItem.ishiuitableopen ? /*#__PURE__*/_react["default"].createElement(_icon["default"], {
90
- name: 'down',
91
- style: {
92
- fontSize: '14px'
93
- }
94
- }) : /*#__PURE__*/_react["default"].createElement(_icon["default"], {
95
- name: 'right',
96
- style: {
97
- fontSize: '14px'
98
- }
99
- }));
100
- }
101
- }]);
102
-
103
- return Expand;
104
- }(_react.Component);
105
-
106
- var defaultRender = function defaultRender(text, record, index) {
107
- return text;
108
- };
109
-
110
- var Row = /*#__PURE__*/function (_Component2) {
111
- _inherits(Row, _Component2);
112
-
113
- var _super2 = _createSuper(Row);
114
-
115
- function Row(props) {
116
- var _this2;
117
-
118
- _classCallCheck(this, Row);
119
-
120
- _this2 = _super2.call(this, props);
121
- _this2.state = {
122
- picked: false
123
- };
124
- return _this2;
125
- }
126
-
127
- _createClass(Row, [{
128
- key: "render",
129
- value: function render() {
130
- var _this$props2 = this.props,
131
- selectedRowKeys = _this$props2.selectedRowKeys,
132
- expand = _this$props2.expand,
133
- k = _this$props2.k,
134
- parent = _this$props2.parent,
135
- highlightRows = _this$props2.highlightRows;
136
- var classNames = {
137
- 'table-row': true,
138
- picked: selectedRowKeys.includes(k) || highlightRows.includes(k),
139
- expand: expand,
140
- test: 't'
141
- };
142
- return /*#__PURE__*/_react["default"].createElement("tr", {
143
- key: k,
144
- onDoubleClick: function onDoubleClick(e) {
145
- if (!k.toString()) {
146
- return;
147
- }
148
-
149
- if (highlightRows.includes(k)) {
150
- highlightRows.splice(highlightRows.indexOf(k), 1);
151
- } else {
152
- highlightRows.push(k);
153
- }
154
-
155
- parent.setState({
156
- highlightRows: highlightRows
157
- });
158
- },
159
- className: (0, _prefix["default"])(classNames)
160
- }, this.props.children);
161
- }
162
- }]);
163
-
164
- return Row;
165
- }(_react.Component);
166
-
167
- var Body = /*#__PURE__*/function (_Component3) {
168
- _inherits(Body, _Component3);
169
-
170
- var _super3 = _createSuper(Body);
171
-
172
- function Body(props) {
173
- var _this3;
174
-
175
- _classCallCheck(this, Body);
176
-
177
- _this3 = _super3.call(this, props);
178
- _this3.state = {
179
- pickedRows: []
180
- };
181
- return _this3;
182
- }
183
-
184
- _createClass(Body, [{
185
- key: "render",
186
- value: function render() {
187
- var _this$props3 = this.props,
188
- columns = _this$props3.columns,
189
- dataSource = _this$props3.dataSource,
190
- addExpand = _this$props3.cbs.addExpand,
191
- _this$props3$rowSelec = _this$props3.rowSelection,
192
- rowSelection = _this$props3$rowSelec === void 0 ? {} : _this$props3$rowSelec,
193
- highlightCols = _this$props3.highlightCols,
194
- advance = _this$props3.advance,
195
- rest = _objectWithoutProperties(_this$props3, ["columns", "dataSource", "cbs", "rowSelection", "highlightCols", "advance"]);
196
-
197
- columns = columns.filter(function (item) {
198
- return !item.hide;
199
- });
200
- var selectedRowKeys = rowSelection.selectedRowKeys || []; // 表头分组
201
-
202
- var i = 0;
203
- var pureData = dataSource.filter(function (item) {
204
- return !item.expand;
205
- });
206
- var nodes = dataSource.map(function (item, k) {
207
- var colSpan = 1;
208
- var tr = []; // 点击后展开的那一行
209
-
210
- if (item.expand) {
211
- var obj = pureData.find(function (o) {
212
- return o.key === item.parent;
213
- });
214
- var expand = columns.find(function (o) {
215
- return o.type === 'expand';
216
- });
217
- tr = expand ? /*#__PURE__*/_react["default"].createElement("td", {
218
- colSpan: columns.length,
219
- key: 'key-' + item.parent,
220
- className: (0, _prefix["default"])('table-col', highlightCols.includes(item.key) ? 'picked' : null)
221
- }, expand.render(obj[item.dataIndex], obj, pureData.indexOf(obj))) : null;
222
- } else {
223
- // 扩展项的占位dom
224
- // 这里只能用for循环,因为会有表格 行列 合并的情况,要改变循环的顺序
225
- for (var j = 0; j < columns.length;) {
226
- var _obj = columns[j];
227
- var td = void 0;
228
- var rowSpan = 1; // 点击后会展开的那个图标
229
-
230
- if (_obj.type === 'expand') {
231
- // {/*<div key={'td-' + k + '-' + j} onClick={(e) => addExpand(e, obj)} data-index={k} data-open={false}> > </div>*/}
232
- td = /*#__PURE__*/_react["default"].createElement(Expand, {
233
- key: k,
234
- addExpand: addExpand,
235
- "data-index": k,
236
- "data-open": false,
237
- colItem: _obj,
238
- index: k,
239
- rowItem: item
240
- });
241
- } else {
242
- _obj.render = _obj.render || defaultRender;
243
- td = _obj.render(item[_obj.dataIndex], item, i); // 做判断的原因是?
244
-
245
- if (td && td.props && td.props.colSpan) {
246
- colSpan = td.props.colSpan;
247
- }
248
-
249
- if (td && td.props && td.props.hasOwnProperty('rowSpan')) {
250
- rowSpan = td.props.rowSpan;
251
- }
252
-
253
- if (td && td.children) {
254
- td = td.children;
255
- } // j=j+colSpan
256
- // 表格溢出开关
257
- // if(colSpan>0){
258
- // j=j+colSpan-1
259
- // }
260
-
261
- }
262
-
263
- if (parseInt(rowSpan) !== 0) {
264
- tr.push( /*#__PURE__*/_react["default"].createElement("td", {
265
- className: (0, _prefix["default"])('table-col', highlightCols.includes(_obj.key) ? 'picked' : null),
266
- rowSpan: rowSpan,
267
- colSpan: colSpan,
268
- "data-span": colSpan,
269
- key: 'td-' + k + '-' + j
270
- }, td));
271
- } else {
272
- tr.push(null);
273
- }
274
-
275
- j = j + colSpan;
276
- } // 这个i 是在动态插入行的时候,给render的回掉函数的 索引
277
-
278
-
279
- i++; // 动态插入的组件不累加
280
- }
281
-
282
- return /*#__PURE__*/_react["default"].createElement(Row, _extends({
283
- selectedRowKeys: selectedRowKeys,
284
- k: item.key || k,
285
- expand: item.expand,
286
- key: item.key || 'tr-' + k
287
- }, rest), tr);
288
- });
289
- return /*#__PURE__*/_react["default"].createElement("tbody", {
290
- className: (0, _prefix["default"])('table-tbody')
291
- }, advance && advance.prefix && this.getPrefixNodes(), nodes, /*#__PURE__*/_react["default"].createElement(_footer["default"], _extends({
292
- className: 'table-footer'
293
- }, this.props)));
294
- }
295
- }, {
296
- key: "getPrefixNodes",
297
- value: function getPrefixNodes() {
298
- var _this$props4 = this.props,
299
- columns = _this$props4.columns,
300
- advance = _this$props4.advance;
301
- return advance.prefix.map(function (suf, index) {
302
- return /*#__PURE__*/_react["default"].createElement("tr", {
303
- className: (0, _prefix["default"])('table-row'),
304
- key: "suf-".concat(index)
305
- }, columns.map(function (item, j) {
306
- return /*#__PURE__*/_react["default"].createElement("td", {
307
- className: (0, _prefix["default"])('table-col'),
308
- key: "suf-".concat(item.dataIndex, "-").concat(index, "-").concat(j)
309
- }, suf[item.dataIndex]);
310
- }));
311
- });
312
- }
313
- }]);
314
-
315
- return Body;
316
- }(_react.Component);
317
-
318
- exports["default"] = Body;
@@ -1,115 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
15
-
16
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
-
18
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
19
-
20
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
-
22
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
23
-
24
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
25
-
26
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
-
28
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
29
-
30
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
31
-
32
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
33
-
34
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
35
-
36
- 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); }; }
37
-
38
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
39
-
40
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
-
42
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
43
-
44
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
-
46
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
47
-
48
- var ClickOutside = /*#__PURE__*/function (_Component) {
49
- _inherits(ClickOutside, _Component);
50
-
51
- var _super = _createSuper(ClickOutside);
52
-
53
- function ClickOutside(props) {
54
- var _this;
55
-
56
- _classCallCheck(this, ClickOutside);
57
-
58
- _this = _super.call(this, props);
59
-
60
- _defineProperty(_assertThisInitialized(_this), "handle", function (e) {
61
- var onClickOutside = _this.props.onClickOutside;
62
- if (e.type === 'touchend') _this.isTouch = true;
63
- if (e.type === 'click' && _this.isTouch) return;
64
- var el = _this.container;
65
-
66
- if (el && !el.contains(e.target)) {
67
- onClickOutside(e);
68
- e.stopPropagation();
69
- }
70
- });
71
-
72
- _this.getContainer = _this.getContainer.bind(_assertThisInitialized(_this));
73
- _this.isTouch = false;
74
- return _this;
75
- }
76
-
77
- _createClass(ClickOutside, [{
78
- key: "getContainer",
79
- value: function getContainer(ref) {
80
- this.container = ref;
81
- }
82
- }, {
83
- key: "render",
84
- value: function render() {
85
- var _this$props = this.props,
86
- children = _this$props.children,
87
- onClickOutside = _this$props.onClickOutside,
88
- props = _objectWithoutProperties(_this$props, ["children", "onClickOutside"]);
89
-
90
- return /*#__PURE__*/_react["default"].createElement("div", _extends({}, props, {
91
- ref: this.getContainer
92
- }), children);
93
- }
94
- }, {
95
- key: "componentDidMount",
96
- value: function componentDidMount() {
97
- document.addEventListener('touchend', this.handle, true);
98
- document.addEventListener('click', this.handle, true);
99
- }
100
- }, {
101
- key: "componentWillUnmount",
102
- value: function componentWillUnmount() {
103
- document.removeEventListener('touchend', this.handle, true);
104
- document.removeEventListener('click', this.handle, true);
105
- }
106
- }]);
107
-
108
- return ClickOutside;
109
- }(_react.Component);
110
-
111
- exports["default"] = ClickOutside;
112
-
113
- _defineProperty(ClickOutside, "propTypes", {
114
- onClickOutside: _propTypes["default"].func.isRequired
115
- });
@@ -1,196 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = _interopRequireWildcard(require("react"));
9
-
10
- var _prefix = _interopRequireDefault(require("./prefix"));
11
-
12
- var _decimal = require("decimal.js");
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
- function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
17
-
18
- function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
21
-
22
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
23
-
24
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
25
-
26
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
27
-
28
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
29
-
30
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
31
-
32
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
33
-
34
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
35
-
36
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
37
-
38
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
39
-
40
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
41
-
42
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
43
-
44
- 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); }; }
45
-
46
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
47
-
48
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
49
-
50
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
51
-
52
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
53
-
54
- var Footer = /*#__PURE__*/function (_Component) {
55
- _inherits(Footer, _Component);
56
-
57
- var _super = _createSuper(Footer);
58
-
59
- function Footer() {
60
- _classCallCheck(this, Footer);
61
-
62
- return _super.apply(this, arguments);
63
- }
64
-
65
- _createClass(Footer, [{
66
- key: "getSum",
67
- value: function getSum(item) {
68
- var _this$props = this.props,
69
- _this$props$dataSourc = _this$props.dataSource,
70
- dataSource = _this$props$dataSourc === void 0 ? [] : _this$props$dataSourc,
71
- _this$props$advance = _this$props.advance,
72
- _this$props$advance$s = _this$props$advance.suffix,
73
- suffix = _this$props$advance$s === void 0 ? [] : _this$props$advance$s,
74
- _this$props$advance$p = _this$props$advance.prefix,
75
- prefix = _this$props$advance$p === void 0 ? [] : _this$props$advance$p;
76
- var res = [].concat(_toConsumableArray(prefix), _toConsumableArray(dataSource), _toConsumableArray(suffix)).map(function (data) {
77
- return data[item.dataIndex];
78
- });
79
- var total = new _decimal.Decimal(0);
80
- res.forEach(function (item, index) {
81
- total = total.plus(new _decimal.Decimal(item));
82
- });
83
- return total.valueOf();
84
- }
85
- }, {
86
- key: "getSumNodes",
87
- value: function getSumNodes() {
88
- var _this = this;
89
-
90
- var columns = this.props.columns;
91
- var tds = columns.map(function (item, index) {
92
- var key = 'sum-' + index;
93
-
94
- if (item.type === 'number') {
95
- return /*#__PURE__*/_react["default"].createElement("td", {
96
- className: (0, _prefix["default"])('table-col'),
97
- key: key
98
- }, _this.getSum(item));
99
- }
100
-
101
- if (index === 0) {
102
- return /*#__PURE__*/_react["default"].createElement("td", {
103
- key: "sum-name"
104
- }, "\u5408\u8BA1");
105
- }
106
-
107
- return /*#__PURE__*/_react["default"].createElement("td", {
108
- className: (0, _prefix["default"])('table-col'),
109
- key: key
110
- });
111
- });
112
- return /*#__PURE__*/_react["default"].createElement("tr", {
113
- className: (0, _prefix["default"])('table-row'),
114
- key: "sum-nodes"
115
- }, tds);
116
- }
117
- }, {
118
- key: "getAveNum",
119
- value: function getAveNum(item) {
120
- var _this$props2 = this.props,
121
- _this$props2$dataSour = _this$props2.dataSource,
122
- dataSource = _this$props2$dataSour === void 0 ? [] : _this$props2$dataSour,
123
- _this$props2$advance = _this$props2.advance,
124
- _this$props2$advance$ = _this$props2$advance.suffix,
125
- suffix = _this$props2$advance$ === void 0 ? [] : _this$props2$advance$,
126
- _this$props2$advance$2 = _this$props2$advance.prefix,
127
- prefix = _this$props2$advance$2 === void 0 ? [] : _this$props2$advance$2;
128
- var data = [].concat(_toConsumableArray(prefix), _toConsumableArray(dataSource), _toConsumableArray(suffix));
129
- return new _decimal.Decimal(this.getSum(item)).dividedBy(data.length).toFixed(2).valueOf() * 1;
130
- }
131
- }, {
132
- key: "getAveNodes",
133
- value: function getAveNodes() {
134
- var _this2 = this;
135
-
136
- var columns = this.props.columns;
137
- var tds = columns.map(function (item, index) {
138
- var key = 'ave-' + index;
139
-
140
- if (item.type === 'number') {
141
- return /*#__PURE__*/_react["default"].createElement("td", {
142
- key: key
143
- }, _this2.getAveNum(item));
144
- }
145
-
146
- if (index === 0) {
147
- return /*#__PURE__*/_react["default"].createElement("td", {
148
- className: (0, _prefix["default"])('table-col'),
149
- key: key
150
- }, "\u5747\u503C");
151
- }
152
-
153
- return /*#__PURE__*/_react["default"].createElement("td", {
154
- className: (0, _prefix["default"])('table-col'),
155
- key: key
156
- });
157
- });
158
- return /*#__PURE__*/_react["default"].createElement("tr", {
159
- className: (0, _prefix["default"])('table-row'),
160
- key: "ave-nodes"
161
- }, tds);
162
- }
163
- }, {
164
- key: "getSuffixNodes",
165
- value: function getSuffixNodes() {
166
- var _this$props3 = this.props,
167
- columns = _this$props3.columns,
168
- advance = _this$props3.advance;
169
- return advance.suffix.map(function (suf, index) {
170
- var key = 'suf-' + index;
171
- return /*#__PURE__*/_react["default"].createElement("tr", {
172
- className: (0, _prefix["default"])('table-row'),
173
- key: key
174
- }, columns.map(function (item, j) {
175
- return /*#__PURE__*/_react["default"].createElement("td", {
176
- className: (0, _prefix["default"])('table-col'),
177
- key: "".concat(key, "-").concat(item.dataIndex, "-").concat(index, "-").concat(j)
178
- }, suf[item.dataIndex]);
179
- }));
180
- });
181
- }
182
- }, {
183
- key: "render",
184
- value: function render() {
185
- var _this$props4 = this.props,
186
- advance = _this$props4.advance,
187
- dataSource = _this$props4.dataSource;
188
- return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, advance && advance.suffix && this.getSuffixNodes(), dataSource.length > 0 && advance && advance.sum && this.getSumNodes(), dataSource.length > 0 && advance && advance.avg && this.getAveNodes());
189
- }
190
- }]);
191
-
192
- return Footer;
193
- }(_react.Component);
194
-
195
- var _default = Footer;
196
- exports["default"] = _default;