@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.
Files changed (117) hide show
  1. package/dist/assets/arrow-mac-down.svg +19 -0
  2. package/dist/assets/arrow-mac-right.svg +17 -0
  3. package/dist/assets/arrow-windows-down.svg +17 -0
  4. package/dist/assets/arrow-windows-right.svg +17 -0
  5. package/dist/core/config.d.ts +3 -0
  6. package/dist/core/config.js +4 -1
  7. package/dist/core/editor/cascaderEditor/index.d.ts +1 -1
  8. package/dist/core/editor/cascaderEditor/index.js +12 -11
  9. package/dist/core/editor/cascaderEditor/index.less +15 -7
  10. package/dist/core/editor/dateEditor/index.js +31 -8
  11. package/dist/core/editor/dateEditor/index.less +9 -2
  12. package/dist/core/editor/numberEditor/index.d.ts +3 -1
  13. package/dist/core/editor/numberEditor/index.js +62 -27
  14. package/dist/core/editor/numberEditor/index.less +3 -2
  15. package/dist/core/editor/selectEditor/index.d.ts +1 -1
  16. package/dist/core/editor/selectEditor/index.js +34 -19
  17. package/dist/core/editor/selectEditor/index.less +16 -5
  18. package/dist/core/reducers/index.d.ts +2 -2
  19. package/dist/core/reducers/index.js +8 -1
  20. package/dist/core/reducers/keyboardReducer.js +39 -9
  21. package/dist/core/reducers/mouseReducer.js +115 -11
  22. package/dist/core/reducers/sideEffectReducer.d.ts +1 -1
  23. package/dist/core/reducers/sideEffectReducer.js +146 -41
  24. package/dist/core/reducers/stateReducer.d.ts +1 -0
  25. package/dist/core/reducers/stateReducer.js +96 -27
  26. package/dist/core/sheet/Cell.d.ts +1 -1
  27. package/dist/core/sheet/Cell.js +33 -24
  28. package/dist/core/sheet/Control.d.ts +21 -0
  29. package/dist/core/sheet/Control.js +83 -0
  30. package/dist/core/sheet/DataEditor.js +3 -3
  31. package/dist/core/sheet/DefaultCell.d.ts +8 -3
  32. package/dist/core/sheet/DefaultCell.js +12 -8
  33. package/dist/core/sheet/DefaultRow.js +3 -9
  34. package/dist/core/sheet/DefaultRowMapper.d.ts +3 -0
  35. package/dist/core/sheet/DefaultRowMapper.js +22 -6
  36. package/dist/core/sheet/DefaultShell.js +1 -1
  37. package/dist/core/sheet/Event.d.ts +1 -1
  38. package/dist/core/sheet/Event.js +1 -1
  39. package/dist/core/sheet/Menu.d.ts +6 -0
  40. package/dist/core/sheet/Menu.js +21 -0
  41. package/dist/core/sheet/ValueViewer.js +1 -1
  42. package/dist/core/sheet/index.js +249 -88
  43. package/dist/core/sheet/index.less +199 -107
  44. package/dist/core/sheet/searchInput.d.ts +15 -0
  45. package/dist/core/sheet/searchInput.js +78 -0
  46. package/dist/core/sheet/useCellEvent.js +1 -1
  47. package/dist/core/sheet/useContextMenu.d.ts +1 -1
  48. package/dist/core/sheet/useContextMenu.js +13 -10
  49. package/dist/core/sheet/useKeyBoardEvent.js +19 -2
  50. package/dist/core/sheet/useMouseEvent.js +19 -12
  51. package/dist/core/sheet/useSearchInput.d.ts +11 -0
  52. package/dist/core/sheet/useSearchInput.js +65 -0
  53. package/dist/core/sheet/useSelectVisible.d.ts +1 -1
  54. package/dist/core/sheet/useSelectVisible.js +17 -7
  55. package/dist/core/sheet/useVirtualList.d.ts +10 -1
  56. package/dist/core/sheet/useVirtualList.js +44 -28
  57. package/dist/core/sheet/var.less +41 -34
  58. package/dist/core/shell/draggableShell/index.d.ts +4 -1
  59. package/dist/core/shell/draggableShell/index.js +133 -50
  60. package/dist/core/shell/tableShell.d.ts +4 -1
  61. package/dist/core/shell/tableShell.js +82 -34
  62. package/dist/core/table/addButton.d.ts +6 -0
  63. package/dist/core/table/addButton.js +103 -0
  64. package/dist/core/table/events.d.ts +1 -3
  65. package/dist/core/table/events.js +30 -35
  66. package/dist/core/table/index.js +97 -189
  67. package/dist/core/table/index.less +12 -0
  68. package/dist/core/table/useGroupConfig.d.ts +4 -1
  69. package/dist/core/table/useGroupConfig.js +139 -14
  70. package/dist/core/table/useRowSelection.d.ts +3 -0
  71. package/dist/core/table/useRowSelection.js +68 -2
  72. package/dist/core/util.d.ts +10 -4
  73. package/dist/core/util.js +121 -69
  74. package/dist/core/viewer/btnViewer/index.js +3 -3
  75. package/dist/core/viewer/cascaderViewer/index.js +6 -1
  76. package/dist/core/viewer/checkViewer/index.js +2 -2
  77. package/dist/core/viewer/editViewer/index.js +3 -3
  78. package/dist/core/viewer/groupViewer/index.js +26 -10
  79. package/dist/core/viewer/selectorViewer/index.js +7 -3
  80. package/dist/core/viewer/switchViewer/index.js +10 -4
  81. package/dist/example/antComponent.d.ts +1 -1
  82. package/dist/example/antComponent.js +63 -37
  83. package/dist/example/basic.d.ts +1 -1
  84. package/dist/example/basic.js +20 -14
  85. package/dist/example/ellipsis.d.ts +1 -1
  86. package/dist/example/ellipsis.js +3 -2
  87. package/dist/example/fixed.d.ts +1 -1
  88. package/dist/example/fixed.js +3 -2
  89. package/dist/example/group.js +40 -17
  90. package/dist/example/selection.d.ts +1 -1
  91. package/dist/example/selection.js +9 -8
  92. package/dist/example/sheet.d.ts +1 -1
  93. package/dist/example/sheet.js +21 -22
  94. package/dist/example/valuationAnalyze.d.ts +1 -0
  95. package/dist/example/valuationAnalyze.js +3 -4
  96. package/dist/hooks/index.d.ts +1 -1
  97. package/dist/hooks/index.js +1 -1
  98. package/dist/hooks/useEventBus.d.ts +1 -0
  99. package/dist/hooks/useEventBus.js +2 -2
  100. package/dist/hooks/useGroupConfig.d.ts +4 -0
  101. package/dist/hooks/useGroupConfig.js +5 -0
  102. package/dist/hooks/useKeyboard.d.ts +5 -2
  103. package/dist/hooks/useKeyboard.js +17 -3
  104. package/dist/hooks/useMiddlewareReducer.d.ts +5 -5
  105. package/dist/hooks/useMiddlewareReducer.js +3 -3
  106. package/dist/hooks/useMouse.d.ts +1 -1
  107. package/dist/hooks/useMouse.js +7 -7
  108. package/dist/hooks/useSetState.js +7 -7
  109. package/dist/hooks/useSheetEvent.d.ts +1 -1
  110. package/dist/hooks/useSheetEvent.js +2 -2
  111. package/dist/hooks/useWidthConfig.d.ts +3 -3
  112. package/dist/hooks/useWidthConfig.js +2 -2
  113. package/dist/standardUtils/index.d.ts +1 -1
  114. package/dist/standardUtils/index.js +1 -1
  115. package/dist/type/sheet.d.ts +77 -31
  116. package/dist/type/sheetTable.d.ts +21 -12
  117. package/package.json +7 -4
