export-table-pulgin-csharp 1.0.2 → 1.0.3
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/dist/index.d.ts +1 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -20
- package/package.json +6 -2
- package/src/index.ts +1 -23
package/dist/index.d.ts
CHANGED
|
@@ -1,20 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { IPlugin } from "windy-quicktable/dist/iplugin/IPlugin";
|
|
3
|
-
export declare function cmm(a?: string): string;
|
|
4
|
-
export declare function st(f: (a?: any) => string): string;
|
|
5
|
-
export declare function foreach<T>(ls: T[], f: (e: T) => string): string;
|
|
6
|
-
export declare type ExportParams = {
|
|
7
|
-
name: string;
|
|
8
|
-
tables: DataTable[];
|
|
9
|
-
fields: Field[];
|
|
10
|
-
datas: any[][];
|
|
11
|
-
objects: any[];
|
|
12
|
-
xxtea: (str: string, key: string, deflate: boolean) => string;
|
|
13
|
-
inject: {
|
|
14
|
-
[key: string]: boolean;
|
|
15
|
-
};
|
|
16
|
-
packagename: string | undefined;
|
|
17
|
-
};
|
|
1
|
+
import { ExportParams, IPlugin } from "windy-quicktable";
|
|
18
2
|
export declare function export_stuff(paras: ExportParams): string | null;
|
|
19
3
|
export declare class ExportPlugin implements IPlugin {
|
|
20
4
|
cs(paras: ExportParams): string | null;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,YAAY,EAAkB,OAAO,EAAM,MAAM,kBAAkB,CAAA;AAEjF,wBAAgB,YAAY,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI,CA+J/D;AAED,qBAAa,YAAa,YAAW,OAAO;IAC3C,EAAE,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,GAAG,IAAI;CAGtC"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ExportPlugin = exports.export_stuff =
|
|
4
|
-
|
|
5
|
-
exports.cmm = cmm;
|
|
6
|
-
function st(f) {
|
|
7
|
-
return f();
|
|
8
|
-
}
|
|
9
|
-
exports.st = st;
|
|
10
|
-
function foreach(ls, f) {
|
|
11
|
-
return ls.map(e => f(e)).join("\n");
|
|
12
|
-
}
|
|
13
|
-
exports.foreach = foreach;
|
|
3
|
+
exports.ExportPlugin = exports.export_stuff = void 0;
|
|
4
|
+
const windy_quicktable_1 = require("windy-quicktable");
|
|
14
5
|
function export_stuff(paras) {
|
|
15
6
|
let { datas, fields, inject, name, objects, packagename, tables, xxtea, } = paras;
|
|
16
7
|
let firstLetterUpper = function (str) {
|
|
@@ -129,18 +120,18 @@ public class ${RowClass} {
|
|
|
129
120
|
|
|
130
121
|
public static List<${RowClass}> Configs = new List<${RowClass}>()
|
|
131
122
|
{
|
|
132
|
-
${foreach(datas, data => ` new ${RowClass}(${st(() => fields.map((f, index) => genValue(data[index], f.type)).join(", "))}),`)}
|
|
123
|
+
${(0, windy_quicktable_1.foreach)(datas, data => ` new ${RowClass}(${(0, windy_quicktable_1.st)(() => fields.map((f, index) => genValue(data[index], f.type)).join(", "))}),`)}
|
|
133
124
|
};
|
|
134
125
|
|
|
135
126
|
public ${RowClass}() { }
|
|
136
|
-
public ${RowClass}(${st(() => fields.map(f => `${getFieldType(f.type)} ${convVarName(f.name)}`).join(", "))})
|
|
127
|
+
public ${RowClass}(${(0, windy_quicktable_1.st)(() => fields.map(f => `${getFieldType(f.type)} ${convVarName(f.name)}`).join(", "))})
|
|
137
128
|
{
|
|
138
|
-
${foreach(fields, f => ` this.${convMemberName(f.name)} = ${convVarName(f.name)};`)}
|
|
129
|
+
${(0, windy_quicktable_1.foreach)(fields, f => ` this.${convMemberName(f.name)} = ${convVarName(f.name)};`)}
|
|
139
130
|
}
|
|
140
131
|
|
|
141
132
|
public virtual ${RowClass} MergeFrom(${RowClass} source)
|
|
142
133
|
{
|
|
143
|
-
${foreach(fields, f => ` this.${convMemberName(f.name)} = source.${convMemberName(f.name)};`)}
|
|
134
|
+
${(0, windy_quicktable_1.foreach)(fields, f => ` this.${convMemberName(f.name)} = source.${convMemberName(f.name)};`)}
|
|
144
135
|
return this;
|
|
145
136
|
}
|
|
146
137
|
|
|
@@ -151,16 +142,16 @@ ${foreach(fields, f => ` this.${convMemberName(f.name)} = source.${convMemberNa
|
|
|
151
142
|
return config;
|
|
152
143
|
}
|
|
153
144
|
|
|
154
|
-
${cmm( /**生成字段 */)}
|
|
155
|
-
${foreach(fields, f => `
|
|
145
|
+
${(0, windy_quicktable_1.cmm)( /**生成字段 */)}
|
|
146
|
+
${(0, windy_quicktable_1.foreach)(fields, f => `
|
|
156
147
|
/// <summary>
|
|
157
|
-
${foreach(getDescripts(f), line => ` /// ${line}`)}
|
|
148
|
+
${(0, windy_quicktable_1.foreach)(getDescripts(f), line => ` /// ${line}`)}
|
|
158
149
|
/// </summary>
|
|
159
150
|
public ${getFieldType(f.type)} ${convMemberName(f.name)};`)}
|
|
160
151
|
|
|
161
|
-
${cmm( /**生成get字段 */)}
|
|
152
|
+
${(0, windy_quicktable_1.cmm)( /**生成get字段 */)}
|
|
162
153
|
#region get字段
|
|
163
|
-
${foreach(fields, f => ` public ${getFieldType(f.type)} ${getTitle(f).replace(" ", "_")} => ${convMemberName(f.name)};`)}
|
|
154
|
+
${(0, windy_quicktable_1.foreach)(fields, f => ` public ${getFieldType(f.type)} ${getTitle(f).replace(" ", "_")} => ${convMemberName(f.name)};`)}
|
|
164
155
|
#endregion
|
|
165
156
|
}
|
|
166
157
|
`;
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "export-table-pulgin-csharp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/windyuuy/export-table-pulgin-csharp.git"
|
|
12
|
+
},
|
|
9
13
|
"author": "windyuuy",
|
|
10
14
|
"license": "ISC",
|
|
11
15
|
"dependencies": {
|
|
12
|
-
"windy-quicktable": "^1.3.
|
|
16
|
+
"windy-quicktable": "^1.3.34"
|
|
13
17
|
}
|
|
14
18
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import
|
|
3
|
-
import { IPlugin } from "windy-quicktable/dist/iplugin/IPlugin"
|
|
4
|
-
|
|
5
|
-
export function cmm(a?: string) { return "" }
|
|
6
|
-
export function st(f: (a?: any) => string) {
|
|
7
|
-
return f()
|
|
8
|
-
}
|
|
9
|
-
export function foreach<T>(ls: T[], f: (e: T) => string) {
|
|
10
|
-
return ls.map(e => f(e)).join("\n")
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type ExportParams = {
|
|
14
|
-
name: string
|
|
15
|
-
tables: DataTable[]
|
|
16
|
-
fields: Field[]
|
|
17
|
-
datas: any[][]
|
|
18
|
-
objects: any[]
|
|
19
|
-
xxtea: (str: string, key: string, deflate: boolean) => string
|
|
20
|
-
inject: {
|
|
21
|
-
[key: string]: boolean;
|
|
22
|
-
}
|
|
23
|
-
packagename: string | undefined
|
|
24
|
-
}
|
|
2
|
+
import { cmm, ExportParams, Field, foreach, IPlugin, st } from "windy-quicktable"
|
|
25
3
|
|
|
26
4
|
export function export_stuff(paras: ExportParams): string | null {
|
|
27
5
|
let {
|