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

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 (84) hide show
  1. package/dist/core/editor/cascaderEditor/index.js +2 -2
  2. package/dist/core/editor/dateEditor/index.js +2 -2
  3. package/dist/core/editor/numberEditor/index.js +2 -2
  4. package/dist/core/editor/selectEditor/index.js +4 -4
  5. package/dist/core/sheet/Cell.d.ts +1 -1
  6. package/dist/core/sheet/Cell.js +3 -3
  7. package/dist/core/sheet/Control.d.ts +1 -1
  8. package/dist/core/sheet/Control.js +2 -2
  9. package/dist/core/sheet/DataEditor.js +2 -2
  10. package/dist/core/sheet/DefaultCell.js +1 -1
  11. package/dist/core/sheet/DefaultRow.js +2 -2
  12. package/dist/core/sheet/DefaultRowMapper.js +4 -4
  13. package/dist/core/sheet/DefaultShell.js +1 -1
  14. package/dist/core/sheet/Event.d.ts +1 -1
  15. package/dist/core/sheet/Event.js +1 -1
  16. package/dist/core/sheet/Menu.d.ts +1 -1
  17. package/dist/core/sheet/Menu.js +3 -3
  18. package/dist/core/sheet/Remark.d.ts +9 -0
  19. package/dist/core/sheet/Remark.js +29 -0
  20. package/dist/core/sheet/ValueViewer.js +1 -1
  21. package/dist/core/sheet/index.js +27 -5
  22. package/dist/core/sheet/index.less +13 -0
  23. package/dist/core/sheet/searchInput.d.ts +1 -1
  24. package/dist/core/sheet/searchInput.js +3 -3
  25. package/dist/core/sheet/useCellEvent.js +1 -1
  26. package/dist/core/sheet/useContextMenu.js +4 -4
  27. package/dist/core/sheet/useMouseEvent.js +1 -1
  28. package/dist/core/sheet/useRemarkContainer.d.ts +14 -0
  29. package/dist/core/sheet/useRemarkContainer.js +120 -0
  30. package/dist/core/sheet/useSearchInput.js +1 -1
  31. package/dist/core/sheet/useSelectVisible.js +1 -1
  32. package/dist/core/sheet/useVirtualList.js +2 -2
  33. package/dist/core/shell/draggableShell/index.d.ts +1 -1
  34. package/dist/core/shell/draggableShell/index.js +10 -5
  35. package/dist/core/shell/tableShell.d.ts +2 -2
  36. package/dist/core/shell/tableShell.js +11 -155
  37. package/dist/core/table/addButton.d.ts +1 -2
  38. package/dist/core/table/addButton.js +3 -4
  39. package/dist/core/table/events.d.ts +1 -1
  40. package/dist/core/table/events.js +3 -3
  41. package/dist/core/table/index.d.ts +1 -0
  42. package/dist/core/table/index.js +85 -9
  43. package/dist/core/table/index.less +19 -0
  44. package/dist/core/table/remarkEvent.d.ts +5 -0
  45. package/dist/core/table/remarkEvent.js +13 -0
  46. package/dist/core/table/useGroupConfig.d.ts +1 -1
  47. package/dist/core/table/useGroupConfig.js +7 -5
  48. package/dist/core/table/useRowSelection.d.ts +1 -1
  49. package/dist/core/table/useRowSelection.js +7 -4
  50. package/dist/core/viewer/btnViewer/index.js +3 -3
  51. package/dist/core/viewer/cascaderViewer/index.js +2 -2
  52. package/dist/core/viewer/checkViewer/index.js +2 -2
  53. package/dist/core/viewer/editViewer/index.js +3 -3
  54. package/dist/core/viewer/groupViewer/index.js +2 -2
  55. package/dist/core/viewer/selectorViewer/index.js +1 -1
  56. package/dist/core/viewer/switchViewer/index.js +2 -2
  57. package/dist/example/antComponent.d.ts +1 -1
  58. package/dist/example/antComponent.js +2 -2
  59. package/dist/example/basic.d.ts +1 -1
  60. package/dist/example/basic.js +4 -4
  61. package/dist/example/ellipsis.d.ts +1 -1
  62. package/dist/example/ellipsis.js +2 -2
  63. package/dist/example/fixed.d.ts +1 -1
  64. package/dist/example/fixed.js +2 -2
  65. package/dist/example/group.js +2 -2
  66. package/dist/example/selection.d.ts +1 -1
  67. package/dist/example/selection.js +2 -2
  68. package/dist/example/sheet.d.ts +1 -1
  69. package/dist/example/sheet.js +3 -3
  70. package/dist/example/valuationAnalyze.js +286 -11
  71. package/dist/hooks/useEventBus.js +1 -1
  72. package/dist/hooks/useGroupConfig.d.ts +1 -1
  73. package/dist/hooks/useGroupConfig.js +2 -2
  74. package/dist/hooks/useKeyboard.js +1 -1
  75. package/dist/hooks/useMiddlewareReducer.js +1 -1
  76. package/dist/hooks/useMouse.js +1 -1
  77. package/dist/hooks/useSetState.js +1 -1
  78. package/dist/hooks/useSheetEvent.d.ts +1 -1
  79. package/dist/hooks/useSheetEvent.js +2 -2
  80. package/dist/hooks/useWidthConfig.d.ts +1 -1
  81. package/dist/hooks/useWidthConfig.js +2 -2
  82. package/dist/type/sheet.d.ts +5 -1
  83. package/dist/type/sheetTable.d.ts +13 -1
  84. package/package.json +5 -2
