@zhenliang/sheet 0.1.87 → 0.1.89-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/reducers/keyboardReducer.js +44 -24
- package/dist/core/sheet/Control.d.ts +5 -0
- package/dist/core/sheet/Control.js +24 -3
- package/dist/core/sheet/index.js +24 -1
- package/dist/core/sheet/useKeyBoardEvent.js +7 -18
- package/dist/core/util.d.ts +1 -1
- package/dist/core/util.js +22 -3
- package/dist/example/group.js +70 -5
- package/dist/type/sheet.d.ts +3 -0
- package/package.json +2 -1
|
@@ -5,24 +5,54 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { isNil } from 'lodash';
|
|
8
|
-
import { getNextVisibleRow, groupConfigToGroupMap, stripRowIndex } from "../util";
|
|
8
|
+
import { getNextVisibleRow, groupConfigToGroupMap, stripRowIndex, getRowHeight, getColWidth } 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
15
|
var groupConfig = state.groupConfig,
|
|
16
|
+
elementRef = state.elementRef,
|
|
16
17
|
_state$data = state.data,
|
|
17
18
|
data = _state$data === void 0 ? [] : _state$data;
|
|
18
|
-
var newRow = (((_state$start = state.start) === null || _state$start === void 0 ? void 0 : _state$start.row) || 0) +
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
var newRow = (((_state$start = state.start) === null || _state$start === void 0 ? void 0 : _state$start.row) || 0) + optRow;
|
|
20
|
+
var newCol = (((_state$start2 = state.start) === null || _state$start2 === void 0 ? void 0 : _state$start2.col) || 0) + optCol;
|
|
21
|
+
// 越界判断
|
|
22
|
+
var maxRow = (data === null || data === void 0 || (_data = data[data.length - 1]) === null || _data === void 0 ? void 0 : _data[0].row) || data.length - 1;
|
|
23
|
+
var maxCol = data[0].length - 1;
|
|
24
|
+
var minCol = -1;
|
|
25
|
+
data[0].forEach(function (item) {
|
|
26
|
+
var itemCol = item.col;
|
|
27
|
+
if (itemCol < 0) {
|
|
28
|
+
minCol++;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
if (newRow > maxRow || newRow < 0 || newCol > maxCol || newCol < minCol) {
|
|
32
|
+
return state;
|
|
33
|
+
}
|
|
34
|
+
// 跟随滚动
|
|
35
|
+
if (optCol !== 0) {
|
|
36
|
+
var _elementRef$current;
|
|
37
|
+
var colWidth = getColWidth(elementRef.current, newCol);
|
|
38
|
+
elementRef === null || elementRef === void 0 || (_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 || _elementRef$current.scrollBy({
|
|
39
|
+
left: colWidth * optCol
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
if (optRow !== 0) {
|
|
43
|
+
var _elementRef$current2;
|
|
44
|
+
var rowHeight = getRowHeight(elementRef.current);
|
|
45
|
+
var itemHeight = rowHeight;
|
|
46
|
+
elementRef === null || elementRef === void 0 || (_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0 || _elementRef$current2.scrollBy({
|
|
47
|
+
top: itemHeight * optRow
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (groupConfig && optRow !== 0) {
|
|
51
|
+
newRow = getNextVisibleRow(newRow, maxRow, groupConfigToGroupMap(groupConfig), optRow);
|
|
22
52
|
}
|
|
23
53
|
var currentPos = {
|
|
24
54
|
row: newRow,
|
|
25
|
-
col:
|
|
55
|
+
col: newCol
|
|
26
56
|
};
|
|
27
57
|
var lastEditing = state.lastEditing;
|
|
28
58
|
if (state.editing) {
|
|
@@ -30,21 +60,10 @@ export var keyboardReducer = {
|
|
|
30
60
|
confirm: true
|
|
31
61
|
});
|
|
32
62
|
}
|
|
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,
|
|
63
|
+
var isOut = isNil(currentPos.row);
|
|
64
|
+
var newState = _objectSpread(_objectSpread({}, state), {}, {
|
|
65
|
+
start: isOut ? undefined : currentPos,
|
|
66
|
+
end: isOut ? undefined : currentPos,
|
|
48
67
|
lastSelected: {
|
|
49
68
|
start: state.start,
|
|
50
69
|
end: state.end
|
|
@@ -52,6 +71,7 @@ export var keyboardReducer = {
|
|
|
52
71
|
editing: undefined,
|
|
53
72
|
lastEditing: lastEditing
|
|
54
73
|
});
|
|
74
|
+
return newState;
|
|
55
75
|
},
|
|
56
76
|
escape: function escape(state) {
|
|
57
77
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
@@ -8,6 +8,8 @@ interface ControlProps {
|
|
|
8
8
|
backToEditRow: () => void;
|
|
9
9
|
toTop: () => void;
|
|
10
10
|
toBottom: () => void;
|
|
11
|
+
reverse: () => void;
|
|
12
|
+
recover: () => void;
|
|
11
13
|
backEditStyle?: Partial<CSSProperties>;
|
|
12
14
|
ControlContainer?: React.FC<any>;
|
|
13
15
|
showBackEdit?: boolean;
|
|
@@ -16,6 +18,9 @@ interface ControlProps {
|
|
|
16
18
|
end?: CellPosition;
|
|
17
19
|
selecting?: boolean;
|
|
18
20
|
};
|
|
21
|
+
showRecoverBtn: boolean;
|
|
22
|
+
recoverLength: number;
|
|
23
|
+
reverseLength: number;
|
|
19
24
|
}
|
|
20
25
|
export declare const Control: React.FC<ControlProps>;
|
|
21
26
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EditOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
1
|
+
import { EditOutlined, RedoOutlined, UndoOutlined, VerticalAlignBottomOutlined, VerticalAlignTopOutlined } from '@ant-design/icons';
|
|
2
2
|
import { Button, Tooltip } from 'antd';
|
|
3
3
|
import React, { useMemo } from 'react';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -16,14 +16,35 @@ export var Control = function Control(props) {
|
|
|
16
16
|
toTop = props.toTop,
|
|
17
17
|
toBottom = props.toBottom,
|
|
18
18
|
backToEditRow = props.backToEditRow,
|
|
19
|
+
reverse = props.reverse,
|
|
20
|
+
recover = props.recover,
|
|
19
21
|
_props$backEditStyle = props.backEditStyle,
|
|
20
22
|
backEditStyle = _props$backEditStyle === void 0 ? {
|
|
21
23
|
bottom: 0,
|
|
22
24
|
right: 0
|
|
23
25
|
} : _props$backEditStyle,
|
|
24
|
-
ControlContainer = props.ControlContainer
|
|
26
|
+
ControlContainer = props.ControlContainer,
|
|
27
|
+
showRecoverBtn = props.showRecoverBtn,
|
|
28
|
+
recoverLength = props.recoverLength,
|
|
29
|
+
reverseLength = props.reverseLength;
|
|
25
30
|
var btns = useMemo(function () {
|
|
26
31
|
var tempBtns = [{
|
|
32
|
+
title: '撤销',
|
|
33
|
+
disabled: reverseLength === 0,
|
|
34
|
+
event: reverse,
|
|
35
|
+
icon: /*#__PURE__*/_jsx(UndoOutlined, {
|
|
36
|
+
style: itemStyle
|
|
37
|
+
}),
|
|
38
|
+
isShow: showRecoverBtn
|
|
39
|
+
}, {
|
|
40
|
+
title: '恢复',
|
|
41
|
+
disabled: recoverLength === 0,
|
|
42
|
+
event: recover,
|
|
43
|
+
icon: /*#__PURE__*/_jsx(RedoOutlined, {
|
|
44
|
+
style: itemStyle
|
|
45
|
+
}),
|
|
46
|
+
isShow: showRecoverBtn
|
|
47
|
+
}, {
|
|
27
48
|
title: '置顶',
|
|
28
49
|
disabled: firstRowVisible,
|
|
29
50
|
event: toTop,
|
|
@@ -51,7 +72,7 @@ export var Control = function Control(props) {
|
|
|
51
72
|
return tempBtns.filter(function (item) {
|
|
52
73
|
return item.isShow;
|
|
53
74
|
});
|
|
54
|
-
}, [firstRowVisible, showQuickLocationBtn, lastRowVisible, startRowVisible, showBackEdit]);
|
|
75
|
+
}, [firstRowVisible, showQuickLocationBtn, lastRowVisible, startRowVisible, showBackEdit, recoverLength, reverseLength, reverse, recover]);
|
|
55
76
|
if (!showBackEdit && !showQuickLocationBtn) return null;
|
|
56
77
|
if (ControlContainer) {
|
|
57
78
|
return /*#__PURE__*/_jsx(ControlContainer, {
|
package/dist/core/sheet/index.js
CHANGED
|
@@ -20,6 +20,7 @@ import { Empty } from 'antd';
|
|
|
20
20
|
import { isEmpty, isNil, isNumber } from 'lodash';
|
|
21
21
|
import { SheetEventContext, useEventBus, useMiddlewareReducer } from "../../hooks";
|
|
22
22
|
import sheetReducer from "../reducers";
|
|
23
|
+
import { sideEffectReducer } from "../reducers/sideEffectReducer";
|
|
23
24
|
import { classNames, getRowHeight, rowToActualRow } from "../util";
|
|
24
25
|
import { Control } from "./Control";
|
|
25
26
|
import { DefaultRowMapper } from "./DefaultRowMapper";
|
|
@@ -98,7 +99,8 @@ var Sheet = function Sheet(props) {
|
|
|
98
99
|
lastFocus: [],
|
|
99
100
|
groupConfig: groupConfig,
|
|
100
101
|
eventBus: eventBus,
|
|
101
|
-
fixedInfo: []
|
|
102
|
+
fixedInfo: [],
|
|
103
|
+
elementRef: sheetWrapperRef
|
|
102
104
|
},
|
|
103
105
|
// [ReduxThunk, ReduxLogger],
|
|
104
106
|
[ReduxThunk]),
|
|
@@ -394,6 +396,18 @@ var Sheet = function Sheet(props) {
|
|
|
394
396
|
handleScroll();
|
|
395
397
|
}
|
|
396
398
|
}, []);
|
|
399
|
+
var _useMemo = useMemo(function () {
|
|
400
|
+
var history = state.history,
|
|
401
|
+
recoverHistory = state.recoverHistory;
|
|
402
|
+
var reverseLength = history ? history.length : 0;
|
|
403
|
+
var recoverLength = recoverHistory ? recoverHistory.length : 0;
|
|
404
|
+
return {
|
|
405
|
+
reverseLength: reverseLength,
|
|
406
|
+
recoverLength: recoverLength
|
|
407
|
+
};
|
|
408
|
+
}, [state]),
|
|
409
|
+
reverseLength = _useMemo.reverseLength,
|
|
410
|
+
recoverLength = _useMemo.recoverLength;
|
|
397
411
|
return /*#__PURE__*/_jsx(SheetEventContext.Provider, {
|
|
398
412
|
value: eventBus,
|
|
399
413
|
children: /*#__PURE__*/_jsxs(_Fragment, {
|
|
@@ -432,6 +446,15 @@ var Sheet = function Sheet(props) {
|
|
|
432
446
|
}), /*#__PURE__*/_jsxs("div", {
|
|
433
447
|
className: "harvest-sheet-control",
|
|
434
448
|
children: [/*#__PURE__*/_jsx(Control, {
|
|
449
|
+
showRecoverBtn: !freeze,
|
|
450
|
+
reverse: function reverse() {
|
|
451
|
+
dispatch(sideEffectReducer.reverse);
|
|
452
|
+
},
|
|
453
|
+
recover: function recover() {
|
|
454
|
+
dispatch(sideEffectReducer.recover);
|
|
455
|
+
},
|
|
456
|
+
reverseLength: reverseLength,
|
|
457
|
+
recoverLength: recoverLength,
|
|
435
458
|
showBackEdit: showBackEdit,
|
|
436
459
|
startRowVisible: startRowVisible,
|
|
437
460
|
backToEditRow: function backToEditRow() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useKeyBoard } from "../..";
|
|
2
2
|
import { sideEffectReducer } from "../reducers/sideEffectReducer";
|
|
3
|
-
import { ensureFocus,
|
|
3
|
+
import { ensureFocus, isSearchElement } from "../util";
|
|
4
4
|
export var useKeyBoardEvent = function useKeyBoardEvent(dispatch, elementRef) {
|
|
5
5
|
useKeyBoard({
|
|
6
6
|
move: function move(e, value) {
|
|
@@ -9,17 +9,6 @@ export var useKeyBoardEvent = function useKeyBoardEvent(dispatch, elementRef) {
|
|
|
9
9
|
type: 'move',
|
|
10
10
|
payload: value
|
|
11
11
|
});
|
|
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
12
|
},
|
|
24
13
|
selectAll: function selectAll(e) {
|
|
25
14
|
e.preventDefault();
|
|
@@ -64,18 +53,18 @@ export var useKeyBoardEvent = function useKeyBoardEvent(dispatch, elementRef) {
|
|
|
64
53
|
});
|
|
65
54
|
},
|
|
66
55
|
copy: function copy(e) {
|
|
67
|
-
var _elementRef$
|
|
68
|
-
var isFromSearch = isSearchElement((_elementRef$
|
|
56
|
+
var _elementRef$current;
|
|
57
|
+
var isFromSearch = isSearchElement((_elementRef$current = elementRef.current) === null || _elementRef$current === void 0 ? void 0 : _elementRef$current.parentElement, e.target);
|
|
69
58
|
isFromSearch ? null : dispatch(sideEffectReducer.copy);
|
|
70
59
|
},
|
|
71
60
|
paste: function paste(e) {
|
|
72
|
-
var _elementRef$
|
|
73
|
-
var isFromSearch = isSearchElement((_elementRef$
|
|
61
|
+
var _elementRef$current2;
|
|
62
|
+
var isFromSearch = isSearchElement((_elementRef$current2 = elementRef.current) === null || _elementRef$current2 === void 0 ? void 0 : _elementRef$current2.parentElement, e.target);
|
|
74
63
|
isFromSearch ? null : dispatch(sideEffectReducer.paste);
|
|
75
64
|
},
|
|
76
65
|
cut: function cut(e) {
|
|
77
|
-
var _elementRef$
|
|
78
|
-
var isFromSearch = isSearchElement((_elementRef$
|
|
66
|
+
var _elementRef$current3;
|
|
67
|
+
var isFromSearch = isSearchElement((_elementRef$current3 = elementRef.current) === null || _elementRef$current3 === void 0 ? void 0 : _elementRef$current3.parentElement, e.target);
|
|
79
68
|
if (isFromSearch) return;
|
|
80
69
|
dispatch(sideEffectReducer.copy);
|
|
81
70
|
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) => any;
|
|
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
|
@@ -16,6 +16,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
16
16
|
|
|
17
17
|
import { message } from 'antd';
|
|
18
18
|
import { cloneDeep, get, isNil, range } from 'lodash';
|
|
19
|
+
var colElements;
|
|
19
20
|
export function findParentTd(el) {
|
|
20
21
|
if (!el) return null;
|
|
21
22
|
if (el.tagName === 'TD') return el;
|
|
@@ -416,17 +417,35 @@ export var getRowHeight = function getRowHeight(container) {
|
|
|
416
417
|
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
418
|
return h;
|
|
418
419
|
};
|
|
420
|
+
export var getColWidth = function getColWidth(container, col) {
|
|
421
|
+
if (isNil(colElements)) {
|
|
422
|
+
colElements = container.getElementsByTagName('col');
|
|
423
|
+
}
|
|
424
|
+
if (colElements[col]) {
|
|
425
|
+
return colElements[col].clientWidth;
|
|
426
|
+
}
|
|
427
|
+
return 0;
|
|
428
|
+
};
|
|
419
429
|
export var getNextVisibleRow = function getNextVisibleRow(row, maxRow, groupMap) {
|
|
420
430
|
var _groupMap$get15, _groupMap$get16;
|
|
421
431
|
var up = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
422
432
|
if (!(groupMap !== null && groupMap !== void 0 && groupMap.size)) {
|
|
423
433
|
return row;
|
|
424
434
|
}
|
|
425
|
-
if (row > maxRow) {
|
|
435
|
+
if (row > maxRow || row < 0) {
|
|
426
436
|
return null;
|
|
427
437
|
}
|
|
428
|
-
|
|
429
|
-
|
|
438
|
+
var isClose = !((_groupMap$get15 = groupMap.get(row)) !== null && _groupMap$get15 !== void 0 && _groupMap$get15.isOpen);
|
|
439
|
+
var isChild = !((_groupMap$get16 = groupMap.get(row)) !== null && _groupMap$get16 !== void 0 && _groupMap$get16.isStart);
|
|
440
|
+
// 向下 如果遇到了一个关着的 并且 是子行 直接返回他的最后一行+1
|
|
441
|
+
if (groupMap.get(row) && isClose && isChild && up > 0) {
|
|
442
|
+
var _groupMap$get17;
|
|
443
|
+
return ((_groupMap$get17 = groupMap.get(row)) === null || _groupMap$get17 === void 0 ? void 0 : _groupMap$get17.groupEnd) + 1;
|
|
444
|
+
}
|
|
445
|
+
// 向上 如果遇到了一个关着的直接返回他的主行
|
|
446
|
+
if (groupMap.get(row) && isClose) {
|
|
447
|
+
var _groupMap$get18;
|
|
448
|
+
return (_groupMap$get18 = groupMap.get(row)) === null || _groupMap$get18 === void 0 ? void 0 : _groupMap$get18.groupStart;
|
|
430
449
|
}
|
|
431
450
|
return row;
|
|
432
451
|
};
|
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,36 @@ 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'
|
|
93
157
|
}];
|
|
94
158
|
var App = function App() {
|
|
95
159
|
var _useState = useState(data),
|
|
@@ -121,7 +185,8 @@ var App = function App() {
|
|
|
121
185
|
return /*#__PURE__*/_jsx(Table, {
|
|
122
186
|
draggable: true,
|
|
123
187
|
scroll: {
|
|
124
|
-
x: '100%'
|
|
188
|
+
x: '100%',
|
|
189
|
+
y: 400
|
|
125
190
|
},
|
|
126
191
|
columns: columns,
|
|
127
192
|
showBackEdit: true,
|
package/dist/type/sheet.d.ts
CHANGED
|
@@ -108,6 +108,7 @@ export type SheetInstance = {
|
|
|
108
108
|
}) => void;
|
|
109
109
|
popHistory: () => OperateHistory;
|
|
110
110
|
dropHistory: () => OperateHistory[];
|
|
111
|
+
dropRecover: () => OperateHistory[];
|
|
111
112
|
call: (caller: (...args: any) => void, ...args: any) => void;
|
|
112
113
|
};
|
|
113
114
|
export type SheetProps = {
|
|
@@ -141,6 +142,7 @@ export type SheetProps = {
|
|
|
141
142
|
showQuickLocationBtn?: boolean;
|
|
142
143
|
showRemark?: boolean;
|
|
143
144
|
ControlContainer?: React.FC;
|
|
145
|
+
showRecoverBtn?: boolean;
|
|
144
146
|
};
|
|
145
147
|
export type WidthConfigContext = {
|
|
146
148
|
onChange?: (value: Record<number | string, number>) => void;
|
|
@@ -238,6 +240,7 @@ export type UpdateStateType = {
|
|
|
238
240
|
};
|
|
239
241
|
cellChangeHandler: (cells: CellData[], additions: CellData[] | undefined, type: ChangeType) => void;
|
|
240
242
|
fixedInfo: SheetType.FixedInfo[];
|
|
243
|
+
elementRef: any;
|
|
241
244
|
} & SearchState;
|
|
242
245
|
export type UpdateFocus = (start: CellPosition, end: CellPosition) => void;
|
|
243
246
|
export type Options<T = any> = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhenliang/sheet",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.89-beta.0",
|
|
4
4
|
"description": "A react library developed with dumi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -85,4 +85,5 @@
|
|
|
85
85
|
"fizz.zhou@ap.jll.com"
|
|
86
86
|
],
|
|
87
87
|
"preid": "beta"
|
|
88
|
+
|
|
88
89
|
}
|