shineout 1.7.1 → 1.8.0-beta.2

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 (381) hide show
  1. package/css/DatePicker/utils.js +1 -1
  2. package/css/Form/Field.js +8 -4
  3. package/css/Form/Form.js +3 -0
  4. package/css/Form/Item.js +1 -1
  5. package/css/Form/index.d.ts +1 -0
  6. package/css/Form/inputable.js +1 -1
  7. package/css/Pagination/Jumper.js +3 -0
  8. package/css/index.d.ts +1 -1
  9. package/css/index.js +1 -1
  10. package/dist/shineout.js +24 -14
  11. package/dist/shineout.js.map +1 -1
  12. package/dist/shineout.min.js +1 -1
  13. package/es/Alert/index.js +127 -107
  14. package/es/Alert/styles/index.js +3 -4
  15. package/es/AnimationList/AbsoluteList.js +257 -193
  16. package/es/AnimationList/LazyList.js +120 -92
  17. package/es/AnimationList/List.js +43 -23
  18. package/es/AnimationList/index.js +19 -14
  19. package/es/AnimationList/styles/index.js +3 -4
  20. package/es/Breadcrumb/index.js +77 -69
  21. package/es/Breadcrumb/styles/index.js +3 -4
  22. package/es/Button/Button.js +91 -74
  23. package/es/Button/Group.js +42 -28
  24. package/es/Button/Once.js +39 -23
  25. package/es/Button/index.js +7 -10
  26. package/es/Button/styles/index.js +3 -4
  27. package/es/Card/Accordion.js +58 -45
  28. package/es/Card/Body.js +55 -42
  29. package/es/Card/Card.js +85 -79
  30. package/es/Card/Footer.js +38 -15
  31. package/es/Card/Header.js +52 -34
  32. package/es/Card/Submit.js +51 -33
  33. package/es/Card/context.js +22 -16
  34. package/es/Card/index.js +16 -19
  35. package/es/Card/styles/index.js +3 -4
  36. package/es/CardGroup/CardGroup.js +93 -69
  37. package/es/CardGroup/Item.js +61 -43
  38. package/es/CardGroup/context.js +12 -10
  39. package/es/CardGroup/index.js +7 -10
  40. package/es/CardGroup/styles/index.js +3 -4
  41. package/es/Carousel/Item.js +31 -17
  42. package/es/Carousel/index.js +156 -123
  43. package/es/Carousel/styles/index.js +3 -4
  44. package/es/Cascader/Cascader.js +397 -346
  45. package/es/Cascader/FilterList.js +185 -142
  46. package/es/Cascader/Input.js +102 -79
  47. package/es/Cascader/List.js +66 -41
  48. package/es/Cascader/Node.js +153 -110
  49. package/es/Cascader/Result.js +289 -232
  50. package/es/Cascader/filter.js +92 -61
  51. package/es/Cascader/index.js +13 -18
  52. package/es/Cascader/styles/index.js +3 -4
  53. package/es/Checkbox/CheckItem.js +168 -154
  54. package/es/Checkbox/Checkbox.js +2 -3
  55. package/es/Checkbox/Group.js +106 -85
  56. package/es/Checkbox/context.js +12 -10
  57. package/es/Checkbox/index.js +14 -21
  58. package/es/Checkbox/styles/index.js +3 -4
  59. package/es/DataList/BaseItem.js +39 -21
  60. package/es/DataList/Extra.js +33 -17
  61. package/es/DataList/List.js +166 -140
  62. package/es/DataList/Meta.js +109 -74
  63. package/es/DataList/Pagination.js +9 -10
  64. package/es/DataList/index.js +13 -19
  65. package/es/DataList/styles/index.js +3 -4
  66. package/es/DatePicker/Container.js +468 -449
  67. package/es/DatePicker/Day.js +265 -258
  68. package/es/DatePicker/Icon.js +34 -20
  69. package/es/DatePicker/Month.js +101 -79
  70. package/es/DatePicker/Picker.js +110 -83
  71. package/es/DatePicker/Quick.js +52 -39
  72. package/es/DatePicker/Range.js +241 -192
  73. package/es/DatePicker/Text.js +103 -91
  74. package/es/DatePicker/Time.js +165 -147
  75. package/es/DatePicker/TimeScroll.js +148 -116
  76. package/es/DatePicker/Year.js +74 -53
  77. package/es/DatePicker/index.js +16 -18
  78. package/es/DatePicker/paramUtils.js +92 -58
  79. package/es/DatePicker/styles/index.js +3 -4
  80. package/es/DatePicker/utils.js +189 -198
  81. package/es/DatePicker/value.js +139 -98
  82. package/es/Datum/Form.js +333 -282
  83. package/es/Datum/List.js +319 -201
  84. package/es/Datum/Tree.js +298 -239
  85. package/es/Datum/hoc.js +104 -69
  86. package/es/Datum/index.js +7 -8
  87. package/es/Datum/types.js +20 -25
  88. package/es/Divider/index.js +50 -32
  89. package/es/Divider/styles/index.js +3 -4
  90. package/es/Drawer/index.js +14 -9
  91. package/es/Dropdown/Item.js +56 -43
  92. package/es/Dropdown/index.js +273 -259
  93. package/es/Dropdown/styles/index.js +3 -4
  94. package/es/EditableArea/EditableArea.js +157 -136
  95. package/es/EditableArea/index.js +8 -15
  96. package/es/EditableArea/styles/index.js +3 -4
  97. package/es/Form/Block.js +83 -57
  98. package/es/Form/BlockField.js +32 -17
  99. package/es/Form/Field.js +59 -35
  100. package/es/Form/FieldError.js +27 -21
  101. package/es/Form/FieldSet.js +214 -156
  102. package/es/Form/Flow.js +51 -32
  103. package/es/Form/Form.js +181 -144
  104. package/es/Form/Item.js +181 -166
  105. package/es/Form/Loop.js +202 -146
  106. package/es/Form/formButton.js +58 -42
  107. package/es/Form/formContext.js +104 -95
  108. package/es/Form/index.d.ts +1 -0
  109. package/es/Form/index.js +40 -45
  110. package/es/Form/inputable.js +368 -292
  111. package/es/Form/mode.js +15 -9
  112. package/es/Form/styles/index.js +4 -5
  113. package/es/Gap/index.js +71 -47
  114. package/es/Gap/styles/index.js +3 -4
  115. package/es/Gap/support.js +11 -14
  116. package/es/Grid/index.js +88 -58
  117. package/es/Grid/utils.js +57 -58
  118. package/es/Icon/Icon.js +43 -42
  119. package/es/Icon/index.js +39 -22
  120. package/es/Icon/styles/index.js +3 -4
  121. package/es/Image/Gallery.js +128 -113
  122. package/es/Image/Group.js +60 -36
  123. package/es/Image/Image.js +227 -153
  124. package/es/Image/Magnify.js +123 -94
  125. package/es/Image/events.js +29 -26
  126. package/es/Image/index.js +6 -9
  127. package/es/Image/styles/index.js +3 -4
  128. package/es/Input/Group.js +17 -11
  129. package/es/Input/Input.js +158 -134
  130. package/es/Input/Number.js +199 -175
  131. package/es/Input/Password.js +54 -31
  132. package/es/Input/clear.js +41 -25
  133. package/es/Input/index.js +23 -35
  134. package/es/Input/styles/index.js +3 -4
  135. package/es/Lazyload/index.js +63 -42
  136. package/es/Lazyload/styles/index.js +3 -4
  137. package/es/Menu/Item.js +275 -236
  138. package/es/Menu/List.js +75 -67
  139. package/es/Menu/Root.js +372 -334
  140. package/es/Menu/context.js +18 -12
  141. package/es/Menu/index.js +3 -5
  142. package/es/Menu/styles/index.js +3 -4
  143. package/es/Message/Container.js +155 -119
  144. package/es/Message/index.js +42 -30
  145. package/es/Message/messager.js +29 -33
  146. package/es/Message/styles/index.js +3 -4
  147. package/es/Modal/Modal.js +80 -60
  148. package/es/Modal/Panel.js +258 -234
  149. package/es/Modal/context.js +15 -15
  150. package/es/Modal/events.js +213 -182
  151. package/es/Modal/index.js +12 -14
  152. package/es/Modal/styles/index.js +3 -4
  153. package/es/Pagination/Item.js +46 -32
  154. package/es/Pagination/Jumper.js +79 -66
  155. package/es/Pagination/Links.js +110 -82
  156. package/es/Pagination/Next.js +52 -31
  157. package/es/Pagination/PageSizeList.js +57 -40
  158. package/es/Pagination/Pagination.js +78 -54
  159. package/es/Pagination/Prev.js +49 -30
  160. package/es/Pagination/Simple.js +32 -18
  161. package/es/Pagination/index.js +68 -41
  162. package/es/Pagination/styles/index.js +3 -4
  163. package/es/Popover/Confirm.js +107 -64
  164. package/es/Popover/Panel.js +284 -231
  165. package/es/Popover/context.js +15 -12
  166. package/es/Popover/events.js +80 -86
  167. package/es/Popover/index.js +12 -14
  168. package/es/Popover/styles/index.js +3 -4
  169. package/es/Progress/Circle.js +70 -59
  170. package/es/Progress/Line.js +51 -39
  171. package/es/Progress/Popup.js +42 -24
  172. package/es/Progress/analyzeColor.js +18 -9
  173. package/es/Progress/index.js +13 -15
  174. package/es/Progress/styles/index.js +3 -4
  175. package/es/Radio/Group.js +105 -94
  176. package/es/Radio/Radio.js +2 -3
  177. package/es/Radio/index.js +15 -17
  178. package/es/Radio/styles/index.js +1 -1
  179. package/es/Rate/Rate.js +216 -167
  180. package/es/Rate/index.js +17 -10
  181. package/es/Rate/styles/index.js +3 -4
  182. package/es/Rule/convert.js +48 -57
  183. package/es/Rule/index.js +63 -40
  184. package/es/Rule/length.js +53 -38
  185. package/es/Rule/regExp.js +23 -14
  186. package/es/Rule/required.js +26 -18
  187. package/es/Rule/styles/index.js +1 -1
  188. package/es/Rule/type.js +26 -18
  189. package/es/Scroll/Bar.js +145 -117
  190. package/es/Scroll/Scroll.js +277 -217
  191. package/es/Scroll/context.js +20 -13
  192. package/es/Scroll/fixedLength.js +33 -24
  193. package/es/Scroll/index.js +89 -55
  194. package/es/Scroll/styles/index.js +3 -4
  195. package/es/Select/BoxList.js +218 -189
  196. package/es/Select/BoxOption.js +64 -38
  197. package/es/Select/FlexBox.js +107 -75
  198. package/es/Select/FlexResult.js +65 -49
  199. package/es/Select/Input.js +137 -113
  200. package/es/Select/More.js +124 -121
  201. package/es/Select/Option.js +73 -52
  202. package/es/Select/OptionList.js +236 -200
  203. package/es/Select/OptionTree.js +111 -96
  204. package/es/Select/Result.js +297 -271
  205. package/es/Select/Select.js +517 -491
  206. package/es/Select/filter.js +221 -148
  207. package/es/Select/group.js +74 -45
  208. package/es/Select/index.js +32 -31
  209. package/es/Select/styles/index.js +3 -4
  210. package/es/Slider/Container.js +145 -132
  211. package/es/Slider/Indicator.js +28 -13
  212. package/es/Slider/Slider.js +132 -103
  213. package/es/Slider/index.js +5 -8
  214. package/es/Slider/styles/index.js +3 -4
  215. package/es/Slider/utils.js +26 -30
  216. package/es/Spin/Multiple.js +153 -109
  217. package/es/Spin/Simple.js +33 -22
  218. package/es/Spin/Spin.js +29 -29
  219. package/es/Spin/index.js +66 -84
  220. package/es/Spin/styles/index.js +27 -30
  221. package/es/Sticky/context.js +12 -10
  222. package/es/Sticky/index.js +255 -194
  223. package/es/Sticky/styles/index.js +1 -1
  224. package/es/Switch/Switch.js +2 -3
  225. package/es/Switch/index.js +8 -14
  226. package/es/Table/Checkbox.js +68 -39
  227. package/es/Table/CheckboxAll.js +121 -64
  228. package/es/Table/Colgroup.js +72 -47
  229. package/es/Table/Expand.js +63 -43
  230. package/es/Table/SeperateTable.js +594 -444
  231. package/es/Table/SimpleTable.js +215 -136
  232. package/es/Table/Sorter.js +83 -62
  233. package/es/Table/Table.js +157 -157
  234. package/es/Table/Tbody.js +240 -176
  235. package/es/Table/Td.js +169 -130
  236. package/es/Table/Thead.js +206 -177
  237. package/es/Table/Tr.js +249 -205
  238. package/es/Table/TreeExpand.js +151 -116
  239. package/es/Table/context.js +15 -15
  240. package/es/Table/fixedAuto.js +82 -59
  241. package/es/Table/index.js +309 -228
  242. package/es/Table/resizable.js +89 -56
  243. package/es/Table/select.js +238 -215
  244. package/es/Table/styles/index.js +3 -4
  245. package/es/Tabs/Header.js +203 -160
  246. package/es/Tabs/Link.js +46 -28
  247. package/es/Tabs/Panel.js +49 -33
  248. package/es/Tabs/Tab.js +97 -79
  249. package/es/Tabs/Tabs.js +211 -177
  250. package/es/Tabs/Wrapper.js +37 -17
  251. package/es/Tabs/index.js +7 -10
  252. package/es/Tabs/styles/index.js +3 -4
  253. package/es/Tag/Input.js +70 -54
  254. package/es/Tag/Tag.js +198 -156
  255. package/es/Tag/index.js +5 -8
  256. package/es/Tag/styles/index.js +3 -4
  257. package/es/Textarea/Textarea.js +139 -118
  258. package/es/Textarea/index.js +10 -19
  259. package/es/Tooltip/Container.js +140 -127
  260. package/es/Tooltip/events.js +49 -55
  261. package/es/Tooltip/index.js +5 -8
  262. package/es/Tooltip/styles/index.js +3 -4
  263. package/es/Transfer/Card.js +212 -177
  264. package/es/Transfer/Transfer.js +160 -153
  265. package/es/Transfer/btns.js +97 -80
  266. package/es/Transfer/context.js +2 -3
  267. package/es/Transfer/filter.js +65 -35
  268. package/es/Transfer/index.js +9 -13
  269. package/es/Transfer/item.js +66 -41
  270. package/es/Transfer/select.js +15 -16
  271. package/es/Transfer/styles/index.js +3 -4
  272. package/es/Tree/Checkbox.js +72 -50
  273. package/es/Tree/Content.js +136 -95
  274. package/es/Tree/List.js +82 -53
  275. package/es/Tree/Node.js +237 -202
  276. package/es/Tree/Root.js +23 -19
  277. package/es/Tree/Tree.js +262 -197
  278. package/es/Tree/index.js +6 -9
  279. package/es/Tree/styles/index.js +3 -4
  280. package/es/Tree/toggle.js +89 -51
  281. package/es/TreeSelect/Input.js +73 -60
  282. package/es/TreeSelect/Result.js +213 -181
  283. package/es/TreeSelect/TreeSelect.js +327 -312
  284. package/es/TreeSelect/datum.js +56 -44
  285. package/es/TreeSelect/filter.js +134 -96
  286. package/es/TreeSelect/index.js +15 -23
  287. package/es/TreeSelect/styles/index.js +3 -4
  288. package/es/TreeSelect/tiled.js +143 -106
  289. package/es/Upload/Dragger.js +63 -39
  290. package/es/Upload/Drop.js +79 -57
  291. package/es/Upload/File.js +61 -48
  292. package/es/Upload/FileInput.js +53 -40
  293. package/es/Upload/Image.js +158 -115
  294. package/es/Upload/ImageFile.js +63 -43
  295. package/es/Upload/ImageResult.js +139 -114
  296. package/es/Upload/Progress.js +117 -105
  297. package/es/Upload/RemoveConfirm.js +58 -42
  298. package/es/Upload/Result.js +73 -58
  299. package/es/Upload/Upload.js +649 -490
  300. package/es/Upload/accept.js +33 -13
  301. package/es/Upload/context.js +12 -10
  302. package/es/Upload/index.js +16 -20
  303. package/es/Upload/request.js +48 -46
  304. package/es/Upload/styles/index.js +3 -4
  305. package/es/component.js +45 -24
  306. package/es/config.js +27 -19
  307. package/es/context/implementation.js +132 -94
  308. package/es/context/index.js +3 -4
  309. package/es/hoc/coin.js +118 -81
  310. package/es/hoc/config.js +31 -17
  311. package/es/hoc/delay.js +99 -55
  312. package/es/hoc/draggable.js +90 -80
  313. package/es/hoc/fetch.js +56 -33
  314. package/es/hoc/hidable.js +119 -98
  315. package/es/hoc/inputBorder.js +158 -158
  316. package/es/hoc/moveable.js +124 -96
  317. package/es/hoc/pagable.js +74 -55
  318. package/es/hoc/resizable.js +132 -100
  319. package/es/hoc/styles/index.js +7 -8
  320. package/es/hoc/trim.js +54 -32
  321. package/es/icons/Caret.js +14 -15
  322. package/es/icons/index.js +31 -85
  323. package/es/index.d.ts +1 -1
  324. package/es/index.js +58 -57
  325. package/es/locale/en_US.js +9 -30
  326. package/es/locale/index.js +13 -14
  327. package/es/locale/zh-CN.js +9 -17
  328. package/es/styles/expose.js +3 -4
  329. package/es/styles/index.js +1 -1
  330. package/es/utils/accept.js +15 -12
  331. package/es/utils/classname.js +23 -12
  332. package/es/utils/cleanProps.js +9 -21
  333. package/es/utils/clone.js +34 -27
  334. package/es/utils/color.js +310 -276
  335. package/es/utils/css-accessors.js +94 -45
  336. package/es/utils/dom/detect.js +29 -29
  337. package/es/utils/dom/document.js +23 -19
  338. package/es/utils/dom/element.js +139 -105
  339. package/es/utils/dom/getDataset.js +9 -9
  340. package/es/utils/dom/isDOMElement.js +3 -5
  341. package/es/utils/dom/normalizeWheel.js +32 -28
  342. package/es/utils/dom/popContainer.js +12 -13
  343. package/es/utils/dom/popover.js +79 -59
  344. package/es/utils/dom/ready.js +5 -6
  345. package/es/utils/dom/translate.js +10 -12
  346. package/es/utils/errors.js +47 -28
  347. package/es/utils/expose.js +97 -58
  348. package/es/utils/flat.js +122 -107
  349. package/es/utils/func.js +38 -20
  350. package/es/utils/hash.js +24 -20
  351. package/es/utils/index.js +24 -49
  352. package/es/utils/is.js +91 -70
  353. package/es/utils/lazyload.js +104 -86
  354. package/es/utils/notification.js +34 -20
  355. package/es/utils/numbers.js +61 -51
  356. package/es/utils/objects.js +221 -140
  357. package/es/utils/proptypes.js +21 -34
  358. package/es/utils/shallowEqual.js +46 -42
  359. package/es/utils/strings.js +50 -32
  360. package/es/utils/transform.js +24 -9
  361. package/es/utils/tree.js +78 -63
  362. package/es/utils/uid.js +14 -17
  363. package/es/utils/validate/index.js +71 -50
  364. package/es/utils/validate/isJson.js +7 -10
  365. package/es/utils/validate/nullable.js +10 -9
  366. package/es/utils/validate/range.js +22 -19
  367. package/es/utils/validate/rangeLength.js +19 -16
  368. package/es/utils/validate/regExp.js +10 -10
  369. package/es/utils/validate/required.js +11 -8
  370. package/es/utils/validate/type.js +56 -59
  371. package/es/utils/vars-inject.js +3420 -4248
  372. package/lib/DatePicker/utils.js +1 -1
  373. package/lib/Form/Field.js +8 -4
  374. package/lib/Form/Form.js +3 -0
  375. package/lib/Form/Item.js +1 -1
  376. package/lib/Form/index.d.ts +1 -0
  377. package/lib/Form/inputable.js +1 -1
  378. package/lib/Pagination/Jumper.js +3 -0
  379. package/lib/index.d.ts +1 -1
  380. package/lib/index.js +1 -1
  381. package/package.json +3 -2
