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

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 (87) 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/reducers/keyboardReducer.js +2 -1
  6. package/dist/core/reducers/mouseReducer.js +3 -2
  7. package/dist/core/reducers/sideEffectReducer.js +3 -3
  8. package/dist/core/sheet/Cell.d.ts +1 -1
  9. package/dist/core/sheet/Cell.js +3 -3
  10. package/dist/core/sheet/Control.d.ts +1 -1
  11. package/dist/core/sheet/Control.js +2 -2
  12. package/dist/core/sheet/DataEditor.js +2 -2
  13. package/dist/core/sheet/DefaultCell.js +1 -1
  14. package/dist/core/sheet/DefaultRow.js +2 -2
  15. package/dist/core/sheet/DefaultRowMapper.js +4 -4
  16. package/dist/core/sheet/DefaultShell.js +1 -1
  17. package/dist/core/sheet/Event.d.ts +1 -1
  18. package/dist/core/sheet/Event.js +1 -1
  19. package/dist/core/sheet/Menu.d.ts +1 -1
  20. package/dist/core/sheet/Menu.js +3 -3
  21. package/dist/core/sheet/Remark.d.ts +9 -0
  22. package/dist/core/sheet/Remark.js +32 -0
  23. package/dist/core/sheet/ValueViewer.js +1 -1
  24. package/dist/core/sheet/index.js +52 -14
  25. package/dist/core/sheet/index.less +34 -0
  26. package/dist/core/sheet/searchInput.d.ts +1 -1
  27. package/dist/core/sheet/searchInput.js +3 -3
  28. package/dist/core/sheet/useCellEvent.js +1 -1
  29. package/dist/core/sheet/useContextMenu.js +4 -4
  30. package/dist/core/sheet/useMouseEvent.js +1 -1
  31. package/dist/core/sheet/useRemarkContainer.d.ts +14 -0
  32. package/dist/core/sheet/useRemarkContainer.js +121 -0
  33. package/dist/core/sheet/useSearchInput.js +1 -1
  34. package/dist/core/sheet/useSelectVisible.js +1 -1
  35. package/dist/core/sheet/useVirtualList.js +2 -2
  36. package/dist/core/shell/draggableShell/index.d.ts +1 -1
  37. package/dist/core/shell/draggableShell/index.js +10 -5
  38. package/dist/core/shell/tableShell.d.ts +2 -2
  39. package/dist/core/shell/tableShell.js +11 -155
  40. package/dist/core/table/addButton.d.ts +1 -2
  41. package/dist/core/table/addButton.js +3 -4
  42. package/dist/core/table/events.d.ts +1 -1
  43. package/dist/core/table/events.js +3 -3
  44. package/dist/core/table/index.d.ts +1 -0
  45. package/dist/core/table/index.js +164 -12
  46. package/dist/core/table/index.less +19 -0
  47. package/dist/core/table/remarkEvent.d.ts +5 -0
  48. package/dist/core/table/remarkEvent.js +9 -0
  49. package/dist/core/table/useGroupConfig.d.ts +1 -1
  50. package/dist/core/table/useGroupConfig.js +7 -5
  51. package/dist/core/table/useRowSelection.d.ts +1 -1
  52. package/dist/core/table/useRowSelection.js +7 -4
  53. package/dist/core/viewer/btnViewer/index.js +3 -3
  54. package/dist/core/viewer/cascaderViewer/index.js +2 -2
  55. package/dist/core/viewer/checkViewer/index.js +2 -2
  56. package/dist/core/viewer/editViewer/index.js +3 -3
  57. package/dist/core/viewer/groupViewer/index.js +2 -2
  58. package/dist/core/viewer/selectorViewer/index.js +1 -1
  59. package/dist/core/viewer/switchViewer/index.js +2 -2
  60. package/dist/example/antComponent.d.ts +1 -1
  61. package/dist/example/antComponent.js +2 -2
  62. package/dist/example/basic.d.ts +1 -1
  63. package/dist/example/basic.js +4 -4
  64. package/dist/example/ellipsis.d.ts +1 -1
  65. package/dist/example/ellipsis.js +2 -2
  66. package/dist/example/fixed.d.ts +1 -1
  67. package/dist/example/fixed.js +2 -2
  68. package/dist/example/group.js +2 -2
  69. package/dist/example/selection.d.ts +1 -1
  70. package/dist/example/selection.js +2 -2
  71. package/dist/example/sheet.d.ts +1 -1
  72. package/dist/example/sheet.js +3 -3
  73. package/dist/example/valuationAnalyze.js +356 -13
  74. package/dist/hooks/useEventBus.js +1 -1
  75. package/dist/hooks/useGroupConfig.d.ts +1 -1
  76. package/dist/hooks/useGroupConfig.js +2 -2
  77. package/dist/hooks/useKeyboard.js +1 -1
  78. package/dist/hooks/useMiddlewareReducer.js +1 -1
  79. package/dist/hooks/useMouse.js +1 -1
  80. package/dist/hooks/useSetState.js +1 -1
  81. package/dist/hooks/useSheetEvent.d.ts +1 -1
  82. package/dist/hooks/useSheetEvent.js +2 -2
  83. package/dist/hooks/useWidthConfig.d.ts +1 -1
  84. package/dist/hooks/useWidthConfig.js +2 -2
  85. package/dist/type/sheet.d.ts +8 -1
  86. package/dist/type/sheetTable.d.ts +15 -2
  87. package/package.json +4 -1
