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.
- package/css/DatePicker/utils.js +1 -1
- package/css/Form/Field.js +8 -4
- package/css/Form/Form.js +3 -0
- package/css/Form/Item.js +1 -1
- package/css/Form/index.d.ts +1 -0
- package/css/Form/inputable.js +1 -1
- package/css/Pagination/Jumper.js +3 -0
- package/css/index.d.ts +1 -1
- package/css/index.js +1 -1
- package/dist/shineout.js +24 -14
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/es/Alert/index.js +127 -107
- package/es/Alert/styles/index.js +3 -4
- package/es/AnimationList/AbsoluteList.js +257 -193
- package/es/AnimationList/LazyList.js +120 -92
- package/es/AnimationList/List.js +43 -23
- package/es/AnimationList/index.js +19 -14
- package/es/AnimationList/styles/index.js +3 -4
- package/es/Breadcrumb/index.js +77 -69
- package/es/Breadcrumb/styles/index.js +3 -4
- package/es/Button/Button.js +91 -74
- package/es/Button/Group.js +42 -28
- package/es/Button/Once.js +39 -23
- package/es/Button/index.js +7 -10
- package/es/Button/styles/index.js +3 -4
- package/es/Card/Accordion.js +58 -45
- package/es/Card/Body.js +55 -42
- package/es/Card/Card.js +85 -79
- package/es/Card/Footer.js +38 -15
- package/es/Card/Header.js +52 -34
- package/es/Card/Submit.js +51 -33
- package/es/Card/context.js +22 -16
- package/es/Card/index.js +16 -19
- package/es/Card/styles/index.js +3 -4
- package/es/CardGroup/CardGroup.js +93 -69
- package/es/CardGroup/Item.js +61 -43
- package/es/CardGroup/context.js +12 -10
- package/es/CardGroup/index.js +7 -10
- package/es/CardGroup/styles/index.js +3 -4
- package/es/Carousel/Item.js +31 -17
- package/es/Carousel/index.js +156 -123
- package/es/Carousel/styles/index.js +3 -4
- package/es/Cascader/Cascader.js +397 -346
- package/es/Cascader/FilterList.js +185 -142
- package/es/Cascader/Input.js +102 -79
- package/es/Cascader/List.js +66 -41
- package/es/Cascader/Node.js +153 -110
- package/es/Cascader/Result.js +289 -232
- package/es/Cascader/filter.js +92 -61
- package/es/Cascader/index.js +13 -18
- package/es/Cascader/styles/index.js +3 -4
- package/es/Checkbox/CheckItem.js +168 -154
- package/es/Checkbox/Checkbox.js +2 -3
- package/es/Checkbox/Group.js +106 -85
- package/es/Checkbox/context.js +12 -10
- package/es/Checkbox/index.js +14 -21
- package/es/Checkbox/styles/index.js +3 -4
- package/es/DataList/BaseItem.js +39 -21
- package/es/DataList/Extra.js +33 -17
- package/es/DataList/List.js +166 -140
- package/es/DataList/Meta.js +109 -74
- package/es/DataList/Pagination.js +9 -10
- package/es/DataList/index.js +13 -19
- package/es/DataList/styles/index.js +3 -4
- package/es/DatePicker/Container.js +468 -449
- package/es/DatePicker/Day.js +265 -258
- package/es/DatePicker/Icon.js +34 -20
- package/es/DatePicker/Month.js +101 -79
- package/es/DatePicker/Picker.js +110 -83
- package/es/DatePicker/Quick.js +52 -39
- package/es/DatePicker/Range.js +241 -192
- package/es/DatePicker/Text.js +103 -91
- package/es/DatePicker/Time.js +165 -147
- package/es/DatePicker/TimeScroll.js +148 -116
- package/es/DatePicker/Year.js +74 -53
- package/es/DatePicker/index.js +16 -18
- package/es/DatePicker/paramUtils.js +92 -58
- package/es/DatePicker/styles/index.js +3 -4
- package/es/DatePicker/utils.js +189 -198
- package/es/DatePicker/value.js +139 -98
- package/es/Datum/Form.js +333 -282
- package/es/Datum/List.js +319 -201
- package/es/Datum/Tree.js +298 -239
- package/es/Datum/hoc.js +104 -69
- package/es/Datum/index.js +7 -8
- package/es/Datum/types.js +20 -25
- package/es/Divider/index.js +50 -32
- package/es/Divider/styles/index.js +3 -4
- package/es/Drawer/index.js +14 -9
- package/es/Dropdown/Item.js +56 -43
- package/es/Dropdown/index.js +273 -259
- package/es/Dropdown/styles/index.js +3 -4
- package/es/EditableArea/EditableArea.js +157 -136
- package/es/EditableArea/index.js +8 -15
- package/es/EditableArea/styles/index.js +3 -4
- package/es/Form/Block.js +83 -57
- package/es/Form/BlockField.js +32 -17
- package/es/Form/Field.js +59 -35
- package/es/Form/FieldError.js +27 -21
- package/es/Form/FieldSet.js +214 -156
- package/es/Form/Flow.js +51 -32
- package/es/Form/Form.js +181 -144
- package/es/Form/Item.js +181 -166
- package/es/Form/Loop.js +202 -146
- package/es/Form/formButton.js +58 -42
- package/es/Form/formContext.js +104 -95
- package/es/Form/index.d.ts +1 -0
- package/es/Form/index.js +40 -45
- package/es/Form/inputable.js +368 -292
- package/es/Form/mode.js +15 -9
- package/es/Form/styles/index.js +4 -5
- package/es/Gap/index.js +71 -47
- package/es/Gap/styles/index.js +3 -4
- package/es/Gap/support.js +11 -14
- package/es/Grid/index.js +88 -58
- package/es/Grid/utils.js +57 -58
- package/es/Icon/Icon.js +43 -42
- package/es/Icon/index.js +39 -22
- package/es/Icon/styles/index.js +3 -4
- package/es/Image/Gallery.js +128 -113
- package/es/Image/Group.js +60 -36
- package/es/Image/Image.js +227 -153
- package/es/Image/Magnify.js +123 -94
- package/es/Image/events.js +29 -26
- package/es/Image/index.js +6 -9
- package/es/Image/styles/index.js +3 -4
- package/es/Input/Group.js +17 -11
- package/es/Input/Input.js +158 -134
- package/es/Input/Number.js +199 -175
- package/es/Input/Password.js +54 -31
- package/es/Input/clear.js +41 -25
- package/es/Input/index.js +23 -35
- package/es/Input/styles/index.js +3 -4
- package/es/Lazyload/index.js +63 -42
- package/es/Lazyload/styles/index.js +3 -4
- package/es/Menu/Item.js +275 -236
- package/es/Menu/List.js +75 -67
- package/es/Menu/Root.js +372 -334
- package/es/Menu/context.js +18 -12
- package/es/Menu/index.js +3 -5
- package/es/Menu/styles/index.js +3 -4
- package/es/Message/Container.js +155 -119
- package/es/Message/index.js +42 -30
- package/es/Message/messager.js +29 -33
- package/es/Message/styles/index.js +3 -4
- package/es/Modal/Modal.js +80 -60
- package/es/Modal/Panel.js +258 -234
- package/es/Modal/context.js +15 -15
- package/es/Modal/events.js +213 -182
- package/es/Modal/index.js +12 -14
- package/es/Modal/styles/index.js +3 -4
- package/es/Pagination/Item.js +46 -32
- package/es/Pagination/Jumper.js +79 -66
- package/es/Pagination/Links.js +110 -82
- package/es/Pagination/Next.js +52 -31
- package/es/Pagination/PageSizeList.js +57 -40
- package/es/Pagination/Pagination.js +78 -54
- package/es/Pagination/Prev.js +49 -30
- package/es/Pagination/Simple.js +32 -18
- package/es/Pagination/index.js +68 -41
- package/es/Pagination/styles/index.js +3 -4
- package/es/Popover/Confirm.js +107 -64
- package/es/Popover/Panel.js +284 -231
- package/es/Popover/context.js +15 -12
- package/es/Popover/events.js +80 -86
- package/es/Popover/index.js +12 -14
- package/es/Popover/styles/index.js +3 -4
- package/es/Progress/Circle.js +70 -59
- package/es/Progress/Line.js +51 -39
- package/es/Progress/Popup.js +42 -24
- package/es/Progress/analyzeColor.js +18 -9
- package/es/Progress/index.js +13 -15
- package/es/Progress/styles/index.js +3 -4
- package/es/Radio/Group.js +105 -94
- package/es/Radio/Radio.js +2 -3
- package/es/Radio/index.js +15 -17
- package/es/Radio/styles/index.js +1 -1
- package/es/Rate/Rate.js +216 -167
- package/es/Rate/index.js +17 -10
- package/es/Rate/styles/index.js +3 -4
- package/es/Rule/convert.js +48 -57
- package/es/Rule/index.js +63 -40
- package/es/Rule/length.js +53 -38
- package/es/Rule/regExp.js +23 -14
- package/es/Rule/required.js +26 -18
- package/es/Rule/styles/index.js +1 -1
- package/es/Rule/type.js +26 -18
- package/es/Scroll/Bar.js +145 -117
- package/es/Scroll/Scroll.js +277 -217
- package/es/Scroll/context.js +20 -13
- package/es/Scroll/fixedLength.js +33 -24
- package/es/Scroll/index.js +89 -55
- package/es/Scroll/styles/index.js +3 -4
- package/es/Select/BoxList.js +218 -189
- package/es/Select/BoxOption.js +64 -38
- package/es/Select/FlexBox.js +107 -75
- package/es/Select/FlexResult.js +65 -49
- package/es/Select/Input.js +137 -113
- package/es/Select/More.js +124 -121
- package/es/Select/Option.js +73 -52
- package/es/Select/OptionList.js +236 -200
- package/es/Select/OptionTree.js +111 -96
- package/es/Select/Result.js +297 -271
- package/es/Select/Select.js +517 -491
- package/es/Select/filter.js +221 -148
- package/es/Select/group.js +74 -45
- package/es/Select/index.js +32 -31
- package/es/Select/styles/index.js +3 -4
- package/es/Slider/Container.js +145 -132
- package/es/Slider/Indicator.js +28 -13
- package/es/Slider/Slider.js +132 -103
- package/es/Slider/index.js +5 -8
- package/es/Slider/styles/index.js +3 -4
- package/es/Slider/utils.js +26 -30
- package/es/Spin/Multiple.js +153 -109
- package/es/Spin/Simple.js +33 -22
- package/es/Spin/Spin.js +29 -29
- package/es/Spin/index.js +66 -84
- package/es/Spin/styles/index.js +27 -30
- package/es/Sticky/context.js +12 -10
- package/es/Sticky/index.js +255 -194
- package/es/Sticky/styles/index.js +1 -1
- package/es/Switch/Switch.js +2 -3
- package/es/Switch/index.js +8 -14
- package/es/Table/Checkbox.js +68 -39
- package/es/Table/CheckboxAll.js +121 -64
- package/es/Table/Colgroup.js +72 -47
- package/es/Table/Expand.js +63 -43
- package/es/Table/SeperateTable.js +594 -444
- package/es/Table/SimpleTable.js +215 -136
- package/es/Table/Sorter.js +83 -62
- package/es/Table/Table.js +157 -157
- package/es/Table/Tbody.js +240 -176
- package/es/Table/Td.js +169 -130
- package/es/Table/Thead.js +206 -177
- package/es/Table/Tr.js +249 -205
- package/es/Table/TreeExpand.js +151 -116
- package/es/Table/context.js +15 -15
- package/es/Table/fixedAuto.js +82 -59
- package/es/Table/index.js +309 -228
- package/es/Table/resizable.js +89 -56
- package/es/Table/select.js +238 -215
- package/es/Table/styles/index.js +3 -4
- package/es/Tabs/Header.js +203 -160
- package/es/Tabs/Link.js +46 -28
- package/es/Tabs/Panel.js +49 -33
- package/es/Tabs/Tab.js +97 -79
- package/es/Tabs/Tabs.js +211 -177
- package/es/Tabs/Wrapper.js +37 -17
- package/es/Tabs/index.js +7 -10
- package/es/Tabs/styles/index.js +3 -4
- package/es/Tag/Input.js +70 -54
- package/es/Tag/Tag.js +198 -156
- package/es/Tag/index.js +5 -8
- package/es/Tag/styles/index.js +3 -4
- package/es/Textarea/Textarea.js +139 -118
- package/es/Textarea/index.js +10 -19
- package/es/Tooltip/Container.js +140 -127
- package/es/Tooltip/events.js +49 -55
- package/es/Tooltip/index.js +5 -8
- package/es/Tooltip/styles/index.js +3 -4
- package/es/Transfer/Card.js +212 -177
- package/es/Transfer/Transfer.js +160 -153
- package/es/Transfer/btns.js +97 -80
- package/es/Transfer/context.js +2 -3
- package/es/Transfer/filter.js +65 -35
- package/es/Transfer/index.js +9 -13
- package/es/Transfer/item.js +66 -41
- package/es/Transfer/select.js +15 -16
- package/es/Transfer/styles/index.js +3 -4
- package/es/Tree/Checkbox.js +72 -50
- package/es/Tree/Content.js +136 -95
- package/es/Tree/List.js +82 -53
- package/es/Tree/Node.js +237 -202
- package/es/Tree/Root.js +23 -19
- package/es/Tree/Tree.js +262 -197
- package/es/Tree/index.js +6 -9
- package/es/Tree/styles/index.js +3 -4
- package/es/Tree/toggle.js +89 -51
- package/es/TreeSelect/Input.js +73 -60
- package/es/TreeSelect/Result.js +213 -181
- package/es/TreeSelect/TreeSelect.js +327 -312
- package/es/TreeSelect/datum.js +56 -44
- package/es/TreeSelect/filter.js +134 -96
- package/es/TreeSelect/index.js +15 -23
- package/es/TreeSelect/styles/index.js +3 -4
- package/es/TreeSelect/tiled.js +143 -106
- package/es/Upload/Dragger.js +63 -39
- package/es/Upload/Drop.js +79 -57
- package/es/Upload/File.js +61 -48
- package/es/Upload/FileInput.js +53 -40
- package/es/Upload/Image.js +158 -115
- package/es/Upload/ImageFile.js +63 -43
- package/es/Upload/ImageResult.js +139 -114
- package/es/Upload/Progress.js +117 -105
- package/es/Upload/RemoveConfirm.js +58 -42
- package/es/Upload/Result.js +73 -58
- package/es/Upload/Upload.js +649 -490
- package/es/Upload/accept.js +33 -13
- package/es/Upload/context.js +12 -10
- package/es/Upload/index.js +16 -20
- package/es/Upload/request.js +48 -46
- package/es/Upload/styles/index.js +3 -4
- package/es/component.js +45 -24
- package/es/config.js +27 -19
- package/es/context/implementation.js +132 -94
- package/es/context/index.js +3 -4
- package/es/hoc/coin.js +118 -81
- package/es/hoc/config.js +31 -17
- package/es/hoc/delay.js +99 -55
- package/es/hoc/draggable.js +90 -80
- package/es/hoc/fetch.js +56 -33
- package/es/hoc/hidable.js +119 -98
- package/es/hoc/inputBorder.js +158 -158
- package/es/hoc/moveable.js +124 -96
- package/es/hoc/pagable.js +74 -55
- package/es/hoc/resizable.js +132 -100
- package/es/hoc/styles/index.js +7 -8
- package/es/hoc/trim.js +54 -32
- package/es/icons/Caret.js +14 -15
- package/es/icons/index.js +31 -85
- package/es/index.d.ts +1 -1
- package/es/index.js +58 -57
- package/es/locale/en_US.js +9 -30
- package/es/locale/index.js +13 -14
- package/es/locale/zh-CN.js +9 -17
- package/es/styles/expose.js +3 -4
- package/es/styles/index.js +1 -1
- package/es/utils/accept.js +15 -12
- package/es/utils/classname.js +23 -12
- package/es/utils/cleanProps.js +9 -21
- package/es/utils/clone.js +34 -27
- package/es/utils/color.js +310 -276
- package/es/utils/css-accessors.js +94 -45
- package/es/utils/dom/detect.js +29 -29
- package/es/utils/dom/document.js +23 -19
- package/es/utils/dom/element.js +139 -105
- package/es/utils/dom/getDataset.js +9 -9
- package/es/utils/dom/isDOMElement.js +3 -5
- package/es/utils/dom/normalizeWheel.js +32 -28
- package/es/utils/dom/popContainer.js +12 -13
- package/es/utils/dom/popover.js +79 -59
- package/es/utils/dom/ready.js +5 -6
- package/es/utils/dom/translate.js +10 -12
- package/es/utils/errors.js +47 -28
- package/es/utils/expose.js +97 -58
- package/es/utils/flat.js +122 -107
- package/es/utils/func.js +38 -20
- package/es/utils/hash.js +24 -20
- package/es/utils/index.js +24 -49
- package/es/utils/is.js +91 -70
- package/es/utils/lazyload.js +104 -86
- package/es/utils/notification.js +34 -20
- package/es/utils/numbers.js +61 -51
- package/es/utils/objects.js +221 -140
- package/es/utils/proptypes.js +21 -34
- package/es/utils/shallowEqual.js +46 -42
- package/es/utils/strings.js +50 -32
- package/es/utils/transform.js +24 -9
- package/es/utils/tree.js +78 -63
- package/es/utils/uid.js +14 -17
- package/es/utils/validate/index.js +71 -50
- package/es/utils/validate/isJson.js +7 -10
- package/es/utils/validate/nullable.js +10 -9
- package/es/utils/validate/range.js +22 -19
- package/es/utils/validate/rangeLength.js +19 -16
- package/es/utils/validate/regExp.js +10 -10
- package/es/utils/validate/required.js +11 -8
- package/es/utils/validate/type.js +56 -59
- package/es/utils/vars-inject.js +3420 -4248
- package/lib/DatePicker/utils.js +1 -1
- package/lib/Form/Field.js +8 -4
- package/lib/Form/Form.js +3 -0
- package/lib/Form/Item.js +1 -1
- package/lib/Form/index.d.ts +1 -0
- package/lib/Form/inputable.js +1 -1
- package/lib/Pagination/Jumper.js +3 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/package.json +3 -2
|
@@ -1,148 +1,184 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
60
|
-
if (resize || this.props.dataChangeResize) this.setState({
|
|
61
|
-
|
|
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
|
-
|
|
79
|
+
|
|
80
|
+
this.updateScrollLeft();
|
|
81
|
+
|
|
64
82
|
if (!compareColumns(prevProps.columns, this.props.columns)) {
|
|
65
|
-
this.resetWidth()
|
|
66
|
-
this.setState({
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
return this.getSumHeight(0, this.props.data.length)
|
|
84
|
-
}
|
|
89
|
+
this.ajustBottom(dataChange);
|
|
90
|
+
};
|
|
85
91
|
|
|
86
|
-
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
92
|
+
_proto.getIndex = function getIndex(scrollTop) {
|
|
93
|
+
if (scrollTop === void 0) {
|
|
94
|
+
scrollTop = this.state.scrollTop;
|
|
95
|
+
}
|
|
91
96
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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
|
-
|
|
102
|
-
|
|
127
|
+
return height;
|
|
128
|
+
};
|
|
103
129
|
|
|
104
|
-
|
|
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
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
-
|
|
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,
|
|
159
|
+
this.lastScrollTop += height - this.props.rowHeight;
|
|
160
|
+
setTranslate(this.tbody, "-" + offsetLeft + "px", "-" + this.lastScrollTop + "px");
|
|
125
161
|
}
|
|
126
162
|
|
|
127
|
-
|
|
163
|
+
var contentHeight = this.getContentHeight();
|
|
128
164
|
|
|
129
165
|
if (oldHeight && height !== oldHeight) {
|
|
130
166
|
if (this.lastScrollTop > contentHeight) {
|
|
131
|
-
this.handleScroll(
|
|
132
|
-
|
|
133
|
-
|
|
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
|
-
|
|
140
|
-
this.setState({
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
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
|
-
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
207
|
-
|
|
208
|
-
this.setState({
|
|
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({
|
|
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
|
-
|
|
241
|
-
this.setState({
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
return
|
|
245
|
-
}
|
|
299
|
+
var index = this.resetIndex();
|
|
300
|
+
this.setState({
|
|
301
|
+
currentIndex: index
|
|
302
|
+
});
|
|
246
303
|
|
|
247
|
-
|
|
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 =
|
|
256
|
-
setTranslate(this.tbody,
|
|
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
|
-
|
|
321
|
+
|
|
322
|
+
return;
|
|
260
323
|
}
|
|
261
324
|
|
|
262
325
|
if (index === 0) {
|
|
263
|
-
this.lastScrollTop = 0
|
|
264
|
-
setTimeout(()
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
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 =
|
|
271
|
-
setTranslate(this.tbody,
|
|
272
|
-
this.lastScrollTop = fullHeight
|
|
273
|
-
setTimeout(()
|
|
274
|
-
|
|
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
|
-
|
|
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
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
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
|
-
|
|
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,
|
|
381
|
+
setTranslate(this.thead, "-" + left + "px", '0');
|
|
302
382
|
}
|
|
303
383
|
|
|
304
|
-
;
|
|
305
|
-
|
|
306
|
-
|
|
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,
|
|
389
|
+
setTranslate(cell, left + "px", '0');
|
|
309
390
|
} else if (cell.classList.contains(tableClass(CLASS_FIXED_RIGHT))) {
|
|
310
|
-
setTranslate(cell,
|
|
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
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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
|
-
|
|
348
|
-
|
|
445
|
+
if (currentIndex === 1 && index === -1) {
|
|
446
|
+
scrollIndex = 0;
|
|
447
|
+
}
|
|
349
448
|
|
|
350
|
-
this.
|
|
449
|
+
this.scrollToIndex(scrollIndex, callback);
|
|
450
|
+
};
|
|
351
451
|
|
|
352
|
-
|
|
353
|
-
|
|
452
|
+
_proto.handleScroll = function handleScroll() {
|
|
453
|
+
if (!this.tbody || this.realTbody.clientHeight === 0) return;
|
|
354
454
|
|
|
355
|
-
|
|
356
|
-
|
|
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
|
-
|
|
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
|
-
|
|
390
|
-
|
|
487
|
+
|
|
488
|
+
if (left < 0) left = 0;
|
|
489
|
+
this.resetWidth(left, right);
|
|
391
490
|
/* set x end */
|
|
392
491
|
|
|
393
492
|
/* set y */
|
|
394
|
-
|
|
493
|
+
|
|
494
|
+
this.tbody.style.marginTop = scrollTop * h + "px";
|
|
395
495
|
|
|
396
496
|
if (pixelY === undefined) {
|
|
397
497
|
// drag scroll bar
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
this.lastScrollTop = offsetScrollTop
|
|
405
|
-
setTranslate(this.tbody,
|
|
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,
|
|
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,
|
|
413
|
-
this.setState({
|
|
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
|
|
418
|
-
|
|
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[
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
if (
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
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
|
-
|
|
453
|
-
|
|
554
|
+
_proto.handleSortChange = function handleSortChange() {
|
|
555
|
+
var _this$props6;
|
|
454
556
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
this.props.onSortChange(
|
|
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(
|
|
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
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
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
|
|
619
|
+
return React.createElement("div", null);
|
|
493
620
|
}
|
|
494
621
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
this.lastData = data
|
|
498
|
-
|
|
499
|
-
if (!dataUpdated && this.lastColumns && !compareColumns(this.lastColumns, columns)) dataUpdated = true
|
|
500
|
-
this.lastColumns = columns
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
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
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
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
|
-
|
|
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
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
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
|
|
595
|
-
|
|
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;
|