export-table-plugin-typescript 1.0.17 → 1.0.19
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/ExportTS.d.ts.map +1 -1
- package/dist/ExportTS.js +9 -6
- package/package.json +1 -1
- package/src/ExportTS.ts +9 -6
package/dist/ExportTS.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExportTS.d.ts","sourceRoot":"","sources":["../src/ExportTS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAmF,MAAM,kBAAkB,CAAA;AAGnL,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"ExportTS.d.ts","sourceRoot":"","sources":["../src/ExportTS.ts"],"names":[],"mappings":"AAEA,OAAO,EAAO,iBAAiB,EAA+B,UAAU,EAAmF,MAAM,kBAAkB,CAAA;AAGnL,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CA2OpE;AAED,qBAAa,cAAe,SAAQ,UAAU;IAC7C,IAAI,SAAe;IACnB,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAQpC"}
|
package/dist/ExportTS.js
CHANGED
|
@@ -33,7 +33,8 @@ const fs = __importStar(require("fs-extra"));
|
|
|
33
33
|
function export_stuff(paras) {
|
|
34
34
|
var _a;
|
|
35
35
|
let { datas, fields, name, objects, tables, table, } = paras;
|
|
36
|
-
let
|
|
36
|
+
let ClassName = (0, export_table_lib_1.makeFirstLetterUpper)(name);
|
|
37
|
+
let RowClass = ClassName + "Row";
|
|
37
38
|
let initFunc = name + "Init";
|
|
38
39
|
let mapfield = fields.find(a => a.type == "key"); //如果是map,则生成对应的map
|
|
39
40
|
let mapName = name + "Map";
|
|
@@ -222,13 +223,15 @@ ${(0, export_table_lib_1.iff)(f.type == "fk[]", () => `
|
|
|
222
223
|
`)}
|
|
223
224
|
}
|
|
224
225
|
|
|
225
|
-
export class ${
|
|
226
|
-
public static readonly I = new ${
|
|
226
|
+
export class ${ClassName} {
|
|
227
|
+
public static readonly I = new ${ClassName}();
|
|
227
228
|
|
|
228
|
-
readonly Configs: ${RowClass}
|
|
229
|
+
readonly Configs: ${RowClass}[] = [];
|
|
229
230
|
|
|
230
231
|
protected LoadDefaultConfigs() {
|
|
231
232
|
|
|
233
|
+
let configs = this.Configs
|
|
234
|
+
|
|
232
235
|
let rowData:any[]=
|
|
233
236
|
[
|
|
234
237
|
${(0, export_table_lib_1.foreach)(datas, d => `
|
|
@@ -256,7 +259,7 @@ export class ${RowClass} {
|
|
|
256
259
|
`)}
|
|
257
260
|
|
|
258
261
|
for(let r of tableData){
|
|
259
|
-
|
|
262
|
+
configs.push(r);
|
|
260
263
|
${(0, export_table_lib_1.iff)(mapfield, () => `
|
|
261
264
|
(${mapName} as any)[r.${mapfield.name}] = r;
|
|
262
265
|
`)}
|
|
@@ -266,7 +269,7 @@ export class ${RowClass} {
|
|
|
266
269
|
|
|
267
270
|
}
|
|
268
271
|
|
|
269
|
-
${
|
|
272
|
+
${ClassName}.I['LoadDefaultConfigs']()
|
|
270
273
|
|
|
271
274
|
`;
|
|
272
275
|
return temp;
|
package/package.json
CHANGED
package/src/ExportTS.ts
CHANGED
|
@@ -13,7 +13,8 @@ export function export_stuff(paras: HandleSheetParams): string | null {
|
|
|
13
13
|
table,
|
|
14
14
|
} = paras;
|
|
15
15
|
|
|
16
|
-
let
|
|
16
|
+
let ClassName = makeFirstLetterUpper(name)
|
|
17
|
+
let RowClass = ClassName + "Row"
|
|
17
18
|
let initFunc = name + "Init"
|
|
18
19
|
let mapfield = fields.find(a => a.type == "key")//如果是map,则生成对应的map
|
|
19
20
|
let mapName = name + "Map"
|
|
@@ -186,13 +187,15 @@ ${iff(f.type == "fk[]", () => `
|
|
|
186
187
|
`)}
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
export class ${
|
|
190
|
-
public static readonly I = new ${
|
|
190
|
+
export class ${ClassName} {
|
|
191
|
+
public static readonly I = new ${ClassName}();
|
|
191
192
|
|
|
192
|
-
readonly Configs: ${RowClass}
|
|
193
|
+
readonly Configs: ${RowClass}[] = [];
|
|
193
194
|
|
|
194
195
|
protected LoadDefaultConfigs() {
|
|
195
196
|
|
|
197
|
+
let configs = this.Configs
|
|
198
|
+
|
|
196
199
|
let rowData:any[]=
|
|
197
200
|
[
|
|
198
201
|
${foreach(datas, d => `
|
|
@@ -220,7 +223,7 @@ export class ${RowClass} {
|
|
|
220
223
|
`)}
|
|
221
224
|
|
|
222
225
|
for(let r of tableData){
|
|
223
|
-
|
|
226
|
+
configs.push(r);
|
|
224
227
|
${iff(mapfield, () => `
|
|
225
228
|
(${mapName} as any)[r.${mapfield!.name}] = r;
|
|
226
229
|
`)}
|
|
@@ -230,7 +233,7 @@ export class ${RowClass} {
|
|
|
230
233
|
|
|
231
234
|
}
|
|
232
235
|
|
|
233
|
-
${
|
|
236
|
+
${ClassName}.I['LoadDefaultConfigs']()
|
|
234
237
|
|
|
235
238
|
`
|
|
236
239
|
return temp
|