@zhenliang/sheet 0.1.4 → 0.1.7-3.beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/arrow-mac-down.svg +19 -0
- package/dist/assets/arrow-mac-right.svg +17 -0
- package/dist/assets/arrow-windows-down.svg +17 -0
- package/dist/assets/arrow-windows-right.svg +17 -0
- package/dist/core/config.d.ts +3 -0
- package/dist/core/config.js +4 -1
- package/dist/core/editor/cascaderEditor/index.d.ts +1 -1
- package/dist/core/editor/cascaderEditor/index.js +12 -11
- package/dist/core/editor/cascaderEditor/index.less +15 -7
- package/dist/core/editor/dateEditor/index.js +31 -8
- package/dist/core/editor/dateEditor/index.less +9 -2
- package/dist/core/editor/numberEditor/index.d.ts +3 -1
- package/dist/core/editor/numberEditor/index.js +62 -27
- package/dist/core/editor/numberEditor/index.less +3 -2
- package/dist/core/editor/selectEditor/index.d.ts +1 -1
- package/dist/core/editor/selectEditor/index.js +34 -19
- package/dist/core/editor/selectEditor/index.less +16 -5
- package/dist/core/reducers/index.d.ts +2 -2
- package/dist/core/reducers/index.js +8 -1
- package/dist/core/reducers/keyboardReducer.js +39 -9
- package/dist/core/reducers/mouseReducer.js +115 -11
- package/dist/core/reducers/sideEffectReducer.d.ts +1 -1
- package/dist/core/reducers/sideEffectReducer.js +146 -41
- package/dist/core/reducers/stateReducer.d.ts +1 -0
- package/dist/core/reducers/stateReducer.js +96 -27
- package/dist/core/sheet/Cell.d.ts +1 -1
- package/dist/core/sheet/Cell.js +33 -24
- package/dist/core/sheet/Control.d.ts +21 -0
- package/dist/core/sheet/Control.js +83 -0
- package/dist/core/sheet/DataEditor.js +3 -3
- package/dist/core/sheet/DefaultCell.d.ts +8 -3
- package/dist/core/sheet/DefaultCell.js +12 -8
- package/dist/core/sheet/DefaultRow.js +3 -9
- package/dist/core/sheet/DefaultRowMapper.d.ts +3 -0
- package/dist/core/sheet/DefaultRowMapper.js +22 -6
- package/dist/core/sheet/DefaultShell.js +1 -1
- package/dist/core/sheet/Event.d.ts +1 -1
- package/dist/core/sheet/Event.js +1 -1
- package/dist/core/sheet/Menu.d.ts +6 -0
- package/dist/core/sheet/Menu.js +21 -0
- package/dist/core/sheet/ValueViewer.js +1 -1
- package/dist/core/sheet/index.js +249 -88
- package/dist/core/sheet/index.less +199 -107
- package/dist/core/sheet/searchInput.d.ts +15 -0
- package/dist/core/sheet/searchInput.js +78 -0
- package/dist/core/sheet/useCellEvent.js +1 -1
- package/dist/core/sheet/useContextMenu.d.ts +1 -1
- package/dist/core/sheet/useContextMenu.js +13 -10
- package/dist/core/sheet/useKeyBoardEvent.js +19 -2
- package/dist/core/sheet/useMouseEvent.js +19 -12
- package/dist/core/sheet/useSearchInput.d.ts +11 -0
- package/dist/core/sheet/useSearchInput.js +65 -0
- package/dist/core/sheet/useSelectVisible.d.ts +1 -1
- package/dist/core/sheet/useSelectVisible.js +17 -7
- package/dist/core/sheet/useVirtualList.d.ts +10 -1
- package/dist/core/sheet/useVirtualList.js +44 -28
- package/dist/core/sheet/var.less +41 -34
- package/dist/core/shell/draggableShell/index.d.ts +4 -1
- package/dist/core/shell/draggableShell/index.js +133 -50
- package/dist/core/shell/tableShell.d.ts +4 -1
- package/dist/core/shell/tableShell.js +82 -34
- package/dist/core/table/addButton.d.ts +6 -0
- package/dist/core/table/addButton.js +103 -0
- package/dist/core/table/events.d.ts +1 -3
- package/dist/core/table/events.js +30 -35
- package/dist/core/table/index.js +97 -189
- package/dist/core/table/index.less +12 -0
- package/dist/core/table/useGroupConfig.d.ts +4 -1
- package/dist/core/table/useGroupConfig.js +139 -14
- package/dist/core/table/useRowSelection.d.ts +3 -0
- package/dist/core/table/useRowSelection.js +68 -2
- package/dist/core/util.d.ts +10 -4
- package/dist/core/util.js +121 -69
- package/dist/core/viewer/btnViewer/index.js +3 -3
- package/dist/core/viewer/cascaderViewer/index.js +6 -1
- package/dist/core/viewer/checkViewer/index.js +2 -2
- package/dist/core/viewer/editViewer/index.js +3 -3
- package/dist/core/viewer/groupViewer/index.js +26 -10
- package/dist/core/viewer/selectorViewer/index.js +7 -3
- package/dist/core/viewer/switchViewer/index.js +10 -4
- package/dist/example/antComponent.d.ts +1 -1
- package/dist/example/antComponent.js +63 -37
- package/dist/example/basic.d.ts +1 -1
- package/dist/example/basic.js +20 -14
- package/dist/example/ellipsis.d.ts +1 -1
- package/dist/example/ellipsis.js +3 -2
- package/dist/example/fixed.d.ts +1 -1
- package/dist/example/fixed.js +3 -2
- package/dist/example/group.js +40 -17
- package/dist/example/selection.d.ts +1 -1
- package/dist/example/selection.js +9 -8
- package/dist/example/sheet.d.ts +1 -1
- package/dist/example/sheet.js +21 -22
- package/dist/example/valuationAnalyze.d.ts +1 -0
- package/dist/example/valuationAnalyze.js +3 -4
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useEventBus.d.ts +1 -0
- package/dist/hooks/useEventBus.js +2 -2
- package/dist/hooks/useGroupConfig.d.ts +4 -0
- package/dist/hooks/useGroupConfig.js +5 -0
- package/dist/hooks/useKeyboard.d.ts +5 -2
- package/dist/hooks/useKeyboard.js +17 -3
- package/dist/hooks/useMiddlewareReducer.d.ts +5 -5
- package/dist/hooks/useMiddlewareReducer.js +3 -3
- package/dist/hooks/useMouse.d.ts +1 -1
- package/dist/hooks/useMouse.js +7 -7
- package/dist/hooks/useSetState.js +7 -7
- package/dist/hooks/useSheetEvent.d.ts +1 -1
- package/dist/hooks/useSheetEvent.js +2 -2
- package/dist/hooks/useWidthConfig.d.ts +3 -3
- package/dist/hooks/useWidthConfig.js +2 -2
- package/dist/standardUtils/index.d.ts +1 -1
- package/dist/standardUtils/index.js +1 -1
- package/dist/type/sheet.d.ts +77 -31
- package/dist/type/sheetTable.d.ts +21 -12
- package/package.json +7 -4
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
.
|
|
1
|
+
.harvest-sheet-container .select-editor {
|
|
2
2
|
// select style
|
|
3
3
|
width: 100%;
|
|
4
4
|
line-height: 20px;
|
|
5
|
-
height:
|
|
5
|
+
height:38px;
|
|
6
|
+
display: block;
|
|
6
7
|
|
|
7
8
|
.ant-select-selector {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: inherit !important;
|
|
8
11
|
border: none !important;
|
|
9
12
|
background: transparent !important;
|
|
10
13
|
box-shadow: none !important;
|
|
11
14
|
color: #292c33;
|
|
12
|
-
height: 20px !important;
|
|
13
15
|
padding:0 !important;
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
.ant-select-selection-search{
|
|
19
|
+
height: 38px;
|
|
20
|
+
}
|
|
21
|
+
|
|
16
22
|
.ant-select-selection-item {
|
|
17
23
|
color: #292c33;
|
|
24
|
+
line-height: 38px !important;
|
|
18
25
|
font-size: 12px;
|
|
19
|
-
line-height: unset !important;
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
.ant-select-arrow {
|
|
@@ -36,6 +42,11 @@
|
|
|
36
42
|
box-shadow: inset 0 -100px 0 rgba(33,133,208,15%);
|
|
37
43
|
}
|
|
38
44
|
|
|
45
|
+
.ant-select-item {
|
|
46
|
+
font-size: 12px !important;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
39
49
|
|
|
40
|
-
|
|
50
|
+
.select-editor-dropdown{
|
|
51
|
+
min-width: 80px !important;
|
|
41
52
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SheetType } from "../../type";
|
|
2
|
-
export
|
|
3
|
-
export
|
|
2
|
+
export type SheetAction = 'change' | 'changes' | 'rowMove' | 'colMove' | 'editFinish' | 'pushHistory' | 'popHistory' | 'select' | 'selectOneRow' | 'changeSearch' | 'closeSearch' | 'openSearch' | 'changeFixedPosition' | 'clearSelect' | 'clearSelectIfNotSingleRow' | 'clearEdit' | 'mouseDown' | 'mouseOver' | 'mouseUp' | 'selectRow' | 'selectCol' | 'loseFocus' | 'doubleClick' | 'mouseLeaveInterval' | 'move' | 'selectAll' | 'escape' | 'reverse' | 'delete' | 'enter' | 'otherInput' | 'none';
|
|
3
|
+
export type reducerAction = (type: Partial<SheetType.UpdateStateType>, payload?: unknown) => Partial<SheetType.UpdateStateType>;
|
|
4
4
|
declare const sheetReducer: (state: Partial<SheetType.UpdateStateType>, action: {
|
|
5
5
|
type: SheetAction;
|
|
6
6
|
payload?: unknown;
|
|
@@ -10,11 +10,15 @@ var sheetReducer = function sheetReducer(state, action) {
|
|
|
10
10
|
case 'editFinish':
|
|
11
11
|
case 'pushHistory':
|
|
12
12
|
case 'popHistory':
|
|
13
|
-
case 'selectRow':
|
|
14
13
|
case 'select':
|
|
14
|
+
case 'selectOneRow':
|
|
15
15
|
case 'clearSelect':
|
|
16
16
|
case 'clearSelectIfNotSingleRow':
|
|
17
17
|
case 'clearEdit':
|
|
18
|
+
case 'changeSearch':
|
|
19
|
+
case 'closeSearch':
|
|
20
|
+
case 'openSearch':
|
|
21
|
+
case 'changeFixedPosition':
|
|
18
22
|
return stateReducer[action.type](state, action.payload);
|
|
19
23
|
case 'mouseDown':
|
|
20
24
|
case 'mouseOver':
|
|
@@ -22,12 +26,15 @@ var sheetReducer = function sheetReducer(state, action) {
|
|
|
22
26
|
case 'loseFocus':
|
|
23
27
|
case 'doubleClick':
|
|
24
28
|
case 'mouseLeaveInterval':
|
|
29
|
+
case 'selectRow':
|
|
30
|
+
case 'selectCol':
|
|
25
31
|
return mouseReducer[action.type](state, action.payload);
|
|
26
32
|
case 'move':
|
|
27
33
|
case 'escape':
|
|
28
34
|
case 'reverse':
|
|
29
35
|
case 'delete':
|
|
30
36
|
case 'enter':
|
|
37
|
+
case 'selectAll':
|
|
31
38
|
case 'otherInput':
|
|
32
39
|
return keyboardReducer[action.type](state, action.payload);
|
|
33
40
|
default:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(
|
|
6
|
-
function _toPrimitive(
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
7
|
import { isNil } from 'lodash';
|
|
8
|
-
import { getNextVisibleRow, groupConfigToGroupMap } from "../util";
|
|
8
|
+
import { getNextVisibleRow, groupConfigToGroupMap, stripRowIndex } from "../util";
|
|
9
9
|
export var keyboardReducer = {
|
|
10
10
|
move: function move(state, payload) {
|
|
11
11
|
var _state$start, _state$start2;
|
|
@@ -17,7 +17,8 @@ export var keyboardReducer = {
|
|
|
17
17
|
data = _state$data === void 0 ? [] : _state$data;
|
|
18
18
|
var newRow = (((_state$start = state.start) === null || _state$start === void 0 ? void 0 : _state$start.row) || 0) + row;
|
|
19
19
|
if (groupConfig) {
|
|
20
|
-
|
|
20
|
+
var _data;
|
|
21
|
+
newRow = getNextVisibleRow(newRow, (data === null || data === void 0 || (_data = data[data.length - 1]) === null || _data === void 0 ? void 0 : _data[0].row) || data.length, groupConfigToGroupMap(groupConfig), row < 0 ? -1 : 1);
|
|
21
22
|
}
|
|
22
23
|
var currentPos = {
|
|
23
24
|
row: newRow,
|
|
@@ -65,12 +66,12 @@ export var keyboardReducer = {
|
|
|
65
66
|
return state;
|
|
66
67
|
},
|
|
67
68
|
enter: function enter(state, payload) {
|
|
68
|
-
var _data$start$row;
|
|
69
|
+
var _data$start$row, _data$start$row2;
|
|
69
70
|
var start = state.start,
|
|
70
71
|
end = state.end,
|
|
71
72
|
editing = state.editing,
|
|
72
73
|
data = state.data;
|
|
73
|
-
if (!start || !end || data !== null && data !== void 0 && (_data$start$row = data[start.row]) !== null && _data$start$row !== void 0 && _data$start$row[start.col].readonly) {
|
|
74
|
+
if (!start || !end || data !== null && data !== void 0 && (_data$start$row = data[start.row]) !== null && _data$start$row !== void 0 && _data$start$row[start.col].readonly || !(data !== null && data !== void 0 && (_data$start$row2 = data[start.row]) !== null && _data$start$row2 !== void 0 && _data$start$row2[start.col].editable)) {
|
|
74
75
|
return state;
|
|
75
76
|
}
|
|
76
77
|
if (!editing) {
|
|
@@ -89,5 +90,34 @@ export var keyboardReducer = {
|
|
|
89
90
|
otherInput: function otherInput(state, payload) {
|
|
90
91
|
if (state.editing) return state;
|
|
91
92
|
return keyboardReducer.enter(state, payload);
|
|
93
|
+
},
|
|
94
|
+
selectAll: function selectAll(state) {
|
|
95
|
+
var _state$data2 = state.data,
|
|
96
|
+
data = _state$data2 === void 0 ? [] : _state$data2;
|
|
97
|
+
var lastEditing;
|
|
98
|
+
if (state.editing) {
|
|
99
|
+
lastEditing = _objectSpread(_objectSpread({}, state.editing), {}, {
|
|
100
|
+
confirm: true
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
var _stripRowIndex = stripRowIndex(data),
|
|
104
|
+
startIndex = _stripRowIndex.startIndex,
|
|
105
|
+
endIndex = _stripRowIndex.endIndex;
|
|
106
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
107
|
+
start: {
|
|
108
|
+
row: 0,
|
|
109
|
+
col: startIndex
|
|
110
|
+
},
|
|
111
|
+
end: {
|
|
112
|
+
row: data.length - 1,
|
|
113
|
+
col: endIndex
|
|
114
|
+
},
|
|
115
|
+
lastSelected: {
|
|
116
|
+
start: state.start,
|
|
117
|
+
end: state.end
|
|
118
|
+
},
|
|
119
|
+
editing: undefined,
|
|
120
|
+
lastEditing: lastEditing
|
|
121
|
+
});
|
|
92
122
|
}
|
|
93
123
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function ownKeys(
|
|
3
|
-
function _objectSpread(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
-
function _toPropertyKey(
|
|
6
|
-
function _toPrimitive(
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { isFreezedCell, stripRowIndex } from "../util";
|
|
7
8
|
export var mouseReducer = {
|
|
8
9
|
mouseDown: function mouseDown(state, payload) {
|
|
9
10
|
var _ref = payload,
|
|
@@ -14,7 +15,12 @@ export var mouseReducer = {
|
|
|
14
15
|
var data = state.data,
|
|
15
16
|
start = state.start,
|
|
16
17
|
end = state.end;
|
|
17
|
-
if (data
|
|
18
|
+
if ((data === null || data === void 0 ? void 0 : data[row][col].dataIndex) === 'index') {
|
|
19
|
+
return mouseReducer.selectRow(state, {
|
|
20
|
+
row: row
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
if (isFreezedCell(row, col, data)) {
|
|
18
24
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
19
25
|
start: undefined,
|
|
20
26
|
end: undefined,
|
|
@@ -70,7 +76,20 @@ export var mouseReducer = {
|
|
|
70
76
|
row = _ref2.row,
|
|
71
77
|
col = _ref2.col;
|
|
72
78
|
var data = state.data;
|
|
73
|
-
if (state.mouseDown === false ||
|
|
79
|
+
if (state.mouseDown === false || isFreezedCell(row, col, data)) return state;
|
|
80
|
+
if (state.isIndex && state.start && state.end && (data === null || data === void 0 ? void 0 : data[row][col].dataIndex) === 'index') {
|
|
81
|
+
var _state$end;
|
|
82
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
83
|
+
end: {
|
|
84
|
+
row: row,
|
|
85
|
+
col: (_state$end = state.end) === null || _state$end === void 0 ? void 0 : _state$end.col
|
|
86
|
+
},
|
|
87
|
+
lastSelected: {
|
|
88
|
+
start: state.start,
|
|
89
|
+
end: state.end
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
74
93
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
75
94
|
end: {
|
|
76
95
|
row: row,
|
|
@@ -87,9 +106,25 @@ export var mouseReducer = {
|
|
|
87
106
|
row = _ref3.row,
|
|
88
107
|
col = _ref3.col;
|
|
89
108
|
var data = state.data;
|
|
90
|
-
if (state.mouseDown === false ||
|
|
109
|
+
if (state.mouseDown === false || isFreezedCell(row, col, data)) return state;
|
|
110
|
+
if (state.isIndex && state.end) {
|
|
111
|
+
var _state$end2;
|
|
112
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
113
|
+
mouseDown: false,
|
|
114
|
+
isIndex: false,
|
|
115
|
+
end: {
|
|
116
|
+
row: row,
|
|
117
|
+
col: (_state$end2 = state.end) === null || _state$end2 === void 0 ? void 0 : _state$end2.col
|
|
118
|
+
},
|
|
119
|
+
lastSelected: {
|
|
120
|
+
start: state.start,
|
|
121
|
+
end: state.end
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
91
125
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
92
126
|
mouseDown: false,
|
|
127
|
+
isIndex: false,
|
|
93
128
|
end: {
|
|
94
129
|
row: row,
|
|
95
130
|
col: col
|
|
@@ -115,7 +150,13 @@ export var mouseReducer = {
|
|
|
115
150
|
lastSelected: {
|
|
116
151
|
start: state.start,
|
|
117
152
|
end: state.end
|
|
118
|
-
}
|
|
153
|
+
},
|
|
154
|
+
searchText: '',
|
|
155
|
+
showSearch: false,
|
|
156
|
+
searchTotal: 0,
|
|
157
|
+
searchCurrent: 0,
|
|
158
|
+
searchCalledCount: 0,
|
|
159
|
+
searchResultList: []
|
|
119
160
|
});
|
|
120
161
|
},
|
|
121
162
|
doubleClick: function doubleClick(state, payload) {
|
|
@@ -129,6 +170,7 @@ export var mouseReducer = {
|
|
|
129
170
|
}
|
|
130
171
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
131
172
|
mouseDown: false,
|
|
173
|
+
isIndex: false,
|
|
132
174
|
editing: {
|
|
133
175
|
row: row,
|
|
134
176
|
col: col
|
|
@@ -149,16 +191,78 @@ export var mouseReducer = {
|
|
|
149
191
|
});
|
|
150
192
|
},
|
|
151
193
|
mouseLeaveInterval: function mouseLeaveInterval(state, payload) {
|
|
152
|
-
var _data$,
|
|
194
|
+
var _data$, _end$col;
|
|
153
195
|
var _ref5 = payload,
|
|
154
196
|
end = _ref5.end;
|
|
155
197
|
var data = state.data;
|
|
156
198
|
// fixed 列不选中
|
|
157
|
-
if (data !== null && data !== void 0 && (_data$ = data[0]) !== null && _data$ !== void 0 && (_data
|
|
199
|
+
if (data !== null && data !== void 0 && (_data$ = data[0]) !== null && _data$ !== void 0 && (_data$ = _data$[(_end$col = end.col) !== null && _end$col !== void 0 ? _end$col : 0]) !== null && _data$ !== void 0 && _data$.fixed) {
|
|
158
200
|
return state;
|
|
159
201
|
}
|
|
160
202
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
161
203
|
end: end
|
|
162
204
|
});
|
|
205
|
+
},
|
|
206
|
+
selectRow: function selectRow(state, payload) {
|
|
207
|
+
var _ref6 = payload,
|
|
208
|
+
row = _ref6.row;
|
|
209
|
+
var _state$data = state.data,
|
|
210
|
+
data = _state$data === void 0 ? [] : _state$data;
|
|
211
|
+
var lastEditing;
|
|
212
|
+
var _stripRowIndex = stripRowIndex(data),
|
|
213
|
+
startIndex = _stripRowIndex.startIndex,
|
|
214
|
+
endIndex = _stripRowIndex.endIndex;
|
|
215
|
+
if (state.editing) {
|
|
216
|
+
lastEditing = _objectSpread(_objectSpread({}, state.editing), {}, {
|
|
217
|
+
confirm: true
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
221
|
+
start: {
|
|
222
|
+
row: row,
|
|
223
|
+
col: startIndex
|
|
224
|
+
},
|
|
225
|
+
end: {
|
|
226
|
+
row: row,
|
|
227
|
+
col: endIndex
|
|
228
|
+
},
|
|
229
|
+
lastSelected: {
|
|
230
|
+
start: state.start,
|
|
231
|
+
end: state.end
|
|
232
|
+
},
|
|
233
|
+
mouseDown: true,
|
|
234
|
+
isIndex: true,
|
|
235
|
+
editing: undefined,
|
|
236
|
+
lastEditing: lastEditing
|
|
237
|
+
});
|
|
238
|
+
},
|
|
239
|
+
selectCol: function selectCol(state, payload) {
|
|
240
|
+
var _ref7 = payload,
|
|
241
|
+
col = _ref7.col,
|
|
242
|
+
colSpan = _ref7.colSpan;
|
|
243
|
+
var _state$data2 = state.data,
|
|
244
|
+
data = _state$data2 === void 0 ? [] : _state$data2;
|
|
245
|
+
var lastEditing;
|
|
246
|
+
if (state.editing) {
|
|
247
|
+
lastEditing = _objectSpread(_objectSpread({}, state.editing), {}, {
|
|
248
|
+
confirm: true
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
return _objectSpread(_objectSpread({}, state), {}, {
|
|
252
|
+
start: {
|
|
253
|
+
row: 0,
|
|
254
|
+
col: col
|
|
255
|
+
},
|
|
256
|
+
end: {
|
|
257
|
+
row: data.length - 1,
|
|
258
|
+
col: col + (colSpan > 1 ? colSpan - 1 : 0)
|
|
259
|
+
},
|
|
260
|
+
lastSelected: {
|
|
261
|
+
start: state.start,
|
|
262
|
+
end: state.end
|
|
263
|
+
},
|
|
264
|
+
editing: undefined,
|
|
265
|
+
lastEditing: lastEditing
|
|
266
|
+
});
|
|
163
267
|
}
|
|
164
268
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SheetType } from "../../type";
|
|
2
2
|
import { FunctionAction, NormalAction } from '../../hooks';
|
|
3
|
-
export
|
|
3
|
+
export type asyncActionType = (dispatch: (action: NormalAction | FunctionAction) => void, getState: () => SheetType.UpdateStateType) => void;
|
|
4
4
|
export declare const sideEffectReducer: Record<string, asyncActionType>;
|