@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.
- package/dist/assets/arrow-mac-down.svg +19 -0
- package/dist/assets/arrow-mac-right.svg +17 -0
- package/dist/assets/arrow-windows-down.svg +17 -0
- package/dist/assets/arrow-windows-right.svg +17 -0
- package/dist/core/config.d.ts +3 -0
- package/dist/core/config.js +4 -1
- package/dist/core/editor/cascaderEditor/index.d.ts +1 -1
- package/dist/core/editor/cascaderEditor/index.js +12 -11
- package/dist/core/editor/cascaderEditor/index.less +15 -7
- package/dist/core/editor/dateEditor/index.js +31 -8
- package/dist/core/editor/dateEditor/index.less +9 -2
- package/dist/core/editor/numberEditor/index.d.ts +3 -1
- package/dist/core/editor/numberEditor/index.js +62 -27
- package/dist/core/editor/numberEditor/index.less +3 -2
- package/dist/core/editor/selectEditor/index.d.ts +1 -1
- package/dist/core/editor/selectEditor/index.js +34 -19
- package/dist/core/editor/selectEditor/index.less +16 -5
- package/dist/core/reducers/index.d.ts +2 -2
- package/dist/core/reducers/index.js +8 -1
- package/dist/core/reducers/keyboardReducer.js +39 -9
- package/dist/core/reducers/mouseReducer.js +115 -11
- package/dist/core/reducers/sideEffectReducer.d.ts +1 -1
- package/dist/core/reducers/sideEffectReducer.js +146 -41
- package/dist/core/reducers/stateReducer.d.ts +1 -0
- package/dist/core/reducers/stateReducer.js +96 -27
- package/dist/core/sheet/Cell.d.ts +1 -1
- package/dist/core/sheet/Cell.js +33 -24
- package/dist/core/sheet/Control.d.ts +21 -0
- package/dist/core/sheet/Control.js +83 -0
- package/dist/core/sheet/DataEditor.js +3 -3
- package/dist/core/sheet/DefaultCell.d.ts +8 -3
- package/dist/core/sheet/DefaultCell.js +12 -8
- package/dist/core/sheet/DefaultRow.js +3 -9
- package/dist/core/sheet/DefaultRowMapper.d.ts +3 -0
- package/dist/core/sheet/DefaultRowMapper.js +22 -6
- package/dist/core/sheet/DefaultShell.js +1 -1
- package/dist/core/sheet/Event.d.ts +1 -1
- package/dist/core/sheet/Event.js +1 -1
- package/dist/core/sheet/Menu.d.ts +6 -0
- package/dist/core/sheet/Menu.js +21 -0
- package/dist/core/sheet/ValueViewer.js +1 -1
- package/dist/core/sheet/index.js +249 -88
- package/dist/core/sheet/index.less +199 -107
- package/dist/core/sheet/searchInput.d.ts +15 -0
- package/dist/core/sheet/searchInput.js +78 -0
- package/dist/core/sheet/useCellEvent.js +1 -1
- package/dist/core/sheet/useContextMenu.d.ts +1 -1
- package/dist/core/sheet/useContextMenu.js +13 -10
- package/dist/core/sheet/useKeyBoardEvent.js +19 -2
- package/dist/core/sheet/useMouseEvent.js +19 -12
- package/dist/core/sheet/useSearchInput.d.ts +11 -0
- package/dist/core/sheet/useSearchInput.js +65 -0
- package/dist/core/sheet/useSelectVisible.d.ts +1 -1
- package/dist/core/sheet/useSelectVisible.js +17 -7
- package/dist/core/sheet/useVirtualList.d.ts +10 -1
- package/dist/core/sheet/useVirtualList.js +44 -28
- package/dist/core/sheet/var.less +41 -34
- package/dist/core/shell/draggableShell/index.d.ts +4 -1
- package/dist/core/shell/draggableShell/index.js +133 -50
- package/dist/core/shell/tableShell.d.ts +4 -1
- package/dist/core/shell/tableShell.js +82 -34
- package/dist/core/table/addButton.d.ts +6 -0
- package/dist/core/table/addButton.js +103 -0
- package/dist/core/table/events.d.ts +1 -3
- package/dist/core/table/events.js +30 -35
- package/dist/core/table/index.js +97 -189
- package/dist/core/table/index.less +12 -0
- package/dist/core/table/useGroupConfig.d.ts +4 -1
- package/dist/core/table/useGroupConfig.js +139 -14
- package/dist/core/table/useRowSelection.d.ts +3 -0
- package/dist/core/table/useRowSelection.js +68 -2
- package/dist/core/util.d.ts +10 -4
- package/dist/core/util.js +121 -69
- package/dist/core/viewer/btnViewer/index.js +3 -3
- package/dist/core/viewer/cascaderViewer/index.js +6 -1
- package/dist/core/viewer/checkViewer/index.js +2 -2
- package/dist/core/viewer/editViewer/index.js +3 -3
- package/dist/core/viewer/groupViewer/index.js +26 -10
- package/dist/core/viewer/selectorViewer/index.js +7 -3
- package/dist/core/viewer/switchViewer/index.js +10 -4
- package/dist/example/antComponent.d.ts +1 -1
- package/dist/example/antComponent.js +63 -37
- package/dist/example/basic.d.ts +1 -1
- package/dist/example/basic.js +20 -14
- package/dist/example/ellipsis.d.ts +1 -1
- package/dist/example/ellipsis.js +3 -2
- package/dist/example/fixed.d.ts +1 -1
- package/dist/example/fixed.js +3 -2
- package/dist/example/group.js +40 -17
- package/dist/example/selection.d.ts +1 -1
- package/dist/example/selection.js +9 -8
- package/dist/example/sheet.d.ts +1 -1
- package/dist/example/sheet.js +21 -22
- package/dist/example/valuationAnalyze.d.ts +1 -0
- package/dist/example/valuationAnalyze.js +3 -4
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useEventBus.d.ts +1 -0
- package/dist/hooks/useEventBus.js +2 -2
- package/dist/hooks/useGroupConfig.d.ts +4 -0
- package/dist/hooks/useGroupConfig.js +5 -0
- package/dist/hooks/useKeyboard.d.ts +5 -2
- package/dist/hooks/useKeyboard.js +17 -3
- package/dist/hooks/useMiddlewareReducer.d.ts +5 -5
- package/dist/hooks/useMiddlewareReducer.js +3 -3
- package/dist/hooks/useMouse.d.ts +1 -1
- package/dist/hooks/useMouse.js +7 -7
- package/dist/hooks/useSetState.js +7 -7
- package/dist/hooks/useSheetEvent.d.ts +1 -1
- package/dist/hooks/useSheetEvent.js +2 -2
- package/dist/hooks/useWidthConfig.d.ts +3 -3
- package/dist/hooks/useWidthConfig.js +2 -2
- package/dist/standardUtils/index.d.ts +1 -1
- package/dist/standardUtils/index.js +1 -1
- package/dist/type/sheet.d.ts +77 -31
- package/dist/type/sheetTable.d.ts +21 -12
- package/package.json +7 -4
package/dist/example/group.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
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
7
|
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
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; }
|
|
5
|
-
function _iterableToArrayLimit(
|
|
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; } }
|
|
6
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
11
|
import { cloneDeep } from 'lodash';
|
|
8
|
-
import { useCallback, useState } from
|
|
12
|
+
import { useCallback, useState } from "../../node_modules/@types/react";
|
|
9
13
|
import Table from "../core/table";
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
|
|
11
15
|
var columns = [{
|
|
12
16
|
title: 'Name',
|
|
13
17
|
dataIndex: 'name',
|
|
@@ -19,7 +23,7 @@ var columns = [{
|
|
|
19
23
|
}, {
|
|
20
24
|
title: 'Address',
|
|
21
25
|
readonly: function readonly(value, record, index) {
|
|
22
|
-
console.log(index);
|
|
26
|
+
// console.log(index);
|
|
23
27
|
return index % 2 === 0;
|
|
24
28
|
},
|
|
25
29
|
dataIndex: 'address',
|
|
@@ -43,10 +47,12 @@ var data = [{
|
|
|
43
47
|
address: 'New York No. 1 Lake Park',
|
|
44
48
|
children: [{
|
|
45
49
|
id: 11,
|
|
46
|
-
key: '1-1'
|
|
50
|
+
key: '1-1',
|
|
51
|
+
parentId: 1
|
|
47
52
|
}, {
|
|
48
53
|
id: 12,
|
|
49
|
-
key: '1-2'
|
|
54
|
+
key: '1-2',
|
|
55
|
+
parentId: 1
|
|
50
56
|
}]
|
|
51
57
|
}, {
|
|
52
58
|
key: 2,
|
|
@@ -56,10 +62,12 @@ var data = [{
|
|
|
56
62
|
address: 'London No. 1 Lake Park',
|
|
57
63
|
children: [{
|
|
58
64
|
id: 21,
|
|
59
|
-
key: '2-1'
|
|
65
|
+
key: '2-1',
|
|
66
|
+
parentId: 2
|
|
60
67
|
}, {
|
|
61
68
|
id: 22,
|
|
62
|
-
key: '2-2'
|
|
69
|
+
key: '2-2',
|
|
70
|
+
parentId: 2
|
|
63
71
|
}]
|
|
64
72
|
}, {
|
|
65
73
|
key: 3,
|
|
@@ -75,10 +83,12 @@ var data = [{
|
|
|
75
83
|
address: 'Sidney No. 1 Lake Park',
|
|
76
84
|
children: [{
|
|
77
85
|
id: 41,
|
|
78
|
-
key: '4-1'
|
|
86
|
+
key: '4-1',
|
|
87
|
+
parentId: 4
|
|
79
88
|
}, {
|
|
80
89
|
id: 42,
|
|
81
|
-
key: '4-2'
|
|
90
|
+
key: '4-2',
|
|
91
|
+
parentId: 4
|
|
82
92
|
}]
|
|
83
93
|
}];
|
|
84
94
|
var App = function App() {
|
|
@@ -86,14 +96,27 @@ var App = function App() {
|
|
|
86
96
|
_useState2 = _slicedToArray(_useState, 2),
|
|
87
97
|
state = _useState2[0],
|
|
88
98
|
setState = _useState2[1];
|
|
89
|
-
var handleChange = useCallback(function (changes
|
|
90
|
-
console.log(extChange);
|
|
99
|
+
var handleChange = useCallback(function (changes) {
|
|
100
|
+
// console.log(extChange);
|
|
91
101
|
var newState = cloneDeep(state);
|
|
102
|
+
var flatNewState = newState.reduce(function (left, right) {
|
|
103
|
+
return [].concat(_toConsumableArray(left), [right], _toConsumableArray(right.children || []));
|
|
104
|
+
}, []);
|
|
92
105
|
changes.forEach(function (change) {
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
106
|
+
var key = change.key,
|
|
107
|
+
value = change.value,
|
|
108
|
+
id = change.id;
|
|
109
|
+
var changedItem = flatNewState.find(function (item) {
|
|
110
|
+
return item.id === id;
|
|
111
|
+
});
|
|
112
|
+
var parentIndex = newState.findIndex(function (item) {
|
|
113
|
+
return item.id === changedItem.parentId;
|
|
114
|
+
});
|
|
115
|
+
var childIndex = newState[parentIndex].children.findIndex(function (item) {
|
|
116
|
+
return item.id === id;
|
|
117
|
+
});
|
|
118
|
+
newState[parentIndex].children[childIndex][key] = value;
|
|
119
|
+
// newState[row][key] = value;
|
|
97
120
|
});
|
|
98
121
|
setState(newState);
|
|
99
122
|
}, [state]);
|
|
@@ -116,7 +139,7 @@ var App = function App() {
|
|
|
116
139
|
// rowExpandable: (record) => record.name !== 'Not Expandable',
|
|
117
140
|
// }}
|
|
118
141
|
,
|
|
119
|
-
dataSource:
|
|
142
|
+
dataSource: state,
|
|
120
143
|
onChange: handleChange
|
|
121
144
|
});
|
|
122
145
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
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(
|
|
6
|
-
function _toPrimitive(
|
|
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
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
8
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
9
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -12,12 +12,12 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
12
12
|
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."); }
|
|
13
13
|
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); }
|
|
14
14
|
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; }
|
|
15
|
-
function _iterableToArrayLimit(
|
|
15
|
+
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; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
import { Table } from "./..";
|
|
18
18
|
import 'antd/dist/antd.css';
|
|
19
|
-
import React, { useCallback, useState } from
|
|
20
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import React, { useCallback, useState } from "../../node_modules/@types/react";
|
|
20
|
+
import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
|
|
21
21
|
var columns = [{
|
|
22
22
|
title: 'Name',
|
|
23
23
|
dataIndex: 'name',
|
|
@@ -72,6 +72,7 @@ var App = function App() {
|
|
|
72
72
|
}, [dataSource]);
|
|
73
73
|
var handleRowChange = useCallback(function () {}, []);
|
|
74
74
|
return /*#__PURE__*/_jsx(Table, {
|
|
75
|
+
draggable: true,
|
|
75
76
|
columns: columns,
|
|
76
77
|
rowKey: "key",
|
|
77
78
|
dataSource: dataSource,
|
package/dist/example/sheet.d.ts
CHANGED
package/dist/example/sheet.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
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(
|
|
6
|
-
function _toPrimitive(
|
|
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
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
8
8
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
9
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -12,20 +12,20 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
12
12
|
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."); }
|
|
13
13
|
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); }
|
|
14
14
|
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; }
|
|
15
|
-
function _iterableToArrayLimit(
|
|
15
|
+
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; } }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
17
|
import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons';
|
|
18
18
|
import { Sheet } from "./..";
|
|
19
19
|
import { Tooltip } from 'antd';
|
|
20
20
|
import { cloneDeep, isNil, random, range } from 'lodash';
|
|
21
|
-
import React, { useCallback, useEffect, useMemo, useRef, useState } from
|
|
21
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "../../node_modules/@types/react";
|
|
22
22
|
import { SheetEvent } from "../core/sheet/Event";
|
|
23
23
|
import { DraggableShell } from "../core/shell/draggableShell";
|
|
24
24
|
import { changeGroupConfig } from "../core/util";
|
|
25
25
|
import { useSheetEvent } from "../hooks";
|
|
26
26
|
import "./index.less";
|
|
27
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
28
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
|
|
28
|
+
import { jsxs as _jsxs } from "../../node_modules/@types/react/jsx-runtime";
|
|
29
29
|
var ExcelIndexCell = function ExcelIndexCell(_ref) {
|
|
30
30
|
var value = _ref.value,
|
|
31
31
|
row = _ref.row,
|
|
@@ -100,7 +100,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
100
100
|
newGrid.forEach(function (row, index) {
|
|
101
101
|
row[0].value = index + 1;
|
|
102
102
|
});
|
|
103
|
-
(_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0
|
|
103
|
+
(_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0 || _sheetInstance$curren.pushToHistory({
|
|
104
104
|
type: 'NewRow',
|
|
105
105
|
changes: [],
|
|
106
106
|
rowInfo: {
|
|
@@ -113,7 +113,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
113
113
|
});
|
|
114
114
|
setState(newGrid);
|
|
115
115
|
setGroupConfig(newGroupConfig);
|
|
116
|
-
(_sheetInstance$curren2 = sheetInstance.current) === null || _sheetInstance$curren2 === void 0
|
|
116
|
+
(_sheetInstance$curren2 = sheetInstance.current) === null || _sheetInstance$curren2 === void 0 || _sheetInstance$curren2.selectRow(index);
|
|
117
117
|
}, [state, groupConfig]);
|
|
118
118
|
var handleDeleteRow = useCallback(function (index) {
|
|
119
119
|
var _sheetInstance$curren3;
|
|
@@ -125,7 +125,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
125
125
|
var newGroupConfig = changeGroupConfig(groupConfig, {
|
|
126
126
|
remove: index
|
|
127
127
|
});
|
|
128
|
-
(_sheetInstance$curren3 = sheetInstance.current) === null || _sheetInstance$curren3 === void 0
|
|
128
|
+
(_sheetInstance$curren3 = sheetInstance.current) === null || _sheetInstance$curren3 === void 0 || _sheetInstance$curren3.pushToHistory({
|
|
129
129
|
type: 'DeleteRow',
|
|
130
130
|
changes: deleteRow[0].map(function (item, col) {
|
|
131
131
|
return {
|
|
@@ -158,7 +158,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
158
158
|
});
|
|
159
159
|
setState(newGrid);
|
|
160
160
|
setGroupConfig(extraInfo);
|
|
161
|
-
(_sheetInstance$curren4 = sheetInstance.current) === null || _sheetInstance$curren4 === void 0
|
|
161
|
+
(_sheetInstance$curren4 = sheetInstance.current) === null || _sheetInstance$curren4 === void 0 || _sheetInstance$curren4.selectRow();
|
|
162
162
|
} else if (type === 'DeleteRow') {
|
|
163
163
|
if (!(rowInfo !== null && rowInfo !== void 0 && rowInfo.deleteRow) && (rowInfo === null || rowInfo === void 0 ? void 0 : rowInfo.deleteRow) !== 0) return;
|
|
164
164
|
newGrid.splice(rowInfo.deleteRow - 1, 0, changes.map(function (item) {
|
|
@@ -192,7 +192,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
192
192
|
});
|
|
193
193
|
newGrid[row] = newRow;
|
|
194
194
|
});
|
|
195
|
-
extChanges === null || extChanges === void 0
|
|
195
|
+
extChanges === null || extChanges === void 0 || extChanges.forEach(function (item) {
|
|
196
196
|
var _ref5 = item,
|
|
197
197
|
row = _ref5.row,
|
|
198
198
|
col = _ref5.col,
|
|
@@ -224,7 +224,6 @@ var BasicSheet = function BasicSheet() {
|
|
|
224
224
|
// }));
|
|
225
225
|
// newGrid.push(newRow);
|
|
226
226
|
}
|
|
227
|
-
|
|
228
227
|
newGrid[row][col] = _objectSpread(_objectSpread({}, newGrid[row][col]), {}, {
|
|
229
228
|
value: value
|
|
230
229
|
});
|
|
@@ -301,7 +300,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
301
300
|
var _ref7 = e,
|
|
302
301
|
type = _ref7.type,
|
|
303
302
|
row = _ref7.row;
|
|
304
|
-
console.log('click', state.length);
|
|
303
|
+
// console.log('click', state.length);
|
|
305
304
|
if (type === '1') {
|
|
306
305
|
handleNewRow(row);
|
|
307
306
|
}
|
|
@@ -313,7 +312,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
313
312
|
}
|
|
314
313
|
}, [state, groupConfig]);
|
|
315
314
|
useEffect(function () {
|
|
316
|
-
console.log('rendered', performance.now());
|
|
315
|
+
// console.log('rendered', performance.now());
|
|
317
316
|
}, []);
|
|
318
317
|
return /*#__PURE__*/_jsxs(Sheet, {
|
|
319
318
|
sheetInstance: sheetInstance,
|
|
@@ -325,7 +324,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
325
324
|
groupConfig: groupConfig,
|
|
326
325
|
scroll: {
|
|
327
326
|
x: '100%',
|
|
328
|
-
y: '100vh'
|
|
327
|
+
y: 'calc(100vh - 290px)'
|
|
329
328
|
},
|
|
330
329
|
sheetRenderer: WrappedTableShell,
|
|
331
330
|
menuRenderer: MenuRender,
|
|
@@ -341,7 +340,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
341
340
|
});
|
|
342
341
|
if (index >= 0) {
|
|
343
342
|
var _sheetInstance$curren5;
|
|
344
|
-
console.log('changed');
|
|
343
|
+
// console.log('changed');
|
|
345
344
|
var groupOpen = _toConsumableArray(groupConfig.groupOpen);
|
|
346
345
|
groupOpen[index] = !groupConfig.groupOpen[index];
|
|
347
346
|
var newGrid = _toConsumableArray(state);
|
|
@@ -356,7 +355,7 @@ var BasicSheet = function BasicSheet() {
|
|
|
356
355
|
groupOpen: groupOpen
|
|
357
356
|
}));
|
|
358
357
|
setState(newGrid);
|
|
359
|
-
(_sheetInstance$curren5 = sheetInstance.current) === null || _sheetInstance$curren5 === void 0
|
|
358
|
+
(_sheetInstance$curren5 = sheetInstance.current) === null || _sheetInstance$curren5 === void 0 || _sheetInstance$curren5.pushToHistory({
|
|
360
359
|
type: 'Custom',
|
|
361
360
|
changes: [],
|
|
362
361
|
extraInfo: {
|
|
@@ -377,13 +376,13 @@ var BasicSheet = function BasicSheet() {
|
|
|
377
376
|
children: [/*#__PURE__*/_jsx("div", {
|
|
378
377
|
onClick: function onClick() {
|
|
379
378
|
var _sheetInstance$curren6;
|
|
380
|
-
(_sheetInstance$curren6 = sheetInstance.current) === null || _sheetInstance$curren6 === void 0
|
|
379
|
+
(_sheetInstance$curren6 = sheetInstance.current) === null || _sheetInstance$curren6 === void 0 || _sheetInstance$curren6.zoomTo(0);
|
|
381
380
|
},
|
|
382
381
|
children: "\u56DE\u5230\u9876\u90E8"
|
|
383
382
|
}), /*#__PURE__*/_jsx("div", {
|
|
384
383
|
onClick: function onClick() {
|
|
385
384
|
var _sheetInstance$curren7;
|
|
386
|
-
(_sheetInstance$curren7 = sheetInstance.current) === null || _sheetInstance$curren7 === void 0
|
|
385
|
+
(_sheetInstance$curren7 = sheetInstance.current) === null || _sheetInstance$curren7 === void 0 || _sheetInstance$curren7.zoomTo();
|
|
387
386
|
},
|
|
388
387
|
children: "\u56DE\u5230\u7F16\u8F91\u884C"
|
|
389
388
|
})]
|
|
@@ -2,15 +2,15 @@ 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(
|
|
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 { getNumberEditor, getSelectEditor, Table } from "./..";
|
|
8
8
|
import { Button } from 'antd';
|
|
9
9
|
import { isNil } from 'lodash';
|
|
10
|
-
import { useCallback, useState } from
|
|
10
|
+
import { useCallback, useState } from "../../node_modules/@types/react";
|
|
11
11
|
import { SwitchViewer } from "../core/viewer";
|
|
12
12
|
import { SheetType } from "../type";
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx } from "../../node_modules/@types/react/jsx-runtime";
|
|
14
14
|
var RateValueInput = getNumberEditor({
|
|
15
15
|
addonAfter: '%',
|
|
16
16
|
min: 0,
|
|
@@ -217,7 +217,6 @@ export default (function () {
|
|
|
217
217
|
// return <div className="value-viewer number-value-viewer" />;
|
|
218
218
|
// },
|
|
219
219
|
}];
|
|
220
|
-
|
|
221
220
|
var handleChange = useCallback(function () {}, [state]);
|
|
222
221
|
return /*#__PURE__*/_jsx(Table, {
|
|
223
222
|
columns: columns,
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export type { Dispatch, FunctionAction, NormalAction, } from './useMiddlewareRed
|
|
|
5
5
|
export { useMouse } from './useMouse';
|
|
6
6
|
export { useSetState } from './useSetState';
|
|
7
7
|
export { SheetEventContext, useSheetEvent } from './useSheetEvent';
|
|
8
|
-
export {
|
|
8
|
+
export { WidthContext, useWidth } from './useWidthConfig';
|
package/dist/hooks/index.js
CHANGED
|
@@ -4,4 +4,4 @@ export { useMiddlewareReducer } from "./useMiddlewareReducer";
|
|
|
4
4
|
export { useMouse } from "./useMouse";
|
|
5
5
|
export { useSetState } from "./useSetState";
|
|
6
6
|
export { SheetEventContext, useSheetEvent } from "./useSheetEvent";
|
|
7
|
-
export {
|
|
7
|
+
export { WidthContext, useWidth } from "./useWidthConfig";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import EventEmitter from 'events';
|
|
2
|
-
import { useEffect, useRef } from
|
|
2
|
+
import { useEffect, useRef } from "../../node_modules/@types/react";
|
|
3
3
|
var useEventBus = function useEventBus() {
|
|
4
4
|
var eventBus = useRef(new EventEmitter());
|
|
5
5
|
useEffect(function () {
|
|
6
6
|
return function () {
|
|
7
7
|
var _eventBus$current;
|
|
8
|
-
(_eventBus$current = eventBus.current) === null || _eventBus$current === void 0
|
|
8
|
+
(_eventBus$current = eventBus.current) === null || _eventBus$current === void 0 || _eventBus$current.removeAllListeners();
|
|
9
9
|
eventBus.current = null;
|
|
10
10
|
};
|
|
11
11
|
}, []);
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type KeyOrClipBoardEvent = (event: KeyboardEvent | ClipboardEvent, value?: any) => void;
|
|
2
|
+
type KeyboardHandler = {
|
|
3
3
|
move: KeyOrClipBoardEvent;
|
|
4
4
|
escape: KeyOrClipBoardEvent;
|
|
5
|
+
selectAll: KeyOrClipBoardEvent;
|
|
5
6
|
delete: KeyOrClipBoardEvent;
|
|
6
7
|
enter: KeyOrClipBoardEvent;
|
|
7
8
|
otherInput: KeyOrClipBoardEvent;
|
|
8
9
|
copy: KeyOrClipBoardEvent;
|
|
9
10
|
paste: KeyOrClipBoardEvent;
|
|
10
11
|
reverse: KeyOrClipBoardEvent;
|
|
12
|
+
recover: KeyOrClipBoardEvent;
|
|
11
13
|
cut: KeyOrClipBoardEvent;
|
|
14
|
+
search: KeyOrClipBoardEvent;
|
|
12
15
|
};
|
|
13
16
|
export declare function move(keyCode: number, isShiftKey: boolean): {
|
|
14
17
|
row: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useCallback, useEffect } from
|
|
2
|
-
import { BACKSPACE_KEY, C_KEY, DELETE_KEY, DOWN_KEY, ENTER_KEY, ESCAPE_KEY, LEFT_KEY, RIGHT_KEY, TAB_KEY, UP_KEY, V_KEY, X_KEY, Z_KEY } from "../core/config";
|
|
1
|
+
import { useCallback, useEffect } from "../../node_modules/@types/react";
|
|
2
|
+
import { A_KEY, BACKSPACE_KEY, C_KEY, DELETE_KEY, DOWN_KEY, ENTER_KEY, ESCAPE_KEY, F_KEY, LEFT_KEY, RIGHT_KEY, TAB_KEY, UP_KEY, V_KEY, X_KEY, Y_KEY, Z_KEY } from "../core/config";
|
|
3
3
|
import { isInputKey } from "../core/util";
|
|
4
4
|
var ua = window.navigator.userAgent;
|
|
5
5
|
var isIE = /MSIE|Trident/.test(ua);
|
|
@@ -51,11 +51,25 @@ export var useKeyBoard = function useKeyBoard(handler, listenElement) {
|
|
|
51
51
|
handler.escape(e);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
var
|
|
54
|
+
var isSearch = ctrlKeyPressed && keyCode === F_KEY;
|
|
55
|
+
if (isSearch) {
|
|
56
|
+
handler.search(e);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
var isReverse = ctrlKeyPressed && keyCode === Z_KEY && !shiftKey;
|
|
55
60
|
if (isReverse) {
|
|
56
61
|
handler.reverse(e);
|
|
57
62
|
return;
|
|
58
63
|
}
|
|
64
|
+
var isRecover = ctrlKeyPressed && (keyCode === Z_KEY && shiftKey || keyCode === Y_KEY);
|
|
65
|
+
if (isRecover) {
|
|
66
|
+
handler.recover(e);
|
|
67
|
+
}
|
|
68
|
+
var isSelectAll = ctrlKeyPressed && keyCode === A_KEY;
|
|
69
|
+
if (isSelectAll) {
|
|
70
|
+
handler.selectAll(e);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
59
73
|
var isCopy = ctrlKeyPressed && keyCode === C_KEY;
|
|
60
74
|
if (isCopy && isIE) {
|
|
61
75
|
handler.copy(e);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type NormalAction = {
|
|
2
2
|
type: string;
|
|
3
3
|
payload?: any;
|
|
4
4
|
};
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
5
|
+
export type FunctionAction = (dispatch: any, getState?: () => any) => any;
|
|
6
|
+
export type Dispatch = (action: any) => any;
|
|
7
|
+
export type MiddlewareAPI<A> = {
|
|
8
8
|
getState: () => A;
|
|
9
9
|
dispatch: Dispatch;
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type Middleware<A> = (api: MiddlewareAPI<A>) => (next: Dispatch) => Dispatch;
|
|
12
12
|
export declare const useMiddlewareReducer: <A, B>(reducer: (state: A, action: B) => A, initialState: A, middleware?: Middleware<A>[]) => [A, Dispatch];
|
|
@@ -2,9 +2,9 @@ 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(
|
|
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 * as React from
|
|
7
|
+
import * as React from "../../node_modules/@types/react";
|
|
8
8
|
export var useMiddlewareReducer = function useMiddlewareReducer(reducer, initialState) {
|
|
9
9
|
var middleware = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
10
10
|
var _React$useState = React.useState(initialState),
|
|
@@ -21,7 +21,7 @@ export var useMiddlewareReducer = function useMiddlewareReducer(reducer, initial
|
|
|
21
21
|
return stateRef.current;
|
|
22
22
|
},
|
|
23
23
|
dispatch: function (_dispatch) {
|
|
24
|
-
function dispatch(
|
|
24
|
+
function dispatch(_x) {
|
|
25
25
|
return _dispatch.apply(this, arguments);
|
|
26
26
|
}
|
|
27
27
|
dispatch.toString = function () {
|
package/dist/hooks/useMouse.d.ts
CHANGED
package/dist/hooks/useMouse.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { debounce } from 'lodash';
|
|
2
|
-
import { useCallback, useEffect, useRef } from
|
|
2
|
+
import { useCallback, useEffect, useRef } from "../../node_modules/@types/react";
|
|
3
3
|
export var useMouse = function useMouse(handler, listenElement) {
|
|
4
4
|
var mouseUp = handler.mouseUp,
|
|
5
5
|
mouseDown = handler.mouseDown,
|
|
@@ -32,9 +32,9 @@ export var useMouse = function useMouse(handler, listenElement) {
|
|
|
32
32
|
document.removeEventListener('mouseup', listenerMouseUp);
|
|
33
33
|
document.removeEventListener('mousedown', listenerMouseDown);
|
|
34
34
|
document.removeEventListener('dblclick', listenerDoubleClick);
|
|
35
|
-
listenElement === null || listenElement === void 0
|
|
36
|
-
listenElement === null || listenElement === void 0
|
|
37
|
-
listenElement === null || listenElement === void 0
|
|
35
|
+
listenElement === null || listenElement === void 0 || listenElement.removeEventListener('mouseover', listenerMouseOver);
|
|
36
|
+
listenElement === null || listenElement === void 0 || listenElement.removeEventListener('mouseleave', listenerMouseLeave);
|
|
37
|
+
listenElement === null || listenElement === void 0 || listenElement.removeEventListener('mouseenter', listenerMouseEnter);
|
|
38
38
|
};
|
|
39
39
|
}, []);
|
|
40
40
|
useEffect(function () {
|
|
@@ -61,8 +61,8 @@ export var useMouse = function useMouse(handler, listenElement) {
|
|
|
61
61
|
document.addEventListener('mouseup', wrappedMouseUp);
|
|
62
62
|
document.addEventListener('mousedown', wrappedMouseDown);
|
|
63
63
|
document.addEventListener('dblclick', wrappedMouseDoubleClick);
|
|
64
|
-
listenElement === null || listenElement === void 0
|
|
65
|
-
listenElement === null || listenElement === void 0
|
|
66
|
-
listenElement === null || listenElement === void 0
|
|
64
|
+
listenElement === null || listenElement === void 0 || listenElement.addEventListener('mouseover', debounceOver);
|
|
65
|
+
listenElement === null || listenElement === void 0 || listenElement.addEventListener('mouseleave', mouseLeave);
|
|
66
|
+
listenElement === null || listenElement === void 0 || listenElement.addEventListener('mouseenter', mouseEnter);
|
|
67
67
|
}, [listenElement]);
|
|
68
68
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
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(
|
|
6
|
-
function _toPrimitive(
|
|
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
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
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
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
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(
|
|
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
|
-
import { useCallback, useState } from
|
|
13
|
+
import { useCallback, useState } from "../../node_modules/@types/react";
|
|
14
14
|
var useSetState = function useSetState() {
|
|
15
15
|
var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
16
16
|
var _useState = useState(initialState),
|