@leankylin-sheet/core 4.0.4 → 4.0.5

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,10 +1,11 @@
1
1
  import { getSheet } from "./common";
2
2
  import { Context } from "../context";
3
3
  import { CellMatrix, Sheet } from "../types";
4
+ import { Hooks } from "..";
4
5
  export declare function getAllSheets(ctx: Context): Sheet[];
5
6
  export { getSheet };
6
7
  export declare function initSheetData(draftCtx: Context, index: number, newData: Sheet): CellMatrix | null;
7
8
  export declare function hideSheet(ctx: Context, sheetId: string): void;
8
9
  export declare function showSheet(ctx: Context, sheetId: string): void;
9
- export declare function copySheet(ctx: Context, sheetId: string): void;
10
+ export declare function copySheet(ctx: Context, sheetId: string, hooks: Hooks): void;
10
11
  export declare function calculateSheetFromula(ctx: Context, id: string): void;
package/dist/index.esm.js CHANGED
@@ -46387,7 +46387,8 @@ function generateCopySheetName(ctx, sheetId) {
46387
46387
  } while (sheetNames.indexOf(sheetCopyName) !== -1);
46388
46388
  return sheetCopyName;
46389
46389
  }
46390
- function copySheet(ctx, sheetId) {
46390
+ function copySheet(ctx, sheetId, hooks) {
46391
+ var _hooks$onCopySheet;
46391
46392
  var index$1 = getSheetIndex(ctx, sheetId);
46392
46393
  var order = ctx.luckysheetfile[index$1].order + 1;
46393
46394
  var sheetName = generateCopySheetName(ctx, sheetId);
@@ -46396,10 +46397,12 @@ function copySheet(ctx, sheetId) {
46396
46397
  delete sheetData.status;
46397
46398
  sheetData.celldata = dataToCelldata(sheetData.data);
46398
46399
  delete sheetData.data;
46399
- addSheet$1(ctx, undefined, v4(), ctx.luckysheetfile[index$1].isPivotTable, sheetName, sheetData);
46400
+ var copyId = v4();
46401
+ addSheet$1(ctx, undefined, copyId, ctx.luckysheetfile[index$1].isPivotTable, sheetName, sheetData);
46400
46402
  var sheetOrderList = {};
46401
46403
  sheetOrderList[ctx.luckysheetfile[ctx.luckysheetfile.length - 1].id] = order;
46402
46404
  setSheetOrder(ctx, sheetOrderList);
46405
+ (_hooks$onCopySheet = hooks.onCopySheet) === null || _hooks$onCopySheet === void 0 ? void 0 : _hooks$onCopySheet.call(hooks, sheetId, copyId);
46403
46406
  }
46404
46407
  function calculateSheetFromula(ctx, id) {
46405
46408
  var index$1 = getSheetIndex(ctx, id);
package/dist/index.js CHANGED
@@ -46397,7 +46397,8 @@ function generateCopySheetName(ctx, sheetId) {
46397
46397
  } while (sheetNames.indexOf(sheetCopyName) !== -1);
46398
46398
  return sheetCopyName;
46399
46399
  }
46400
- function copySheet(ctx, sheetId) {
46400
+ function copySheet(ctx, sheetId, hooks) {
46401
+ var _hooks$onCopySheet;
46401
46402
  var index$1 = getSheetIndex(ctx, sheetId);
46402
46403
  var order = ctx.luckysheetfile[index$1].order + 1;
46403
46404
  var sheetName = generateCopySheetName(ctx, sheetId);
@@ -46406,10 +46407,12 @@ function copySheet(ctx, sheetId) {
46406
46407
  delete sheetData.status;
46407
46408
  sheetData.celldata = dataToCelldata(sheetData.data);
46408
46409
  delete sheetData.data;
46409
- addSheet$1(ctx, undefined, uuid.v4(), ctx.luckysheetfile[index$1].isPivotTable, sheetName, sheetData);
46410
+ var copyId = uuid.v4();
46411
+ addSheet$1(ctx, undefined, copyId, ctx.luckysheetfile[index$1].isPivotTable, sheetName, sheetData);
46410
46412
  var sheetOrderList = {};
46411
46413
  sheetOrderList[ctx.luckysheetfile[ctx.luckysheetfile.length - 1].id] = order;
46412
46414
  setSheetOrder(ctx, sheetOrderList);
46415
+ (_hooks$onCopySheet = hooks.onCopySheet) === null || _hooks$onCopySheet === void 0 ? void 0 : _hooks$onCopySheet.call(hooks, sheetId, copyId);
46413
46416
  }
46414
46417
  function calculateSheetFromula(ctx, id) {
46415
46418
  var index$1 = getSheetIndex(ctx, id);
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
  import { Sheet, Selection, CellMatrix, Cell } from "./types";
3
3
  export type Hooks = {
4
+ onCopySheet?: (oldSheetId: string, newSheetId: string) => void;
4
5
  commentsPreRender?: (r: number, c: number) => any;
5
6
  showCommentsMenu?: (item: {
6
7
  text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leankylin-sheet/core",
3
- "version": "4.0.4",
3
+ "version": "4.0.5",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.esm.js",
6
6
  "typings": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "build": "father-build"
14
14
  },
15
15
  "dependencies": {
16
- "@leankylin-sheet/formula-parser": "4.0.4",
16
+ "@leankylin-sheet/formula-parser": "4.0.5",
17
17
  "dayjs": "^1.11.0",
18
18
  "immer": "^9.0.12",
19
19
  "lodash": "^4.17.21",