export-table-pulgin-csharp 1.1.91 → 1.1.93

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ExportCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAAE,KAAK,EAAwB,UAAU,EAA0B,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGrI,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CAWpE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CA0CjE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CA0D5E;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAmSpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
1
+ {"version":3,"file":"ExportCSPlugin.d.ts","sourceRoot":"","sources":["../src/ExportCSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAAE,KAAK,EAAwB,UAAU,EAA0B,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAGrI,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CAWpE;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,GAAG,CA0CjE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CA0D5E;AAID,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,GAAG,IAAI,CAkTpE;AAED,qBAAa,YAAa,SAAQ,UAAU;IAC3C,IAAI,SAAW;IACf,IAAI,EAAE,MAAM,EAAE,CAAS;IAEvB,WAAW,CAAC,KAAK,EAAE,iBAAiB;CAOpC"}
@@ -276,6 +276,21 @@ function export_stuff(paras) {
276
276
  const getDescripts = (v) => {
277
277
  return v.describe.split("\n");
278
278
  };
279
+ const convTupleArrayType = (f) => {
280
+ let line0 = f.rawType.replaceAll(/(?<=[^\w])(number)(?=[^\w]|$)/g, "double").replaceAll(/(?<=[^\w])(boolean)(?=[^\w]|$)/g, "bool");
281
+ console.log(line0);
282
+ let m = line0.match(/\@\((\w+),(\w+)\)(\[\])?/);
283
+ if (m != null) {
284
+ let type1 = m[1];
285
+ let type2 = m[2];
286
+ let isArray = m[3] != null;
287
+ let line = `public Tuple<${type1}, ${type2}>${isArray ? "[]" : ""} ${convMemberName(f.name)}Obj;`;
288
+ return line;
289
+ }
290
+ else {
291
+ return `public ${line0} ${convMemberName(f.name)}Obj;`;
292
+ }
293
+ };
279
294
  let temp = `
280
295
  using System.Collections.Generic;
281
296
  using System.Linq;
@@ -321,7 +336,7 @@ ${(0, export_table_lib_1.iff)(f.rawType.startsWith("@"), () => `
321
336
  /// <summary>
322
337
  ${(0, export_table_lib_1.foreach)(getDescripts(f), line => ` /// ${line}`)}
323
338
  /// </summary>
324
- public ${f.rawType.substring(1).replaceAll(/(?<=[^\w])(number)(?=[^\w]|$)/g, "double").replaceAll(/(?<=[^\w])(boolean)(?=[^\w]|$)/g, "bool")} ${convMemberName(f.name)}Obj;`)}`)}
339
+ ${convTupleArrayType(f)}`)}`)}
325
340
 
326
341
  ${(0, export_table_lib_1.cmm)( /**生成get字段 */)}
327
342
  #region get字段
@@ -82,7 +82,7 @@ function exportUJson(paras) {
82
82
  if (objs.length > 1) {
83
83
  console.log(`配置错误,过多的条目数量: ${content}`);
84
84
  }
85
- newObj[newKey + "Obj"] = objs[0] ?? null;
85
+ newObj[newKey + "Obj"] = objs[0] ?? {};
86
86
  }
87
87
  }
88
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "export-table-pulgin-csharp",
3
- "version": "1.1.91",
3
+ "version": "1.1.93",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -221,6 +221,21 @@ export function export_stuff(paras: HandleSheetParams): string | null {
221
221
  return v.describe.split("\n")
222
222
  }
223
223
 
224
+ const convTupleArrayType = (f: Field) => {
225
+ let line0 = f.rawType.replaceAll(/(?<=[^\w])(number)(?=[^\w]|$)/g, "double").replaceAll(/(?<=[^\w])(boolean)(?=[^\w]|$)/g, "bool");
226
+ console.log(line0)
227
+ let m = line0.match(/\@\((\w+),(\w+)\)(\[\])?/)
228
+ if (m != null) {
229
+ let type1 = m[1]
230
+ let type2 = m[2]
231
+ let isArray = m[3] != null
232
+ let line = `public Tuple<${type1}, ${type2}>${isArray ? "[]" : ""} ${convMemberName(f.name)}Obj;`
233
+ return line;
234
+ } else {
235
+ return `public ${line0} ${convMemberName(f.name)}Obj;`
236
+ }
237
+ }
238
+
224
239
  let temp = `
225
240
  using System.Collections.Generic;
226
241
  using System.Linq;
@@ -276,7 +291,7 @@ ${foreach(getDescripts(f), line =>
276
291
  ` /// ${line}`
277
292
  )}
278
293
  /// </summary>
279
- public ${f.rawType.substring(1).replaceAll(/(?<=[^\w])(number)(?=[^\w]|$)/g, "double").replaceAll(/(?<=[^\w])(boolean)(?=[^\w]|$)/g, "bool")} ${convMemberName(f.name)}Obj;`)}`
294
+ ${convTupleArrayType(f)}`)}`
280
295
  )}
281
296
 
282
297
  ${cmm(/**生成get字段 */)}
@@ -67,7 +67,7 @@ export function exportUJson(paras: HandleSheetParams): string | null {
67
67
  if (objs.length > 1) {
68
68
  console.log(`配置错误,过多的条目数量: ${content}`)
69
69
  }
70
- newObj[newKey + "Obj"] = objs[0] ?? null
70
+ newObj[newKey + "Obj"] = objs[0] ?? {}
71
71
  }
72
72
  }
73
73
  }