@zhenliang/sheet 0.1.23 → 0.1.25
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/cascaderEditor/index.js +0 -1
- package/dist/core/editor/cascaderEditor/index.less +9 -5
- package/dist/core/editor/dateEditor/index.js +10 -4
- package/dist/core/editor/dateEditor/index.less +8 -1
- package/dist/core/editor/numberEditor/index.d.ts +1 -1
- package/dist/core/editor/numberEditor/index.js +5 -5
- package/dist/core/editor/numberEditor/index.less +2 -2
- package/dist/core/editor/selectEditor/index.js +4 -4
- package/dist/core/editor/selectEditor/index.less +8 -3
- package/dist/core/reducers/index.d.ts +2 -2
- package/dist/core/reducers/keyboardReducer.js +3 -3
- package/dist/core/reducers/mouseReducer.js +5 -5
- package/dist/core/reducers/sideEffectReducer.d.ts +1 -1
- package/dist/core/reducers/sideEffectReducer.js +10 -10
- package/dist/core/reducers/stateReducer.js +10 -10
- package/dist/core/sheet/Cell.js +2 -2
- package/dist/core/sheet/DataEditor.js +1 -1
- package/dist/core/sheet/DefaultCell.d.ts +1 -0
- package/dist/core/sheet/DefaultCell.js +3 -3
- package/dist/core/sheet/DefaultRowMapper.js +4 -1
- package/dist/core/sheet/index.js +31 -23
- package/dist/core/sheet/index.less +6 -3
- package/dist/core/sheet/useContextMenu.d.ts +1 -1
- package/dist/core/sheet/useContextMenu.js +6 -6
- package/dist/core/sheet/useKeyBoardEvent.js +1 -1
- package/dist/core/sheet/useMouseEvent.js +6 -6
- package/dist/core/sheet/useSelectVisible.js +3 -3
- package/dist/core/sheet/useVirtualList.js +3 -3
- package/dist/core/shell/draggableShell/index.d.ts +1 -0
- package/dist/core/shell/draggableShell/index.js +6 -6
- package/dist/core/shell/tableShell.d.ts +1 -0
- package/dist/core/shell/tableShell.js +4 -4
- package/dist/core/table/events.js +5 -5
- package/dist/core/table/index.js +7 -7
- package/dist/core/table/useGroupConfig.js +1 -1
- package/dist/core/table/useRowSelection.js +1 -1
- package/dist/core/util.d.ts +0 -1
- package/dist/core/util.js +19 -52
- package/dist/core/viewer/cascaderViewer/index.js +6 -1
- package/dist/core/viewer/editViewer/index.js +2 -1
- package/dist/core/viewer/groupViewer/index.js +5 -1
- package/dist/example/antComponent.js +7 -8
- package/dist/example/basic.js +4 -4
- package/dist/example/group.js +3 -3
- package/dist/example/selection.js +4 -4
- package/dist/example/sheet.js +21 -17
- package/dist/example/valuationAnalyze.d.ts +1 -0
- package/dist/example/valuationAnalyze.js +1 -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 +4 -4
- package/dist/standardUtils/index.d.ts +1 -1
- package/dist/standardUtils/index.js +1 -1
- package/dist/type/sheet.d.ts +28 -27
- package/dist/type/sheetTable.d.ts +10 -9
- package/package.json +1 -1
package/dist/core/sheet/index.js
CHANGED
|
@@ -1,14 +1,8 @@
|
|
|
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
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
8
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."); }
|
|
9
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); }
|
|
10
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; }
|
|
11
|
-
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; } }
|
|
12
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
7
|
import { useEffect, useMemo, useRef } from 'react';
|
|
14
8
|
// import ReduxLogger from 'redux-logger';
|
|
@@ -16,7 +10,8 @@ import ReduxThunk from 'redux-thunk';
|
|
|
16
10
|
import DefaultRow from "./DefaultRow";
|
|
17
11
|
import DefaultShell from "./DefaultShell";
|
|
18
12
|
import { ArrowDownOutlined, ArrowUpOutlined } from '@ant-design/icons';
|
|
19
|
-
import {
|
|
13
|
+
import { Empty } from 'antd';
|
|
14
|
+
import { isEmpty, isNil, isNumber } from 'lodash';
|
|
20
15
|
import { SheetEventContext, useEventBus, useMiddlewareReducer } from "../../hooks";
|
|
21
16
|
import sheetReducer from "../reducers";
|
|
22
17
|
import { classNames, getRowHeight, rowToActualRow } from "../util";
|
|
@@ -38,12 +33,15 @@ var Sheet = function Sheet(props) {
|
|
|
38
33
|
} : _props$sheetInstance,
|
|
39
34
|
_props$sheetRenderer = props.sheetRenderer,
|
|
40
35
|
SheetShell = _props$sheetRenderer === void 0 ? DefaultShell : _props$sheetRenderer,
|
|
36
|
+
_props$emptyRenderer = props.emptyRenderer,
|
|
37
|
+
emptyRenderer = _props$emptyRenderer === void 0 ? /*#__PURE__*/_jsx(Empty, {
|
|
38
|
+
description: "\u6682\u65E0\u6570\u636E"
|
|
39
|
+
}) : _props$emptyRenderer,
|
|
41
40
|
_props$rowRenderer = props.rowRenderer,
|
|
42
41
|
Row = _props$rowRenderer === void 0 ? DefaultRow : _props$rowRenderer,
|
|
43
42
|
ContextMenu = props.menuRenderer,
|
|
44
43
|
_props$virtualized = props.virtualized,
|
|
45
44
|
virtualized = _props$virtualized === void 0 ? false : _props$virtualized,
|
|
46
|
-
sticky = props.sticky,
|
|
47
45
|
className = props.className,
|
|
48
46
|
data = props.data,
|
|
49
47
|
_props$freePaste = props.freePaste,
|
|
@@ -91,14 +89,14 @@ var Sheet = function Sheet(props) {
|
|
|
91
89
|
var firstRowCell = container.querySelector("td.cell[data-col='".concat(start === null || start === void 0 ? void 0 : start.col, "']"));
|
|
92
90
|
var colPosition = firstRowCell ? firstRowCell.offsetLeft - firstRowCell.clientWidth : 0;
|
|
93
91
|
var scrollHeight = actual * rowHeight;
|
|
94
|
-
(_sheetWrapperRef$curr = sheetWrapperRef.current) === null || _sheetWrapperRef$curr === void 0
|
|
92
|
+
(_sheetWrapperRef$curr = sheetWrapperRef.current) === null || _sheetWrapperRef$curr === void 0 || _sheetWrapperRef$curr.scrollTo(isNumber(row) ? 0 : colPosition, scrollHeight);
|
|
95
93
|
|
|
96
94
|
// 最后一行的bug暂时用 scroll end 事件来处理
|
|
97
95
|
if (isNil(row) && start.row === data.length - 1 && sheetWrapperRef.current) {
|
|
98
96
|
var handleScrollEnd = function handleScrollEnd() {
|
|
99
97
|
var _sheetWrapperRef$curr2, _sheetWrapperRef$curr3;
|
|
100
|
-
(_sheetWrapperRef$curr2 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr2 === void 0
|
|
101
|
-
(_sheetWrapperRef$curr3 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr3 === void 0
|
|
98
|
+
(_sheetWrapperRef$curr2 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr2 === void 0 || _sheetWrapperRef$curr2.scrollTo(isNumber(row) ? 0 : colPosition, scrollHeight);
|
|
99
|
+
(_sheetWrapperRef$curr3 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr3 === void 0 || _sheetWrapperRef$curr3.removeEventListener('scrollend', handleScrollEnd);
|
|
102
100
|
};
|
|
103
101
|
sheetWrapperRef.current.addEventListener('scrollend', handleScrollEnd);
|
|
104
102
|
}
|
|
@@ -160,7 +158,7 @@ var Sheet = function Sheet(props) {
|
|
|
160
158
|
setTimeout(function () {
|
|
161
159
|
var _sheetWrapperRef$curr4;
|
|
162
160
|
// 表格获取焦点 + 接收keyboard event
|
|
163
|
-
(_sheetWrapperRef$curr4 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr4 === void 0
|
|
161
|
+
(_sheetWrapperRef$curr4 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr4 === void 0 || _sheetWrapperRef$curr4.focus({
|
|
164
162
|
preventScroll: true
|
|
165
163
|
});
|
|
166
164
|
}, 1);
|
|
@@ -180,11 +178,11 @@ var Sheet = function Sheet(props) {
|
|
|
180
178
|
});
|
|
181
179
|
}, [groupConfig]);
|
|
182
180
|
var rowElements = useMemo(function () {
|
|
183
|
-
var _state$data
|
|
184
|
-
return state === null || state === void 0
|
|
181
|
+
var _state$data;
|
|
182
|
+
return state === null || state === void 0 || (_state$data = state.data) === null || _state$data === void 0 || (_state$data = _state$data.slice(virtualStart, virtualEnd)) === null || _state$data === void 0 ? void 0 : _state$data.map(function (rowData) {
|
|
185
183
|
var _state$data2, _rowData;
|
|
186
|
-
var row = (state === null || state === void 0
|
|
187
|
-
var rowCN = rowClassName instanceof Function ? rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(rowData === null || rowData === void 0
|
|
184
|
+
var row = (state === null || state === void 0 || (_state$data2 = state.data) === null || _state$data2 === void 0 ? void 0 : _state$data2.indexOf(rowData)) || 0;
|
|
185
|
+
var rowCN = rowClassName instanceof Function ? rowClassName === null || rowClassName === void 0 ? void 0 : rowClassName(rowData === null || rowData === void 0 || (_rowData = rowData[rowData.length - 1]) === null || _rowData === void 0 ? void 0 : _rowData.record, row) : rowClassName;
|
|
188
186
|
return /*#__PURE__*/_jsx(Row, {
|
|
189
187
|
row: row,
|
|
190
188
|
cells: rowData,
|
|
@@ -197,7 +195,7 @@ var Sheet = function Sheet(props) {
|
|
|
197
195
|
}, row);
|
|
198
196
|
});
|
|
199
197
|
}, [state.data, groupConfig, virtualStart, virtualEnd, rowClassName]);
|
|
200
|
-
var memoHeight = Math.min(((_state$data$length = state === null || state === void 0
|
|
198
|
+
var memoHeight = Math.min(((_state$data$length = state === null || state === void 0 || (_state$data3 = state.data) === null || _state$data3 === void 0 ? void 0 : _state$data3.length) !== null && _state$data$length !== void 0 ? _state$data$length : 0) + 1, 10) * 42 + 43;
|
|
201
199
|
var _useSelectVisible = useSelectVisible(sheetWrapperRef, state.start),
|
|
202
200
|
_useSelectVisible2 = _slicedToArray(_useSelectVisible, 2),
|
|
203
201
|
startRowVisible = _useSelectVisible2[0],
|
|
@@ -239,19 +237,29 @@ var Sheet = function Sheet(props) {
|
|
|
239
237
|
onContextMenu: onContextMenu
|
|
240
238
|
})
|
|
241
239
|
}) : null]
|
|
242
|
-
}), /*#__PURE__*/
|
|
240
|
+
}), isEmpty(state.data) || isNil(state.data) ? /*#__PURE__*/_jsx("div", {
|
|
241
|
+
style: {
|
|
242
|
+
marginTop: 16,
|
|
243
|
+
marginBottom: 16
|
|
244
|
+
},
|
|
245
|
+
children: emptyRenderer
|
|
246
|
+
}) : null, /*#__PURE__*/_jsxs("div", {
|
|
243
247
|
className: "harvest-sheet-control",
|
|
244
248
|
children: [children, showBackEdit && !startRowVisible ? /*#__PURE__*/_jsxs("div", {
|
|
245
249
|
className: "back-edit",
|
|
246
250
|
onClick: function onClick() {
|
|
247
251
|
var _sheetInstance$curren;
|
|
248
|
-
return sheetInstance === null || sheetInstance === void 0
|
|
252
|
+
return sheetInstance === null || sheetInstance === void 0 || (_sheetInstance$curren = sheetInstance.current) === null || _sheetInstance$curren === void 0 ? void 0 : _sheetInstance$curren.zoomTo();
|
|
249
253
|
},
|
|
250
|
-
style:
|
|
254
|
+
style: !backEditStyle ? {
|
|
251
255
|
top: 0,
|
|
252
256
|
right: 0
|
|
253
|
-
} : backEditStyle
|
|
254
|
-
children: [direction === 'up' ? /*#__PURE__*/_jsx(ArrowUpOutlined, {
|
|
257
|
+
} : backEditStyle,
|
|
258
|
+
children: [direction === 'up' ? /*#__PURE__*/_jsx(ArrowUpOutlined, {
|
|
259
|
+
rev: undefined
|
|
260
|
+
}) : /*#__PURE__*/_jsx(ArrowDownOutlined, {
|
|
261
|
+
rev: undefined
|
|
262
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
255
263
|
style: {
|
|
256
264
|
marginLeft: 0
|
|
257
265
|
},
|
|
@@ -12,9 +12,6 @@
|
|
|
12
12
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
15
|
span.harvest-sheet-container, span.harvest-sheet-container:focus {
|
|
19
16
|
outline: none;
|
|
20
17
|
}
|
|
@@ -304,4 +301,10 @@ span.harvest-sheet-container, span.harvest-sheet-container:focus {
|
|
|
304
301
|
z-index: 4;
|
|
305
302
|
border:1px solid #D8DFEB;
|
|
306
303
|
border-radius:2px;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
:global {
|
|
307
|
+
.ant-empty-description{
|
|
308
|
+
color: #A4A9B2;
|
|
309
|
+
}
|
|
307
310
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
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); }
|
|
@@ -8,7 +8,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
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
13
|
import { useSetState } from "../..";
|
|
14
14
|
import { useEffect } from 'react';
|
|
@@ -61,10 +61,10 @@ export var useContextMenu = function useContextMenu(dispatch, elementRef) {
|
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
63
|
useEffect(function () {
|
|
64
|
-
var _contextMenuRef$curre2
|
|
64
|
+
var _contextMenuRef$curre2;
|
|
65
65
|
if (!elementRef.current || !enableContextMenu) return;
|
|
66
66
|
// 添加统一规范
|
|
67
|
-
(_contextMenuRef$curre2 = contextMenuRef.current) === null || _contextMenuRef$curre2 === void 0
|
|
67
|
+
(_contextMenuRef$curre2 = contextMenuRef.current) === null || _contextMenuRef$curre2 === void 0 || (_contextMenuRef$curre2 = _contextMenuRef$curre2.firstElementChild) === null || _contextMenuRef$curre2 === void 0 || _contextMenuRef$curre2.setAttribute('style', 'z-index: 5;word-break: keep-all;');
|
|
68
68
|
var handleClose = function handleClose() {
|
|
69
69
|
setMenuEvent({
|
|
70
70
|
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 || (_elementRef$current = elementRef.current) === null || _elementRef$current === 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 || _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 || _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 || _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 || _elementRef$current6.style.setProperty('scroll-behavior', 'smooth');
|
|
136
136
|
var currentPos = extractDataRowAndCol(currentCell);
|
|
137
137
|
dispatch({
|
|
138
138
|
type: 'mouseOver',
|
|
@@ -267,8 +267,8 @@ export var useMouseEvent = function useMouseEvent(dispatch, elementRef) {
|
|
|
267
267
|
});
|
|
268
268
|
}, []);
|
|
269
269
|
var loseFocus = useCallback(function (e) {
|
|
270
|
-
var _elementRef$current10
|
|
271
|
-
if (!((_elementRef$current10 = elementRef.current) !== null && _elementRef$current10 !== void 0 && (_elementRef$
|
|
270
|
+
var _elementRef$current10;
|
|
271
|
+
if (!((_elementRef$current10 = elementRef.current) !== null && _elementRef$current10 !== void 0 && (_elementRef$current10 = _elementRef$current10.parentElement) !== null && _elementRef$current10 !== void 0 && _elementRef$current10.contains(e.target))) {
|
|
272
272
|
dispatch({
|
|
273
273
|
type: 'loseFocus'
|
|
274
274
|
});
|
|
@@ -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(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { throttle } from 'lodash';
|
|
8
8
|
import { useEffect, useState } from 'react';
|
|
@@ -44,10 +44,10 @@ export var useSelectVisible = function useSelectVisible(sheetWrapper, start) {
|
|
|
44
44
|
}
|
|
45
45
|
}, 100);
|
|
46
46
|
handleScroll();
|
|
47
|
-
(_sheetWrapper$current3 = sheetWrapper.current) === null || _sheetWrapper$current3 === void 0
|
|
47
|
+
(_sheetWrapper$current3 = sheetWrapper.current) === null || _sheetWrapper$current3 === void 0 || _sheetWrapper$current3.addEventListener('scroll', handleScroll);
|
|
48
48
|
return function () {
|
|
49
49
|
var _sheetWrapper$current4;
|
|
50
|
-
(_sheetWrapper$current4 = sheetWrapper.current) === null || _sheetWrapper$current4 === void 0
|
|
50
|
+
(_sheetWrapper$current4 = sheetWrapper.current) === null || _sheetWrapper$current4 === void 0 || _sheetWrapper$current4.removeEventListener('scroll', handleScroll);
|
|
51
51
|
};
|
|
52
52
|
}, [sheetWrapper.current, start]);
|
|
53
53
|
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(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 { isEqual, throttle } from 'lodash';
|
|
8
8
|
import { useEffect, useRef, useState } from 'react';
|
|
@@ -31,7 +31,7 @@ export var useVirtualList = function useVirtualList(elementRef) {
|
|
|
31
31
|
useEffect(function () {
|
|
32
32
|
var _elementRef$current;
|
|
33
33
|
groupConfigRef.current = groupConfig;
|
|
34
|
-
(_elementRef$current = elementRef.current) === null || _elementRef$current === void 0
|
|
34
|
+
(_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 || _elementRef$current.scrollBy({
|
|
35
35
|
top: 1
|
|
36
36
|
});
|
|
37
37
|
}, [groupConfig]);
|
|
@@ -83,7 +83,7 @@ export var useVirtualList = function useVirtualList(elementRef) {
|
|
|
83
83
|
elementRef.current.addEventListener('scroll', handleScroll);
|
|
84
84
|
return function () {
|
|
85
85
|
var _elementRef$current2;
|
|
86
|
-
(_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0
|
|
86
|
+
(_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0 || _elementRef$current2.removeEventListener('scroll', handleScroll);
|
|
87
87
|
};
|
|
88
88
|
}, [elementRef.current, data.length]);
|
|
89
89
|
if (!virtualized) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _typeof(
|
|
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
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
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
4
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); }
|
|
@@ -6,7 +6,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
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(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { createElement, useEffect, useMemo, useRef } from 'react';
|
|
12
12
|
import { useSetState, useWidth } from "../../../hooks";
|
|
@@ -50,17 +50,17 @@ export var DraggableShell = function DraggableShell(_ref) {
|
|
|
50
50
|
col: -1,
|
|
51
51
|
value: true,
|
|
52
52
|
record: {
|
|
53
|
-
open: controlProps === null || controlProps === void 0
|
|
53
|
+
open: controlProps === null || controlProps === void 0 || (_controlProps$group = controlProps.group) === null || _controlProps$group === void 0 ? void 0 : _controlProps$group.open,
|
|
54
54
|
isHeader: true
|
|
55
55
|
}
|
|
56
56
|
}), showSelect && /*#__PURE__*/_jsx(CheckViewer, {
|
|
57
57
|
row: -1,
|
|
58
58
|
col: -1,
|
|
59
|
-
value: controlProps === null || controlProps === void 0
|
|
59
|
+
value: controlProps === null || controlProps === void 0 || (_controlProps$check = controlProps.check) === null || _controlProps$check === void 0 ? void 0 : _controlProps$check.checked,
|
|
60
60
|
record: {
|
|
61
|
-
open: controlProps === null || controlProps === void 0
|
|
61
|
+
open: controlProps === null || controlProps === void 0 || (_controlProps$check2 = controlProps.check) === null || _controlProps$check2 === void 0 ? void 0 : _controlProps$check2.checked,
|
|
62
62
|
isHeader: true,
|
|
63
|
-
indeterminate: controlProps === null || controlProps === void 0
|
|
63
|
+
indeterminate: controlProps === null || controlProps === void 0 || (_controlProps$check3 = controlProps.check) === null || _controlProps$check3 === void 0 ? void 0 : _controlProps$check3.indeterminate
|
|
64
64
|
}
|
|
65
65
|
})]
|
|
66
66
|
}, "-1"));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import type { SheetType } from "../../type";
|
|
2
3
|
import './draggableShell/index.less';
|
|
3
4
|
export declare const TableShell: ({ columns, className, showGroup, showSelect, controlProps, controlWidth, }: SheetType.SheetShell) => import("react").FC<{
|
|
@@ -27,17 +27,17 @@ export var TableShell = function TableShell(_ref) {
|
|
|
27
27
|
col: -1,
|
|
28
28
|
value: true,
|
|
29
29
|
record: {
|
|
30
|
-
open: controlProps === null || controlProps === void 0
|
|
30
|
+
open: controlProps === null || controlProps === void 0 || (_controlProps$group = controlProps.group) === null || _controlProps$group === void 0 ? void 0 : _controlProps$group.open,
|
|
31
31
|
isHeader: true
|
|
32
32
|
}
|
|
33
33
|
}), showSelect && /*#__PURE__*/_jsx(CheckViewer, {
|
|
34
34
|
row: -1,
|
|
35
35
|
col: -1,
|
|
36
|
-
value: controlProps === null || controlProps === void 0
|
|
36
|
+
value: controlProps === null || controlProps === void 0 || (_controlProps$check = controlProps.check) === null || _controlProps$check === void 0 ? void 0 : _controlProps$check.checked,
|
|
37
37
|
record: {
|
|
38
|
-
open: controlProps === null || controlProps === void 0
|
|
38
|
+
open: controlProps === null || controlProps === void 0 || (_controlProps$check2 = controlProps.check) === null || _controlProps$check2 === void 0 ? void 0 : _controlProps$check2.checked,
|
|
39
39
|
isHeader: true,
|
|
40
|
-
indeterminate: controlProps === null || controlProps === void 0
|
|
40
|
+
indeterminate: controlProps === null || controlProps === void 0 || (_controlProps$check3 = controlProps.check) === null || _controlProps$check3 === void 0 ? void 0 : _controlProps$check3.indeterminate
|
|
41
41
|
}
|
|
42
42
|
})]
|
|
43
43
|
}, "-1"));
|
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
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); }
|
|
@@ -62,7 +62,7 @@ export var GroupEvent = function GroupEvent(props) {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
onGridChange && onGridChange(newGrid);
|
|
65
|
-
sheetInstance === null || sheetInstance === void 0
|
|
65
|
+
sheetInstance === null || sheetInstance === void 0 || sheetInstance.pushToHistory({
|
|
66
66
|
type: 'Custom',
|
|
67
67
|
changes: [],
|
|
68
68
|
extraInfo: {
|
|
@@ -80,7 +80,7 @@ export var GroupEvent = function GroupEvent(props) {
|
|
|
80
80
|
groupOpen: Array(rowGroupConfig === null || rowGroupConfig === void 0 ? void 0 : rowGroupConfig.groupOpen.length).fill(value),
|
|
81
81
|
defaultOpen: !groups.length ? value : undefined
|
|
82
82
|
}));
|
|
83
|
-
sheetInstance === null || sheetInstance === void 0
|
|
83
|
+
sheetInstance === null || sheetInstance === void 0 || sheetInstance.pushToHistory({
|
|
84
84
|
type: 'Custom',
|
|
85
85
|
changes: [],
|
|
86
86
|
extraInfo: {
|
package/dist/core/table/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function _typeof(
|
|
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
2
|
var _excluded = ["sheetInstance", "columns", "dataSource", "rowKey", "rowSelection", "groupConfig", "onChange", "handleAdd", "draggable", "eventHandler"];
|
|
3
3
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
4
4
|
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."); }
|
|
5
5
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
6
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
-
function ownKeys(
|
|
8
|
-
function _objectSpread(
|
|
7
|
+
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; }
|
|
8
|
+
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; }
|
|
9
9
|
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; }
|
|
10
10
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
11
11
|
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); }
|
|
@@ -13,7 +13,7 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
|
|
|
13
13
|
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."); }
|
|
14
14
|
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); }
|
|
15
15
|
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; }
|
|
16
|
-
function _iterableToArrayLimit(
|
|
16
|
+
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; } }
|
|
17
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
18
|
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; }
|
|
19
19
|
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; }
|
|
@@ -57,7 +57,7 @@ var Table = function Table(_ref) {
|
|
|
57
57
|
var sheetInstance = sheetRef || _sheetInstance;
|
|
58
58
|
var dataHasChildren = dataSource === null || dataSource === void 0 ? void 0 : dataSource.some(function (item) {
|
|
59
59
|
var _item$children;
|
|
60
|
-
return (item === null || item === void 0
|
|
60
|
+
return (item === null || item === void 0 || (_item$children = item.children) === null || _item$children === void 0 ? void 0 : _item$children.length) > 0;
|
|
61
61
|
});
|
|
62
62
|
var configWithChildren = !!groupConfig && !!dataSource.length;
|
|
63
63
|
var hasChildren = dataHasChildren || configWithChildren;
|
|
@@ -104,8 +104,8 @@ var Table = function Table(_ref) {
|
|
|
104
104
|
id: rowId,
|
|
105
105
|
row: currentIndex,
|
|
106
106
|
col: -1,
|
|
107
|
-
editable: !((columns === null || columns === void 0 ? void 0 : columns[0].editable) instanceof Function) ? columns === null || columns === void 0
|
|
108
|
-
readonly: !((columns === null || columns === void 0 ? void 0 : columns[0].readonly) instanceof Function) ? columns === null || columns === void 0
|
|
107
|
+
editable: !((columns === null || columns === void 0 ? void 0 : columns[0].editable) instanceof Function) ? columns === null || columns === void 0 || (_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.editable : columns === null || columns === void 0 || (_columns$2 = columns[0]) === null || _columns$2 === void 0 ? void 0 : _columns$2.editable('', itemRow, currentIndex),
|
|
108
|
+
readonly: !((columns === null || columns === void 0 ? void 0 : columns[0].readonly) instanceof Function) ? columns === null || columns === void 0 || (_columns$3 = columns[0]) === null || _columns$3 === void 0 ? void 0 : _columns$3.readonly : columns === null || columns === void 0 || (_columns$4 = columns[0]) === null || _columns$4 === void 0 ? void 0 : _columns$4.readonly('', itemRow, currentIndex),
|
|
109
109
|
align: 'center',
|
|
110
110
|
fixed: 'unset',
|
|
111
111
|
value: groupMap.get(currentIndex) && ((_groupMap$get = groupMap.get(currentIndex)) === null || _groupMap$get === void 0 ? void 0 : _groupMap$get.isStart),
|
|
@@ -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(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 { flatten, isNil } from 'lodash';
|
|
8
8
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
@@ -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(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 { useEffect, useRef, useState } from 'react';
|
|
8
8
|
export var useRowSelection = function useRowSelection(dataSource, rowSelection, hasChildren) {
|
package/dist/core/util.d.ts
CHANGED
|
@@ -31,7 +31,6 @@ export declare const defaultValueRenderer: (cell: SheetType.Cell) => string | nu
|
|
|
31
31
|
export declare function renderValue(cell: SheetType.Cell): string | number;
|
|
32
32
|
export declare const optionsToValuesFromLabelOrValue: (options: SheetType.OptionsType[], val: string) => string[];
|
|
33
33
|
export declare const optionsTransferToValue: (options: SheetType.OptionsType[], val: string, key?: string) => string[];
|
|
34
|
-
export declare const optionsTransferToValue2: (options?: SheetType.OptionsType[], value?: string, path?: string[]) => (string | number)[];
|
|
35
34
|
export declare const valuesTransferToLabel: (options?: SheetType.OptionsType[], value?: string) => string | null;
|
|
36
35
|
export declare const groupConfigToGroupMap: (rowGroupConfig?: SheetType.RowGroupConfig) => Map<number, SheetType.RowGroup & {
|
|
37
36
|
isStart: boolean;
|