@visactor/vtable-plugins 1.19.4-alpha.1 → 1.19.4

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.
@@ -108,4 +108,5 @@ const parseValue = value => {
108
108
  translateRowObj_1.translateRowArrayToObj)(newData, columns);
109
109
  };
110
110
 
111
- exports.generateAutoFillData = generateAutoFillData;
111
+ exports.generateAutoFillData = generateAutoFillData;
112
+ //# sourceMappingURL=autoFillHandle.js.map
package/cjs/index.d.ts CHANGED
@@ -11,5 +11,6 @@ export * from './focus-highlight';
11
11
  export * from './table-carousel-animation';
12
12
  export * from './rotate-table';
13
13
  export * from './gantt-export-image';
14
+ export * from './paste-add-row-column';
14
15
  export * from './wps-fill-handle';
15
16
  export * from './excel-import';
package/cjs/index.js CHANGED
@@ -23,6 +23,6 @@ __exportStar(require("./column-series"), exports), __exportStar(require("./row-s
23
23
  __exportStar(require("./highlight-header-when-select-cell"), exports), __exportStar(require("./excel-edit-cell-keyboard"), exports),
24
24
  __exportStar(require("./types"), exports), __exportStar(require("./focus-highlight"), exports),
25
25
  __exportStar(require("./table-carousel-animation"), exports), __exportStar(require("./rotate-table"), exports),
26
- __exportStar(require("./gantt-export-image"), exports), __exportStar(require("./wps-fill-handle"), exports),
27
- __exportStar(require("./excel-import"), exports);
26
+ __exportStar(require("./gantt-export-image"), exports), __exportStar(require("./paste-add-row-column"), exports),
27
+ __exportStar(require("./wps-fill-handle"), exports), __exportStar(require("./excel-import"), exports);
28
28
  //# sourceMappingURL=index.js.map
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,mDAAiC;AACjC,kDAAgC;AAChC,+CAA6B;AAC7B,sEAAoD;AACpD,6DAA2C;AAC3C,0CAAwB;AACxB,oDAAkC;AAClC,6DAA2C;AAC3C,iDAA+B;AAC/B,uDAAqC;AACrC,oDAAkC;AAClC,iDAA+B","file":"index.js","sourcesContent":["export * from './carousel-animation';\nexport * from './invert-highlight';\nexport * from './header-highlight';\nexport * from './add-row-column';\nexport * from './column-series';\nexport * from './row-series';\nexport * from './highlight-header-when-select-cell';\nexport * from './excel-edit-cell-keyboard';\nexport * from './types';\nexport * from './focus-highlight';\nexport * from './table-carousel-animation';\nexport * from './rotate-table';\nexport * from './gantt-export-image';\nexport * from './wps-fill-handle';\nexport * from './excel-import';\n"]}
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,qDAAmC;AACnC,qDAAmC;AACnC,mDAAiC;AACjC,kDAAgC;AAChC,+CAA6B;AAC7B,sEAAoD;AACpD,6DAA2C;AAC3C,0CAAwB;AACxB,oDAAkC;AAClC,6DAA2C;AAC3C,iDAA+B;AAC/B,uDAAqC;AACrC,yDAAuC;AACvC,oDAAkC;AAClC,iDAA+B","file":"index.js","sourcesContent":["export * from './carousel-animation';\nexport * from './invert-highlight';\nexport * from './header-highlight';\nexport * from './add-row-column';\nexport * from './column-series';\nexport * from './row-series';\nexport * from './highlight-header-when-select-cell';\nexport * from './excel-edit-cell-keyboard';\nexport * from './types';\nexport * from './focus-highlight';\nexport * from './table-carousel-animation';\nexport * from './rotate-table';\nexport * from './gantt-export-image';\nexport * from './paste-add-row-column';\nexport * from './wps-fill-handle';\nexport * from './excel-import';\n"]}
@@ -0,0 +1,17 @@
1
+ import * as VTable from '@visactor/vtable';
2
+ export type IPasteAddRowColumnPluginOptions = {
3
+ addRowCallback?: (addedRow: number, table: VTable.ListTable) => void;
4
+ addColumnCallback?: (addedCount: number, table: VTable.ListTable) => void;
5
+ };
6
+ export declare class PasteAddRowColumnPlugin implements VTable.plugins.IVTablePlugin {
7
+ id: string;
8
+ name: string;
9
+ runTime: ("initialized" | "pasted_data")[];
10
+ table: VTable.ListTable;
11
+ pluginOptions: IPasteAddRowColumnPluginOptions;
12
+ pastedData: any;
13
+ constructor(pluginOptions?: IPasteAddRowColumnPluginOptions);
14
+ run(...args: any[]): void;
15
+ handlePaste(): void;
16
+ release(): void;
17
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) {
4
+ void 0 === k2 && (k2 = k);
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ desc && !("get" in desc ? !m.__esModule : desc.writable || desc.configurable) || (desc = {
7
+ enumerable: !0,
8
+ get: function() {
9
+ return m[k];
10
+ }
11
+ }), Object.defineProperty(o, k2, desc);
12
+ } : function(o, m, k, k2) {
13
+ void 0 === k2 && (k2 = k), o[k2] = m[k];
14
+ }), __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function(o, v) {
15
+ Object.defineProperty(o, "default", {
16
+ enumerable: !0,
17
+ value: v
18
+ });
19
+ } : function(o, v) {
20
+ o.default = v;
21
+ }), __importStar = this && this.__importStar || function(mod) {
22
+ if (mod && mod.__esModule) return mod;
23
+ var result = {};
24
+ if (null != mod) for (var k in mod) "default" !== k && Object.prototype.hasOwnProperty.call(mod, k) && __createBinding(result, mod, k);
25
+ return __setModuleDefault(result, mod), result;
26
+ };
27
+
28
+ Object.defineProperty(exports, "__esModule", {
29
+ value: !0
30
+ }), exports.PasteAddRowColumnPlugin = void 0;
31
+
32
+ const VTable = __importStar(require("@visactor/vtable"));
33
+
34
+ class PasteAddRowColumnPlugin {
35
+ constructor(pluginOptions) {
36
+ this.id = `paste-add-row-${Date.now()}`, this.name = "Paste Add row", this.runTime = [ VTable.TABLE_EVENT_TYPE.INITIALIZED, VTable.TABLE_EVENT_TYPE.PASTED_DATA ],
37
+ this.pluginOptions = pluginOptions;
38
+ }
39
+ run(...args) {
40
+ const runtime = args[1], table = args[2];
41
+ this.table = table, runtime === VTable.TABLE_EVENT_TYPE.PASTED_DATA && (this.pastedData = args[0],
42
+ this.handlePaste());
43
+ }
44
+ handlePaste() {
45
+ var _a, _b, _c;
46
+ const {pasteData: pasteData, row: row, col: col} = this.pastedData, rowCount = this.table.rowCount, colCount = this.table.colCount, rowsNeeded = row + pasteData.length - rowCount, colsNeeded = col + ((null === (_a = pasteData[0]) || void 0 === _a ? void 0 : _a.length) || 0) - colCount;
47
+ if (rowsNeeded > 0) for (let i = 0; i < rowsNeeded; i++) (null === (_b = this.pluginOptions) || void 0 === _b ? void 0 : _b.addRowCallback) ? this.pluginOptions.addRowCallback(rowCount + i, this.table) : this.table.addRecord([]);
48
+ if (colsNeeded > 0) for (let i = 0; i < colsNeeded; i++) {
49
+ const newColIndex = colCount + i;
50
+ (null === (_c = this.pluginOptions) || void 0 === _c ? void 0 : _c.addColumnCallback) ? this.pluginOptions.addColumnCallback(newColIndex, this.table) : this.table.addColumn({
51
+ field: `field_${newColIndex}`,
52
+ title: `New Column ${newColIndex}`,
53
+ width: 100
54
+ });
55
+ }
56
+ this.table.changeCellValues(col, row, pasteData, !0);
57
+ }
58
+ release() {
59
+ this.table.internalProps.handler.clear();
60
+ }
61
+ }
62
+
63
+ exports.PasteAddRowColumnPlugin = PasteAddRowColumnPlugin;
64
+ //# sourceMappingURL=paste-add-row-column.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["paste-add-row-column.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAM3C,MAAa,uBAAuB;IAOlC,YAAY,aAA+C;QAN3D,OAAE,GAAG,iBAAiB,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QACnC,SAAI,GAAG,eAAe,CAAC;QACvB,YAAO,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QAKnF,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IACD,GAAG,CAAC,GAAG,IAAW;QAChB,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACxB,MAAM,KAAK,GAAwB,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAyB,CAAC;QACvC,IAAI,OAAO,KAAK,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE;YACnD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,WAAW,EAAE,CAAC;SACpB;IACH,CAAC;IAED,WAAW;;QACT,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC;QAChD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;QAErC,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC;QACxC,MAAM,cAAc,GAAG,CAAA,MAAA,SAAS,CAAC,CAAC,CAAC,0CAAE,MAAM,KAAI,CAAC,CAAC;QAEjD,MAAM,UAAU,GAAG,GAAG,GAAG,cAAc,GAAG,QAAQ,CAAC;QACnD,MAAM,UAAU,GAAG,GAAG,GAAG,cAAc,GAAG,QAAQ,CAAC;QAGnD,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;gBACnC,IAAI,MAAA,IAAI,CAAC,aAAa,0CAAE,cAAc,EAAE;oBACtC,IAAI,CAAC,aAAa,CAAC,cAAc,CAAC,QAAQ,GAAG,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;iBAC7D;qBAAM;oBACL,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;iBAC1B;aACF;SACF;QAGD,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,UAAU,EAAE,CAAC,EAAE,EAAE;gBACnC,MAAM,WAAW,GAAG,QAAQ,GAAG,CAAC,CAAC;gBACjC,IAAI,MAAA,IAAI,CAAC,aAAa,0CAAE,iBAAiB,EAAE;oBACzC,IAAI,CAAC,aAAa,CAAC,iBAAiB,CAAC,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;iBAC/D;qBAAM;oBACL,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;wBACnB,KAAK,EAAE,SAAS,WAAW,EAAE;wBAC7B,KAAK,EAAE,cAAc,WAAW,EAAE;wBAClC,KAAK,EAAE,GAAG;qBACX,CAAC,CAAC;iBACJ;aACF;SACF;QAGD,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACzD,CAAC;IAED,OAAO;QACL,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC;CACF;AAjED,0DAiEC","file":"paste-add-row-column.js","sourcesContent":["import * as VTable from '@visactor/vtable';\nexport type IPasteAddRowColumnPluginOptions = {\n addRowCallback?: (addedRow: number, table: VTable.ListTable) => void;\n addColumnCallback?: (addedCount: number, table: VTable.ListTable) => void;\n};\n\nexport class PasteAddRowColumnPlugin implements VTable.plugins.IVTablePlugin {\n id = `paste-add-row-${Date.now()}`;\n name = 'Paste Add row';\n runTime = [VTable.TABLE_EVENT_TYPE.INITIALIZED, VTable.TABLE_EVENT_TYPE.PASTED_DATA];\n table: VTable.ListTable;\n pluginOptions: IPasteAddRowColumnPluginOptions;\n pastedData: any;\n constructor(pluginOptions?: IPasteAddRowColumnPluginOptions) {\n this.pluginOptions = pluginOptions;\n }\n run(...args: any[]) {\n const runtime = args[1];\n const table: VTable.BaseTableAPI = args[2];\n this.table = table as VTable.ListTable;\n if (runtime === VTable.TABLE_EVENT_TYPE.PASTED_DATA) {\n this.pastedData = args[0];\n this.handlePaste();\n }\n }\n\n handlePaste() {\n const { pasteData, row, col } = this.pastedData;\n const rowCount = this.table.rowCount;\n const colCount = this.table.colCount;\n\n const pastedRowCount = pasteData.length;\n const pastedColCount = pasteData[0]?.length || 0;\n\n const rowsNeeded = row + pastedRowCount - rowCount;\n const colsNeeded = col + pastedColCount - colCount;\n\n // 扩展行\n if (rowsNeeded > 0) {\n for (let i = 0; i < rowsNeeded; i++) {\n if (this.pluginOptions?.addRowCallback) {\n this.pluginOptions.addRowCallback(rowCount + i, this.table);\n } else {\n this.table.addRecord([]);\n }\n }\n }\n\n // 扩展列\n if (colsNeeded > 0) {\n for (let i = 0; i < colsNeeded; i++) {\n const newColIndex = colCount + i;\n if (this.pluginOptions?.addColumnCallback) {\n this.pluginOptions.addColumnCallback(newColIndex, this.table);\n } else {\n this.table.addColumn({\n field: `field_${newColIndex}`,\n title: `New Column ${newColIndex}`,\n width: 100\n });\n }\n }\n }\n\n // 最后统一写入数据\n this.table.changeCellValues(col, row, pasteData, true);\n }\n\n release() {\n this.table.internalProps.handler.clear();\n }\n}\n"]}
@@ -96,5 +96,4 @@ function deleteSelectRange(selectCells, tableInstance) {
96
96
  for (let i = 0; i < selectCells.length; i++) for (let j = 0; j < selectCells[i].length; j++) tableInstance.changeCellValue(selectCells[i][j].col, selectCells[i][j].row, "");
97
97
  }
