@zhenliang/sheet 0.1.4 → 0.1.7-3.beta.0

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.
Files changed (117) hide show
  1. package/dist/assets/arrow-mac-down.svg +19 -0
  2. package/dist/assets/arrow-mac-right.svg +17 -0
  3. package/dist/assets/arrow-windows-down.svg +17 -0
  4. package/dist/assets/arrow-windows-right.svg +17 -0
  5. package/dist/core/config.d.ts +3 -0
  6. package/dist/core/config.js +4 -1
  7. package/dist/core/editor/cascaderEditor/index.d.ts +1 -1
  8. package/dist/core/editor/cascaderEditor/index.js +12 -11
  9. package/dist/core/editor/cascaderEditor/index.less +15 -7
  10. package/dist/core/editor/dateEditor/index.js +31 -8
  11. package/dist/core/editor/dateEditor/index.less +9 -2
  12. package/dist/core/editor/numberEditor/index.d.ts +3 -1
  13. package/dist/core/editor/numberEditor/index.js +62 -27
  14. package/dist/core/editor/numberEditor/index.less +3 -2
  15. package/dist/core/editor/selectEditor/index.d.ts +1 -1
  16. package/dist/core/editor/selectEditor/index.js +34 -19
  17. package/dist/core/editor/selectEditor/index.less +16 -5
  18. package/dist/core/reducers/index.d.ts +2 -2
  19. package/dist/core/reducers/index.js +8 -1
  20. package/dist/core/reducers/keyboardReducer.js +39 -9
  21. package/dist/core/reducers/mouseReducer.js +115 -11
  22. package/dist/core/reducers/sideEffectReducer.d.ts +1 -1
  23. package/dist/core/reducers/sideEffectReducer.js +146 -41
  24. package/dist/core/reducers/stateReducer.d.ts +1 -0
  25. package/dist/core/reducers/stateReducer.js +96 -27
  26. package/dist/core/sheet/Cell.d.ts +1 -1
  27. package/dist/core/sheet/Cell.js +33 -24
  28. package/dist/core/sheet/Control.d.ts +21 -0
  29. package/dist/core/sheet/Control.js +83 -0
  30. package/dist/core/sheet/DataEditor.js +3 -3
  31. package/dist/core/sheet/DefaultCell.d.ts +8 -3
  32. package/dist/core/sheet/DefaultCell.js +12 -8
  33. package/dist/core/sheet/DefaultRow.js +3 -9
  34. package/dist/core/sheet/DefaultRowMapper.d.ts +3 -0
  35. package/dist/core/sheet/DefaultRowMapper.js +22 -6
  36. package/dist/core/sheet/DefaultShell.js +1 -1
  37. package/dist/core/sheet/Event.d.ts +1 -1
  38. package/dist/core/sheet/Event.js +1 -1
  39. package/dist/core/sheet/Menu.d.ts +6 -0
  40. package/dist/core/sheet/Menu.js +21 -0
  41. package/dist/core/sheet/ValueViewer.js +1 -1
  42. package/dist/core/sheet/index.js +249 -88
  43. package/dist/core/sheet/index.less +199 -107
  44. package/dist/core/sheet/searchInput.d.ts +15 -0
  45. package/dist/core/sheet/searchInput.js +78 -0
  46. package/dist/core/sheet/useCellEvent.js +1 -1
  47. package/dist/core/sheet/useContextMenu.d.ts +1 -1
  48. package/dist/core/sheet/useContextMenu.js +13 -10
  49. package/dist/core/sheet/useKeyBoardEvent.js +19 -2
  50. package/dist/core/sheet/useMouseEvent.js +19 -12
  51. package/dist/core/sheet/useSearchInput.d.ts +11 -0
  52. package/dist/core/sheet/useSearchInput.js +65 -0
  53. package/dist/core/sheet/useSelectVisible.d.ts +1 -1
  54. package/dist/core/sheet/useSelectVisible.js +17 -7
  55. package/dist/core/sheet/useVirtualList.d.ts +10 -1
  56. package/dist/core/sheet/useVirtualList.js +44 -28
  57. package/dist/core/sheet/var.less +41 -34
  58. package/dist/core/shell/draggableShell/index.d.ts +4 -1
  59. package/dist/core/shell/draggableShell/index.js +133 -50
  60. package/dist/core/shell/tableShell.d.ts +4 -1
  61. package/dist/core/shell/tableShell.js +82 -34
  62. package/dist/core/table/addButton.d.ts +6 -0
  63. package/dist/core/table/addButton.js +103 -0
  64. package/dist/core/table/events.d.ts +1 -3
  65. package/dist/core/table/events.js +30 -35
  66. package/dist/core/table/index.js +97 -189
  67. package/dist/core/table/index.less +12 -0
  68. package/dist/core/table/useGroupConfig.d.ts +4 -1
  69. package/dist/core/table/useGroupConfig.js +139 -14
  70. package/dist/core/table/useRowSelection.d.ts +3 -0
  71. package/dist/core/table/useRowSelection.js +68 -2
  72. package/dist/core/util.d.ts +10 -4
  73. package/dist/core/util.js +121 -69
  74. package/dist/core/viewer/btnViewer/index.js +3 -3
  75. package/dist/core/viewer/cascaderViewer/index.js +6 -1
  76. package/dist/core/viewer/checkViewer/index.js +2 -2
  77. package/dist/core/viewer/editViewer/index.js +3 -3
  78. package/dist/core/viewer/groupViewer/index.js +26 -10
  79. package/dist/core/viewer/selectorViewer/index.js +7 -3
  80. package/dist/core/viewer/switchViewer/index.js +10 -4
  81. package/dist/example/antComponent.d.ts +1 -1
  82. package/dist/example/antComponent.js +63 -37
  83. package/dist/example/basic.d.ts +1 -1
  84. package/dist/example/basic.js +20 -14
  85. package/dist/example/ellipsis.d.ts +1 -1
  86. package/dist/example/ellipsis.js +3 -2
  87. package/dist/example/fixed.d.ts +1 -1
  88. package/dist/example/fixed.js +3 -2
  89. package/dist/example/group.js +40 -17
  90. package/dist/example/selection.d.ts +1 -1
  91. package/dist/example/selection.js +9 -8
  92. package/dist/example/sheet.d.ts +1 -1
  93. package/dist/example/sheet.js +21 -22
  94. package/dist/example/valuationAnalyze.d.ts +1 -0
  95. package/dist/example/valuationAnalyze.js +3 -4
  96. package/dist/hooks/index.d.ts +1 -1
  97. package/dist/hooks/index.js +1 -1
  98. package/dist/hooks/useEventBus.d.ts +1 -0
  99. package/dist/hooks/useEventBus.js +2 -2
  100. package/dist/hooks/useGroupConfig.d.ts +4 -0
  101. package/dist/hooks/useGroupConfig.js +5 -0
  102. package/dist/hooks/useKeyboard.d.ts +5 -2
  103. package/dist/hooks/useKeyboard.js +17 -3
  104. package/dist/hooks/useMiddlewareReducer.d.ts +5 -5
  105. package/dist/hooks/useMiddlewareReducer.js +3 -3
  106. package/dist/hooks/useMouse.d.ts +1 -1
  107. package/dist/hooks/useMouse.js +7 -7
  108. package/dist/hooks/useSetState.js +7 -7
  109. package/dist/hooks/useSheetEvent.d.ts +1 -1
  110. package/dist/hooks/useSheetEvent.js +2 -2
  111. package/dist/hooks/useWidthConfig.d.ts +3 -3
  112. package/dist/hooks/useWidthConfig.js +2 -2
  113. package/dist/standardUtils/index.d.ts +1 -1
  114. package/dist/standardUtils/index.js +1 -1
  115. package/dist/type/sheet.d.ts +77 -31
  116. package/dist/type/sheetTable.d.ts +21 -12
  117. package/package.json +7 -4