@@ -1,22 +1,28 @@
1
- .select-editor,.ant-select-selector {
1
+ .harvest-sheet-container .select-editor {
2
2
  // select style
3
3
  width: 100%;
4
4
  line-height: 20px;
5
- height: 20px;
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 declare type SheetAction = 'change' | 'changes' | 'rowMove' | 'colMove' | 'editFinish' | 'pushHistory' | 'popHistory' | 'selectRow' | 'select' | 'clearSelect' | 'clearSelectIfNotSingleRow' | 'clearEdit' | 'mouseDown' | 'mouseOver' | 'mouseUp' | 'loseFocus' | 'doubleClick' | 'mouseLeaveInterval' | 'move' | 'escape' | 'reverse' | 'delete' | 'enter' | 'otherInput' | 'none';
3
- export declare type reducerAction = (type: Partial<SheetType.UpdateStateType>, payload?: unknown) => Partial<SheetType.UpdateStateType>;
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(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; }
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(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); }
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
- newRow = getNextVisibleRow(newRow, data.length, groupConfigToGroupMap(groupConfig), row < 0 ? -1 : 1);
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(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; }
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(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); }
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 !== null && data !== void 0 && data[row][col].fixed) {
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 || data !== null && data !== void 0 && data[row][col].fixed) return state;
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 || data !== null && data !== void 0 && data[row][col].fixed) return state;
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$, _data$$end$col;
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$$end$col = _data$[end.col]) !== null && _data$$end$col !== void 0 && _data$$end$col.fixed) {
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 declare type asyncActionType = (dispatch: (action: NormalAction | FunctionAction) => void, getState: () => SheetType.UpdateStateType) => void;
3
+ export type asyncActionType = (dispatch: (action: NormalAction | FunctionAction) => void, getState: () => SheetType.UpdateStateType) => void;
4
4
  export declare const sideEffectReducer: Record<string, asyncActionType>;