@zhenliang/sheet 0.1.61 → 0.1.62
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/dist/core/sheet/index.js
CHANGED
|
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { useEffect, useImperativeHandle, useMemo, useRef
|
|
7
|
+
import { useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
8
8
|
// import ReduxLogger from 'redux-logger';
|
|
9
9
|
import ReduxThunk from 'redux-thunk';
|
|
10
10
|
import DefaultRow from "./DefaultRow";
|
|
@@ -31,7 +31,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
31
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
32
32
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
33
33
|
var Sheet = function Sheet(props) {
|
|
34
|
-
var _visibleData$length, _scroll$y, _scroll$x
|
|
34
|
+
var _visibleData$length, _scroll$y, _scroll$x;
|
|
35
35
|
var _props$sheetInstance = props.sheetInstance,
|
|
36
36
|
sheetInstance = _props$sheetInstance === void 0 ? {
|
|
37
37
|
current: null
|
|
@@ -64,12 +64,7 @@ var Sheet = function Sheet(props) {
|
|
|
64
64
|
hideColBar = _props$hideColBar === void 0 ? true : _props$hideColBar,
|
|
65
65
|
_props$showQuickLocat = props.showQuickLocationBtn,
|
|
66
66
|
showQuickLocationBtn = _props$showQuickLocat === void 0 ? false : _props$showQuickLocat,
|
|
67
|
-
ControlContainer = props.ControlContainer
|
|
68
|
-
handleAdd = props.handleAdd;
|
|
69
|
-
var _useState = useState(false),
|
|
70
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
71
|
-
mouseOnTable = _useState2[0],
|
|
72
|
-
setMouseOnTable = _useState2[1];
|
|
67
|
+
ControlContainer = props.ControlContainer;
|
|
73
68
|
var sheetWrapperRef = useRef(null);
|
|
74
69
|
var contextMenuRef = useRef(null);
|
|
75
70
|
var eventBus = useEventBus();
|
|
@@ -269,20 +264,6 @@ var Sheet = function Sheet(props) {
|
|
|
269
264
|
return null;
|
|
270
265
|
}, [isEmptyData, emptyRenderer]);
|
|
271
266
|
var hasHorizontalScrollbar = sheetWrapperRef.current && sheetWrapperRef.current.scrollWidth > sheetWrapperRef.current.clientWidth;
|
|
272
|
-
// 解决滚动条出现
|
|
273
|
-
var offSetBottom = useMemo(function () {
|
|
274
|
-
var height = 0;
|
|
275
|
-
if (handleAdd) {
|
|
276
|
-
height += 32;
|
|
277
|
-
}
|
|
278
|
-
if (showBackEdit || showQuickLocationBtn) {
|
|
279
|
-
height += 24;
|
|
280
|
-
}
|
|
281
|
-
if (height > 0 && hasHorizontalScrollbar && boldScroll && mouseOnTable) {
|
|
282
|
-
height -= 30;
|
|
283
|
-
}
|
|
284
|
-
return height;
|
|
285
|
-
}, [handleAdd, showBackEdit, showQuickLocationBtn, hasHorizontalScrollbar, boldScroll, mouseOnTable]);
|
|
286
267
|
return /*#__PURE__*/_jsx(SheetEventContext.Provider, {
|
|
287
268
|
value: eventBus,
|
|
288
269
|
children: /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -298,12 +279,6 @@ var Sheet = function Sheet(props) {
|
|
|
298
279
|
maxHeight: (_scroll$y = scroll === null || scroll === void 0 ? void 0 : scroll.y) !== null && _scroll$y !== void 0 ? _scroll$y : memoHeight,
|
|
299
280
|
width: (_scroll$x = scroll === null || scroll === void 0 ? void 0 : scroll.x) !== null && _scroll$x !== void 0 ? _scroll$x : '100%'
|
|
300
281
|
},
|
|
301
|
-
onMouseOver: function onMouseOver() {
|
|
302
|
-
return setMouseOnTable(true);
|
|
303
|
-
},
|
|
304
|
-
onMouseLeave: function onMouseLeave() {
|
|
305
|
-
return setMouseOnTable(false);
|
|
306
|
-
},
|
|
307
282
|
children: [/*#__PURE__*/_jsxs(SheetShell, {
|
|
308
283
|
className: classNames('harvest-sheet', className),
|
|
309
284
|
children: [/*#__PURE__*/_jsx(VirtualizeStart, {
|
|
@@ -321,16 +296,8 @@ var Sheet = function Sheet(props) {
|
|
|
321
296
|
contextMenu: ContextMenu,
|
|
322
297
|
onContextMenu: onContextMenu
|
|
323
298
|
}), EmptyElement]
|
|
324
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
325
|
-
style: {
|
|
326
|
-
height: offSetBottom
|
|
327
|
-
}
|
|
328
299
|
}), /*#__PURE__*/_jsxs("div", {
|
|
329
300
|
className: "harvest-sheet-control",
|
|
330
|
-
style: {
|
|
331
|
-
top: (_sheetWrapperRef$curr5 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr5 === void 0 ? void 0 : _sheetWrapperRef$curr5.clientHeight,
|
|
332
|
-
width: '100%'
|
|
333
|
-
},
|
|
334
301
|
children: [/*#__PURE__*/_jsx(Control, {
|
|
335
302
|
showBackEdit: showBackEdit,
|
|
336
303
|
startRowVisible: startRowVisible,
|