@@ -2,34 +2,20 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
2
2
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
3
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
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
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
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
7
  import { isNil } from 'lodash';
8
- import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
8
+ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from "../../../node_modules/@types/react";
9
9
  import { useSetState, useSheetEvent } from "../../hooks";
10
10
  import { renderValue } from "../util";
11
11
  import DataEditor from "./DataEditor";
12
12
  import DefaultCell from "./DefaultCell";
13
13
  import ValueViewer from "./ValueViewer";
14
- import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
15
15
  function initialData(_ref) {
16
16
  var cell = _ref.cell;
17
17
  return renderValue(cell);
18
18
  }
19
- function widthStyle(cell) {
20
- var width = typeof (cell === null || cell === void 0 ? void 0 : cell.width) === 'number' ? "".concat(cell.width, "px") : cell.width;
21
- var align = cell.align || 'left';
22
- var position = cell.fixed ? 'sticky' : 'unset';
23
- var left = cell.fixed === 'left' ? 0 : 'unset';
24
- var right = cell.fixed === 'right' ? 0 : 'unset';
25
- return {
26
- width: width,
27
- textAlign: align,
28
- position: position,
29
- left: left,
30
- right: right
31
- };
32
- }
33
19
  var Cell = function Cell(props) {
34
20
  var _cell$editable;
35
21
  var row = props.row,
@@ -39,7 +25,8 @@ var Cell = function Cell(props) {
39
25
  CellRenderer = _props$cellRenderer === void 0 ? DefaultCell : _props$cellRenderer,
40
26
  dataEditor = props.dataEditor,
41
27
  valueViewer = props.valueViewer,
42
- attributesRenderer = props.attributesRenderer;
28
+ attributesRenderer = props.attributesRenderer,
29
+ cellFixedInfo = props.cellFixedInfo;
43
30
  var eventBus = useSheetEvent();
44
31
  var _useSetState = useSetState(),
45
32
  _useSetState2 = _slicedToArray(_useSetState, 2),
@@ -70,7 +57,7 @@ var Cell = function Cell(props) {
70
57
  } else if (eventInfo.value && eventInfo.editing) {
71
58
  var _cell$dataEditor, _cell$dataEditor2, _cell$dataEditor2$par;
72
59
  // 单元格直接键盘编辑,设置为输入值
73
- setValue((_cell$dataEditor = cell.dataEditor) !== null && _cell$dataEditor !== void 0 && _cell$dataEditor.parser ? cell === null || cell === void 0 ? void 0 : (_cell$dataEditor2 = cell.dataEditor) === null || _cell$dataEditor2 === void 0 ? void 0 : (_cell$dataEditor2$par = _cell$dataEditor2.parser) === null || _cell$dataEditor2$par === void 0 ? void 0 : _cell$dataEditor2$par.call(_cell$dataEditor2, eventInfo.value) : value);
60
+ setValue((_cell$dataEditor = cell.dataEditor) !== null && _cell$dataEditor !== void 0 && _cell$dataEditor.parser ? cell === null || cell === void 0 || (_cell$dataEditor2 = cell.dataEditor) === null || _cell$dataEditor2 === void 0 || (_cell$dataEditor2$par = _cell$dataEditor2.parser) === null || _cell$dataEditor2$par === void 0 ? void 0 : _cell$dataEditor2$par.call(_cell$dataEditor2, eventInfo.value, cell.record) : eventInfo.value);
74
61
  }
75
62
  setEventState(eventInfo);
76
63
  };
@@ -101,7 +88,8 @@ var Cell = function Cell(props) {
101
88
  row: row,
102
89
  col: col,
103
90
  id: cell.id,
104
- value: value
91
+ value: value,
92
+ key: cell.dataIndex
105
93
  // 没必要format value 已经是legal 的值了
106
94
  // value: cell.dataEditor?.formatter
107
95
  // ? cell.dataEditor.formatter?.(value)
@@ -115,7 +103,7 @@ var Cell = function Cell(props) {
115
103
  if (valueRef.current === value) {
116
104
  return;
117
105
  }
118
- if (cell !== null && cell !== void 0 && (_cell$dataEditor5 = cell.dataEditor) !== null && _cell$dataEditor5 !== void 0 && _cell$dataEditor5.checker && !((_cell$dataEditor6 = cell.dataEditor) !== null && _cell$dataEditor6 !== void 0 && (_cell$dataEditor6$che = _cell$dataEditor6.checker) !== null && _cell$dataEditor6$che !== void 0 && _cell$dataEditor6$che.call(_cell$dataEditor6, value, cell.record))) {
106
+ if (value !== null && cell !== null && cell !== void 0 && (_cell$dataEditor5 = cell.dataEditor) !== null && _cell$dataEditor5 !== void 0 && _cell$dataEditor5.checker && !((_cell$dataEditor6 = cell.dataEditor) !== null && _cell$dataEditor6 !== void 0 && (_cell$dataEditor6$che = _cell$dataEditor6.checker) !== null && _cell$dataEditor6$che !== void 0 && _cell$dataEditor6$che.call(_cell$dataEditor6, value, cell.record))) {
119
107
  setValue(valueRef.current);
120
108
  return;
121
109
  }
@@ -125,6 +113,7 @@ var Cell = function Cell(props) {
125
113
  col: col,
126
114
  id: cell.id,
127
115
  value: value,
116
+ key: cell.dataIndex,
128
117
  confirm: true
129
118
  });
130
119
  }, [eventBus, valueRef, cell]);
@@ -163,6 +152,22 @@ var Cell = function Cell(props) {
163
152
  return a;
164
153
  }).join(' ');
