@zhenliang/sheet 0.1.32 → 0.1.34

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.
@@ -73,7 +73,7 @@ export var getNumberEditor = function getNumberEditor(extraProps, getExtraProps)
73
73
  */
74
74
  var valueParser = baseFormatter;
75
75
  var handleChange = useCallback(function (value) {
76
- onChange && onChange(value ? value : null);
76
+ onChange && onChange(!isNil(value) ? value : null);
77
77
  }, [onChange]);
78
78
  return /*#__PURE__*/_jsx(AntInputNumber, _objectSpread(_objectSpread({
79
79
  ref: inputNumberRef
@@ -58,7 +58,6 @@ var Sheet = function Sheet(props) {
58
58
  backEditStyle = props.backEditStyle,
59
59
  _props$boldScroll = props.boldScroll,
60
60
  boldScroll = _props$boldScroll === void 0 ? true : _props$boldScroll;
61
- var scrollWarpRef = useRef(null);
62
61
  var sheetWrapperRef = useRef(null);
63
62
  var contextMenuRef = useRef(null);
64
63
  var eventBus = useEventBus();
@@ -231,46 +230,37 @@ var Sheet = function Sheet(props) {
231
230
  }
232
231
  return null;
233
232
  }, [isEmptyData, emptyRenderer]);
234
- var hasHorizontalScrollbar = scrollWarpRef.current && scrollWarpRef.current.scrollWidth > scrollWarpRef.current.clientWidth;
233
+ var hasHorizontalScrollbar = sheetWrapperRef.current && sheetWrapperRef.current.scrollWidth > sheetWrapperRef.current.clientWidth;
235
234
  return /*#__PURE__*/_jsx(SheetEventContext.Provider, {
236
235
  value: eventBus,
237
236
  children: /*#__PURE__*/_jsxs("span", {
238
- children: [/*#__PURE__*/_jsx("div", {
239
- ref: scrollWarpRef,
237
+ children: [/*#__PURE__*/_jsxs("span", {
238
+ ref: sheetWrapperRef,
239
+ tabIndex: 0,
240
+ className: classNames('harvest harvest-sheet-container', className, cls({
241
+ tableWarpScroll: hasHorizontalScrollbar && boldScroll
242
+ })),
240
243
  style: {
241
- overflow: 'auto'
244
+ maxHeight: (_scroll$y = scroll === null || scroll === void 0 ? void 0 : scroll.y) !== null && _scroll$y !== void 0 ? _scroll$y : memoHeight,
245
+ width: (_scroll$x = scroll === null || scroll === void 0 ? void 0 : scroll.x) !== null && _scroll$x !== void 0 ? _scroll$x : '100%'
242
246
  },
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'
247
+ children: [/*#__PURE__*/_jsxs(SheetShell, {
248
+ className: classNames('harvest-sheet', className),
249
+ children: [/*#__PURE__*/_jsx(VirtualizeStart, {
250
+ virtualized: virtualized,
251
+ paddingTop: paddingTop
252
+ }), rowElements, /*#__PURE__*/_jsx(VirtualizeEnd, {
253
+ virtualized: virtualized,
254
+ paddingBottom: paddingBottom
272
255
  })]
273
- })
256
+ }, "sheet"), /*#__PURE__*/_jsx(Menu, {
257
+ ref: contextMenuRef,
258
+ position: menu.position,
259
+ cell: menu.cellPosition,
260
+ showMenu: menu.showMenu,
261
+ contextMenu: ContextMenu,
262
+ onContextMenu: onContextMenu
263
+ })]
274
264
  }), EmptyElement, /*#__PURE__*/_jsxs("div", {
275
265
  className: "harvest-sheet-control",
276
266
  children: [children, /*#__PURE__*/_jsx(Control, {
@@ -1,9 +1,5 @@
1
1
  @import './var.less';
2
2
 
3
- .sheet-pd10 {
4
- height: 0;
5
- }
6
-
7
3
  .tableWarpScroll {
8
4
  &::-webkit-scrollbar {
9
5
  display: none;
@@ -12,14 +8,16 @@
12
8
  &:hover {
13
9
  margin-bottom: 10px;
14
10
 
15
- .sheet-pd10 {
16
- height: 10px;
17
- }
18
-
19
11
  &::-webkit-scrollbar {
20
12
  display: block;
13
+ height: 20px;
14
+ }
15
+
16
+ &::-webkit-scrollbar-thumb {
17
+ border-top: 10px solid #fff;
21
18
  height: 10px;
22
19
  }
20
+
23
21
  }
24
22
 
25
23
  }
@@ -28,6 +26,7 @@
28
26
  display: block;
29
27
  position: relative ;
30
28
  // scroll-behavior:smooth;
29
+ overflow: auto;
31
30
  }
32
31
 
33
32
  .harvest-sheet-container .header{
@@ -40,7 +39,7 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
40
39
  }
41
40
 
42
41
  .harvest-sheet-container .harvest-sheet {
43
- width: 100%;
42
+ width: calc(100% - 1px);
44
43
  border-collapse: collapse;
45
44
  table-layout: fixed;
46
45
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",