@lcap/nasl 1.0.2 → 2.12.0-beta

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 (355) hide show
  1. package/out/automate/engine/index.js +11 -0
  2. package/out/automate/engine/index.js.map +1 -1
  3. package/out/automate/engine/uniqueName.js +1 -1
  4. package/out/automate/engine/uniqueName.js.map +1 -1
  5. package/out/automate/engine/utils.d.ts +1 -0
  6. package/out/automate/engine/utils.js +89 -67
  7. package/out/automate/engine/utils.js.map +1 -1
  8. package/out/concepts/App__.d.ts +51 -49
  9. package/out/concepts/App__.js +86 -54
  10. package/out/concepts/App__.js.map +1 -1
  11. package/out/concepts/Argument__.js +1 -1
  12. package/out/concepts/Argument__.js.map +1 -1
  13. package/out/concepts/Assignee__.js +1 -1
  14. package/out/concepts/Assignee__.js.map +1 -1
  15. package/out/concepts/Assignment__.js +1 -1
  16. package/out/concepts/Assignment__.js.map +1 -1
  17. package/out/concepts/Attribute__.js +1 -1
  18. package/out/concepts/Attribute__.js.map +1 -1
  19. package/out/concepts/BinaryExpression__.js +1 -1
  20. package/out/concepts/BinaryExpression__.js.map +1 -1
  21. package/out/concepts/BindAttribute__.js +3 -3
  22. package/out/concepts/BindAttribute__.js.map +1 -1
  23. package/out/concepts/BindDirective__.js +1 -1
  24. package/out/concepts/BindDirective__.js.map +1 -1
  25. package/out/concepts/BindEvent__.js +11 -6
  26. package/out/concepts/BindEvent__.js.map +1 -1
  27. package/out/concepts/BooleanLiteral__.js +1 -1
  28. package/out/concepts/BooleanLiteral__.js.map +1 -1
  29. package/out/concepts/CallFunction__.js +8 -3
  30. package/out/concepts/CallFunction__.js.map +1 -1
  31. package/out/concepts/CallInterface__.js +1 -1
  32. package/out/concepts/CallInterface__.js.map +1 -1
  33. package/out/concepts/CallLogic__.js +23 -21
  34. package/out/concepts/CallLogic__.js.map +1 -1
  35. package/out/concepts/CallQueryComponent__.d.ts +9 -8
  36. package/out/concepts/CallQueryComponent__.js +89 -79
  37. package/out/concepts/CallQueryComponent__.js.map +1 -1
  38. package/out/concepts/Comment__.js +2 -2
  39. package/out/concepts/Comment__.js.map +1 -1
  40. package/out/concepts/CompletionProperty__.js +1 -1
  41. package/out/concepts/CompletionProperty__.js.map +1 -1
  42. package/out/concepts/ConfigGroup__.d.ts +1 -0
  43. package/out/concepts/ConfigGroup__.js +8 -1
  44. package/out/concepts/ConfigGroup__.js.map +1 -1
  45. package/out/concepts/ConfigPropertyValue__.js +1 -1
  46. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  47. package/out/concepts/ConfigProperty__.d.ts +1 -0
  48. package/out/concepts/ConfigProperty__.js +4 -1
  49. package/out/concepts/ConfigProperty__.js.map +1 -1
  50. package/out/concepts/Configuration__.d.ts +1 -0
  51. package/out/concepts/Configuration__.js +4 -1
  52. package/out/concepts/Configuration__.js.map +1 -1
  53. package/out/concepts/Constant__.js +1 -1
  54. package/out/concepts/Constant__.js.map +1 -1
  55. package/out/concepts/DataElement__.js +1 -1
  56. package/out/concepts/DataElement__.js.map +1 -1
  57. package/out/concepts/DataSource__.d.ts +143 -0
  58. package/out/concepts/DataSource__.js +316 -0
  59. package/out/concepts/DataSource__.js.map +1 -0
  60. package/out/concepts/Destination__.js +8 -8
  61. package/out/concepts/Destination__.js.map +1 -1
  62. package/out/concepts/End__.js +3 -3
  63. package/out/concepts/End__.js.map +1 -1
  64. package/out/concepts/EntityIndex__.d.ts +5 -0
  65. package/out/concepts/EntityIndex__.js +7 -1
  66. package/out/concepts/EntityIndex__.js.map +1 -1
  67. package/out/concepts/EntityProperty__.d.ts +9 -0
  68. package/out/concepts/EntityProperty__.js +20 -3
  69. package/out/concepts/EntityProperty__.js.map +1 -1
  70. package/out/concepts/Entity__.d.ts +5 -0
  71. package/out/concepts/Entity__.js +21 -11
  72. package/out/concepts/Entity__.js.map +1 -1
  73. package/out/concepts/EnumItem__.js +1 -1
  74. package/out/concepts/EnumItem__.js.map +1 -1
  75. package/out/concepts/Enum__.js +11 -5
  76. package/out/concepts/Enum__.js.map +1 -1
  77. package/out/concepts/Event__.js +1 -1
  78. package/out/concepts/Event__.js.map +1 -1
  79. package/out/concepts/ForEachStatement__.js +3 -3
  80. package/out/concepts/ForEachStatement__.js.map +1 -1
  81. package/out/concepts/Function__.d.ts +18 -0
  82. package/out/concepts/Function__.js +96 -1
  83. package/out/concepts/Function__.js.map +1 -1
  84. package/out/concepts/Identifier__.js +3 -13
  85. package/out/concepts/Identifier__.js.map +1 -1
  86. package/out/concepts/IfStatement__.js +9 -9
  87. package/out/concepts/IfStatement__.js.map +1 -1
  88. package/out/concepts/InterfaceParam__.js +1 -1
  89. package/out/concepts/InterfaceParam__.js.map +1 -1
  90. package/out/concepts/Interface__.js +19 -12
  91. package/out/concepts/Interface__.js.map +1 -1
  92. package/out/concepts/JSBlock__.js +1 -1
  93. package/out/concepts/JSBlock__.js.map +1 -1
  94. package/out/concepts/LogicItem__.js +1 -1
  95. package/out/concepts/LogicItem__.js.map +1 -1
  96. package/out/concepts/Logic__.js +41 -42
  97. package/out/concepts/Logic__.js.map +1 -1
  98. package/out/concepts/MemberExpression__.js +1 -1
  99. package/out/concepts/MemberExpression__.js.map +1 -1
  100. package/out/concepts/Module__.d.ts +1 -85
  101. package/out/concepts/Module__.js +6 -107
  102. package/out/concepts/Module__.js.map +1 -1
  103. package/out/concepts/Namespace__.d.ts +0 -86
  104. package/out/concepts/Namespace__.js +1 -108
  105. package/out/concepts/Namespace__.js.map +1 -1
  106. package/out/concepts/NullLiteral__.js +1 -1
  107. package/out/concepts/NullLiteral__.js.map +1 -1
  108. package/out/concepts/NumericLiteral__.js +1 -1
  109. package/out/concepts/NumericLiteral__.js.map +1 -1
  110. package/out/concepts/Param__.d.ts +2 -1
  111. package/out/concepts/Param__.js +1 -1
  112. package/out/concepts/Param__.js.map +1 -1
  113. package/out/concepts/Point__.js +1 -1
  114. package/out/concepts/Point__.js.map +1 -1
  115. package/out/concepts/ProcessComponent__.js +1 -1
  116. package/out/concepts/ProcessComponent__.js.map +1 -1
  117. package/out/concepts/ProcessElement__.js +26 -11
  118. package/out/concepts/ProcessElement__.js.map +1 -1
  119. package/out/concepts/ProcessOutcome__.js +1 -1
  120. package/out/concepts/ProcessOutcome__.js.map +1 -1
  121. package/out/concepts/Process__.js +17 -10
  122. package/out/concepts/Process__.js.map +1 -1
  123. package/out/concepts/QueryAggregateExpression__.js +1 -1
  124. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  125. package/out/concepts/QueryFieldExpression__.js +9 -2
  126. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  127. package/out/concepts/QueryFromExpression__.d.ts +4 -0
  128. package/out/concepts/QueryFromExpression__.js +14 -3
  129. package/out/concepts/QueryFromExpression__.js.map +1 -1
  130. package/out/concepts/QueryGroupByExpression__.js +1 -1
  131. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  132. package/out/concepts/QueryJoinExpression__.d.ts +4 -0
  133. package/out/concepts/QueryJoinExpression__.js +15 -4
  134. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  135. package/out/concepts/QueryLimitExpression__.js +1 -1
  136. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  137. package/out/concepts/QueryOrderByExpression__.js +1 -1
  138. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  139. package/out/concepts/QuerySelectExpression__.js +1 -1
  140. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  141. package/out/concepts/Rect__.js +1 -1
  142. package/out/concepts/Rect__.js.map +1 -1
  143. package/out/concepts/Return__.js +1 -1
  144. package/out/concepts/Return__.js.map +1 -1
  145. package/out/concepts/Role__.js +11 -4
  146. package/out/concepts/Role__.js.map +1 -1
  147. package/out/concepts/Slot__.js +1 -1
  148. package/out/concepts/Slot__.js.map +1 -1
  149. package/out/concepts/SqlQueryComponent__.d.ts +10 -0
  150. package/out/concepts/SqlQueryComponent__.js +32 -5
  151. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  152. package/out/concepts/Start__.js +1 -1
  153. package/out/concepts/Start__.js.map +1 -1
  154. package/out/concepts/StringLiteral__.js +1 -1
  155. package/out/concepts/StringLiteral__.js.map +1 -1
  156. package/out/concepts/StructureProperty__.js +1 -1
  157. package/out/concepts/StructureProperty__.js.map +1 -1
  158. package/out/concepts/Structure__.js +20 -13
  159. package/out/concepts/Structure__.js.map +1 -1
  160. package/out/concepts/SwitchCase__.js +6 -6
  161. package/out/concepts/SwitchCase__.js.map +1 -1
  162. package/out/concepts/SwitchStatement__.js +1 -1
  163. package/out/concepts/SwitchStatement__.js.map +1 -1
  164. package/out/concepts/Theme__.js +1 -1
  165. package/out/concepts/Theme__.js.map +1 -1
  166. package/out/concepts/Transactional__.js +1 -1
  167. package/out/concepts/Transactional__.js.map +1 -1
  168. package/out/concepts/TypeAnnotation__.d.ts +8 -0
  169. package/out/concepts/TypeAnnotation__.js +46 -4
  170. package/out/concepts/TypeAnnotation__.js.map +1 -1
  171. package/out/concepts/TypeParam__.js +1 -1
  172. package/out/concepts/TypeParam__.js.map +1 -1
  173. package/out/concepts/UnaryExpression__.js +1 -1
  174. package/out/concepts/UnaryExpression__.js.map +1 -1
  175. package/out/concepts/Unparsed__.js +1 -1
  176. package/out/concepts/Unparsed__.js.map +1 -1
  177. package/out/concepts/UseComponent__.js +1 -1
  178. package/out/concepts/UseComponent__.js.map +1 -1
  179. package/out/concepts/ValidationRule__.js +1 -1
  180. package/out/concepts/ValidationRule__.js.map +1 -1
  181. package/out/concepts/Variable__.js +1 -1
  182. package/out/concepts/Variable__.js.map +1 -1
  183. package/out/concepts/ViewComponent__.js +1 -1
  184. package/out/concepts/ViewComponent__.js.map +1 -1
  185. package/out/concepts/ViewElement__.js +18 -18
  186. package/out/concepts/ViewElement__.js.map +1 -1
  187. package/out/concepts/View__.js +25 -23
  188. package/out/concepts/View__.js.map +1 -1
  189. package/out/concepts/WhileStatement__.js +5 -5
  190. package/out/concepts/WhileStatement__.js.map +1 -1
  191. package/out/concepts/basics/stdlib/nasl.util.js +278 -0
  192. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  193. package/out/concepts/index__.d.ts +1 -0
  194. package/out/concepts/index__.js +1 -0
  195. package/out/concepts/index__.js.map +1 -1
  196. package/out/generator/genBundleFiles.js +8 -3
  197. package/out/generator/genBundleFiles.js.map +1 -1
  198. package/out/generator/genMetaData.js +13 -12
  199. package/out/generator/genMetaData.js.map +1 -1
  200. package/out/server/createUiTs.js +1 -0
  201. package/out/server/createUiTs.js.map +1 -1
  202. package/out/server/getLogics.js +9 -1
  203. package/out/server/getLogics.js.map +1 -1
  204. package/out/server/getProcesses.d.ts +3 -0
  205. package/out/server/getProcesses.js +61 -1
  206. package/out/server/getProcesses.js.map +1 -1
  207. package/out/server/naslServer.js +128 -6
  208. package/out/server/naslServer.js.map +1 -1
  209. package/out/server/process2LogicNamespace.js +10 -1
  210. package/out/server/process2LogicNamespace.js.map +1 -1
  211. package/out/server/translator.js +19 -1
  212. package/out/server/translator.js.map +1 -1
  213. package/out/service/storage/init.js +2 -2
  214. package/out/service/storage/init.js.map +1 -1
  215. package/out/templator/genCreateBlock.js +15 -11
  216. package/out/templator/genCreateBlock.js.map +1 -1
  217. package/out/templator/genCurdEditMultipleKeyBlock.js +15 -12
  218. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  219. package/out/templator/genCurdMultipleKeyBlock.js +25 -21
  220. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  221. package/out/templator/genEditTableBlock.js +12 -12
  222. package/out/templator/genEditTableBlock.js.map +1 -1
  223. package/out/templator/genGridViewBlock.js +21 -20
  224. package/out/templator/genGridViewBlock.js.map +1 -1
  225. package/out/templator/genListViewBlock.js +6 -3
  226. package/out/templator/genListViewBlock.js.map +1 -1
  227. package/out/templator/genQueryComponent.js +5 -5
  228. package/out/templator/genQueryComponent.js.map +1 -1
  229. package/out/templator/genSelectBlock.js +8 -7
  230. package/out/templator/genSelectBlock.js.map +1 -1
  231. package/out/templator/genTableBlock.js +17 -15
  232. package/out/templator/genTableBlock.js.map +1 -1
  233. package/out/templator/genUpdateBlock.js +15 -11
  234. package/out/templator/genUpdateBlock.js.map +1 -1
  235. package/out/templator/utils.d.ts +2 -2
  236. package/out/templator/utils.js.map +1 -1
  237. package/out/test/integration/connect-file.js +6 -6
  238. package/out/test/integration/connect-file.js.map +1 -1
  239. package/out/translator/index.js +1 -1
  240. package/out/translator/index.js.map +1 -1
  241. package/out/utils/index.d.ts +4 -0
  242. package/out/utils/index.js +32 -1
  243. package/out/utils/index.js.map +1 -1
  244. package/package.json +1 -1
  245. package/src/automate/engine/index.js +12 -1
  246. package/src/automate/engine/uniqueName.js +1 -1
  247. package/src/automate/engine/utils.js +92 -67
  248. package/src/concepts/App__.ts +165 -95
  249. package/src/concepts/Argument__.ts +1 -1
  250. package/src/concepts/Assignee__.ts +1 -1
  251. package/src/concepts/Assignment__.ts +1 -1
  252. package/src/concepts/Attribute__.ts +1 -1
  253. package/src/concepts/BinaryExpression__.ts +1 -1
  254. package/src/concepts/BindAttribute__.ts +3 -3
  255. package/src/concepts/BindDirective__.ts +1 -1
  256. package/src/concepts/BindEvent__.ts +10 -6
  257. package/src/concepts/BooleanLiteral__.ts +1 -1
  258. package/src/concepts/CallFunction__.ts +19 -16
  259. package/src/concepts/CallInterface__.ts +1 -1
  260. package/src/concepts/CallLogic__.ts +23 -23
  261. package/src/concepts/CallQueryComponent__.ts +96 -113
  262. package/src/concepts/Comment__.ts +2 -2
  263. package/src/concepts/CompletionProperty__.ts +1 -1
  264. package/src/concepts/ConfigGroup__.ts +4 -2
  265. package/src/concepts/ConfigPropertyValue__.ts +1 -1
  266. package/src/concepts/ConfigProperty__.ts +5 -1
  267. package/src/concepts/Configuration__.ts +4 -1
  268. package/src/concepts/Constant__.ts +1 -1
  269. package/src/concepts/DataElement__.ts +1 -1
  270. package/src/concepts/DataSource__.ts +389 -0
  271. package/src/concepts/Destination__.ts +24 -8
  272. package/src/concepts/End__.ts +3 -3
  273. package/src/concepts/EntityIndex__.ts +8 -1
  274. package/src/concepts/EntityProperty__.ts +21 -3
  275. package/src/concepts/Entity__.ts +24 -12
  276. package/src/concepts/EnumItem__.ts +1 -1
  277. package/src/concepts/Enum__.ts +24 -5
  278. package/src/concepts/Event__.ts +1 -1
  279. package/src/concepts/ForEachStatement__.ts +3 -3
  280. package/src/concepts/Function__.ts +97 -3
  281. package/src/concepts/Identifier__.ts +12 -13
  282. package/src/concepts/IfStatement__.ts +10 -10
  283. package/src/concepts/InterfaceParam__.ts +1 -1
  284. package/src/concepts/Interface__.ts +20 -12
  285. package/src/concepts/JSBlock__.ts +1 -1
  286. package/src/concepts/LogicItem__.ts +1 -1
  287. package/src/concepts/Logic__.ts +41 -39
  288. package/src/concepts/MemberExpression__.ts +1 -1
  289. package/src/concepts/Module__.ts +9 -204
  290. package/src/concepts/Namespace__.ts +1 -204
  291. package/src/concepts/NullLiteral__.ts +1 -1
  292. package/src/concepts/NumericLiteral__.ts +1 -1
  293. package/src/concepts/Param__.ts +3 -2
  294. package/src/concepts/Point__.ts +1 -1
  295. package/src/concepts/ProcessComponent__.ts +1 -1
  296. package/src/concepts/ProcessElement__.ts +29 -13
  297. package/src/concepts/ProcessOutcome__.ts +1 -1
  298. package/src/concepts/Process__.ts +17 -11
  299. package/src/concepts/QueryAggregateExpression__.ts +1 -1
  300. package/src/concepts/QueryFieldExpression__.ts +10 -2
  301. package/src/concepts/QueryFromExpression__.ts +14 -3
  302. package/src/concepts/QueryGroupByExpression__.ts +1 -1
  303. package/src/concepts/QueryJoinExpression__.ts +15 -4
  304. package/src/concepts/QueryLimitExpression__.ts +1 -1
  305. package/src/concepts/QueryOrderByExpression__.ts +1 -1
  306. package/src/concepts/QuerySelectExpression__.ts +1 -1
  307. package/src/concepts/Rect__.ts +1 -1
  308. package/src/concepts/Return__.ts +1 -1
  309. package/src/concepts/Role__.ts +11 -5
  310. package/src/concepts/Slot__.ts +1 -1
  311. package/src/concepts/SqlQueryComponent__.ts +30 -11
  312. package/src/concepts/Start__.ts +1 -1
  313. package/src/concepts/StringLiteral__.ts +1 -1
  314. package/src/concepts/StructureProperty__.ts +1 -1
  315. package/src/concepts/Structure__.ts +20 -12
  316. package/src/concepts/SwitchCase__.ts +6 -6
  317. package/src/concepts/SwitchStatement__.ts +1 -1
  318. package/src/concepts/Theme__.ts +1 -1
  319. package/src/concepts/Transactional__.ts +1 -1
  320. package/src/concepts/TypeAnnotation__.ts +45 -23
  321. package/src/concepts/TypeParam__.ts +1 -1
  322. package/src/concepts/UnaryExpression__.ts +1 -1
  323. package/src/concepts/Unparsed__.ts +1 -1
  324. package/src/concepts/UseComponent__.ts +1 -1
  325. package/src/concepts/ValidationRule__.ts +1 -1
  326. package/src/concepts/Variable__.ts +1 -1
  327. package/src/concepts/ViewComponent__.ts +1 -1
  328. package/src/concepts/ViewElement__.ts +19 -19
  329. package/src/concepts/View__.ts +25 -23
  330. package/src/concepts/WhileStatement__.ts +5 -5
  331. package/src/concepts/basics/stdlib/nasl.util.ts +279 -0
  332. package/src/concepts/index__.ts +1 -0
  333. package/src/generator/genBundleFiles.ts +8 -3
  334. package/src/generator/genMetaData.ts +13 -13
  335. package/src/server/createUiTs.ts +1 -0
  336. package/src/server/getLogics.ts +11 -3
  337. package/src/server/getProcesses.ts +61 -0
  338. package/src/server/naslServer.ts +124 -6
  339. package/src/server/process2LogicNamespace.ts +29 -19
  340. package/src/server/translator.ts +22 -1
  341. package/src/service/storage/init.ts +2 -2
  342. package/src/templator/genCreateBlock.ts +16 -13
  343. package/src/templator/genCurdEditMultipleKeyBlock.ts +16 -13
  344. package/src/templator/genCurdMultipleKeyBlock.ts +26 -22
  345. package/src/templator/genEditTableBlock.ts +14 -13
  346. package/src/templator/genGridViewBlock.ts +22 -21
  347. package/src/templator/genListViewBlock.ts +9 -5
  348. package/src/templator/genQueryComponent.ts +6 -6
  349. package/src/templator/genSelectBlock.ts +9 -8
  350. package/src/templator/genTableBlock.ts +18 -16
  351. package/src/templator/genUpdateBlock.ts +16 -12
  352. package/src/templator/utils.ts +2 -2
  353. package/src/test/integration/connect-file.ts +6 -6
  354. package/src/translator/index.ts +1 -1
  355. package/src/utils/index.ts +32 -0