98
98
 
99
- //# sourceMappingURL=wps-fill-handle.js.map
100
99
  exports.WpsFillHandlePlugin = WpsFillHandlePlugin;
@@ -8799,7 +8799,7 @@
8799
8799
  }
8800
8800
  removeChild(child) {
8801
8801
  const data = super.removeChild(child);
8802
- return child.stage = null, this.getGraphicService().onRemove(child), this.addUpdateBoundTag(), data;
8802
+ return this.getGraphicService().onRemove(child), child.stage = null, this.addUpdateBoundTag(), data;
8803
8803
  }
8804
8804
  removeAllChild(deep = !1) {
8805
8805
  this.forEachChildren(child => {
@@ -10310,9 +10310,10 @@
10310
10310
  return super.needUpdateTag(key, POLYGON_UPDATE_TAG_KEY);
10311
10311
  }
10312
10312
  toCustomPath() {
10313
- const points = this.attribute.points,
10314
- path = new CustomPath2D();
10315
- return points.forEach((point, index) => {
10313
+ let path = super.toCustomPath();
10314
+ if (path) return path;
10315
+ const points = this.attribute.points;
10316
+ return path = new CustomPath2D(), points.forEach((point, index) => {
10316
10317
  0 === index ? path.moveTo(point.x, point.y) : path.lineTo(point.x, point.y);
10317
10318
  }), path.closePath(), path;
10318
10319
  }
@@ -12940,6 +12941,7 @@
12940
12941
  drawContext.updateBounds ? this.useDirtyBounds = !0 : this.useDirtyBounds = !drawContext.stage.params.optimize.disableCheckGraphicWidthOutRange;
12941
12942
  }
12942
12943
  draw(renderService, drawContext) {
12944
+ var _a;
12943
12945
  this.prepareForDraw(renderService, drawContext), drawContext.drawContribution = this, this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap, this.currentRenderService = renderService;
12944
12946
  const {
12945
12947
  context: context,
@@ -12954,7 +12956,7 @@
12954
12956
  dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
12955
12957
  }
12956
12958
  const d = context.dpr % 1;
12957
- (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.reset(!1), context.save(), context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f), context.clearMatrix(!1), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), renderService.renderTreeRoots.sort((a, b) => {
12959
+ (d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.reset(!1), context.save(), context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f), context.clearMatrix(!1), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), (null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage) && renderService.drawParams.stage.hooks.afterClearScreen.call(renderService.drawParams), renderService.renderTreeRoots.sort((a, b) => {
12958
12960
  var _a, _b;
12959
12961
  return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
12960
12962
  }).forEach(group => {
@@ -13090,7 +13092,7 @@
13090
13092
  return data || this.currentRenderMap.get(type) || this.defaultRenderMap.get(type);
13091
13093
  }
13092
13094
  clearScreen(renderService, context, drawContext) {
13093
- var _a, _b;
13095
+ var _a, _b, _c;
13094
13096
  const {
13095
13097
  clear: clear,
13096
13098
  viewBox: viewBox
@@ -13098,9 +13100,9 @@
13098
13100
  width = viewBox.width(),
13099
13101
  height = viewBox.height();
13100
13102
  if (clear) {
13101
- context.clearRect(0, 0, width, height);
13102
- const stage = null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage;
13103
- if (stage && (context.globalAlpha = null !== (_b = stage.attribute.opacity) && void 0 !== _b ? _b : 1), stage && stage.backgroundImg && stage.resources) {
13103
+ context.clearRect(0, 0, width, height), (null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage) && renderService.drawParams.stage.hooks.afterClearRect.call(renderService.drawParams);
13104
+ const stage = null === (_b = renderService.drawParams) || void 0 === _b ? void 0 : _b.stage;
13105
+ if (stage && (context.globalAlpha = null !== (_c = stage.attribute.opacity) && void 0 !== _c ? _c : 1), stage && stage.backgroundImg && stage.resources) {
13104
13106
  const res = stage.resources.get(clear);
13105
13107
  res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
13106
13108
  } else context.fillStyle = createColor(context, clear, {
@@ -13628,13 +13630,19 @@
13628
13630
  } else this._skipRender = 1;
13629
13631
  }, this.beforeRender = stage => {
13630
13632
  this._beforeRender && this._beforeRender(stage);
13633
+ }, this.afterClearScreen = drawParams => {
13634
+ this._afterClearScreen && this._afterClearScreen(drawParams);
13635
+ }, this.afterClearRect = drawParams => {
13636
+ this._afterClearRect && this._afterClearRect(drawParams);
13631
13637
  }, this.afterRender = stage => {
13632
13638
  this.renderCount++, this._afterRender && this._afterRender(stage), this._afterNextRenderCbs && this._afterNextRenderCbs.forEach(cb => cb(stage)), this._afterNextRenderCbs = null, this.tickedBeforeRender = !1;
13633
13639
  }, this.afterTickCb = () => {
13634
13640
  this.tickedBeforeRender = !0, "rendering" !== this.state && this.renderNextFrame();
13635
13641
  }, this.params = params, this.theme = new Theme(), this.hooks = {
13636
13642
  beforeRender: new SyncHook(["stage"]),
13637
- afterRender: new SyncHook(["stage"])
13643
+ afterRender: new SyncHook(["stage"]),
13644
+ afterClearScreen: new SyncHook(["stage"]),
13645
+ afterClearRect: new SyncHook(["stage"])
13638
13646
  }, this.global = application.global, !this.global.env && isBrowserEnv() && this.global.setEnv("browser"), this.window = container.get(VWindow), this.renderService = container.get(RenderService), this.pluginService = container.get(PluginService), this.layerService = container.get(LayerService), this.graphicService = container.get(GraphicService), this.pluginService.active(this, params), this.window.create({
13639
13647
  width: params.width,
13640
13648
  height: params.height,
@@ -13646,7 +13654,7 @@
13646
13654
  canvas: params.canvas
13647
13655
  }), this.state = "normal", this.renderCount = 0, this.tryInitEventSystem(), this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig.BACKGROUND, this.appendChild(this.layerService.createLayer(this, {
13648
13656
  main: !0
13649
- })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
13657
+ })), this.nextFrameRenderLayerSet = new Set(), this.willNextFrameRender = !1, this.stage = this, this.renderStyle = params.renderStyle, params.autoRender && this.enableAutoRender(), params.autoRefresh && this.enableAutoRefresh(), !1 === params.disableDirtyBounds && this.enableDirtyBounds(), params.enableHtmlAttribute && this.enableHtmlAttribute(params.enableHtmlAttribute), params.ReactDOM && this.enableReactAttribute(params.ReactDOM), params.enableLayout && this.enableLayout(), this.hooks.beforeRender.tap("constructor", this.beforeRender), this.hooks.afterRender.tap("constructor", this.afterRender), this.hooks.afterClearScreen.tap("constructor", this.afterClearScreen), this.hooks.afterClearRect.tap("constructor", this.afterClearRect), this._beforeRender = params.beforeRender, this._afterRender = params.afterRender, this._afterClearScreen = params.afterClearScreen, this._afterClearRect = params.afterClearRect, this.supportInteractiveLayer = !1 !== params.interactiveLayer, params.optimize || (params.optimize = {
13650
13658
  tickRenderMode: "effect"
13651
13659
  }), this.optmize(params.optimize), params.background && isString$1(this._background) && this._background.includes("/") && this.setAttributes({
13652
13660
  background: this._background
@@ -14041,7 +14049,7 @@
14041
14049
  return this._cursor;
14042
14050
  }
14043
14051
  eventPointTransform(e) {
14044
- const point = this.global.mapToCanvasPoint(e, this.window.getContext().canvas.nativeCanvas);
14052
+ const point = this.global.mapToCanvasPoint(e, this.window);
14045
14053
  return this.stage.window.pointTransform(point.x, point.y);
14046
14054
  }
14047
14055
  pauseTriggerEvent() {
@@ -21983,6 +21991,65 @@
21983
21991
  }
21984
21992
  }
21985
21993
 
21994
+ class PasteAddRowColumnPlugin {
21995
+ id = `paste-add-row-${Date.now()}`;
21996
+ name = 'Paste Add row';
21997
+ runTime = [VTable__namespace.TABLE_EVENT_TYPE.INITIALIZED, VTable__namespace.TABLE_EVENT_TYPE.PASTED_DATA];
21998
+ table;
21999
+ pluginOptions;
22000
+ pastedData;
22001
+ constructor(pluginOptions) {
22002
+ this.pluginOptions = pluginOptions;
22003
+ }
22004
+ run(...args) {
22005
+ const runtime = args[1];
22006
+ const table = args[2];
22007
+ this.table = table;
22008
+ if (runtime === VTable__namespace.TABLE_EVENT_TYPE.PASTED_DATA) {
22009
+ this.pastedData = args[0];
22010
+ this.handlePaste();
22011
+ }
22012
+ }
22013
+ handlePaste() {
22014
+ const { pasteData, row, col } = this.pastedData;
22015
+ const rowCount = this.table.rowCount;
22016
+ const colCount = this.table.colCount;
22017
+ const pastedRowCount = pasteData.length;
22018
+ const pastedColCount = pasteData[0]?.length || 0;
22019
+ const rowsNeeded = row + pastedRowCount - rowCount;
22020
+ const colsNeeded = col + pastedColCount - colCount;
22021
+ if (rowsNeeded > 0) {
22022
+ for (let i = 0; i < rowsNeeded; i++) {
22023
+ if (this.pluginOptions?.addRowCallback) {
22024
+ this.pluginOptions.addRowCallback(rowCount + i, this.table);
22025
+ }
22026
+ else {
22027
+ this.table.addRecord([]);
22028
+ }
22029
+ }
22030
+ }
22031
+ if (colsNeeded > 0) {
22032
+ for (let i = 0; i < colsNeeded; i++) {
22033
+ const newColIndex = colCount + i;
22034
+ if (this.pluginOptions?.addColumnCallback) {
22035
+ this.pluginOptions.addColumnCallback(newColIndex, this.table);
22036
+ }
22037
+ else {
22038
+ this.table.addColumn({
22039
+ field: `field_${newColIndex}`,
22040
+ title: `New Column ${newColIndex}`,
22041
+ width: 100
22042
+ });
22043
+ }
22044
+ }
22045
+ }
22046
+ this.table.changeCellValues(col, row, pasteData, true);
22047
+ }
22048
+ release() {
22049
+ this.table.internalProps.handler.clear();
22050
+ }
22051
+ }
22052
+
21986
22053
  /*
21987
22054
  * big.js v6.2.2
21988
22055
  * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic.
@@ -101161,6 +101228,7 @@ ${recordsStr}
101161
101228
  exports.HeaderHighlightPlugin = HeaderHighlightPlugin;
101162
101229
  exports.HighlightHeaderWhenSelectCellPlugin = HighlightHeaderWhenSelectCellPlugin;
101163
101230
  exports.InvertHighlightPlugin = InvertHighlightPlugin;
101231
+ exports.PasteAddRowColumnPlugin = PasteAddRowColumnPlugin;
101164
101232
  exports.RotateTablePlugin = RotateTablePlugin;
101165
101233
  exports.RowSeriesPlugin = RowSeriesPlugin;
101166
101234
  exports.TableCarouselAnimationPlugin = TableCarouselAnimationPlugin;