@lcap/nasl 3.5.0-beta.3 → 3.5.0-beta.5

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 (289) hide show
  1. package/out/breakpoint/store/core.js +1 -1
  2. package/out/breakpoint/store/core.js.map +1 -1
  3. package/out/common/BaseNode.d.ts +7 -0
  4. package/out/common/BaseNode.js +15 -2
  5. package/out/common/BaseNode.js.map +1 -1
  6. package/out/concepts/AnonymousFunction__.d.ts +1 -0
  7. package/out/concepts/AnonymousFunction__.js +34 -16
  8. package/out/concepts/AnonymousFunction__.js.map +1 -1
  9. package/out/concepts/Argument__.d.ts +1 -0
  10. package/out/concepts/Argument__.js +28 -8
  11. package/out/concepts/Argument__.js.map +1 -1
  12. package/out/concepts/Assignment__.js +5 -7
  13. package/out/concepts/Assignment__.js.map +1 -1
  14. package/out/concepts/BatchAssignment__.js +5 -3
  15. package/out/concepts/BatchAssignment__.js.map +1 -1
  16. package/out/concepts/BinaryExpression__.d.ts +1 -0
  17. package/out/concepts/BinaryExpression__.js +30 -13
  18. package/out/concepts/BinaryExpression__.js.map +1 -1
  19. package/out/concepts/BindAttribute__.js +11 -3
  20. package/out/concepts/BindAttribute__.js.map +1 -1
  21. package/out/concepts/BindDirective__.js +3 -3
  22. package/out/concepts/BindDirective__.js.map +1 -1
  23. package/out/concepts/BindEvent__.js +2 -2
  24. package/out/concepts/BindEvent__.js.map +1 -1
  25. package/out/concepts/BooleanLiteral__.d.ts +1 -0
  26. package/out/concepts/BooleanLiteral__.js +6 -0
  27. package/out/concepts/BooleanLiteral__.js.map +1 -1
  28. package/out/concepts/BusinessComponent__.d.ts +4 -2
  29. package/out/concepts/BusinessComponent__.js +128 -89
  30. package/out/concepts/BusinessComponent__.js.map +1 -1
  31. package/out/concepts/CallConnector__.d.ts +1 -0
  32. package/out/concepts/CallConnector__.js +6 -0
  33. package/out/concepts/CallConnector__.js.map +1 -1
  34. package/out/concepts/CallEvent__.d.ts +4 -0
  35. package/out/concepts/CallEvent__.js +19 -2
  36. package/out/concepts/CallEvent__.js.map +1 -1
  37. package/out/concepts/CallFunction__.d.ts +1 -0
  38. package/out/concepts/CallFunction__.js +62 -8
  39. package/out/concepts/CallFunction__.js.map +1 -1
  40. package/out/concepts/CallInterface__.js +31 -22
  41. package/out/concepts/CallInterface__.js.map +1 -1
  42. package/out/concepts/CallLogic__.js +49 -38
  43. package/out/concepts/CallLogic__.js.map +1 -1
  44. package/out/concepts/CallQueryComponent__.d.ts +2 -0
  45. package/out/concepts/CallQueryComponent__.js +94 -8
  46. package/out/concepts/CallQueryComponent__.js.map +1 -1
  47. package/out/concepts/DefaultValue__.d.ts +1 -0
  48. package/out/concepts/DefaultValue__.js +7 -1
  49. package/out/concepts/DefaultValue__.js.map +1 -1
  50. package/out/concepts/Destination__.d.ts +1 -1
  51. package/out/concepts/Destination__.js +34 -22
  52. package/out/concepts/Destination__.js.map +1 -1
  53. package/out/concepts/EntityProperty__.d.ts +1 -0
  54. package/out/concepts/EntityProperty__.js +26 -2
  55. package/out/concepts/EntityProperty__.js.map +1 -1
  56. package/out/concepts/Entity__.d.ts +1 -0
  57. package/out/concepts/Entity__.js +25 -0
  58. package/out/concepts/Entity__.js.map +1 -1
  59. package/out/concepts/EnumItem__.d.ts +1 -0
  60. package/out/concepts/EnumItem__.js +12 -0
  61. package/out/concepts/EnumItem__.js.map +1 -1
  62. package/out/concepts/Enum__.d.ts +1 -0
  63. package/out/concepts/Enum__.js +16 -2
  64. package/out/concepts/Enum__.js.map +1 -1
  65. package/out/concepts/Event__.d.ts +4 -0
  66. package/out/concepts/Event__.js +12 -0
  67. package/out/concepts/Event__.js.map +1 -1
  68. package/out/concepts/ForEachStatement__.js +10 -16
  69. package/out/concepts/ForEachStatement__.js.map +1 -1
  70. package/out/concepts/FrontendType__.js +1 -0
  71. package/out/concepts/FrontendType__.js.map +1 -1
  72. package/out/concepts/Identifier__.d.ts +2 -0
  73. package/out/concepts/Identifier__.js +21 -0
  74. package/out/concepts/Identifier__.js.map +1 -1
  75. package/out/concepts/JSBlock__.js +1 -1
  76. package/out/concepts/JSBlock__.js.map +1 -1
  77. package/out/concepts/LogicItem__.d.ts +6 -0
  78. package/out/concepts/LogicItem__.js +11 -1
  79. package/out/concepts/LogicItem__.js.map +1 -1
  80. package/out/concepts/Logic__.js +24 -23
  81. package/out/concepts/Logic__.js.map +1 -1
  82. package/out/concepts/MatchCase__.js +5 -5
  83. package/out/concepts/MatchCase__.js.map +1 -1
  84. package/out/concepts/Match__.js +1 -1
  85. package/out/concepts/Match__.js.map +1 -1
  86. package/out/concepts/MemberExpression__.d.ts +1 -0
  87. package/out/concepts/MemberExpression__.js +13 -3
  88. package/out/concepts/MemberExpression__.js.map +1 -1
  89. package/out/concepts/NewComposite__.js +3 -3
  90. package/out/concepts/NewComposite__.js.map +1 -1
  91. package/out/concepts/NewList__.js +4 -4
  92. package/out/concepts/NewList__.js.map +1 -1
  93. package/out/concepts/NewMap__.d.ts +1 -1
  94. package/out/concepts/NewMap__.js +6 -5
  95. package/out/concepts/NewMap__.js.map +1 -1
  96. package/out/concepts/NullLiteral__.d.ts +2 -0
  97. package/out/concepts/NullLiteral__.js +12 -0
  98. package/out/concepts/NullLiteral__.js.map +1 -1
  99. package/out/concepts/NumericLiteral__.d.ts +1 -0
  100. package/out/concepts/NumericLiteral__.js +7 -1
  101. package/out/concepts/NumericLiteral__.js.map +1 -1
  102. package/out/concepts/OqlQueryComponent__.js +4 -2
  103. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  104. package/out/concepts/Param__.d.ts +1 -0
  105. package/out/concepts/Param__.js +41 -0
  106. package/out/concepts/Param__.js.map +1 -1
  107. package/out/concepts/ProcessElement__.js +9 -1
  108. package/out/concepts/ProcessElement__.js.map +1 -1
  109. package/out/concepts/QueryAggregateExpression__.d.ts +2 -0
  110. package/out/concepts/QueryAggregateExpression__.js +16 -0
  111. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  112. package/out/concepts/QueryFieldExpression__.d.ts +2 -0
  113. package/out/concepts/QueryFieldExpression__.js +33 -0
  114. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  115. package/out/concepts/QueryFromExpression__.d.ts +2 -0
  116. package/out/concepts/QueryFromExpression__.js +27 -0
  117. package/out/concepts/QueryFromExpression__.js.map +1 -1
  118. package/out/concepts/QueryGroupByExpression__.d.ts +2 -0
  119. package/out/concepts/QueryGroupByExpression__.js +13 -1
  120. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  121. package/out/concepts/QueryJoinExpression__.d.ts +2 -0
  122. package/out/concepts/QueryJoinExpression__.js +37 -0
  123. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  124. package/out/concepts/QueryLimitExpression__.d.ts +2 -0
  125. package/out/concepts/QueryLimitExpression__.js +16 -0
  126. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  127. package/out/concepts/QueryOrderByExpression__.d.ts +2 -0
  128. package/out/concepts/QueryOrderByExpression__.js +22 -0
  129. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  130. package/out/concepts/QuerySelectExpression__.d.ts +3 -0
  131. package/out/concepts/QuerySelectExpression__.js +41 -0
  132. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  133. package/out/concepts/SelectMembers__.d.ts +1 -0
  134. package/out/concepts/SelectMembers__.js +7 -0
  135. package/out/concepts/SelectMembers__.js.map +1 -1
  136. package/out/concepts/SqlQueryComponent__.js +4 -2
  137. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  138. package/out/concepts/StringInterpolation__.d.ts +1 -0
  139. package/out/concepts/StringInterpolation__.js +20 -2
  140. package/out/concepts/StringInterpolation__.js.map +1 -1
  141. package/out/concepts/StringLiteral__.d.ts +1 -0
  142. package/out/concepts/StringLiteral__.js +21 -1
  143. package/out/concepts/StringLiteral__.js.map +1 -1
  144. package/out/concepts/StructureProperty__.d.ts +1 -0
  145. package/out/concepts/StructureProperty__.js +19 -0
  146. package/out/concepts/StructureProperty__.js.map +1 -1
  147. package/out/concepts/Structure__.d.ts +1 -0
  148. package/out/concepts/Structure__.js +22 -7
  149. package/out/concepts/Structure__.js.map +1 -1
  150. package/out/concepts/SwitchCase__.js +1 -1
  151. package/out/concepts/SwitchCase__.js.map +1 -1
  152. package/out/concepts/TypeAnnotation__.d.ts +1 -0
  153. package/out/concepts/TypeAnnotation__.js +42 -1
  154. package/out/concepts/TypeAnnotation__.js.map +1 -1
  155. package/out/concepts/TypeParam__.d.ts +2 -1
  156. package/out/concepts/TypeParam__.js +7 -1
  157. package/out/concepts/TypeParam__.js.map +1 -1
  158. package/out/concepts/Unparsed__.js +1 -1
  159. package/out/concepts/Unparsed__.js.map +1 -1
  160. package/out/concepts/ValidationRule__.js +2 -1
  161. package/out/concepts/ValidationRule__.js.map +1 -1
  162. package/out/concepts/ViewElement__.d.ts +1 -0
  163. package/out/concepts/ViewElement__.js +72 -59
  164. package/out/concepts/ViewElement__.js.map +1 -1
  165. package/out/concepts/View__.d.ts +2 -1
  166. package/out/concepts/View__.js +6 -19
  167. package/out/concepts/View__.js.map +1 -1
  168. package/out/generator/genBundleFiles.d.ts +1 -0
  169. package/out/generator/genBundleFiles.js +4 -1
  170. package/out/generator/genBundleFiles.js.map +1 -1
  171. package/out/natural/genNaturalTS.d.ts +4 -1
  172. package/out/natural/genNaturalTS.js +38 -1
  173. package/out/natural/genNaturalTS.js.map +1 -1
  174. package/out/natural/transformTSCode.js +52 -41
  175. package/out/natural/transformTSCode.js.map +1 -1
  176. package/out/server/formatTsUtils.js +10 -9
  177. package/out/server/formatTsUtils.js.map +1 -1
  178. package/out/server/getFunctions.js +3 -3
  179. package/out/server/getFunctions.js.map +1 -1
  180. package/out/server/getProcesses.js +3 -3
  181. package/out/server/getProcesses.js.map +1 -1
  182. package/out/server/naslServer.js +52 -17
  183. package/out/server/naslServer.js.map +1 -1
  184. package/out/server/translator.js +8 -0
  185. package/out/server/translator.js.map +1 -1
  186. package/out/templator/genCurdEditMultipleKeyBlock.js +1 -1
  187. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  188. package/out/templator/genGetBlock.js +2 -1
  189. package/out/templator/genGetBlock.js.map +1 -1
  190. package/out/templator/genUpdateBlock.js +2 -1
  191. package/out/templator/genUpdateBlock.js.map +1 -1
  192. package/out/templator/utils.js +3 -3
  193. package/out/templator/utils.js.map +1 -1
  194. package/out/translator/types.d.ts +2 -0
  195. package/out/translator/utils.d.ts +2 -1
  196. package/out/translator/utils.js +44 -7
  197. package/out/translator/utils.js.map +1 -1
  198. package/out/utils/string.js +2 -2
  199. package/out/utils/string.js.map +1 -1
  200. package/out/utils/time-slicing/performance.js +3 -3
  201. package/out/utils/time-slicing/performance.js.map +1 -1
  202. package/package.json +2 -2
  203. package/src/breakpoint/store/core.ts +1 -1
  204. package/src/common/BaseNode.ts +17 -3
  205. package/src/concepts/AnonymousFunction__.ts +24 -9
  206. package/src/concepts/Argument__.ts +28 -6
  207. package/src/concepts/Assignment__.ts +5 -7
  208. package/src/concepts/BatchAssignment__.ts +6 -3
  209. package/src/concepts/BinaryExpression__.ts +30 -13
  210. package/src/concepts/BindAttribute__.ts +10 -3
  211. package/src/concepts/BindDirective__.ts +3 -3
  212. package/src/concepts/BindEvent__.ts +2 -2
  213. package/src/concepts/BooleanLiteral__.ts +5 -0
  214. package/src/concepts/BusinessComponent__.ts +144 -100
  215. package/src/concepts/CallConnector__.ts +5 -0
  216. package/src/concepts/CallEvent__.ts +20 -3
  217. package/src/concepts/CallFunction__.ts +54 -8
  218. package/src/concepts/CallInterface__.ts +31 -24
  219. package/src/concepts/CallLogic__.ts +48 -37
  220. package/src/concepts/CallQueryComponent__.ts +101 -8
  221. package/src/concepts/DefaultValue__.ts +6 -1
  222. package/src/concepts/Destination__.ts +32 -22
  223. package/src/concepts/EntityProperty__.ts +30 -2
  224. package/src/concepts/Entity__.ts +29 -0
  225. package/src/concepts/EnumItem__.ts +17 -0
  226. package/src/concepts/Enum__.ts +19 -2
  227. package/src/concepts/Event__.ts +13 -0
  228. package/src/concepts/ForEachStatement__.ts +10 -20
  229. package/src/concepts/FrontendType__.ts +1 -0
  230. package/src/concepts/Identifier__.ts +19 -0
  231. package/src/concepts/JSBlock__.ts +1 -1
  232. package/src/concepts/LogicItem__.ts +13 -1
  233. package/src/concepts/Logic__.ts +24 -24
  234. package/src/concepts/MatchCase__.ts +5 -5
  235. package/src/concepts/Match__.ts +1 -1
  236. package/src/concepts/MemberExpression__.ts +12 -3
  237. package/src/concepts/NewComposite__.ts +7 -9
  238. package/src/concepts/NewList__.ts +4 -4
  239. package/src/concepts/NewMap__.ts +6 -5
  240. package/src/concepts/NullLiteral__.ts +10 -0
  241. package/src/concepts/NumericLiteral__.ts +6 -1
  242. package/src/concepts/OqlQueryComponent__.ts +4 -2
  243. package/src/concepts/Param__.ts +39 -0
  244. package/src/concepts/ProcessElement__.ts +8 -1
  245. package/src/concepts/QueryAggregateExpression__.ts +15 -0
  246. package/src/concepts/QueryFieldExpression__.ts +34 -0
  247. package/src/concepts/QueryFromExpression__.ts +29 -0
  248. package/src/concepts/QueryGroupByExpression__.ts +11 -1
  249. package/src/concepts/QueryJoinExpression__.ts +39 -0
  250. package/src/concepts/QueryLimitExpression__.ts +14 -0
  251. package/src/concepts/QueryOrderByExpression__.ts +23 -0
  252. package/src/concepts/QuerySelectExpression__.ts +55 -0
  253. package/src/concepts/SelectMembers__.ts +7 -0
  254. package/src/concepts/SqlQueryComponent__.ts +4 -2
  255. package/src/concepts/StringInterpolation__.ts +18 -2
  256. package/src/concepts/StringLiteral__.ts +20 -1
  257. package/src/concepts/StructureProperty__.ts +22 -0
  258. package/src/concepts/Structure__.ts +24 -7
  259. package/src/concepts/SwitchCase__.ts +1 -1
  260. package/src/concepts/TypeAnnotation__.ts +37 -1
  261. package/src/concepts/TypeParam__.ts +6 -1
  262. package/src/concepts/Unparsed__.ts +1 -1
  263. package/src/concepts/ValidationRule__.ts +6 -1
  264. package/src/concepts/ViewElement__.ts +74 -58
  265. package/src/concepts/View__.ts +6 -19
  266. package/src/generator/genBundleFiles.ts +6 -1
  267. package/src/natural/genNaturalTS.ts +41 -0
  268. package/src/natural/transformTSCode.ts +50 -42
  269. package/src/server/formatTsUtils.ts +16 -11
  270. package/src/server/getFunctions.ts +3 -3
  271. package/src/server/getProcesses.ts +3 -3
  272. package/src/server/naslServer.ts +56 -18
  273. package/src/server/translator.ts +7 -0
  274. package/src/templator/genCurdEditMultipleKeyBlock.ts +1 -1
  275. package/src/templator/genGetBlock.ts +2 -1
  276. package/src/templator/genUpdateBlock.ts +2 -1
  277. package/src/templator/utils.ts +3 -3
  278. package/src/translator/types.ts +4 -0
  279. package/src/translator/utils.ts +73 -34
  280. package/src/utils/string.ts +2 -2
  281. package/src/utils/time-slicing/performance.ts +3 -3
  282. package/test/concepts/call-interface/__snapshots__/getQuickInfoOffset.spec.ts.snap +3 -3
  283. package/test/concepts/call-interface/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
  284. package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +199 -0
  285. package/test/concepts/view-element/__snapshots__/toVue.spec.ts.snap +127 -6
  286. package/test/concepts/view-element/fixtures/table-data-source-calllogic-with-server-validation.json +2074 -0
  287. package/test/concepts/view-element/toVue.spec.ts +0 -1
  288. package/ts-worker/package.json +1 -1
  289. package/ts-worker/src/index.js +1 -0
