@hi-ui/table 4.3.1 → 4.3.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/CHANGELOG.md +40 -0
- package/lib/cjs/BaseTable.js +136 -189
- package/lib/cjs/ColGroupContent.js +5 -28
- package/lib/cjs/SettingDrawer.js +76 -127
- package/lib/cjs/Table.js +107 -171
- package/lib/cjs/TableAdvancedFilter.js +49 -85
- package/lib/cjs/TableBody.js +33 -69
- package/lib/cjs/TableCell.js +56 -102
- package/lib/cjs/TableColumnMenu.js +39 -77
- package/lib/cjs/TableEmbedRow.js +11 -38
- package/lib/cjs/TableHeader.js +8 -33
- package/lib/cjs/TableRow.js +48 -88
- package/lib/cjs/TableSettingMenu.js +48 -94
- package/lib/cjs/TbodyContent.js +28 -56
- package/lib/cjs/TheadContent.js +20 -49
- package/lib/cjs/_virtual/index.js +0 -3
- package/lib/cjs/_virtual/index2.js +0 -3
- package/lib/cjs/_virtual/react-is.development.js +0 -3
- package/lib/cjs/_virtual/react-is.production.min.js +0 -3
- package/lib/cjs/context.js +0 -9
- package/lib/cjs/hooks/use-async-switch.js +13 -51
- package/lib/cjs/hooks/use-check.js +47 -77
- package/lib/cjs/hooks/use-col-hidden.js +16 -28
- package/lib/cjs/hooks/use-col-set.js +5 -18
- package/lib/cjs/hooks/use-col-sorter.js +18 -32
- package/lib/cjs/hooks/use-col-width.js +21 -57
- package/lib/cjs/hooks/use-colgroup.js +63 -85
- package/lib/cjs/hooks/use-drag.js +10 -31
- package/lib/cjs/hooks/use-embed-expand.js +23 -68
- package/lib/cjs/hooks/use-expand.js +32 -64
- package/lib/cjs/hooks/use-pagination.js +19 -50
- package/lib/cjs/hooks/use-queue.js +2 -14
- package/lib/cjs/icons/index.js +4 -21
- package/lib/cjs/index.js +0 -4
- package/lib/cjs/node_modules/classnames/index.js +2 -11
- package/lib/cjs/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +31 -227
- package/lib/cjs/node_modules/rc-resize-observer/es/index.js +10 -68
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +1 -17
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +1 -14
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +1 -25
- package/lib/cjs/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +1 -5
- package/lib/cjs/node_modules/rc-util/es/Dom/canUseDom.js +0 -2
- package/lib/cjs/node_modules/rc-util/es/Dom/findDOMNode.js +1 -14
- package/lib/cjs/node_modules/rc-util/es/hooks/useLayoutEffect.js +2 -9
- package/lib/cjs/node_modules/rc-util/es/raf.js +0 -11
- package/lib/cjs/node_modules/rc-virtual-list/es/Filler.js +6 -25
- package/lib/cjs/node_modules/rc-virtual-list/es/Item.js +3 -14
- package/lib/cjs/node_modules/rc-virtual-list/es/List.js +103 -194
- package/lib/cjs/node_modules/rc-virtual-list/es/ScrollBar.js +16 -96
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useChildren.js +2 -11
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +8 -34
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +0 -10
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useHeights.js +6 -39
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +0 -16
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +4 -9
- package/lib/cjs/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +3 -28
- package/lib/cjs/node_modules/rc-virtual-list/es/index.js +0 -2
- package/lib/cjs/node_modules/rc-virtual-list/es/utils/CacheMap.js +2 -9
- package/lib/cjs/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +0 -15
- package/lib/cjs/node_modules/rc-virtual-list/es/utils/isFirefox.js +0 -2
- package/lib/cjs/node_modules/react-is/cjs/react-is.development.js +3 -29
- package/lib/cjs/node_modules/react-is/cjs/react-is.production.min.js +19 -45
- package/lib/cjs/node_modules/react-is/index.js +0 -5
- package/lib/cjs/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +83 -248
- package/lib/cjs/packages/hooks/use-merge-refs/lib/esm/index.js +3 -14
- package/lib/cjs/packages/ui/scrollbar/lib/esm/Scrollbar.js +48 -86
- package/lib/cjs/packages/ui/scrollbar/lib/esm/styles/index.scss.js +1 -15
- package/lib/cjs/packages/ui/scrollbar/lib/esm/utils/index.js +0 -13
- package/lib/cjs/styles/index.scss.js +1 -4
- package/lib/cjs/use-table.js +268 -355
- package/lib/cjs/utils/index.js +11 -45
- package/lib/esm/BaseTable.js +117 -138
- package/lib/esm/ColGroupContent.js +3 -9
- package/lib/esm/SettingDrawer.js +64 -83
- package/lib/esm/Table.js +97 -124
- package/lib/esm/TableAdvancedFilter.js +37 -47
- package/lib/esm/TableBody.js +24 -34
- package/lib/esm/TableCell.js +48 -72
- package/lib/esm/TableColumnMenu.js +24 -38
- package/lib/esm/TableEmbedRow.js +8 -15
- package/lib/esm/TableHeader.js +5 -11
- package/lib/esm/TableRow.js +36 -51
- package/lib/esm/TableSettingMenu.js +33 -49
- package/lib/esm/TbodyContent.js +20 -27
- package/lib/esm/TheadContent.js +14 -21
- package/lib/esm/context.js +0 -4
- package/lib/esm/hooks/use-async-switch.js +9 -28
- package/lib/esm/hooks/use-check.js +42 -55
- package/lib/esm/hooks/use-col-hidden.js +16 -21
- package/lib/esm/hooks/use-col-set.js +5 -13
- package/lib/esm/hooks/use-col-sorter.js +18 -23
- package/lib/esm/hooks/use-col-width.js +14 -34
- package/lib/esm/hooks/use-colgroup.js +60 -66
- package/lib/esm/hooks/use-drag.js +9 -13
- package/lib/esm/hooks/use-embed-expand.js +20 -42
- package/lib/esm/hooks/use-expand.js +32 -56
- package/lib/esm/hooks/use-pagination.js +13 -25
- package/lib/esm/hooks/use-queue.js +2 -10
- package/lib/esm/node_modules/classnames/index.js +2 -9
- package/lib/esm/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +31 -228
- package/lib/esm/node_modules/rc-resize-observer/es/index.js +3 -26
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Children/toArray.js +0 -3
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/Dom/findDOMNode.js +1 -2
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/ref.js +0 -8
- package/lib/esm/node_modules/rc-resize-observer/node_modules/rc-util/es/warning.js +0 -5
- package/lib/esm/node_modules/rc-util/es/Dom/canUseDom.js +0 -1
- package/lib/esm/node_modules/rc-util/es/Dom/findDOMNode.js +1 -2
- package/lib/esm/node_modules/rc-util/es/hooks/useLayoutEffect.js +1 -0
- package/lib/esm/node_modules/rc-util/es/raf.js +0 -10
- package/lib/esm/node_modules/rc-virtual-list/es/Filler.js +4 -15
- package/lib/esm/node_modules/rc-virtual-list/es/Item.js +1 -3
- package/lib/esm/node_modules/rc-virtual-list/es/List.js +101 -174
- package/lib/esm/node_modules/rc-virtual-list/es/ScrollBar.js +14 -86
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useChildren.js +0 -2
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useDiffItem.js +6 -25
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useFrameWheel.js +0 -6
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useHeights.js +4 -28
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js +0 -13
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useOriginScroll.js +4 -8
- package/lib/esm/node_modules/rc-virtual-list/es/hooks/useScrollTo.js +1 -19
- package/lib/esm/node_modules/rc-virtual-list/es/index.js +1 -1
- package/lib/esm/node_modules/rc-virtual-list/es/utils/CacheMap.js +2 -8
- package/lib/esm/node_modules/rc-virtual-list/es/utils/algorithmUtil.js +1 -12
- package/lib/esm/node_modules/rc-virtual-list/es/utils/isFirefox.js +0 -1
- package/lib/esm/node_modules/react-is/cjs/react-is.development.js +4 -27
- package/lib/esm/node_modules/react-is/cjs/react-is.production.min.js +20 -44
- package/lib/esm/node_modules/react-is/index.js +0 -1
- package/lib/esm/node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js +82 -248
- package/lib/esm/packages/hooks/use-merge-refs/lib/esm/index.js +3 -9
- package/lib/esm/packages/ui/scrollbar/lib/esm/Scrollbar.js +47 -64
- package/lib/esm/packages/ui/scrollbar/lib/esm/styles/index.scss.js +1 -3
- package/lib/esm/packages/ui/scrollbar/lib/esm/utils/index.js +0 -10
- package/lib/esm/styles/index.scss.js +1 -3
- package/lib/esm/use-table.js +261 -318
- package/lib/esm/utils/index.js +11 -41
- package/lib/types/BaseTable.d.ts +2 -2
- package/package.json +33 -33
|
@@ -12,17 +12,11 @@
|
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
var React = require('react');
|
|
17
|
-
|
|
18
16
|
var index = require('../../classnames/index.js');
|
|
19
|
-
|
|
20
17
|
var raf = require('../../rc-util/es/raf.js');
|
|
21
|
-
|
|
22
|
-
function _interopNamespace(e) {
|
|
23
|
-
if (e && e.__esModule) return e;
|
|
18
|
+
function _interopNamespaceDefault(e) {
|
|
24
19
|
var n = Object.create(null);
|
|
25
|
-
|
|
26
20
|
if (e) {
|
|
27
21
|
Object.keys(e).forEach(function (k) {
|
|
28
22
|
if (k !== 'default') {
|
|
@@ -36,13 +30,10 @@ function _interopNamespace(e) {
|
|
|
36
30
|
}
|
|
37
31
|
});
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
n["default"] = e;
|
|
41
34
|
return Object.freeze(n);
|
|
42
35
|
}
|
|
43
|
-
|
|
44
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
45
|
-
|
|
36
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
46
37
|
function _typeof(obj) {
|
|
47
38
|
"@babel/helpers - typeof";
|
|
48
39
|
|
|
@@ -52,7 +43,6 @@ function _typeof(obj) {
|
|
|
52
43
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
53
44
|
}, _typeof(obj);
|
|
54
45
|
}
|
|
55
|
-
|
|
56
46
|
function _defineProperty(obj, key, value) {
|
|
57
47
|
if (key in obj) {
|
|
58
48
|
Object.defineProperty(obj, key, {
|
|
@@ -64,16 +54,13 @@ function _defineProperty(obj, key, value) {
|
|
|
64
54
|
} else {
|
|
65
55
|
obj[key] = value;
|
|
66
56
|
}
|
|
67
|
-
|
|
68
57
|
return obj;
|
|
69
58
|
}
|
|
70
|
-
|
|
71
59
|
function _classCallCheck(instance, Constructor) {
|
|
72
60
|
if (!(instance instanceof Constructor)) {
|
|
73
61
|
throw new TypeError("Cannot call a class as a function");
|
|
74
62
|
}
|
|
75
63
|
}
|
|
76
|
-
|
|
77
64
|
function _defineProperties(target, props) {
|
|
78
65
|
for (var i = 0; i < props.length; i++) {
|
|
79
66
|
var descriptor = props[i];
|
|
@@ -83,7 +70,6 @@ function _defineProperties(target, props) {
|
|
|
83
70
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
84
71
|
}
|
|
85
72
|
}
|
|
86
|
-
|
|
87
73
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
88
74
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
89
75
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -92,12 +78,10 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
92
78
|
});
|
|
93
79
|
return Constructor;
|
|
94
80
|
}
|
|
95
|
-
|
|
96
81
|
function _inherits(subClass, superClass) {
|
|
97
82
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
98
83
|
throw new TypeError("Super expression must either be null or a function");
|
|
99
84
|
}
|
|
100
|
-
|
|
101
85
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
102
86
|
constructor: {
|
|
103
87
|
value: subClass,
|
|
@@ -110,58 +94,45 @@ function _inherits(subClass, superClass) {
|
|
|
110
94
|
});
|
|
111
95
|
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
112
96
|
}
|
|
113
|
-
|
|
114
97
|
function _setPrototypeOf(o, p) {
|
|
115
98
|
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
116
99
|
o.__proto__ = p;
|
|
117
100
|
return o;
|
|
118
101
|
};
|
|
119
|
-
|
|
120
102
|
return _setPrototypeOf(o, p);
|
|
121
103
|
}
|
|
122
|
-
|
|
123
104
|
function _createSuper(Derived) {
|
|
124
105
|
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
125
|
-
|
|
126
106
|
return function _createSuperInternal() {
|
|
127
107
|
var Super = _getPrototypeOf(Derived),
|
|
128
|
-
|
|
129
|
-
|
|
108
|
+
result;
|
|
130
109
|
if (hasNativeReflectConstruct) {
|
|
131
110
|
var NewTarget = _getPrototypeOf(this).constructor;
|
|
132
|
-
|
|
133
111
|
result = Reflect.construct(Super, arguments, NewTarget);
|
|
134
112
|
} else {
|
|
135
113
|
result = Super.apply(this, arguments);
|
|
136
114
|
}
|
|
137
|
-
|
|
138
115
|
return _possibleConstructorReturn(this, result);
|
|
139
116
|
};
|
|
140
117
|
}
|
|
141
|
-
|
|
142
118
|
function _possibleConstructorReturn(self, call) {
|
|
143
119
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
144
120
|
return call;
|
|
145
121
|
} else if (call !== void 0) {
|
|
146
122
|
throw new TypeError("Derived constructors may only return object or undefined");
|
|
147
123
|
}
|
|
148
|
-
|
|
149
124
|
return _assertThisInitialized(self);
|
|
150
125
|
}
|
|
151
|
-
|
|
152
126
|
function _assertThisInitialized(self) {
|
|
153
127
|
if (self === void 0) {
|
|
154
128
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
155
129
|
}
|
|
156
|
-
|
|
157
130
|
return self;
|
|
158
131
|
}
|
|
159
|
-
|
|
160
132
|
function _isNativeReflectConstruct() {
|
|
161
133
|
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
162
134
|
if (Reflect.construct.sham) return false;
|
|
163
135
|
if (typeof Proxy === "function") return true;
|
|
164
|
-
|
|
165
136
|
try {
|
|
166
137
|
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
167
138
|
return true;
|
|
@@ -169,34 +140,25 @@ function _isNativeReflectConstruct() {
|
|
|
169
140
|
return false;
|
|
170
141
|
}
|
|
171
142
|
}
|
|
172
|
-
|
|
173
143
|
function _getPrototypeOf(o) {
|
|
174
144
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
175
145
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
176
146
|
};
|
|
177
147
|
return _getPrototypeOf(o);
|
|
178
148
|
}
|
|
179
|
-
|
|
180
149
|
var MIN_SIZE = 20;
|
|
181
|
-
|
|
182
150
|
function getPageY(e) {
|
|
183
151
|
return 'touches' in e ? e.touches[0].pageY : e.pageY;
|
|
184
152
|
}
|
|
185
|
-
|
|
186
153
|
var ScrollBar = /*#__PURE__*/function (_React$Component) {
|
|
187
154
|
_inherits(ScrollBar, _React$Component);
|
|
188
|
-
|
|
189
155
|
var _super = _createSuper(ScrollBar);
|
|
190
|
-
|
|
191
156
|
function ScrollBar() {
|
|
192
157
|
var _this;
|
|
193
|
-
|
|
194
158
|
_classCallCheck(this, ScrollBar);
|
|
195
|
-
|
|
196
159
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
197
160
|
args[_key] = arguments[_key];
|
|
198
161
|
}
|
|
199
|
-
|
|
200
162
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
201
163
|
_this.moveRaf = null;
|
|
202
164
|
_this.scrollbarRef = /*#__PURE__*/React__namespace.createRef();
|
|
@@ -208,90 +170,66 @@ var ScrollBar = /*#__PURE__*/function (_React$Component) {
|
|
|
208
170
|
startTop: null,
|
|
209
171
|
visible: false
|
|
210
172
|
};
|
|
211
|
-
|
|
212
173
|
_this.delayHidden = function () {
|
|
213
174
|
clearTimeout(_this.visibleTimeout);
|
|
214
|
-
|
|
215
175
|
_this.setState({
|
|
216
176
|
visible: true
|
|
217
177
|
});
|
|
218
|
-
|
|
219
178
|
_this.visibleTimeout = setTimeout(function () {
|
|
220
179
|
_this.setState({
|
|
221
180
|
visible: false
|
|
222
181
|
});
|
|
223
182
|
}, 2000);
|
|
224
183
|
};
|
|
225
|
-
|
|
226
184
|
_this.onScrollbarTouchStart = function (e) {
|
|
227
185
|
e.preventDefault();
|
|
228
186
|
};
|
|
229
|
-
|
|
230
187
|
_this.onContainerMouseDown = function (e) {
|
|
231
188
|
e.stopPropagation();
|
|
232
189
|
e.preventDefault();
|
|
233
190
|
};
|
|
234
|
-
|
|
235
191
|
_this.patchEvents = function () {
|
|
236
192
|
window.addEventListener('mousemove', _this.onMouseMove);
|
|
237
193
|
window.addEventListener('mouseup', _this.onMouseUp);
|
|
238
|
-
|
|
239
194
|
_this.thumbRef.current.addEventListener('touchmove', _this.onMouseMove);
|
|
240
|
-
|
|
241
195
|
_this.thumbRef.current.addEventListener('touchend', _this.onMouseUp);
|
|
242
196
|
};
|
|
243
|
-
|
|
244
197
|
_this.removeEvents = function () {
|
|
245
198
|
var _this$scrollbarRef$cu;
|
|
246
|
-
|
|
247
199
|
window.removeEventListener('mousemove', _this.onMouseMove);
|
|
248
200
|
window.removeEventListener('mouseup', _this.onMouseUp);
|
|
249
201
|
(_this$scrollbarRef$cu = _this.scrollbarRef.current) === null || _this$scrollbarRef$cu === void 0 ? void 0 : _this$scrollbarRef$cu.removeEventListener('touchstart', _this.onScrollbarTouchStart);
|
|
250
|
-
|
|
251
202
|
if (_this.thumbRef.current) {
|
|
252
203
|
_this.thumbRef.current.removeEventListener('touchstart', _this.onMouseDown);
|
|
253
|
-
|
|
254
204
|
_this.thumbRef.current.removeEventListener('touchmove', _this.onMouseMove);
|
|
255
|
-
|
|
256
205
|
_this.thumbRef.current.removeEventListener('touchend', _this.onMouseUp);
|
|
257
206
|
}
|
|
258
|
-
|
|
259
207
|
raf["default"].cancel(_this.moveRaf);
|
|
260
208
|
};
|
|
261
|
-
|
|
262
209
|
_this.onMouseDown = function (e) {
|
|
263
210
|
var onStartMove = _this.props.onStartMove;
|
|
264
|
-
|
|
265
211
|
_this.setState({
|
|
266
212
|
dragging: true,
|
|
267
213
|
pageY: getPageY(e),
|
|
268
214
|
startTop: _this.getTop()
|
|
269
215
|
});
|
|
270
|
-
|
|
271
216
|
onStartMove();
|
|
272
|
-
|
|
273
217
|
_this.patchEvents();
|
|
274
|
-
|
|
275
218
|
e.stopPropagation();
|
|
276
219
|
e.preventDefault();
|
|
277
220
|
};
|
|
278
|
-
|
|
279
221
|
_this.onMouseMove = function (e) {
|
|
280
222
|
var _this$state = _this.state,
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
223
|
+
dragging = _this$state.dragging,
|
|
224
|
+
pageY = _this$state.pageY,
|
|
225
|
+
startTop = _this$state.startTop;
|
|
284
226
|
var onScroll = _this.props.onScroll;
|
|
285
227
|
raf["default"].cancel(_this.moveRaf);
|
|
286
|
-
|
|
287
228
|
if (dragging) {
|
|
288
229
|
var offsetY = getPageY(e) - pageY;
|
|
289
230
|
var newTop = startTop + offsetY;
|
|
290
|
-
|
|
291
231
|
var enableScrollRange = _this.getEnableScrollRange();
|
|
292
|
-
|
|
293
232
|
var enableHeightRange = _this.getEnableHeightRange();
|
|
294
|
-
|
|
295
233
|
var ptg = enableHeightRange ? newTop / enableHeightRange : 0;
|
|
296
234
|
var newScrollTop = Math.ceil(ptg * enableScrollRange);
|
|
297
235
|
_this.moveRaf = raf["default"](function () {
|
|
@@ -299,69 +237,52 @@ var ScrollBar = /*#__PURE__*/function (_React$Component) {
|
|
|
299
237
|
});
|
|
300
238
|
}
|
|
301
239
|
};
|
|
302
|
-
|
|
303
240
|
_this.onMouseUp = function () {
|
|
304
241
|
var onStopMove = _this.props.onStopMove;
|
|
305
|
-
|
|
306
242
|
_this.setState({
|
|
307
243
|
dragging: false
|
|
308
244
|
});
|
|
309
|
-
|
|
310
245
|
onStopMove();
|
|
311
|
-
|
|
312
246
|
_this.removeEvents();
|
|
313
247
|
};
|
|
314
|
-
|
|
315
248
|
_this.getSpinHeight = function () {
|
|
316
249
|
var _this$props = _this.props,
|
|
317
|
-
|
|
318
|
-
|
|
250
|
+
height = _this$props.height,
|
|
251
|
+
count = _this$props.count;
|
|
319
252
|
var baseHeight = height / count * 10;
|
|
320
253
|
baseHeight = Math.max(baseHeight, MIN_SIZE);
|
|
321
254
|
baseHeight = Math.min(baseHeight, height / 2);
|
|
322
255
|
return Math.floor(baseHeight);
|
|
323
256
|
};
|
|
324
|
-
|
|
325
257
|
_this.getEnableScrollRange = function () {
|
|
326
258
|
var _this$props2 = _this.props,
|
|
327
|
-
|
|
328
|
-
|
|
259
|
+
scrollHeight = _this$props2.scrollHeight,
|
|
260
|
+
height = _this$props2.height;
|
|
329
261
|
return scrollHeight - height || 0;
|
|
330
262
|
};
|
|
331
|
-
|
|
332
263
|
_this.getEnableHeightRange = function () {
|
|
333
264
|
var height = _this.props.height;
|
|
334
|
-
|
|
335
265
|
var spinHeight = _this.getSpinHeight();
|
|
336
|
-
|
|
337
266
|
return height - spinHeight || 0;
|
|
338
267
|
};
|
|
339
|
-
|
|
340
268
|
_this.getTop = function () {
|
|
341
269
|
var scrollTop = _this.props.scrollTop;
|
|
342
|
-
|
|
343
270
|
var enableScrollRange = _this.getEnableScrollRange();
|
|
344
|
-
|
|
345
271
|
var enableHeightRange = _this.getEnableHeightRange();
|
|
346
|
-
|
|
347
272
|
if (scrollTop === 0 || enableScrollRange === 0) {
|
|
348
273
|
return 0;
|
|
349
274
|
}
|
|
350
|
-
|
|
351
275
|
var ptg = scrollTop / enableScrollRange;
|
|
352
276
|
return ptg * enableHeightRange;
|
|
353
277
|
};
|
|
354
|
-
|
|
355
278
|
_this.showScroll = function () {
|
|
356
279
|
var _this$props3 = _this.props,
|
|
357
|
-
|
|
358
|
-
|
|
280
|
+
height = _this$props3.height,
|
|
281
|
+
scrollHeight = _this$props3.scrollHeight;
|
|
359
282
|
return scrollHeight > height;
|
|
360
283
|
};
|
|
361
|
-
|
|
362
284
|
return _this;
|
|
363
285
|
}
|
|
364
|
-
|
|
365
286
|
_createClass(ScrollBar, [{
|
|
366
287
|
key: "componentDidMount",
|
|
367
288
|
value: function componentDidMount() {
|
|
@@ -383,11 +304,12 @@ var ScrollBar = /*#__PURE__*/function (_React$Component) {
|
|
|
383
304
|
}
|
|
384
305
|
}, {
|
|
385
306
|
key: "render",
|
|
386
|
-
value:
|
|
307
|
+
value:
|
|
308
|
+
// ====================== Render =======================
|
|
387
309
|
function render() {
|
|
388
310
|
var _this$state2 = this.state,
|
|
389
|
-
|
|
390
|
-
|
|
311
|
+
dragging = _this$state2.dragging,
|
|
312
|
+
visible = _this$state2.visible;
|
|
391
313
|
var prefixCls = this.props.prefixCls;
|
|
392
314
|
var spinHeight = this.getSpinHeight();
|
|
393
315
|
var top = this.getTop();
|
|
@@ -424,8 +346,6 @@ var ScrollBar = /*#__PURE__*/function (_React$Component) {
|
|
|
424
346
|
}));
|
|
425
347
|
}
|
|
426
348
|
}]);
|
|
427
|
-
|
|
428
349
|
return ScrollBar;
|
|
429
350
|
}(React__namespace.Component);
|
|
430
|
-
|
|
431
351
|
exports["default"] = ScrollBar;
|
|
@@ -12,15 +12,10 @@
|
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
var React = require('react');
|
|
17
|
-
|
|
18
16
|
var Item = require('../Item.js');
|
|
19
|
-
|
|
20
|
-
function _interopNamespace(e) {
|
|
21
|
-
if (e && e.__esModule) return e;
|
|
17
|
+
function _interopNamespaceDefault(e) {
|
|
22
18
|
var n = Object.create(null);
|
|
23
|
-
|
|
24
19
|
if (e) {
|
|
25
20
|
Object.keys(e).forEach(function (k) {
|
|
26
21
|
if (k !== 'default') {
|
|
@@ -34,13 +29,10 @@ function _interopNamespace(e) {
|
|
|
34
29
|
}
|
|
35
30
|
});
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
n["default"] = e;
|
|
39
33
|
return Object.freeze(n);
|
|
40
34
|
}
|
|
41
|
-
|
|
42
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
43
|
-
|
|
35
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
44
36
|
function useChildren(list, startIndex, endIndex, setNodeRef, renderFunc, _ref) {
|
|
45
37
|
var getKey = _ref.getKey;
|
|
46
38
|
return list.slice(startIndex, endIndex + 1).map(function (item, index) {
|
|
@@ -56,5 +48,4 @@ function useChildren(list, startIndex, endIndex, setNodeRef, renderFunc, _ref) {
|
|
|
56
48
|
}, node);
|
|
57
49
|
});
|
|
58
50
|
}
|
|
59
|
-
|
|
60
51
|
exports["default"] = useChildren;
|
|
@@ -12,15 +12,10 @@
|
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
var React = require('react');
|
|
17
|
-
|
|
18
16
|
var algorithmUtil = require('../utils/algorithmUtil.js');
|
|
19
|
-
|
|
20
|
-
function _interopNamespace(e) {
|
|
21
|
-
if (e && e.__esModule) return e;
|
|
17
|
+
function _interopNamespaceDefault(e) {
|
|
22
18
|
var n = Object.create(null);
|
|
23
|
-
|
|
24
19
|
if (e) {
|
|
25
20
|
Object.keys(e).forEach(function (k) {
|
|
26
21
|
if (k !== 'default') {
|
|
@@ -34,21 +29,16 @@ function _interopNamespace(e) {
|
|
|
34
29
|
}
|
|
35
30
|
});
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
n["default"] = e;
|
|
39
33
|
return Object.freeze(n);
|
|
40
34
|
}
|
|
41
|
-
|
|
42
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
43
|
-
|
|
35
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
44
36
|
function _slicedToArray(arr, i) {
|
|
45
37
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
46
38
|
}
|
|
47
|
-
|
|
48
39
|
function _nonIterableRest() {
|
|
49
40
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
function _unsupportedIterableToArray(o, minLen) {
|
|
53
43
|
if (!o) return;
|
|
54
44
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -57,31 +47,23 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
57
47
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
58
48
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
59
49
|
}
|
|
60
|
-
|
|
61
50
|
function _arrayLikeToArray(arr, len) {
|
|
62
51
|
if (len == null || len > arr.length) len = arr.length;
|
|
63
|
-
|
|
64
52
|
for (var i = 0, arr2 = new Array(len); i < len; i++) {
|
|
65
53
|
arr2[i] = arr[i];
|
|
66
54
|
}
|
|
67
|
-
|
|
68
55
|
return arr2;
|
|
69
56
|
}
|
|
70
|
-
|
|
71
57
|
function _iterableToArrayLimit(arr, i) {
|
|
72
58
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
73
|
-
|
|
74
59
|
if (_i == null) return;
|
|
75
60
|
var _arr = [];
|
|
76
61
|
var _n = true;
|
|
77
62
|
var _d = false;
|
|
78
|
-
|
|
79
63
|
var _s, _e;
|
|
80
|
-
|
|
81
64
|
try {
|
|
82
65
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
83
66
|
_arr.push(_s.value);
|
|
84
|
-
|
|
85
67
|
if (i && _arr.length === i) break;
|
|
86
68
|
}
|
|
87
69
|
} catch (err) {
|
|
@@ -94,36 +76,28 @@ function _iterableToArrayLimit(arr, i) {
|
|
|
94
76
|
if (_d) throw _e;
|
|
95
77
|
}
|
|
96
78
|
}
|
|
97
|
-
|
|
98
79
|
return _arr;
|
|
99
80
|
}
|
|
100
|
-
|
|
101
81
|
function _arrayWithHoles(arr) {
|
|
102
82
|
if (Array.isArray(arr)) return arr;
|
|
103
83
|
}
|
|
104
|
-
|
|
105
84
|
function useDiffItem(data, getKey, onDiff) {
|
|
106
85
|
var _React$useState = React__namespace.useState(data),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
86
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
87
|
+
prevData = _React$useState2[0],
|
|
88
|
+
setPrevData = _React$useState2[1];
|
|
111
89
|
var _React$useState3 = React__namespace.useState(null),
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
90
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
91
|
+
diffItem = _React$useState4[0],
|
|
92
|
+
setDiffItem = _React$useState4[1];
|
|
116
93
|
React__namespace.useEffect(function () {
|
|
117
94
|
var diff = algorithmUtil.findListDiffIndex(prevData || [], data || [], getKey);
|
|
118
|
-
|
|
119
95
|
if ((diff === null || diff === void 0 ? void 0 : diff.index) !== undefined) {
|
|
120
96
|
onDiff === null || onDiff === void 0 ? void 0 : onDiff(diff.index);
|
|
121
97
|
setDiffItem(data[diff.index]);
|
|
122
98
|
}
|
|
123
|
-
|
|
124
99
|
setPrevData(data);
|
|
125
100
|
}, [data]);
|
|
126
101
|
return [diffItem];
|
|
127
102
|
}
|
|
128
|
-
|
|
129
103
|
exports["default"] = useDiffItem;
|
|
@@ -12,15 +12,10 @@
|
|
|
12
12
|
Object.defineProperty(exports, '__esModule', {
|
|
13
13
|
value: true
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
var React = require('react');
|
|
17
|
-
|
|
18
16
|
var raf = require('../../../rc-util/es/raf.js');
|
|
19
|
-
|
|
20
17
|
var isFirefox = require('../utils/isFirefox.js');
|
|
21
|
-
|
|
22
18
|
var useOriginScroll = require('./useOriginScroll.js');
|
|
23
|
-
|
|
24
19
|
function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, onWheelDelta) {
|
|
25
20
|
var offsetRef = React.useRef(0);
|
|
26
21
|
var nextFrameRef = React.useRef(null); // Firefox patch
|
|
@@ -29,7 +24,6 @@ function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, onWheelDelta)
|
|
|
29
24
|
var isMouseScrollRef = React.useRef(false); // Scroll status sync
|
|
30
25
|
|
|
31
26
|
var originScroll = useOriginScroll["default"](isScrollAtTop, isScrollAtBottom);
|
|
32
|
-
|
|
33
27
|
function onWheel(event) {
|
|
34
28
|
if (!inVirtual) return;
|
|
35
29
|
raf["default"].cancel(nextFrameRef.current);
|
|
@@ -42,7 +36,6 @@ function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, onWheelDelta)
|
|
|
42
36
|
if (!isFirefox["default"]) {
|
|
43
37
|
event.preventDefault();
|
|
44
38
|
}
|
|
45
|
-
|
|
46
39
|
nextFrameRef.current = raf["default"](function () {
|
|
47
40
|
// Patch a multiple for Firefox to fix wheel number too small
|
|
48
41
|
// ref: https://github.com/ant-design/ant-design/issues/26372#issuecomment-679460266
|
|
@@ -52,13 +45,10 @@ function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, onWheelDelta)
|
|
|
52
45
|
});
|
|
53
46
|
} // A patch for firefox
|
|
54
47
|
|
|
55
|
-
|
|
56
48
|
function onFireFoxScroll(event) {
|
|
57
49
|
if (!inVirtual) return;
|
|
58
50
|
isMouseScrollRef.current = event.detail === wheelValueRef.current;
|
|
59
51
|
}
|
|
60
|
-
|
|
61
52
|
return [onWheel, onFireFoxScroll];
|
|
62
53
|
}
|
|
63
|
-
|
|
64
54
|
exports["default"] = useFrameWheel;
|