@@ -104,7 +104,7 @@ export class Role extends BaseNode {
104
104
  toEmbeddedTS(state?: TranslatorState): string {
105
105
  let code = `export enum ${this.tsName} {\n`;
106
106
  code += ` ${this.tsName}='${this.tsName}'\n`;
107
- code += indent(state.tabSize) + '}\n';
107
+ code += indent((state?.tabSize || 0)) + '}\n';
108
108
 
109
109
  return code;
110
110
  }
@@ -117,9 +117,15 @@ export class Role extends BaseNode {
117
117
  }
118
118
 
119
119
  getNamespace() {
120
- if (this.parentNode && (this.parentNode as Namespace).getNamespace)
121
- return `${(this.parentNode as Namespace).getNamespace()}.roles`;
122
- else
120
+ if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
121
+ const parentNamespace = (this.parentNode as Namespace).getNamespace();
122
+ const parentName = this.parentNode.name;
123
+ const arr = [parentNamespace];
124
+ if (this.parentNode.concept !== 'App' && parentName) {
125
+ arr.push(parentName);
126
+ }
127
+ return `${arr.join('.')}.roles`;
128
+ } else
123
129
  throw new Error('无法获取命名空间,请设置 parentNode!');
124
130
  }
125
131
 
@@ -155,7 +161,7 @@ export class Role extends BaseNode {
155
161
  //================================================================================
156
162
  }