@@ -9,6 +9,9 @@ import {
9
9
  withGenerator,
10
10
  TranslatorGenerator,
11
11
  } from '../translator';
12
+
13
+ import Identifier from './Identifier__';
14
+ import StringLiteral from './StringLiteral__';
12
15
  //================================================================================
13
16
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
14
17
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -209,6 +212,26 @@ export class QueryOrderByExpression extends LogicItem {
209
212
  return code;
210
213
  }
211
214
 
215
+ @withSourceMap()
216
+ toNaturalTS(state = createCompilerState()): string {
217
+ let orderElement = this.orderElement.concept === 'Identifier' && (this.orderElement as Identifier).namespace === 'inner'
218
+ ? (this.orderElement as Identifier).name
219
+ : this.orderElement.toNaturalTS(state);
220
+ let order = this.order.toNaturalTS(state);
221
+ return `[${orderElement || '__IDENTIFIER__'}, ${order || '__IDENTIFIER__'}]`;
222
+ }
223
+
224
+ @withSourceMap()
225
+ toTextualNASL(state = createCompilerState()): string {
226
+ let orderElement = this.orderElement.concept === 'QueryOrderByExpression'
227
+ ? this.orderElement.toTextualNASL(state)
228
+ : this.orderElement.concept === 'Identifier' && (this.orderElement as Identifier).namespace === 'inner'
229
+ ? (this.orderElement as Identifier).name
230
+ : `\${${this.orderElement.toTextualNASL(state)}}`;
231
+ let order = this.order.concept === 'StringLiteral' ? (this.order as StringLiteral).value : `\${${this.order.toTextualNASL(state)}}`;
232
+ return `${orderElement || '__IDENTIFIER__'} ${order || '__IDENTIFIER__'}`;
233
+ }
234
+
212
235
  //================================================================================
