@lcap/nasl 3.8.0-beta.3 → 3.8.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 (320) hide show
  1. package/out/automate/engine/utils.js +1 -2
  2. package/out/automate/engine/utils.js.map +1 -1
  3. package/out/bak/translator.js +1 -1
  4. package/out/bak/translator.js.map +1 -1
  5. package/out/common/BaseNode.js +7 -2
  6. package/out/common/BaseNode.js.map +1 -1
  7. package/out/concepts/App__.js +6 -1
  8. package/out/concepts/App__.js.map +1 -1
  9. package/out/concepts/Argument__.js +11 -5
  10. package/out/concepts/Argument__.js.map +1 -1
  11. package/out/concepts/AuthLogicForCallInterface__.js +3 -0
  12. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  13. package/out/concepts/BinaryExpression__.js +49 -2
  14. package/out/concepts/BinaryExpression__.js.map +1 -1
  15. package/out/concepts/BindAttribute__.d.ts +4 -3
  16. package/out/concepts/BindAttribute__.js +121 -42
  17. package/out/concepts/BindAttribute__.js.map +1 -1
  18. package/out/concepts/BindEvent__.js +5 -42
  19. package/out/concepts/BindEvent__.js.map +1 -1
  20. package/out/concepts/BusinessComponent__.d.ts +1 -0
  21. package/out/concepts/BusinessComponent__.js +16 -0
  22. package/out/concepts/BusinessComponent__.js.map +1 -1
  23. package/out/concepts/BusinessLogic__.js +3 -0
  24. package/out/concepts/BusinessLogic__.js.map +1 -1
  25. package/out/concepts/CallConnector__.js +1 -1
  26. package/out/concepts/CallConnector__.js.map +1 -1
  27. package/out/concepts/CallFunction__.js +1 -1
  28. package/out/concepts/CallFunction__.js.map +1 -1
  29. package/out/concepts/CallLogic__.d.ts +6 -1
  30. package/out/concepts/CallLogic__.js +58 -17
  31. package/out/concepts/CallLogic__.js.map +1 -1
  32. package/out/concepts/Connection__.d.ts +4 -0
  33. package/out/concepts/Connection__.js +15 -0
  34. package/out/concepts/Connection__.js.map +1 -1
  35. package/out/concepts/DatabaseTypeAnnotation__.d.ts +2 -0
  36. package/out/concepts/DatabaseTypeAnnotation__.js +20 -0
  37. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  38. package/out/concepts/End__.js +5 -1
  39. package/out/concepts/End__.js.map +1 -1
  40. package/out/concepts/EntityProperty__.js +2 -0
  41. package/out/concepts/EntityProperty__.js.map +1 -1
  42. package/out/concepts/Entity__.d.ts +1 -0
  43. package/out/concepts/Entity__.js +24 -1
  44. package/out/concepts/Entity__.js.map +1 -1
  45. package/out/concepts/EnumItem__.d.ts +12 -0
  46. package/out/concepts/EnumItem__.js +49 -5
  47. package/out/concepts/EnumItem__.js.map +1 -1
  48. package/out/concepts/Enum__.js +4 -1
  49. package/out/concepts/Enum__.js.map +1 -1
  50. package/out/concepts/ForEachStatement__.js +1 -1
  51. package/out/concepts/ForEachStatement__.js.map +1 -1
  52. package/out/concepts/FrontendLibrary__.d.ts +46 -46
  53. package/out/concepts/FrontendLibrary__.js +34 -36
  54. package/out/concepts/FrontendLibrary__.js.map +1 -1
  55. package/out/concepts/I18nInfo__.d.ts +1 -0
  56. package/out/concepts/I18nInfo__.js +7 -0
  57. package/out/concepts/I18nInfo__.js.map +1 -1
  58. package/out/concepts/IfStatement__.js +2 -2
  59. package/out/concepts/IfStatement__.js.map +1 -1
  60. package/out/concepts/Interface__.js +4 -1
  61. package/out/concepts/Interface__.js.map +1 -1
  62. package/out/concepts/Logic__.d.ts +2 -3
  63. package/out/concepts/Logic__.js +33 -8
  64. package/out/concepts/Logic__.js.map +1 -1
  65. package/out/concepts/MatchCase__.d.ts +2 -2
  66. package/out/concepts/MatchCase__.js +7 -7
  67. package/out/concepts/MatchCase__.js.map +1 -1
  68. package/out/concepts/NewComposite__.js +2 -1
  69. package/out/concepts/NewComposite__.js.map +1 -1
  70. package/out/concepts/NewList__.js +2 -1
  71. package/out/concepts/NewList__.js.map +1 -1
  72. package/out/concepts/NewMap__.js +2 -1
  73. package/out/concepts/NewMap__.js.map +1 -1
  74. package/out/concepts/OqlQueryComponent__.js +3 -11
  75. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  76. package/out/concepts/OverriddenLogic__.js +7 -0
  77. package/out/concepts/OverriddenLogic__.js.map +1 -1
  78. package/out/concepts/Param__.js +2 -1
  79. package/out/concepts/Param__.js.map +1 -1
  80. package/out/concepts/ProcessElementV2__.d.ts +4 -5
  81. package/out/concepts/ProcessElementV2__.js +12 -17
  82. package/out/concepts/ProcessElementV2__.js.map +1 -1
  83. package/out/concepts/ProcessElement__.d.ts +3 -4
  84. package/out/concepts/ProcessElement__.js +44 -46
  85. package/out/concepts/ProcessElement__.js.map +1 -1
  86. package/out/concepts/ProcessV2__.d.ts +5 -0
  87. package/out/concepts/ProcessV2__.js +30 -2
  88. package/out/concepts/ProcessV2__.js.map +1 -1
  89. package/out/concepts/Process__.d.ts +5 -0
  90. package/out/concepts/Process__.js +28 -0
  91. package/out/concepts/Process__.js.map +1 -1
  92. package/out/concepts/QueryFromExpression__.js +2 -2
  93. package/out/concepts/QueryFromExpression__.js.map +1 -1
  94. package/out/concepts/QueryJoinExpression__.js +2 -2
  95. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  96. package/out/concepts/Return__.d.ts +1 -1
  97. package/out/concepts/Return__.js +2 -1
  98. package/out/concepts/Return__.js.map +1 -1
  99. package/out/concepts/StaticString__.d.ts +4 -0
  100. package/out/concepts/StaticString__.js +11 -0
  101. package/out/concepts/StaticString__.js.map +1 -1
  102. package/out/concepts/StructureProperty__.js +5 -2
  103. package/out/concepts/StructureProperty__.js.map +1 -1
  104. package/out/concepts/Structure__.js +9 -3
  105. package/out/concepts/Structure__.js.map +1 -1
  106. package/out/concepts/SubLogic__.d.ts +1 -3
  107. package/out/concepts/SubLogic__.js +14 -8
  108. package/out/concepts/SubLogic__.js.map +1 -1
  109. package/out/concepts/Transactional__.d.ts +1 -0
  110. package/out/concepts/Transactional__.js +7 -0
  111. package/out/concepts/Transactional__.js.map +1 -1
  112. package/out/concepts/TypeParam__.d.ts +4 -0
  113. package/out/concepts/TypeParam__.js +3 -0
  114. package/out/concepts/TypeParam__.js.map +1 -1
  115. package/out/concepts/ValidationRule__.d.ts +1 -6
  116. package/out/concepts/ValidationRule__.js +9 -6
  117. package/out/concepts/ValidationRule__.js.map +1 -1
  118. package/out/concepts/Variable__.d.ts +1 -1
  119. package/out/concepts/Variable__.js +7 -2
  120. package/out/concepts/Variable__.js.map +1 -1
  121. package/out/concepts/ViewElement__.d.ts +2 -0
  122. package/out/concepts/ViewElement__.js +130 -47
  123. package/out/concepts/ViewElement__.js.map +1 -1
  124. package/out/concepts/View__.d.ts +8 -0
  125. package/out/concepts/View__.js +123 -7
  126. package/out/concepts/View__.js.map +1 -1
  127. package/out/concepts/basics/stdlib/nasl.processV2.js +2 -2
  128. package/out/concepts/basics/stdlib/nasl.processV2.js.map +1 -1
  129. package/out/concepts/basics/stdlib/nasl.ui.js +1 -1
  130. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  131. package/out/concepts/basics/stdlib/nasl.validation.js +110 -4
  132. package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
  133. package/out/generator/genBundleFiles.d.ts +2 -0
  134. package/out/generator/genBundleFiles.js +51 -37
  135. package/out/generator/genBundleFiles.js.map +1 -1
  136. package/out/generator/genMetaData.js +20 -26
  137. package/out/generator/genMetaData.js.map +1 -1
  138. package/out/generator/release-body/body.js +8 -6
  139. package/out/generator/release-body/body.js.map +1 -1
  140. package/out/generator/release-body/index.d.ts +1 -0
  141. package/out/generator/release-body/index.js +1 -0
  142. package/out/generator/release-body/index.js.map +1 -1
  143. package/out/generator/release-body/utils.js +1 -1
  144. package/out/generator/release-body/utils.js.map +1 -1
  145. package/out/natural/genNaturalTS.d.ts +56 -24
  146. package/out/natural/genNaturalTS.js +182 -112
  147. package/out/natural/genNaturalTS.js.map +1 -1
  148. package/out/natural/getContext/getUILib.js +4 -2
  149. package/out/natural/getContext/getUILib.js.map +1 -1
  150. package/out/natural/getContext/index.d.ts +34 -25
  151. package/out/natural/getContext/index.js +304 -157
  152. package/out/natural/getContext/index.js.map +1 -1
  153. package/out/natural/index.d.ts +1 -0
  154. package/out/natural/index.js +1 -0
  155. package/out/natural/index.js.map +1 -1
  156. package/out/natural/tools.d.ts +11 -0
  157. package/out/natural/tools.js +155 -0
  158. package/out/natural/tools.js.map +1 -0
  159. package/out/natural/transformTS2UI.js +84 -22
  160. package/out/natural/transformTS2UI.js.map +1 -1
  161. package/out/natural/transformTSCode.js +83 -22
  162. package/out/natural/transformTSCode.js.map +1 -1
  163. package/out/server/formatTsUtils.js +17 -1
  164. package/out/server/formatTsUtils.js.map +1 -1
  165. package/out/server/getLogics.js +1 -4
  166. package/out/server/getLogics.js.map +1 -1
  167. package/out/server/naslServer.js +285 -32
  168. package/out/server/naslServer.js.map +1 -1
  169. package/out/server/translator.js +5 -1
  170. package/out/server/translator.js.map +1 -1
  171. package/out/templator/genCreateBlock.js +5 -18
  172. package/out/templator/genCreateBlock.js.map +1 -1
  173. package/out/templator/genCurdMultipleKeyBlock.js +11 -32
  174. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  175. package/out/templator/genGetBlock.js +1 -2
  176. package/out/templator/genGetBlock.js.map +1 -1
  177. package/out/templator/genListViewBlock.js +6 -4
  178. package/out/templator/genListViewBlock.js.map +1 -1
  179. package/out/templator/genSelectBlock.js +82 -59
  180. package/out/templator/genSelectBlock.js.map +1 -1
  181. package/out/templator/genTableBlock.js +4 -4
  182. package/out/templator/genTableBlock.js.map +1 -1
  183. package/out/templator/genUpdateBlock.js +2 -15
  184. package/out/templator/genUpdateBlock.js.map +1 -1
  185. package/out/templator/utils.d.ts +1 -1
  186. package/out/templator/utils.js +1 -1
  187. package/out/templator/utils.js.map +1 -1
  188. package/out/translator/types.d.ts +4 -0
  189. package/out/translator/utils.d.ts +1 -0
  190. package/out/translator/utils.js +6 -1
  191. package/out/translator/utils.js.map +1 -1
  192. package/out/utils/env.d.ts +4 -0
  193. package/out/utils/env.js +6 -3
  194. package/out/utils/env.js.map +1 -1
  195. package/out/utils/index.d.ts +19 -0
  196. package/out/utils/index.js +61 -1
  197. package/out/utils/index.js.map +1 -1
  198. package/out/utils/language-cache/constant.d.ts +18 -0
  199. package/out/utils/language-cache/constant.js +35 -0
  200. package/out/utils/language-cache/constant.js.map +1 -0
  201. package/out/utils/language-cache/index.d.ts +2 -0
  202. package/out/utils/language-cache/index.js +19 -0
  203. package/out/utils/language-cache/index.js.map +1 -0
  204. package/out/utils/language-cache/nasl.d.ts +10 -0
  205. package/out/utils/language-cache/nasl.js +98 -0
  206. package/out/utils/language-cache/nasl.js.map +1 -0
  207. package/out/utils/language-cache/types.d.ts +44 -0
  208. package/out/utils/language-cache/types.js +4 -0
  209. package/out/utils/language-cache/types.js.map +1 -0
  210. package/out/utils/time-slicing/controller.js.map +1 -1
  211. package/out/utils/types.d.ts +17 -0
  212. package/package.json +3 -2
  213. package/sandbox/stdlib/nasl.core.ts +15 -11
  214. package/sandbox/stdlib/nasl.oql.ts +5 -1
  215. package/sandbox/stdlib/nasl.processV2.ts +5 -4
  216. package/sandbox/stdlib/nasl.ui.components.pc.ts +225 -225
  217. package/sandbox/stdlib/nasl.ui.ts +10 -0
  218. package/sandbox/stdlib/nasl.util.ts +11 -0
  219. package/sandbox/stdlib/nasl.validation.ts +3 -2
  220. package/sandbox-natural/stdlib/nasl.ui.pre.d.ts +1 -1
  221. package/sandbox-natural/stdlib/nasl.ui.ts +2 -2
  222. package/sandbox-natural/stdlib/nasl.util.ts +2 -2
  223. package/src/automate/engine/utils.js +1 -2
  224. package/src/bak/translator.js +1 -1
  225. package/src/common/BaseNode.ts +7 -3
  226. package/src/concepts/App__.ts +9 -1
  227. package/src/concepts/Argument__.ts +10 -5
  228. package/src/concepts/AuthLogicForCallInterface__.ts +3 -0
  229. package/src/concepts/BinaryExpression__.ts +46 -2
  230. package/src/concepts/BindAttribute__.ts +144 -46
  231. package/src/concepts/BindEvent__.ts +8 -47
  232. package/src/concepts/BusinessComponent__.ts +17 -0
  233. package/src/concepts/BusinessLogic__.ts +3 -0
  234. package/src/concepts/CallConnector__.ts +1 -1
  235. package/src/concepts/CallFunction__.ts +1 -1
  236. package/src/concepts/CallLogic__.ts +63 -17
  237. package/src/concepts/Connection__.ts +16 -0
  238. package/src/concepts/DatabaseTypeAnnotation__.ts +11 -0
  239. package/src/concepts/End__.ts +5 -1
  240. package/src/concepts/EntityProperty__.ts +5 -0
  241. package/src/concepts/Entity__.ts +29 -1
  242. package/src/concepts/EnumItem__.ts +64 -1
  243. package/src/concepts/Enum__.ts +6 -1
  244. package/src/concepts/ForEachStatement__.ts +1 -1
  245. package/src/concepts/FrontendLibrary__.ts +78 -80
  246. package/src/concepts/I18nInfo__.ts +5 -0
  247. package/src/concepts/IfStatement__.ts +2 -2
  248. package/src/concepts/Interface__.ts +6 -1
  249. package/src/concepts/Logic__.ts +39 -10
  250. package/src/concepts/MatchCase__.ts +8 -9
  251. package/src/concepts/NewComposite__.ts +2 -1
  252. package/src/concepts/NewList__.ts +2 -1
  253. package/src/concepts/NewMap__.ts +2 -1
  254. package/src/concepts/OqlQueryComponent__.ts +3 -11
  255. package/src/concepts/OverriddenLogic__.ts +7 -0
  256. package/src/concepts/Param__.ts +1 -0
  257. package/src/concepts/ProcessElementV2__.ts +14 -16
  258. package/src/concepts/ProcessElement__.ts +16 -16
  259. package/src/concepts/ProcessV2__.ts +39 -3
  260. package/src/concepts/Process__.ts +36 -0
  261. package/src/concepts/QueryFromExpression__.ts +2 -2
  262. package/src/concepts/QueryJoinExpression__.ts +2 -2
  263. package/src/concepts/Return__.ts +2 -1
  264. package/src/concepts/StaticString__.ts +12 -0
  265. package/src/concepts/StructureProperty__.ts +7 -2
  266. package/src/concepts/Structure__.ts +11 -3
  267. package/src/concepts/SubLogic__.ts +15 -9
  268. package/src/concepts/Transactional__.ts +5 -0
  269. package/src/concepts/TypeParam__.ts +6 -0
  270. package/src/concepts/ValidationRule__.ts +7 -6
  271. package/src/concepts/Variable__.ts +7 -2
  272. package/src/concepts/ViewElement__.ts +130 -47
  273. package/src/concepts/View__.ts +157 -8
  274. package/src/concepts/basics/stdlib/nasl.processV2.ts +2 -2
  275. package/src/concepts/basics/stdlib/nasl.ui.ts +1 -1
  276. package/src/concepts/basics/stdlib/nasl.validation.ts +111 -4
  277. package/src/generator/genBundleFiles.ts +53 -39
  278. package/src/generator/genMetaData.ts +21 -26
  279. package/src/generator/release-body/body.ts +9 -6
  280. package/src/generator/release-body/index.ts +1 -0
  281. package/src/generator/release-body/utils.ts +4 -2
  282. package/src/natural/genNaturalTS.ts +327 -141
  283. package/src/natural/getContext/getUILib.ts +4 -2
  284. package/src/natural/getContext/index.ts +348 -171
  285. package/src/natural/index.ts +1 -0
  286. package/src/natural/tools.ts +130 -0
  287. package/src/natural/transformTS2UI.ts +84 -22
  288. package/src/natural/transformTSCode.ts +83 -22
  289. package/src/server/formatTsUtils.ts +21 -1
  290. package/src/server/getLogics.ts +1 -4
  291. package/src/server/naslServer.ts +302 -33
  292. package/src/server/translator.ts +5 -1
  293. package/src/templator/genCreateBlock.ts +5 -18
  294. package/src/templator/genCurdMultipleKeyBlock.ts +14 -32
  295. package/src/templator/genGetBlock.ts +2 -4
  296. package/src/templator/genListViewBlock.ts +6 -4
  297. package/src/templator/genSelectBlock.ts +88 -61
  298. package/src/templator/genTableBlock.ts +4 -4
  299. package/src/templator/genUpdateBlock.ts +2 -15
  300. package/src/templator/utils.ts +1 -1
  301. package/src/translator/types.ts +4 -0
  302. package/src/translator/utils.ts +6 -0
  303. package/src/utils/env.ts +5 -4
  304. package/src/utils/index.ts +50 -1
  305. package/src/utils/language-cache/constant.ts +37 -0
  306. package/src/utils/language-cache/index.ts +2 -0
  307. package/src/utils/language-cache/nasl.ts +83 -0
  308. package/src/utils/language-cache/types.ts +48 -0
  309. package/src/utils/time-slicing/controller.ts +0 -1
  310. package/src/utils/types.ts +20 -0
  311. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +13 -13
  312. package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +12 -12
  313. package/test/concepts/validation-rule/__snapshots__/toEmbeddedTS.spec.ts.snap +1 -2
  314. package/test/concepts/view-element/__snapshots__/toEmbeddedTS.spec.ts.snap +221 -217
  315. package/ts-worker/bundle.js +1 -1
  316. package/ts-worker/src/index.js +0 -1
  317. package/out/utils/delay/index.d.ts +0 -0
  318. package/out/utils/delay/index.js +0 -1
  319. package/out/utils/delay/index.js.map +0 -1
  320. package/src/utils/delay/index.ts +0 -0
