export-table-pulgin-csharp 1.0.12 → 1.0.13
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.
- package/package.json +6 -1
- package/src/index.ts +4 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "export-table-pulgin-csharp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,6 +15,11 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@types/node": "^17.0.18",
|
|
17
17
|
"fs": "^0.0.1-security",
|
|
18
|
+
"fs-extra": "^10.0.0",
|
|
19
|
+
"fse": "^4.0.1",
|
|
18
20
|
"windy-quicktable": "^1.3.34"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/fs-extra": "^9.0.13"
|
|
19
24
|
}
|
|
20
25
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { cmm, HandleSheetParams, Field, foreach, IPlugin, st, PluginBase, HandleBatchParams } from "windy-quicktable"
|
|
3
|
-
import * as fs from "fs"
|
|
3
|
+
import * as fs from "fs-extra"
|
|
4
4
|
|
|
5
5
|
export function export_stuff(paras: HandleSheetParams): string | null {
|
|
6
6
|
let {
|
|
@@ -91,12 +91,12 @@ export function export_stuff(paras: HandleSheetParams): string | null {
|
|
|
91
91
|
let values = value as number[]
|
|
92
92
|
return `new int[]{${values.join(", ")}}`
|
|
93
93
|
} else if (t == "any") {
|
|
94
|
-
throw new Error(
|
|
94
|
+
throw new Error(`invalid type ${f.name}:<any>`)
|
|
95
95
|
} else if (t == "key") {
|
|
96
96
|
return `${value}`
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
throw new Error(
|
|
99
|
+
throw new Error(`invalid type ${f.name}:<unkown>`)
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
const getTitle = (v: Field) => {
|
|
@@ -172,13 +172,10 @@ export class ExportPlugin extends PluginBase {
|
|
|
172
172
|
handleSheet(paras: HandleSheetParams) {
|
|
173
173
|
let content = export_stuff(paras)
|
|
174
174
|
if (content != null) {
|
|
175
|
-
fs.
|
|
175
|
+
fs.outputFileSync(paras.outFilePath.fullPath, content, "utf-8")
|
|
176
176
|
}
|
|
177
177
|
return content
|
|
178
178
|
}
|
|
179
|
-
handleBatch(paras: HandleBatchParams): void {
|
|
180
|
-
console.log("lkwej:", paras.workbookManager.dataTables.length)
|
|
181
|
-
}
|
|
182
179
|
}
|
|
183
180
|
|
|
184
181
|
export const ExportPlugins = [
|