@@ -0,0 +1,121 @@
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 { throttle } from 'lodash';
15
+ import { useCallback, useEffect } from 'react';
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 = throttle(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
+ if (ratio < 1) {
100
+ setRemarkInfo({
101
+ show: false
102
+ });
103
+ }
104
+ }, {
105
+ threshold: 1
106
+ });
107
+ io.observe(cell);
108
+ return function () {
109
+ var _io2;
110
+ if (cell) {
111
+ var _io;
112
+ (_io = io) === null || _io === void 0 || _io.unobserve(cell);
113
+ }
114
+ (_io2 = io) === null || _io2 === void 0 || _io2.disconnect();
115
+ io = undefined;
116
+ };
117
+ }, [start]);
118
+ return {
119
+ remarkInfo: _objectSpread({}, remarkInfo)
120
+ };
121
+ };
@@ -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;
@@ -8,21 +8,23 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
8
8
  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; }
9
9
  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; } }
10
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
11
- import { createElement, useEffect, useMemo, useRef } from "../../../../node_modules/@types/react";
11
+ import { createElement, useEffect, useMemo, useRef } from 'react';
12
12
  import { useSetState, useSheetEvent, useWidth } from "../../../hooks";
13
13
  import { classNames } from "../../util";
14
14
  import { CheckViewer } from "../../viewer/checkViewer";
15
15
  import { GroupViewer } from "../../viewer/groupViewer";
16
16
  import "./index.less";
17
- import { jsx as _jsx } from "../../../../node_modules/@types/react/jsx-runtime";
18
- import { jsxs as _jsxs } from "../../../../node_modules/@types/react/jsx-runtime";
19
- import { Fragment as _Fragment } from "../../../../node_modules/@types/react/jsx-runtime";
17
+ import { jsx as _jsx } from "react/jsx-runtime";
18
+ import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ import { Fragment as _Fragment } from "react/jsx-runtime";
20
20
  export var DraggableShell = function DraggableShell(_ref) {
21
21
  var columns = _ref.columns,
22
22
  className = _ref.className,
23
23
  showGroup = _ref.showGroup,
24
24
  showSelect = _ref.showSelect,
25
25
  controlProps = _ref.controlProps,
26
+ _ref$dragable = _ref.dragable,
27
+ dragable = _ref$dragable === void 0 ? true : _ref$dragable,
26
28
  _ref$controlWidth = _ref.controlWidth,
27
29
  controlWidth = _ref$controlWidth === void 0 ? 30 : _ref$controlWidth;
28
30
  var TableShell = function TableShell(_ref2) {
@@ -190,7 +192,7 @@ export var DraggableShell = function DraggableShell(_ref) {
190
192
  },
191
193
  children: /*#__PURE__*/_jsx("span", {
192
194
  className: "value-viewer",
193
- children: typeof item.title === 'function' ? createElement(item.title) : item.title
195
+ children: typeof item.title === 'function' ? /*#__PURE__*/createElement(item.title) : item.title
194
196
  })
195
197
  }, (_item$dataIndex2 = item.dataIndex) !== null && _item$dataIndex2 !== void 0 ? _item$dataIndex2 : index));
