@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.
@@ -102,4 +102,5 @@ export const generateAutoFillData = (originalData, columns, startRange, currentE
102
102
  }
103
103
  }
104
104
  return Array.isArray(null == originalData ? void 0 : originalData[0]) ? newData : translateRowArrayToObj(newData, columns);
105
- };
105
+ };
106
+ //# sourceMappingURL=autoFillHandle.js.map
package/es/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/es/index.js CHANGED
@@ -24,6 +24,8 @@ export * from "./rotate-table";
24
24
 
25
25
  export * from "./gantt-export-image";
26
26
 
27
+ export * from "./paste-add-row-column";
28
+
27
29
  export * from "./wps-fill-handle";
28
30
 
29
31
  export * from "./excel-import";
package/es/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC","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,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,qCAAqC,CAAC;AACpD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC","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,31 @@
1
+ import * as VTable from "@visactor/vtable";
2
+
3
+ export class PasteAddRowColumnPlugin {
4
+ constructor(pluginOptions) {
5
+ 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 ],
6
+ this.pluginOptions = pluginOptions;
7
+ }
8
+ run(...args) {
9
+ const runtime = args[1], table = args[2];
10
+ this.table = table, runtime === VTable.TABLE_EVENT_TYPE.PASTED_DATA && (this.pastedData = args[0],
11
+ this.handlePaste());
12
+ }
13
+ handlePaste() {
14
+ var _a, _b, _c;
15
+ 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;
16
+ 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([]);
17
+ if (colsNeeded > 0) for (let i = 0; i < colsNeeded; i++) {
18
+ const newColIndex = colCount + i;
19
+ (null === (_c = this.pluginOptions) || void 0 === _c ? void 0 : _c.addColumnCallback) ? this.pluginOptions.addColumnCallback(newColIndex, this.table) : this.table.addColumn({
20
+ field: `field_${newColIndex}`,
21
+ title: `New Column ${newColIndex}`,
22
+ width: 100
23
+ });
24
+ }
25
+ this.table.changeCellValues(col, row, pasteData, !0);
26
+ }
27
+ release() {
28
+ this.table.internalProps.handler.clear();
29
+ }
30
+ }
31
+ //# sourceMappingURL=paste-add-row-column.js.map
@@ -0,0 +1 @@
1
+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C;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","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"]}
@@ -65,5 +65,4 @@ export class WpsFillHandlePlugin {
65
65
 
66
66
  function deleteSelectRange(selectCells, tableInstance) {
67
67
  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, "");
68
- }
69
- //# sourceMappingURL=wps-fill-handle.js.map
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visactor/vtable-plugins",
3
- "version": "1.19.4-alpha.1",
3
+ "version": "1.19.4",
4
4
  "description": "The search util of VTable",
5
5
  "author": {
6
6
  "name": "VisActor",
@@ -36,13 +36,10 @@
36
36
  "exceljs": "4.4.0"
37
37
  },
38
38
  "peerDependencies": {
39
- "@visactor/vtable": "1.19.4-alpha.1"
39
+ "@visactor/vtable": "1.19.4"
40
40
  },
41
41
  "devDependencies": {
42
- "@visactor/vtable": "1.19.4-alpha.1",
43
- "@visactor/vtable-editors": "1.19.4-alpha.1",
44
- "@visactor/vtable-gantt": "1.19.4-alpha.1",
45
- "@visactor/vchart": "2.0.0-alpha.1",
42
+ "@visactor/vchart": "2.0.2",
46
43
  "@rushstack/eslint-patch": "~1.1.4",
47
44
  "react": "^18.0.0",
48
45
  "react-dom": "^18.0.0",
@@ -84,9 +81,12 @@
84
81
  "@types/react-is": "^17.0.3",
85
82
  "rollup-plugin-node-resolve": "5.2.0",
86
83
  "@types/lodash": "4.14.182",
84
+ "@visactor/vtable": "1.19.4",
85
+ "@visactor/vtable-gantt": "1.19.4",
86
+ "@visactor/vtable-editors": "1.19.4",
87
87
  "@internal/bundler": "0.0.1",
88
- "@internal/eslint-config": "0.0.1",
89
- "@internal/ts-config": "0.0.1"
88
+ "@internal/ts-config": "0.0.1",
89
+ "@internal/eslint-config": "0.0.1"
90
90
  },
91
91
  "scripts": {
92
92
  "demo": "vite ./demo",