@zhenliang/sheet 0.1.33 → 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
@@ -6,6 +6,7 @@ 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';
9
10
  import ReduxThunk from 'redux-thunk';
10
11
  import DefaultRow from "./DefaultRow";
11
12
  import DefaultShell from "./DefaultShell";
@@ -54,7 +55,9 @@ var Sheet = function Sheet(props) {
54
55
  scroll = props.scroll,
55
56
  children = props.children,
56
57
  showBackEdit = props.showBackEdit,
57
- backEditStyle = props.backEditStyle;
58
+ backEditStyle = props.backEditStyle,
59
+ _props$boldScroll = props.boldScroll,
60
+ boldScroll = _props$boldScroll === void 0 ? true : _props$boldScroll;
58
61
  var sheetWrapperRef = useRef(null);
59
62
  var contextMenuRef = useRef(null);
60
63
  var eventBus = useEventBus();
@@ -227,13 +230,16 @@ var Sheet = function Sheet(props) {
227
230
  }
228
231
  return null;
229
232
  }, [isEmptyData, emptyRenderer]);
233
+ var hasHorizontalScrollbar = sheetWrapperRef.current && sheetWrapperRef.current.scrollWidth > sheetWrapperRef.current.clientWidth;
230
234
  return /*#__PURE__*/_jsx(SheetEventContext.Provider, {
231
235
  value: eventBus,
232
236
  children: /*#__PURE__*/_jsxs("span", {
233
237
  children: [/*#__PURE__*/_jsxs("span", {
234
238
  ref: sheetWrapperRef,
235
239
  tabIndex: 0,
236
- className: classNames('harvest harvest-sheet-container', className),
240
+ className: classNames('harvest harvest-sheet-container', className, cls({
241
+ tableWarpScroll: hasHorizontalScrollbar && boldScroll
242
+ })),
237
243
  style: {
238
244
  maxHeight: (_scroll$y = scroll === null || scroll === void 0 ? void 0 : scroll.y) !== null && _scroll$y !== void 0 ? _scroll$y : memoHeight,
239
245
  width: (_scroll$x = scroll === null || scroll === void 0 ? void 0 : scroll.x) !== null && _scroll$x !== void 0 ? _scroll$x : '100%'
@@ -1,10 +1,32 @@
1
1
  @import './var.less';
2
2
 
3
+ .tableWarpScroll {
4
+ &::-webkit-scrollbar {
5
+ display: none;
6
+ }
7
+
8
+ &:hover {
9
+ margin-bottom: 10px;
10
+
11
+ &::-webkit-scrollbar {
12
+ display: block;
13
+ height: 20px;
14
+ }
15
+
16
+ &::-webkit-scrollbar-thumb {
17
+ border-top: 10px solid #fff;
18
+ height: 10px;
19
+ }
20
+
21
+ }
22
+
23
+ }
24
+
3
25
  .harvest-sheet-container{
4
- overflow: auto;
5
26
  display: block;
6
27
  position: relative ;
7
28
  // scroll-behavior:smooth;
29
+ overflow: auto;
8
30
  }
9
31
 
10
32
  .harvest-sheet-container .header{
@@ -17,7 +39,7 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
17
39
  }
18
40
 
19
41
  .harvest-sheet-container .harvest-sheet {
20
- width: 100%;
42
+ width: calc(100% - 1px);
21
43
  border-collapse: collapse;
22
44
  table-layout: fixed;
23
45
 
@@ -46,10 +68,7 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
46
68
  .harvest-sheet-container .harvest-sheet .cell {
47
69
  height: 17px;
48
70
  font-size: var(--cell-font-size);
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);
71
+ padding:var(--cell-padding-vertical) var(--cell-padding-horizontal) var(--cell-padding-vertical) var(--cell-padding-horizontal);
53
72
  border: 1px solid var(--cell-border-color);
54
73
  background-color: var(--cell-background-color);
55
74
  cursor: cell;
@@ -114,6 +114,7 @@ export type SheetProps = {
114
114
  };
115
115
  rowClassName?: string | ((record: Record<string, unknown>, index: number) => string);
116
116
  children?: any[];
117
+ boldScroll?: boolean;
117
118
  };
118
119
  export type WidthConfigContext = {
119
120
  onChange?: (value: Record<number | string, number>) => void;
@@ -87,4 +87,5 @@ 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;
90
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.33",
3
+ "version": "0.1.34",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",