@zhenliang/sheet 0.1.82 → 0.1.84

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.
@@ -176,10 +176,28 @@ export var stateReducer = _objectSpread({
176
176
  },
177
177
  select: function select(state, payload) {
178
178
  var oldStart = state.start,
179
- oldEnd = state.end;
179
+ oldEnd = state.end,
180
+ data = state.data;
180
181
  var _ref3 = payload,
181
182
  start = _ref3.start,
182
183
  end = _ref3.end;
184
+ if (data) {
185
+ var _stripRowIndex = stripRowIndex(data),
186
+ startIndex = _stripRowIndex.startIndex,
187
+ endIndex = _stripRowIndex.endIndex;
188
+ return _objectSpread(_objectSpread({}, state), {}, {
189
+ start: _objectSpread(_objectSpread({}, start), {}, {
190
+ col: Math.max(startIndex, start.col)
191
+ }),
192
+ end: _objectSpread(_objectSpread({}, end), {}, {
193
+ col: Math.min(endIndex, end.col)
194
+ }),
195
+ lastSelected: {
196
+ start: oldStart,
197
+ end: oldEnd
198
+ }
199
+ });
200
+ }
183
201
  return _objectSpread(_objectSpread({}, state), {}, {
184
202
  start: start,
185
203
  end: end,
@@ -192,9 +210,9 @@ export var stateReducer = _objectSpread({
192
210
  selectOneRow: function selectOneRow(state, payload) {
193
211
  var _state$data4 = state.data,
194
212
  data = _state$data4 === void 0 ? [] : _state$data4;
195
- var _stripRowIndex = stripRowIndex(data),
196
- startIndex = _stripRowIndex.startIndex,
197
- endIndex = _stripRowIndex.endIndex;
213
+ var _stripRowIndex2 = stripRowIndex(data),
214
+ startIndex = _stripRowIndex2.startIndex,
215
+ endIndex = _stripRowIndex2.endIndex;
198
216
  if (startIndex >= 0 && endIndex >= 0) {
199
217
  return _objectSpread(_objectSpread({}, state), {}, {
200
218
  start: {
@@ -1,4 +1,5 @@
1
1
  import type { SheetType } from "../type";
2
+ import { Cell } from '../type/sheet';
2
3
  export declare function findParentTd(el: HTMLElement): HTMLElement | null;
3
4
  export declare function extractDataRowAndCol(el: HTMLElement): {
4
5
  row: number;
package/dist/core/util.js CHANGED
@@ -97,7 +97,7 @@ export function stringToClipboardData(str, count) {
97
97
  });
98
98
  }
99
99
  export var defaultParsePaste = function defaultParsePaste(str) {
100
- return str.trimEnd().split(/\r\n|\n|\r/).map(function (row) {
100
+ return str.split(/\r\n|\n|\r/).map(function (row) {
101
101
  return row.split('\t');
102
102
  });
103
103
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhenliang/sheet",
3
- "version": "0.1.82",
3
+ "version": "0.1.84",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",