@zhenliang/sheet 0.1.72-beta.4 → 0.1.72-beta.5
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/changes.md +45 -0
- package/dist/core/editor/dateEditor/index.js +6 -6
- package/dist/core/editor/numberEditor/index.d.ts +1 -1
- package/dist/core/editor/numberEditor/index.js +7 -7
- package/dist/core/editor/selectEditor/index.js +6 -6
- package/dist/core/reducers/index.d.ts +2 -2
- package/dist/core/reducers/keyboardReducer.js +6 -6
- package/dist/core/reducers/mouseReducer.js +7 -7
- package/dist/core/reducers/sideEffectReducer.d.ts +1 -1
- package/dist/core/reducers/sideEffectReducer.js +14 -14
- package/dist/core/reducers/stateReducer.js +10 -10
- package/dist/core/sheet/Cell.d.ts +1 -1
- package/dist/core/sheet/Cell.js +2 -2
- package/dist/core/sheet/DataEditor.js +1 -1
- package/dist/core/sheet/DefaultCell.d.ts +1 -1
- package/dist/core/sheet/DefaultCell.js +5 -5
- package/dist/core/sheet/DefaultRowMapper.js +5 -5
- package/dist/core/sheet/index.js +11 -11
- package/dist/core/sheet/index.less +7 -4
- package/dist/core/sheet/searchInput.js +1 -1
- package/dist/core/sheet/useContextMenu.d.ts +1 -1
- package/dist/core/sheet/useContextMenu.js +8 -8
- package/dist/core/sheet/useKeyBoardEvent.js +1 -1
- package/dist/core/sheet/useMouseEvent.js +10 -7
- package/dist/core/sheet/useSearchInput.js +8 -8
- package/dist/core/sheet/useSelectVisible.js +3 -3
- package/dist/core/sheet/useVirtualList.js +3 -3
- package/dist/core/shell/draggableShell/index.d.ts +0 -1
- package/dist/core/shell/draggableShell/index.js +10 -10
- package/dist/core/shell/tableShell.d.ts +0 -1
- package/dist/core/shell/tableShell.js +4 -4
- package/dist/core/table/addButton.js +2 -2
- package/dist/core/table/events.js +7 -7
- package/dist/core/table/index.js +7 -7
- package/dist/core/table/useGroupConfig.js +10 -10
- package/dist/core/table/useRowSelection.js +1 -1
- package/dist/core/util.js +14 -14
- package/dist/core/viewer/groupViewer/index.js +3 -3
- package/dist/example/antComponent.js +9 -9
- package/dist/example/basic.js +6 -6
- package/dist/example/group.js +2 -1
- package/dist/example/selection.js +6 -6
- package/dist/example/sheet.js +15 -14
- package/dist/example/valuationAnalyze.d.ts +1 -1
- package/dist/example/valuationAnalyze.js +2 -1
- package/dist/hooks/useEventBus.d.ts +0 -1
- package/dist/hooks/useEventBus.js +1 -1
- package/dist/hooks/useKeyboard.d.ts +2 -2
- package/dist/hooks/useMiddlewareReducer.d.ts +5 -5
- package/dist/hooks/useMiddlewareReducer.js +2 -2
- package/dist/hooks/useMouse.d.ts +1 -1
- package/dist/hooks/useMouse.js +6 -6
- package/dist/hooks/useSetState.js +6 -6
- package/dist/standardUtils/index.d.ts +1 -1
- package/dist/standardUtils/index.js +1 -1
- package/dist/type/sheet.d.ts +31 -31
- package/dist/type/sheetTable.d.ts +9 -9
- package/package.json +1 -1
package/dist/core/sheet/index.js
CHANGED
|
@@ -2,7 +2,7 @@ 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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
8
8
|
// import ReduxLogger from 'redux-logger';
|
|
@@ -111,14 +111,14 @@ var Sheet = function Sheet(props) {
|
|
|
111
111
|
var firstRowCell = container.querySelector("td.cell[data-col='".concat(start === null || start === void 0 ? void 0 : start.col, "']"));
|
|
112
112
|
var colPosition = firstRowCell ? firstRowCell.offsetLeft - firstRowCell.clientWidth : 0;
|
|
113
113
|
var scrollHeight = actual * rowHeight;
|
|
114
|
-
(_sheetWrapperRef$curr = sheetWrapperRef.current) === null || _sheetWrapperRef$curr === void 0
|
|
114
|
+
(_sheetWrapperRef$curr = sheetWrapperRef.current) === null || _sheetWrapperRef$curr === void 0 ? void 0 : _sheetWrapperRef$curr.scrollTo(isNumber(row) ? 0 : colPosition, scrollHeight);
|
|
115
115
|
|
|
116
116
|
// 最后一行的bug暂时用 scroll end 事件来处理
|
|
117
117
|
if (isNil(row) && start.row === data.length - 1 && sheetWrapperRef.current) {
|
|
118
118
|
var handleScrollEnd = function handleScrollEnd() {
|
|
119
119
|
var _sheetWrapperRef$curr2, _sheetWrapperRef$curr3;
|
|
120
|
-
(_sheetWrapperRef$curr2 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr2 === void 0
|
|
121
|
-
(_sheetWrapperRef$curr3 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr3 === void 0
|
|
120
|
+
(_sheetWrapperRef$curr2 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr2 === void 0 ? void 0 : _sheetWrapperRef$curr2.scrollTo(isNumber(row) ? 0 : colPosition, scrollHeight);
|
|
121
|
+
(_sheetWrapperRef$curr3 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr3 === void 0 ? void 0 : _sheetWrapperRef$curr3.removeEventListener('scrollend', handleScrollEnd);
|
|
122
122
|
};
|
|
123
123
|
sheetWrapperRef.current.addEventListener('scrollend', handleScrollEnd);
|
|
124
124
|
}
|
|
@@ -137,7 +137,7 @@ var Sheet = function Sheet(props) {
|
|
|
137
137
|
var firstRowCell = container.querySelector("td.cell[data-col='".concat(col, "']"));
|
|
138
138
|
var colPosition = firstRowCell ? firstRowCell.offsetLeft - firstRowCell.clientWidth : 0;
|
|
139
139
|
var scrollHeight = actual * rowHeight;
|
|
140
|
-
(_sheetWrapperRef$curr4 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr4 === void 0
|
|
140
|
+
(_sheetWrapperRef$curr4 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr4 === void 0 ? void 0 : _sheetWrapperRef$curr4.scrollTo(colPosition, scrollHeight);
|
|
141
141
|
});
|
|
142
142
|
},
|
|
143
143
|
pushToHistory: function pushToHistory(config) {
|
|
@@ -206,7 +206,7 @@ var Sheet = function Sheet(props) {
|
|
|
206
206
|
setTimeout(function () {
|
|
207
207
|
var _sheetWrapperRef$curr5;
|
|
208
208
|
// 表格获取焦点 + 接收keyboard event
|
|
209
|
-
(_sheetWrapperRef$curr5 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr5 === void 0
|
|
209
|
+
(_sheetWrapperRef$curr5 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr5 === void 0 ? void 0 : _sheetWrapperRef$curr5.focus({
|
|
210
210
|
preventScroll: true
|
|
211
211
|
});
|
|
212
212
|
}, 1);
|
|
@@ -245,10 +245,10 @@ var Sheet = function Sheet(props) {
|
|
|
245
245
|
}, [groupConfig]);
|
|
246
246
|
var rowElements = useMemo(function () {
|
|
247
247
|
var _visibleData$slice;
|
|
248
|
-
return visibleData === null || visibleData === void 0
|
|
248
|
+
return visibleData === null || visibleData === void 0 ? void 0 : (_visibleData$slice = visibleData.slice(virtualStart, virtualEnd)) === null || _visibleData$slice === void 0 ? void 0 : _visibleData$slice.map(function (rowData) {
|
|
249
249
|
var _rowData$, _rowData;
|
|
250
250
|
var row = ((_rowData$ = rowData[0]) === null || _rowData$ === void 0 ? void 0 : _rowData$.row) || 0;
|
|
251
|
-
var rowCN = rowClassName instanceof Function ? rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(rowData === null || rowData === void 0
|
|
251
|
+
var rowCN = rowClassName instanceof Function ? rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(rowData === null || rowData === void 0 ? void 0 : (_rowData = rowData[rowData.length - 1]) === null || _rowData === void 0 ? void 0 : _rowData.record, row) : rowClassName;
|
|
252
252
|
return /*#__PURE__*/_jsx(Row, {
|
|
253
253
|
row: row,
|
|
254
254
|
cells: rowData,
|
|
@@ -360,18 +360,18 @@ var Sheet = function Sheet(props) {
|
|
|
360
360
|
startRowVisible: startRowVisible,
|
|
361
361
|
backToEditRow: function backToEditRow() {
|
|
362
362
|
var _sheetInstance$curren;
|
|
363
|
-
return sheetInstance === null || sheetInstance === void 0
|
|
363
|
+
return sheetInstance === null || sheetInstance === void 0 ? void 0 : (_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0 ? void 0 : _sheetInstance$curren.zoomTo();
|
|
364
364
|
},
|
|
365
365
|
firstRowVisible: firstRowVisible,
|
|
366
366
|
lastRowVisible: lastRowVisible,
|
|
367
367
|
backEditStyle: backEditStyle,
|
|
368
368
|
toTop: function toTop() {
|
|
369
369
|
var _sheetInstance$curren2;
|
|
370
|
-
return sheetInstance === null || sheetInstance === void 0
|
|
370
|
+
return sheetInstance === null || sheetInstance === void 0 ? void 0 : (_sheetInstance$curren2 = sheetInstance.current) === null || _sheetInstance$curren2 === void 0 ? void 0 : _sheetInstance$curren2.zoomTo(0);
|
|
371
371
|
},
|
|
372
372
|
toBottom: function toBottom() {
|
|
373
373
|
var _sheetInstance$curren3, _data$length;
|
|
374
|
-
return sheetInstance === null || sheetInstance === void 0
|
|
374
|
+
return sheetInstance === null || sheetInstance === void 0 ? void 0 : (_sheetInstance$curren3 = sheetInstance.current) === null || _sheetInstance$curren3 === void 0 ? void 0 : _sheetInstance$curren3.zoomTo(((_data$length = data === null || data === void 0 ? void 0 : data.length) !== null && _data$length !== void 0 ? _data$length : 1) - 1);
|
|
375
375
|
},
|
|
376
376
|
showQuickLocationBtn: showQuickLocationBtn,
|
|
377
377
|
ControlContainer: ControlContainer,
|
|
@@ -85,10 +85,6 @@ span.harvest-sheet-container:focus {
|
|
|
85
85
|
position: sticky;
|
|
86
86
|
z-index: 2;
|
|
87
87
|
|
|
88
|
-
&.cell-title {
|
|
89
|
-
z-index: 3;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
88
|
&::before {
|
|
93
89
|
position: absolute;
|
|
94
90
|
top: -1px;
|
|
@@ -102,6 +98,13 @@ span.harvest-sheet-container:focus {
|
|
|
102
98
|
content: '';
|
|
103
99
|
}
|
|
104
100
|
|
|
101
|
+
&.cell-title {
|
|
102
|
+
z-index: 3;
|
|
103
|
+
&::before {
|
|
104
|
+
content: none;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
105
108
|
&.fixed-left::after {
|
|
106
109
|
position: absolute;
|
|
107
110
|
z-index: 3;
|
|
@@ -44,7 +44,7 @@ export var SearchInput = function SearchInput(props) {
|
|
|
44
44
|
if (e.shiftKey) goLast && goLast();else goNext && goNext();
|
|
45
45
|
setTimeout(function () {
|
|
46
46
|
var _inputRef$current;
|
|
47
|
-
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0
|
|
47
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
48
48
|
}, 100);
|
|
49
49
|
},
|
|
50
50
|
suffix: /*#__PURE__*/_jsxs("span", {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
import { useSetState } from "../..";
|
|
14
14
|
import { useEffect } from 'react';
|
|
@@ -64,10 +64,10 @@ export var useContextMenu = function useContextMenu(dispatch, elementRef) {
|
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
66
|
useEffect(function () {
|
|
67
|
-
var _contextMenuRef$curre2;
|
|
67
|
+
var _contextMenuRef$curre2, _contextMenuRef$curre3;
|
|
68
68
|
if (!elementRef.current || !enableContextMenu) return;
|
|
69
69
|
// 添加统一规范
|
|
70
|
-
(_contextMenuRef$curre2 = contextMenuRef.current) === null || _contextMenuRef$curre2 === void 0
|
|
70
|
+
(_contextMenuRef$curre2 = contextMenuRef.current) === null || _contextMenuRef$curre2 === void 0 ? void 0 : (_contextMenuRef$curre3 = _contextMenuRef$curre2.firstElementChild) === null || _contextMenuRef$curre3 === void 0 ? void 0 : _contextMenuRef$curre3.setAttribute('style', 'z-index: 5;word-break: keep-all;');
|
|
71
71
|
var handleClose = function handleClose() {
|
|
72
72
|
setMenuEvent({
|
|
73
73
|
showMenu: false
|
|
@@ -16,7 +16,7 @@ export var useKeyBoardEvent = function useKeyBoardEvent(dispatch, elementRef) {
|
|
|
16
16
|
var _elementRef$current;
|
|
17
17
|
var rowHeight = getRowHeight(elementRef.current);
|
|
18
18
|
var itemHeight = rowHeight || 30;
|
|
19
|
-
elementRef === null || elementRef === void 0
|
|
19
|
+
elementRef === null || elementRef === void 0 ? void 0 : (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.scrollBy({
|
|
20
20
|
top: itemHeight * row
|
|
21
21
|
});
|
|
22
22
|
}
|
|
@@ -32,7 +32,7 @@ export var useMouseEvent = function useMouseEvent(dispatch, elementRef) {
|
|
|
32
32
|
var colCalled = 0;
|
|
33
33
|
var step = function step() {
|
|
34
34
|
var _elementRef$current;
|
|
35
|
-
(_elementRef$current = elementRef.current) === null || _elementRef$current === void 0
|
|
35
|
+
(_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.style.setProperty('scroll-behavior', 'auto');
|
|
36
36
|
var position = {
|
|
37
37
|
x: destination.x,
|
|
38
38
|
y: destination.y
|
|
@@ -93,11 +93,11 @@ export var useMouseEvent = function useMouseEvent(dispatch, elementRef) {
|
|
|
93
93
|
if (!animateRef.current) return;
|
|
94
94
|
if (Math.abs(distance.x) + Math.abs(distance.y) < 2) {
|
|
95
95
|
var _elementRef$current2;
|
|
96
|
-
(_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0
|
|
96
|
+
(_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0 ? void 0 : _elementRef$current2.scrollTo(destination.x, destination.y);
|
|
97
97
|
resetInterval();
|
|
98
98
|
} else {
|
|
99
99
|
var _elementRef$current3;
|
|
100
|
-
(_elementRef$current3 = elementRef.current) === null || _elementRef$current3 === void 0
|
|
100
|
+
(_elementRef$current3 = elementRef.current) === null || _elementRef$current3 === void 0 ? void 0 : _elementRef$current3.scrollTo(destination.x, destination.y);
|
|
101
101
|
requestAnimationFrame(step);
|
|
102
102
|
called++;
|
|
103
103
|
}
|
|
@@ -132,7 +132,7 @@ export var useMouseEvent = function useMouseEvent(dispatch, elementRef) {
|
|
|
132
132
|
if (!((_elementRef$current5 = elementRef.current) !== null && _elementRef$current5 !== void 0 && _elementRef$current5.contains(e.target))) return;
|
|
133
133
|
var currentCell = findParentTd(e.target);
|
|
134
134
|
if (!currentCell || currentCell.classList.contains('fixed')) return;
|
|
135
|
-
(_elementRef$current6 = elementRef.current) === null || _elementRef$current6 === void 0
|
|
135
|
+
(_elementRef$current6 = elementRef.current) === null || _elementRef$current6 === void 0 ? void 0 : _elementRef$current6.style.setProperty('scroll-behavior', 'smooth');
|
|
136
136
|
var currentPos = extractDataRowAndCol(currentCell);
|
|
137
137
|
dispatch({
|
|
138
138
|
type: 'mouseOver',
|
|
@@ -173,14 +173,17 @@ export var useMouseEvent = function useMouseEvent(dispatch, elementRef) {
|
|
|
173
173
|
scrollTo('bottom');
|
|
174
174
|
// elementRef.current.scrollTop += cellHeight;
|
|
175
175
|
}
|
|
176
|
+
|
|
176
177
|
if (dTop < 40) {
|
|
177
178
|
scrollTo('top');
|
|
178
179
|
// elementRef.current.scrollTop -= cellHeight;
|
|
179
180
|
}
|
|
181
|
+
|
|
180
182
|
if (dLeft < 40) {
|
|
181
183
|
scrollTo('left');
|
|
182
184
|
// elementRef.current.scrollLeft -= cellWidth;
|
|
183
185
|
}
|
|
186
|
+
|
|
184
187
|
if (dRight > -40) {
|
|
185
188
|
scrollTo('right');
|
|
186
189
|
// elementRef.current.scrollLeft += cellWidth;
|
|
@@ -264,9 +267,9 @@ export var useMouseEvent = function useMouseEvent(dispatch, elementRef) {
|
|
|
264
267
|
});
|
|
265
268
|
}, []);
|
|
266
269
|
var loseFocus = useCallback(function (e) {
|
|
267
|
-
var _elementRef$current10, _elementRef$current11;
|
|
268
|
-
var isSearch = (_elementRef$current10 = elementRef.current) === null || _elementRef$current10 === void 0
|
|
269
|
-
var isTableAControl = (_elementRef$
|
|
270
|
+
var _elementRef$current10, _elementRef$current11, _elementRef$current12, _elementRef$current13, _elementRef$current14;
|
|
271
|
+
var isSearch = (_elementRef$current10 = elementRef.current) === null || _elementRef$current10 === void 0 ? void 0 : (_elementRef$current11 = _elementRef$current10.parentElement) === null || _elementRef$current11 === void 0 ? void 0 : (_elementRef$current12 = _elementRef$current11.nextSibling) === null || _elementRef$current12 === void 0 ? void 0 : _elementRef$current12.contains(e.target);
|
|
272
|
+
var isTableAControl = (_elementRef$current13 = elementRef.current) === null || _elementRef$current13 === void 0 ? void 0 : (_elementRef$current14 = _elementRef$current13.parentElement) === null || _elementRef$current14 === void 0 ? void 0 : _elementRef$current14.contains(e.target);
|
|
270
273
|
if (!(isTableAControl || isSearch)) {
|
|
271
274
|
dispatch({
|
|
272
275
|
type: 'loseFocus'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
7
|
import { pick } from 'lodash';
|
|
8
8
|
import { useCallback, useEffect } from 'react';
|
|
9
9
|
export var useSearchInput = function useSearchInput(state, dispatch, handlerRef) {
|
|
@@ -15,18 +15,18 @@ export var useSearchInput = function useSearchInput(state, dispatch, handlerRef)
|
|
|
15
15
|
var result = (_state$searchResultLi = state.searchResultList) === null || _state$searchResultLi === void 0 ? void 0 : _state$searchResultLi[index];
|
|
16
16
|
if (result) {
|
|
17
17
|
var _state$eventBus, _handlerRef$current, _handlerRef$current2;
|
|
18
|
-
(_state$eventBus = state.eventBus) === null || _state$eventBus === void 0
|
|
18
|
+
(_state$eventBus = state.eventBus) === null || _state$eventBus === void 0 ? void 0 : _state$eventBus.emit('group-open-title', true);
|
|
19
19
|
dispatch({
|
|
20
20
|
type: 'changes',
|
|
21
21
|
payload: {
|
|
22
22
|
searchCurrent: index
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
(_handlerRef$current = handlerRef.current) === null || _handlerRef$current === void 0
|
|
25
|
+
(_handlerRef$current = handlerRef.current) === null || _handlerRef$current === void 0 ? void 0 : _handlerRef$current.select({
|
|
26
26
|
start: result,
|
|
27
27
|
end: result
|
|
28
28
|
});
|
|
29
|
-
handlerRef === null || handlerRef === void 0
|
|
29
|
+
handlerRef === null || handlerRef === void 0 ? void 0 : (_handlerRef$current2 = handlerRef.current) === null || _handlerRef$current2 === void 0 ? void 0 : _handlerRef$current2.zoomTo();
|
|
30
30
|
}
|
|
31
31
|
}, [state.searchTotal, state.searchResultList]);
|
|
32
32
|
var goNext = useCallback(function () {
|
|
@@ -2,7 +2,7 @@ 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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { throttle } from 'lodash';
|
|
8
8
|
import { useEffect, useState } from 'react';
|
|
@@ -45,10 +45,10 @@ export var useSelectVisible = function useSelectVisible(sheetWrapper, start) {
|
|
|
45
45
|
}
|
|
46
46
|
}, 100);
|
|
47
47
|
handleScroll();
|
|
48
|
-
(_sheetWrapper$current3 = sheetWrapper.current) === null || _sheetWrapper$current3 === void 0
|
|
48
|
+
(_sheetWrapper$current3 = sheetWrapper.current) === null || _sheetWrapper$current3 === void 0 ? void 0 : _sheetWrapper$current3.addEventListener('scroll', handleScroll);
|
|
49
49
|
return function () {
|
|
50
50
|
var _sheetWrapper$current4;
|
|
51
|
-
(_sheetWrapper$current4 = sheetWrapper.current) === null || _sheetWrapper$current4 === void 0
|
|
51
|
+
(_sheetWrapper$current4 = sheetWrapper.current) === null || _sheetWrapper$current4 === void 0 ? void 0 : _sheetWrapper$current4.removeEventListener('scroll', handleScroll);
|
|
52
52
|
};
|
|
53
53
|
}, [sheetWrapper.current, start]);
|
|
54
54
|
if (!start) {
|
|
@@ -2,7 +2,7 @@ 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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
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";
|
|
@@ -33,7 +33,7 @@ export var useVirtualList = function useVirtualList(elementRef) {
|
|
|
33
33
|
// const virtualRef = useRef<VirtualConfig | null>();
|
|
34
34
|
useEffect(function () {
|
|
35
35
|
var _elementRef$current;
|
|
36
|
-
(_elementRef$current = elementRef.current) === null || _elementRef$current === void 0
|
|
36
|
+
(_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.scrollBy({
|
|
37
37
|
top: 0
|
|
38
38
|
});
|
|
39
39
|
}, [groupConfig]);
|
|
@@ -64,7 +64,7 @@ export var useVirtualList = function useVirtualList(elementRef) {
|
|
|
64
64
|
elementRef.current.addEventListener('scroll', handleScroll);
|
|
65
65
|
return function () {
|
|
66
66
|
var _elementRef$current2;
|
|
67
|
-
(_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0
|
|
67
|
+
(_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0 ? void 0 : _elementRef$current2.removeEventListener('scroll', handleScroll);
|
|
68
68
|
};
|
|
69
69
|
}, [elementRef.current, data.length]);
|
|
70
70
|
if (!virtualized) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
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; }
|
|
3
|
-
function _toPropertyKey(
|
|
4
|
-
function _toPrimitive(
|
|
3
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
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."); }
|
|
7
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); }
|
|
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
|
-
function _iterableToArrayLimit(
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { createElement, useEffect, useMemo, useRef } from 'react';
|
|
12
12
|
import { useSetState, useSheetEvent, useWidth } from "../../../hooks";
|
|
@@ -95,17 +95,17 @@ export var DraggableShell = function DraggableShell(_ref) {
|
|
|
95
95
|
col: -1,
|
|
96
96
|
value: true,
|
|
97
97
|
record: {
|
|
98
|
-
open: controlProps === null || controlProps === void 0
|
|
98
|
+
open: controlProps === null || controlProps === void 0 ? void 0 : (_controlProps$group = controlProps.group) === null || _controlProps$group === void 0 ? void 0 : _controlProps$group.open,
|
|
99
99
|
isHeader: true
|
|
100
100
|
}
|
|
101
101
|
}), showSelect && /*#__PURE__*/_jsx(CheckViewer, {
|
|
102
102
|
row: -1,
|
|
103
103
|
col: -1,
|
|
104
|
-
value: controlProps === null || controlProps === void 0
|
|
104
|
+
value: controlProps === null || controlProps === void 0 ? void 0 : (_controlProps$check = controlProps.check) === null || _controlProps$check === void 0 ? void 0 : _controlProps$check.checked,
|
|
105
105
|
record: {
|
|
106
|
-
open: controlProps === null || controlProps === void 0
|
|
106
|
+
open: controlProps === null || controlProps === void 0 ? void 0 : (_controlProps$check2 = controlProps.check) === null || _controlProps$check2 === void 0 ? void 0 : _controlProps$check2.checked,
|
|
107
107
|
isHeader: true,
|
|
108
|
-
indeterminate: controlProps === null || controlProps === void 0
|
|
108
|
+
indeterminate: controlProps === null || controlProps === void 0 ? void 0 : (_controlProps$check3 = controlProps.check) === null || _controlProps$check3 === void 0 ? void 0 : _controlProps$check3.indeterminate
|
|
109
109
|
}
|
|
110
110
|
})]
|
|
111
111
|
}, "-1"));
|
|
@@ -217,12 +217,12 @@ export var DraggableShell = function DraggableShell(_ref) {
|
|
|
217
217
|
var _downRef$current$oldW, _downRef$current$oldX;
|
|
218
218
|
downRef.current.style.cursor = 'default';
|
|
219
219
|
if (((_downRef$current$oldW = downRef.current.oldWidth) !== null && _downRef$current$oldW !== void 0 ? _downRef$current$oldW : 0) + (e.x - ((_downRef$current$oldX = downRef.current.oldX) !== null && _downRef$current$oldX !== void 0 ? _downRef$current$oldX : 0)) > 0) {
|
|
220
|
-
var _downRef$current$oldW2, _downRef$current$oldX2, _headRef$current, _columns$actualIndex
|
|
220
|
+
var _downRef$current$oldW2, _downRef$current$oldX2, _headRef$current, _columns$actualIndex, _columns$actualIndex$;
|
|
221
221
|
var newWidth = Math.max(Number(((_downRef$current$oldW2 = downRef.current.oldWidth) !== null && _downRef$current$oldW2 !== void 0 ? _downRef$current$oldW2 : 0) + (e.x - ((_downRef$current$oldX2 = downRef.current.oldX) !== null && _downRef$current$oldX2 !== void 0 ? _downRef$current$oldX2 : 0))), 50);
|
|
222
222
|
var cellList = [].slice.call((_headRef$current = headRef.current) === null || _headRef$current === void 0 ? void 0 : _headRef$current.cells);
|
|
223
223
|
var changeIndex = cellList.indexOf(downRef.current);
|
|
224
224
|
var actualIndex = changeIndex - offset;
|
|
225
|
-
var isDoubleSpan = (((_columns$actualIndex = columns[actualIndex]) === null || _columns$actualIndex === void 0
|
|
225
|
+
var isDoubleSpan = (((_columns$actualIndex = columns[actualIndex]) === null || _columns$actualIndex === void 0 ? void 0 : (_columns$actualIndex$ = _columns$actualIndex.titleConfig) === null || _columns$actualIndex$ === void 0 ? void 0 : _columns$actualIndex$.colSpan) || 0) > 1;
|
|
226
226
|
var nextColumn = columns[actualIndex + 1] || {};
|
|
227
227
|
var nextWidth = +String(nextColumn === null || nextColumn === void 0 ? void 0 : nextColumn.width).replace('px', '');
|
|
228
228
|
//调整该列中的每个Cell
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { SheetType } from "../../type";
|
|
3
2
|
import './draggableShell/index.less';
|
|
4
3
|
export declare const TableShell: ({ columns, className, showGroup, showSelect, controlProps, controlWidth, }: SheetType.SheetShell) => import("react").FC<{
|
|
@@ -55,17 +55,17 @@ export var TableShell = function TableShell(_ref) {
|
|
|
55
55
|
col: -1,
|
|
56
56
|
value: true,
|
|
57
57
|
record: {
|
|
58
|
-
open: controlProps === null || controlProps === void 0
|
|
58
|
+
open: controlProps === null || controlProps === void 0 ? void 0 : (_controlProps$group = controlProps.group) === null || _controlProps$group === void 0 ? void 0 : _controlProps$group.open,
|
|
59
59
|
isHeader: true
|
|
60
60
|
}
|
|
61
61
|
}), showSelect && /*#__PURE__*/_jsx(CheckViewer, {
|
|
62
62
|
row: -1,
|
|
63
63
|
col: -1,
|
|
64
|
-
value: controlProps === null || controlProps === void 0
|
|
64
|
+
value: controlProps === null || controlProps === void 0 ? void 0 : (_controlProps$check = controlProps.check) === null || _controlProps$check === void 0 ? void 0 : _controlProps$check.checked,
|
|
65
65
|
record: {
|
|
66
|
-
open: controlProps === null || controlProps === void 0
|
|
66
|
+
open: controlProps === null || controlProps === void 0 ? void 0 : (_controlProps$check2 = controlProps.check) === null || _controlProps$check2 === void 0 ? void 0 : _controlProps$check2.checked,
|
|
67
67
|
isHeader: true,
|
|
68
|
-
indeterminate: controlProps === null || controlProps === void 0
|
|
68
|
+
indeterminate: controlProps === null || controlProps === void 0 ? void 0 : (_controlProps$check3 = controlProps.check) === null || _controlProps$check3 === void 0 ? void 0 : _controlProps$check3.indeterminate
|
|
69
69
|
}
|
|
70
70
|
})]
|
|
71
71
|
}, "-1"));
|
|
@@ -2,7 +2,7 @@ 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(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
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";
|
|
@@ -16,7 +16,7 @@ var RowPop = function RowPop(props) {
|
|
|
16
16
|
useEffect(function () {
|
|
17
17
|
var interval = setInterval(function () {
|
|
18
18
|
var _inputRef$current;
|
|
19
|
-
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0
|
|
19
|
+
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
|
|
20
20
|
}, 200);
|
|
21
21
|
return function () {
|
|
22
22
|
clearInterval(interval);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
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(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
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 _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); }
|
|
@@ -55,7 +55,7 @@ export var GroupEvent = function GroupEvent(props) {
|
|
|
55
55
|
onGroupChange && onGroupChange(_objectSpread(_objectSpread({}, rowGroupConfig), {}, {
|
|
56
56
|
groupOpen: groupOpen
|
|
57
57
|
}));
|
|
58
|
-
sheetInstance === null || sheetInstance === void 0
|
|
58
|
+
sheetInstance === null || sheetInstance === void 0 ? void 0 : sheetInstance.pushToHistory({
|
|
59
59
|
type: 'Custom',
|
|
60
60
|
changes: [],
|
|
61
61
|
extraInfo: {
|
|
@@ -75,7 +75,7 @@ export var GroupEvent = function GroupEvent(props) {
|
|
|
75
75
|
groupOpen: Array(rowGroupConfig === null || rowGroupConfig === void 0 ? void 0 : rowGroupConfig.groupOpen.length).fill(value),
|
|
76
76
|
defaultOpen: !groups.length ? value : undefined
|
|
77
77
|
}));
|
|
78
|
-
sheetInstance === null || sheetInstance === void 0
|
|
78
|
+
sheetInstance === null || sheetInstance === void 0 ? void 0 : sheetInstance.pushToHistory({
|
|
79
79
|
type: 'Custom',
|
|
80
80
|
changes: [],
|
|
81
81
|
extraInfo: {
|
package/dist/core/table/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
2
|
var _excluded = ["sheetInstance", "columns", "dataSource", "rowKey", "rowSelection", "groupConfig", "onChange", "handleAdd", "handleBatchAdd", "draggable", "eventHandler"];
|
|
3
|
-
function ownKeys(
|
|
4
|
-
function _objectSpread(
|
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
5
|
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; }
|
|
6
|
-
function _toPropertyKey(
|
|
7
|
-
function _toPrimitive(
|
|
6
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
8
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
9
|
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."); }
|
|
10
10
|
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); }
|
|
11
11
|
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; }
|
|
12
|
-
function _iterableToArrayLimit(
|
|
12
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -52,7 +52,7 @@ var Table = function Table(_ref) {
|
|
|
52
52
|
var sheetInstance = sheetRef || _sheetInstance;
|
|
53
53
|
var dataHasChildren = dataSource === null || dataSource === void 0 ? void 0 : dataSource.some(function (item) {
|
|
54
54
|
var _item$children;
|
|
55
|
-
return (item === null || item === void 0
|
|
55
|
+
return (item === null || item === void 0 ? void 0 : (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0;
|
|
56
56
|
});
|
|
57
57
|
var configWithChildren = !!groupConfig && !!dataSource.length;
|
|
58
58
|
var hasChildren = dataHasChildren || configWithChildren;
|