@zhenliang/sheet 0.1.61 → 0.1.63

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.
@@ -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, useState } from 'react';
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, _sheetWrapperRef$curr5;
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
@@ -56,7 +56,8 @@ var Sheet = function Sheet(props) {
56
56
  rowClassName = props.rowClassName,
57
57
  scroll = props.scroll,
58
58
  children = props.children,
59
- showBackEdit = props.showBackEdit,
59
+ _props$showBackEdit = props.showBackEdit,
60
+ showBackEdit = _props$showBackEdit === void 0 ? true : _props$showBackEdit,
60
61
  backEditStyle = props.backEditStyle,
61
62
  _props$boldScroll = props.boldScroll,
62
63
  boldScroll = _props$boldScroll === void 0 ? true : _props$boldScroll,
@@ -64,12 +65,7 @@ var Sheet = function Sheet(props) {
64
65
  hideColBar = _props$hideColBar === void 0 ? true : _props$hideColBar,
65
66
  _props$showQuickLocat = props.showQuickLocationBtn,
66
67
  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];
68
+ ControlContainer = props.ControlContainer;
73
69
  var sheetWrapperRef = useRef(null);
74
70
  var contextMenuRef = useRef(null);
75
71
  var eventBus = useEventBus();
@@ -269,20 +265,6 @@ var Sheet = function Sheet(props) {
269
265
  return null;
270
266
  }, [isEmptyData, emptyRenderer]);
271
267
  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
268
  return /*#__PURE__*/_jsx(SheetEventContext.Provider, {
287
269
  value: eventBus,
288
270
  children: /*#__PURE__*/_jsxs(_Fragment, {
@@ -298,12 +280,6 @@ var Sheet = function Sheet(props) {
298
280
  maxHeight: (_scroll$y = scroll === null || scroll === void 0 ? void 0 : scroll.y) !== null && _scroll$y !== void 0 ? _scroll$y : memoHeight,
299
281
  width: (_scroll$x = scroll === null || scroll === void 0 ? void 0 : scroll.x) !== null && _scroll$x !== void 0 ? _scroll$x : '100%'
300
282
  },
301
- onMouseOver: function onMouseOver() {
302
- return setMouseOnTable(true);
303
- },
304
- onMouseLeave: function onMouseLeave() {
305
- return setMouseOnTable(false);
306
- },
307
283
  children: [/*#__PURE__*/_jsxs(SheetShell, {
308
284
  className: classNames('harvest-sheet', className),
309
285
  children: [/*#__PURE__*/_jsx(VirtualizeStart, {
@@ -321,16 +297,8 @@ var Sheet = function Sheet(props) {
321
297
  contextMenu: ContextMenu,
322
298
  onContextMenu: onContextMenu
323
299
  }), EmptyElement]
324
- }), /*#__PURE__*/_jsx("div", {
325
- style: {
326
- height: offSetBottom
327
- }
328
300
  }), /*#__PURE__*/_jsxs("div", {
329
301
  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
302
  children: [/*#__PURE__*/_jsx(Control, {
335
303
  showBackEdit: showBackEdit,
336
304
  startRowVisible: startRowVisible,
@@ -292,19 +292,18 @@ span.harvest-sheet-container:focus {
292
292
  }
293
293
 
294
294
  .harvest-sheet-control {
295
- position: absolute;
296
- z-index: 3;
297
- left: 0;
295
+ display: flex;
296
+ flex-direction: row-reverse;
298
297
  }
299
298
 
300
299
  .harvest-sheet-control .control {
301
- margin: 4px 1px 4px 0;
302
300
  display: flex;
303
301
  align-items: center;
304
302
  flex-direction: row;
305
303
  justify-content: flex-end;
306
- border-radius: 2px;
307
304
  height: 24px;
305
+ margin-left: 5px;
306
+ margin-top: 4px;
308
307
  .control-item {
309
308
  margin-right: 4px;
310
309
  &:last-child {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.61",
3
+ "version": "0.1.63",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",