@@ -1,10 +1,10 @@
1
1
  import { Cascader } from 'antd';
2
2
  import 'antd/es/cascader/style/index.css';
3
3
  import { isNil } from 'lodash';
4
- import { useMemo } from "../../../../node_modules/@types/react";
4
+ import { useMemo } from 'react';
5
5
  import { optionsToValuesFromLabelOrValue, valuesTransferToLabel } from "../../util";
6
6
  import "./index.less";
7
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
8
  var getCascaderEditor = function getCascaderEditor(options, getCustomOptions) {
9
9
  var CascaderEditor = function CascaderEditor(props) {
10
10
  var value = props.value,
@@ -8,9 +8,9 @@ import { DatePicker } from 'antd';
8
8
  import 'antd/es/date-picker/style/index.css';
9
9
  import { isNil } from 'lodash';
10
10
  import moment from 'moment';
11
- import { useEffect, useMemo, useRef } from "../../../../node_modules/@types/react";
11
+ import { useEffect, useMemo, useRef } from 'react';
12
12
  import "./index.less";
13
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
14
  export var getDateEditor = function getDateEditor(dateProps) {
15
15
  var DateEditor = function DateEditor(props) {
16
16
  var value = props.value,
@@ -11,9 +11,9 @@ import { formatPrecision } from "../../../standardUtils";
11
11
  import { InputNumber as AntInputNumber } from 'antd';
12
12
  import 'antd/es/input-number/style/index.css';
13
13
  import { isNil, isNumber } from 'lodash';
14
- import { useCallback, useEffect, useRef } from "../../../../node_modules/@types/react";
14
+ import { useCallback, useEffect, useRef } from 'react';
15
15
  import "./index.less";
16
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
17
  var isNumeric = function isNumeric(str) {
18
18
  // 使用正则表达式匹配数字,包括整数和小数
19
19
  return /^-?\d+(\.\d+)?$/.test(str);
@@ -15,11 +15,11 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
15
15
  import { Select } from 'antd';
16
16
  import 'antd/es/select/style/index.css';
17
17
  import { isNil } from 'lodash';
18
- import { useState } from "../../../../node_modules/@types/react";
18
+ import { useState } from 'react';
19
19
  import "./index.less";
20
- import { Fragment as _Fragment } from "../../../../node_modules/@types/react/jsx-runtime";
21
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
22
- import { jsxs as _jsxs } from "../../../../node_modules/@types/react/jsx-runtime";
20
+ import { Fragment as _Fragment } from "react/jsx-runtime";
21
+ import { jsx as _jsx } from "react/jsx-runtime";
22
+ import { jsxs as _jsxs } from "react/jsx-runtime";
23
23
  export var getSelectEditor = function getSelectEditor(options) {
24
24
  var valueKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'value';
25
25
  var extra = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : /*#__PURE__*/_jsx(_Fragment, {});
@@ -1,4 +1,4 @@
1
1
  import type { SheetType } from "../../type";
2
- import React from "../../../node_modules/@types/react";
2
+ import React from 'react';
3
3
  declare const _default: React.MemoExoticComponent<(props: SheetType.CellProps) => JSX.Element>;
4
4
  export default _default;
@@ -5,13 +5,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
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
7
  import { isNil } from 'lodash';
8
- import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from "../../../node_modules/@types/react";
8
+ import React, { memo, useCallback, useEffect, useMemo, useRef, useState } from '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 "../../../node_modules/@types/react/jsx-runtime";
14
+ import { jsx as _jsx } from "react/jsx-runtime";
15
15
  function initialData(_ref) {
16
16
  var cell = _ref.cell;
17
17
  return renderValue(cell);
@@ -184,7 +184,7 @@ var Cell = function Cell(props) {
184
184
  children: content
185
185
  });
186
186
  };
187
- export default memo(Cell, function (pre, next) {
187
+ export default /*#__PURE__*/memo(Cell, function (pre, next) {
188
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;
189
189
  return shouldUpdate;
190
190
  });
@@ -1,5 +1,5 @@
1
1
  import { CellPosition } from "../../type/sheet";
2
- import React, { CSSProperties } from "../../../node_modules/@types/react";
2
+ import React, { CSSProperties } from 'react';
3
3
  interface ControlProps {
4
4
  startRowVisible: boolean;
5
5
  firstRowVisible: boolean;
@@ -1,7 +1,7 @@
1
1
  import { EditOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
2
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";
3
+ import React, { useMemo } from 'react';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  var itemStyle = {
6
6
  fontSize: 18,
7
7
  marginTop: 2
@@ -1,5 +1,5 @@
1
- import { useEffect, useRef } from "../../../node_modules/@types/react";
2
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
1
+ import { useEffect, useRef } from 'react';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  var DataEditor = function DataEditor(_ref) {
4
4
  var value = _ref.value,
5
5
  onChange = _ref.onChange;
@@ -5,7 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
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 "../../../node_modules/@types/react/jsx-runtime";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
9
  var DefaultCell = function DefaultCell(props) {
10
10
  var cell = props.cell,
11
11
  row = props.row,
@@ -1,6 +1,6 @@
1
- import { useMemo } from "../../../node_modules/@types/react";
1
+ import { useMemo } from 'react';
2
2
  import { groupConfigToGroupMap } from "../util";
3
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  var DefaultRow = function DefaultRow(_ref) {
5
5
  var _groupMap$get, _groupMap$get2;
6
6
  var rowClassName = _ref.rowClassName,
@@ -4,11 +4,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
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
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
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";
7
+ import { memo } from 'react';
8
8
  import Cell from "./Cell";
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) {
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ import { Fragment as _Fragment } from "react/jsx-runtime";
11
+ export var DefaultRowMapper = /*#__PURE__*/memo(function (_ref) {
12
12
  var rowData = _ref.rowData,
13
13
  row = _ref.row,
14
14
  fixedInfo = _ref.fixedInfo,
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
1
+ import { jsx as _jsx } from "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 "../../../node_modules/@types/react";
1
+ import { FC } from '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 "../../../node_modules/@types/react";
2
+ import { useEffect } from 'react';
3
3
  export var SheetEvent = function SheetEvent(_ref) {
4
4
  var handler = _ref.handler,
5
5
  name = _ref.name;
@@ -1,5 +1,5 @@
1
1
  import { MenuRenderProps } from "../../type/sheet";
2
- import React from "../../../node_modules/@types/react";
2
+ import React from 'react';
3
3
  export declare const Menu: React.ForwardRefExoticComponent<MenuRenderProps & {
4
4
  contextMenu?: React.FC<MenuRenderProps> | undefined;
5
5
  showMenu: boolean;
@@ -1,6 +1,6 @@
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) {
1
+ import React, { forwardRef } from 'react';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export var Menu = /*#__PURE__*/forwardRef(function (props, ref) {
4
4
  var showMenu = props.showMenu,
5
5
  position = props.position,
6
6
  cell = props.cell,
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export declare const Remark: import("react").ForwardRefExoticComponent<{
3
+ children?: ReactNode;
4
+ showRemark: boolean;
5
+ position: {
6
+ top: number;
7
+ left: number;
8
+ };
9
+ } & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,29 @@
1
+ import { forwardRef, useMemo } from 'react';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ export var Remark = /*#__PURE__*/forwardRef(function (props, ref) {
4
+ var showRemark = props.showRemark,
5
+ children = props.children,
6
+ position = props.position;
7
+ var transform = useMemo(function () {
8
+ if (document.body.clientWidth - position.left < 200) {
9
+ return 'translate(-100%,40px)';
10
+ }
11
+ return '';
12
+ }, [position.left]);
13
+ return /*#__PURE__*/_jsx("div", {
14
+ ref: ref,
15
+ children: /*#__PURE__*/_jsx("div", {
16
+ className: "harvest-remark-container",
17
+ style: {
18
+ position: 'fixed',
19
+ top: position.top,
20
+ left: position.left,
21
+ transform: transform,
22
+ opacity: showRemark ? 1 : 0,
23
+ pointerEvents: showRemark ? 'all' : 'none',
24
+ minWidth: showRemark ? 200 : 0
25
+ },
26
+ children: showRemark ? children : null
27
+ })
28
+ });
29
+ });
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  var ValueViewer = function ValueViewer(_ref) {
3
3
  var value = _ref.value;
4
4
  return /*#__PURE__*/_jsx("span", {
@@ -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 { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "../../../node_modules/@types/react";
7
+ import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
8
8
  // import ReduxLogger from 'redux-logger';
9
9
  import ReduxThunk from 'redux-thunk';
10
10
  import DefaultRow from "./DefaultRow";
@@ -18,18 +18,20 @@ import { classNames, getRowHeight, rowToActualRow } from "../util";
18
18
  import { Control } from "./Control";
19
19
  import { DefaultRowMapper } from "./DefaultRowMapper";
20
20
  import { Menu } from "./Menu";
21
+ import { Remark } from "./Remark";
21
22
  import "./index.less";
22
23
  import { SearchInput } from "./searchInput";
23
24
  import { useCellEvent } from "./useCellEvent";
24
25
  import { useContextMenu } from "./useContextMenu";
25
26
  import { useKeyBoardEvent } from "./useKeyBoardEvent";
26
27
  import { useMouseEvent } from "./useMouseEvent";
28
+ import { useRemarkContainer } from "./useRemarkContainer";
27
29
  import { useSearchInput } from "./useSearchInput";
28
30
  import { useSelectVisible } from "./useSelectVisible";
29
31
  import { VirtualizeEnd, VirtualizeStart, useVirtualList } from "./useVirtualList";
30
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
31
- import { jsxs as _jsxs } from "../../../node_modules/@types/react/jsx-runtime";
32
- import { Fragment as _Fragment } from "../../../node_modules/@types/react/jsx-runtime";
32
+ import { jsx as _jsx } from "react/jsx-runtime";
33
+ import { jsxs as _jsxs } from "react/jsx-runtime";
34
+ import { Fragment as _Fragment } from "react/jsx-runtime";
33
35
  var Sheet = function Sheet(props) {
34
36
  var _visibleData$length, _scroll$y, _scroll$x;
35
37
  var _props$sheetInstance = props.sheetInstance,
@@ -56,6 +58,7 @@ var Sheet = function Sheet(props) {
56
58
  rowClassName = props.rowClassName,
57
59
  scroll = props.scroll,
58
60
  children = props.children,
61
+ ControlContainer = props.ControlContainer,
59
62
  _props$showBackEdit = props.showBackEdit,
60
63
  showBackEdit = _props$showBackEdit === void 0 ? true : _props$showBackEdit,
61
64
  backEditStyle = props.backEditStyle,
@@ -65,7 +68,9 @@ var Sheet = function Sheet(props) {
65
68
  hideColBar = _props$hideColBar === void 0 ? true : _props$hideColBar,
66
69
  _props$showQuickLocat = props.showQuickLocationBtn,
67
70
  showQuickLocationBtn = _props$showQuickLocat === void 0 ? false : _props$showQuickLocat,
68
- ControlContainer = props.ControlContainer;
71
+ _props$showRemark = props.showRemark,
72
+ showRemark = _props$showRemark === void 0 ? false : _props$showRemark,
73
+ remarkElement = props.remarkElement;
69
74
  var _useState = useState(false),
70
75
  _useState2 = _slicedToArray(_useState, 2),
71
76
  isScrolledOver = _useState2[0],
@@ -199,6 +204,8 @@ var Sheet = function Sheet(props) {
199
204
  useMouseEvent(dispatch, sheetWrapperRef);
200
205
  useKeyBoardEvent(dispatch, sheetWrapperRef);
201
206
  var menu = useContextMenu(dispatch, sheetWrapperRef, !!ContextMenu, contextMenuRef);
207
+ var _useRemarkContainer = useRemarkContainer(sheetWrapperRef, state.start, state.editing, showRemark),
208
+ remarkInfo = _useRemarkContainer.remarkInfo;
202
209
 
203
210
  // timeout 的副作用不适合放reducer里面
204
211
  useEffect(function () {
@@ -235,6 +242,13 @@ var Sheet = function Sheet(props) {
235
242
  changeSearch = _useSearchInput.changeSearch,
236
243
  goNext = _useSearchInput.goNext,
237
244
  goLast = _useSearchInput.goLast;
245
+ useEffect(function () {
246
+ if (!state.mouseDown && state.start && state.end && state.start.row === state.end.row && state.start.col === state.end.col) {
247
+ eventBus.emit('cell-select-single', state.start);
248
+ } else {
249
+ eventBus.emit('cell-select-single', null);
250
+ }
251
+ }, [state.start, state.end, state.mouseDown]);
238
252
  useEffect(function () {
239
253
  dispatch({
240
254
  type: 'clearEdit'
@@ -322,6 +336,7 @@ var Sheet = function Sheet(props) {
322
336
  handleScroll();
323
337
  }
324
338
  }, []);
339
+ console.log(menu.showMenu);
325
340
  return /*#__PURE__*/_jsx(SheetEventContext.Provider, {
326
341
  value: eventBus,
327
342
  children: /*#__PURE__*/_jsxs(_Fragment, {
@@ -356,6 +371,13 @@ var Sheet = function Sheet(props) {
356
371
  showMenu: menu.showMenu,
357
372
  contextMenu: ContextMenu,
358
373
  onContextMenu: onContextMenu
374
+ }), /*#__PURE__*/_jsx(Remark, {
375
+ showRemark: remarkInfo.show && !menu.showMenu,
376
+ position: {
377
+ left: remarkInfo.position.left,
378
+ top: remarkInfo.position.top
379
+ },
380
+ children: remarkElement
359
381
  }), EmptyElement]
360
382
  }), /*#__PURE__*/_jsxs("div", {
361
383
  className: "harvest-sheet-control",
@@ -378,3 +378,16 @@ span.harvest-sheet-container:focus {
378
378
  color: #a4a9b2;
379
379
  }
380
380
  }
381
+ .harvest-sheet-container .harvest-remark-container{
382
+ opacity: 1;
383
+ border:1px solid #E5E5E5;
384
+ border-radius: 2px;
385
+ z-index: 10;
386
+ margin-left: 5px;
387
+ transition: min-height .2s linear,height .2s linear;
388
+ padding: 8px;
389
+ overflow: hidden;
390
+ background: rgb(255,255,255);
391
+ // box-shadow: 2px 2px 5px #888888;
392
+ box-shadow: 0 4px 8px rgba(216,223,235,.5);
393
+ }
@@ -1,4 +1,4 @@
1
- import { CSSProperties } from "../../../node_modules/@types/react";
1
+ import { CSSProperties } from 'react';
2
2
  interface SearchInputProps {
3
3
  open?: boolean;
4
4
  style?: Partial<CSSProperties>;
@@ -1,8 +1,8 @@
1
1
  import { CloseOutlined, DownOutlined, UpOutlined } from '@ant-design/icons';
2
2
  import { Divider, Input } from 'antd';
3
- import { useEffect, useRef } from "../../../node_modules/@types/react";
4
- import { jsxs as _jsxs } from "../../../node_modules/@types/react/jsx-runtime";
5
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
3
+ import { useEffect, useRef } from 'react';
4
+ import { jsxs as _jsxs } from "react/jsx-runtime";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
6
  export var SearchInput = function SearchInput(props) {
7
7
  var inputRef = useRef(null);
8
8
  var _props$current = props.current,
@@ -1,4 +1,4 @@
1
- import { useEffect } from "../../../node_modules/@types/react";
1
+ import { useEffect } from 'react';
2
2
  import { sideEffectReducer } from "../reducers";
3
3
  export var useCellEvent = function useCellEvent(dispatch, listenerVar) {
4
4
  var _ref = listenerVar || {},
@@ -11,7 +11,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
11
11
  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; } }
12
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import { useSetState } from "../..";
14
- import { useEffect } from "../../../node_modules/@types/react";
14
+ import { useEffect } from 'react';
15
15
  import { calcMenuPosition, extractDataRowAndCol, findParentTd } from "../util";
16
16
  export var useContextMenu = function useContextMenu(dispatch, elementRef) {
17
17
  var enableContextMenu = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
@@ -37,10 +37,10 @@ export var useContextMenu = function useContextMenu(dispatch, elementRef) {
37
37
  if (!currentCell) return;
38
38
  var currentPos = extractDataRowAndCol(currentCell);
39
39
  dispatch({
40
- type: 'mouseDown',
40
+ type: 'select',
41
41
  payload: {
42
- pos: currentPos,
43
- shiftKey: e.shiftKey
42
+ start: currentPos,
43
+ end: currentPos
44
44
  }
45
45
  });
46
46
  var _calcMenuPosition = calcMenuPosition({
@@ -1,5 +1,5 @@
1
1
  import { useMouse } from "../..";
2
- import { useCallback, useEffect, useRef } from "../../../node_modules/@types/react";
2
+ import { useCallback, useEffect, useRef } from 'react';
3
3
  import { extractDataRowAndCol, findParentTd } from "../util";
4
4
  var rowCount = 10; //每秒10行
5
5
  var colCount = 5; //每秒5列
@@ -0,0 +1,14 @@
1
+ import { SheetType } from "../../type";
2
+ export declare const useRemarkContainer: (elementRef: React.RefObject<SheetType.refAssertion>, start?: SheetType.CellPosition, editing?: SheetType.CellPosition, showRemark?: boolean) => {
3
+ remarkInfo: {
4
+ position: {
5
+ top: number;
6
+ left: number;
7
+ };
8
+ cellPosition: {
9
+ row: number;
10
+ col: number;
11
+ };
12
+ show: boolean;
13
+ };
14
+ };
@@ -0,0 +1,120 @@
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
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ 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."); }
9
+ 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); }
10
+ 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; }
11
+ 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; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import { useSetState } from "../../hooks";
14
+ import { useCallback, useEffect } from 'react';
15
+ import { debounce } from 'lodash';
16
+ export var useRemarkContainer = function useRemarkContainer(elementRef, start, editing) {
17
+ var showRemark = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
18
+ var _useSetState = useSetState({
19
+ position: {
20
+ top: 0,
21
+ left: 0
22
+ },
23
+ cellPosition: {
24
+ row: 0,
25
+ col: 0
26
+ },
27
+ show: showRemark
28
+ }),
29
+ _useSetState2 = _slicedToArray(_useSetState, 2),
30
+ remarkInfo = _useSetState2[0],
31
+ setRemarkInfo = _useSetState2[1];
32
+ var calcPosition = useCallback(function () {
33
+ if (!start || !showRemark || !elementRef.current) {
34
+ return;
35
+ }
36
+ var cell = elementRef.current.querySelector("td[data-row=\"".concat(start.row, "\"][data-col=\"").concat(start.col, "\"]"));
37
+ if (!cell) {
38
+ return;
39
+ }
40
+ var containerRect = elementRef.current.getBoundingClientRect();
41
+ var cellRect = cell.getBoundingClientRect();
42
+ var visible = containerRect.top < cellRect.top && containerRect.left < cellRect.left && containerRect.top + (containerRect === null || containerRect === void 0 ? void 0 : containerRect.height) > cellRect.bottom && containerRect.left + (containerRect === null || containerRect === void 0 ? void 0 : containerRect.width) > (cellRect === null || cellRect === void 0 ? void 0 : cellRect.right);
43
+ return {
44
+ top: cellRect.y,
45
+ left: cellRect.x + cellRect.width,
46
+ visible: visible
47
+ };
48
+ }, [start, showRemark]);
49
+ useEffect(function () {
50
+ var position = calcPosition();
51
+ if (!position) {
52
+ return;
53
+ }
54
+ setRemarkInfo({
55
+ position: position
56
+ });
57
+ }, [start, showRemark]);
58
+ useEffect(function () {
59
+ setRemarkInfo({
60
+ show: showRemark && !editing
61
+ });
62
+ }, [showRemark, editing]);
63
+ useEffect(function () {
64
+ var _elementRef$current, _elementRef$current2;
65
+ var remarkScroll = debounce(function () {
66
+ setRemarkInfo({
67
+ show: false
68
+ });
69
+ }, 50);
70
+ var remarkScrollEnd = function remarkScrollEnd() {
71
+ var position = calcPosition();
72
+ if (!position) {
73
+ return;
74
+ }
75
+ setRemarkInfo({
76
+ position: position,
77
+ show: position.visible && showRemark && !editing && position.left > 0 && position.top > 0
78
+ });
79
+ };
80
+ (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 || _elementRef$current.addEventListener('scroll', remarkScroll);
81
+ (_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0 || _elementRef$current2.addEventListener('scrollend', remarkScrollEnd);
82
+ return function () {
83
+ var _elementRef$current3, _elementRef$current4;
84
+ (_elementRef$current3 = elementRef.current) === null || _elementRef$current3 === void 0 || _elementRef$current3.removeEventListener('scroll', remarkScroll);
85
+ (_elementRef$current4 = elementRef.current) === null || _elementRef$current4 === void 0 || _elementRef$current4.removeEventListener('scrollend', remarkScrollEnd);
86
+ };
87
+ }, [start, showRemark, editing]);
88
+ useEffect(function () {
89
+ var _elementRef$current5;
90
+ if (!start) return;
91
+ var cell = (_elementRef$current5 = elementRef.current) === null || _elementRef$current5 === void 0 ? void 0 : _elementRef$current5.querySelector("td[data-row=\"".concat(start.row, "\"][data-col=\"").concat(start.col, "\"]"));
92
+ if (!cell) return;
93
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
94
+ if (!cell) {
95
+ return function () {};
96
+ }
97
+ var io = new IntersectionObserver(function (entries) {
98
+ var ratio = entries[0].intersectionRatio;
99
+ console.log('io-ratio', ratio);
100
+ if (ratio < 1) setRemarkInfo({
101
+ show: false
102
+ });
103
+ }, {
104
+ threshold: 1
105
+ });
106
+ io.observe(cell);
107
+ return function () {
108
+ var _io2;
109
+ if (cell) {
110
+ var _io;
111
+ (_io = io) === null || _io === void 0 || _io.unobserve(cell);
112
+ }
113
+ (_io2 = io) === null || _io2 === void 0 || _io2.disconnect();
114
+ io = undefined;
115
+ };
116
+ }, [start]);
117
+ return {
118
+ remarkInfo: _objectSpread({}, remarkInfo)
119
+ };
120
+ };
@@ -5,7 +5,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
5
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
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 { pick } from 'lodash';
8
- import { useCallback, useEffect } from "../../../node_modules/@types/react";
8
+ import { useCallback, useEffect } from 'react';
9
9
  export var useSearchInput = function useSearchInput(state, dispatch, handlerRef) {
10
10
  var goSearchResult = useCallback(function (value) {
11
11
  var _state$searchResultLi;
@@ -5,7 +5,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
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
7
  import { throttle } from 'lodash';
8
- import { useEffect, useState } from "../../../node_modules/@types/react";
8
+ import { useEffect, useState } from 'react';
9
9
  export var useSelectVisible = function useSelectVisible(sheetWrapper, start) {
10
10
  var _useState = useState(true),
11
11
  _useState2 = _slicedToArray(_useState, 2),
@@ -7,9 +7,9 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  /* eslint-disable @typescript-eslint/no-unused-vars */
8
8
  import { useGroup } from "../../hooks/useGroupConfig";
9
9
  import { throttle } from 'lodash';
10
- import { useEffect, useState } from "../../../node_modules/@types/react";
10
+ import { useEffect, useState } from 'react';
11
11
  import { getRowHeight } from "../util";
12
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  var extra = 20;
14
14
  // 虚拟列表
15
15
  export var useVirtualList = function useVirtualList(elementRef) {
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { SheetType } from "../../../type";
3
3
  import './index.less';
4
- export declare const DraggableShell: ({ columns, className, showGroup, showSelect, controlProps, controlWidth, }: SheetType.SheetShell) => import("../../../../node_modules/@types/react").FC<{
4
+ export declare const DraggableShell: ({ columns, className, showGroup, showSelect, controlProps, dragable, controlWidth, }: SheetType.SheetShell) => import("react").FC<{
5
5
  children: React.ReactElement;
6
6
  isScrolledOver: boolean;
7
7
  isScrolledToEnd: boolean;