@zhenliang/sheet 0.1.32 → 0.1.33

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.
@@ -6,7 +6,6 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { useEffect, useImperativeHandle, useMemo, useRef } from 'react';
8
8
  // import ReduxLogger from 'redux-logger';
9
- import cls from 'classnames';
10
9
  import ReduxThunk from 'redux-thunk';
11
10
  import DefaultRow from "./DefaultRow";
12
11
  import DefaultShell from "./DefaultShell";
@@ -55,10 +54,7 @@ var Sheet = function Sheet(props) {
55
54
  scroll = props.scroll,
56
55
  children = props.children,
57
56
  showBackEdit = props.showBackEdit,
58
- backEditStyle = props.backEditStyle,
59
- _props$boldScroll = props.boldScroll,
60
- boldScroll = _props$boldScroll === void 0 ? true : _props$boldScroll;
61
- var scrollWarpRef = useRef(null);
57
+ backEditStyle = props.backEditStyle;
62
58
  var sheetWrapperRef = useRef(null);
63
59
  var contextMenuRef = useRef(null);
64
60
  var eventBus = useEventBus();
@@ -231,46 +227,34 @@ var Sheet = function Sheet(props) {
231
227
  }
232
228
  return null;
233
229
  }, [isEmptyData, emptyRenderer]);
234
- var hasHorizontalScrollbar = scrollWarpRef.current && scrollWarpRef.current.scrollWidth > scrollWarpRef.current.clientWidth;
235
230
  return /*#__PURE__*/_jsx(SheetEventContext.Provider, {
236
231
  value: eventBus,
237
232
  children: /*#__PURE__*/_jsxs("span", {
238
- children: [/*#__PURE__*/_jsx("div", {
239
- ref: scrollWarpRef,
233
+ children: [/*#__PURE__*/_jsxs("span", {
234
+ ref: sheetWrapperRef,
235
+ tabIndex: 0,
236
+ className: classNames('harvest harvest-sheet-container', className),
240
237
  style: {
241
- overflow: 'auto'
238
+ maxHeight: (_scroll$y = scroll === null || scroll === void 0 ? void 0 : scroll.y) !== null && _scroll$y !== void 0 ? _scroll$y : memoHeight,
239
+ width: (_scroll$x = scroll === null || scroll === void 0 ? void 0 : scroll.x) !== null && _scroll$x !== void 0 ? _scroll$x : '100%'
242
240
  },
243
- className: cls({
244
- tableWarpScroll: hasHorizontalScrollbar && boldScroll
245
- }),
246
- children: /*#__PURE__*/_jsxs("span", {
247
- ref: sheetWrapperRef,
248
- tabIndex: 0,
249
- className: classNames('harvest harvest-sheet-container', className),
250
- style: {
251
- maxHeight: (_scroll$y = scroll === null || scroll === void 0 ? void 0 : scroll.y) !== null && _scroll$y !== void 0 ? _scroll$y : memoHeight,
252
- width: (_scroll$x = scroll === null || scroll === void 0 ? void 0 : scroll.x) !== null && _scroll$x !== void 0 ? _scroll$x : 'calc(100% - 1px)'
253
- },
254
- children: [/*#__PURE__*/_jsxs(SheetShell, {
255
- className: classNames('harvest-sheet', className),
256
- children: [/*#__PURE__*/_jsx(VirtualizeStart, {
257
- virtualized: virtualized,
258
- paddingTop: paddingTop
259
- }), rowElements, /*#__PURE__*/_jsx(VirtualizeEnd, {
260
- virtualized: virtualized,
261
- paddingBottom: paddingBottom
262
- })]
263
- }, "sheet"), /*#__PURE__*/_jsx(Menu, {
264
- ref: contextMenuRef,
265
- position: menu.position,
266
- cell: menu.cellPosition,
267
- showMenu: menu.showMenu,
268
- contextMenu: ContextMenu,
269
- onContextMenu: onContextMenu
270
- }), /*#__PURE__*/_jsx("div", {
271
- className: 'sheet-pd10'
241
+ children: [/*#__PURE__*/_jsxs(SheetShell, {
242
+ className: classNames('harvest-sheet', className),
243
+ children: [/*#__PURE__*/_jsx(VirtualizeStart, {
244
+ virtualized: virtualized,
245
+ paddingTop: paddingTop
246
+ }), rowElements, /*#__PURE__*/_jsx(VirtualizeEnd, {
247
+ virtualized: virtualized,
248
+ paddingBottom: paddingBottom
272
249
  })]
273
- })
250
+ }, "sheet"), /*#__PURE__*/_jsx(Menu, {
251
+ ref: contextMenuRef,
252
+ position: menu.position,
253
+ cell: menu.cellPosition,
254
+ showMenu: menu.showMenu,
255
+ contextMenu: ContextMenu,
256
+ onContextMenu: onContextMenu
257
+ })]
274
258
  }), EmptyElement, /*#__PURE__*/_jsxs("div", {
275
259
  className: "harvest-sheet-control",
276
260
  children: [children, /*#__PURE__*/_jsx(Control, {
@@ -1,30 +1,7 @@
1
1
  @import './var.less';
2
2
 
3
- .sheet-pd10 {
4
- height: 0;
5
- }
6
-
7
- .tableWarpScroll {
8
- &::-webkit-scrollbar {
9
- display: none;
10
- }
11
-
12
- &:hover {
13
- margin-bottom: 10px;
14
-
15
- .sheet-pd10 {
16
- height: 10px;
17
- }
18
-
19
- &::-webkit-scrollbar {
20
- display: block;
21
- height: 10px;
22
- }
23
- }
24
-
25
- }
26
-
27
3
  .harvest-sheet-container{
4
+ overflow: auto;
28
5
  display: block;
29
6
  position: relative ;
30
7
  // scroll-behavior:smooth;
@@ -69,7 +46,10 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
69
46
  .harvest-sheet-container .harvest-sheet .cell {
70
47
  height: 17px;
71
48
  font-size: var(--cell-font-size);
72
- padding:var(--cell-padding-vertical) var(--cell-padding-horizontal) var(--cell-padding-vertical) var(--cell-padding-horizontal);
49
+ padding-left:var(--cell-padding-horizontal);
50
+ padding-right:var(--cell-padding-horizontal);
51
+ padding-top:var(--cell-padding-vertical);
52
+ padding-bottom:var(--cell-padding-vertical);
73
53
  border: 1px solid var(--cell-border-color);
74
54
  background-color: var(--cell-background-color);
75
55
  cursor: cell;
@@ -114,7 +114,6 @@ export type SheetProps = {
114
114
  };
115
115
  rowClassName?: string | ((record: Record<string, unknown>, index: number) => string);
116
116
  children?: any[];
117
- boldScroll?: boolean;
118
117
  };
119
118
  export type WidthConfigContext = {
120
119
  onChange?: (value: Record<number | string, number>) => void;
@@ -87,5 +87,4 @@ export type TableProps = {
87
87
  onChange: (changes: TableChange[], extChanges?: TableChange[]) => void;
88
88
  handleAdd?: () => void;
89
89
  eventHandler?: Record<'reverse' | 'btn-click' | 'cell-edit' | 'cell-switch' | string, undefined | EventHandler>;
90
- boldScroll?: boolean;
91
90
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.32",
3
+ "version": "0.1.33",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",