@@ -1,148 +1,184 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
- import immer from 'immer'
4
- import { PureComponent } from '../component'
5
- import { getProps } from '../utils/proptypes'
6
- import { setTranslate } from '../utils/dom/translate'
7
- import { range, split } from '../utils/numbers'
8
- import { compareColumns } from '../utils/shallowEqual'
9
- import { getParent } from '../utils/dom/element'
10
- import { tableClass } from './styles'
11
- import Scroll from '../Scroll'
12
- import { BAR_WIDTH } from '../Scroll/Scroll'
13
- import Colgroup from './Colgroup'
14
- import Thead from './Thead'
15
- import Tbody from './Tbody'
16
- import { isNumber } from '../utils/is'
17
- import { Provider as AbsoluteProvider } from './context'
18
- import { CLASS_FIXED_LEFT, CLASS_FIXED_RIGHT } from './Td'
19
- import Sticky from '../Sticky'
20
-
21
- class SeperateTable extends PureComponent {
22
- constructor(props) {
23
- super(props)
24
- this.state = {
1
+ import _objectSpread from "@babel/runtime/helpers/objectSpread";
2
+ import _extends from "@babel/runtime/helpers/extends";
3
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
4
+ import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
5
+ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
6
+ import React from 'react';
7
+ import PropTypes from 'prop-types';
8
+ import immer from 'immer';
9
+ import { PureComponent } from '../component';
10
+ import { getProps } from '../utils/proptypes';
11
+ import { setTranslate } from '../utils/dom/translate';
12
+ import { range, split } from '../utils/numbers';
13
+ import { compareColumns } from '../utils/shallowEqual';
14
+ import { getParent } from '../utils/dom/element';
15
+ import { tableClass } from './styles';
16
+ import Scroll from '../Scroll';
17
+ import { BAR_WIDTH } from '../Scroll/Scroll';
18
+ import Colgroup from './Colgroup';
19
+ import Thead from './Thead';
20
+ import Tbody from './Tbody';
21
+ import { isNumber } from '../utils/is';
22
+ import { Provider as AbsoluteProvider } from './context';
23
+ import { CLASS_FIXED_LEFT, CLASS_FIXED_RIGHT } from './Td';
24
+ import Sticky from '../Sticky';
25
+
26
+ var SeperateTable =
27
+ /*#__PURE__*/
28
+ function (_PureComponent) {
29
+ _inheritsLoose(SeperateTable, _PureComponent);
30
+
31
+ function SeperateTable(props) {
32
+ var _this;
33
+
34
+ _this = _PureComponent.call(this, props) || this;
35
+ _this.state = {
25
36
  currentIndex: 0,
26
37
  scrollLeft: 0,
27
38
  scrollTop: 0,
28
39
  floatFixed: true,
29
- resize: false,
30
- }
31
-
32
- this.bindTbody = this.bindElement.bind(this, 'tbody')
33
- this.bindRealTbody = this.bindElement.bind(this, 'realTbody')
34
- this.bindThead = this.bindElement.bind(this, 'thead')
35
- this.bindHeadWrapper = this.bindElement.bind(this, 'headWrapper')
36
- this.setRowHeight = this.setRowHeight.bind(this)
37
- this.handleColgroup = this.handleColgroup.bind(this)
38
- this.handleScroll = this.handleScroll.bind(this)
39
- this.handleSortChange = this.handleSortChange.bind(this)
40
- this.scrollToTop = this.scrollToTop.bind(this)
41
-
42
- this.cachedRowHeight = []
43
- this.lastScrollArgs = {}
44
- this.lastScrollTop = 0
45
-
46
- if (props.tableRef) props.tableRef(this)
40
+ resize: false
41
+ };
42
+ _this.bindTbody = _this.bindElement.bind(_assertThisInitialized(_assertThisInitialized(_this)), 'tbody');
43
+ _this.bindRealTbody = _this.bindElement.bind(_assertThisInitialized(_assertThisInitialized(_this)), 'realTbody');
44
+ _this.bindThead = _this.bindElement.bind(_assertThisInitialized(_assertThisInitialized(_this)), 'thead');
45
+ _this.bindHeadWrapper = _this.bindElement.bind(_assertThisInitialized(_assertThisInitialized(_this)), 'headWrapper');
46
+ _this.setRowHeight = _this.setRowHeight.bind(_assertThisInitialized(_assertThisInitialized(_this)));
47
+ _this.handleColgroup = _this.handleColgroup.bind(_assertThisInitialized(_assertThisInitialized(_this)));
48
+ _this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_assertThisInitialized(_this)));
49
+ _this.handleSortChange = _this.handleSortChange.bind(_assertThisInitialized(_assertThisInitialized(_this)));
50
+ _this.scrollToTop = _this.scrollToTop.bind(_assertThisInitialized(_assertThisInitialized(_this)));
51
+ _this.cachedRowHeight = [];
52
+ _this.lastScrollArgs = {};
53
+ _this.lastScrollTop = 0;
54
+ if (props.tableRef) props.tableRef(_assertThisInitialized(_assertThisInitialized(_this)));
55
+ return _this;
47
56
  }
48
57
 
49
- componentDidMount() {
50
- super.componentDidMount()
51
- this.adjustScrollLeft()
52
- }
58
+ var _proto = SeperateTable.prototype;
59
+
60
+ _proto.componentDidMount = function componentDidMount() {
61
+ _PureComponent.prototype.componentDidMount.call(this);
62
+
63
+ this.adjustScrollLeft();
64
+ } // reset scrollTop when data changed
65
+ ;
66
+
67
+ _proto.componentDidUpdate = function componentDidUpdate(prevProps) {
68
+ if (!this.tbody) return;
69
+ var dataChange = this.props.data !== prevProps.data;
53
70
 
54
- // reset scrollTop when data changed
55
- componentDidUpdate(prevProps) {
56
- if (!this.tbody) return
57
- const dataChange = this.props.data !== prevProps.data
58
71
  if (dataChange) {
59
- const resize = prevProps.data.length === 0 && this.props.data.length
60
- if (resize || this.props.dataChangeResize) this.setState({ resize: true, colgroup: undefined })
61
- this.resetHeight()
72
+ var resize = prevProps.data.length === 0 && this.props.data.length;
73
+ if (resize || this.props.dataChangeResize) this.setState({
74
+ resize: true,
75
+ colgroup: undefined
76
+ });
77
+ this.resetHeight();
62
78
  }
63
- this.updateScrollLeft()
79
+
80
+ this.updateScrollLeft();
81
+
64
82
  if (!compareColumns(prevProps.columns, this.props.columns)) {
65
- this.resetWidth()
66
- this.setState({ colgroup: undefined })
83
+ this.resetWidth();
84
+ this.setState({
85
+ colgroup: undefined
86
+ });
67
87
  }
68
- this.ajustBottom(dataChange)
69
- }
70
-
71
- getIndex(scrollTop = this.state.scrollTop) {
72
- const { data, rowsInView } = this.props
73
- const max = data.length
74
- const mcf = scrollTop > 0.5 ? Math.ceil : Math.floor
75
- let index = mcf(scrollTop * max - rowsInView * scrollTop)
76
- if (index > max - rowsInView) index = max - rowsInView
77
- if (index < 0) index = 0
78
- return index
79
- }
80
88
 
81
- getContentHeight() {
82
- if (!this.props.data) return 0
83
- return this.getSumHeight(0, this.props.data.length)
84
- }
89
+ this.ajustBottom(dataChange);
90
+ };
85
91
 
86
- getContentWidth() {
87
- if (this.props.width) return this.props.width
88
- if (this.tbody) return this.tbody.offsetWidth
89
- return 0
90
- }
92
+ _proto.getIndex = function getIndex(scrollTop) {
93
+ if (scrollTop === void 0) {
94
+ scrollTop = this.state.scrollTop;
95
+ }
91
96
 
92
- getSumHeight(start, end) {
93
- const { rowHeight } = this.props
94
- let height = 0
95
- for (let i = start; i < end; i++) {
96
- height += this.cachedRowHeight[i] || rowHeight
97
+ var _this$props = this.props,
98
+ data = _this$props.data,
99
+ rowsInView = _this$props.rowsInView;
100
+ var max = data.length;
101
+ var mcf = scrollTop > 0.5 ? Math.ceil : Math.floor;
102
+ var index = mcf(scrollTop * max - rowsInView * scrollTop);
103
+ if (index > max - rowsInView) index = max - rowsInView;
104
+ if (index < 0) index = 0;
105
+ return index;
106
+ };
107
+
108
+ _proto.getContentHeight = function getContentHeight() {
109
+ if (!this.props.data) return 0;
110
+ return this.getSumHeight(0, this.props.data.length);
111
+ };
112
+
113
+ _proto.getContentWidth = function getContentWidth() {
114
+ if (this.props.width) return this.props.width;
115
+ if (this.tbody) return this.tbody.offsetWidth;
116
+ return 0;
117
+ };
118
+
119
+ _proto.getSumHeight = function getSumHeight(start, end) {
120
+ var rowHeight = this.props.rowHeight;
121
+ var height = 0;
122
+
123
+ for (var i = start; i < end; i++) {
124
+ height += this.cachedRowHeight[i] || rowHeight;
97
125
  }
98
- return height
99
- }
100
126
 
101
- getLastRowHeight(index) {
102
- const { rowHeight, data, rowsInView } = this.props
127
+ return height;
128
+ };
103
129
 
104
- if (index + rowsInView >= data.length) return 0
130
+ _proto.getLastRowHeight = function getLastRowHeight(index) {
131
+ var _this$props2 = this.props,
132
+ rowHeight = _this$props2.rowHeight,
133
+ data = _this$props2.data,
134
+ rowsInView = _this$props2.rowsInView;
135
+ if (index + rowsInView >= data.length) return 0;
136
+ var lastRowHeight = 0;
105
137
 
106
- let lastRowHeight = 0
107
138
  if (index >= 1 && index < data.length / 2) {
108
- lastRowHeight = this.cachedRowHeight[index - 1] || rowHeight
139
+ lastRowHeight = this.cachedRowHeight[index - 1] || rowHeight;
109
140
  }
110
- return lastRowHeight
111
- }
112
141
 
113
- setRowHeight(height, index, expand) {
114
- const oldHeight = this.cachedRowHeight[index]
115
- this.cachedRowHeight[index] = height
142
+ return lastRowHeight;
143
+ };
144
+
145
+ _proto.setRowHeight = function setRowHeight(height, index, expand) {
146
+ var oldHeight = this.cachedRowHeight[index];
147
+ this.cachedRowHeight[index] = height;
148
+
116
149
  if (!this.renderByExpand && expand) {
117
- this.renderByExpand = true
150
+ this.renderByExpand = true;
118
151
  }
119
- if (!this.tbody) return
120
152
 
121
- const { offsetLeft, currentIndex } = this.state
153
+ if (!this.tbody) return;
154
+ var _this$state = this.state,
155
+ offsetLeft = _this$state.offsetLeft,
156
+ currentIndex = _this$state.currentIndex;
157
+
122
158
  if (currentIndex === index && !oldHeight) {
123
- this.lastScrollTop += height - this.props.rowHeight
124
- setTranslate(this.tbody, `-${offsetLeft}px`, `-${this.lastScrollTop}px`)
159
+ this.lastScrollTop += height - this.props.rowHeight;
160
+ setTranslate(this.tbody, "-" + offsetLeft + "px", "-" + this.lastScrollTop + "px");
125
161
  }
126
162
 
127
- const contentHeight = this.getContentHeight()
163
+ var contentHeight = this.getContentHeight();
128
164
 
129
165
  if (oldHeight && height !== oldHeight) {
130
166
  if (this.lastScrollTop > contentHeight) {
131
- this.handleScroll(
132
- ...immer(this.lastScrollArgs, draft => {
133
- draft[7] = 1
134
- })
135
- )
136
- return
167
+ this.handleScroll.apply(this, immer(this.lastScrollArgs, function (draft) {
168
+ draft[7] = 1;
169
+ }));
170
+ return;
137
171
  }
138
172
 
139
- const scrollTop = this.lastScrollTop / contentHeight
140
- this.setState({ scrollTop })
173
+ var scrollTop = this.lastScrollTop / contentHeight;
174
+ this.setState({
175
+ scrollTop: scrollTop
176
+ });
177
+
141
178
  if (scrollTop === this.state.scrollTop) {
142
- this.forceUpdate()
179
+ this.forceUpdate();
143
180
  }
144
181
  }
145
-
146
182
  /**
147
183
  * if press and hold bar to scroll to the bottom, reset scroll
148
184
  */
@@ -155,444 +191,560 @@ class SeperateTable extends PureComponent {
155
191
  // )
156
192
  // })
157
193
  // }
158
- }
159
194
 
160
- checkScrollToIndex(index, outerHeight) {
161
- const { data, rowsInView } = this.props
162
- const max = data.length
195
+ };
196
+
197
+ _proto.checkScrollToIndex = function checkScrollToIndex(index, outerHeight) {
198
+ var _this$props3 = this.props,
199
+ data = _this$props3.data,
200
+ rowsInView = _this$props3.rowsInView;
201
+ var max = data.length;
202
+
163
203
  if (max - index >= rowsInView) {
164
- return index
204
+ return index;
165
205
  }
166
- const contentHeight = this.getSumHeight(index, max)
206
+
207
+ var contentHeight = this.getSumHeight(index, max);
208
+
167
209
  if (contentHeight >= outerHeight) {
168
- return index
210
+ return index;
169
211
  }
170
- return max
171
- }
172
212
 
173
- ajustBottom(dataChange) {
174
- const reachBottom = this.lastScrollArgs[1] === 1
175
- const drag = this.lastScrollArgs[8]
213
+ return max;
214
+ };
215
+
216
+ _proto.ajustBottom = function ajustBottom(dataChange) {
217
+ var _this2 = this;
218
+
219
+ var reachBottom = this.lastScrollArgs[1] === 1;
220
+ var drag = this.lastScrollArgs[8];
221
+
176
222
  if (!dataChange && reachBottom && drag) {
177
- if (this.ajustBottomScroll) return
178
- this.ajustBottomScroll = true
179
- setTimeout(() => {
180
- this.handleScroll(...this.lastScrollArgs)
181
- })
223
+ if (this.ajustBottomScroll) return;
224
+ this.ajustBottomScroll = true;
225
+ setTimeout(function () {
226
+ _this2.handleScroll.apply(_this2, _this2.lastScrollArgs);
227
+ });
182
228
  }
183
- }
229
+ };
230
+
231
+ _proto.updateScrollLeft = function updateScrollLeft() {
232
+ var scrollLeft = this.props.scrollLeft;
233
+ this.resetFloatFixed();
234
+ if (!isNumber(scrollLeft)) return;
235
+ var args = Array.isArray(this.lastScrollArgs) && this.lastScrollArgs.slice();
184
236
 
185
- updateScrollLeft() {
186
- let { scrollLeft } = this.props
187
- this.resetFloatFixed()
188
- if (!isNumber(scrollLeft)) return
189
- const args = Array.isArray(this.lastScrollArgs) && this.lastScrollArgs.slice()
190
237
  if (scrollLeft !== this.state.offsetLeft && args) {
191
- const bodyWidth = this.lastScrollArgs[4]
192
- if (scrollLeft < 0) scrollLeft = 0
193
- if (scrollLeft > this.getContentWidth() - bodyWidth) scrollLeft = this.getContentWidth() - bodyWidth
194
- args[0] = scrollLeft / (this.getContentWidth() - args[4])
195
- args[1] = this.state.scrollTop
196
- args[6] = 0
197
- args[7] = 0
198
- this.handleScroll(...args)
238
+ var bodyWidth = this.lastScrollArgs[4];
239
+ if (scrollLeft < 0) scrollLeft = 0;
240
+ if (scrollLeft > this.getContentWidth() - bodyWidth) scrollLeft = this.getContentWidth() - bodyWidth;
241
+ args[0] = scrollLeft / (this.getContentWidth() - args[4]);
242
+ args[1] = this.state.scrollTop;
243
+ args[6] = 0;
244
+ args[7] = 0;
245
+ this.handleScroll.apply(this, args);
199
246
  }
200
- }
247
+ };
248
+
249
+ _proto.adjustScrollLeft = function adjustScrollLeft() {
250
+ var scrollLeft = this.props.scrollLeft;
251
+ this.resetFloatFixed();
201
252
 
202
- adjustScrollLeft() {
203
- const { scrollLeft } = this.props
204
- this.resetFloatFixed()
205
253
  if (isNumber(scrollLeft) && scrollLeft > 0) {
206
- const v = this.headWrapper.clientWidth
207
- const offset = this.getContentWidth() - v
208
- this.setState({ scrollLeft: scrollLeft / offset, offsetLeft: scrollLeft })
254
+ var v = this.headWrapper.clientWidth;
255
+ var offset = this.getContentWidth() - v;
256
+ this.setState({
257
+ scrollLeft: scrollLeft / offset,
258
+ offsetLeft: scrollLeft
259
+ });
209
260
  }
210
- }
261
+ };
262
+
263
+ _proto.resetFloatFixed = function resetFloatFixed() {
264
+ if (!this.headWrapper || !this.tbody) return;
265
+ var fixed = this.props.fixed;
266
+ var delta = fixed === 'x' ? 0 : BAR_WIDTH;
267
+ var floatFixed = Math.abs(this.headWrapper.clientWidth - this.tbody.clientWidth) !== delta;
211
268
 
212
- resetFloatFixed() {
213
- if (!this.headWrapper || !this.tbody) return
214
- const { fixed } = this.props
215
- const delta = fixed === 'x' ? 0 : BAR_WIDTH
216
- const floatFixed = Math.abs(this.headWrapper.clientWidth - this.tbody.clientWidth) !== delta
217
269
  if (floatFixed !== this.state.floatFixed) {
218
- this.setState({ floatFixed })
270
+ this.setState({
271
+ floatFixed: floatFixed
272
+ });
219
273
  }
220
- }
274
+ };
275
+
276
+ _proto.resetIndex = function resetIndex() {
277
+ var currentIndex = this.state.currentIndex;
278
+ var max = this.props.data.length - this.props.rowsInView;
279
+ if (max < 0) max = 0;
280
+ if (max >= currentIndex) return currentIndex; // if data.length < currentIndex
281
+
282
+ return max;
283
+ };
284
+
285
+ _proto.resetHeight = function resetHeight() {
286
+ var _this3 = this;
287
+
288
+ var _this$state2 = this.state,
289
+ scrollTop = _this$state2.scrollTop,
290
+ offsetLeft = _this$state2.offsetLeft;
291
+ var _this$props4 = this.props,
292
+ treeColumnsName = _this$props4.treeColumnsName,
293
+ changedByExpand = _this$props4.changedByExpand;
294
+ var fullHeight = this.getContentHeight();
295
+ var height = fullHeight * scrollTop;
296
+ var scrollHeight = this.lastScrollArgs[5]; // Height reduced
221
297
 
222
- resetIndex() {
223
- const { currentIndex } = this.state
224
- let max = this.props.data.length - this.props.rowsInView
225
- if (max < 0) max = 0
226
- if (max >= currentIndex) return currentIndex
227
- // if data.length < currentIndex
228
- return max
229
- }
230
-
231
- resetHeight() {
232
- const { scrollTop, offsetLeft } = this.state
233
- const { treeColumnsName, changedByExpand } = this.props
234
- const fullHeight = this.getContentHeight()
235
- const height = fullHeight * scrollTop
236
-
237
- const scrollHeight = this.lastScrollArgs[5]
238
- // Height reduced
239
298
  if (this.lastScrollTop - height >= 1) {
240
- const index = this.resetIndex()
241
- this.setState({ currentIndex: index })
242
- if (this.renderByExpand) {
243
- this.renderByExpand = false
244
- return
245
- }
299
+ var index = this.resetIndex();
300
+ this.setState({
301
+ currentIndex: index
302
+ });
246
303
 
247
- // this.lastScrollTop = height
304
+ if (this.renderByExpand) {
305
+ this.renderByExpand = false;
306
+ return;
307
+ } // this.lastScrollTop = height
248
308
  // if (treeColumnsName && changedByExpand) {
249
309
  // this.tbody.style.marginTop = `${this.lastScrollTop - this.realOffset}px`
250
310
  // setTranslate(this.tbody, `-${offsetLeft}px`, `-${this.lastScrollTop}px`)
251
311
  // return
252
312
  // }
313
+
314
+
253
315
  if (treeColumnsName && changedByExpand) {
254
316
  if (fullHeight - this.lastScrollTop < (1 - this.lastScrollArgs[1]) * scrollHeight) {
255
- this.tbody.style.marginTop = `${scrollHeight}px`
256
- setTranslate(this.tbody, `-${offsetLeft}px`, `-${fullHeight}px`)
257
- this.lastScrollTop = fullHeight
317
+ this.tbody.style.marginTop = scrollHeight + "px";
318
+ setTranslate(this.tbody, "-" + offsetLeft + "px", "-" + fullHeight + "px");
319
+ this.lastScrollTop = fullHeight;
258
320
  }
259
- return
321
+
322
+ return;
260
323
  }
261
324
 
262
325
  if (index === 0) {
263
- this.lastScrollTop = 0
264
- setTimeout(() => {
265
- this.setState({ scrollTop: 0 })
266
- })
267
- this.tbody.style.marginTop = '0px'
268
- setTranslate(this.tbody, `-${offsetLeft}px`, '0px')
326
+ this.lastScrollTop = 0;
327
+ setTimeout(function () {
328
+ _this3.setState({
329
+ scrollTop: 0
330
+ });
331
+ });
332
+ this.tbody.style.marginTop = '0px';
333
+ setTranslate(this.tbody, "-" + offsetLeft + "px", '0px');
269
334
  } else if (fullHeight - this.lastScrollTop < (1 - this.lastScrollArgs[1]) * scrollHeight) {
270
- this.tbody.style.marginTop = `${scrollHeight}px`
271
- setTranslate(this.tbody, `-${offsetLeft}px`, `-${fullHeight}px`)
272
- this.lastScrollTop = fullHeight
273
- setTimeout(() => {
274
- this.setState({ scrollTop: 1 })
275
- })
335
+ this.tbody.style.marginTop = scrollHeight + "px";
336
+ setTranslate(this.tbody, "-" + offsetLeft + "px", "-" + fullHeight + "px");
337
+ this.lastScrollTop = fullHeight;
338
+ setTimeout(function () {
339
+ _this3.setState({
340
+ scrollTop: 1
341
+ });
342
+ });
276
343
  } else {
277
- const keepTop = this.lastScrollTop - this.lastScrollArgs[1] * scrollHeight
278
- // keepTop = scrollTopLength - scrollTopLength/fullHeight * scrollHeight
344
+ var keepTop = this.lastScrollTop - this.lastScrollArgs[1] * scrollHeight; // keepTop = scrollTopLength - scrollTopLength/fullHeight * scrollHeight
279
345
  // keepTop = (1 - scrollHeight / fullHeight) * scrollTopLength
280
- const scrollTopLength = keepTop / (1 - scrollHeight / fullHeight)
281
- this.lastScrollTop = scrollTopLength
282
- const st = this.lastScrollTop / fullHeight
283
- this.tbody.style.marginTop = `${st * scrollHeight}px`
284
- setTranslate(this.tbody, `-${offsetLeft}px`, `-${this.lastScrollTop}px`)
285
- setTimeout(() => {
286
- this.setState({ scrollTop: st })
287
- })
346
+
347
+ var scrollTopLength = keepTop / (1 - scrollHeight / fullHeight);
348
+ this.lastScrollTop = scrollTopLength;
349
+ var st = this.lastScrollTop / fullHeight;
350
+ this.tbody.style.marginTop = st * scrollHeight + "px";
351
+ setTranslate(this.tbody, "-" + offsetLeft + "px", "-" + this.lastScrollTop + "px");
352
+ setTimeout(function () {
353
+ _this3.setState({
354
+ scrollTop: st
355
+ });
356
+ });
288
357
  }
289
358
  } else if (this.lastScrollTop - height < 1) {
290
- setTimeout(() => {
291
- this.setState({ scrollTop: this.lastScrollTop / fullHeight })
292
- })
359
+ setTimeout(function () {
360
+ _this3.setState({
361
+ scrollTop: _this3.lastScrollTop / fullHeight
362
+ });
363
+ });
293
364
  }
294
- }
365
+ };
366
+
367
+ _proto.resetWidth = function resetWidth(left, right) {
368
+ if (left === void 0) {
369
+ left = this.lastResetLeft || 0;
370
+ }
371
+
372
+ if (right === void 0) {
373
+ right = this.lastResetRight || 0;
374
+ }
375
+
376
+ this.lastResetLeft = left;
377
+ this.lastResetRight = right;
378
+ setTranslate(this.tbody, "-" + left + "px", "-" + this.lastScrollTop + "px");
295
379
 
296
- resetWidth(left = this.lastResetLeft || 0, right = this.lastResetRight || 0) {
297
- this.lastResetLeft = left
298
- this.lastResetRight = right
299
- setTranslate(this.tbody, `-${left}px`, `-${this.lastScrollTop}px`)
300
380
  if (this.thead) {
301
- setTranslate(this.thead, `-${left}px`, '0')
381
+ setTranslate(this.thead, "-" + left + "px", '0');
302
382
  }
303
383
 
304
- ;[this.thead, this.tbody].forEach(el => {
305
- if (!el) return
306
- ;[].forEach.call(el.parentNode.querySelectorAll('td, th'), cell => {
384
+ ;
385
+ [this.thead, this.tbody].forEach(function (el) {
386
+ if (!el) return;
387
+ [].forEach.call(el.parentNode.querySelectorAll('td, th'), function (cell) {
307
388
  if (cell.classList.contains(tableClass(CLASS_FIXED_LEFT))) {
308
- setTranslate(cell, `${left}px`, '0')
389
+ setTranslate(cell, left + "px", '0');
309
390
  } else if (cell.classList.contains(tableClass(CLASS_FIXED_RIGHT))) {
310
- setTranslate(cell, `-${right}px`, '0')
391
+ setTranslate(cell, "-" + right + "px", '0');
311
392
  } else if (cell.style.transform) {
312
- setTranslate(cell, '0', '0')
393
+ setTranslate(cell, '0', '0');
313
394
  }
314
- })
315
- })
316
- }
317
-
318
- bindElement(key, el) {
319
- this[key] = el
320
- }
321
-
322
- scrollToTop() {
323
- this.scrollToIndex(0)
324
- }
325
-
326
- scrollToIndex(index, callback) {
327
- if (!this.$isMounted) return
328
- if (index >= 1) index -= 1
329
- if (index < 0) index = 0
330
- const contentHeight = this.getContentHeight()
331
- const outerHeight = getParent(this.realTbody, `.${tableClass('body')}`).clientHeight - 12
332
- let currentIndex = this.checkScrollToIndex(index, outerHeight)
333
- const sumHeight = this.getSumHeight(0, currentIndex)
334
- let scrollTop = sumHeight / contentHeight
335
- let marginTop = scrollTop * outerHeight
336
- let offsetScrollTop = sumHeight + marginTop
395
+ });
396
+ });
397
+ };
398
+
399
+ _proto.bindElement = function bindElement(key, el) {
400
+ this[key] = el;
401
+ };
402
+
403
+ _proto.scrollToTop = function scrollToTop() {
404
+ this.scrollToIndex(0);
405
+ };
406
+
407
+ _proto.scrollToIndex = function scrollToIndex(index, callback) {
408
+ if (!this.$isMounted) return;
409
+ if (index >= 1) index -= 1;
410
+ if (index < 0) index = 0;
411
+ var contentHeight = this.getContentHeight();
412
+ var outerHeight = getParent(this.realTbody, "." + tableClass('body')).clientHeight - 12;
413
+ var currentIndex = this.checkScrollToIndex(index, outerHeight);
414
+ var sumHeight = this.getSumHeight(0, currentIndex);
415
+ var scrollTop = sumHeight / contentHeight;
416
+ var marginTop = scrollTop * outerHeight;
417
+ var offsetScrollTop = sumHeight + marginTop;
337
418
 
338
419
  if (offsetScrollTop > contentHeight) {
339
- offsetScrollTop = contentHeight
340
- currentIndex = this.props.data.length - this.props.rowsInView
341
- scrollTop = 1
342
- marginTop = outerHeight
420
+ offsetScrollTop = contentHeight;
421
+ currentIndex = this.props.data.length - this.props.rowsInView;
422
+ scrollTop = 1;
423
+ marginTop = outerHeight;
343
424
  }
344
425
 
345
- this.lastScrollArgs[1] = scrollTop
426
+ this.lastScrollArgs[1] = scrollTop;
427
+ this.setState({
428
+ currentIndex: currentIndex,
429
+ scrollTop: scrollTop
430
+ }, callback);
431
+ this.lastScrollTop = offsetScrollTop;
432
+ this.tbody.style.marginTop = marginTop + "px";
433
+ setTranslate(this.tbody, "-" + this.state.offsetLeft + "px", "-" + offsetScrollTop + "px");
434
+ } // business component needed
435
+ ;
436
+
437
+ _proto.scrollOffset = function scrollOffset(index, callback) {
438
+ var currentIndex = this.state.currentIndex;
439
+ var outerHeight = getParent(this.realTbody, "." + tableClass('body')).clientHeight - 12;
440
+ var lastRowHeight = this.cachedRowHeight[this.cachedRowHeight.length - 1];
441
+ if (this.state.scrollTop === 1 && index >= 0) return;
442
+ if (lastRowHeight && this.realTbody.clientHeight - outerHeight < lastRowHeight && index >= 0) return;
443
+ var scrollIndex = currentIndex + index + 1;
346
444
 
347
- this.setState({ currentIndex, scrollTop }, callback)
348
- this.lastScrollTop = offsetScrollTop
445
+ if (currentIndex === 1 && index === -1) {
446
+ scrollIndex = 0;
447
+ }
349
448
 
350
- this.tbody.style.marginTop = `${marginTop}px`
449
+ this.scrollToIndex(scrollIndex, callback);
450
+ };
351
451
 
352
- setTranslate(this.tbody, `-${this.state.offsetLeft}px`, `-${offsetScrollTop}px`)
353
- }
452
+ _proto.handleScroll = function handleScroll() {
453
+ if (!this.tbody || this.realTbody.clientHeight === 0) return;
354
454
 
355
- // business component needed
356
- scrollOffset(index, callback) {
357
- const { currentIndex } = this.state
358
- const outerHeight = getParent(this.realTbody, `.${tableClass('body')}`).clientHeight - 12
359
- const lastRowHeight = this.cachedRowHeight[this.cachedRowHeight.length - 1]
360
- if (this.state.scrollTop === 1 && index >= 0) return
361
- if (lastRowHeight && this.realTbody.clientHeight - outerHeight < lastRowHeight && index >= 0) return
362
- let scrollIndex = currentIndex + index + 1
363
- if (currentIndex === 1 && index === -1) {
364
- scrollIndex = 0
455
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
456
+ args[_key] = arguments[_key];
365
457
  }
366
458
 
367
- this.scrollToIndex(scrollIndex, callback)
368
- }
459
+ var x = args[0],
460
+ y = args[1],
461
+ max = args[2],
462
+ bar = args[3],
463
+ v = args[4],
464
+ h = args[5],
465
+ pixelX = args[6],
466
+ pixelY = args[7];
467
+ var colgroup = this.state.colgroup;
468
+ var isResize = v && this.lastScrollArgs[4] && v !== this.lastScrollArgs[4];
469
+ this.lastScrollArgs = args;
369
470
 
370
- handleScroll(...args) {
371
- if (!this.tbody || this.realTbody.clientHeight === 0) return
372
- const [x, y, max, bar, v, h, pixelX, pixelY] = args
373
- const { colgroup } = this.state
374
- const isResize = v && this.lastScrollArgs[4] && v !== this.lastScrollArgs[4]
375
- this.lastScrollArgs = args
376
471
  if (this.ajustBottomScroll) {
377
- this.lastScrollArgs[8] = false
378
- this.ajustBottomScroll = false
472
+ this.lastScrollArgs[8] = false;
473
+ this.ajustBottomScroll = false;
379
474
  }
380
- const { data, rowHeight, rowsInView } = this.props
381
- const contentWidth = this.getContentWidth()
382
- const contentHeight = this.getContentHeight()
383
- let left = x * (contentWidth - v)
384
- let scrollTop = h > contentHeight ? 0 : y
385
- let right = max - left
386
- if (right < 0) right = 0
387
475
 
476
+ var _this$props5 = this.props,
477
+ data = _this$props5.data,
478
+ rowHeight = _this$props5.rowHeight,
479
+ rowsInView = _this$props5.rowsInView;
480
+ var contentWidth = this.getContentWidth();
481
+ var contentHeight = this.getContentHeight();
482
+ var left = x * (contentWidth - v);
483
+ var scrollTop = h > contentHeight ? 0 : y;
484
+ var right = max - left;
485
+ if (right < 0) right = 0;
388
486
  /* set x */
389
- if (left < 0) left = 0
390
- this.resetWidth(left, right)
487
+
488
+ if (left < 0) left = 0;
489
+ this.resetWidth(left, right);
391
490
  /* set x end */
392
491
 
393
492
  /* set y */
394
- this.tbody.style.marginTop = `${scrollTop * h}px`
493
+
494
+ this.tbody.style.marginTop = scrollTop * h + "px";
395
495
 
396
496
  if (pixelY === undefined) {
397
497
  // drag scroll bar
398
-
399
- const index = this.getIndex(scrollTop)
400
- const lastRowHeight = this.getLastRowHeight(index)
401
- const offsetScrollTop = this.getSumHeight(0, index) + scrollTop * this.realTbody.clientHeight
402
-
403
- this.setState({ currentIndex: index })
404
- this.lastScrollTop = offsetScrollTop
405
- setTranslate(this.tbody, `-${left}px`, `-${offsetScrollTop + lastRowHeight}px`)
498
+ var index = this.getIndex(scrollTop);
499
+ var lastRowHeight = this.getLastRowHeight(index);
500
+ var offsetScrollTop = this.getSumHeight(0, index) + scrollTop * this.realTbody.clientHeight;
501
+ this.setState({
502
+ currentIndex: index
503
+ });
504
+ this.lastScrollTop = offsetScrollTop;
505
+ setTranslate(this.tbody, "-" + left + "px", "-" + (offsetScrollTop + lastRowHeight) + "px");
406
506
  } else if (pixelY === 0) {
407
507
  // whell x
408
- setTranslate(this.tbody, `-${left}px`, `-${this.lastScrollTop}px`)
508
+ setTranslate(this.tbody, "-" + left + "px", "-" + this.lastScrollTop + "px");
409
509
  } else if (contentHeight < h) {
410
- this.lastScrollTop = 0
411
- scrollTop = 0
412
- setTranslate(this.tbody, `-${left}px`, '0px')
413
- this.setState({ currentIndex: 0 })
510
+ this.lastScrollTop = 0;
511
+ scrollTop = 0;
512
+ setTranslate(this.tbody, "-" + left + "px", '0px');
513
+ this.setState({
514
+ currentIndex: 0
515
+ });
414
516
  } else {
415
517
  // wheel scroll
518
+ this.lastScrollTop += pixelY;
519
+ if (this.lastScrollTop < 0) this.lastScrollTop = 0; // scroll over bottom
416
520
 
417
- this.lastScrollTop += pixelY
418
- if (this.lastScrollTop < 0) this.lastScrollTop = 0
419
-
420
- // scroll over bottom
421
- if (this.lastScrollTop > contentHeight) this.lastScrollTop = contentHeight
521
+ if (this.lastScrollTop > contentHeight) this.lastScrollTop = contentHeight;
522
+ var temp = this.lastScrollTop - scrollTop * h;
523
+ var _index = 0;
422
524
 
423
- let temp = this.lastScrollTop - scrollTop * h
424
- let index = 0
425
525
  while (temp > 0) {
426
- temp -= this.cachedRowHeight[index] || rowHeight
427
- index += 1
428
- }
429
-
430
- // offset last row
431
- index -= 1
432
-
433
- if (data.length - rowsInView < index) index = data.length - rowsInView
434
- if (index < 0) index = 0
435
-
436
- this.setState({ currentIndex: index })
437
-
438
- scrollTop = this.lastScrollTop / contentHeight
439
- setTranslate(this.tbody, `-${left}px`, `-${this.lastScrollTop}px`)
526
+ temp -= this.cachedRowHeight[_index] || rowHeight;
527
+ _index += 1;
528
+ } // offset last row
529
+
530
+
531
+ _index -= 1;
532
+ if (data.length - rowsInView < _index) _index = data.length - rowsInView;
533
+ if (_index < 0) _index = 0;
534
+ this.setState({
535
+ currentIndex: _index
536
+ });
537
+ scrollTop = this.lastScrollTop / contentHeight;
538
+ setTranslate(this.tbody, "-" + left + "px", "-" + this.lastScrollTop + "px");
440
539
  }
441
540
  /* set y end */
442
541
 
542
+
443
543
  this.setState({
444
544
  scrollLeft: x,
445
- scrollTop,
545
+ scrollTop: scrollTop,
446
546
  offsetLeft: left,
447
547
  offsetRight: right,
448
548
  colgroup: isResize ? undefined : colgroup,
449
- resize: isResize ? v : false,
450
- })
549
+ resize: isResize ? v : false
550
+ });
551
+ if (this.props.onScroll) this.props.onScroll(x, y, left);
552
+ };
451
553
 
452
- if (this.props.onScroll) this.props.onScroll(x, y, left)
453
- }
554
+ _proto.handleSortChange = function handleSortChange() {
555
+ var _this$props6;
454
556
 
455
- handleSortChange(...args) {
456
- this.scrollToIndex(0)
457
- this.props.onSortChange(...args)
458
- }
557
+ this.scrollToIndex(0);
558
+
559
+ (_this$props6 = this.props).onSortChange.apply(_this$props6, arguments);
560
+ };
561
+
562
+ _proto.handleColgroup = function handleColgroup(tds) {
563
+ var columns = this.props.columns;
564
+ var colgroup = [];
565
+
566
+ var _loop = function _loop(i, count) {
567
+ var _tds$i$getBoundingCli = tds[i].getBoundingClientRect(),
568
+ width = _tds$i$getBoundingCli.width;
569
+
570
+ var colSpan = parseInt(tds[i].getAttribute('colspan'), 10);
459
571
 
460
- handleColgroup(tds) {
461
- const { columns } = this.props
462
- const colgroup = []
463
- for (let i = 0, count = tds.length; i < count; i++) {
464
- const { width } = tds[i].getBoundingClientRect()
465
- const colSpan = parseInt(tds[i].getAttribute('colspan'), 10)
466
572
  if (colSpan > 1) {
467
- split(width, range(colSpan).map(j => columns[i + j].width)).forEach(w => colgroup.push(w))
573
+ split(width, range(colSpan).map(function (j) {
574
+ return columns[i + j].width;
575
+ })).forEach(function (w) {
576
+ return colgroup.push(w);
577
+ });
468
578
  } else {
469
- colgroup.push(width)
579
+ colgroup.push(width);
470
580
  }
581
+ };
582
+
583
+ for (var i = 0, count = tds.length; i < count; i++) {
584
+ _loop(i, count);
471
585
  }
472
- this.setState({ colgroup, resize: false })
473
- }
474
586
 
475
- renderBody(floatClass) {
476
- const {
477
- data,
478
- rowsInView,
479
- columns,
480
- width,
481
- fixed,
482
- rowHeight,
483
- columnResizable,
484
- innerScrollAttr,
485
- ...others
486
- } = this.props
487
- const { colgroup, scrollTop, scrollLeft, offsetLeft, offsetRight, currentIndex, resize } = this.state
488
- const contentWidth = this.getContentWidth()
489
- const minWidthSup = columns.find(d => d.minWidth)
587
+ this.setState({
588
+ colgroup: colgroup,
589
+ resize: false
590
+ });
591
+ };
592
+
593
+ _proto.renderBody = function renderBody(floatClass) {
594
+ var _this$props7 = this.props,
595
+ data = _this$props7.data,
596
+ rowsInView = _this$props7.rowsInView,
597
+ columns = _this$props7.columns,
598
+ width = _this$props7.width,
599
+ fixed = _this$props7.fixed,
600
+ rowHeight = _this$props7.rowHeight,
601
+ columnResizable = _this$props7.columnResizable,
602
+ innerScrollAttr = _this$props7.innerScrollAttr,
603
+ others = _objectWithoutPropertiesLoose(_this$props7, ["data", "rowsInView", "columns", "width", "fixed", "rowHeight", "columnResizable", "innerScrollAttr"]);
604
+
605
+ var _this$state3 = this.state,
606
+ colgroup = _this$state3.colgroup,
607
+ scrollTop = _this$state3.scrollTop,
608
+ scrollLeft = _this$state3.scrollLeft,
609
+ offsetLeft = _this$state3.offsetLeft,
610
+ offsetRight = _this$state3.offsetRight,
611
+ currentIndex = _this$state3.currentIndex,
612
+ resize = _this$state3.resize;
613
+ var contentWidth = this.getContentWidth();
614
+ var minWidthSup = columns.find(function (d) {
615
+ return d.minWidth;
616
+ });
490
617
 
491
618
  if (!data || data.length === 0) {
492
- return <div />
619
+ return React.createElement("div", null);
493
620
  }
494
621
 
495
- let dataUpdated = this.lastData !== data // Incorrect height due to changing data length dynamically
496
- if (this.lastData && !dataUpdated) dataUpdated = this.lastData.length !== data.length
497
- this.lastData = data
498
-
499
- if (!dataUpdated && this.lastColumns && !compareColumns(this.lastColumns, columns)) dataUpdated = true
500
- this.lastColumns = columns
501
- const prevHeight = this.getSumHeight(0, currentIndex)
502
- const hasNotRenderRows = data.length > rowsInView
503
-
504
- return (
505
- <Scroll
506
- scrollTop={scrollTop}
507
- scrollLeft={scrollLeft}
508
- scroll={fixed}
509
- scrollHeight={this.getContentHeight()}
510
- scrollWidth={contentWidth}
511
- onScroll={this.handleScroll}
512
- className={tableClass('body', ...floatClass)}
513
- innerScrollAttr={innerScrollAttr}
514
- >
515
- <div ref={this.bindTbody} className={tableClass('scroll-inner')} style={{ width }}>
516
- <div style={{ height: prevHeight }} />
517
- <table className={tableClass(!colgroup && minWidthSup && 'init')} style={{ width }} ref={this.bindRealTbody}>
518
- <Colgroup colgroup={colgroup} columns={columns} resizable={columnResizable && this.lastScrollArgs[4]} />
519
- <Tbody
520
- {...others}
521
- columns={columns}
522
- onBodyRender={this.handleColgroup}
523
- index={currentIndex}
524
- offsetLeft={offsetLeft}
525
- offsetRight={offsetRight}
526
- data={data.slice(currentIndex, currentIndex + rowsInView)}
527
- setRowHeight={this.setRowHeight}
528
- hasNotRenderRows={hasNotRenderRows}
529
- dataUpdated={dataUpdated}
530
- resize={resize}
531
- colgroup={colgroup}
532
- onScrollTop={this.scrollToTop}
533
- columnResizable={columnResizable}
534
- />
535
- </table>
536
- </div>
537
- </Scroll>
538
- )
539
- }
540
-
541
- renderHeader(floatClass) {
542
- const { columns, width, onResize, columnResizable, sticky } = this.props
543
- const { colgroup } = this.state
544
-
545
- const header = (
546
- <div key="head" className={tableClass('head', ...floatClass)} ref={this.bindHeadWrapper}>
547
- <table style={{ width }} ref={this.bindThead}>
548
- <Colgroup colgroup={colgroup} columns={columns} resizable={columnResizable && this.lastScrollArgs[4]} />
549
- <Thead {...this.props} colgroup={colgroup} onSortChange={this.handleSortChange} onColChange={onResize} />
550
- </table>
551
- </div>
552
- )
622
+ var dataUpdated = this.lastData !== data; // Incorrect height due to changing data length dynamically
623
+
624
+ if (this.lastData && !dataUpdated) dataUpdated = this.lastData.length !== data.length;
625
+ this.lastData = data;
626
+ if (!dataUpdated && this.lastColumns && !compareColumns(this.lastColumns, columns)) dataUpdated = true;
627
+ this.lastColumns = columns;
628
+ var prevHeight = this.getSumHeight(0, currentIndex);
629
+ var hasNotRenderRows = data.length > rowsInView;
630
+ return React.createElement(Scroll, {
631
+ scrollTop: scrollTop,
632
+ scrollLeft: scrollLeft,
633
+ scroll: fixed,
634
+ scrollHeight: this.getContentHeight(),
635
+ scrollWidth: contentWidth,
636
+ onScroll: this.handleScroll,
637
+ className: tableClass.apply(void 0, ['body'].concat(floatClass)),
638
+ innerScrollAttr: innerScrollAttr
639
+ }, React.createElement("div", {
640
+ ref: this.bindTbody,
641
+ className: tableClass('scroll-inner'),
642
+ style: {
643
+ width: width
644
+ }
645
+ }, React.createElement("div", {
646
+ style: {
647
+ height: prevHeight
648
+ }
649
+ }), React.createElement("table", {
650
+ className: tableClass(!colgroup && minWidthSup && 'init'),
651
+ style: {
652
+ width: width
653
+ },
654
+ ref: this.bindRealTbody
655
+ }, React.createElement(Colgroup, {
656
+ colgroup: colgroup,
657
+ columns: columns,
658
+ resizable: columnResizable && this.lastScrollArgs[4]
659
+ }), React.createElement(Tbody, _extends({}, others, {
660
+ columns: columns,
661
+ onBodyRender: this.handleColgroup,
662
+ index: currentIndex,
663
+ offsetLeft: offsetLeft,
664
+ offsetRight: offsetRight,
665
+ data: data.slice(currentIndex, currentIndex + rowsInView),
666
+ setRowHeight: this.setRowHeight,
667
+ hasNotRenderRows: hasNotRenderRows,
668
+ dataUpdated: dataUpdated,
669
+ resize: resize,
670
+ colgroup: colgroup,
671
+ onScrollTop: this.scrollToTop,
672
+ columnResizable: columnResizable
673
+ })))));
674
+ };
675
+
676
+ _proto.renderHeader = function renderHeader(floatClass) {
677
+ var _this$props8 = this.props,
678
+ columns = _this$props8.columns,
679
+ width = _this$props8.width,
680
+ onResize = _this$props8.onResize,
681
+ columnResizable = _this$props8.columnResizable,
682
+ sticky = _this$props8.sticky;
683
+ var colgroup = this.state.colgroup;
684
+ var header = React.createElement("div", {
685
+ key: "head",
686
+ className: tableClass.apply(void 0, ['head'].concat(floatClass)),
687
+ ref: this.bindHeadWrapper
688
+ }, React.createElement("table", {
689
+ style: {
690
+ width: width
691
+ },
692
+ ref: this.bindThead
693
+ }, React.createElement(Colgroup, {
694
+ colgroup: colgroup,
695
+ columns: columns,
696
+ resizable: columnResizable && this.lastScrollArgs[4]
697
+ }), React.createElement(Thead, _extends({}, this.props, {
698
+ colgroup: colgroup,
699
+ onSortChange: this.handleSortChange,
700
+ onColChange: onResize
701
+ }))));
553
702
 
554
703
  if (sticky) {
555
- const stickyProps = Object.assign({ top: 0 }, sticky)
556
- return (
557
- <Sticky {...stickyProps} key="head">
558
- {header}
559
- </Sticky>
560
- )
704
+ var stickyProps = Object.assign({
705
+ top: 0
706
+ }, sticky);
707
+ return React.createElement(Sticky, _extends({}, stickyProps, {
708
+ key: "head"
709
+ }), header);
561
710
  }
562
711
 
563
- return header
564
- }
565
-
566
- render() {
567
- const { fixed, hideHeader } = this.props
568
- const { scrollLeft, floatFixed } = this.state
712
+ return header;
713
+ };
569
714
 
570
- const floatClass = []
715
+ _proto.render = function render() {
716
+ var _this$props9 = this.props,
717
+ fixed = _this$props9.fixed,
718
+ hideHeader = _this$props9.hideHeader;
719
+ var _this$state4 = this.state,
720
+ scrollLeft = _this$state4.scrollLeft,
721
+ floatFixed = _this$state4.floatFixed;
722
+ var floatClass = [];
571
723
 
572
724
  if (floatFixed) {
573
725
  if (scrollLeft > 0) {
574
- floatClass.push('float-left')
726
+ floatClass.push('float-left');
575
727
  }
728
+
576
729
  if (scrollLeft !== 1) {
577
- floatClass.push('float-right')
730
+ floatClass.push('float-right');
578
731
  }
579
732
  }
580
733
 
581
734
  if (fixed === 'y' || fixed === 'both') {
582
- floatClass.push('scroll-y')
735
+ floatClass.push('scroll-y');
583
736
  }
584
737
 
585
- return [
586
- hideHeader ? null : this.renderHeader(floatClass),
587
- <AbsoluteProvider value key="body">
588
- {this.renderBody(floatClass)}
589
- </AbsoluteProvider>,
590
- ]
591
- }
592
- }
738
+ return [hideHeader ? null : this.renderHeader(floatClass), React.createElement(AbsoluteProvider, {
739
+ value: true,
740
+ key: "body"
741
+ }, this.renderBody(floatClass))];
742
+ };
593
743
 
594
- SeperateTable.propTypes = {
595
- ...getProps(PropTypes, 'size', 'type', 'kengen'),
744
+ return SeperateTable;
745
+ }(PureComponent);
746
+
747
+ SeperateTable.propTypes = _objectSpread({}, getProps(PropTypes, 'size', 'type', 'kengen'), {
596
748
  columns: PropTypes.array.isRequired,
597
749
  data: PropTypes.array,
598
750
  fixed: PropTypes.string.isRequired,
@@ -605,13 +757,11 @@ SeperateTable.propTypes = {
605
757
  onResize: PropTypes.func,
606
758
  innerScrollAttr: PropTypes.arrayOf(PropTypes.string),
607
759
  sticky: PropTypes.oneOfType([PropTypes.object, PropTypes.bool]),
608
- hideHeader: PropTypes.bool,
609
- }
610
-
760
+ hideHeader: PropTypes.bool
761
+ });
611
762
  SeperateTable.defaultProps = {
612
763
  data: undefined,
613
764
  rowHeight: 40,
614
- width: undefined,
615
- }
616
-
617
- export default SeperateTable
765
+ width: undefined
766
+ };
767
+ export default SeperateTable;