213
236
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
214
237
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -1,3 +1,13 @@
1
+ import {
2
+ TranslatorState,
3
+ withSourceMap,
4
+ createCompilerState,
5
+ withSourceMapGenerator,
6
+ withGenerator,
7
+ TranslatorGenerator,
8
+ indent,
9
+ } from '../translator';
10
+ import CallQueryComponent from './CallQueryComponent__';
1
11
  //================================================================================
2
12
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
3
13
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -547,6 +557,51 @@ export class QuerySelectExpression extends LogicItem {
547
557
  return utils.unique(name, this.getQueryFieldExpressionExistingNames(), undefined, false);
548
558
  }
549
559
 
560
+ @withSourceMap()
561
+ toNaturalTS(state = createCompilerState()): string {
562
+ let code = this.distinct ? `\n${indent(state.tabSize)}.SELECT_DISTINCT(() => ({\n` : `\n${indent(state.tabSize)}.SELECT(() => ({\n`;
563
+
564
+ this.selectElements.forEach((element) => {
565
+ code += indent(state.tabSize + 1);
566
+ code += element.toNaturalTS(state, true);
567
+ code += ',\n';
568
+ });
569
+
570
+ if ((this.parentNode as CallQueryComponent)?.groupBy.length) {
571
+ (this.parentNode as CallQueryComponent)?.groupBy.forEach((groupElement, index) => {
572
+ code += indent(state.tabSize);
573
+ code += (groupElement.groupElement as QueryFieldExpression).toNaturalTS(state, true) + ',\n';
574
+ });
575
+ }
576
+
577
+ code += `${indent(state.tabSize)}}))`;
578
+
579
+ return code;
580
+ }
581
+
582
+ @withSourceMap()
583
+ toTextualNASL(state = createCompilerState()): string {
584
+ let code = 'SELECT ';
585
+ if (this.distinct)
586
+ code += 'DISTINCT ';
587
+
588
+ this.selectElements.forEach((element) => {
589
+ code += element.toTextualNASL(state);
590
+ if (element !== this.selectElements[this.selectElements.length - 1])
591
+ code += ', ';
592
+ });
593
+
594
+ if ((this.parentNode as CallQueryComponent)?.groupBy.length) {
595
+ (this.parentNode as CallQueryComponent)?.groupBy.forEach((element, index) => {
596
+ code += element.toTextualNASL(state);
597
+ if (element !== (this.parentNode as CallQueryComponent)?.groupBy[this.selectElements.length - 1])
598
+ code += ', ';
599
+ });
600
+ }
601
+
602
+ return code;
603
+ }
604
+
550
605
  //================================================================================
