@visactor/vtable-plugins 1.19.5 → 1.19.7

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.
Files changed (85) hide show
  1. package/cjs/index.d.ts +1 -0
  2. package/cjs/index.js +2 -1
  3. package/cjs/index.js.map +1 -1
  4. package/cjs/table-export/csv/index.d.ts +12 -0
  5. package/cjs/table-export/csv/index.js +54 -0
  6. package/cjs/table-export/csv/index.js.map +1 -0
  7. package/cjs/table-export/excel/index.d.ts +21 -0
  8. package/cjs/table-export/excel/index.js +243 -0
  9. package/cjs/table-export/excel/index.js.map +1 -0
  10. package/cjs/table-export/excel/style.d.ts +6 -0
  11. package/cjs/table-export/excel/style.js +89 -0
  12. package/cjs/table-export/excel/style.js.map +1 -0
  13. package/cjs/table-export/index.d.ts +7 -0
  14. package/cjs/table-export/index.js +38 -0
  15. package/cjs/table-export/index.js.map +1 -0
  16. package/cjs/table-export/util/color.d.ts +152 -0
  17. package/cjs/table-export/util/color.js +197 -0
  18. package/cjs/table-export/util/color.js.map +1 -0
  19. package/cjs/table-export/util/download.d.ts +2 -0
  20. package/cjs/table-export/util/download.js +60 -0
  21. package/cjs/table-export/util/download.js.map +1 -0
  22. package/cjs/table-export/util/encode.d.ts +3 -0
  23. package/cjs/table-export/util/encode.js +17 -0
  24. package/cjs/table-export/util/encode.js.map +1 -0
  25. package/cjs/table-export/util/indent.d.ts +2 -0
  26. package/cjs/table-export/util/indent.js +27 -0
  27. package/cjs/table-export/util/indent.js.map +1 -0
  28. package/cjs/table-export/util/pagination.d.ts +5 -0
  29. package/cjs/table-export/util/pagination.js +24 -0
  30. package/cjs/table-export/util/pagination.js.map +1 -0
  31. package/cjs/table-export/util/promise.d.ts +1 -0
  32. package/cjs/table-export/util/promise.js +10 -0
  33. package/cjs/table-export/util/promise.js.map +1 -0
  34. package/cjs/table-export/util/type.d.ts +6 -0
  35. package/cjs/table-export/util/type.js +6 -0
  36. package/cjs/table-export/util/type.js.map +1 -0
  37. package/cjs/table-export.d.ts +17 -0
  38. package/cjs/table-export.js +93 -0
  39. package/cjs/table-export.js.map +1 -0
  40. package/cjs/types.js +1 -2
  41. package/cjs/wps-fill-handle.js +1 -0
  42. package/dist/vtable-plugins.js +1179 -185
  43. package/dist/vtable-plugins.min.js +14 -14
  44. package/es/index.d.ts +1 -0
  45. package/es/index.js +2 -0
  46. package/es/index.js.map +1 -1
  47. package/es/table-export/csv/index.d.ts +12 -0
  48. package/es/table-export/csv/index.js +47 -0
  49. package/es/table-export/csv/index.js.map +1 -0
  50. package/es/table-export/excel/index.d.ts +21 -0
  51. package/es/table-export/excel/index.js +242 -0
  52. package/es/table-export/excel/index.js.map +1 -0
  53. package/es/table-export/excel/style.d.ts +6 -0
  54. package/es/table-export/excel/style.js +80 -0
  55. package/es/table-export/excel/style.js.map +1 -0
  56. package/es/table-export/index.d.ts +7 -0
  57. package/es/table-export/index.js +8 -0
  58. package/es/table-export/index.js.map +1 -0
  59. package/es/table-export/util/color.d.ts +152 -0
  60. package/es/table-export/util/color.js +189 -0
  61. package/es/table-export/util/color.js.map +1 -0
  62. package/es/table-export/util/download.d.ts +2 -0
  63. package/es/table-export/util/download.js +52 -0
  64. package/es/table-export/util/download.js.map +1 -0
  65. package/es/table-export/util/encode.d.ts +3 -0
  66. package/es/table-export/util/encode.js +10 -0
  67. package/es/table-export/util/encode.js.map +1 -0
  68. package/es/table-export/util/indent.d.ts +2 -0
  69. package/es/table-export/util/indent.js +19 -0
  70. package/es/table-export/util/indent.js.map +1 -0
  71. package/es/table-export/util/pagination.d.ts +5 -0
  72. package/es/table-export/util/pagination.js +16 -0
  73. package/es/table-export/util/pagination.js.map +1 -0
  74. package/es/table-export/util/promise.d.ts +1 -0
  75. package/es/table-export/util/promise.js +4 -0
  76. package/es/table-export/util/promise.js.map +1 -0
  77. package/es/table-export/util/type.d.ts +6 -0
  78. package/es/table-export/util/type.js +2 -0
  79. package/es/table-export/util/type.js.map +1 -0
  80. package/es/table-export.d.ts +17 -0
  81. package/es/table-export.js +62 -0
  82. package/es/table-export.js.map +1 -0
  83. package/es/types.js +1 -2
  84. package/es/wps-fill-handle.js +2 -1
  85. package/package.json +10 -8
