@leankylin-sheet/core 1.2.13 → 1.2.15

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.
@@ -1,5 +1,5 @@
1
1
  import { Context } from "../context";
2
2
  export declare function handlePaste(ctx: Context, e: ClipboardEvent): void;
3
3
  export declare function getClipboardContent(): Promise<string>;
4
- export declare function handlePasteByLeanklin(ctx: Context, clipboard: string): Promise<void>;
4
+ export declare function handlePasteByLeanklin(ctx: Context, e: any): Promise<void>;
5
5
  export declare function handlePasteByClick(ctx: Context, triggerType?: string): void;
package/dist/index.esm.js CHANGED
@@ -69426,33 +69426,39 @@ function _getClipboardContent() {
69426
69426
  }));
69427
69427
  return _getClipboardContent.apply(this, arguments);
69428
69428
  }
69429
+ function getClipboardText(e) {
69430
+ var clipboardData = e.clipboardData;
69431
+ var txtdata = clipboardData.getData("text/plain");
69432
+ return txtdata;
69433
+ }
69429
69434
  function handlePasteByLeanklin(_x2, _x3) {
69430
69435
  return _handlePasteByLeanklin.apply(this, arguments);
69431
69436
  }
69432
69437
  function _handlePasteByLeanklin() {
69433
- _handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, clipboard) {
69438
+ _handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, e) {
69434
69439
  var _ctx$luckysheet_selec8;
69435
- var allowEdit, selectRange, rows, columns, data, copyOne, newData, r, rIndex, c, row, column, range;
69440
+ var clipboard, allowEdit, selectRange, rows, columns, data, copyOne, newData, r, rIndex, c, row, column, range;
69436
69441
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
69437
69442
  while (1) switch (_context2.prev = _context2.next) {
69438
69443
  case 0:
69444
+ clipboard = getClipboardText(e);
69439
69445
  allowEdit = isAllowEdit(ctx);
69440
69446
  if (allowEdit) {
69441
- _context2.next = 3;
69447
+ _context2.next = 4;
69442
69448
  break;
69443
69449
  }
69444
69450
  return _context2.abrupt("return");
69445
- case 3:
69451
+ case 4:
69446
69452
  selectRange = (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : _ctx$luckysheet_selec8[0];
69447
69453
  if (selectRange) {
69448
- _context2.next = 6;
69454
+ _context2.next = 7;
69449
69455
  break;
69450
69456
  }
69451
69457
  return _context2.abrupt("return");
69452
- case 6:
69458
+ case 7:
69453
69459
  rows = selectRange.row;
69454
69460
  columns = selectRange.column;
69455
- data = clipboard.split("\n").map(function (item) {
69461
+ data = clipboard.trimEnd().split("\n").map(function (item) {
69456
69462
  return item.split("\t");
69457
69463
  });
69458
69464
  copyOne = data.length === 1 && data[0].length === 1;
@@ -69474,7 +69480,7 @@ function _handlePasteByLeanklin() {
69474
69480
  };
69475
69481
  setCellValuesByRange(ctx, newData, range, null);
69476
69482
  ctx.luckysheet_select_save = [range];
69477
- case 17:
69483
+ case 18:
69478
69484
  case "end":
69479
69485
  return _context2.stop();
69480
69486
  }
package/dist/index.js CHANGED
@@ -69436,33 +69436,39 @@ function _getClipboardContent() {
69436
69436
  }));
69437
69437
  return _getClipboardContent.apply(this, arguments);
69438
69438
  }
69439
+ function getClipboardText(e) {
69440
+ var clipboardData = e.clipboardData;
69441
+ var txtdata = clipboardData.getData("text/plain");
69442
+ return txtdata;
69443
+ }
69439
69444
  function handlePasteByLeanklin(_x2, _x3) {
69440
69445
  return _handlePasteByLeanklin.apply(this, arguments);
69441
69446
  }
69442
69447
  function _handlePasteByLeanklin() {
69443
- _handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, clipboard) {
69448
+ _handlePasteByLeanklin = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(ctx, e) {
69444
69449
  var _ctx$luckysheet_selec8;
69445
- var allowEdit, selectRange, rows, columns, data, copyOne, newData, r, rIndex, c, row, column, range;
69450
+ var clipboard, allowEdit, selectRange, rows, columns, data, copyOne, newData, r, rIndex, c, row, column, range;
69446
69451
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
69447
69452
  while (1) switch (_context2.prev = _context2.next) {
69448
69453
  case 0:
69454
+ clipboard = getClipboardText(e);
69449
69455
  allowEdit = isAllowEdit(ctx);
69450
69456
  if (allowEdit) {
69451
- _context2.next = 3;
69457
+ _context2.next = 4;
69452
69458
  break;
69453
69459
  }
69454
69460
  return _context2.abrupt("return");
69455
- case 3:
69461
+ case 4:
69456
69462
  selectRange = (_ctx$luckysheet_selec8 = ctx.luckysheet_select_save) === null || _ctx$luckysheet_selec8 === void 0 ? void 0 : _ctx$luckysheet_selec8[0];
69457
69463
  if (selectRange) {
69458
- _context2.next = 6;
69464
+ _context2.next = 7;
69459
69465
  break;
69460
69466
  }
69461
69467
  return _context2.abrupt("return");
69462
- case 6:
69468
+ case 7:
69463
69469
  rows = selectRange.row;
69464
69470
  columns = selectRange.column;
69465
- data = clipboard.split("\n").map(function (item) {
69471
+ data = clipboard.trimEnd().split("\n").map(function (item) {
69466
69472
  return item.split("\t");
69467
69473
  });
69468
69474
  copyOne = data.length === 1 && data[0].length === 1;
@@ -69484,7 +69490,7 @@ function _handlePasteByLeanklin() {
69484
69490
  };
69485
69491
  setCellValuesByRange(ctx, newData, range, null);
69486
69492
  ctx.luckysheet_select_save = [range];
69487
- case 17:
69493
+ case 18:
69488
69494
  case "end":
69489
69495
  return _context2.stop();
69490
69496
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "1.2.13",
3
+ "version": "1.2.15",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "repository": "http://114.55.85.79:19999/leankylin-front/leankylin-sheet",
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@leankylin-sheet/formula-parser": "^1.2.13",
13
+ "@leankylin-sheet/formula-parser": "^1.2.15",
14
14
  "dayjs": "^1.11.0",
15
15
  "immer": "^9.0.12",
16
16
  "lodash": "^4.17.21",