196
198
  if (item.fixed === 'left') {
@@ -203,6 +205,9 @@ export var DraggableShell = function DraggableShell(_ref) {
203
205
  return ths;
204
206
  }, [columns, colItems, isScrolledOver, isScrolledToEnd]);
205
207
  useEffect(function () {
208
+ if (!dragable) {
209
+ return;
210
+ }
206
211
  var handleMouseUp = function handleMouseUp() {
207
212
  //结束宽度调整
208
213
  if (downRef.current) {
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
2
  import type { SheetType } from "../../type";
3
3
  import './draggableShell/index.less';
4
- export declare const TableShell: ({ columns, className, showGroup, showSelect, controlProps, controlWidth, }: SheetType.SheetShell) => import("../../../node_modules/@types/react").FC<{
5
- children: React.ReactElement;
4
+ export declare const TableShell: (props: SheetType.SheetShell) => import("react").FC<{
5
+ children: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
6
6
  isScrolledOver: boolean;
7
7
  isScrolledToEnd: boolean;
8
8
  }>;
@@ -1,157 +1,13 @@
1
- import { useMemo } from "../../../node_modules/@types/react";
2
- import { useSheetEvent } from "../../hooks";
3
- import { classNames } from "../util";
4
- import { CheckViewer } from "../viewer/checkViewer";
5
- import { GroupViewer } from "../viewer/groupViewer";
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); }
6
7
  import "./draggableShell/index.less";
7
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
8
- import { jsxs as _jsxs } from "../../../node_modules/@types/react/jsx-runtime";
9
- import { Fragment as _Fragment } from "../../../node_modules/@types/react/jsx-runtime";
10
- export var TableShell = function TableShell(_ref) {
11
- var columns = _ref.columns,
12
- className = _ref.className,
13
- showGroup = _ref.showGroup,
14
- showSelect = _ref.showSelect,
15
- controlProps = _ref.controlProps,
16
- _ref$controlWidth = _ref.controlWidth,
17
- controlWidth = _ref$controlWidth === void 0 ? 30 : _ref$controlWidth;
18
- var TableShell = function TableShell(_ref2) {
19
- var children = _ref2.children,
20
- isScrolledOver = _ref2.isScrolledOver,
21
- isScrolledToEnd = _ref2.isScrolledToEnd;
22
- var eventBus = useSheetEvent();
23
- var colItems = useMemo(function () {
24
- var cols = [];
25
- if (showGroup || showSelect) {
26
- cols.push( /*#__PURE__*/_jsx("col", {
27
- className: classNames('sheet-control'),
28
- style: {
29
- width: controlWidth,
30
- border: 'none'
31
- }
32
- }, "sheet-control"));
33
- }
34
- columns.forEach(function (item, index) {
35
- cols.push( /*#__PURE__*/_jsx("col", {
36
- className: classNames('cell'),
37
- style: {
38
- width: item.width || 'unset',
39
- border: 'none'
40
- }
41
- }, item.dataIndex || index));
42
- });
43
- return cols;
44
- }, [columns, showGroup || showSelect, controlWidth]);
45
- var thItems = useMemo(function () {
46
- var ths = [];
47
- var hasControl = showGroup || showSelect;
48
- var positionArr = [];
49
- if (hasControl) {
50
- var _controlProps$group, _controlProps$check, _controlProps$check2, _controlProps$check3;
51
- ths.push( /*#__PURE__*/_jsxs("th", {
52
- className: "cell cell-title read-only sheet-control",
53
- children: [showGroup && /*#__PURE__*/_jsx(GroupViewer, {
54
- row: -1,
55
- col: -1,
56
- value: true,
57
- record: {
58
- open: controlProps === null || controlProps === void 0 || (_controlProps$group = controlProps.group) === null || _controlProps$group === void 0 ? void 0 : _controlProps$group.open,
59
- isHeader: true
60
- }
61
- }), showSelect && /*#__PURE__*/_jsx(CheckViewer, {
62
- row: -1,
63
- col: -1,
64
- value: controlProps === null || controlProps === void 0 || (_controlProps$check = controlProps.check) === null || _controlProps$check === void 0 ? void 0 : _controlProps$check.checked,
65
- record: {
66
- open: controlProps === null || controlProps === void 0 || (_controlProps$check2 = controlProps.check) === null || _controlProps$check2 === void 0 ? void 0 : _controlProps$check2.checked,
67
- isHeader: true,
68
- indeterminate: controlProps === null || controlProps === void 0 || (_controlProps$check3 = controlProps.check) === null || _controlProps$check3 === void 0 ? void 0 : _controlProps$check3.indeterminate
69
- }
70
- })]
71
- }, "-1"));
72
- positionArr.push({
73
- isLastFixedLeft: false,
74
- isFirstFixedRight: false,
75
- fixPosition: 0
76
- });
77
- }
78
- var fixLeftPosition = 0;
79
- var fixRightPosition = columns.reduce(function (pre, cur, index) {
80
- if (cur.fixed === 'right') {
81
- var positionIndex = hasControl ? index + 1 : index;
82
- return pre + colItems[positionIndex].props.style.width;
83
- }
84
- return pre + 0;
85
- }, 0);
86
- columns.forEach(function (item, index) {
87
- var _item$titleConfig, _item$titleConfig2, _ref3;
88
- var positionIndex = hasControl ? index + 1 : index;
89
- if (item.fixed === 'right') {
90
- fixRightPosition -= colItems[positionIndex].props.style.width;
91
- }
92
- var isLastFixedLeft = item.fixed === 'left' && !columns.slice(index + 1).some(function (item) {
93
- return item.fixed === 'left';
94
- });
95
- var isFirstFixedRight = item.fixed === 'right' && !columns.slice(0, index).some(function (item) {
96
- return item.fixed === 'right';
97
- });
98
- positionArr.push({
99
- isLastFixedLeft: isLastFixedLeft,
100
- isFirstFixedRight: isFirstFixedRight,
101
- fixPosition: item.fixed === 'right' ? fixRightPosition : fixLeftPosition
102
- });
103
- ((_item$titleConfig = item.titleConfig) === null || _item$titleConfig === void 0 ? void 0 : _item$titleConfig.colSpan) !== 0 && ths.push( /*#__PURE__*/_jsx("th", {
104
- className: classNames('cell', 'cell-title', 'read-only', item.fixed && 'fixed', item.fixed && "fixed-".concat(item.fixed), isLastFixedLeft && isScrolledOver ? "last-fixed-left" : '', isFirstFixedRight && !isScrolledToEnd ? "first-fixed-right" : ''),
105
- colSpan: (_item$titleConfig2 = item.titleConfig) === null || _item$titleConfig2 === void 0 ? void 0 : _item$titleConfig2.colSpan,
106
- onClick: function onClick() {
107
- eventBus.emit('col-select', {
108
- col: index
109
- });
110
- },
111
- style: {
112
- textAlign: (_ref3 = item.align) !== null && _ref3 !== void 0 ? _ref3 : 'unset',
113
- cursor: 'e-resizer',
114
- left: item.fixed === 'left' ? fixLeftPosition : 'unset',
115
- right: item.fixed === 'right' ? fixRightPosition : 'unset'
116
- },
117
- children: /*#__PURE__*/_jsx("span", {
118
- className: "value-viewer",
119
- children: item.title
120
- })
121
- }, item.dataIndex || index));
122
- if (item.fixed === 'left') {
123
- fixLeftPosition += colItems[positionIndex].props.style.width;
124
- }
125
- });
126
- setTimeout(function () {
127
- eventBus.emit('change-fixed-position', positionArr);
128
- }, 16);
129
- return ths;
130
- }, [columns, showGroup || showSelect, controlProps, isScrolledOver, isScrolledToEnd]);
131
- return /*#__PURE__*/_jsxs(_Fragment, {
132
- children: [/*#__PURE__*/_jsxs("table", {
133
- className: classNames('header', 'harvest-sheet', className),
134
- style: {
135
- position: 'sticky',
136
- top: 0,
137
- zIndex: 3
138
- },
139
- children: [/*#__PURE__*/_jsx("colgroup", {
140
- children: colItems
141
- }), /*#__PURE__*/_jsx("thead", {
142
- children: /*#__PURE__*/_jsx("tr", {
143
- children: thItems
144
- })
145
- })]
146
- }, "header"), /*#__PURE__*/_jsxs("table", {
147
- className: classNames('body', 'harvest-sheet'),
148
- children: [/*#__PURE__*/_jsx("colgroup", {
149
- children: colItems
150
- }), /*#__PURE__*/_jsx("tbody", {
151
- children: children
152
- }, "tbody")]
153
- }, "body")]
154
- });
155
- };
156
- return TableShell;
8
+ import { DraggableShell } from "./draggableShell";
9
+ export var TableShell = function TableShell(props) {
10
+ return DraggableShell(_objectSpread(_objectSpread({}, props), {}, {
11
+ dragable: false
12
+ }));
157
13
  };
@@ -1,5 +1,4 @@
1
- import React from "../../../node_modules/@types/react";
2
- import './index.less';
1
+ import React from "react";
3
2
  export declare const AddButton: React.FC<{
4
3
  handleAdd?: () => void;
5
4
  handleBatchAdd?: (count: number) => void;
@@ -6,10 +6,9 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
6
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
7
  import { MoreOutlined } from "@ant-design/icons";
8
8
  import { Form, InputNumber, Popover, Button } from "antd";
9
- import React, { useEffect, useRef, useState } from "../../../node_modules/@types/react";
10
- import "./index.less";
11
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
12
- import { jsxs as _jsxs } from "../../../node_modules/@types/react/jsx-runtime";
9
+ import React, { useEffect, useRef, useState } from "react";
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
12
  var RowPop = function RowPop(props) {
14
13
  var handleBatchAdd = props.handleBatchAdd;
15
14
  var inputRef = useRef(null);
@@ -1,5 +1,5 @@
1
1
  import { SheetTableType, SheetType } from "../../type";
2
- import { FC } from "../../../node_modules/@types/react";
2
+ import { FC } from 'react';
3
3
  export declare const SelectionEvent: FC<{
4
4
  hasChildren: boolean;
5
5
  rowSelection?: SheetTableType.TableRowSelection;
@@ -13,9 +13,9 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
13
13
  /* eslint-disable @typescript-eslint/no-unused-vars */
14
14
  import { useGroup } from "../../hooks/useGroupConfig";
15
15
  import { SheetEvent } from "../sheet/Event";
16
- import { jsx as _jsx } from "../../../node_modules/@types/react/jsx-runtime";
17
- import { Fragment as _Fragment } from "../../../node_modules/@types/react/jsx-runtime";
18
- import { jsxs as _jsxs } from "../../../node_modules/@types/react/jsx-runtime";
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { Fragment as _Fragment } from "react/jsx-runtime";
18
+ import { jsxs as _jsxs } from "react/jsx-runtime";
19
19
  export var SelectionEvent = function SelectionEvent(props) {
20
20
  var hasChildren = props.hasChildren,
21
21
  rowSelection = props.rowSelection,
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { SheetTableType } from "../../type";
3
+ import './index.less';
3
4
  declare const Table: React.FC<SheetTableType.TableProps>;
4
5
  export default Table;