@@ -0,0 +1,93 @@
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
+ }, __awaiter = this && this.__awaiter || function(thisArg, _arguments, P, generator) {
27
+ return new (P || (P = Promise))((function(resolve, reject) {
28
+ function fulfilled(value) {
29
+ try {
30
+ step(generator.next(value));
31
+ } catch (e) {
32
+ reject(e);
33
+ }
34
+ }
35
+ function rejected(value) {
36
+ try {
37
+ step(generator.throw(value));
38
+ } catch (e) {
39
+ reject(e);
40
+ }
41
+ }
42
+ function step(result) {
43
+ var value;
44
+ result.done ? resolve(result.value) : (value = result.value, value instanceof P ? value : new P((function(resolve) {
45
+ resolve(value);
46
+ }))).then(fulfilled, rejected);
47
+ }
48
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
49
+ }));
50
+ };
51
+
52
+ Object.defineProperty(exports, "__esModule", {
53
+ value: !0
54
+ }), exports.TableExportPlugin = void 0;
55
+
56
+ const VTable = __importStar(require("@visactor/vtable")), index_1 = require("./table-export/index");
57
+
58
+ class TableExportPlugin {
59
+ constructor(pluginOptions) {
60
+ this.id = "table-export-plugin", this.name = "TableExport", this.runTime = [ VTable.TABLE_EVENT_TYPE.INITIALIZED ],
61
+ this.pluginOptions = Object.assign({
62
+ exportOnIdle: !1,
63
+ exportExcelOptions: {
64
+ downloadFile: !0,
65
+ fileName: "export"
66
+ },
67
+ exportCsvOptions: {
68
+ downloadFile: !0,
69
+ fileName: "export"
70
+ }
71
+ }, pluginOptions);
72
+ }
73
+ run(...args) {
74
+ if (args[1] === VTable.TABLE_EVENT_TYPE.INITIALIZED) {
75
+ args[0];
76
+ this.table = args[2], this.table.exportToCsv = () => {
77
+ const options = this.pluginOptions.exportCsvOptions;
78
+ return options.downloadFile ? (0, index_1.downloadCsv)((0, index_1.exportVTableToCsv)(this.table, options), options.fileName || "export") : (0,
79
+ index_1.exportVTableToCsv)(this.table, options);
80
+ }, this.table.exportToExcel = () => __awaiter(this, void 0, void 0, (function*() {
81
+ const options = this.pluginOptions.exportExcelOptions;
82
+ return options.downloadFile ? yield (0, index_1.downloadExcel)(yield (0, index_1.exportVTableToExcel)(this.table, options, this.pluginOptions.exportOnIdle), options.fileName || "export") : (0,
83
+ index_1.exportVTableToExcel)(this.table, options, this.pluginOptions.exportOnIdle);
84
+ }));
85
+ }
86
+ }
87
+ release() {
88
+ this.table && (delete this.table.exportToCsv, delete this.table.exportToExcel, this.table = null);
89
+ }
90
+ }
91
+
92
+ exports.TableExportPlugin = TableExportPlugin;
93
+ //# sourceMappingURL=table-export.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["table-export.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAE3C,gDAA0G;AAoB1G,MAAa,iBAAiB;IAM5B,YAAY,aAAuC;QALnD,OAAE,GAAG,q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Aa,EACxB,CAAC,MAAM,IAAA,2BAAmB,EAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAgB,EAChG,OAAO,CAAC,QAAQ,IAAI,QAAQ,CAC7B,CAAC;iBACH;gBACD,OAAO,IAAA,2BAAmB,EAAC,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YACnF,CAAC,CAAA,CAAC;SACH;IACH,CAAC;IAMD,OAAO;QACL,IAAI,IAAI,CAAC,KAAK,EAAE;YACd,OAAQ,IAAI,CAAC,KAAa,CAAC,WAAW,CAAC;YACvC,OAAQ,IAAI,CAAC,KAAa,CAAC,aAAa,CAAC;YACzC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;SACnB;IACH,CAAC;CACF;AA1DD,8CA0DC","file":"table-export.js","sourcesContent":["import * as VTable from '@visactor/vtable';\nimport type { ExportVTableToCsvOptions, ExportVTableToExcelOptions } from './table-export/index';\nimport { exportVTableToCsv, exportVTableToExcel, downloadCsv, downloadExcel } from './table-export/index';\n\n// // 扩展ListTable接口以包含导出方法\n// declare module '@visactor/vtable' {\n// interface ListTableAll {\n// exportToCsv: (options?: any) => void;\n// exportToExcel: (options?: any) => void;\n// }\n// }\n\nexport type TableExportPluginOptions = {\n exportExcelOptions?: ExportVTableToExcelOptions;\n exportCsvOptions?: ExportVTableToCsvOptions;\n exportOnIdle?: boolean; //是否空闲时导出下载,默认false\n};\n\n/**\n * 表格导出插件\n * 提供CSV和Excel格式的表格数据导出功能\n */\nexport class TableExportPlugin implements VTable.plugins.IVTablePlugin {\n id = 'table-export-plugin';\n name = 'TableExport';\n runTime: any[] = [VTable.TABLE_EVENT_TYPE.INITIALIZED];\n private table: VTable.ListTable;\n private pluginOptions: TableExportPluginOptions;\n constructor(pluginOptions: TableExportPluginOptions) {\n this.pluginOptions = Object.assign(\n {\n exportOnIdle: false,\n exportExcelOptions: { downloadFile: true, fileName: 'export' },\n exportCsvOptions: { downloadFile: true, fileName: 'export' }\n },\n pluginOptions\n );\n }\n /**\n * 插件初始化方法\n * @param tableInstance - 表格实例\n */\n run(...args: any[]) {\n // const eventArgs = args[0];\n const runTime = args[1];\n if (runTime === VTable.TABLE_EVENT_TYPE.INITIALIZED) {\n const eventArgs = args[0];\n this.table = args[2];\n // 挂载导出方法到表格实例\n (this.table as any).exportToCsv = () => {\n const options = this.pluginOptions.exportCsvOptions;\n if (options.downloadFile) {\n return downloadCsv(exportVTableToCsv(this.table, options), options.fileName || 'export');\n }\n return exportVTableToCsv(this.table, options);\n };\n (this.table as any).exportToExcel = async () => {\n const options = this.pluginOptions.exportExcelOptions;\n if (options.downloadFile) {\n return await downloadExcel(\n (await exportVTableToExcel(this.table, options, this.pluginOptions.exportOnIdle)) as ArrayBuffer,\n options.fileName || 'export'\n );\n }\n return exportVTableToExcel(this.table, options, this.pluginOptions.exportOnIdle);\n };\n }\n }\n\n /**\n * 插件销毁方法\n * 清理挂载到表格实例的方法\n */\n release() {\n if (this.table) {\n delete (this.table as any).exportToCsv;\n delete (this.table as any).exportToExcel;\n this.table = null;\n }\n }\n}\n"]}
package/cjs/types.js CHANGED
@@ -2,5 +2,4 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- });
6
- //# sourceMappingURL=types.js.map
5
+ });
@@ -96,4 +96,5 @@ 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
99
100
  exports.WpsFillHandlePlugin = WpsFillHandlePlugin;