551
606
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
552
607
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -1,3 +1,4 @@
1
+ import { runGeneratorSync as runSync } from '../utils/time-slicing';
1
2
  import { wrapForEachToGenerator as wrapForEach } from '../utils/time-slicing';
2
3
  import {
3
4
  TranslatorState,
@@ -402,6 +403,12 @@ export class SelectMembers extends BaseNode {
402
403
  const code = '';
403
404
  return code;
404
405
  }
406
+
407
+ @withSourceMap()
408
+ toNaturalTS(state = createCompilerState()): string {
409
+ return runSync(this.toEmbeddedTS(state));
410
+ }
411
+
405
412
  //================================================================================
406
413
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
407
414
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -290,8 +290,10 @@ export class SqlQueryComponent extends LogicItem {
290
290
 
291
291
  @withSourceMap()
292
292
  toNaturalTS(state = createCompilerState()): string {
293
- const code: string = `nasl.oql.query(\`${this.code}\`)`;
294
- return code;
293
+ const code = this.code
294
+ .replace(/\.(\d+)\}/g, '[$1]}')
295
+ .replace(/`/g, '\\`'); // 处理枚举 TS 转不回来的情况 ${app.enums.NetStatusEnum.1}
296
+ return `nasl.oql.query(\`${code}\`)`;
295
297
  }
296
298
 
297
299
  /**
@@ -360,14 +360,30 @@ export class StringInterpolation extends LogicItem {
360
360
  let code = '`';
361
361
  this.expressions.forEach((exp) => {
362
362
  if (exp.concept === 'StringLiteral') {
363
- code += (exp as StringLiteral).value;
363
+ code += (exp as StringLiteral).toNaturalTS(shiftState(state, code));
364
364
  } else {
365
365
  code += '${';
366
366
  code += exp.toNaturalTS(shiftState(state, code));
367
367
  code += '}';
368
368
  }
369
369
  });
370
- code += '`\n';
370
+ code += '`';
371
+ return code;
372
+ }
373
+
374
+ @withSourceMap()
375
+ toTextualNASL(state = createCompilerState()): string {
376
+ let code = 's"';
377
+ this.expressions.forEach((exp) => {
378
+ if (exp.concept === 'StringLiteral') {
379
+ code += (exp as StringLiteral).toNaturalTS(shiftState(state, code));
380
+ } else {
381
+ code += '${';
382
+ code += exp.toNaturalTS(shiftState(state, code));
383
+ code += '}';
384
+ }
385
+ });
386
+ code += '"';
371
387
  return code;
372
388
  }
373
389
 
@@ -141,7 +141,26 @@ export class StringLiteral extends LogicItem {
141
141
 
142
142
  @withSourceMap()
143
143
  toNaturalTS(state = createCompilerState(), isRequired?: boolean): string {
144
- return `'${this.value}'`;
144
+
145
+ if (this.parentNode?.concept === 'StringInterpolation') {
146
+ const code = this.value.replace(/[`$\\]/g, '\\$&');
147
+ return code;
148
+ } else {
149
+ const code = this.value.replace(/['\\]/g, '\\$&');
150
+ // if (code.includes("'"))
151
+ // return `"${code}"`;
152
+ // else
153
+ return `'${code}'`;
154
+ }
155
+ }
156
+
157
+ @withSourceMap()
158
+ toTextualNASL(state = createCompilerState()): string {
159
+ const code = this.value;
160
+ if (this.parentNode?.concept === 'StringInterpolation')
161
+ return code;
162
+ else
163
+ return `'${code}'`;
145
164
  }
146
165
 
147
166
  /**
@@ -7,6 +7,8 @@ import {
7
7
  withSourceMapGenerator,
8
8
  withGenerator,
9
9
  TranslatorGenerator,
10
+ indent,
11
+ createDecoratorCode,
10
12
  } from '../translator';
11
13
 
12
14
  interface defaultCode {
@@ -353,6 +355,26 @@ export class StructureProperty extends BaseNode {
353
355
  return code;
354
356
  }
355
357
 
358
+ @withSourceMap()
359
+ toTextualNASL(state = createCompilerState()): string {
360
+ let code = '';
361
+
362
+ const index = (this.parentNode as Structure)?.properties.indexOf(this);
363
+ if (index > 0) code += `\n${indent(state.tabSize)}`;
364
+
365
+ code += createDecoratorCode(state, this, ['label', 'description', 'jsonName']);
366
+
367
+ code += this.name;
368
+ if (this.typeAnnotation) {
369
+ code += ': ';
370
+ code += this.typeAnnotation.toTextualNASL(shiftState(state, code, { inline: true }));
371
+ }
372
+ if (this.defaultValue) {
373
+ code += ` = ${this.defaultValue}`;
374
+ }
375
+ return code;
376
+ }
377
+
356
378
  /**
357
379
  * 设置数据类型
358
380
  * @param typeAnnotation 类型标注对象
@@ -9,6 +9,7 @@ import {
9
9
  withSourceMapGenerator,
10
10
  withGenerator,
11
11
  TranslatorGenerator,
12
+ createDecoratorCode,
12
13
  } from '../translator';
13
14
  import type Namespace from './Namespace__';
14
15
  import { CUSTOM_CONNECTOR_EDITABLE_SUFFIX } from './basics/constants';
@@ -614,24 +615,24 @@ export class Structure extends BaseNode {
614
615
  *toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
615
616
  const self = this;
616
617
  let code = `export class ${self.tsName} {\n`;
617
- code += indent((state?.tabSize || 0) + 1);
618
+ code += indent(state.tabSize + 1);
618
619
  code += `__name: '${self.getTsNamespace()}.${self.tsName}';\n`;
619
620
  yield* wrapForEach(self.properties, function* warpForEachGenerator(property) {
620
- code += indent((state?.tabSize || 0) + 1);
621
+ code += indent(state.tabSize + 1);
621
622
  code += yield* property.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
622
623
  code += ';\n';
623
624
  });
624
625
 
625
626
  /* 默认值草稿区 */
626
- code += `${indent((state?.tabSize || 0) + 1)}playground = () => {\n`;
627
+ code += `${state.tabSize + 1}playground = () => {\n`;
627
628
  for (const prop of this.properties) {
628
629
  for (const item of prop.defaultValue?.playground ?? []) {
629
630
  code += yield* item.toEmbeddedTS(shiftState(state, code));
630
631
  code += ';\n';
631
632
  }
632
633
  }
633
- code += `${indent((state?.tabSize || 0) + 1)}}\n`;
634
- code += `${indent(state?.tabSize || 0)}}\n`;
634
+ code += `${state.tabSize + 1}}\n`;
635
+ code += `${state.tabSize}}\n`;
635
636
  return code;
636
637
  }
637
638
 
@@ -640,11 +641,27 @@ export class Structure extends BaseNode {
640
641
  let code = `class ${this.name} {\n`;
641
642
  // code += `${indent(state.tabSize + 1)}__name: '${this.getNamespace()}.${this.name}';\n`;
642
643
  this.properties.forEach((property) => {
643
- code += indent((state?.tabSize || 0) + 1);
644
+ code += indent(state.tabSize + 1);
644
645
  code += property.toNaturalTS(shiftState(state, code, { tabSize: 0 }));
645
646
  code += ';\n';
646
647
  });
647
- code += `${indent(state?.tabSize || 0)}}\n`;
648
+ code += `${indent(state.tabSize)}}\n`;
649
+ return code;
650
+ }
651
+
652
+ @withSourceMap()
653
+ toTextualNASL(state = createCompilerState()): string {
654
+ let code = '';
655
+
656
+ code += createDecoratorCode(state, this, ['description']);
657
+
658
+ code += `struct ${this.name} {\n`;
659
+ // code += `${indent(state.tabSize + 1)}__name: '${this.getNamespace()}.${this.name}';\n`;
660
+ this.properties.forEach((property) => {
661
+ code += property.toTextualNASL(shiftState(state, code, { tabSize: state.tabSize + 1 }));
662
+ code += '\n';
663
+ });
664
+ code += `${indent(state.tabSize)}}\n`;
648
665
  return code;
649
666
  }
650
667
 
@@ -339,7 +339,7 @@ export class SwitchCase extends LogicItem {
339
339
  }
340
340
 
341
341
  @withSourceMap()
342
- toNaturalTS(state = createCompilerState(), isLast?: boolean, isFirst?: boolean): string {
342
+ toNaturalTS(state = createCompilerState(), isLast?: boolean, isFirst = true): string {
343
343
  let code = '\n';
344
344
  if (!isLast) {
345
345
  code += indent(state.tabSize + 2);
@@ -760,7 +760,7 @@ export class TypeAnnotation extends BaseNode {
760
760
  return this.typeName;
761
761
  } else if (this.typeKind === 'generic') {
762
762
  return `${this.typeName}<${
763
- !this.typeArguments.length
763
+ !this.typeArguments?.length
764
764
  ? 'T'
765
765
  : this.typeArguments.map((arg) => arg?.typeTitle || arg?.name || 'T').join(', ')
766
766
  }>`;
@@ -1081,6 +1081,42 @@ export class TypeAnnotation extends BaseNode {
1081
1081
  return '__IDENTIFIER__';
1082
1082
  }
1083
1083
 
1084
+ @withSourceMap()
1085
+ toTextualNASL(state = createCompilerState()): string {
1086
+ if (this.typeKind === 'primitive' || this.typeKind === 'reference') {
1087
+ if (this.typeName === 'Long')
1088
+ return `${this.typeNamespace}.Integer`;
1089
+ return `${this.typeNamespace}.${this.typeName}`;
1090
+ } else if (this.typeKind === 'generic') {
1091
+ let code = `${this.typeName}<`;
1092
+ (this.typeArguments || []).forEach((arg, index) => {
1093
+ code += arg?.toNaturalTS(shiftState(state, code, { inline: true }));
1094
+ if (index !== this.typeArguments.length - 1) code += ', ';
1095
+ });
1096
+ code += '>';
1097
+ return code;
1098
+ } else if (this.typeKind === 'union') {
1099
+ let code = '';
1100
+ (this.typeArguments || []).forEach((arg, index) => {
1101
+ code += arg?.toNaturalTS(shiftState(state, code, { inline: true }));
1102
+ if (index !== this.typeArguments.length - 1) code += ' | ';
1103
+ });
1104
+ return code;
1105
+ } else if (this.typeKind === 'anonymousStructure') {
1106
+ let code = `{ `;
1107
+ (this.properties || []).forEach((property, i) => {
1108
+ code += `${property.name}: `;
1109
+ code += `${property.typeAnnotation?.toNaturalTS(
1110
+ shiftState(state, code, { inline: true, tabSize: state.tabSize + 1 }),
1111
+ )}`;
1112
+ code += i < this.properties?.length - 1 ? ', ' : ' }';
1113
+ });
1114
+ return code;
1115
+ } else {
1116
+ return this.typeName;
1117
+ }
1118
+ }
1119
+
1084
1120
  /**
1085
1121
  * 用于标准化数据结构,便于计算 anonymousStructure 的 __name
1086
1122
  */
@@ -73,7 +73,12 @@ export class TypeParam extends BaseNode {
73
73
  }
74
74
 
75
75
  @withSourceMap()
76
- toNaturalTS(state = createCompilerState(), prefix?: string): string {
76
+ toNaturalTS(state = createCompilerState()): string {
77
+ return this.name;
78
+ }
79
+
80
+ @withSourceMap()
81
+ toTextualNASL(state = createCompilerState()): string {
77
82
  return this.name;
78
83
  }
79
84
 
@@ -98,7 +98,7 @@ export class Unparsed extends LogicItem {
98
98
 
99
99
  @withSourceMap()
100
100
  toNaturalTS(): string {
101
- return ``;
101
+ return '__IDENTIFIER__';
102
102
  }
103
103
  //================================================================================
104
104
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
@@ -500,7 +500,12 @@ export class ValidationRule extends LogicItem {
500
500
  const { calleeName, target, calleeKey, arguments: args, errorMessage, view } = self;
501
501
  if (calleeName) {
502
502
  // 调用逻辑时绑定的验证器
503
- if (self?.parentNode?.parentKey !== 'metadataTypes' && (self.getAncestor('CallLogic') || !view)) {
503
+ if (
504
+ self?.parentNode?.parentKey !== 'metadataTypes'
505
+ && (
506
+ self.getAncestor('CallLogic') || !(view || this.getAncestor('BusinessComponent'))
507
+ )
508
+ ) {
504
509
  code += yield* target.toEmbeddedTS(shiftState(state, code));
505
510
  code += ';\n';
506
511
  }
@@ -1725,7 +1725,7 @@ export class ViewElement extends BaseNode {
1725
1725
  }>`;
1726
1726
  } else {
1727
1727
  let targetNode: any = _this;
1728
- while (!targetNode.__tsVariableDataSourceTypeName && asserts.isViewElement(targetNode?.parentNode)) {
1728
+ while ((!targetNode.__tsVariableDataSourceTypeName || targetNode.__tsVariableDataSourceTypeName === 'any') && asserts.isViewElement(targetNode?.parentNode)) {
1729
1729
  targetNode = targetNode.parentNode;
1730
1730
  }
1731
1731
  genericity += `<${(targetNode as any).__tsVariableDataSourceTypeName ?? 'any'}>`;
@@ -1747,8 +1747,9 @@ export class ViewElement extends BaseNode {
1747
1747
  tabSize: 4,
1748
1748
  inline: true,
1749
1749
  noNeedParams: true,
1750
+ callLogicNoIife: true,
1750
1751
  };
1751
- let value = yield* attr.expression.toEmbeddedTS(
1752
+ const value = yield* attr.expression.toEmbeddedTS(
1752
1753
  shiftState(state, code, attr.expression.concept === 'CallLogic' ? extraParams : {}),
1753
1754
  );
1754
1755
  code += indent((state?.tabSize || 0) + 3);
@@ -1844,8 +1845,9 @@ export class ViewElement extends BaseNode {
1844
1845
  tabSize: 4,
1845
1846
  inline: true,
1846
1847
  noNeedParams: true,
1848
+ callLogicNoIife: true,
1847
1849
  };
1848
- let value = yield* attr.expression.toEmbeddedTS(
1850
+ const value = yield* attr.expression.toEmbeddedTS(
1849
1851
  shiftState(state, code, attr.expression.concept === 'CallLogic' ? extraParams : {}),
1850
1852
  );
1851
1853
  code += `type ${datasourceName} = `;
@@ -1892,6 +1894,29 @@ export class ViewElement extends BaseNode {
1892
1894
  }
1893
1895
  }
1894
1896
 
1897
+ // 收集页面元素中的业务组件
1898
+ collectExistingBusinessComponent() {
1899
+ const excludedSet = new Set();
1900
+ utils.traverse(
1901
+ ({ node }) => {
1902
+ const correspondingBusinessComponent = node.correspondingBusinessComponent;
1903
+ if (correspondingBusinessComponent && !excludedSet.has(correspondingBusinessComponent)) {
1904
+ const set = correspondingBusinessComponent.collectExistingBusinessComponent();
1905
+ if (set.size) {
1906
+ set.forEach(value => {
1907
+ if (!excludedSet.has(value)) {
1908
+ excludedSet.add(value);
1909
+ }
1910
+ });
1911
+ }
1912
+ }
1913
+ },
1914
+ {
1915
+ node: this,
1916
+ },
1917
+ );
1918
+ return excludedSet;
1919
+ }
1895
1920
 
1896
1921
  @withSourceMapGenerator
1897
1922
  *toEmbeddedTS(state = createCompilerState(), parentLevel?: number): TranslatorGenerator {
@@ -2016,8 +2041,8 @@ export class ViewElement extends BaseNode {
2016
2041
  code += `() => [\n`;
2017
2042
  }
2018
2043
  yield* wrapForEach(self.bindAttrs, function* warpForEachGenerator(attr) {
2019
- // 过滤自由布局的key
2020
- const shouldFilter = self.isCorrespondingBusinessComponent && !(name === 'key' && !attr.expression);
2044
+ // 过滤业务组件的非表达式模式的翻译
2045
+ const shouldFilter = self.isCorrespondingBusinessComponent && (attr.type !== 'dynamic');
2021
2046
  if (shouldFilter) {
2022
2047
  return;
2023
2048
  }
@@ -2768,49 +2793,6 @@ export class ViewElement extends BaseNode {
2768
2793
  const { finalCode, asCompontent } = options || {};
2769
2794
  const parts: string[] = [];
2770
2795
  if (finalCode === false) {
2771
- if (this.tag === 'slot') {
2772
- if (asCompontent) {
2773
- return `<div vusion-slot-name="${this.name}">
2774
- <slot name="${this.name}">
2775
- <div s-empty="true" style="background: #f7f8fa;
2776
- border: 1px dashed #c3c3c3;
2777
- text-align: center;
2778
- color: #999;
2779
- min-height: 32px;
2780
- min-width: 32px;
2781
- width: 100%;
2782
- align-items: center;
2783
- display: inline-flex;
2784
- justify-content: center;">
2785
- +
2786
- </div>
2787
- </slot>
2788
- </div>`;
2789
- } else {
2790
- return `<div vusion-node-path="${this.nodePath}"
2791
- style="background: linear-gradient(-45deg,#fff 25%,#f3f5fa 0,#f3f5fa 50%,#fff 0,#fff 75%,#f3f5fa 0);
2792
- background-size: 45px 45px;
2793
- background-repeat: repeat;
2794
- line-height: 32px;
2795
- min-height: 32px;
2796
- color: var(--font-second-color);
2797
- text-align: center;">
2798
- 组件占位,可在使用业务组件时插入任意组件
2799
- </div>`;
2800
- }
2801
- } else if (this.businessComponent?.name === this.tag) {
2802
- // 组件内部使用自身的情况
2803
- return `<div vusion-node-path="${this.nodePath}"
2804
- style="background: linear-gradient(-45deg,#fff 25%,#f3f5fa 0,#f3f5fa 50%,#fff 0,#fff 75%,#f3f5fa 0);
2805
- background-size: 45px 45px;
2806
- background-repeat: repeat;
2807
- line-height: 32px;
2808
- min-height: 32px;
2809
- color: var(--font-second-color);
2810
- text-align: center;">
2811
- 在组件内部使用自身可能会导致循环引用,请谨慎使用
2812
- </div>`;
2813
- }
2814
2796
  const isRoot = options.isRoot;
2815
2797
  if (isRoot && !options?.asCompontent) {
2816
2798
  parts.push('type="root"');
@@ -2859,7 +2841,7 @@ export class ViewElement extends BaseNode {
2859
2841
  const tabString = ' '.repeat(newOptions.tabSize * newOptions.indentLevel);
2860
2842
  const insideTabString = ' '.repeat(newOptions.tabSize * (newOptions.indentLevel + 1));
2861
2843
  let shouldIndent = true;
2862
- const content: string = !this.children
2844
+ let content: string = !this.children
2863
2845
  ? ''
2864
2846
  : this.children
2865
2847
  .map((element) => {
@@ -2868,9 +2850,6 @@ export class ViewElement extends BaseNode {
2868
2850
  return (shouldIndent ? '\n' + insideTabString : '') + element?.toVue(childOptions);
2869
2851
  })
2870
2852
  .join('');
2871
- if (!content.length) {
2872
- shouldIndent = false;
2873
- }
2874
2853
  if (newOptions.aslIdAttr) {
2875
2854
  if (newOptions.aslIdAttr === true) {
2876
2855
  newOptions.aslIdAttr = 'asl-id';
@@ -2892,7 +2871,6 @@ export class ViewElement extends BaseNode {
2892
2871
  this.refName && parts.push(`:ref="\`${this.refName}\`"`);
2893
2872
  this.keyName && parts.push(`:key="\`${this.keyName}\`"`);
2894
2873
  this.staticClass && parts.push(`class="${this.staticClass}"`);
2895
- this.staticStyle && parts.push(`style="${this.staticStyle}"`);
2896
2874
 
2897
2875
  const vIfs: string[] = [];
2898
2876
  []
@@ -2933,7 +2911,45 @@ export class ViewElement extends BaseNode {
2933
2911
  ) {
2934
2912
  this.name && parts.push(`key="${this.name}"`);
2935
2913
  }
2936
-
2914
+ let tag = this.tag;
2915
+ let staticStyle = this.staticStyle ?? '';
2916
+ if (this.tag === 'slot') {
2917
+ this.name && parts.push(`name="${this.name}"`);
2918
+ if (finalCode === false) {
2919
+ tag = 'div';
2920
+ if (asCompontent) {
2921
+ parts.push(`vusion-slot-name="${this.name}"`);
2922
+ content = `<slot name="${this.name}">
2923
+ <div s-empty="true" bs-empty="true" style="background: #f7f8fa;
2924
+ border: 1px dashed #c3c3c3;
2925
+ text-align: center;
2926
+ color: #999;
2927
+ min-height: 32px;
2928
+ min-width: 32px;
2929
+ width: 100%;
2930
+ align-items: center;
2931
+ display: inline-flex;
2932
+ justify-content: center;">
2933
+ +
2934
+ </div>
2935
+ </slot>`;
2936
+ } else {
2937
+ parts.push(`vusion-node-path="${this.nodePath}"`);
2938
+ content = `组件占位,可在使用业务组件时插入任意组件`;
2939
+ staticStyle += `background: linear-gradient(-45deg,#fff 25%,#f3f5fa 0,#f3f5fa 50%,#fff 0,#fff 75%,#f3f5fa 0);
2940
+ background-size: 45px 45px;
2941
+ background-repeat: repeat;
2942
+ line-height: 32px;
2943
+ min-height: 32px;
2944
+ color: var(--font-second-color);
2945
+ text-align: center;`;
2946
+ }
2947
+ }
2948
+ }
2949
+ staticStyle && parts.push(`style="${staticStyle}"`);
2950
+ if (!content.length) {
2951
+ shouldIndent = false;
2952
+ }
2937
2953
  let partsLength = 0;
2938
2954
  let partsString = '';
2939
2955
  parts.forEach((part) => {
@@ -2945,12 +2961,12 @@ export class ViewElement extends BaseNode {
2945
2961
  partsLength += part.length;
2946
2962
  });
2947
2963
  let htmlContent =
2948
- `<${this.tag}${partsString.length ? partsString : ''}>` +
2964
+ `<${tag}${partsString.length ? partsString : ''}>` +
2949
2965
  content +
2950
2966
  (shouldIndent ? '\n' + tabString : '') +
2951
- `</${this.tag}>`;
2952
- if (!content.trim() && selfClosingTag.includes(this.tag)) {
2953
- htmlContent = `<${this.tag}${partsString.length ? partsString : ''} />`;
2967
+ `</${tag}>`;
2968
+ if (!content.trim() && selfClosingTag.includes(tag)) {
2969
+ htmlContent = `<${tag}${partsString.length ? partsString : ''} />`;
2954
2970
  }
2955
2971
  return htmlContent;
2956
2972
  }
@@ -1690,7 +1690,7 @@ export class View extends BaseNode {
1690
1690
  newName = name.replace(/\d*$/, (m) => `_${BranchCopyUniCode}_${m}`);
1691
1691
  }
1692
1692
  // 主分支无 BranchCopyUniCode
1693
- if (!BranchCopyUniCode && prefix?.at(-1) !== '_') {
1693
+ if (!BranchCopyUniCode && prefix?.slice(-1) !== '_') {
1694
1694
  newName = name.replace(/\d*$/, (m) => `_${m}`);
1695
1695
  }
1696
1696
  const newPrefix = newName.replace(/\d*$/, '');
@@ -1738,13 +1738,16 @@ export class View extends BaseNode {
1738
1738
 
1739
1739
  public static readonly TAG_NAME_PREFIX_REG?: RegExp = /^([lieu]|van)[-_]/;
1740
1740
 
1741
- mergeBlock({ code, nodePath, position, cb }: { code: string; nodePath: string; position: string; cb?: Function }) {
1741
+ mergeBlock({ code, nodePath, position, slotTarget, cb }: { code: string; nodePath: string; position: string; slotTarget?: string; cb?: Function }) {
1742
1742
  const ViewElement = getConceptConstructor('ViewElement');
1743
1743
  const Logic = getConceptConstructor('Logic');
1744
1744
  const Param = getConceptConstructor('Param');
1745
1745
  const Variable = getConceptConstructor('Variable');
1746
1746
  const BindEvent = getConceptConstructor('BindEvent');
1747
- const template = utils.sliceTagContent(code, 'template');
1747
+ let template = utils.sliceTagContent(code, 'template');
1748
+ if (slotTarget) {
1749
+ template = `<template #${slotTarget}>${template}</template>`;
1750
+ }
1748
1751
  let targetNode = this.app.findNodeByPath(nodePath);
1749
1752
  let parentNode = position === 'append' ? targetNode : targetNode.parentNode;
1750
1753
  if (parentNode.concept === 'View') {
@@ -1836,22 +1839,6 @@ export class View extends BaseNode {
1836
1839
  });
1837
1840
  }
1838
1841
 
1839
- // 页面逻辑
1840
- if (Array.isArray(definition.viewLogics)) {
1841
- definition.viewLogics.forEach((logicOption: any) => {
1842
- // 页面逻辑只有load函数的走之前的逻辑其余不用创建
1843
- if (logicOption.name.startsWith('load')) {
1844
- // const logic = Logic.from(
1845
- // {
1846
- // ...logicOption,
1847
- // },
1848
- // this,
1849
- // 'logics'
1850
- // );
1851
- // this.addLogic(logic);
1852
- }
1853
- });
1854
- }
1855
1842
  // 页面事件
1856
1843
  if (Array.isArray(definition.viewBindEvents)) {
1857
1844
  definition.viewBindEvents.forEach((eventOption: any) => {