@@ -125,6 +125,16 @@ declare namespace nasl.ui {
125
125
  dirty: nasl.core.Boolean;
126
126
  firstError: nasl.core.String;
127
127
  }
128
+ export class ValidateResult {
129
+ rawValue: nasl.core.String;
130
+ value: nasl.core.String;
131
+ trigger: nasl.core.String;
132
+ muted: nasl.core.String;
133
+ valid: nasl.core.Boolean;
134
+ touched: nasl.core.Boolean;
135
+ dirty: nasl.core.Boolean;
136
+ firstError: nasl.core.String;
137
+ }
128
138
  export class PaginationEvent {
129
139
  page: nasl.core.Long;
130
140
  oldPage: nasl.core.Long;
@@ -147,4 +147,15 @@ declare namespace nasl.util {
147
147
  export function callLogicWithChecker<T extends (...args: any[]) => any>(func: T, checker: (...args: Parameters<T>) => any): T;
148
148
  // 分页组件函数
149
149
  export function paginateLimit<T>(list: nasl.collection.List<T>, page: nasl.core.Long, size: nasl.core.Long): { list: nasl.collection.List<T>, total: nasl.core.Long };
150
+
151
+ // 判断ReturnType是否包含‘enums’, 只给组件属性校验使用
152
+ export function bindAttrWrap<T extends (...args: any[]) => any, I extends boolean>(func: T, ignore: I): I extends true
153
+ ? any
154
+ : ReturnType<T> extends nasl.core.Enums<any>
155
+ ? any
156
+ : ReturnType<T> extends nasl.collection.List<infer E>
157
+ ? E extends nasl.core.Enums<any>
158
+ ? any
159
+ : ReturnType<T>
160
+ : ReturnType<T>;
150
161
  }
@@ -5,7 +5,7 @@ declare namespace nasl.validation {
5
5
  export function min(min: nasl.core.Decimal | nasl.core.String | nasl.core.Date | nasl.core.DateTime): nasl.core.Boolean;
6
6
  export function max(min: nasl.core.Decimal | nasl.core.String | nasl.core.Date | nasl.core.DateTime): nasl.core.Boolean;
7
7
  export function range(min: nasl.core.Decimal | nasl.core.String | nasl.core.Date | nasl.core.DateTime, max: nasl.core.Decimal | nasl.core.String | nasl.core.Date | nasl.core.DateTime): nasl.core.Boolean;
8
- export function pattern(re: nasl.core.String | RegExp): nasl.core.Boolean;
8
+ export function pattern(re: nasl.core.String | RegExp, strict?: nasl.core.Boolean, matchCase?: nasl.core.Boolean): nasl.core.Boolean;
9
9
  export function is(arg: nasl.core.Any): nasl.core.Boolean;
10
10
  export function isNot(arg: nasl.core.Any): nasl.core.Boolean;
11
11
  export function equals(arg: nasl.core.Any): nasl.core.Boolean;
@@ -26,7 +26,8 @@ declare namespace nasl.validation {
26
26
  export function hash(algorithm?: nasl.core.String): nasl.core.Boolean;
27
27
  export function isbn(version: nasl.core.String): nasl.core.Boolean;
28
28
  export function iso8601(strict: nasl.core.Boolean): nasl.core.Boolean;
29
- export function mobile(locale?: nasl.core.String | nasl.collection.List<nasl.core.String>, strict?: nasl.core.Boolean): nasl.core.Boolean;
29
+ export function creditCard(types: nasl.collection.List<nasl.core.String>): nasl.core.Boolean;
30
+ export function mobile(locale: nasl.core.String | nasl.collection.List<nasl.core.String>, strict: nasl.core.Boolean): nasl.core.Boolean;
30
31
  export function postalCode(locale: nasl.core.String | nasl.collection.List<nasl.core.String>): nasl.core.Boolean;
31
32
  export function uuid(version?: nasl.core.String): nasl.core.Boolean;
32
33
  export function errorMessage(message?: nasl.core.Any): nasl.core.String;
@@ -67,7 +67,7 @@ declare namespace nasl.ui {
67
67
  which: nasl.core.Integer;
68
68
  }
69
69
 
70
- export interface ValidateEvent {
70
+ export interface ValidateResult {
71
71
  rawValue: nasl.core.String;
72
72
  value: nasl.core.String;
73
73
  trigger: nasl.core.String;
@@ -1,7 +1,7 @@
1
1
  declare namespace nasl.ui {
2
2
  export interface MouseEvent { }
3
3
 
4
- export interface ValidateEvent { valid: Boolean; }
4
+ export interface ValidateResult { valid: Boolean; }
5
5
 
6
6
  export class Button {
7
7
  constructor(options?: {
@@ -14,7 +14,7 @@ declare namespace nasl.ui {
14
14
  export class Form {
15
15
  constructor(options?: {});
16
16
 
17
- validate(): ValidateEvent;
17
+ validate(): ValidateResult;
18
18
  }
19
19
 
20
20
  export class Modal {
@@ -36,8 +36,8 @@ declare namespace nasl.util {
36
36
  export function AlterDateTime<T extends Date | DateTime>(dateTime: T, option: 'Increase' | 'Decrease', amount: Long, unit: 'day' | 'week' | 'month' | 'quarter' | 'year'): T;
37
37
  /* 按指定维度计算日期,如“所在年-第几周”。当输入为 DateTime 类型时,会把数据转到提供的时区的当地时间进行计算。*/
38
38
  export function GetDateCount<T extends Date | DateTime>(dateTime: T, metric: 'week-year', timeZone: string): Time;
39
- /* 按“星期几”获取指定日期范围内的日子。当输入为 DateTime 类型时,会把数据转到提供的时区的当地时间进行计算。*/
40
- export function GetSpecificDaysOfWeek<T extends Date | DateTime>(startDate: T, endDate: T, target: List<Long>, timeZone: string): Time;
39
+ /* 按“星期几”获取指定日期范围内的日子。当输入为 DateTime 类型时,会把数据转到提供的时区的当地时间进行计算。target 取值范围 [1,2,3,4,5,6,7] */
40
+ export function GetSpecificDaysOfWeek<T extends Date | DateTime>(startDate: T, endDate: T, target: List<Long>, timeZone?: String): List<T>;
41
41
 
42
42
  // 列表(List)函数
43
43
  export function Add<T, K extends T>(list: List<T>, item: K): void;
@@ -82,8 +82,7 @@ export function getNaslNodeByNodeCallee(namespace, typeName) {
82
82
  return interfaceStructures.find((item) => item.name === typeName);
83
83
  } else if (namespace === 'nasl.process') {
84
84
  return processStructures.find((item) => item.name === typeName);
85
- } else if (namespace === 'nasl.processV2') {
86
- console.log(123)
85
+ } else if (namespace?.includes('nasl.processV2')) {
87
86
  const findStructure = processV2Structures.find((item) => item.name === typeName);
88
87
  if(findStructure) {
89
88
  return findStructure;
@@ -29,7 +29,7 @@ function genVarInitialVal(variable, URLParamRetrieval) {
29
29
  code += `this.$genInitFromSchema('${sortedTypeKey}', `;
30
30
  }
31
31
  if (variable.concept === 'Param' && URLParamRetrieval) {
32
- code += `this.$route.query.hasOwnProperty('${variable.name}') ? this.$genInitFromSchema('${sortedTypeKey}', this.$route.query.${variable.name}) :`;
32
+ code += `this.$route.query.hasOwnProperty('${variable.name}') && !['undefined', 'null'].includes(this.$route.query.${variable.name}) ? this.$genInitFromSchema('${sortedTypeKey}', this.$route.query.${variable.name}) :`;
33
33
  }
34
34
  const { defaultValue } = variable;
35
35
  // 设置成null,才能同步给后端清除该值,但是null对checkbox组件是一种特殊状态
@@ -30,7 +30,6 @@ const patchCompose = (node: BaseNode, type = 'add') => {
30
30
  }
31
31
  }
32
32
 
33
-
34
33
  type NodePathOption = {
35
34
  useName?: boolean,
36
35
  }
@@ -328,7 +327,10 @@ export class BaseNode extends EventEmitter {
328
327
  (app?.getDefaultOnAnno()?.[source.concept] as any)?.map((anno:any)=>{
329
328
  if((this as any)?.applyAnnotations?.length>0){
330
329
  // (this as any)?._addApplyAnnotation(anno?.transToApplyAnno())
331
- (this as any)?.applyAnnotations.push(anno?.transToApplyAnno())
330
+ let aanno = anno?.transToApplyAnno()
331
+ if(!(this as any)?.applyAnnotations?.find((aa:any)=>aa.annotationName===aanno.annotationName)){
332
+ (this as any)?.applyAnnotations.push(aanno)
333
+ }
332
334
  }else{
333
335
  (this as any).applyAnnotations = [anno?.transToApplyAnno()]
334
336
  // this.update({
@@ -809,7 +811,9 @@ export class BaseNode extends EventEmitter {
809
811
  // 有一些继承的情况
810
812
  const Ctor = classMap.get(source?.concept) || this;
811
813
  if (Ctor && source instanceof Ctor) {
812
- console.warn('传入的对象已经是一个实例,请确认逻辑是否存在问题!')
814
+ if (utils.isDebugMode) {
815
+ console.warn('传入的对象已经是一个实例,请确认逻辑是否存在问题!');
816
+ }
813
817
  if (parentNode) {
814
818
  source.parentNode = parentNode;
815
819
  }
@@ -3644,7 +3644,7 @@ export class App extends BaseNode {
3644
3644
  if (dep?.annotations?.length > 0) {
3645
3645
  dep.annotations.forEach((anno) => {
3646
3646
  let useAnno:any = anno?.properties?.find((p) => p?.name === 'useAnno');
3647
- if (useAnno && useAnno.defaultValue?.expression?.value === 'true') {
3647
+ if (useAnno && ['true',true].includes(useAnno.defaultValue?.expression?.value) ) {
3648
3648
  anno.applyTo.map((concept) => {
3649
3649
  result[concept].push(anno);
3650
3650
  });
@@ -4131,9 +4131,14 @@ export class App extends BaseNode {
4131
4131
  const jsName = `${prefix}/packages/${
4132
4132
  prefixPath ? `${prefixPath}/` : ''
4133
4133
  }${name}@${version}/dist-theme/index.js`;
4134
+ const cssName = `${prefix}/packages/${
4135
+ prefixPath ? `${prefixPath}/` : ''
4136
+ }${name}@${version}/dist-theme/index.css`;
4137
+
4134
4138
  if (!existingSet.has(jsName)) {
4135
4139
  existingSet.add(jsName);
4136
4140
  result.custom.js.push(jsName);
4141
+ result.custom.css.push(cssName);
4137
4142
  result.custom.names.push(dep.name);
4138
4143
  }
4139
4144
  }
@@ -4408,6 +4413,9 @@ export class App extends BaseNode {
4408
4413
  frontendType?.frontends?.forEach((frontend) => {
4409
4414
  resultLogics = [...resultLogics, ...frontend.getExtensionsCallbackLogics()];
4410
4415
  });
4416
+ frontendType?.businessComponents?.forEach((businessComponent) => {
4417
+ resultLogics = [...resultLogics, ...(businessComponent?.getViewCallLogics?.() || [])];
4418
+ });
4411
4419
  });
4412
4420
  return Array.from(new Set(resultLogics));
4413
4421
  }
@@ -150,9 +150,8 @@ export class Argument extends LogicItem {
150
150
 
151
151
  toJS(state?: TranslatorState): string {
152
152
  let code = this.spread ? '...' : '';
153
- if (this.expression) {
154
- const resultCode = this.expression.toJS(state);
155
- const { typeName, typeNamespace } = (this.expression as any)?.__nodeType || {};
153
+ if (this.expression || this.paramDefaultValue) {
154
+ const resultCode = this.expression?.toJS?.(state) || this.paramDefaultValue?.toJS(state);
156
155
  code += resultCode;
157
156
  } else {
158
157
  code += 'undefined';
@@ -309,6 +308,7 @@ export class Argument extends LogicItem {
309
308
  fromSubLogicBySignature(typeAnnotation: TypeAnnotation): SubLogic {
310
309
  if (!asserts.isTypeAnnotation(typeAnnotation)) return;
311
310
  const parentLogic = this.getAncestor('Logic');
311
+ const parentView = this.getAncestor('View');
312
312
  const callLogic = this.getAncestor('CallLogic');
313
313
  if (!asserts.isCallLogic(callLogic)) return;
314
314
 
@@ -344,8 +344,13 @@ export class Argument extends LogicItem {
344
344
  }
345
345
  )
346
346
 
347
- if (!asserts.isLogic(parentLogic)) return;
348
- const uniqueName = parentLogic.getSubLogicUniqueName();
347
+ let uniqueName = '';
348
+ if (asserts.isLogic(parentLogic)) {
349
+ uniqueName = parentLogic.getSubLogicUniqueName();
350
+ } else if (asserts.isView(parentView)) {
351
+ uniqueName = parentView.getSubLogicUniqueName();
352
+ }
353
+ if (!uniqueName) return;
349
354
  return this.createSubLogic({
350
355
  name: uniqueName,
351
356
  params: paramTypes,
@@ -362,6 +362,9 @@ export class AuthLogicForCallInterface extends AuthLogic {
362
362
  // 内置函数对集合类型的推导
363
363
  (asserts.isCallFunction(el) && el.derivablecollection?.name))
364
364
  ) {
365
+ if (el?.getAncestor('SubLogic')) {
366
+ return;
367
+ }
365
368
  if (asserts.isAssignment(el)) {
366
369
  const advanceVar = self.variables?.find(
367
370
  (variable) => !variable.typeAnnotation && el.left?.name === variable.name,
@@ -210,6 +210,9 @@ export class BinaryExpression extends LogicItem {
210
210
  }
211
211
 
212
212
  toVue(options?: ElementToVueOptions) {
213
+ if (options?.finalCode === false) {
214
+ return this.toUI(options);
215
+ }
213
216
  if (['startwith', 'endwith'].includes(this.operator)) {
214
217
  const operatorMap = {
215
218
  startwith: 'startsWith',
@@ -224,9 +227,50 @@ export class BinaryExpression extends LogicItem {
224
227
  return code;
225
228
  }
226
229
  let code = '';
227
- code += `(${this.left?.toVue(options) || ''})`;
230
+ const left = this.left?.toVue(options) || '';
231
+ const right = this.right?.toVue(options) || '';
232
+ if (['+', '-', '*', '/'].includes(this.operator)) {
233
+ const operatorMap: any = {
234
+ '+': 'add',
235
+ '-': 'minus',
236
+ '*': 'multiply',
237
+ '/': 'divide',
238
+ };
239
+ code += `$global.${operatorMap[this.operator as keyof typeof operatorMap]}(`;
240
+ code += left;
241
+ code += `,`;
242
+ code += right;
243
+ code += ')';
244
+ return code;
245
+ }
246
+ if (['>', '>=', '<', '<='].includes(this.operator)) {
247
+ const leftType = this.left?.getCurrentAnnotatedJSON();
248
+ const rightType = this.right?.getCurrentAnnotatedJSON();
249
+ // 如果两边类型一致可以做一些特殊比较
250
+ if (leftType?.typeKey === rightType?.typeKey) {
251
+ if (leftType?.typeName === 'Time') {
252
+ code += `Date.parse('2000-01-01T' + ${left})`;
253
+ code += ` ${this.operator} `;
254
+ code += `Date.parse('2000-01-01T' + ${right})`;
255
+ } else if (leftType?.typeName === 'Date' || leftType?.typeName === 'DateTime') {
256
+ code += `Date.parse(${left})`;
257
+ code += ` ${this.operator} `;
258
+ code += `Date.parse(${right})`;
259
+ } else {
260
+ code += `(${left})`;
261
+ code += ` ${this.operator} `;
262
+ code += `(${right})`;
263
+ }
264
+ } else {
265
+ code += `(${left})`;
266
+ code += ` ${this.operator} `;
267
+ code += `(${right})`;
268
+ }
269
+ return code;
270
+ }
271
+ code += `(${left})`;
228
272
  code += ` ${this.operator} `;
229
- code += `(${this.right?.toVue(options) || ''})`;
273
+ code += `(${right})`;
230
274
  return code;
231
275
  }
232
276
 
@@ -1,3 +1,4 @@
1
+ import * as json5 from 'json5';
1
2
  import { wrapForEachToGenerator as wrapForEach } from '../utils/time-slicing';
2
3
  import {
3
4
  TranslatorState,
@@ -10,17 +11,18 @@ import {
10
11
  withGenerator,
11
12
  TranslatorGenerator,
12
13
  } from '../translator';
13
- import { ElementToVueOptions } from './ViewElement__';
14
+ import ViewElement, { ElementToVueOptions } from './ViewElement__';
14
15
  import type Namespace from './Namespace__';
15
16
  import type MemberExpression from './MemberExpression__';
17
+ import CallFunction from './CallFunction__';
16
18
 
17
- import ViewElement from './ViewElement__';
18
19
  import View from './View__';
19
20
  import Module from './Module__';
20
21
  import Frontend from './Frontend__';
21
22
  import ProcessElement from './ProcessElement__';
22
23
  import Process from './Process__';
23
24
  import { kebab2Camel } from '../utils';
25
+ import { config } from '../config';
24
26
  //================================================================================
25
27
  // 从这里开始到结尾注释之间的代码由 NASL Workbench 自动生成,请不手动修改!
26
28
  // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
@@ -47,11 +49,13 @@ import AssigneeV2 from './AssigneeV2__';
47
49
  export class BindAttribute extends BaseNode {
48
50
  /** 类名 */
49
51
  static readonly ConceptName: string = 'BindAttribute';
52
+
50
53
  /**
51
54
  * 是否为抽象类
52
55
  * 抽象类不能产生 concept: string
53
56
  */
54
57
  static isAbstract: boolean = false;
58
+
55
59
  /** 继承链 */
56
60
  static readonly inheritanceChain: string[] = ['BaseNode'];
57
61
 
@@ -61,6 +65,7 @@ export class BindAttribute extends BaseNode {
61
65
  @property('concept')
62
66
  // @ts-ignore
63
67
  readonly concept!: 'BindAttribute';
68
+
64
69
  /**
65
70
  * 元素绑定属性名称
66
71
  */
@@ -161,7 +166,7 @@ export class BindAttribute extends BaseNode {
161
166
  * @param source 需要合并的部分参数
162
167
  */
163
168
  constructor(source?: Partial<BindAttribute>) {
164
- source = Object.assign({}, BindAttribute.getDefaultOptions(), source);
169
+ source = { ...BindAttribute.getDefaultOptions(), ...source};
165
170
  super(source);
166
171
  super.subConstructor(source);
167
172
  }
@@ -273,6 +278,7 @@ export class BindAttribute extends BaseNode {
273
278
  const excludedSet = new Set(excludedList);
274
279
  return ((this.rules as ValidationRule[]) || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
275
280
  }
281
+
276
282
  getValidationRuleUniqueName(name = 'validationRule1') {
277
283
  return utils.unique(name, this.getValidationRuleExistingNames(), undefined, false);
278
284
  }
@@ -541,7 +547,7 @@ export class BindAttribute extends BaseNode {
541
547
  if (typeof options === 'string') {
542
548
  validationRule = (this.rules as ValidationRule[]).find((item) => item.name === options);
543
549
  if (!validationRule) {
544
- throw new Error('找不到验证规则 ' + options);
550
+ throw new Error(`找不到验证规则 ${ options}`);
545
551
  }
546
552
  } else {
547
553
  validationRule = options;
@@ -556,7 +562,7 @@ export class BindAttribute extends BaseNode {
556
562
  removeItem(logicItem: LogicItem): void;
557
563
 
558
564
  removeItem(options: LogicItem) {
559
- let logicItem: LogicItem = options;
565
+ const logicItem: LogicItem = options;
560
566
  return logicItem.delete();
561
567
  }
562
568
 
@@ -570,30 +576,35 @@ export class BindAttribute extends BaseNode {
570
576
  get viewElement() {
571
577
  return this.getAncestor('ViewElement') as ViewElement;
572
578
  }
579
+
573
580
  /**
574
581
  * 祖先 View
575
582
  */
576
583
  get view() {
577
584
  return this.getAncestor('View') as View;
578
585
  }
586
+
579
587
  /**
580
588
  * 祖先 Module
581
589
  */
582
590
  get module() {
583
591
  return this.getAncestor('Module') as Module;
584
592
  }
593
+
585
594
  /**
586
595
  * 祖先 Frontend
587
596
  */
588
597
  get frontend() {
589
598
  return this.getAncestor('Frontend') as Frontend;
590
599
  }
600
+
591
601
  /**
592
602
  * 祖先 ProcessElement
593
603
  */
594
604
  get processElement() {
595
605
  return this.getAncestor('ProcessElement') as ProcessElement;
596
606
  }
607
+
597
608
  /**
598
609
  * 祖先 Process
599
610
  */
@@ -929,7 +940,7 @@ export class BindAttribute extends BaseNode {
929
940
  transfromUnionTypeAnnotation(expTypeAnnotation, this.app);
930
941
  if (expTypeAnnotation?.typeNamespace?.endsWith('.metadataTypes')) {
931
942
  const referenceNode =
932
- this.app.findNodeByCompleteName(expTypeAnnotation.typeNamespace + '.' + expTypeAnnotation.typeName)
943
+ this.app.findNodeByCompleteName(`${expTypeAnnotation.typeNamespace }.${ expTypeAnnotation.typeName}`)
933
944
  ?.typeAnnotation || {};
934
945
  value = `$utils['ToString']('${referenceNode?.typeNamespace}.${referenceNode.typeName}', ${value})`;
935
946
  } else {
@@ -961,10 +972,12 @@ export class BindAttribute extends BaseNode {
961
972
  }
962
973
 
963
974
  @withSourceMapGenerator
964
- *toEmbeddedTS(state = createCompilerState()): TranslatorGenerator {
975
+ *toEmbeddedTS(state = createCompilerState(), options: { carryName: boolean } = { carryName: false }): TranslatorGenerator {
965
976
  const self = this;
966
977
  const { name, type, value, rules, expression, playground } = self;
967
978
  const humpName = self.toHump(name);
979
+ const { allNodesAPI = {} } = config;
980
+ const { carryName } = options;
968
981
 
969
982
  let code = '';
970
983
  if (!name) {
@@ -977,44 +990,84 @@ export class BindAttribute extends BaseNode {
977
990
  }
978
991
 
979
992
  // 不翻译的属性
980
- const excludeProps = ['dataSchema', 'key'];
993
+ const excludeProps = [
994
+ 'dataSchema',
995
+ 'key',
996
+ ];
981
997
  if (excludeProps.includes(humpName)) {
982
998
  return code;
983
999
  }
984
1000
 
985
- // feild属性需要特殊处理
986
- if (['valueField', 'textField', 'parentField', 'childrenField'].includes(humpName)) {
987
- if (type !== 'dynamic') {
988
- code += `item => item.${value}`;
989
- }
990
- return code;
1001
+ if (carryName) {
1002
+ code += `${humpName}: `;
991
1003
  }
992
1004
 
993
- // 特殊处理dataSource
994
- if (['dataSource'].includes(humpName)) {
995
- code += `(()`;
996
-
997
- // if (!expression) {
998
- code += ': any';
999
- // }
1005
+ // 从allNodesAPI中找到对应的属性
1006
+ let prop;
1007
+ if (allNodesAPI && self.parentNode.concept === 'ViewElement') {
1008
+ prop = allNodesAPI[self.parentNode.tag]?.props?.find((item) => item.name === humpName);
1009
+ }
1000
1010
 
1001
- code += ' => {\n';
1011
+ // feild属性需要特殊处理
1012
+ if (self.parentNode.concept === 'ViewElement') {
1013
+ // allNodesAPI中找到对应的属性
1014
+ if (/\(\s*item\s*:\s*T\s*\)\s*=>\s*.+/.test(prop?.tsType)) {
1015
+ if (type === 'dynamic') {
1016
+ code += `((): any => {})()`;
1017
+ } else {
1018
+ code += `item => item${value ? `.${value}` : ''}`;
1019
+ }
1002
1020
 
1003
- if (expression) {
1004
- code += `return `;
1005
- code += yield* expression.toEmbeddedTS(
1006
- shiftState(state, code, {
1007
- tabSize: (state?.tabSize || 0) + 1,
1008
- }),
1009
- );
1010
- code += ';\n';
1021
+ return code;
1011
1022
  }
1023
+ }
1012
1024
 
1013
- code += `})()`;
1014
- return code;
1025
+ // 不校验类型的属性
1026
+ const ignoreCheckProps = [
1027
+ 'sorting',
1028
+ 'advancedFormat',
1029
+ 'unit',
1030
+ 'decimalPlaces',
1031
+ 'autosize',
1032
+
1033
+ 'destination',
1034
+ 'externalDestination',
1035
+ 'rules',
1036
+ 'url',
1037
+
1038
+ 'dataSource',
1039
+ 'converter',
1040
+ ]
1041
+
1042
+ // @ts-ignore
1043
+ if (prop?.implicitToString) {
1044
+ ignoreCheckProps.push(humpName);
1015
1045
  }
1046
+ // 数据源是Enum的value属性
1047
+ if (name === 'value' && self.parentNode.concept === 'ViewElement') {
1048
+ // 向上查找ViewElement
1049
+ const dataSourceAttr = self.parentNode.bindAttrs.find((attr) => attr.name === 'dataSource');
1050
+ // @ts-ignore
1051
+ if (dataSourceAttr?.expression && (/Enum/.test(dataSourceAttr?.expression?.name) || /Enum/.test(dataSourceAttr?.expression?.calleeName))) {
1052
+ ignoreCheckProps.push(humpName);
1053
+ }
1054
+ }
1055
+ if (type === 'dynamic' && !expression) {
1056
+ ignoreCheckProps.push(humpName);
1057
+ }
1058
+ if (['string', 'static'].includes(type) && ['', undefined, null].includes(value)) {
1059
+ ignoreCheckProps.push(humpName);
1060
+ }
1061
+ if (['string', 'static'].includes(type) && /^\[.*\]$/.test(value)) {
1062
+ ignoreCheckProps.push(humpName);
1063
+ }
1064
+
1065
+ const ignore = ignoreCheckProps.includes(humpName);
1066
+ const start = `nasl.util.bindAttrWrap(() => {\n`;
1067
+ const end = `}, ${ignore ? 'true' : 'false'})`;
1068
+
1069
+ code += start;
1016
1070
 
1017
- code += `((): any => {\n`;
1018
1071
  code += `return `;
1019
1072
 
1020
1073
  if (['destination', 'externalDestination'].includes(name) && type === 'dynamic') {
@@ -1053,12 +1106,56 @@ export class BindAttribute extends BaseNode {
1053
1106
  code += ';\n';
1054
1107
  }
1055
1108
  } else if (['static', 'string'].includes(type)) {
1056
- code +=
1057
- typeof value === 'boolean'
1058
- ? value
1059
- : ['true', 'false'].includes(value)
1060
- ? value.replace(/'/g, '')
1061
- : JSON.stringify(value);
1109
+ if (ignore) {
1110
+ code += `new nasl.core.StringLiteral<\`\`>()`;
1111
+ } else {
1112
+ const formattedValue = typeof value === 'string'
1113
+ ? value.trim()
1114
+ : value;
1115
+
1116
+ // 普通string类型的属性
1117
+ if (type === 'string') {
1118
+ // 存在特殊字符的情况
1119
+ if (/(<|>|\\r|\\n)/g.test(formattedValue)) {
1120
+ code += `new nasl.core.StringLiteral<\`StringLiteral\`>()`;
1121
+ } else {
1122
+ code += `new nasl.core.StringLiteral<\`${formattedValue}\`>()`;
1123
+ }
1124
+ }
1125
+
1126
+ // 普通static类型的属性
1127
+ if (type === 'static') {
1128
+ let t = 'string';
1129
+
1130
+ try {
1131
+ const val = json5.parse(formattedValue);
1132
+ // @ts-ignore
1133
+ t = typeof val || 'string';
1134
+ } catch (error) {
1135
+
1136
+ }
1137
+
1138
+ switch (t) {
1139
+ case 'string':
1140
+ code += `new nasl.core.StringLiteral<\`StringLiteral\`>()`;
1141
+ break;
1142
+ case 'number':
1143
+ if (String(formattedValue).includes('.')) {
1144
+ code += `new nasl.core.Decimal(${formattedValue})`;
1145
+ } else {
1146
+ code += `new nasl.core.Long(${formattedValue})`;
1147
+ }
1148
+ break;
1149
+ case 'boolean':
1150
+ code += [true, 'true'].includes(formattedValue) ? `new nasl.core.BooleanTrue()` : `new nasl.core.BooleanFalse()`;
1151
+ break;
1152
+ default:
1153
+ code += `new nasl.core.StringLiteral<\`\`>()`;
1154
+ break;
1155
+ }
1156
+ }
1157
+ }
1158
+
1062
1159
  code += ';\n';
1063
1160
  }
1064
1161
 
@@ -1069,7 +1166,7 @@ export class BindAttribute extends BaseNode {
1069
1166
  });
1070
1167
  }
1071
1168
 
1072
- code += `})()`;
1169
+ code += end;
1073
1170
  return code;
1074
1171
  }
1075
1172
 
@@ -1087,13 +1184,14 @@ export class BindAttribute extends BaseNode {
1087
1184
  ].includes(node.parentNode.tag)
1088
1185
  ) {
1089
1186
  return node.parentNode;
1090
- } else {
1091
- return this.findCurrentElementParent(node.parentNode);
1092
1187
  }
1093
- } else {
1094
- return undefined;
1188
+ return this.findCurrentElementParent(node.parentNode);
1189
+
1095
1190
  }
1191
+ return undefined;
1192
+
1096
1193
  }
1194
+
1097
1195
  @withSourceMap()
1098
1196
  toNaturalTS(state = createCompilerState()): string {
1099
1197
  let code = `${kebab2Camel(this.name)}: `;
@@ -1176,9 +1274,9 @@ export function attrConvertCamelCase(str: string) {
1176
1274
  strList = strList.map((strItem, index) => {
1177
1275
  if (index === 0) {
1178
1276
  return strItem;
1179
- } else {
1180
- return `${strItem.slice(0, 1).toUpperCase()}${strItem.slice(1)}`;
1181
1277
  }
1278
+ return `${strItem.slice(0, 1).toUpperCase()}${strItem.slice(1)}`;
1279
+
1182
1280
  });
1183
1281
  return strList.join('');
1184
1282
  }