157
163
 
158
- classMap['Role'] = Role;
164
+ classMap.Role = Role;
159
165
  export default Role;
160
166
  //================================================================================
161
167
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -114,7 +114,7 @@ export class Slot extends BaseNode {
114
114
  //================================================================================
115
115
  }
116
116
 
117
- classMap['Slot'] = Slot;
117
+ classMap.Slot = Slot;
118
118
  export default Slot;
119
119
  //================================================================================
120
120
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -42,7 +42,11 @@ export class SqlQueryComponent extends LogicItem {
42
42
  @property('TypeAnnotation')
43
43
  typeAnnotation: TypeAnnotation = undefined;
44
44
 
45
-
45
+ /**
46
+ * 局部版本
47
+ */
48
+ @property()
49
+ ideVersion: string = undefined;
46
50
 
47
51
  /**
48
52
  * @param source 需要合并的部分参数
@@ -57,7 +61,6 @@ export class SqlQueryComponent extends LogicItem {
57
61
  return super.from(source, parentNode, parentKey) as SqlQueryComponent;
58
62
  }
59
63
 
60
-
61
64
  /**
62
65
  * 设置SQL 查询
63
66
  */
@@ -70,10 +73,6 @@ export class SqlQueryComponent extends LogicItem {
70
73
  });