165
154
  }, [editing, selected, selectedInfo, cell.className, cell.readonly]);
155
+ var widthStyle = useMemo(function () {
156
+ var _cellFixedInfo$fixPos, _cellFixedInfo$fixPos2;
157
+ var width = typeof (cell === null || cell === void 0 ? void 0 : cell.width) === 'number' ? "".concat(cell.width, "px") : cell.width;
158
+ var align = cell.align || 'left';
159
+ var position = cell.fixed ? 'sticky' : 'unset';
160
+ var left = cell.fixed === 'left' ? (_cellFixedInfo$fixPos = cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.fixPosition) !== null && _cellFixedInfo$fixPos !== void 0 ? _cellFixedInfo$fixPos : 0 : 'unset';
161
+ var right = cell.fixed === 'right' ? (_cellFixedInfo$fixPos2 = cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.fixPosition) !== null && _cellFixedInfo$fixPos2 !== void 0 ? _cellFixedInfo$fixPos2 : 0 : 'unset';
162
+ var obj = {
163
+ width: width,
164
+ textAlign: align,
165
+ position: position,
166
+ left: left,
167
+ right: right
168
+ };
169
+ return obj;
170
+ }, [cellFixedInfo, cell]);
166
171
  return /*#__PURE__*/_jsx(CellRenderer, {
167
172
  row: row,
168
173
  col: col,
@@ -171,11 +176,15 @@ var Cell = function Cell(props) {
171
176
  editing: eventState.editing,
172
177
  attributesRenderer: attributesRenderer,
173
178
  className: className,
174
- style: widthStyle(cell),
179
+ style: widthStyle,
180
+ isFirstFixedRight: cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.isFirstFixedRight,
181
+ isLastFixedLeft: cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.isLastFixedLeft,
182
+ isScrolledOver: cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.isScrolledOver,
183
+ isScrolledToEnd: cellFixedInfo === null || cellFixedInfo === void 0 ? void 0 : cellFixedInfo.isScrolledToEnd,
175
184
  children: content
176
185
  });
177
186
  };
