@zhenliang/sheet 0.1.88 → 0.1.89-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/reducers/keyboardReducer.js +47 -25
- package/dist/core/sheet/index.js +20 -8
- package/dist/core/sheet/useKeyBoardEvent.js +16 -19
- package/dist/core/util.d.ts +1 -1
- package/dist/core/util.js +22 -4
- package/dist/example/group.js +85 -5
- package/dist/type/sheet.d.ts +2 -0
- package/package.json +1 -1
|
@@ -4,25 +4,57 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
-
import { isNil } from 'lodash';
|
|
7
|
+
import { get, isNil } from 'lodash';
|
|
8
8
|
import { getNextVisibleRow, groupConfigToGroupMap, stripRowIndex } from "../util";
|
|
9
9
|
export var keyboardReducer = {
|
|
10
10
|
move: function move(state, payload) {
|
|
11
|
-
var _state$start, _state$start2;
|
|
11
|
+
var _state$start, _state$start2, _data;
|
|
12
12
|
var _ref = payload,
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
optRow = _ref.row,
|
|
14
|
+
optCol = _ref.col,
|
|
15
|
+
elementRef = _ref.elementRef;
|
|
15
16
|
var groupConfig = state.groupConfig,
|
|
16
17
|
_state$data = state.data,
|
|
17
|
-
data = _state$data === void 0 ? [] : _state$data
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
data = _state$data === void 0 ? [] : _state$data,
|
|
19
|
+
rowHeight = state.rowHeight,
|
|
20
|
+
cloWidthArray = state.cloWidthArray;
|
|
21
|
+
var newRow = (((_state$start = state.start) === null || _state$start === void 0 ? void 0 : _state$start.row) || 0) + optRow;
|
|
22
|
+
var newCol = (((_state$start2 = state.start) === null || _state$start2 === void 0 ? void 0 : _state$start2.col) || 0) + optCol;
|
|
23
|
+
// 越界判断
|
|
24
|
+
var maxRow = (data === null || data === void 0 || (_data = data[data.length - 1]) === null || _data === void 0 ? void 0 : _data[0].row) || data.length - 1;
|
|
25
|
+
var maxCol = data[0].length - 1;
|
|
26
|
+
var minCol = 0;
|
|
27
|
+
data[0].forEach(function (item) {
|
|
28
|
+
var itemCol = item.col;
|
|
29
|
+
if (itemCol < 0) {
|
|
30
|
+
minCol++;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (newRow > maxRow || newRow < 0 || newCol > maxCol || newCol < minCol) {
|
|
34
|
+
return state;
|
|
35
|
+
}
|
|
36
|
+
// 跟随滚动
|
|
37
|
+
if (optCol !== 0) {
|
|
38
|
+
var _elementRef$current;
|
|
39
|
+
var colWidth = get(cloWidthArray.current, newCol);
|
|
40
|
+
elementRef === null || elementRef === void 0 || (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 || _elementRef$current.scrollBy({
|
|
41
|
+
left: colWidth * optCol
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if (optRow !== 0) {
|
|
45
|
+
var _elementRef$current2;
|
|
46
|
+
var itemHeight = rowHeight.current;
|
|
47
|
+
elementRef === null || elementRef === void 0 || (_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0 || _elementRef$current2.scrollBy({
|
|
48
|
+
top: itemHeight * optRow
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
if (groupConfig && optRow !== 0) {
|
|
52
|
+
var _getNextVisibleRow;
|
|
53
|
+
newRow = (_getNextVisibleRow = getNextVisibleRow(newRow, maxRow, groupConfigToGroupMap(groupConfig), optRow)) !== null && _getNextVisibleRow !== void 0 ? _getNextVisibleRow : 0;
|
|
22
54
|
}
|
|
23
55
|
var currentPos = {
|
|
24
56
|
row: newRow,
|
|
25
|
-
col:
|
|
57
|
+
col: newCol
|
|
26
58
|
};
|
|
27
59
|
var lastEditing = state.lastEditing;
|
|
28
60
|
if (state.editing) {
|
|
@@ -30,21 +62,10 @@ export var keyboardReducer = {
|
|
|
30
62
|
confirm: true
|
|
31
63
|
});
|
|
32
64
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
lastSelected: {
|
|
38
|
-
start: state.start,
|
|
39
|
-
end: state.end
|
|
40
|
-
},
|
|
41
|
-
editing: undefined,
|
|
42
|
-
lastEditing: lastEditing
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return _objectSpread(_objectSpread({}, state), {}, {
|
|
46
|
-
start: currentPos,
|
|
47
|
-
end: currentPos,
|
|
65
|
+
var isOut = isNil(currentPos.row);
|
|
66
|
+
var newState = _objectSpread(_objectSpread({}, state), {}, {
|
|
67
|
+
start: isOut ? undefined : currentPos,
|
|
68
|
+
end: isOut ? undefined : currentPos,
|
|
48
69
|
lastSelected: {
|
|
49
70
|
start: state.start,
|
|
50
71
|
end: state.end
|
|
@@ -52,6 +73,7 @@ export var keyboardReducer = {
|
|
|
52
73
|
editing: undefined,
|
|
53
74
|
lastEditing: lastEditing
|
|
54
75
|
});
|
|
76
|
+
return newState;
|
|
55
77
|
},
|
|
56
78
|
escape: function escape(state) {
|
|
57
79
|
return _objectSpread(_objectSpread({}, state), {}, {
|
package/dist/core/sheet/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import { isEmpty, isNil, isNumber } from 'lodash';
|
|
|
21
21
|
import { SheetEventContext, useEventBus, useMiddlewareReducer } from "../../hooks";
|
|
22
22
|
import sheetReducer from "../reducers";
|
|
23
23
|
import { sideEffectReducer } from "../reducers/sideEffectReducer";
|
|
24
|
-
import { classNames,
|
|
24
|
+
import { classNames, rowToActualRow } from "../util";
|
|
25
25
|
import { Control } from "./Control";
|
|
26
26
|
import { DefaultRowMapper } from "./DefaultRowMapper";
|
|
27
27
|
import { Menu } from "./Menu";
|
|
@@ -87,6 +87,8 @@ var Sheet = function Sheet(props) {
|
|
|
87
87
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
88
88
|
isScrolledToEnd = _useState4[0],
|
|
89
89
|
setIsScrolledToEnd = _useState4[1];
|
|
90
|
+
var rowHeight = useRef(30);
|
|
91
|
+
var cloWidthArray = useRef([]);
|
|
90
92
|
var sheetWrapperRef = useRef(null);
|
|
91
93
|
var contextMenuRef = useRef(null);
|
|
92
94
|
var eventBus = useEventBus();
|
|
@@ -99,7 +101,9 @@ var Sheet = function Sheet(props) {
|
|
|
99
101
|
lastFocus: [],
|
|
100
102
|
groupConfig: groupConfig,
|
|
101
103
|
eventBus: eventBus,
|
|
102
|
-
fixedInfo: []
|
|
104
|
+
fixedInfo: [],
|
|
105
|
+
rowHeight: rowHeight,
|
|
106
|
+
cloWidthArray: cloWidthArray
|
|
103
107
|
},
|
|
104
108
|
// [ReduxThunk, ReduxLogger],
|
|
105
109
|
[ReduxThunk]),
|
|
@@ -120,10 +124,9 @@ var Sheet = function Sheet(props) {
|
|
|
120
124
|
var container = sheetWrapperRef.current;
|
|
121
125
|
if (!start && isNil(row)) return;
|
|
122
126
|
var actual = rowToActualRow((_ref = row) !== null && _ref !== void 0 ? _ref : start === null || start === void 0 ? void 0 : start.row, groupConfig, data.length);
|
|
123
|
-
var rowHeight = getRowHeight(container);
|
|
124
127
|
var firstRowCell = container.querySelector("td.cell[data-col='".concat(start === null || start === void 0 ? void 0 : start.col, "']"));
|
|
125
128
|
var colPosition = firstRowCell ? firstRowCell.offsetLeft - firstRowCell.clientWidth : 0;
|
|
126
|
-
var scrollHeight = actual * rowHeight;
|
|
129
|
+
var scrollHeight = actual * rowHeight.current;
|
|
127
130
|
(_sheetWrapperRef$curr = sheetWrapperRef.current) === null || _sheetWrapperRef$curr === void 0 || _sheetWrapperRef$curr.scrollTo(isNumber(row) ? 0 : colPosition, scrollHeight);
|
|
128
131
|
|
|
129
132
|
// 最后一行的bug暂时用 scroll end 事件来处理
|
|
@@ -153,10 +156,9 @@ var Sheet = function Sheet(props) {
|
|
|
153
156
|
var container = sheetWrapperRef.current;
|
|
154
157
|
if (isNil(row) || isNil(col)) return;
|
|
155
158
|
var actual = rowToActualRow(row, groupConfig, data.length);
|
|
156
|
-
var rowHeight = getRowHeight(container);
|
|
157
159
|
var firstRowCell = container.querySelector("td.cell[data-col='".concat(col, "']"));
|
|
158
160
|
var colPosition = firstRowCell ? firstRowCell.offsetLeft - firstRowCell.clientWidth : 0;
|
|
159
|
-
var scrollHeight = actual * rowHeight;
|
|
161
|
+
var scrollHeight = actual * rowHeight.current;
|
|
160
162
|
if (nextLoop) {
|
|
161
163
|
setTimeout(function () {
|
|
162
164
|
var _sheetWrapperRef$curr4;
|
|
@@ -244,6 +246,16 @@ var Sheet = function Sheet(props) {
|
|
|
244
246
|
}
|
|
245
247
|
});
|
|
246
248
|
}, [onCellsChanged, data, freePaste, groupConfig, freeze]);
|
|
249
|
+
useEffect(function () {
|
|
250
|
+
var _sheetWrapperRef$curr6, _sheetWrapperRef$curr7, _sheetWrapperRef$curr8;
|
|
251
|
+
if (!sheetWrapperRef.current) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
rowHeight.current = ((_sheetWrapperRef$curr6 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr6 === void 0 || (_sheetWrapperRef$curr6 = _sheetWrapperRef$curr6.getElementsByTagName('thead')[0]) === null || _sheetWrapperRef$curr6 === void 0 ? void 0 : _sheetWrapperRef$curr6.clientHeight) || 30;
|
|
255
|
+
cloWidthArray.current = Array.from((_sheetWrapperRef$curr7 = (_sheetWrapperRef$curr8 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr8 === void 0 ? void 0 : _sheetWrapperRef$curr8.getElementsByTagName('col')) !== null && _sheetWrapperRef$curr7 !== void 0 ? _sheetWrapperRef$curr7 : []).map(function (item) {
|
|
256
|
+
return item.clientWidth;
|
|
257
|
+
});
|
|
258
|
+
}, [sheetWrapperRef.current]);
|
|
247
259
|
useCellEvent(dispatch, state);
|
|
248
260
|
useMouseEvent(dispatch, sheetWrapperRef);
|
|
249
261
|
useKeyBoardEvent(dispatch, sheetWrapperRef);
|
|
@@ -270,9 +282,9 @@ var Sheet = function Sheet(props) {
|
|
|
270
282
|
useEffect(function () {
|
|
271
283
|
if (!state.editing && state.start) {
|
|
272
284
|
setTimeout(function () {
|
|
273
|
-
var _sheetWrapperRef$
|
|
285
|
+
var _sheetWrapperRef$curr9;
|
|
274
286
|
// 表格获取焦点 + 接收keyboard event
|
|
275
|
-
(_sheetWrapperRef$
|
|
287
|
+
(_sheetWrapperRef$curr9 = sheetWrapperRef.current) === null || _sheetWrapperRef$curr9 === void 0 || _sheetWrapperRef$curr9.focus({
|
|
276
288
|
preventScroll: true
|
|
277
289
|
});
|
|
278
290
|
}, 1);
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
1
7
|
import { useKeyBoard } from "../..";
|
|
2
8
|
import { sideEffectReducer } from "../reducers/sideEffectReducer";
|
|
3
|
-
import { ensureFocus,
|
|
9
|
+
import { ensureFocus, isSearchElement } from "../util";
|
|
4
10
|
export var useKeyBoardEvent = function useKeyBoardEvent(dispatch, elementRef) {
|
|
5
11
|
useKeyBoard({
|
|
6
12
|
move: function move(e, value) {
|
|
7
13
|
e.preventDefault();
|
|
8
14
|
dispatch({
|
|
9
15
|
type: 'move',
|
|
10
|
-
payload: value
|
|
16
|
+
payload: _objectSpread(_objectSpread({}, value), {}, {
|
|
17
|
+
elementRef: elementRef
|
|
18
|
+
})
|
|
11
19
|
});
|
|
12
|
-
// todo 横向滚动的处理
|
|
13
|
-
var _ref = value,
|
|
14
|
-
row = _ref.row;
|
|
15
|
-
if (Math.abs(row) !== 0) {
|
|
16
|
-
var _elementRef$current;
|
|
17
|
-
var rowHeight = getRowHeight(elementRef.current);
|
|
18
|
-
var itemHeight = rowHeight || 30;
|
|
19
|
-
elementRef === null || elementRef === void 0 || (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 || _elementRef$current.scrollBy({
|
|
20
|
-
top: itemHeight * row
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
20
|
},
|
|
24
21
|
selectAll: function selectAll(e) {
|
|
25
22
|
e.preventDefault();
|
|
@@ -64,18 +61,18 @@ export var useKeyBoardEvent = function useKeyBoardEvent(dispatch, elementRef) {
|
|
|
64
61
|
});
|
|
65
62
|
},
|
|
66
63
|
copy: function copy(e) {
|
|
67
|
-
var _elementRef$
|
|
68
|
-
var isFromSearch = isSearchElement((_elementRef$
|
|
64
|
+
var _elementRef$current;
|
|
65
|
+
var isFromSearch = isSearchElement((_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.parentElement, e.target);
|
|
69
66
|
isFromSearch ? null : dispatch(sideEffectReducer.copy);
|
|
70
67
|
},
|
|
71
68
|
paste: function paste(e) {
|
|
72
|
-
var _elementRef$
|
|
73
|
-
var isFromSearch = isSearchElement((_elementRef$
|
|
69
|
+
var _elementRef$current2;
|
|
70
|
+
var isFromSearch = isSearchElement((_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0 ? void 0 : _elementRef$current2.parentElement, e.target);
|
|
74
71
|
isFromSearch ? null : dispatch(sideEffectReducer.paste);
|
|
75
72
|
},
|
|
76
73
|
cut: function cut(e) {
|
|
77
|
-
var _elementRef$
|
|
78
|
-
var isFromSearch = isSearchElement((_elementRef$
|
|
74
|
+
var _elementRef$current3;
|
|
75
|
+
var isFromSearch = isSearchElement((_elementRef$current3 = elementRef.current) === null || _elementRef$current3 === void 0 ? void 0 : _elementRef$current3.parentElement, e.target);
|
|
79
76
|
if (isFromSearch) return;
|
|
80
77
|
dispatch(sideEffectReducer.copy);
|
|
81
78
|
dispatch(sideEffectReducer.delete);
|
package/dist/core/util.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { SheetType } from "../type";
|
|
2
|
-
import { Cell } from '../type/sheet';
|
|
3
2
|
export declare function findParentTd(el: HTMLElement): HTMLElement | null;
|
|
4
3
|
export declare function extractDataRowAndCol(el: HTMLElement): {
|
|
5
4
|
row: number;
|
|
@@ -44,6 +43,7 @@ export declare const changeGroupConfig: (rowGroupConfig: SheetType.RowGroupConfi
|
|
|
44
43
|
export declare const rowToActualRow: (row: number, groupConfig?: SheetType.RowGroupConfig, max?: number) => number;
|
|
45
44
|
export declare const rowToCountRow: (row: number, groupConfig: SheetType.RowGroupConfig, max: number) => number;
|
|
46
45
|
export declare const getRowHeight: (container: HTMLSpanElement) => number;
|
|
46
|
+
export declare const getColWidth: (container: HTMLSpanElement, col: number) => number;
|
|
47
47
|
export declare const getNextVisibleRow: (row: number, maxRow: number, groupMap?: Map<number, SheetType.RowGroup & {
|
|
48
48
|
isStart: boolean;
|
|
49
49
|
isOpen: boolean;
|
package/dist/core/util.js
CHANGED
|
@@ -416,17 +416,35 @@ export var getRowHeight = function getRowHeight(container) {
|
|
|
416
416
|
var h = ((_container$getElement = container.getElementsByTagName('td')[0]) === null || _container$getElement === void 0 || (_container$getElement = _container$getElement.parentNode) === null || _container$getElement === void 0 ? void 0 : _container$getElement.clientHeight) || 30;
|
|
417
417
|
return h;
|
|
418
418
|
};
|
|
419
|
+
export var getColWidth = function getColWidth(container, col) {
|
|
420
|
+
var colElements = container.getElementsByTagName('col');
|
|
421
|
+
if (colElements[col]) {
|
|
422
|
+
return colElements[col].clientWidth;
|
|
423
|
+
}
|
|
424
|
+
return 0;
|
|
425
|
+
};
|
|
419
426
|
export var getNextVisibleRow = function getNextVisibleRow(row, maxRow, groupMap) {
|
|
420
|
-
var _groupMap$get15, _groupMap$get16;
|
|
421
427
|
var up = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
422
428
|
if (!(groupMap !== null && groupMap !== void 0 && groupMap.size)) {
|
|
423
429
|
return row;
|
|
424
430
|
}
|
|
425
|
-
if (row > maxRow) {
|
|
431
|
+
if (row > maxRow || row < 0) {
|
|
426
432
|
return null;
|
|
427
433
|
}
|
|
428
|
-
|
|
429
|
-
|
|
434
|
+
var rowInfo = groupMap.get(row);
|
|
435
|
+
var isClose = !(rowInfo !== null && rowInfo !== void 0 && rowInfo.isOpen);
|
|
436
|
+
var isChild = !(rowInfo !== null && rowInfo !== void 0 && rowInfo.isStart);
|
|
437
|
+
// 向下 如果遇到了一个关着的 并且 是子行 直接返回他的最后一行+1
|
|
438
|
+
if (rowInfo && isClose && up > 0 && isChild) {
|
|
439
|
+
var newRow = rowInfo.groupEnd + 1;
|
|
440
|
+
if (rowInfo.groupEnd === maxRow) {
|
|
441
|
+
newRow = rowInfo.groupStart;
|
|
442
|
+
}
|
|
443
|
+
return newRow;
|
|
444
|
+
}
|
|
445
|
+
// 向上 如果遇到了一个关着的直接返回他的主行
|
|
446
|
+
if (rowInfo && isClose) {
|
|
447
|
+
return rowInfo.groupStart;
|
|
430
448
|
}
|
|
431
449
|
return row;
|
|
432
450
|
};
|
package/dist/example/group.js
CHANGED
|
@@ -15,11 +15,13 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
15
15
|
var columns = [{
|
|
16
16
|
title: 'Name',
|
|
17
17
|
dataIndex: 'name',
|
|
18
|
-
key: 'name'
|
|
18
|
+
key: 'name',
|
|
19
|
+
width: 220
|
|
19
20
|
}, {
|
|
20
21
|
title: 'Age',
|
|
21
22
|
dataIndex: 'age',
|
|
22
|
-
key: 'age'
|
|
23
|
+
key: 'age',
|
|
24
|
+
width: 220
|
|
23
25
|
}, {
|
|
24
26
|
title: 'Address',
|
|
25
27
|
readonly: function readonly(value, record, index) {
|
|
@@ -27,7 +29,8 @@ var columns = [{
|
|
|
27
29
|
return index % 2 === 0;
|
|
28
30
|
},
|
|
29
31
|
dataIndex: 'address',
|
|
30
|
-
key: 'address'
|
|
32
|
+
key: 'address',
|
|
33
|
+
width: 220
|
|
31
34
|
}, {
|
|
32
35
|
title: 'Action',
|
|
33
36
|
dataIndex: '',
|
|
@@ -37,7 +40,38 @@ var columns = [{
|
|
|
37
40
|
return /*#__PURE__*/_jsx("a", {
|
|
38
41
|
children: "Delete"
|
|
39
42
|
});
|
|
40
|
-
}
|
|
43
|
+
},
|
|
44
|
+
width: 120
|
|
45
|
+
}, {
|
|
46
|
+
title: 'Test',
|
|
47
|
+
dataIndex: 'Test',
|
|
48
|
+
key: 'Test',
|
|
49
|
+
width: 100
|
|
50
|
+
}, {
|
|
51
|
+
title: 'Test1',
|
|
52
|
+
dataIndex: 'Test1',
|
|
53
|
+
key: 'Test1',
|
|
54
|
+
width: 100
|
|
55
|
+
}, {
|
|
56
|
+
title: 'Test2',
|
|
57
|
+
dataIndex: 'Test2',
|
|
58
|
+
key: 'Test2',
|
|
59
|
+
width: 100
|
|
60
|
+
}, {
|
|
61
|
+
title: 'Test3',
|
|
62
|
+
dataIndex: 'Test3',
|
|
63
|
+
key: 'Test3',
|
|
64
|
+
width: 100
|
|
65
|
+
}, {
|
|
66
|
+
title: 'Test4',
|
|
67
|
+
dataIndex: 'Test4',
|
|
68
|
+
key: 'Test4',
|
|
69
|
+
width: 100
|
|
70
|
+
}, {
|
|
71
|
+
title: 'Test5',
|
|
72
|
+
dataIndex: 'Test5',
|
|
73
|
+
key: 'Test5',
|
|
74
|
+
width: 100
|
|
41
75
|
}];
|
|
42
76
|
var data = [{
|
|
43
77
|
key: 1,
|
|
@@ -90,6 +124,51 @@ var data = [{
|
|
|
90
124
|
key: '4-2',
|
|
91
125
|
parentId: 4
|
|
92
126
|
}]
|
|
127
|
+
}, {
|
|
128
|
+
key: 4,
|
|
129
|
+
id: 4,
|
|
130
|
+
name: 'Not Expandable',
|
|
131
|
+
age: 29,
|
|
132
|
+
address: 'Jiangsu No. 1 Lake Park'
|
|
133
|
+
}, {
|
|
134
|
+
key: 5,
|
|
135
|
+
id: 5,
|
|
136
|
+
name: 'Not Expandable',
|
|
137
|
+
age: 29,
|
|
138
|
+
address: 'Jiangsu No. 1 Lake Park'
|
|
139
|
+
}, {
|
|
140
|
+
key: 6,
|
|
141
|
+
id: 6,
|
|
142
|
+
name: 'Not Expandable',
|
|
143
|
+
age: 29,
|
|
144
|
+
address: 'Jiangsu No. 1 Lake Park'
|
|
145
|
+
}, {
|
|
146
|
+
key: 7,
|
|
147
|
+
id: 7,
|
|
148
|
+
name: 'Not Expandable',
|
|
149
|
+
age: 29,
|
|
150
|
+
address: 'Jiangsu No. 1 Lake Park'
|
|
151
|
+
}, {
|
|
152
|
+
key: 8,
|
|
153
|
+
id: 8,
|
|
154
|
+
name: 'Not Expandable',
|
|
155
|
+
age: 29,
|
|
156
|
+
address: 'Jiangsu No. 1 Lake Park'
|
|
157
|
+
}, {
|
|
158
|
+
key: 9,
|
|
159
|
+
id: 9,
|
|
160
|
+
name: 'Jim Green',
|
|
161
|
+
age: 42,
|
|
162
|
+
address: 'London No. 1 Lake Park',
|
|
163
|
+
children: [{
|
|
164
|
+
id: 91,
|
|
165
|
+
key: '9-1',
|
|
166
|
+
parentId: 9
|
|
167
|
+
}, {
|
|
168
|
+
id: 92,
|
|
169
|
+
key: '9-2',
|
|
170
|
+
parentId: 9
|
|
171
|
+
}]
|
|
93
172
|
}];
|
|
94
173
|
var App = function App() {
|
|
95
174
|
var _useState = useState(data),
|
|
@@ -121,7 +200,8 @@ var App = function App() {
|
|
|
121
200
|
return /*#__PURE__*/_jsx(Table, {
|
|
122
201
|
draggable: true,
|
|
123
202
|
scroll: {
|
|
124
|
-
x: '100%'
|
|
203
|
+
x: '100%',
|
|
204
|
+
y: 400
|
|
125
205
|
},
|
|
126
206
|
columns: columns,
|
|
127
207
|
showBackEdit: true,
|
package/dist/type/sheet.d.ts
CHANGED
|
@@ -240,6 +240,8 @@ export type UpdateStateType = {
|
|
|
240
240
|
};
|
|
241
241
|
cellChangeHandler: (cells: CellData[], additions: CellData[] | undefined, type: ChangeType) => void;
|
|
242
242
|
fixedInfo: SheetType.FixedInfo[];
|
|
243
|
+
rowHeight: any;
|
|
244
|
+
cloWidthArray: any;
|
|
243
245
|
} & SearchState;
|
|
244
246
|
export type UpdateFocus = (start: CellPosition, end: CellPosition) => void;
|
|
245
247
|
export type Options<T = any> = {
|