71
74
  }
72
75
 
73
-
74
-
75
-
76
-
77
76
  /**
78
77
  * 删除类型标注
79
78
  * @param name 类型标注名称
@@ -126,22 +125,42 @@ export class SqlQueryComponent extends LogicItem {
126
125
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
127
126
  // 自动生成的代码已结束。下面可以手动编写。
128
127
  //================================================================================
128
+
129
+ @property()
130
+ dataSource: string = undefined;
131
+
129
132
  @withSourceMap()
130
133
  toEmbeddedTS(state?: TranslatorState): string {
131
- let code = `(function(): nasl.collection.List<`
132
- code +=`${this.typeAnnotation ? this.typeAnnotation.toEmbeddedTS(shiftState(state, code)): '__IDENTIFIER__'}> {\n`;
134
+ let code;
135
+ if (this.ideVersion === '2.11') {
136
+ code = `(function(): `;
137
+ code += `${this.typeAnnotation ? this.typeAnnotation.toEmbeddedTS(shiftState(state, code)) : '__IDENTIFIER__'} {\n`;
138
+ } else {
139
+ code = `(function(): nasl.collection.List<`;
140
+ code += `${this.typeAnnotation ? this.typeAnnotation.toEmbeddedTS(shiftState(state, code)) : '__IDENTIFIER__'}> {\n`;
141
+ }
133
142
  code += '\n';
134
- code += indent(state.tabSize + 1) + 'return;\n';
135
- code += indent(state.tabSize) + '})();\n';
143
+ code += indent((state?.tabSize || 0) + 1) + 'return;\n';
144
+ code += indent((state?.tabSize || 0)) + '})();\n';
136
145
  return code;
137
146
  }
147
+
148
+ /**
149
+ * 获取添加时的默认选项
150
+ * @returns
151
+ */
152
+ public static getDefaultOptions(): any {
153
+ return {
154
+ dataSource: 'defaultDS',
155
+ };
156
+ }
138
157
  //================================================================================