178
- export default /*#__PURE__*/memo(Cell, function (pre, next) {
179
- var shouldUpdate = pre.col === next.col && pre.row === next.row && pre.cell.value === next.cell.value && pre.cell.dataEditor === next.cell.dataEditor && pre.cell.record === next.cell.record;
187
+ export default memo(Cell, function (pre, next) {
188
+ var shouldUpdate = pre.col === next.col && pre.row === next.row && pre.cell.value === next.cell.value && pre.cell.dataEditor === next.cell.dataEditor && pre.cell.className === next.cell.className && pre.cell.record === next.cell.record && pre.cellFixedInfo === next.cellFixedInfo;
180
189
  return shouldUpdate;
181
190
  });
@@ -0,0 +1,21 @@
1
+ import { CellPosition } from "../../type/sheet";
2
+ import React, { CSSProperties } from "../../../node_modules/@types/react";
3
+ interface ControlProps {
4
+ startRowVisible: boolean;
5
+ firstRowVisible: boolean;
6
+ lastRowVisible: boolean;
7
+ showQuickLocationBtn: boolean;
8
+ backToEditRow: () => void;
9
+ toTop: () => void;
10
+ toBottom: () => void;
11
+ backEditStyle?: Partial<CSSProperties>;
12
+ ControlContainer?: React.FC<any>;
13
+ showBackEdit?: boolean;
14
+ selectInfo?: {
15
+ start?: CellPosition;
16
+ end?: CellPosition;
17
+ selecting?: boolean;
18
+ };
19
+ }
20
+ export declare const Control: React.FC<ControlProps>;
21
+ export {};
@@ -0,0 +1,83 @@
1
+ import { EditOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
2
+ import { Button, Tooltip } from 'antd';
3
+ import React, { useMemo } from "../../../node_modules/@types/react";
4
+ import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
5
+ var itemStyle = {
6
+ fontSize: 18,
7
+ marginTop: 2
8
+ };
9
+ export var Control = function Control(props) {
10
+ var showBackEdit = props.showBackEdit,
11
+ showQuickLocationBtn = props.showQuickLocationBtn,
12
+ startRowVisible = props.startRowVisible,
13
+ firstRowVisible = props.firstRowVisible,
14
+ lastRowVisible = props.lastRowVisible,
15
+ selectInfo = props.selectInfo,
16
+ toTop = props.toTop,
17
+ toBottom = props.toBottom,
18
+ backToEditRow = props.backToEditRow,
19
+ _props$backEditStyle = props.backEditStyle,
20
+ backEditStyle = _props$backEditStyle === void 0 ? {
21
+ bottom: 0,
22
+ right: 0
23
+ } : _props$backEditStyle,
24
+ ControlContainer = props.ControlContainer;
25
+ var btns = useMemo(function () {
26
+ var tempBtns = [{
27
+ title: '置顶',
28
+ disabled: firstRowVisible,
29
+ event: toTop,
30
+ icon: /*#__PURE__*/_jsx(VerticalAlignTopOutlined, {
31
+ style: itemStyle
32
+ }),
33
+ isShow: showQuickLocationBtn
34
+ }, {
35
+ title: '置底',
36
+ disabled: lastRowVisible,
37
+ event: toBottom,
38
+ icon: /*#__PURE__*/_jsx(VerticalAlignBottomOutlined, {
39
+ style: itemStyle
40
+ }),
41
+ isShow: showQuickLocationBtn
42
+ }, {
43
+ title: '返回编辑行',
44
+ disabled: startRowVisible,
45
+ event: backToEditRow,
46
+ icon: /*#__PURE__*/_jsx(EditOutlined, {
47
+ style: itemStyle
48
+ }),
49
+ isShow: showBackEdit
50
+ }];
51
+ return tempBtns.filter(function (item) {
52
+ return item.isShow;
53
+ });
54
+ }, [firstRowVisible, showQuickLocationBtn, lastRowVisible, startRowVisible, showBackEdit]);
55
+ if (!showBackEdit && !showQuickLocationBtn) return null;
56
+ if (ControlContainer) {
57
+ return /*#__PURE__*/_jsx(ControlContainer, {
58
+ selectInfo: selectInfo
59
+ });
60
+ }
61
+ return /*#__PURE__*/_jsx("div", {
62
+ className: "control",
63
+ style: backEditStyle,
64
+ children: btns.map(function (item) {
65
+ return /*#__PURE__*/_jsx("div", {
66
+ className: "control-item",
67
+ children: /*#__PURE__*/_jsx(Tooltip, {
68
+ title: item.title,
69
+ children: /*#__PURE__*/_jsx(Button, {
70
+ style: {
71
+ width: 24,
72
+ height: 24,
73
+ padding: 0
74
+ },
75
+ disabled: item.disabled,
76
+ onClick: item.event,
77
+ children: item.icon
78
+ })
79
+ })
80
+ }, item.title);
81
+ })
82
+ });
83
+ };
@@ -1,12 +1,12 @@
1
- import { useEffect, useRef } from 'react';
2
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { useEffect, useRef } from "../../../node_modules/@types/react";
2
+ import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
3
3
  var DataEditor = function DataEditor(_ref) {
4
4
  var value = _ref.value,
5
5
  onChange = _ref.onChange;
6
6
  var inputRef = useRef(null);
7
7
  useEffect(function () {
8
8
  var _inputRef$current;
9
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
9
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.focus();
10
10
  }, []);
11
11
  var handleChange = function handleChange(e) {
12
12
  onChange(e.target.value);
@@ -1,11 +1,16 @@
1
+ /// <reference types="react" />
1
2
  import type { SheetType } from "../../type";
2
- declare const DefaultCell: (props: {
3
+ declare const DefaultCell: React.FC<{
3
4
  cell: SheetType.Cell;
4
5
  row: number;
5
6
  col: number;
6
- attributesRenderer?: SheetType.AttributesRenderer | undefined;
7
+ attributesRenderer?: SheetType.AttributesRenderer;
7
8
  className: string;
8
9
  style: Record<string, string>;
9
10
  children: React.ReactElement;
10
- }) => JSX.Element;
11
+ isFirstFixedRight: boolean;
12
+ isLastFixedLeft: boolean;
13
+ isScrolledOver: boolean;
14
+ isScrolledToEnd: boolean;
15
+ }>;
11
16
  export default DefaultCell;
@@ -1,11 +1,11 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
4
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
7
  import { classNames } from "../util";
8
- import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
9
9
  var DefaultCell = function DefaultCell(props) {
10
10
  var cell = props.cell,
11
11
  row = props.row,
@@ -13,14 +13,18 @@ var DefaultCell = function DefaultCell(props) {
13
13
  attributesRenderer = props.attributesRenderer,
14
14
  className = props.className,
15
15
  style = props.style,
16
- children = props.children;
16
+ children = props.children,
17
+ isFirstFixedRight = props.isFirstFixedRight,
18
+ isLastFixedLeft = props.isLastFixedLeft,
19
+ isScrolledOver = props.isScrolledOver,
20
+ isScrolledToEnd = props.isScrolledToEnd;
17
21
  var colSpan = cell.colSpan,
18
22
  rowSpan = cell.rowSpan;
19
23
  var attributes = attributesRenderer ? attributesRenderer(cell, row, col) : {};
20
24
  return /*#__PURE__*/_jsx("td", _objectSpread(_objectSpread({
21
25
  "data-row": row,
22
26
  "data-col": col,
23
- className: classNames(className, cell.fixed && 'fixed', cell.fixed && "fixed-".concat(cell.fixed)),
27
+ className: classNames(className, cell.fixed && 'fixed', cell.fixed && "fixed-".concat(cell.fixed), cell.dataIndex === 'index' ? 'index' : null, isLastFixedLeft && isScrolledOver ? "last-fixed-left" : null, isFirstFixedRight && !isScrolledToEnd ? "first-fixed-right" : null),
24
28
  colSpan: colSpan,
25
29
  rowSpan: rowSpan,
26
30
  style: style
@@ -1,6 +1,6 @@
1
- import { useMemo } from 'react';
1
+ import { useMemo } from "../../../node_modules/@types/react";
2
2
  import { groupConfigToGroupMap } from "../util";
3
- import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
4
4
  var DefaultRow = function DefaultRow(_ref) {
5
5
  var _groupMap$get, _groupMap$get2;
6
6
  var rowClassName = _ref.rowClassName,
@@ -12,13 +12,7 @@ var DefaultRow = function DefaultRow(_ref) {
12
12
  return groupConfigToGroupMap(groupConfig);
13
13
  }, [groupConfig]);
14
14
  if (groupMap.get(row) && !((_groupMap$get = groupMap.get(row)) !== null && _groupMap$get !== void 0 && _groupMap$get.isStart) && !((_groupMap$get2 = groupMap.get(row)) !== null && _groupMap$get2 !== void 0 && _groupMap$get2.isOpen)) {
15
- return /*#__PURE__*/_jsx("tr", {
16
- className: rowClassName,
17
- style: {
18
- display: 'none'
19
- },
20
- children: children
21
- });
15
+ return null;
22
16
  }
23
17
  return /*#__PURE__*/_jsx("tr", {
24
18
  className: rowClassName,
@@ -3,6 +3,9 @@ import type { SheetType } from "../../type";
3
3
  interface DefaultRowMapperProps {
4
4
  rowData: SheetType.Cell[];
5
5
  row: number;
6
+ fixedInfo: SheetType.FixedInfo[];
7
+ isScrolledOver: boolean;
8
+ isScrolledToEnd: boolean;
6
9
  }
7
10
  export declare const DefaultRowMapper: React.FC<DefaultRowMapperProps>;
8
11
  export {};
@@ -1,15 +1,31 @@
1
- import { memo } from 'react';
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ import { memo } from "../../../node_modules/@types/react";
2
8
  import Cell from "./Cell";
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- export var DefaultRowMapper = /*#__PURE__*/memo(function (_ref) {
9
+ import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
10
+ import { Fragment as _Fragment } from "../../../node_modules/@types/react/jsx-runtime";
11
+ export var DefaultRowMapper = memo(function (_ref) {
5
12
  var rowData = _ref.rowData,
6
- row = _ref.row;
13
+ row = _ref.row,
14
+ fixedInfo = _ref.fixedInfo,
15
+ isScrolledOver = _ref.isScrolledOver,
16
+ isScrolledToEnd = _ref.isScrolledToEnd;
7
17
  var cls = rowData.map(function (cell, col) {
8
18
  return /*#__PURE__*/_jsx(Cell, {
9
19
  row: row,
10
20
  col: col,
11
- cell: cell
21
+ cell: cell,
22
+ cellFixedInfo: _objectSpread(_objectSpread({}, fixedInfo[col]), {}, {
23
+ isScrolledOver: isScrolledOver,
24
+ isScrolledToEnd: isScrolledToEnd
25
+ })
12
26
  }, col);
13
27
  });
14
- return cls;
28
+ return /*#__PURE__*/_jsx(_Fragment, {
29
+ children: cls
30
+ });
15
31
  });
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
2
2
  var DefaultShell = function DefaultShell(_ref) {
3
3
  var children = _ref.children,
4
4
  className = _ref.className;
@@ -1,4 +1,4 @@
1
- import { FC } from 'react';
1
+ import { FC } from "../../../node_modules/@types/react";
2
2
  export declare const SheetEvent: FC<{
3
3
  handler?: (value: unknown) => void;
4
4
  name: string;
@@ -1,5 +1,5 @@
1
1
  import { useSheetEvent } from "../..";
2
- import { useEffect } from 'react';
2
+ import { useEffect } from "../../../node_modules/@types/react";
3
3
  export var SheetEvent = function SheetEvent(_ref) {
4
4
  var handler = _ref.handler,
5
5
  name = _ref.name;
@@ -0,0 +1,6 @@
1
+ import { MenuRenderProps } from "../../type/sheet";
2
+ import React from "../../../node_modules/@types/react";
3
+ export declare const Menu: React.ForwardRefExoticComponent<MenuRenderProps & {
4
+ contextMenu?: React.FC<MenuRenderProps> | undefined;
5
+ showMenu: boolean;
6
+ } & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,21 @@
1
+ import React, { forwardRef } from "../../../node_modules/@types/react";
2
+ import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
3
+ export var Menu = forwardRef(function (props, ref) {
4
+ var showMenu = props.showMenu,
5
+ position = props.position,
6
+ cell = props.cell,
7
+ onContextMenu = props.onContextMenu,
8
+ ContextMenu = props.contextMenu;
9
+ var isMenuShow = !!ContextMenu && showMenu;
10
+ return /*#__PURE__*/_jsx("div", {
11
+ ref: ref,
12
+ style: {
13
+ display: isMenuShow ? '' : 'none'
14
+ },
15
+ children: isMenuShow && /*#__PURE__*/_jsx(ContextMenu, {
16
+ position: position,
17
+ cell: cell,
18
+ onContextMenu: onContextMenu
19
+ })
20
+ });
21
+ });
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
2
2
  var ValueViewer = function ValueViewer(_ref) {
3
3
  var value = _ref.value;
4
4
  return /*#__PURE__*/_jsx("span", {