139
158
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
140
159
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
141
160
  //================================================================================
142
161
  }
143
162
 
144
- classMap['SqlQueryComponent'] = SqlQueryComponent;
163
+ classMap.SqlQueryComponent = SqlQueryComponent;
145
164
  export default SqlQueryComponent;
146
165
  //================================================================================
147
166
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -71,7 +71,7 @@ export class Start extends LogicItem {
71
71
  //================================================================================
72
72
  }
73
73
 
74
- classMap['Start'] = Start;
74
+ classMap.Start = Start;
75
75
  export default Start;
76
76
  //================================================================================
77
77
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -125,7 +125,7 @@ export class StringLiteral extends LogicItem {
125
125
  //================================================================================
126
126
  }
127
127
 
128
- classMap['StringLiteral'] = StringLiteral;
128
+ classMap.StringLiteral = StringLiteral;
129
129
  export default StringLiteral;
130
130
  //================================================================================
131
131
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -345,7 +345,7 @@ export class StructureProperty extends BaseNode {
345
345
  //================================================================================
346
346
  }
347
347
 
348
- classMap['StructureProperty'] = StructureProperty;
348
+ classMap.StructureProperty = StructureProperty;
349
349
  export default StructureProperty;
350
350
  //================================================================================
351
351
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -531,34 +531,42 @@ export class Structure extends BaseNode {
531
531
  @withSourceMap()
532
532
  toEmbeddedTS(state?: TranslatorState): string {
533
533
  let code = `export class ${this.tsName} {\n`;
534
- code += indent(state.tabSize + 1);
534
+ code += indent((state?.tabSize || 0) + 1);
535
535
  code += `__name: '${this.getTsNamespace()}.${this.tsName}';\n`;
536
536
  this.properties.forEach((property) => {
537
- code += indent(state.tabSize + 1);
537
+ code += indent((state?.tabSize || 0) + 1);
538
538
  code += property.toEmbeddedTS(shiftState(state, code, { tabSize: 0 }));
539
539
  code += ';\n';
540
540
  });
541
- code += indent(state.tabSize) + '}\n';
541
+ code += indent((state?.tabSize || 0)) + '}\n';
542
542
 
543
543
  return code;
544
544
  }
545
545
 
546
546
  getNamespace() {
547
547
  if (this.parentNode && (this.parentNode as Namespace).getNamespace) {
548
- return `${(this.parentNode as Namespace).getNamespace()}.structures`;
548
+ const parentNamespace = (this.parentNode as Namespace).getNamespace();
549
+ const parentName = this.parentNode.name;
550
+ const arr = [parentNamespace];
551
+ if (this.parentNode.concept !== 'App' && parentName) {
552
+ arr.push(parentName);
553
+ }
554
+ return `${arr.join('.')}.structures`;
549
555
  } else
550
556
  throw new Error('无法获取命名空间,请设置 parentNode!');
551
557
  }
552
558
 
553
559
  getTsNamespace() {
554
- if (this.parentNode.concept === 'App') {
555
- return `${(this.parentNode as Namespace).getNamespace()}.structures`;
556
- } else {
557
- if (this.parentNode && (this.parentNode as Namespace).getTsNamespace) {
558
- return `${(this.parentNode as Namespace).getTsNamespace()}.structures`;
559
- } else {
560
- throw new Error('无法获取命名空间,请设置 parentNode!');
560
+ if (this.parentNode && (this.parentNode as Namespace).getTsNamespace) {
561
+ const parentNamespace = (this.parentNode as Namespace).getTsNamespace();
562
+ const parentName = this.parentNode.tsName || this.parentNode.name;
563
+ const arr = [parentNamespace];
564
+ if (this.parentNode.concept !== 'App' && parentName) {
565
+ arr.push(parentName);
561
566
  }
567
+ return `${arr.join('.')}.structures`;
568
+ } else {
569
+ throw new Error('无法获取命名空间,请设置 parentNode!');
562
570
  }
563
571
  }
564
572
 
@@ -595,7 +603,7 @@ export class Structure extends BaseNode {
595
603
  //================================================================================
596
604
  }
597
605
 
598
- classMap['Structure'] = Structure;
606
+ classMap.Structure = Structure;
599
607
  export default Structure;
600
608
  //================================================================================
601
609
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -281,7 +281,7 @@ export class SwitchCase extends LogicItem {
281
281
  if (!isLast) {
282
282
  code += 'if (nasl.core.ensureBoolean(';
283
283
  code += this.test ? this.test.toEmbeddedTS(shiftState(state, code, {
284
- tabSize: state.tabSize + 1,
284
+ tabSize: (state?.tabSize || 0) + 1,
285
285
  })) : '__IDENTIFIER__';
286
286
 
287
287
  code += ')) {\n';
@@ -290,22 +290,22 @@ export class SwitchCase extends LogicItem {
290
290
  this.consequent.forEach((logicItem) => {
291
291
  code
292
292
  += logicItem.toEmbeddedTS(shiftState(state, code, {
293
- tabSize: state.tabSize + 1,
293
+ tabSize: (state?.tabSize || 0) + 1,
294
294
  })) + '\n';
295
295
  });
296
296
  }
297
- code += indent(state.tabSize) + '}\n';
297
+ code += indent((state?.tabSize || 0)) + '}\n';
298
298
  } else {
299
299
  code += 'else {\n';
300
300
  if (Array.isArray(this.consequent)) {
301
301
  this.consequent.forEach((logicItem) => {
302
302
  code
303
303
  += logicItem.toEmbeddedTS(shiftState(state, code, {
304
- tabSize: state.tabSize + 1,
304
+ tabSize: (state?.tabSize || 0) + 1,
305
305
  })) + '\n';
306
306
  });
307
307
  }
308
- code += indent(state.tabSize) + '}\n';
308
+ code += indent((state?.tabSize || 0)) + '}\n';
309
309
  }
310
310
 
311
311
  return code;
@@ -317,7 +317,7 @@ export class SwitchCase extends LogicItem {
317
317
  //================================================================================
318
318
  }
319
319
 
320
- classMap['SwitchCase'] = SwitchCase;
320
+ classMap.SwitchCase = SwitchCase;
321
321
  export default SwitchCase;
322
322
  //================================================================================
323
323
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -248,7 +248,7 @@ export class SwitchStatement extends LogicItem {
248
248
  //================================================================================
249
249
  }
250
250
 
251
- classMap['SwitchStatement'] = SwitchStatement;
251
+ classMap.SwitchStatement = SwitchStatement;
252
252
  export default SwitchStatement;
253
253
  //================================================================================
254
254
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -87,7 +87,7 @@ export class Theme extends BaseNode {
87
87
  //================================================================================
88
88
  }
89
89
 
90
- classMap['Theme'] = Theme;
90
+ classMap.Theme = Theme;
91
91
  export default Theme;
92
92
  //================================================================================
93
93
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -157,7 +157,7 @@ export class Transactional extends BaseNode {
157
157
  //================================================================================
158
158
  }
159
159
 
160
- classMap['Transactional'] = Transactional;
160
+ classMap.Transactional = Transactional;
161
161
  export default Transactional;
162
162
  //================================================================================
163
163
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -40,7 +40,6 @@ import { v4 as uuidv4 } from 'uuid';
40
40
  import BaseNode from '../common/BaseNode';
41
41
  import classMap from '../common/classMap';
42
42
 
43
-
44
43
  /**
45
44
  * 类型标注
46
45
  */
@@ -82,8 +81,6 @@ export class TypeAnnotation extends BaseNode {
82
81
  @property()
83
82
  inferred?: boolean = undefined;
84
83
 
85
-
86
-
87
84
  /**
88
85
  * @param source 需要合并的部分参数
89
86
  */
@@ -97,13 +94,6 @@ export class TypeAnnotation extends BaseNode {
97
94
  return super.from(source, parentNode, parentKey) as TypeAnnotation;
98
95
  }
99
96
 
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
97
  /**
108
98
  * 插入类型标注
109
99
  * @internal
@@ -136,8 +126,6 @@ export class TypeAnnotation extends BaseNode {
136
126
  return typeAnnotation;
137
127
  }
138
128
 
139
-
140
-
141
129
  /**
142
130
  * 插入类型标注
143
131
  * @param typeAnnotationOptions 类型标注参数
@@ -160,8 +148,6 @@ export class TypeAnnotation extends BaseNode {
160
148
  return node;
161
149
  }
162
150
 
163
-
164
-
165
151
  /**
166
152
  * 添加类型标注
167
153
  * @internal
@@ -181,8 +167,6 @@ export class TypeAnnotation extends BaseNode {
181
167
  return this._insertTypeAnnotationAt(options as any, index);
182
168
  }
183
169
 
184
-
185
-
186
170
  /**
187
171
  * 添加类型标注
188
172
  * @param typeAnnotationOptions 类型标注参数
@@ -206,9 +190,6 @@ export class TypeAnnotation extends BaseNode {
206
190
  return node;
207
191
  }
208
192
 
209
-
210
-
211
-
212
193
  /**
213
194
  * 删除类型标注
214
195
  * @param typeAnnotation 已有的类型标注实例
@@ -216,7 +197,7 @@ export class TypeAnnotation extends BaseNode {
216
197
  removeTypeAnnotation(typeAnnotation: TypeAnnotation): void;
217
198
 
218
199
  removeTypeAnnotation(options: TypeAnnotation) {
219
- let typeAnnotation: TypeAnnotation = options;
200
+ const typeAnnotation: TypeAnnotation = options;
220
201
  return typeAnnotation.delete();
221
202
  }
222
203
 
@@ -258,6 +239,35 @@ export class TypeAnnotation extends BaseNode {
258
239
  }
259
240
  }
260
241
 
242
+ /**
243
+ * 用于展示的 type 标题
244
+ */
245
+ get headTitle(): string {
246
+ if (this.typeKind === 'primitive') {
247
+ return `${this.typeName} ${PRIMITIVE_TITLE[this.typeName]}`;
248
+ } else if (this.typeKind === 'reference') {
249
+ const typeNamespace = this?.typeNamespace;
250
+ let typeTitle = this.typeName;
251
+ if (typeNamespace && this.rootNode) {
252
+ const entity = (this.rootNode as any).findNodeByCompleteName([typeNamespace, this?.typeName].join('.'));
253
+ if (entity?.concept === 'Entity') {
254
+ const dataSourceName = entity.dataSource?.name;
255
+ if (dataSourceName) {
256
+ typeTitle += `(${dataSourceName})`;
257
+ }
258
+ }
259
+ }
260
+ return typeTitle;
261
+ } else if (this.typeKind === 'generic') {
262
+ if (this.typeArguments && this.typeArguments.length)
263
+ return `${this.typeName}<${(this.typeArguments || []).map((arg) => arg.headTitle || 'T')}>`;
264
+ else
265
+ return this.typeName;
266
+ } else {
267
+ return this.typeName;
268
+ }
269
+ }
270
+
261
271
  /**
262
272
  * 用于展示的 type 标题
263
273
  */
@@ -265,11 +275,11 @@ export class TypeAnnotation extends BaseNode {
265
275
  if (this.typeKind === 'primitive') {
266
276
  return `${this.typeName} ${PRIMITIVE_TITLE[this.typeName]}`;
267
277
  } else if (this.typeKind === 'reference') {
268
- return `${this.typeName}`;
278
+ return this.typeName;
269
279
  } else if (this.typeKind === 'generic') {
270
280
  let str = `${this.typeName}`;
271
281
  const loop = (typeArguments: Array<TypeAnnotation>) => {
272
- str += '<' + (typeArguments[0].typeName || 'T');
282
+ str += '<' + (typeArguments[0].typeTitle || 'T');
273
283
  if (typeArguments[0].typeKind === 'generic') {
274
284
  if (this.typeArguments && this.typeArguments.length) {
275
285
  loop(typeArguments[0].typeArguments);
@@ -329,6 +339,18 @@ export class TypeAnnotation extends BaseNode {
329
339
  });
330
340
  }
331
341
 
342
+ /**
343
+ * 设置类型字段名称
344
+ */
345
+ setTypeNamespace(typeNamespace: string) {
346
+ const object = {
347
+ typeNamespace,
348
+ };
349
+ this.update({
350
+ ...object,
351
+ });
352
+ }
353
+
332
354
  get tsCalleeNamespace() {
333
355
  if (this.typeNamespace) {
334
356
  let tsCalleeNamespace = this.typeNamespace;
@@ -430,7 +452,7 @@ export class TypeAnnotation extends BaseNode {
430
452
  //================================================================================
431
453
  }
432
454
 
433
- classMap['TypeAnnotation'] = TypeAnnotation;
455
+ classMap.TypeAnnotation = TypeAnnotation;
434
456
  export default TypeAnnotation;
435
457
  //================================================================================
436
458
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -61,7 +61,7 @@ export class TypeParam extends BaseNode {
61
61
  //================================================================================
62
62
  }
63
63
 
64
- classMap['TypeParam'] = TypeParam;
64
+ classMap.TypeParam = TypeParam;
65
65
  export default TypeParam;
66
66
  //================================================================================
67
67
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -176,7 +176,7 @@ export class UnaryExpression extends LogicItem {
176
176
  //================================================================================
177
177
  }
178
178
 
179
- classMap['UnaryExpression'] = UnaryExpression;
179
+ classMap.UnaryExpression = UnaryExpression;
180
180
  export default UnaryExpression;
181
181
  //================================================================================
182
182
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -90,7 +90,7 @@ export class Unparsed extends LogicItem {
90
90
  //================================================================================
91
91
  }
92
92
 
93
- classMap['Unparsed'] = Unparsed;
93
+ classMap.Unparsed = Unparsed;
94
94
  export default Unparsed;
95
95
  //================================================================================
96
96
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -77,7 +77,7 @@ export class UseComponent extends BaseNode {
77
77
  //================================================================================
78
78
  }
79
79
 
80
- classMap['UseComponent'] = UseComponent;
80
+ classMap.UseComponent = UseComponent;
81
81
  export default UseComponent;
82
82
  //================================================================================
83
83
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -324,7 +324,7 @@ export class ValidationRule extends LogicItem {
324
324
  //================================================================================
325
325
  }
326
326
 
327
- classMap['ValidationRule'] = ValidationRule;
327
+ classMap.ValidationRule = ValidationRule;
328
328
  export default ValidationRule;
329
329
  //================================================================================
330
330
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -365,7 +365,7 @@ export class Variable extends BaseNode {
365
365
  //================================================================================
366
366
  }
367
367
 
368
- classMap['Variable'] = Variable;
368
+ classMap.Variable = Variable;
369
369
  export default Variable;
370
370
  //================================================================================
371
371
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -1091,7 +1091,7 @@ export class ViewComponent extends BaseNode {
1091
1091
  //================================================================================
1092
1092
  }
1093
1093
 
1094
- classMap['ViewComponent'] = ViewComponent;
1094
+ classMap.ViewComponent = ViewComponent;
1095
1095
  export default ViewComponent;
1096
1096
  //================================================================================
1097
1097
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
@@ -864,7 +864,7 @@ export class ViewElement extends BaseNode {
864
864
  }
865
865
 
866
866
 
867
-
867
+
868
868
 
869
869
  /**
870
870
  * 删除元素绑定属性
@@ -1120,7 +1120,7 @@ export class ViewElement extends BaseNode {
1120
1120
 
1121
1121
  haveScope(node: ViewElement): boolean {
1122
1122
  // uGallery 没有子集不需要scope
1123
- const dataSourcePcList = ['uTableView', 'uListView', 'uGridView', 'uCalendarView', 'uListComponents', 'uSelect', 'devopsDragTable'];
1123
+ const dataSourcePcList = ['uTableView', 'uListView', 'uGridView', 'uCalendarView', 'uListComponents', 'uSelect', 'devopsDragTable', 'uTreeViewNew'];
1124
1124
  const dataSourceH5List = ['vanRadioGroup', 'vanCheckboxGroup', 'vanListView', 'vanGridView', 'vanForComponents', 'lcapEchartsLine', 'lcapEchartsBar', 'lcapEchartsPie'];
1125
1125
  const dataSourceList = [...dataSourcePcList, ...dataSourceH5List];
1126
1126
  return dataSourceList.includes(node.toHump(node.tag));
@@ -1132,7 +1132,7 @@ export class ViewElement extends BaseNode {
1132
1132
  let code = '';
1133
1133
  // formItem的单独处理
1134
1134
  if (this.tag === 'u-form-item') {
1135
- code = indent(state.tabSize) + `${this.name}: nasl.ui.${this.toHump(this.tag)}`;
1135
+ code = indent((state?.tabSize || 0)) + `${this.name}: nasl.ui.${this.toHump(this.tag)}`;
1136
1136
  if (Array.isArray(this.children) && this.children.length) {
1137
1137
  const tag = this.children[0].tag;
1138
1138
  if (tag === 'u-input') {
@@ -1185,9 +1185,9 @@ export class ViewElement extends BaseNode {
1185
1185
  }
1186
1186
  }
1187
1187
  }
1188
- code += indent(state.tabSize) + `${this.name}: nasl.ui.${this.toHump(this.tag)}<${genericType}>;\n`;
1188
+ code += indent((state?.tabSize || 0)) + `${this.name}: nasl.ui.${this.toHump(this.tag)}<${genericType}>;\n`;
1189
1189
  } else {
1190
- code = indent(state.tabSize) + `${this.name}: nasl.ui.${this.toHump(this.tag)}<any>;\n`;
1190
+ code = indent((state?.tabSize || 0)) + `${this.name}: nasl.ui.${this.toHump(this.tag)}<any>;\n`;
1191
1191
  }
1192
1192
  if (Array.isArray(this.children)) {
1193
1193
  this.children.forEach((element) => {
@@ -1217,14 +1217,14 @@ export class ViewElement extends BaseNode {
1217
1217
  }
1218
1218
  // 角色
1219
1219
  if (Array.isArray(this.bindRoles) && this.bindRoles.length) {
1220
- code += indent(state.tabSize + 2);
1220
+ code += indent((state?.tabSize || 0) + 2);
1221
1221
  code += 'roles = [\n';
1222
1222
  this.bindRoles.forEach((role) => {
1223
- code += indent(state.tabSize + 3);
1223
+ code += indent((state?.tabSize || 0) + 3);
1224
1224
  code += `${this.app.getNamespace()}.roles.${chineseTsName(role)}.${chineseTsName(role)},`;
1225
1225
  code += '\n';
1226
1226
  });
1227
- code += indent(state.tabSize + 2);
1227
+ code += indent((state?.tabSize || 0) + 2);
1228
1228
  code += '],\n';
1229
1229
  }
1230
1230
  // 绑定属性
@@ -1233,7 +1233,7 @@ export class ViewElement extends BaseNode {
1233
1233
  // 跳转页面
1234
1234
  if (attr.destination) {
1235
1235
  code += attr.destination.toEmbeddedTS(shiftState(state, code, {
1236
- tabSize: state.tabSize,
1236
+ tabSize: (state?.tabSize || 0),
1237
1237
  }));
1238
1238
  }
1239
1239
  });
@@ -1244,7 +1244,7 @@ export class ViewElement extends BaseNode {
1244
1244
  if (Array.isArray(this.bindEvents)) {
1245
1245
  this.bindEvents.forEach((event) => {
1246
1246
  code += event.toEmbeddedTS(shiftState(state, code, {
1247
- tabSize: state.tabSize + 2,
1247
+ tabSize: (state?.tabSize || 0) + 2,
1248
1248
  }));
1249
1249
  code += '\n';
1250
1250
  });
@@ -1252,7 +1252,7 @@ export class ViewElement extends BaseNode {
1252
1252
 
1253
1253
  // 子元素
1254
1254
  if (Array.isArray(this.children)) {
1255
- code += indent(state.tabSize + 1);
1255
+ code += indent((state?.tabSize || 0) + 1);
1256
1256
 
1257
1257
  if (Array.isArray(this.bindAttrs)) {
1258
1258
  code += `bindAttr: () => [\n`;
@@ -1260,7 +1260,7 @@ export class ViewElement extends BaseNode {
1260
1260
  if (attr.expression) {
1261
1261
  code
1262
1262
  += attr.expression.toEmbeddedTS(shiftState(state, code, {
1263
- tabSize: state.tabSize + 2,
1263
+ tabSize: (state?.tabSize || 0) + 2,
1264
1264
  })) + ',\n';
1265
1265
  }
1266
1266
  if (Array.isArray(attr.rules) && attr.rules.length) {
@@ -1273,11 +1273,11 @@ export class ViewElement extends BaseNode {
1273
1273
  if (directive.expression) {
1274
1274
  code
1275
1275
  += directive.expression.toEmbeddedTS(shiftState(state, code, {
1276
- tabSize: state.tabSize + 2,
1276
+ tabSize: (state?.tabSize || 0) + 2,
1277
1277
  })) + ',\n';
1278
1278
  }
1279
1279
  });
1280
- code += indent(state.tabSize + 2) + '],\n';
1280
+ code += indent((state?.tabSize || 0) + 2) + '],\n';
1281
1281
  }
1282
1282
 
1283
1283
  let levelIndex = parentLevel || 0;
@@ -1290,15 +1290,15 @@ export class ViewElement extends BaseNode {
1290
1290
 
1291
1291
  this.children.forEach((element) => {
1292
1292
  code += element.toEmbeddedTS(shiftState(state, code, {
1293
- tabSize: state.tabSize + 2,
1293
+ tabSize: (state?.tabSize || 0) + 2,
1294
1294
  }), levelIndex);
1295
1295
  code += '\n';
1296
1296
  });
1297
- code += indent(state.tabSize + 1);
1297
+ code += indent((state?.tabSize || 0) + 1);
1298
1298
  code += ']\n';
1299
1299
  }
1300
1300
 
1301
- code += indent(state.tabSize) + '}),\n';
1301
+ code += indent((state?.tabSize || 0)) + '}),\n';
1302
1302
 
1303
1303
  return code;
1304
1304
  }
@@ -1673,7 +1673,7 @@ export class ViewElement extends BaseNode {
1673
1673
  if (hasAuto)
1674
1674
  addEmpty = false;
1675
1675
  }
1676
- if (['u-select', 'u-dropdown', 'u-panel'].includes(el.tag)) {
1676
+ if (['u-select', 'u-dropdown', 'u-panel','u-toc','u-toc-item', 'u-tree-view-new','u-tree-view-node-new', 'u-tree-select', 'u-anchor'].includes(el.tag)) {
1677
1677
  addEmpty = false;
1678
1678
  }
1679
1679
  const background = (emptySlot && emptySlot['empty-background']) || (hasSupport ? 'add-sub' : '');
@@ -1801,7 +1801,7 @@ export class ViewElement extends BaseNode {
1801
1801
  //================================================================================
1802
1802
  }
1803
1803
 
1804
- classMap['ViewElement'] = ViewElement;
1804
+ classMap.ViewElement = ViewElement;
1805
1805
  export default ViewElement;
1806
1806
  //================================================================================
1807
1807
  // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