@lcap/nasl 3.4.0-beta.3 → 3.4.0-beta.4

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 (880) hide show
  1. package/out/automate/engine/index.d.ts +4 -4
  2. package/out/automate/engine/index.js +363 -363
  3. package/out/automate/engine/operators.d.ts +26 -16
  4. package/out/automate/engine/operators.js +363 -363
  5. package/out/automate/engine/uniqueName.d.ts +12 -12
  6. package/out/automate/engine/uniqueName.js +111 -111
  7. package/out/automate/engine/utils.d.ts +25 -25
  8. package/out/automate/engine/utils.js +443 -443
  9. package/out/automate/engine/viewCache.d.ts +19 -18
  10. package/out/automate/engine/viewCache.js +44 -44
  11. package/out/automate/template/myProcess.d.ts +10 -9
  12. package/out/automate/template/myProcess.js +11501 -11500
  13. package/out/automate/template/myProcess.js.map +1 -1
  14. package/out/automate/upgrader/2.12.d.ts +7 -7
  15. package/out/automate/upgrader/2.12.js +62 -62
  16. package/out/automate/upgrader/2.14-components.d.ts +1115 -1115
  17. package/out/automate/upgrader/2.14-components.js +1086 -1086
  18. package/out/automate/upgrader/2.14.d.ts +10 -10
  19. package/out/automate/upgrader/2.14.js +235 -235
  20. package/out/automate/upgrader/2.14.old.d.ts +1 -1
  21. package/out/automate/upgrader/2.14.old.js +124 -124
  22. package/out/automate/upgrader/2.16.d.ts +10 -10
  23. package/out/automate/upgrader/2.16.js +74 -74
  24. package/out/automate/upgrader/2.17.d.ts +21 -21
  25. package/out/automate/upgrader/2.17.js +556 -556
  26. package/out/automate/upgrader/2.18.d.ts +10 -10
  27. package/out/automate/upgrader/2.18.js +106 -106
  28. package/out/automate/upgrader/2.20.d.ts +17 -17
  29. package/out/automate/upgrader/2.20.js +67 -67
  30. package/out/bak/translator.d.ts +1 -1
  31. package/out/bak/translator.js +143 -143
  32. package/out/breakpoint/generator/AfterStartNode.d.ts +7 -7
  33. package/out/breakpoint/generator/AfterStartNode.js +29 -29
  34. package/out/breakpoint/generator/BeforeEndNode.d.ts +7 -7
  35. package/out/breakpoint/generator/BeforeEndNode.js +27 -27
  36. package/out/breakpoint/generator/BreakpointNode.d.ts +15 -15
  37. package/out/breakpoint/generator/BreakpointNode.js +283 -283
  38. package/out/breakpoint/generator/CallbackNode.d.ts +4 -4
  39. package/out/breakpoint/generator/CallbackNode.js +21 -21
  40. package/out/breakpoint/generator/FragmentNode.d.ts +4 -4
  41. package/out/breakpoint/generator/FragmentNode.js +17 -17
  42. package/out/breakpoint/generator/index.d.ts +4 -4
  43. package/out/breakpoint/generator/index.js +118 -118
  44. package/out/breakpoint/index.d.ts +3 -3
  45. package/out/breakpoint/index.js +19 -19
  46. package/out/breakpoint/shared/constants.d.ts +37 -37
  47. package/out/breakpoint/shared/constants.js +105 -105
  48. package/out/breakpoint/shared/index.d.ts +3 -3
  49. package/out/breakpoint/shared/index.js +32 -32
  50. package/out/breakpoint/shared/operations.d.ts +10 -10
  51. package/out/breakpoint/shared/operations.js +24 -24
  52. package/out/breakpoint/shared/socket.d.ts +48 -48
  53. package/out/breakpoint/shared/socket.js +256 -256
  54. package/out/breakpoint/shared/utils.d.ts +27 -27
  55. package/out/breakpoint/shared/utils.js +228 -228
  56. package/out/breakpoint/store/core.d.ts +80 -80
  57. package/out/breakpoint/store/core.js +415 -415
  58. package/out/breakpoint/store/dock.d.ts +1 -1
  59. package/out/breakpoint/store/dock.js +159 -159
  60. package/out/breakpoint/store/index.d.ts +2 -2
  61. package/out/breakpoint/store/index.js +18 -18
  62. package/out/common/BaseNode.d.ts +347 -334
  63. package/out/common/BaseNode.js +1376 -1325
  64. package/out/common/BaseNode.js.map +1 -1
  65. package/out/common/Command.d.ts +21 -21
  66. package/out/common/Command.js +78 -78
  67. package/out/common/ComponentAPI.d.ts +110 -110
  68. package/out/common/ComponentAPI.js +2 -2
  69. package/out/common/EventEmitter.d.ts +60 -60
  70. package/out/common/EventEmitter.js +68 -68
  71. package/out/common/EventEmitter.js.map +1 -1
  72. package/out/common/Messager.d.ts +91 -91
  73. package/out/common/Messager.js +206 -206
  74. package/out/common/asyncFuncMap.d.ts +2 -2
  75. package/out/common/asyncFuncMap.js +15 -15
  76. package/out/common/index.d.ts +3 -3
  77. package/out/common/index.js +19 -19
  78. package/out/concepts/Abort__.d.ts +28 -26
  79. package/out/concepts/Abort__.js +83 -81
  80. package/out/concepts/Abort__.js.map +1 -1
  81. package/out/concepts/AbstractInterface__.d.ts +22 -0
  82. package/out/concepts/AbstractInterface__.js +60 -0
  83. package/out/concepts/AbstractInterface__.js.map +1 -0
  84. package/out/concepts/Anchor__.d.ts +48 -46
  85. package/out/concepts/Anchor__.js +208 -206
  86. package/out/concepts/Anchor__.js.map +1 -1
  87. package/out/concepts/AnonymousFunction__.d.ts +175 -173
  88. package/out/concepts/AnonymousFunction__.js +548 -546
  89. package/out/concepts/AnonymousFunction__.js.map +1 -1
  90. package/out/concepts/App__.d.ts +1770 -1687
  91. package/out/concepts/App__.js +2777 -2670
  92. package/out/concepts/App__.js.map +1 -1
  93. package/out/concepts/Argument__.d.ts +70 -68
  94. package/out/concepts/Argument__.js +285 -285
  95. package/out/concepts/Argument__.js.map +1 -1
  96. package/out/concepts/Assignee__.d.ts +291 -289
  97. package/out/concepts/Assignee__.js +455 -452
  98. package/out/concepts/Assignee__.js.map +1 -1
  99. package/out/concepts/AssignmentLine__.d.ts +44 -42
  100. package/out/concepts/AssignmentLine__.js +120 -118
  101. package/out/concepts/AssignmentLine__.js.map +1 -1
  102. package/out/concepts/Assignment__.d.ts +77 -75
  103. package/out/concepts/Assignment__.js +328 -327
  104. package/out/concepts/Assignment__.js.map +1 -1
  105. package/out/concepts/Attribute__.d.ts +112 -110
  106. package/out/concepts/Attribute__.js +259 -265
  107. package/out/concepts/Attribute__.js.map +1 -1
  108. package/out/concepts/AuthInterface__.d.ts +38 -36
  109. package/out/concepts/AuthInterface__.js +86 -85
  110. package/out/concepts/AuthInterface__.js.map +1 -1
  111. package/out/concepts/AuthLogicForCallInterface__.d.ts +141 -139
  112. package/out/concepts/AuthLogicForCallInterface__.js +535 -532
  113. package/out/concepts/AuthLogicForCallInterface__.js.map +1 -1
  114. package/out/concepts/AuthLogic__.d.ts +69 -67
  115. package/out/concepts/AuthLogic__.js +222 -221
  116. package/out/concepts/AuthLogic__.js.map +1 -1
  117. package/out/concepts/BackendVariable__.d.ts +148 -146
  118. package/out/concepts/BackendVariable__.js +482 -481
  119. package/out/concepts/BackendVariable__.js.map +1 -1
  120. package/out/concepts/Backend__.d.ts +137 -135
  121. package/out/concepts/Backend__.js +287 -285
  122. package/out/concepts/Backend__.js.map +1 -1
  123. package/out/concepts/BatchAssignment__.d.ts +255 -253
  124. package/out/concepts/BatchAssignment__.js +883 -880
  125. package/out/concepts/BatchAssignment__.js.map +1 -1
  126. package/out/concepts/BinaryExpression__.d.ts +74 -72
  127. package/out/concepts/BinaryExpression__.js +398 -398
  128. package/out/concepts/BinaryExpression__.js.map +1 -1
  129. package/out/concepts/BindAttribute__.d.ts +330 -328
  130. package/out/concepts/BindAttribute__.js +1064 -1071
  131. package/out/concepts/BindAttribute__.js.map +1 -1
  132. package/out/concepts/BindDirective__.d.ts +169 -167
  133. package/out/concepts/BindDirective__.js +558 -562
  134. package/out/concepts/BindDirective__.js.map +1 -1
  135. package/out/concepts/BindEvent__.d.ts +255 -253
  136. package/out/concepts/BindEvent__.js +943 -942
  137. package/out/concepts/BindEvent__.js.map +1 -1
  138. package/out/concepts/BindStyle__.d.ts +142 -140
  139. package/out/concepts/BindStyle__.js +424 -423
  140. package/out/concepts/BindStyle__.js.map +1 -1
  141. package/out/concepts/BooleanLiteral__.d.ts +38 -36
  142. package/out/concepts/BooleanLiteral__.js +109 -108
  143. package/out/concepts/BooleanLiteral__.js.map +1 -1
  144. package/out/concepts/CallAuthInterface__.d.ts +128 -126
  145. package/out/concepts/CallAuthInterface__.js +421 -414
  146. package/out/concepts/CallAuthInterface__.js.map +1 -1
  147. package/out/concepts/CallConnector__.d.ts +49 -47
  148. package/out/concepts/CallConnector__.js +267 -266
  149. package/out/concepts/CallConnector__.js.map +1 -1
  150. package/out/concepts/CallFunction__.d.ts +161 -159
  151. package/out/concepts/CallFunction__.js +589 -568
  152. package/out/concepts/CallFunction__.js.map +1 -1
  153. package/out/concepts/CallInterface__.d.ts +132 -130
  154. package/out/concepts/CallInterface__.js +808 -802
  155. package/out/concepts/CallInterface__.js.map +1 -1
  156. package/out/concepts/CallLogic__.d.ts +233 -231
  157. package/out/concepts/CallLogic__.js +1317 -1319
  158. package/out/concepts/CallLogic__.js.map +1 -1
  159. package/out/concepts/CallQueryComponent__.d.ts +435 -433
  160. package/out/concepts/CallQueryComponent__.js +1313 -1325
  161. package/out/concepts/CallQueryComponent__.js.map +1 -1
  162. package/out/concepts/Comment__.d.ts +35 -33
  163. package/out/concepts/Comment__.js +101 -100
  164. package/out/concepts/Comment__.js.map +1 -1
  165. package/out/concepts/CompletionProperty__.d.ts +107 -105
  166. package/out/concepts/CompletionProperty__.js +279 -283
  167. package/out/concepts/CompletionProperty__.js.map +1 -1
  168. package/out/concepts/ConfigGroup__.d.ts +127 -125
  169. package/out/concepts/ConfigGroup__.js +266 -264
  170. package/out/concepts/ConfigGroup__.js.map +1 -1
  171. package/out/concepts/ConfigPropertyValue__.d.ts +47 -45
  172. package/out/concepts/ConfigPropertyValue__.js +110 -110
  173. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  174. package/out/concepts/ConfigProperty__.d.ts +156 -154
  175. package/out/concepts/ConfigProperty__.js +334 -334
  176. package/out/concepts/ConfigProperty__.js.map +1 -1
  177. package/out/concepts/Configuration__.d.ts +126 -124
  178. package/out/concepts/Configuration__.js +239 -236
  179. package/out/concepts/Configuration__.js.map +1 -1
  180. package/out/concepts/Connection__.d.ts +168 -166
  181. package/out/concepts/Connection__.js +347 -347
  182. package/out/concepts/Connection__.js.map +1 -1
  183. package/out/concepts/ConnectorTrigger__.d.ts +81 -79
  184. package/out/concepts/ConnectorTrigger__.js +160 -161
  185. package/out/concepts/ConnectorTrigger__.js.map +1 -1
  186. package/out/concepts/Connector__.d.ts +929 -570
  187. package/out/concepts/Connector__.js +1346 -907
  188. package/out/concepts/Connector__.js.map +1 -1
  189. package/out/concepts/Constant__.d.ts +121 -119
  190. package/out/concepts/Constant__.js +313 -313
  191. package/out/concepts/Constant__.js.map +1 -1
  192. package/out/concepts/DataSource__.d.ts +171 -169
  193. package/out/concepts/DataSource__.js +477 -477
  194. package/out/concepts/DataSource__.js.map +1 -1
  195. package/out/concepts/DatabaseTypeAnnotation__.d.ts +34 -32
  196. package/out/concepts/DatabaseTypeAnnotation__.js +82 -82
  197. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -1
  198. package/out/concepts/DefaultValue__.d.ts +98 -98
  199. package/out/concepts/DefaultValue__.js +210 -209
  200. package/out/concepts/DefaultValue__.js.map +1 -1
  201. package/out/concepts/Destination__.d.ts +160 -158
  202. package/out/concepts/Destination__.js +804 -804
  203. package/out/concepts/Destination__.js.map +1 -1
  204. package/out/concepts/End__.d.ts +27 -25
  205. package/out/concepts/End__.js +117 -115
  206. package/out/concepts/End__.js.map +1 -1
  207. package/out/concepts/EntityIndex__.d.ts +98 -96
  208. package/out/concepts/EntityIndex__.js +227 -229
  209. package/out/concepts/EntityIndex__.js.map +1 -1
  210. package/out/concepts/EntityProperty__.d.ts +289 -287
  211. package/out/concepts/EntityProperty__.js +883 -888
  212. package/out/concepts/EntityProperty__.js.map +1 -1
  213. package/out/concepts/Entity__.d.ts +342 -340
  214. package/out/concepts/Entity__.js +779 -769
  215. package/out/concepts/Entity__.js.map +1 -1
  216. package/out/concepts/EnumItem__.d.ts +67 -65
  217. package/out/concepts/EnumItem__.js +155 -155
  218. package/out/concepts/EnumItem__.js.map +1 -1
  219. package/out/concepts/Enum__.d.ts +141 -139
  220. package/out/concepts/Enum__.js +341 -341
  221. package/out/concepts/Enum__.js.map +1 -1
  222. package/out/concepts/Event__.d.ts +146 -144
  223. package/out/concepts/Event__.js +261 -263
  224. package/out/concepts/Event__.js.map +1 -1
  225. package/out/concepts/ExternalDestination__.d.ts +78 -76
  226. package/out/concepts/ExternalDestination__.js +292 -291
  227. package/out/concepts/ExternalDestination__.js.map +1 -1
  228. package/out/concepts/ForEachStatement__.d.ts +173 -190
  229. package/out/concepts/ForEachStatement__.js +533 -534
  230. package/out/concepts/ForEachStatement__.js.map +1 -1
  231. package/out/concepts/FrontendLibrary__.d.ts +216 -214
  232. package/out/concepts/FrontendLibrary__.js +374 -372
  233. package/out/concepts/FrontendLibrary__.js.map +1 -1
  234. package/out/concepts/FrontendVariable__.d.ts +24 -22
  235. package/out/concepts/FrontendVariable__.js +66 -63
  236. package/out/concepts/FrontendVariable__.js.map +1 -1
  237. package/out/concepts/Frontend__.d.ts +511 -509
  238. package/out/concepts/Frontend__.js +1043 -1003
  239. package/out/concepts/Frontend__.js.map +1 -1
  240. package/out/concepts/Function__.d.ts +420 -418
  241. package/out/concepts/Function__.js +805 -801
  242. package/out/concepts/Function__.js.map +1 -1
  243. package/out/concepts/I18nInfo__.d.ts +44 -44
  244. package/out/concepts/I18nInfo__.js +110 -110
  245. package/out/concepts/I18nInfo__.js.map +1 -1
  246. package/out/concepts/Identifier__.d.ts +54 -52
  247. package/out/concepts/Identifier__.js +309 -305
  248. package/out/concepts/Identifier__.js.map +1 -1
  249. package/out/concepts/IfStatement__.d.ts +161 -159
  250. package/out/concepts/IfStatement__.js +353 -352
  251. package/out/concepts/IfStatement__.js.map +1 -1
  252. package/out/concepts/Integration__.d.ts +146 -144
  253. package/out/concepts/Integration__.js +301 -298
  254. package/out/concepts/Integration__.js.map +1 -1
  255. package/out/concepts/InterfaceFromExample__.d.ts +88 -0
  256. package/out/concepts/InterfaceFromExample__.js +172 -0
  257. package/out/concepts/InterfaceFromExample__.js.map +1 -0
  258. package/out/concepts/InterfaceParam__.d.ts +151 -144
  259. package/out/concepts/InterfaceParam__.js +354 -346
  260. package/out/concepts/InterfaceParam__.js.map +1 -1
  261. package/out/concepts/Interface__.d.ts +334 -331
  262. package/out/concepts/Interface__.js +923 -910
  263. package/out/concepts/Interface__.js.map +1 -1
  264. package/out/concepts/JSBlock__.d.ts +37 -35
  265. package/out/concepts/JSBlock__.js +113 -112
  266. package/out/concepts/JSBlock__.js.map +1 -1
  267. package/out/concepts/JavaLogic__.d.ts +45 -43
  268. package/out/concepts/JavaLogic__.js +127 -128
  269. package/out/concepts/JavaLogic__.js.map +1 -1
  270. package/out/concepts/LogicItem__.d.ts +154 -152
  271. package/out/concepts/LogicItem__.js +289 -291
  272. package/out/concepts/LogicItem__.js.map +1 -1
  273. package/out/concepts/Logic__.d.ts +648 -644
  274. package/out/concepts/Logic__.js +1967 -1946
  275. package/out/concepts/Logic__.js.map +1 -1
  276. package/out/concepts/MatchCase__.d.ts +261 -259
  277. package/out/concepts/MatchCase__.js +703 -693
  278. package/out/concepts/MatchCase__.js.map +1 -1
  279. package/out/concepts/Match__.d.ts +127 -125
  280. package/out/concepts/Match__.js +697 -695
  281. package/out/concepts/Match__.js.map +1 -1
  282. package/out/concepts/MemberExpression__.d.ts +77 -75
  283. package/out/concepts/MemberExpression__.js +496 -495
  284. package/out/concepts/MemberExpression__.js.map +1 -1
  285. package/out/concepts/MicroApp__.d.ts +54 -52
  286. package/out/concepts/MicroApp__.js +122 -127
  287. package/out/concepts/MicroApp__.js.map +1 -1
  288. package/out/concepts/Module__.d.ts +985 -1236
  289. package/out/concepts/Module__.js +1450 -1756
  290. package/out/concepts/Module__.js.map +1 -1
  291. package/out/concepts/MsgTriggerEvent__.d.ts +140 -138
  292. package/out/concepts/MsgTriggerEvent__.js +239 -236
  293. package/out/concepts/MsgTriggerEvent__.js.map +1 -1
  294. package/out/concepts/MsgTriggerLauncher__.d.ts +129 -127
  295. package/out/concepts/MsgTriggerLauncher__.js +234 -232
  296. package/out/concepts/MsgTriggerLauncher__.js.map +1 -1
  297. package/out/concepts/Namespace__.d.ts +1086 -1070
  298. package/out/concepts/Namespace__.js +1546 -1491
  299. package/out/concepts/Namespace__.js.map +1 -1
  300. package/out/concepts/NewComposite__.d.ts +351 -349
  301. package/out/concepts/NewComposite__.js +1261 -1311
  302. package/out/concepts/NewComposite__.js.map +1 -1
  303. package/out/concepts/NewList__.d.ts +138 -136
  304. package/out/concepts/NewList__.js +455 -449
  305. package/out/concepts/NewList__.js.map +1 -1
  306. package/out/concepts/NewMap__.d.ts +229 -227
  307. package/out/concepts/NewMap__.js +600 -589
  308. package/out/concepts/NewMap__.js.map +1 -1
  309. package/out/concepts/New__.d.ts +23 -21
  310. package/out/concepts/New__.js +71 -69
  311. package/out/concepts/New__.js.map +1 -1
  312. package/out/concepts/NullLiteral__.d.ts +29 -27
  313. package/out/concepts/NullLiteral__.js +84 -82
  314. package/out/concepts/NullLiteral__.js.map +1 -1
  315. package/out/concepts/NumericLiteral__.d.ts +59 -57
  316. package/out/concepts/NumericLiteral__.js +190 -189
  317. package/out/concepts/NumericLiteral__.js.map +1 -1
  318. package/out/concepts/OqlQueryComponent__.d.ts +76 -74
  319. package/out/concepts/OqlQueryComponent__.js +368 -365
  320. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  321. package/out/concepts/OverriddenLogic__.d.ts +637 -635
  322. package/out/concepts/OverriddenLogic__.js +1693 -1691
  323. package/out/concepts/OverriddenLogic__.js.map +1 -1
  324. package/out/concepts/Param__.d.ts +182 -180
  325. package/out/concepts/Param__.js +512 -512
  326. package/out/concepts/Param__.js.map +1 -1
  327. package/out/concepts/Point__.d.ts +34 -32
  328. package/out/concepts/Point__.js +82 -82
  329. package/out/concepts/Point__.js.map +1 -1
  330. package/out/concepts/ProcessComponent__.d.ts +222 -220
  331. package/out/concepts/ProcessComponent__.js +360 -360
  332. package/out/concepts/ProcessComponent__.js.map +1 -1
  333. package/out/concepts/ProcessElement__.d.ts +649 -647
  334. package/out/concepts/ProcessElement__.js +1335 -1334
  335. package/out/concepts/ProcessElement__.js.map +1 -1
  336. package/out/concepts/ProcessOutcome__.d.ts +33 -32
  337. package/out/concepts/ProcessOutcome__.js +108 -92
  338. package/out/concepts/ProcessOutcome__.js.map +1 -1
  339. package/out/concepts/ProcessOutcomes__.d.ts +33 -32
  340. package/out/concepts/ProcessOutcomes__.js +110 -93
  341. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  342. package/out/concepts/Process__.d.ts +616 -614
  343. package/out/concepts/Process__.js +1139 -1135
  344. package/out/concepts/Process__.js.map +1 -1
  345. package/out/concepts/QueryAggregateExpression__.d.ts +54 -52
  346. package/out/concepts/QueryAggregateExpression__.js +159 -159
  347. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  348. package/out/concepts/QueryFieldExpression__.d.ts +56 -54
  349. package/out/concepts/QueryFieldExpression__.js +163 -164
  350. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  351. package/out/concepts/QueryFromExpression__.d.ts +101 -99
  352. package/out/concepts/QueryFromExpression__.js +220 -220
  353. package/out/concepts/QueryFromExpression__.js.map +1 -1
  354. package/out/concepts/QueryGroupByExpression__.d.ts +49 -47
  355. package/out/concepts/QueryGroupByExpression__.js +150 -148
  356. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  357. package/out/concepts/QueryJoinExpression__.d.ts +188 -186
  358. package/out/concepts/QueryJoinExpression__.js +347 -348
  359. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  360. package/out/concepts/QueryLimitExpression__.d.ts +60 -58
  361. package/out/concepts/QueryLimitExpression__.js +172 -171
  362. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  363. package/out/concepts/QueryOrderByExpression__.d.ts +71 -69
  364. package/out/concepts/QueryOrderByExpression__.js +185 -184
  365. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  366. package/out/concepts/QuerySelectExpression__.d.ts +206 -204
  367. package/out/concepts/QuerySelectExpression__.js +311 -308
  368. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  369. package/out/concepts/Rect__.d.ts +42 -40
  370. package/out/concepts/Rect__.js +98 -100
  371. package/out/concepts/Rect__.js.map +1 -1
  372. package/out/concepts/Return__.d.ts +147 -145
  373. package/out/concepts/Return__.js +410 -409
  374. package/out/concepts/Return__.js.map +1 -1
  375. package/out/concepts/Role__.d.ts +65 -63
  376. package/out/concepts/Role__.js +172 -173
  377. package/out/concepts/Role__.js.map +1 -1
  378. package/out/concepts/SelectMembers__.d.ts +145 -143
  379. package/out/concepts/SelectMembers__.js +307 -305
  380. package/out/concepts/SelectMembers__.js.map +1 -1
  381. package/out/concepts/Slot__.d.ts +77 -75
  382. package/out/concepts/Slot__.js +175 -178
  383. package/out/concepts/Slot__.js.map +1 -1
  384. package/out/concepts/SqlQueryComponent__.d.ts +74 -72
  385. package/out/concepts/SqlQueryComponent__.js +291 -292
  386. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  387. package/out/concepts/Start__.d.ts +27 -25
  388. package/out/concepts/Start__.js +76 -74
  389. package/out/concepts/Start__.js.map +1 -1
  390. package/out/concepts/StringInterpolation__.d.ts +118 -116
  391. package/out/concepts/StringInterpolation__.js +275 -272
  392. package/out/concepts/StringInterpolation__.js.map +1 -1
  393. package/out/concepts/StringLiteral__.d.ts +45 -43
  394. package/out/concepts/StringLiteral__.js +165 -157
  395. package/out/concepts/StringLiteral__.js.map +1 -1
  396. package/out/concepts/StructureProperty__.d.ts +150 -148
  397. package/out/concepts/StructureProperty__.js +373 -372
  398. package/out/concepts/StructureProperty__.js.map +1 -1
  399. package/out/concepts/Structure__.d.ts +252 -248
  400. package/out/concepts/Structure__.js +521 -506
  401. package/out/concepts/Structure__.js.map +1 -1
  402. package/out/concepts/SwitchCase__.d.ts +97 -95
  403. package/out/concepts/SwitchCase__.js +287 -281
  404. package/out/concepts/SwitchCase__.js.map +1 -1
  405. package/out/concepts/SwitchStatement__.d.ts +87 -85
  406. package/out/concepts/SwitchStatement__.js +212 -209
  407. package/out/concepts/SwitchStatement__.js.map +1 -1
  408. package/out/concepts/Theme__.d.ts +40 -38
  409. package/out/concepts/Theme__.js +91 -89
  410. package/out/concepts/Theme__.js.map +1 -1
  411. package/out/concepts/Transactional__.d.ts +90 -88
  412. package/out/concepts/Transactional__.js +171 -172
  413. package/out/concepts/Transactional__.js.map +1 -1
  414. package/out/concepts/TriggerEvent__.d.ts +123 -121
  415. package/out/concepts/TriggerEvent__.js +236 -234
  416. package/out/concepts/TriggerEvent__.js.map +1 -1
  417. package/out/concepts/TriggerLauncher__.d.ts +84 -82
  418. package/out/concepts/TriggerLauncher__.js +223 -225
  419. package/out/concepts/TriggerLauncher__.js.map +1 -1
  420. package/out/concepts/TypeAnnotation__.d.ts +304 -299
  421. package/out/concepts/TypeAnnotation__.js +1054 -1025
  422. package/out/concepts/TypeAnnotation__.js.map +1 -1
  423. package/out/concepts/TypeParam__.d.ts +28 -26
  424. package/out/concepts/TypeParam__.js +82 -81
  425. package/out/concepts/TypeParam__.js.map +1 -1
  426. package/out/concepts/UnaryExpression__.d.ts +52 -50
  427. package/out/concepts/UnaryExpression__.js +200 -199
  428. package/out/concepts/UnaryExpression__.js.map +1 -1
  429. package/out/concepts/Unparsed__.d.ts +36 -33
  430. package/out/concepts/Unparsed__.js +103 -102
  431. package/out/concepts/Unparsed__.js.map +1 -1
  432. package/out/concepts/UseComponent__.d.ts +34 -32
  433. package/out/concepts/UseComponent__.js +82 -82
  434. package/out/concepts/UseComponent__.js.map +1 -1
  435. package/out/concepts/ValidationRule__.d.ts +152 -150
  436. package/out/concepts/ValidationRule__.js +531 -525
  437. package/out/concepts/ValidationRule__.js.map +1 -1
  438. package/out/concepts/Variable__.d.ts +167 -165
  439. package/out/concepts/Variable__.js +479 -478
  440. package/out/concepts/Variable__.js.map +1 -1
  441. package/out/concepts/ViewBlock__.d.ts +38 -36
  442. package/out/concepts/ViewBlock__.js +90 -91
  443. package/out/concepts/ViewBlock__.js.map +1 -1
  444. package/out/concepts/ViewComponent__.d.ts +568 -566
  445. package/out/concepts/ViewComponent__.js +819 -816
  446. package/out/concepts/ViewComponent__.js.map +1 -1
  447. package/out/concepts/ViewElement__.d.ts +628 -626
  448. package/out/concepts/ViewElement__.js +2315 -2316
  449. package/out/concepts/ViewElement__.js.map +1 -1
  450. package/out/concepts/View__.d.ts +725 -723
  451. package/out/concepts/View__.js +2219 -2217
  452. package/out/concepts/View__.js.map +1 -1
  453. package/out/concepts/WhileStatement__.d.ts +100 -98
  454. package/out/concepts/WhileStatement__.js +251 -247
  455. package/out/concepts/WhileStatement__.js.map +1 -1
  456. package/out/concepts/basics/constants.d.ts +1 -0
  457. package/out/concepts/basics/constants.js +6 -0
  458. package/out/concepts/basics/constants.js.map +1 -0
  459. package/out/concepts/basics/stdlib/index.d.ts +4 -4
  460. package/out/concepts/basics/stdlib/index.js +44 -44
  461. package/out/concepts/basics/stdlib/nasl.auth.d.ts +7 -7
  462. package/out/concepts/basics/stdlib/nasl.auth.js +163 -163
  463. package/out/concepts/basics/stdlib/nasl.browser.d.ts +3 -3
  464. package/out/concepts/basics/stdlib/nasl.browser.js +148 -148
  465. package/out/concepts/basics/stdlib/nasl.collection.d.ts +7 -7
  466. package/out/concepts/basics/stdlib/nasl.collection.js +51 -51
  467. package/out/concepts/basics/stdlib/nasl.configuration.d.ts +3 -3
  468. package/out/concepts/basics/stdlib/nasl.configuration.js +55 -55
  469. package/out/concepts/basics/stdlib/nasl.core.d.ts +5 -5
  470. package/out/concepts/basics/stdlib/nasl.core.js +48 -48
  471. package/out/concepts/basics/stdlib/nasl.event.d.ts +3 -3
  472. package/out/concepts/basics/stdlib/nasl.event.js +24 -24
  473. package/out/concepts/basics/stdlib/nasl.http.d.ts +7 -7
  474. package/out/concepts/basics/stdlib/nasl.http.js +168 -168
  475. package/out/concepts/basics/stdlib/nasl.interface.d.ts +7 -7
  476. package/out/concepts/basics/stdlib/nasl.interface.js +42 -42
  477. package/out/concepts/basics/stdlib/nasl.io.d.ts +3 -3
  478. package/out/concepts/basics/stdlib/nasl.io.js +51 -51
  479. package/out/concepts/basics/stdlib/nasl.logging.d.ts +3 -3
  480. package/out/concepts/basics/stdlib/nasl.logging.js +55 -55
  481. package/out/concepts/basics/stdlib/nasl.process.d.ts +7 -7
  482. package/out/concepts/basics/stdlib/nasl.process.js +637 -637
  483. package/out/concepts/basics/stdlib/nasl.ui.d.ts +7 -7
  484. package/out/concepts/basics/stdlib/nasl.ui.js +1062 -1062
  485. package/out/concepts/basics/stdlib/nasl.util.d.ts +5 -5
  486. package/out/concepts/basics/stdlib/nasl.util.js +2291 -2291
  487. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  488. package/out/concepts/basics/stdlib/nasl.validation.d.ts +3 -3
  489. package/out/concepts/basics/stdlib/nasl.validation.js +564 -564
  490. package/out/concepts/basics/stdlib/reference2TypeAnnotationList.d.ts +5 -5
  491. package/out/concepts/basics/stdlib/reference2TypeAnnotationList.js +25 -25
  492. package/out/concepts/basics/stdlib/timeZone.d.ts +5 -5
  493. package/out/concepts/basics/stdlib/timeZone.js +195 -195
  494. package/out/concepts/basics/types/coreTypeList.d.ts +2 -2
  495. package/out/concepts/basics/types/coreTypeList.js +14 -14
  496. package/out/concepts/basics/types/index.d.ts +16 -16
  497. package/out/concepts/basics/types/index.js +34 -34
  498. package/out/concepts/index.d.ts +6 -6
  499. package/out/concepts/index.js +24 -24
  500. package/out/concepts/index__.d.ts +126 -124
  501. package/out/concepts/index__.js +142 -140
  502. package/out/concepts/index__.js.map +1 -1
  503. package/out/concepts/types__.d.ts +128 -126
  504. package/out/concepts/types__.js +2 -2
  505. package/out/config.d.ts +43 -43
  506. package/out/config.js +71 -71
  507. package/out/decorators/index.d.ts +69 -57
  508. package/out/decorators/index.js +216 -172
  509. package/out/decorators/index.js.map +1 -1
  510. package/out/decorators/promise.d.ts +7 -7
  511. package/out/decorators/promise.js +27 -27
  512. package/out/enums/KEYWORDS.d.ts +6 -6
  513. package/out/enums/KEYWORDS.js +1245 -1243
  514. package/out/enums/KEYWORDS.js.map +1 -1
  515. package/out/enums/LEVEL_NAME_MAP.d.ts +26 -26
  516. package/out/enums/LEVEL_NAME_MAP.js +29 -29
  517. package/out/eventBus.d.ts +3 -3
  518. package/out/eventBus.js +6 -6
  519. package/out/generator/compileComponent.d.ts +11 -11
  520. package/out/generator/compileComponent.js +11 -11
  521. package/out/generator/genBundleFiles.d.ts +34 -34
  522. package/out/generator/genBundleFiles.js +356 -356
  523. package/out/generator/genBundleFiles.js.map +1 -1
  524. package/out/generator/genHash.d.ts +7 -7
  525. package/out/generator/genHash.js +38 -38
  526. package/out/generator/genMetaData.d.ts +31 -31
  527. package/out/generator/genMetaData.js +305 -301
  528. package/out/generator/genMetaData.js.map +1 -1
  529. package/out/generator/genReleaseBody.d.ts +72 -72
  530. package/out/generator/genReleaseBody.js +323 -321
  531. package/out/generator/genReleaseBody.js.map +1 -1
  532. package/out/generator/icestark.d.ts +2 -2
  533. package/out/generator/icestark.js +7 -5
  534. package/out/generator/icestark.js.map +1 -1
  535. package/out/generator/index.d.ts +7 -7
  536. package/out/generator/index.js +23 -23
  537. package/out/generator/microApp.d.ts +2 -2
  538. package/out/generator/microApp.js +35 -35
  539. package/out/generator/permission.d.ts +10 -10
  540. package/out/generator/permission.js +269 -269
  541. package/out/generator/qiankun.d.ts +2 -2
  542. package/out/generator/qiankun.js +6 -4
  543. package/out/generator/qiankun.js.map +1 -1
  544. package/out/generator/styleReplacer.d.ts +3 -3
  545. package/out/generator/styleReplacer.js +67 -67
  546. package/out/index.d.ts +13 -13
  547. package/out/index.js +66 -66
  548. package/out/manager/diagnostic.d.ts +35 -35
  549. package/out/manager/diagnostic.js +62 -62
  550. package/out/manager/stepRecorder.d.ts +20 -20
  551. package/out/manager/stepRecorder.js +108 -108
  552. package/out/natural/componentData.d.ts +31 -31
  553. package/out/natural/componentData.js +84 -84
  554. package/out/natural/genNaturalTS.d.ts +3 -3
  555. package/out/natural/genNaturalTS.js +89 -90
  556. package/out/natural/genNaturalTS.js.map +1 -1
  557. package/out/natural/index.d.ts +2 -2
  558. package/out/natural/index.js +18 -18
  559. package/out/natural/naslStdlibMap.d.ts +2 -2
  560. package/out/natural/naslStdlibMap.js +25 -25
  561. package/out/natural/transformTSCode.d.ts +7 -7
  562. package/out/natural/transformTSCode.js +919 -877
  563. package/out/natural/transformTSCode.js.map +1 -1
  564. package/out/sentry/index.d.ts +34 -34
  565. package/out/sentry/index.js +148 -147
  566. package/out/sentry/index.js.map +1 -1
  567. package/out/server/createUiTs.d.ts +16 -16
  568. package/out/server/createUiTs.js +242 -242
  569. package/out/server/entity2LogicNamespace.d.ts +10 -10
  570. package/out/server/entity2LogicNamespace.js +381 -381
  571. package/out/server/event.d.ts +30 -30
  572. package/out/server/event.js +150 -150
  573. package/out/server/extendBaseNode.d.ts +1 -1
  574. package/out/server/extendBaseNode.js +574 -543
  575. package/out/server/extendBaseNode.js.map +1 -1
  576. package/out/server/formatTsUtils.d.ts +37 -37
  577. package/out/server/formatTsUtils.js +851 -851
  578. package/out/server/getConnector.d.ts +14 -14
  579. package/out/server/getConnector.js +77 -77
  580. package/out/server/getExtensionModules.d.ts +3 -3
  581. package/out/server/getExtensionModules.js +33 -33
  582. package/out/server/getFunctions.d.ts +3 -3
  583. package/out/server/getFunctions.js +19 -19
  584. package/out/server/getInterfaces.d.ts +2 -2
  585. package/out/server/getInterfaces.js +47 -47
  586. package/out/server/getLogging.d.ts +1 -1
  587. package/out/server/getLogging.js +8 -8
  588. package/out/server/getLogics.d.ts +4 -4
  589. package/out/server/getLogics.js +380 -380
  590. package/out/server/getMemberIdentifier.d.ts +17 -17
  591. package/out/server/getMemberIdentifier.js +508 -508
  592. package/out/server/getProcessComponents.d.ts +2 -2
  593. package/out/server/getProcessComponents.js +12 -12
  594. package/out/server/getProcesses.d.ts +33 -33
  595. package/out/server/getProcesses.js +596 -596
  596. package/out/server/getScope.d.ts +13 -13
  597. package/out/server/getScope.js +60 -60
  598. package/out/server/getValidates.d.ts +3 -3
  599. package/out/server/getValidates.js +13 -13
  600. package/out/server/index.d.ts +5 -5
  601. package/out/server/index.js +41 -41
  602. package/out/server/naslServer.d.ts +375 -371
  603. package/out/server/naslServer.js +4706 -4585
  604. package/out/server/naslServer.js.map +1 -1
  605. package/out/server/naslStdlibMap.d.ts +2 -2
  606. package/out/server/naslStdlibMap.js +53 -53
  607. package/out/server/process2LogicNamespace.d.ts +26 -26
  608. package/out/server/process2LogicNamespace.js +108 -108
  609. package/out/server/translator.d.ts +26 -26
  610. package/out/server/translator.js +819 -805
  611. package/out/server/translator.js.map +1 -1
  612. package/out/service/creator/add.configs.d.ts +1 -1
  613. package/out/service/creator/add.configs.js +102 -102
  614. package/out/service/creator/errHandles.d.ts +18 -18
  615. package/out/service/creator/errHandles.js +67 -67
  616. package/out/service/creator/index.d.ts +1 -1
  617. package/out/service/creator/index.js +86 -86
  618. package/out/service/datasource/api.d.ts +12 -12
  619. package/out/service/datasource/api.js +13 -13
  620. package/out/service/datasource/index.d.ts +2 -2
  621. package/out/service/datasource/index.js +9 -9
  622. package/out/service/defaultErrorMessage.json +98 -98
  623. package/out/service/logic/api.d.ts +9 -9
  624. package/out/service/logic/api.js +10 -10
  625. package/out/service/logic/checktypeSocket.d.ts +5 -5
  626. package/out/service/logic/checktypeSocket.js +54 -54
  627. package/out/service/logic/index.d.ts +2 -2
  628. package/out/service/logic/index.js +9 -9
  629. package/out/service/storage/api.d.ts +54 -54
  630. package/out/service/storage/api.js +41 -41
  631. package/out/service/storage/index.d.ts +2 -2
  632. package/out/service/storage/index.js +9 -9
  633. package/out/service/storage/init.d.ts +102 -102
  634. package/out/service/storage/init.js +1161 -1161
  635. package/out/service/storage/jsoner.d.ts +36 -36
  636. package/out/service/storage/jsoner.js +128 -130
  637. package/out/service/storage/jsoner.js.map +1 -1
  638. package/out/service/storage/map.d.ts +4 -4
  639. package/out/service/storage/map.js +53 -53
  640. package/out/service/storage/service.d.ts +25 -25
  641. package/out/service/storage/service.js +79 -79
  642. package/out/service/storage/storagePoint.d.ts +17 -17
  643. package/out/service/storage/storagePoint.js +75 -75
  644. package/out/service/video/BaseService.d.ts +7 -7
  645. package/out/service/video/BaseService.js +60 -60
  646. package/out/service/video/MainCallbackService.d.ts +12 -12
  647. package/out/service/video/MainCallbackService.js +182 -182
  648. package/out/service/video/VideoTranscribe.d.ts +15 -15
  649. package/out/service/video/VideoTranscribe.js +95 -95
  650. package/out/service/video/publishService.d.ts +1 -1
  651. package/out/service/video/publishService.js +57 -57
  652. package/out/templator/genCallComponentLogic.d.ts +17 -17
  653. package/out/templator/genCallComponentLogic.js +28 -28
  654. package/out/templator/genCreateBlock.d.ts +10 -10
  655. package/out/templator/genCreateBlock.js +297 -297
  656. package/out/templator/genCurdEditMultipleKeyBlock.d.ts +8 -8
  657. package/out/templator/genCurdEditMultipleKeyBlock.js +398 -398
  658. package/out/templator/genCurdMultipleKeyBlock.d.ts +34 -34
  659. package/out/templator/genCurdMultipleKeyBlock.js +541 -541
  660. package/out/templator/genEditTableBlock.d.ts +51 -51
  661. package/out/templator/genEditTableBlock.js +255 -255
  662. package/out/templator/genEnumSelectBlock.d.ts +10 -10
  663. package/out/templator/genEnumSelectBlock.js +21 -21
  664. package/out/templator/genGetBlock.d.ts +6 -6
  665. package/out/templator/genGetBlock.js +96 -96
  666. package/out/templator/genGridViewBlock.d.ts +55 -55
  667. package/out/templator/genGridViewBlock.js +286 -286
  668. package/out/templator/genListViewBlock.d.ts +19 -19
  669. package/out/templator/genListViewBlock.js +108 -108
  670. package/out/templator/genQueryComponent.d.ts +34 -34
  671. package/out/templator/genQueryComponent.js +348 -348
  672. package/out/templator/genSelectBlock.d.ts +45 -45
  673. package/out/templator/genSelectBlock.js +340 -340
  674. package/out/templator/genTableBlock.d.ts +53 -53
  675. package/out/templator/genTableBlock.js +226 -226
  676. package/out/templator/genUpdateBlock.d.ts +6 -6
  677. package/out/templator/genUpdateBlock.js +322 -322
  678. package/out/templator/index.d.ts +19 -19
  679. package/out/templator/index.js +37 -37
  680. package/out/templator/utils.d.ts +683 -683
  681. package/out/templator/utils.js +458 -458
  682. package/out/translator/constant.d.ts +6 -6
  683. package/out/translator/constant.js +9 -9
  684. package/out/translator/index.d.ts +3 -3
  685. package/out/translator/index.js +19 -19
  686. package/out/translator/types.d.ts +33 -32
  687. package/out/translator/types.js +2 -2
  688. package/out/translator/utils.d.ts +17 -17
  689. package/out/translator/utils.js +110 -97
  690. package/out/translator/utils.js.map +1 -1
  691. package/out/utils/cookie.d.ts +9 -9
  692. package/out/utils/cookie.js +61 -61
  693. package/out/utils/env.d.ts +2 -2
  694. package/out/utils/env.js +5 -5
  695. package/out/utils/i18nInfo.d.ts +5 -5
  696. package/out/utils/i18nInfo.js +60 -60
  697. package/out/utils/index.d.ts +44 -44
  698. package/out/utils/index.js +200 -200
  699. package/out/utils/logger.d.ts +7 -7
  700. package/out/utils/logger.js +22 -22
  701. package/out/utils/sortTsString.d.ts +1 -1
  702. package/out/utils/sortTsString.js +43 -37
  703. package/out/utils/sortTsString.js.map +1 -1
  704. package/out/utils/string.d.ts +51 -51
  705. package/out/utils/string.js +106 -106
  706. package/out/utils/time-slicing.d.ts +41 -41
  707. package/out/utils/time-slicing.js +81 -81
  708. package/out/utils/traverse.d.ts +36 -36
  709. package/out/utils/traverse.js +142 -142
  710. package/out/utils/types.d.ts +1 -1
  711. package/out/utils/types.js +2 -2
  712. package/out/utils/window.d.ts +7 -7
  713. package/out/utils/window.js +13 -13
  714. package/package.json +8 -8
  715. package/sandbox/stdlib/nasl.oql.ts +6 -1
  716. package/sandbox-natural/stdlib/nasl.core.ts +6 -3
  717. package/sandbox-natural/stdlib/nasl.oql.ts +6 -0
  718. package/sandbox-natural/stdlib/nasl.util.ts +2 -1
  719. package/src/automate/template/myProcess.js +3 -2
  720. package/src/common/BaseNode.ts +108 -51
  721. package/src/concepts/Abort__.ts +4 -1
  722. package/src/concepts/AbstractInterface__.ts +64 -0
  723. package/src/concepts/Anchor__.ts +6 -2
  724. package/src/concepts/AnonymousFunction__.ts +11 -5
  725. package/src/concepts/App__.ts +1648 -1378
  726. package/src/concepts/Argument__.ts +7 -3
  727. package/src/concepts/Assignee__.ts +10 -5
  728. package/src/concepts/AssignmentLine__.ts +3 -0
  729. package/src/concepts/Assignment__.ts +8 -4
  730. package/src/concepts/Attribute__.ts +7 -2
  731. package/src/concepts/AuthInterface__.ts +3 -0
  732. package/src/concepts/AuthLogicForCallInterface__.ts +8 -4
  733. package/src/concepts/AuthLogic__.ts +3 -0
  734. package/src/concepts/BackendVariable__.ts +11 -4
  735. package/src/concepts/Backend__.ts +5 -1
  736. package/src/concepts/BatchAssignment__.ts +13 -8
  737. package/src/concepts/BinaryExpression__.ts +10 -6
  738. package/src/concepts/BindAttribute__.ts +6 -2
  739. package/src/concepts/BindDirective__.ts +11 -4
  740. package/src/concepts/BindEvent__.ts +8 -3
  741. package/src/concepts/BindStyle__.ts +5 -1
  742. package/src/concepts/BooleanLiteral__.ts +4 -1
  743. package/src/concepts/CallAuthInterface__.ts +11 -3
  744. package/src/concepts/CallConnector__.ts +3 -0
  745. package/src/concepts/CallFunction__.ts +41 -15
  746. package/src/concepts/CallInterface__.ts +33 -21
  747. package/src/concepts/CallLogic__.ts +41 -35
  748. package/src/concepts/CallQueryComponent__.ts +11 -14
  749. package/src/concepts/Comment__.ts +3 -0
  750. package/src/concepts/CompletionProperty__.ts +5 -1
  751. package/src/concepts/ConfigGroup__.ts +5 -1
  752. package/src/concepts/ConfigPropertyValue__.ts +3 -0
  753. package/src/concepts/ConfigProperty__.ts +5 -1
  754. package/src/concepts/Configuration__.ts +5 -1
  755. package/src/concepts/Connection__.ts +5 -1
  756. package/src/concepts/ConnectorTrigger__.ts +3 -0
  757. package/src/concepts/Connector__.ts +910 -25
  758. package/src/concepts/Constant__.ts +9 -4
  759. package/src/concepts/DataSource__.ts +5 -1
  760. package/src/concepts/DatabaseTypeAnnotation__.ts +3 -0
  761. package/src/concepts/DefaultValue__.ts +4 -3
  762. package/src/concepts/Destination__.ts +8 -4
  763. package/src/concepts/End__.ts +3 -0
  764. package/src/concepts/EntityIndex__.ts +3 -0
  765. package/src/concepts/EntityProperty__.ts +14 -4
  766. package/src/concepts/Entity__.ts +17 -2
  767. package/src/concepts/EnumItem__.ts +3 -0
  768. package/src/concepts/Enum__.ts +5 -1
  769. package/src/concepts/Event__.ts +5 -1
  770. package/src/concepts/ExternalDestination__.ts +7 -3
  771. package/src/concepts/ForEachStatement__.ts +21 -16
  772. package/src/concepts/FrontendLibrary__.ts +7 -2
  773. package/src/concepts/FrontendVariable__.ts +3 -0
  774. package/src/concepts/Frontend__.ts +59 -14
  775. package/src/concepts/Function__.ts +15 -7
  776. package/src/concepts/I18nInfo__.ts +1 -0
  777. package/src/concepts/Identifier__.ts +9 -2
  778. package/src/concepts/IfStatement__.ts +25 -22
  779. package/src/concepts/Integration__.ts +8 -4
  780. package/src/concepts/InterfaceFromExample__.ts +194 -0
  781. package/src/concepts/InterfaceParam__.ts +20 -4
  782. package/src/concepts/Interface__.ts +51 -25
  783. package/src/concepts/JSBlock__.ts +3 -0
  784. package/src/concepts/JavaLogic__.ts +3 -0
  785. package/src/concepts/LogicItem__.ts +3 -0
  786. package/src/concepts/Logic__.ts +48 -19
  787. package/src/concepts/MatchCase__.ts +16 -5
  788. package/src/concepts/Match__.ts +8 -4
  789. package/src/concepts/MemberExpression__.ts +8 -4
  790. package/src/concepts/MicroApp__.ts +3 -0
  791. package/src/concepts/Module__.ts +286 -893
  792. package/src/concepts/MsgTriggerEvent__.ts +5 -1
  793. package/src/concepts/MsgTriggerLauncher__.ts +6 -2
  794. package/src/concepts/Namespace__.ts +246 -173
  795. package/src/concepts/NewComposite__.ts +54 -103
  796. package/src/concepts/NewList__.ts +27 -18
  797. package/src/concepts/NewMap__.ts +29 -15
  798. package/src/concepts/New__.ts +3 -0
  799. package/src/concepts/NullLiteral__.ts +4 -1
  800. package/src/concepts/NumericLiteral__.ts +6 -2
  801. package/src/concepts/OqlQueryComponent__.ts +8 -1
  802. package/src/concepts/OverriddenLogic__.ts +18 -7
  803. package/src/concepts/Param__.ts +8 -2
  804. package/src/concepts/Point__.ts +3 -0
  805. package/src/concepts/ProcessComponent__.ts +7 -2
  806. package/src/concepts/ProcessElement__.ts +19 -8
  807. package/src/concepts/ProcessOutcome__.ts +20 -2
  808. package/src/concepts/ProcessOutcomes__.ts +20 -2
  809. package/src/concepts/Process__.ts +15 -7
  810. package/src/concepts/QueryAggregateExpression__.ts +5 -1
  811. package/src/concepts/QueryFieldExpression__.ts +3 -0
  812. package/src/concepts/QueryFromExpression__.ts +5 -1
  813. package/src/concepts/QueryGroupByExpression__.ts +5 -1
  814. package/src/concepts/QueryJoinExpression__.ts +5 -1
  815. package/src/concepts/QueryLimitExpression__.ts +5 -1
  816. package/src/concepts/QueryOrderByExpression__.ts +5 -1
  817. package/src/concepts/QuerySelectExpression__.ts +5 -1
  818. package/src/concepts/Rect__.ts +3 -0
  819. package/src/concepts/Return__.ts +9 -3
  820. package/src/concepts/Role__.ts +3 -0
  821. package/src/concepts/SelectMembers__.ts +5 -1
  822. package/src/concepts/Slot__.ts +5 -1
  823. package/src/concepts/SqlQueryComponent__.ts +5 -1
  824. package/src/concepts/Start__.ts +3 -0
  825. package/src/concepts/StringInterpolation__.ts +7 -3
  826. package/src/concepts/StringLiteral__.ts +12 -3
  827. package/src/concepts/StructureProperty__.ts +12 -4
  828. package/src/concepts/Structure__.ts +25 -3
  829. package/src/concepts/SwitchCase__.ts +9 -1
  830. package/src/concepts/SwitchStatement__.ts +7 -3
  831. package/src/concepts/Theme__.ts +3 -0
  832. package/src/concepts/Transactional__.ts +3 -0
  833. package/src/concepts/TriggerEvent__.ts +5 -1
  834. package/src/concepts/TriggerLauncher__.ts +3 -0
  835. package/src/concepts/TypeAnnotation__.ts +62 -23
  836. package/src/concepts/TypeParam__.ts +3 -0
  837. package/src/concepts/UnaryExpression__.ts +8 -4
  838. package/src/concepts/Unparsed__.ts +5 -2
  839. package/src/concepts/UseComponent__.ts +3 -0
  840. package/src/concepts/ValidationRule__.ts +21 -7
  841. package/src/concepts/Variable__.ts +10 -4
  842. package/src/concepts/ViewBlock__.ts +3 -0
  843. package/src/concepts/ViewComponent__.ts +15 -6
  844. package/src/concepts/ViewElement__.ts +13 -5
  845. package/src/concepts/View__.ts +27 -11
  846. package/src/concepts/WhileStatement__.ts +7 -1
  847. package/src/concepts/basics/constants.ts +2 -0
  848. package/src/concepts/basics/stdlib/nasl.util.ts +3 -3
  849. package/src/concepts/index__.ts +2 -0
  850. package/src/concepts/types__.ts +4 -0
  851. package/src/decorators/index.ts +55 -0
  852. package/src/enums/KEYWORDS.ts +2 -0
  853. package/src/generator/genBundleFiles.ts +7 -7
  854. package/src/generator/genMetaData.ts +7 -2
  855. package/src/generator/genReleaseBody.ts +8 -4
  856. package/src/generator/icestark.ts +4 -2
  857. package/src/generator/qiankun.ts +3 -1
  858. package/src/natural/genNaturalTS.ts +5 -6
  859. package/src/natural/transformTSCode.ts +53 -13
  860. package/src/sentry/index.ts +3 -1
  861. package/src/server/extendBaseNode.ts +30 -2
  862. package/src/server/naslServer.ts +142 -22
  863. package/src/server/translator.ts +13 -1
  864. package/src/service/storage/jsoner.ts +2 -2
  865. package/src/translator/types.ts +1 -0
  866. package/src/translator/utils.ts +15 -0
  867. package/src/utils/sortTsString.ts +9 -4
  868. package/test/concepts/call-function/__snapshots__/toEmbeddedTS.spec.ts.snap +26 -0
  869. package/test/concepts/call-function/__snapshots__/toJS.spec.ts.snap +26 -0
  870. package/test/concepts/call-function/constant.ts +5 -0
  871. package/test/concepts/call-function/fixtures/from-string.json +100 -0
  872. package/test/concepts/call-function/fixtures/to-string-global-tz.json +99 -0
  873. package/test/concepts/call-function/fixtures/to-string-no-tz.json +89 -0
  874. package/test/concepts/call-function/fixtures/to-string-user-tz.json +101 -0
  875. package/test/concepts/call-function/fixtures/to-string-utc-tz.json +101 -0
  876. package/test/concepts/call-function/toEmbeddedTS.spec.ts +14 -0
  877. package/test/concepts/call-function/toJS.spec.ts +14 -0
  878. package/test/concepts/call-interface/__snapshots__/toEmbeddedTS.spec.ts.snap +6 -3
  879. package/test/concepts/call-logic/__snapshots__/getQuickInfoOffset.spec.ts.snap +3 -3
  880. package/test/concepts/call-logic/__snapshots__/toEmbeddedTS.spec.ts.snap +3 -3
@@ -1,1101 +1,1115 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
- return c > 3 && r && Object.defineProperty(target, key, r), r;
23
- };
24
- var __importStar = (this && this.__importStar) || function (mod) {
25
- if (mod && mod.__esModule) return mod;
26
- var result = {};
27
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
- __setModuleDefault(result, mod);
29
- return result;
30
- };
31
- var __importDefault = (this && this.__importDefault) || function (mod) {
32
- return (mod && mod.__esModule) ? mod : { "default": mod };
33
- };
34
- var View_1;
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.PAGE_COMPONENT_INCLUDE_TAG_MAP = exports.View = void 0;
37
- const translator_1 = require("../translator");
38
- const translator_2 = __importDefault(require("../bak/translator"));
39
- const Structure__1 = require("./Structure__");
40
- const Identifier__1 = __importDefault(require("./Identifier__"));
41
- const Assignment__1 = __importDefault(require("./Assignment__"));
42
- const BatchAssignment__1 = __importDefault(require("./BatchAssignment__"));
43
- const CallInterface__1 = __importDefault(require("./CallInterface__"));
44
- const CallLogic__1 = __importDefault(require("./CallLogic__"));
45
- const DefaultValue__1 = __importDefault(require("./DefaultValue__"));
46
- const decorators_1 = require("../decorators");
47
- const utils = __importStar(require("../utils"));
48
- const BaseNode_1 = __importDefault(require("../common/BaseNode"));
49
- const ViewElement__1 = __importDefault(require("./ViewElement__"));
50
- const Param__1 = __importDefault(require("./Param__"));
51
- const Variable__1 = __importDefault(require("./Variable__"));
52
- const Logic__1 = __importDefault(require("./Logic__"));
53
- const BindEvent__1 = __importDefault(require("./BindEvent__"));
54
- /**
55
- * 页面
56
- */
57
- let View = class View extends BaseNode_1.default {
58
- static { View_1 = this; }
59
- /** 类名 */
60
- static ConceptName = 'View';
61
- /**
62
- * 产品概念
63
- */
64
- concept;
65
- /**
66
- * 页面模板 Id
67
- */
68
- // @ts-ignore
69
- pageTemplateId;
70
- /**
71
- * 页面名称
72
- */
73
- // @ts-ignore
74
- name;
75
- /**
76
- * 唯一标识
77
- */
78
- // @ts-ignore
79
- uuid;
80
- /**
81
- * 页面标题
82
- */
83
- // @ts-ignore
84
- title;
85
- /**
86
- * 面包屑
87
- */
88
- // @ts-ignore
89
- crumb;
90
- /**
91
- * 权限控制
92
- */
93
- // @ts-ignore
94
- auth;
95
- /**
96
- * 权限资源描述
97
- */
98
- // @ts-ignore
99
- authDescription;
100
- /**
101
- * 是否是默认跳转的页面
102
- */
103
- // @ts-ignore
104
- isIndex;
105
- /**
106
- * 未解析的模板代码
107
- */
108
- // @ts-ignore
109
- template;
110
- /**
111
- * 未解析的逻辑代码
112
- */
113
- // @ts-ignore
114
- script;
115
- /**
116
- * 未解析的样式代码
117
- */
118
- // @ts-ignore
119
- style;
120
- /**
121
- * 页面元素列表
122
- */
123
- elements = [];
124
- /**
125
- * 输入参数列表
126
- */
127
- params = [];
128
- /**
129
- * 变量列表
130
- */
131
- variables = [];
132
- /**
133
- * 逻辑列表
134
- */
135
- logics = [];
136
- /**
137
- * 元素绑定事件列表
138
- */
139
- bindEvents = [];
140
- /**
141
- * 绑定的角色
142
- */
143
- bindRoles = [];
144
- /**
145
- * 页面列表
146
- */
147
- children = [];
148
- /**
149
- * 祖先 Module
150
- */
151
- get module() {
152
- return this.getAncestor('Module');
153
- }
154
- /**
155
- * 祖先 App
156
- */
157
- get app() {
158
- return this.getAncestor('App');
159
- }
160
- /**
161
- * 祖先 Frontend
162
- */
163
- get frontend() {
164
- return this.getAncestor('Frontend');
165
- }
166
- /**
167
- * @param source 需要合并的部分参数
168
- */
169
- constructor(source) {
170
- source = Object.assign({}, View_1.getDefaultOptions(), source);
171
- super(source);
172
- super.subConstructor(source);
173
- }
174
- static from(source, parentNode, parentKey) {
175
- return super.from(source, parentNode, parentKey);
176
- }
177
- /**
178
- * 从父级删除该节点
179
- * @internal
180
- */
181
- _delete() {
182
- let params = null;
183
- if (this.parentNode) {
184
- params = this.parentNode?.__removeView?.(this);
185
- }
186
- return params;
187
- }
188
- /**
189
- * 设置页面名称
190
- */
191
- setName(name) {
192
- const object = {
193
- name,
194
- };
195
- this.update({
196
- ...object,
197
- field: 'name',
198
- });
199
- }
200
- /**
201
- * 设置页面标题
202
- */
203
- setTitle(title) {
204
- const object = {
205
- title,
206
- };
207
- this.update({
208
- ...object,
209
- });
210
- }
211
- /**
212
- * 设置面包屑
213
- */
214
- setCrumb(crumb) {
215
- const object = {
216
- crumb,
217
- };
218
- this.update({
219
- ...object,
220
- });
221
- }
222
- /**
223
- * 设置权限控制
224
- */
225
- setAuth(auth) {
226
- const object = {
227
- auth,
228
- };
229
- this.update({
230
- ...object,
231
- });
232
- }
233
- /**
234
- * 设置权限资源描述
235
- */
236
- setAuthDescription(authDescription) {
237
- const object = {
238
- authDescription,
239
- };
240
- this.update({
241
- ...object,
242
- });
243
- }
244
- /**
245
- * 设置是否是默认跳转的页面
246
- */
247
- setIsIndex(isIndex) {
248
- const object = {
249
- isIndex,
250
- };
251
- this.update({
252
- ...object,
253
- });
254
- }
255
- _insertViewElementAt(options, index) {
256
- const viewElementOptions = {};
257
- const relationOptions = { parentNode: this, parentKey: 'elements' };
258
- let viewElement;
259
- if (!options) {
260
- viewElement = ViewElement__1.default.from({
261
- ...viewElementOptions,
262
- name: this.getViewElementUniqueName(),
263
- }, this, 'elements');
264
- }
265
- else if (typeof options === 'string') {
266
- viewElement = ViewElement__1.default.from({
267
- ...viewElementOptions,
268
- name: options,
269
- }, this, 'elements');
270
- }
271
- else if (options instanceof ViewElement__1.default) {
272
- options.ensureDelete(); // 同一实例不支持多处存在
273
- viewElement = options;
274
- Object.assign(viewElement, relationOptions);
275
- }
276
- else {
277
- viewElement = ViewElement__1.default.from({
278
- ...viewElementOptions,
279
- ...options,
280
- }, this, 'elements');
281
- }
282
- this.elements.splice(index, 0, viewElement);
283
- return viewElement;
284
- }
285
- insertViewElementAt(options, index) {
286
- const node = this._insertViewElementAt(options, index);
287
- node.create({
288
- index,
289
- parentNode: this,
290
- parentKey: 'elements',
291
- });
292
- return node;
293
- }
294
- _addViewElement(options) {
295
- const index = this.elements.length;
296
- return this._insertViewElementAt(options, index);
297
- }
298
- addViewElement(options) {
299
- const node = this._addViewElement(options);
300
- const index = this.elements.indexOf(node);
301
- node.create({
302
- index,
303
- parentNode: this,
304
- parentKey: 'elements',
305
- });
306
- return node;
307
- }
308
- getParamUniqueName(name = 'param1') {
309
- return utils.unique(name, this.getVarExistingNames(), undefined, false);
310
- }
311
- _insertParamAt(options, index) {
312
- const paramOptions = {};
313
- const relationOptions = { parentNode: this, parentKey: 'params' };
314
- let param;
315
- if (!options) {
316
- param = Param__1.default.from({
317
- ...paramOptions,
318
- name: this.getParamUniqueName(),
319
- }, this, 'params');
320
- }
321
- else if (typeof options === 'string') {
322
- param = Param__1.default.from({
323
- ...paramOptions,
324
- name: options,
325
- }, this, 'params');
326
- }
327
- else if (options instanceof Param__1.default) {
328
- options.ensureDelete(); // 同一实例不支持多处存在
329
- param = options;
330
- Object.assign(param, relationOptions);
331
- }
332
- else {
333
- param = Param__1.default.from({
334
- ...paramOptions,
335
- ...options,
336
- }, this, 'params');
337
- }
338
- this.params.splice(index, 0, param);
339
- return param;
340
- }
341
- insertParamAt(options, index) {
342
- const node = this._insertParamAt(options, index);
343
- node.create({
344
- index,
345
- parentNode: this,
346
- parentKey: 'params',
347
- });
348
- return node;
349
- }
350
- _addParam(options) {
351
- const index = this.params.length;
352
- return this._insertParamAt(options, index);
353
- }
354
- addParam(options) {
355
- const node = this._addParam(options);
356
- const index = this.params.indexOf(node);
357
- node.create({
358
- index,
359
- parentNode: this,
360
- parentKey: 'params',
361
- });
362
- return node;
363
- }
364
- getVariableUniqueName(name = 'variable1') {
365
- return utils.unique(name, this.getVarExistingNames(), undefined, false);
366
- }
367
- _insertVariableAt(options, index) {
368
- const variableOptions = {};
369
- const relationOptions = { parentNode: this, parentKey: 'variables' };
370
- let variable;
371
- if (!options) {
372
- variable = Variable__1.default.from({
373
- ...variableOptions,
374
- name: this.getVariableUniqueName(),
375
- }, this, 'variables');
376
- }
377
- else if (typeof options === 'string') {
378
- variable = Variable__1.default.from({
379
- ...variableOptions,
380
- name: options,
381
- }, this, 'variables');
382
- }
383
- else if (options instanceof Variable__1.default) {
384
- options.ensureDelete(); // 同一实例不支持多处存在
385
- variable = options;
386
- Object.assign(variable, relationOptions);
387
- }
388
- else {
389
- variable = Variable__1.default.from({
390
- ...variableOptions,
391
- ...options,
392
- }, this, 'variables');
393
- }
394
- this.variables.splice(index, 0, variable);
395
- return variable;
396
- }
397
- insertVariableAt(options, index) {
398
- const node = this._insertVariableAt(options, index);
399
- node.create({
400
- index,
401
- parentNode: this,
402
- parentKey: 'variables',
403
- });
404
- return node;
405
- }
406
- _addVariable(options) {
407
- const index = this.variables.length;
408
- return this._insertVariableAt(options, index);
409
- }
410
- addVariable(options) {
411
- const node = this._addVariable(options);
412
- const index = this.variables.indexOf(node);
413
- node.create({
414
- index,
415
- parentNode: this,
416
- parentKey: 'variables',
417
- });
418
- return node;
419
- }
420
- getLogicUniqueName(name = 'logic1') {
421
- return utils.unique(name, this.getLogicExistingNames(), undefined, false);
422
- }
423
- _insertLogicAt(options, index) {
424
- const logicOptions = {};
425
- const relationOptions = { parentNode: this, parentKey: 'logics' };
426
- let logic;
427
- if (!options) {
428
- logic = Logic__1.default.from({
429
- ...logicOptions,
430
- name: this.getLogicUniqueName(),
431
- }, this, 'logics');
432
- }
433
- else if (typeof options === 'string') {
434
- logic = Logic__1.default.from({
435
- ...logicOptions,
436
- name: options,
437
- }, this, 'logics');
438
- }
439
- else if (options instanceof Logic__1.default) {
440
- options.ensureDelete(); // 同一实例不支持多处存在
441
- logic = options;
442
- Object.assign(logic, relationOptions);
443
- }
444
- else {
445
- logic = Logic__1.default.from({
446
- ...logicOptions,
447
- ...options,
448
- }, this, 'logics');
449
- }
450
- this.logics.splice(index, 0, logic);
451
- return logic;
452
- }
453
- insertLogicAt(options, index) {
454
- const node = this._insertLogicAt(options, index);
455
- node.create({
456
- index,
457
- parentNode: this,
458
- parentKey: 'logics',
459
- });
460
- return node;
461
- }
462
- _addLogic(options) {
463
- const index = this.logics.length;
464
- return this._insertLogicAt(options, index);
465
- }
466
- addLogic(options) {
467
- const node = this._addLogic(options);
468
- const index = this.logics.indexOf(node);
469
- node.create({
470
- index,
471
- parentNode: this,
472
- parentKey: 'logics',
473
- });
474
- return node;
475
- }
476
- getBindEventExistingNames(excludedList = []) {
477
- const excludedSet = new Set(excludedList);
478
- return (this.bindEvents || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
479
- }
480
- getBindEventUniqueName(name = 'bindEvent1') {
481
- return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
482
- }
483
- _insertBindEventAt(options, index) {
484
- const bindEventOptions = {};
485
- const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
486
- let bindEvent;
487
- if (!options) {
488
- bindEvent = BindEvent__1.default.from({
489
- ...bindEventOptions,
490
- name: this.getBindEventUniqueName(),
491
- }, this, 'bindEvents');
492
- }
493
- else if (typeof options === 'string') {
494
- bindEvent = BindEvent__1.default.from({
495
- ...bindEventOptions,
496
- name: options,
497
- }, this, 'bindEvents');
498
- }
499
- else if (options instanceof BindEvent__1.default) {
500
- options.ensureDelete(); // 同一实例不支持多处存在
501
- bindEvent = options;
502
- Object.assign(bindEvent, relationOptions);
503
- }
504
- else {
505
- bindEvent = BindEvent__1.default.from({
506
- ...bindEventOptions,
507
- ...options,
508
- }, this, 'bindEvents');
509
- }
510
- this.bindEvents.splice(index, 0, bindEvent);
511
- return bindEvent;
512
- }
513
- insertBindEventAt(options, index) {
514
- const node = this._insertBindEventAt(options, index);
515
- node.create({
516
- index,
517
- parentNode: this,
518
- parentKey: 'bindEvents',
519
- });
520
- return node;
521
- }
522
- _addBindEvent(options) {
523
- const index = this.bindEvents.length;
524
- return this._insertBindEventAt(options, index);
525
- }
526
- addBindEvent(options) {
527
- const node = this._addBindEvent(options);
528
- const index = this.bindEvents.indexOf(node);
529
- node.create({
530
- index,
531
- parentNode: this,
532
- parentKey: 'bindEvents',
533
- });
534
- return node;
535
- }
536
- getViewExistingNames(excludedList = []) {
537
- const excludedSet = new Set(excludedList);
538
- return (this.children || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
539
- }
540
- getViewUniqueName(name = 'view1') {
541
- return utils.unique(name, this.getViewExistingNames(), undefined, false);
542
- }
543
- _insertViewAt(options, index) {
544
- const viewOptions = {};
545
- const relationOptions = { parentNode: this, parentKey: 'children' };
546
- let view;
547
- if (!options) {
548
- view = View_1.from({
549
- ...viewOptions,
550
- name: this.getViewUniqueName(),
551
- }, this, 'children');
552
- }
553
- else if (typeof options === 'string') {
554
- view = View_1.from({
555
- ...viewOptions,
556
- name: options,
557
- }, this, 'children');
558
- }
559
- else if (options instanceof View_1) {
560
- options.ensureDelete(); // 同一实例不支持多处存在
561
- view = options;
562
- Object.assign(view, relationOptions);
563
- }
564
- else {
565
- view = View_1.from({
566
- ...viewOptions,
567
- ...options,
568
- }, this, 'children');
569
- }
570
- this.children.splice(index, 0, view);
571
- return view;
572
- }
573
- insertViewAt(options, index) {
574
- const node = this._insertViewAt(options, index);
575
- node.create({
576
- index,
577
- parentNode: this,
578
- parentKey: 'children',
579
- });
580
- return node;
581
- }
582
- _addView(options) {
583
- const index = this.children.length;
584
- return this._insertViewAt(options, index);
585
- }
586
- addView(options) {
587
- const node = this._addView(options);
588
- const index = this.children.indexOf(node);
589
- node.create({
590
- index,
591
- parentNode: this,
592
- parentKey: 'children',
593
- });
594
- return node;
595
- }
596
- removeViewElement(options) {
597
- let viewElement;
598
- if (typeof options === 'string') {
599
- viewElement = this.elements.find((item) => item.name === options);
600
- if (!viewElement) {
601
- throw new Error('找不到页面元素 ' + options);
602
- }
603
- }
604
- else {
605
- viewElement = options;
606
- }
607
- return viewElement.delete();
608
- }
609
- __removeViewElement(viewElement) {
610
- const parentKey = viewElement.parentKey;
611
- const params = {
612
- parentNode: this,
613
- parentKey,
614
- index: -1,
615
- object: null,
616
- oldObject: viewElement,
617
- };
618
- if (parentKey) {
619
- params.parentKey = parentKey;
620
- // @ts-ignore
621
- const t = this.__v_raw || this;
622
- // @ts-ignore
623
- const n = viewElement.__v_raw || viewElement;
624
- if (Array.isArray(t[parentKey])) {
625
- const index = t[parentKey].indexOf(n);
626
- ~index && this[parentKey].splice(index, 1);
627
- params.index = index;
628
- }
629
- else if (t[parentKey] === n) {
630
- params.index = 0;
631
- this[parentKey] = undefined;
632
- }
633
- }
634
- return params;
635
- }
636
- removeParam(options) {
637
- let param;
638
- if (typeof options === 'string') {
639
- param = this.params.find((item) => item.name === options);
640
- if (!param) {
641
- throw new Error('找不到输入参数 ' + options);
642
- }
643
- }
644
- else {
645
- param = options;
646
- }
647
- return param.delete();
648
- }
649
- __removeParam(param) {
650
- const parentKey = param.parentKey;
651
- const params = {
652
- parentNode: this,
653
- parentKey,
654
- index: -1,
655
- object: null,
656
- oldObject: param,
657
- };
658
- if (parentKey) {
659
- params.parentKey = parentKey;
660
- // @ts-ignore
661
- const t = this.__v_raw || this;
662
- // @ts-ignore
663
- const n = param.__v_raw || param;
664
- if (Array.isArray(t[parentKey])) {
665
- const index = t[parentKey].indexOf(n);
666
- ~index && this[parentKey].splice(index, 1);
667
- params.index = index;
668
- }
669
- else if (t[parentKey] === n) {
670
- params.index = 0;
671
- this[parentKey] = undefined;
672
- }
673
- }
674
- return params;
675
- }
676
- removeVariable(options) {
677
- let variable;
678
- if (typeof options === 'string') {
679
- variable = this.variables.find((item) => item.name === options);
680
- if (!variable) {
681
- throw new Error('找不到变量 ' + options);
682
- }
683
- }
684
- else {
685
- variable = options;
686
- }
687
- return variable.delete();
688
- }
689
- __removeVariable(variable) {
690
- const parentKey = variable.parentKey;
691
- const params = {
692
- parentNode: this,
693
- parentKey,
694
- index: -1,
695
- object: null,
696
- oldObject: variable,
697
- };
698
- if (parentKey) {
699
- params.parentKey = parentKey;
700
- // @ts-ignore
701
- const t = this.__v_raw || this;
702
- // @ts-ignore
703
- const n = variable.__v_raw || variable;
704
- if (Array.isArray(t[parentKey])) {
705
- const index = t[parentKey].indexOf(n);
706
- ~index && this[parentKey].splice(index, 1);
707
- params.index = index;
708
- }
709
- else if (t[parentKey] === n) {
710
- params.index = 0;
711
- this[parentKey] = undefined;
712
- }
713
- }
714
- return params;
715
- }
716
- removeLogic(options) {
717
- let logic;
718
- if (typeof options === 'string') {
719
- logic = this.logics.find((item) => item.name === options);
720
- if (!logic) {
721
- throw new Error('找不到逻辑 ' + options);
722
- }
723
- }
724
- else {
725
- logic = options;
726
- }
727
- return logic.delete();
728
- }
729
- __removeLogic(logic) {
730
- const parentKey = logic.parentKey;
731
- const params = {
732
- parentNode: this,
733
- parentKey,
734
- index: -1,
735
- object: null,
736
- oldObject: logic,
737
- };
738
- if (parentKey) {
739
- params.parentKey = parentKey;
740
- // @ts-ignore
741
- const t = this.__v_raw || this;
742
- // @ts-ignore
743
- const n = logic.__v_raw || logic;
744
- if (Array.isArray(t[parentKey])) {
745
- const index = t[parentKey].indexOf(n);
746
- ~index && this[parentKey].splice(index, 1);
747
- params.index = index;
748
- }
749
- else if (t[parentKey] === n) {
750
- params.index = 0;
751
- this[parentKey] = undefined;
752
- }
753
- }
754
- return params;
755
- }
756
- removeBindEvent(options) {
757
- let bindEvent;
758
- if (typeof options === 'string') {
759
- bindEvent = this.bindEvents.find((item) => item.name === options);
760
- if (!bindEvent) {
761
- throw new Error('找不到元素绑定事件 ' + options);
762
- }
763
- }
764
- else {
765
- bindEvent = options;
766
- }
767
- return bindEvent.delete();
768
- }
769
- __removeBindEvent(bindEvent) {
770
- const parentKey = bindEvent.parentKey;
771
- const params = {
772
- parentNode: this,
773
- parentKey,
774
- index: -1,
775
- object: null,
776
- oldObject: bindEvent,
777
- };
778
- if (parentKey) {
779
- params.parentKey = parentKey;
780
- // @ts-ignore
781
- const t = this.__v_raw || this;
782
- // @ts-ignore
783
- const n = bindEvent.__v_raw || bindEvent;
784
- if (Array.isArray(t[parentKey])) {
785
- const index = t[parentKey].indexOf(n);
786
- ~index && this[parentKey].splice(index, 1);
787
- params.index = index;
788
- }
789
- else if (t[parentKey] === n) {
790
- params.index = 0;
791
- this[parentKey] = undefined;
792
- }
793
- }
794
- return params;
795
- }
796
- removeView(options) {
797
- let view;
798
- if (typeof options === 'string') {
799
- view = this.children.find((item) => item.name === options);
800
- if (!view) {
801
- throw new Error('找不到页面 ' + options);
802
- }
803
- }
804
- else {
805
- view = options;
806
- }
807
- return view.delete();
808
- }
809
- __removeView(view) {
810
- const parentKey = view.parentKey;
811
- const params = {
812
- parentNode: this,
813
- parentKey,
814
- index: -1,
815
- object: null,
816
- oldObject: view,
817
- };
818
- if (parentKey) {
819
- params.parentKey = parentKey;
820
- // @ts-ignore
821
- const t = this.__v_raw || this;
822
- // @ts-ignore
823
- const n = view.__v_raw || view;
824
- if (Array.isArray(t[parentKey])) {
825
- const index = t[parentKey].indexOf(n);
826
- ~index && this[parentKey].splice(index, 1);
827
- params.index = index;
828
- }
829
- else if (t[parentKey] === n) {
830
- params.index = 0;
831
- this[parentKey] = undefined;
832
- }
833
- }
834
- return params;
835
- }
836
- //================================================================================
837
- // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
838
- // 自动生成的代码已结束。下面可以手动编写。
839
- //================================================================================
840
- /* 主页面有没有权限 */
841
- get parentAuth() {
842
- const _nameSpace = this.getTsNamespace();
843
- const _nameSpaceArr = _nameSpace.split('.');
844
- const viewsIndex = _nameSpaceArr.findIndex((item) => item === 'views');
845
- const mainViewName = _nameSpaceArr[viewsIndex + 1];
846
- return mainViewName ? this.frontend.views.find((item) => item.name === mainViewName)?.auth : this.auth;
847
- }
848
- /**
849
- * 设置页面权限
850
- */
851
- setBindRoles(bindRoles) {
852
- const object = {
853
- bindRoles,
854
- };
855
- this.update({
856
- ...object,
857
- });
858
- }
859
- findLogicByName(name) {
860
- return this.logics.find((logic) => logic.name === name);
861
- }
862
- existingViewElement = new Set();
863
- // 收集已经存在的ViewElement
864
- collectExistingViewElementName(excludedList = []) {
865
- const excludedSet = new Set(excludedList);
866
- this.elements.forEach((element) => {
867
- utils.traverse(({ node }) => {
868
- if (!excludedSet.has(node)) {
869
- this.existingViewElement.add(node.name);
870
- }
871
- }, {
872
- node: element,
873
- });
874
- });
875
- }
876
- // 获取当前页面的所有组件的名字
877
- getViewElementExistingNames(excludedList = []) {
878
- if (!this.existingViewElement.size) {
879
- this.collectExistingViewElementName();
880
- }
881
- return Array.from(this.existingViewElement);
882
- }
883
- getViewElementUniqueName(name = 'viewElement1') {
884
- this.collectExistingViewElementName();
885
- const viewElementUniqueName = utils.unique(name, this.existingViewElement);
886
- this.existingViewElement.add(viewElementUniqueName);
887
- return viewElementUniqueName;
888
- }
889
- getAllViewElementNames(excludeName) {
890
- const res = [];
891
- this.elements.forEach((element) => {
892
- utils.traverse(({ node }) => {
893
- if (node.name !== excludeName)
894
- res.push(node.name);
895
- }, {
896
- node: element,
897
- });
898
- });
899
- return Array.from(res);
900
- }
901
- // 组件名是否有效
902
- isValidElementName(name) {
903
- if (name) {
904
- return !this.getViewElementExistingNames().find((existingName) => existingName === name);
905
- }
906
- return false;
907
- }
908
- static TAG_NAME_PREFIX_REG = /^([lieu]|van)[-_]/;
909
- mergeBlock({ code, nodePath, position, cb }) {
910
- const template = utils.sliceTagContent(code, 'template');
911
- let targetNode = this.app.findNodeByPath(nodePath);
912
- let parentNode = position === 'append' ? targetNode : targetNode.parentNode;
913
- if (parentNode.concept === 'View') {
914
- parentNode = targetNode;
915
- if (position === 'insertBefore') {
916
- targetNode = parentNode.children[0];
917
- }
918
- else if (position === 'insertAfter') {
919
- const len = parentNode.children.length;
920
- targetNode = parentNode.children[len - 1];
921
- }
922
- }
923
- const definitionStr = utils.sliceTagContent(code, 'definition') || '{}';
924
- const definition = JSON.parse(definitionStr);
925
- let node = null;
926
- if (template) {
927
- node = ViewElement__1.default.fromHTML(template, {
928
- view: this,
929
- definition,
930
- });
931
- if (!parentNode) {
932
- return;
933
- }
934
- if (position === 'append') {
935
- parentNode.addViewElement(node);
936
- cb && cb(parentNode, node);
937
- }
938
- else {
939
- const index = targetNode.getIndexOfParent();
940
- if (position === 'insertBefore') {
941
- parentNode.insertViewElementAt(node, index);
942
- }
943
- else if (position === 'insertAfter') {
944
- parentNode.insertViewElementAt(node, index + 1);
945
- }
946
- }
947
- }
948
- // 服务端逻辑
949
- if (Array.isArray(definition.logics)) {
950
- definition.logics.forEach((logicOption) => {
951
- const logic = Logic__1.default.from({
952
- ...logicOption,
953
- }, this.rootNode, 'logics');
954
- this.rootNode.addLogic(logic);
955
- });
956
- }
957
- // 全局结构体
958
- if (Array.isArray(definition.structures)) {
959
- definition.structures.forEach((structureOption) => {
960
- const structure = Structure__1.Structure.from({
961
- ...structureOption,
962
- }, this.rootNode, 'structures');
963
- this.rootNode.addStructure(structure);
964
- });
965
- }
966
- // 页面入参
967
- if (Array.isArray(definition.viewParams)) {
968
- definition.viewParams.forEach((paramsOption) => {
969
- const param = Param__1.default.from({
970
- ...paramsOption,
971
- }, this, 'params');
972
- this._addParam(param);
973
- param.addParamsPrepare();
974
- });
975
- }
976
- // 页面变量
977
- if (Array.isArray(definition.viewVariables)) {
978
- definition.viewVariables.forEach((variableOption) => {
979
- const variable = Variable__1.default.from({
980
- ...variableOption,
981
- }, this, 'variables');
982
- this.addVariable(variable);
983
- });
984
- }
985
- // 页面逻辑
986
- if (Array.isArray(definition.viewLogics)) {
987
- definition.viewLogics.forEach((logicOption) => {
988
- // 页面逻辑只有load函数的走之前的逻辑其余不用创建
989
- if (logicOption.name.startsWith('load')) {
990
- // const logic = Logic.from(
991
- // {
992
- // ...logicOption,
993
- // },
994
- // this,
995
- // 'logics'
996
- // );
997
- // this.addLogic(logic);
998
- }
999
- });
1000
- }
1001
- // 页面事件
1002
- if (Array.isArray(definition.viewBindEvents)) {
1003
- definition.viewBindEvents.forEach((eventOption) => {
1004
- const newLogic = definition.viewLogics.find((logic) => eventOption.calleeName === logic.name);
1005
- const bindEvent = this.bindEvents.find((currentEventItem) => currentEventItem.name === eventOption.name);
1006
- // 如果没有event对象就先新增一个,如果已经有了就在内部添加logic
1007
- if (!bindEvent) {
1008
- const event = BindEvent__1.default.from({
1009
- ...eventOption,
1010
- calleeName: '',
1011
- logics: [newLogic],
1012
- }, this, 'events');
1013
- this.addBindEvent(event);
1014
- }
1015
- else {
1016
- const index = bindEvent.logics.length;
1017
- newLogic.name += index;
1018
- bindEvent.addLogic(newLogic);
1019
- }
1020
- });
1021
- }
1022
- return node;
1023
- }
1024
- onChange($event) {
1025
- this.emit('change', $event);
1026
- }
1027
- getLogicExistingNames(excludedList = []) {
1028
- const excludedSet = new Set(excludedList);
1029
- const varList = [];
1030
- if (Array.isArray(this.params)) {
1031
- varList.push(...this.params);
1032
- }
1033
- if (Array.isArray(this.variables)) {
1034
- varList.push(...this.variables);
1035
- }
1036
- if (Array.isArray(this.logics)) {
1037
- varList.push(...this.logics);
1038
- }
1039
- return varList.filter((item) => !excludedSet.has(item)).map((item) => item.name);
1040
- }
1041
- getVarExistingNames(excludedList = []) {
1042
- const excludedSet = new Set(excludedList);
1043
- const varList = [];
1044
- if (Array.isArray(this.params)) {
1045
- varList.push(...this.params);
1046
- }
1047
- if (Array.isArray(this.variables)) {
1048
- varList.push(...this.variables);
1049
- }
1050
- if (Array.isArray(this.logics)) {
1051
- this.logics.forEach((logic) => {
1052
- varList.push(logic);
1053
- if (Array.isArray(logic.params)) {
1054
- varList.push(...logic.params);
1055
- }
1056
- if (Array.isArray(logic.returns)) {
1057
- varList.push(...logic.returns);
1058
- }
1059
- if (Array.isArray(logic.variables)) {
1060
- varList.push(...logic.variables);
1061
- }
1062
- });
1063
- }
1064
- // 事件逻辑的变量不允许和页面逻辑下的重复
1065
- if (Array.isArray(this.elementLogicRoot) && this.elementLogicRoot.length) {
1066
- this.elementLogicRoot[0]?.children.forEach((logic) => {
1067
- if (Array.isArray(logic.variables)) {
1068
- varList.push(...logic.variables);
1069
- }
1070
- });
1071
- }
1072
- return varList.filter((item) => !excludedSet.has(item)).map((item) => item.name);
1073
- }
1074
- /**
1075
- * 生成 Vue 中需要的 JS 代码
1076
- * @TODO 这一版先做成 componentOptions 式的,后面再美化
1077
- */
1078
- genScript() {
1079
- const componentList = [];
1080
- const componentListExtra = [];
1081
- this.elementsAttrs(this.elements, componentList);
1082
- this.elementsAttrsAll(this.elements, componentListExtra);
1083
- const definition = {
1084
- params: this.params,
1085
- variables: this.variables,
1086
- logics: this.logics,
1087
- events: this.bindEvents,
1088
- title: this.title,
1089
- crumb: this.crumb,
1090
- first: this.children.find((child) => child.isIndex)?.name,
1091
- auth: this.auth ? 'loginAuth' : undefined,
1092
- viewBindEvents: this.getViewBindEvents(),
1093
- viewExpressions: this.getViewExpressions(),
1094
- elements: componentList,
1095
- elementsAll: componentListExtra,
1096
- };
1097
- let code = '';
1098
- let mixin = '';
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
31
+ var __importDefault = (this && this.__importDefault) || function (mod) {
32
+ return (mod && mod.__esModule) ? mod : { "default": mod };
33
+ };
34
+ var View_1;
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.PAGE_COMPONENT_INCLUDE_TAG_MAP = exports.View = void 0;
37
+ const translator_1 = require("../translator");
38
+ const translator_2 = __importDefault(require("../bak/translator"));
39
+ const Structure__1 = require("./Structure__");
40
+ const Identifier__1 = __importDefault(require("./Identifier__"));
41
+ const Assignment__1 = __importDefault(require("./Assignment__"));
42
+ const BatchAssignment__1 = __importDefault(require("./BatchAssignment__"));
43
+ const CallInterface__1 = __importDefault(require("./CallInterface__"));
44
+ const CallLogic__1 = __importDefault(require("./CallLogic__"));
45
+ const DefaultValue__1 = __importDefault(require("./DefaultValue__"));
46
+ const decorators_1 = require("../decorators");
47
+ const utils = __importStar(require("../utils"));
48
+ const BaseNode_1 = __importDefault(require("../common/BaseNode"));
49
+ const ViewElement__1 = __importDefault(require("./ViewElement__"));
50
+ const Param__1 = __importDefault(require("./Param__"));
51
+ const Variable__1 = __importDefault(require("./Variable__"));
52
+ const Logic__1 = __importDefault(require("./Logic__"));
53
+ const BindEvent__1 = __importDefault(require("./BindEvent__"));
54
+ /**
55
+ * 页面
56
+ */
57
+ let View = View_1 =
58
+ // @ts-ignore
59
+ class View extends BaseNode_1.default {
60
+ /** 类名 */
61
+ static ConceptName = 'View';
62
+ /** 继承链 */
63
+ static inheritanceChain = ['BaseNode'];
64
+ /**
65
+ * 产品概念
66
+ */
67
+ concept;
68
+ /**
69
+ * 页面模板 Id
70
+ */
71
+ // @ts-ignore
72
+ pageTemplateId;
73
+ /**
74
+ * 页面名称
75
+ */
76
+ // @ts-ignore
77
+ name;
78
+ /**
79
+ * 唯一标识
80
+ */
81
+ // @ts-ignore
82
+ uuid;
83
+ /**
84
+ * 页面标题
85
+ */
86
+ // @ts-ignore
87
+ title;
88
+ /**
89
+ * 面包屑
90
+ */
91
+ // @ts-ignore
92
+ crumb;
93
+ /**
94
+ * 权限控制
95
+ */
96
+ // @ts-ignore
97
+ auth;
98
+ /**
99
+ * 权限资源描述
100
+ */
101
+ // @ts-ignore
102
+ authDescription;
103
+ /**
104
+ * 是否是默认跳转的页面
105
+ */
106
+ // @ts-ignore
107
+ isIndex;
108
+ /**
109
+ * 未解析的模板代码
110
+ */
111
+ // @ts-ignore
112
+ template;
113
+ /**
114
+ * 未解析的逻辑代码
115
+ */
116
+ // @ts-ignore
117
+ script;
118
+ /**
119
+ * 未解析的样式代码
120
+ */
121
+ // @ts-ignore
122
+ style;
123
+ /**
124
+ * 页面元素列表
125
+ */
126
+ elements = [];
127
+ /**
128
+ * 输入参数列表
129
+ */
130
+ params = [];
131
+ /**
132
+ * 变量列表
133
+ */
134
+ variables = [];
135
+ /**
136
+ * 逻辑列表
137
+ */
138
+ logics = [];
139
+ /**
140
+ * 元素绑定事件列表
141
+ */
142
+ bindEvents = [];
143
+ /**
144
+ * 绑定的角色
145
+ */
146
+ bindRoles = [];
147
+ /**
148
+ * 页面列表
149
+ */
150
+ children = [];
151
+ /**
152
+ * 祖先 Module
153
+ */
154
+ get module() {
155
+ return this.getAncestor('Module');
156
+ }
157
+ /**
158
+ * 祖先 App
159
+ */
160
+ get app() {
161
+ return this.getAncestor('App');
162
+ }
163
+ /**
164
+ * 祖先 Frontend
165
+ */
166
+ get frontend() {
167
+ return this.getAncestor('Frontend');
168
+ }
169
+ /**
170
+ * @param source 需要合并的部分参数
171
+ */
172
+ constructor(source) {
173
+ source = Object.assign({}, View_1.getDefaultOptions(), source);
174
+ super(source);
175
+ super.subConstructor(source);
176
+ }
177
+ static from(source, parentNode, parentKey) {
178
+ return super.from(source, parentNode, parentKey);
179
+ }
180
+ /**
181
+ * 从父级删除该节点
182
+ * @internal
183
+ */
184
+ _delete() {
185
+ let params = null;
186
+ if (this.parentNode) {
187
+ params = this.parentNode?.__removeView?.(this);
188
+ }
189
+ return params;
190
+ }
191
+ /**
192
+ * 设置页面名称
193
+ */
194
+ setName(name) {
195
+ const object = {
196
+ name,
197
+ };
198
+ this.update({
199
+ ...object,
200
+ field: 'name',
201
+ });
202
+ }
203
+ /**
204
+ * 设置页面标题
205
+ */
206
+ setTitle(title) {
207
+ const object = {
208
+ title,
209
+ };
210
+ this.update({
211
+ ...object,
212
+ });
213
+ }
214
+ /**
215
+ * 设置面包屑
216
+ */
217
+ setCrumb(crumb) {
218
+ const object = {
219
+ crumb,
220
+ };
221
+ this.update({
222
+ ...object,
223
+ });
224
+ }
225
+ /**
226
+ * 设置权限控制
227
+ */
228
+ setAuth(auth) {
229
+ const object = {
230
+ auth,
231
+ };
232
+ this.update({
233
+ ...object,
234
+ });
235
+ }
236
+ /**
237
+ * 设置权限资源描述
238
+ */
239
+ setAuthDescription(authDescription) {
240
+ const object = {
241
+ authDescription,
242
+ };
243
+ this.update({
244
+ ...object,
245
+ });
246
+ }
247
+ /**
248
+ * 设置是否是默认跳转的页面
249
+ */
250
+ setIsIndex(isIndex) {
251
+ const object = {
252
+ isIndex,
253
+ };
254
+ this.update({
255
+ ...object,
256
+ });
257
+ }
258
+ _insertViewElementAt(options, index) {
259
+ const viewElementOptions = {};
260
+ const relationOptions = { parentNode: this, parentKey: 'elements' };
261
+ let viewElement;
262
+ if (!options) {
263
+ viewElement = ViewElement__1.default.from({
264
+ ...viewElementOptions,
265
+ name: this.getViewElementUniqueName(),
266
+ }, this, 'elements');
267
+ }
268
+ else if (typeof options === 'string') {
269
+ viewElement = ViewElement__1.default.from({
270
+ ...viewElementOptions,
271
+ name: options,
272
+ }, this, 'elements');
273
+ }
274
+ else if (options instanceof ViewElement__1.default) {
275
+ options.ensureDelete(); // 同一实例不支持多处存在
276
+ viewElement = options;
277
+ Object.assign(viewElement, relationOptions);
278
+ }
279
+ else {
280
+ viewElement = ViewElement__1.default.from({
281
+ ...viewElementOptions,
282
+ ...options,
283
+ }, this, 'elements');
284
+ }
285
+ this.elements.splice(index, 0, viewElement);
286
+ return viewElement;
287
+ }
288
+ insertViewElementAt(options, index) {
289
+ const node = this._insertViewElementAt(options, index);
290
+ node.create({
291
+ index,
292
+ parentNode: this,
293
+ parentKey: 'elements',
294
+ });
295
+ return node;
296
+ }
297
+ _addViewElement(options) {
298
+ const index = this.elements.length;
299
+ return this._insertViewElementAt(options, index);
300
+ }
301
+ addViewElement(options) {
302
+ const node = this._addViewElement(options);
303
+ const index = this.elements.indexOf(node);
304
+ node.create({
305
+ index,
306
+ parentNode: this,
307
+ parentKey: 'elements',
308
+ });
309
+ return node;
310
+ }
311
+ getParamUniqueName(name = 'param1') {
312
+ return utils.unique(name, this.getVarExistingNames(), undefined, false);
313
+ }
314
+ _insertParamAt(options, index) {
315
+ const paramOptions = {};
316
+ const relationOptions = { parentNode: this, parentKey: 'params' };
317
+ let param;
318
+ if (!options) {
319
+ param = Param__1.default.from({
320
+ ...paramOptions,
321
+ name: this.getParamUniqueName(),
322
+ }, this, 'params');
323
+ }
324
+ else if (typeof options === 'string') {
325
+ param = Param__1.default.from({
326
+ ...paramOptions,
327
+ name: options,
328
+ }, this, 'params');
329
+ }
330
+ else if (options instanceof Param__1.default) {
331
+ options.ensureDelete(); // 同一实例不支持多处存在
332
+ param = options;
333
+ Object.assign(param, relationOptions);
334
+ }
335
+ else {
336
+ param = Param__1.default.from({
337
+ ...paramOptions,
338
+ ...options,
339
+ }, this, 'params');
340
+ }
341
+ this.params.splice(index, 0, param);
342
+ return param;
343
+ }
344
+ insertParamAt(options, index) {
345
+ const node = this._insertParamAt(options, index);
346
+ node.create({
347
+ index,
348
+ parentNode: this,
349
+ parentKey: 'params',
350
+ });
351
+ return node;
352
+ }
353
+ _addParam(options) {
354
+ const index = this.params.length;
355
+ return this._insertParamAt(options, index);
356
+ }
357
+ addParam(options) {
358
+ const node = this._addParam(options);
359
+ const index = this.params.indexOf(node);
360
+ node.create({
361
+ index,
362
+ parentNode: this,
363
+ parentKey: 'params',
364
+ });
365
+ return node;
366
+ }
367
+ getVariableUniqueName(name = 'variable1') {
368
+ return utils.unique(name, this.getVarExistingNames(), undefined, false);
369
+ }
370
+ _insertVariableAt(options, index) {
371
+ const variableOptions = {};
372
+ const relationOptions = { parentNode: this, parentKey: 'variables' };
373
+ let variable;
374
+ if (!options) {
375
+ variable = Variable__1.default.from({
376
+ ...variableOptions,
377
+ name: this.getVariableUniqueName(),
378
+ }, this, 'variables');
379
+ }
380
+ else if (typeof options === 'string') {
381
+ variable = Variable__1.default.from({
382
+ ...variableOptions,
383
+ name: options,
384
+ }, this, 'variables');
385
+ }
386
+ else if (options instanceof Variable__1.default) {
387
+ options.ensureDelete(); // 同一实例不支持多处存在
388
+ variable = options;
389
+ Object.assign(variable, relationOptions);
390
+ }
391
+ else {
392
+ variable = Variable__1.default.from({
393
+ ...variableOptions,
394
+ ...options,
395
+ }, this, 'variables');
396
+ }
397
+ this.variables.splice(index, 0, variable);
398
+ return variable;
399
+ }
400
+ insertVariableAt(options, index) {
401
+ const node = this._insertVariableAt(options, index);
402
+ node.create({
403
+ index,
404
+ parentNode: this,
405
+ parentKey: 'variables',
406
+ });
407
+ return node;
408
+ }
409
+ _addVariable(options) {
410
+ const index = this.variables.length;
411
+ return this._insertVariableAt(options, index);
412
+ }
413
+ addVariable(options) {
414
+ const node = this._addVariable(options);
415
+ const index = this.variables.indexOf(node);
416
+ node.create({
417
+ index,
418
+ parentNode: this,
419
+ parentKey: 'variables',
420
+ });
421
+ return node;
422
+ }
423
+ getLogicUniqueName(name = 'logic1') {
424
+ return utils.unique(name, this.getLogicExistingNames(), undefined, false);
425
+ }
426
+ _insertLogicAt(options, index) {
427
+ const logicOptions = {};
428
+ const relationOptions = { parentNode: this, parentKey: 'logics' };
429
+ let logic;
430
+ if (!options) {
431
+ logic = Logic__1.default.from({
432
+ ...logicOptions,
433
+ name: this.getLogicUniqueName(),
434
+ }, this, 'logics');
435
+ }
436
+ else if (typeof options === 'string') {
437
+ logic = Logic__1.default.from({
438
+ ...logicOptions,
439
+ name: options,
440
+ }, this, 'logics');
441
+ }
442
+ else if (options instanceof Logic__1.default) {
443
+ options.ensureDelete(); // 同一实例不支持多处存在
444
+ logic = options;
445
+ Object.assign(logic, relationOptions);
446
+ }
447
+ else {
448
+ logic = Logic__1.default.from({
449
+ ...logicOptions,
450
+ ...options,
451
+ }, this, 'logics');
452
+ }
453
+ this.logics.splice(index, 0, logic);
454
+ return logic;
455
+ }
456
+ insertLogicAt(options, index) {
457
+ const node = this._insertLogicAt(options, index);
458
+ node.create({
459
+ index,
460
+ parentNode: this,
461
+ parentKey: 'logics',
462
+ });
463
+ return node;
464
+ }
465
+ _addLogic(options) {
466
+ const index = this.logics.length;
467
+ return this._insertLogicAt(options, index);
468
+ }
469
+ addLogic(options) {
470
+ const node = this._addLogic(options);
471
+ const index = this.logics.indexOf(node);
472
+ node.create({
473
+ index,
474
+ parentNode: this,
475
+ parentKey: 'logics',
476
+ });
477
+ return node;
478
+ }
479
+ getBindEventExistingNames(excludedList = []) {
480
+ const excludedSet = new Set(excludedList);
481
+ return (this.bindEvents || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
482
+ }
483
+ getBindEventUniqueName(name = 'bindEvent1') {
484
+ return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
485
+ }
486
+ _insertBindEventAt(options, index) {
487
+ const bindEventOptions = {};
488
+ const relationOptions = { parentNode: this, parentKey: 'bindEvents' };
489
+ let bindEvent;
490
+ if (!options) {
491
+ bindEvent = BindEvent__1.default.from({
492
+ ...bindEventOptions,
493
+ name: this.getBindEventUniqueName(),
494
+ }, this, 'bindEvents');
495
+ }
496
+ else if (typeof options === 'string') {
497
+ bindEvent = BindEvent__1.default.from({
498
+ ...bindEventOptions,
499
+ name: options,
500
+ }, this, 'bindEvents');
501
+ }
502
+ else if (options instanceof BindEvent__1.default) {
503
+ options.ensureDelete(); // 同一实例不支持多处存在
504
+ bindEvent = options;
505
+ Object.assign(bindEvent, relationOptions);
506
+ }
507
+ else {
508
+ bindEvent = BindEvent__1.default.from({
509
+ ...bindEventOptions,
510
+ ...options,
511
+ }, this, 'bindEvents');
512
+ }
513
+ this.bindEvents.splice(index, 0, bindEvent);
514
+ return bindEvent;
515
+ }
516
+ insertBindEventAt(options, index) {
517
+ const node = this._insertBindEventAt(options, index);
518
+ node.create({
519
+ index,
520
+ parentNode: this,
521
+ parentKey: 'bindEvents',
522
+ });
523
+ return node;
524
+ }
525
+ _addBindEvent(options) {
526
+ const index = this.bindEvents.length;
527
+ return this._insertBindEventAt(options, index);
528
+ }
529
+ addBindEvent(options) {
530
+ const node = this._addBindEvent(options);
531
+ const index = this.bindEvents.indexOf(node);
532
+ node.create({
533
+ index,
534
+ parentNode: this,
535
+ parentKey: 'bindEvents',
536
+ });
537
+ return node;
538
+ }
539
+ getViewExistingNames(excludedList = []) {
540
+ const excludedSet = new Set(excludedList);
541
+ return (this.children || []).filter((item) => !excludedSet.has(item)).map((item) => item.name);
542
+ }
543
+ getViewUniqueName(name = 'view1') {
544
+ return utils.unique(name, this.getViewExistingNames(), undefined, false);
545
+ }
546
+ _insertViewAt(options, index) {
547
+ const viewOptions = {};
548
+ const relationOptions = { parentNode: this, parentKey: 'children' };
549
+ let view;
550
+ if (!options) {
551
+ view = View_1.from({
552
+ ...viewOptions,
553
+ name: this.getViewUniqueName(),
554
+ }, this, 'children');
555
+ }
556
+ else if (typeof options === 'string') {
557
+ view = View_1.from({
558
+ ...viewOptions,
559
+ name: options,
560
+ }, this, 'children');
561
+ }
562
+ else if (options instanceof View_1) {
563
+ options.ensureDelete(); // 同一实例不支持多处存在
564
+ view = options;
565
+ Object.assign(view, relationOptions);
566
+ }
567
+ else {
568
+ view = View_1.from({
569
+ ...viewOptions,
570
+ ...options,
571
+ }, this, 'children');
572
+ }
573
+ this.children.splice(index, 0, view);
574
+ return view;
575
+ }
576
+ insertViewAt(options, index) {
577
+ const node = this._insertViewAt(options, index);
578
+ node.create({
579
+ index,
580
+ parentNode: this,
581
+ parentKey: 'children',
582
+ });
583
+ return node;
584
+ }
585
+ _addView(options) {
586
+ const index = this.children.length;
587
+ return this._insertViewAt(options, index);
588
+ }
589
+ addView(options) {
590
+ const node = this._addView(options);
591
+ const index = this.children.indexOf(node);
592
+ node.create({
593
+ index,
594
+ parentNode: this,
595
+ parentKey: 'children',
596
+ });
597
+ return node;
598
+ }
599
+ removeViewElement(options) {
600
+ let viewElement;
601
+ if (typeof options === 'string') {
602
+ viewElement = this.elements.find((item) => item.name === options);
603
+ if (!viewElement) {
604
+ throw new Error('找不到页面元素 ' + options);
605
+ }
606
+ }
607
+ else {
608
+ viewElement = options;
609
+ }
610
+ return viewElement.delete();
611
+ }
612
+ __removeViewElement(viewElement) {
613
+ const parentKey = viewElement.parentKey;
614
+ const params = {
615
+ parentNode: this,
616
+ parentKey,
617
+ index: -1,
618
+ object: null,
619
+ oldObject: viewElement,
620
+ };
621
+ if (parentKey) {
622
+ params.parentKey = parentKey;
623
+ // @ts-ignore
624
+ const t = this.__v_raw || this;
625
+ // @ts-ignore
626
+ const n = viewElement.__v_raw || viewElement;
627
+ if (Array.isArray(t[parentKey])) {
628
+ // @ts-ignore
629
+ const index = t[parentKey].findIndex((el) => (el.__v_raw || el) === n);
630
+ ~index && this[parentKey].splice(index, 1);
631
+ params.index = index;
632
+ }
633
+ else if (t[parentKey] === n) {
634
+ params.index = 0;
635
+ this[parentKey] = undefined;
636
+ }
637
+ }
638
+ return params;
639
+ }
640
+ removeParam(options) {
641
+ let param;
642
+ if (typeof options === 'string') {
643
+ param = this.params.find((item) => item.name === options);
644
+ if (!param) {
645
+ throw new Error('找不到输入参数 ' + options);
646
+ }
647
+ }
648
+ else {
649
+ param = options;
650
+ }
651
+ return param.delete();
652
+ }
653
+ __removeParam(param) {
654
+ const parentKey = param.parentKey;
655
+ const params = {
656
+ parentNode: this,
657
+ parentKey,
658
+ index: -1,
659
+ object: null,
660
+ oldObject: param,
661
+ };
662
+ if (parentKey) {
663
+ params.parentKey = parentKey;
664
+ // @ts-ignore
665
+ const t = this.__v_raw || this;
666
+ // @ts-ignore
667
+ const n = param.__v_raw || param;
668
+ if (Array.isArray(t[parentKey])) {
669
+ // @ts-ignore
670
+ const index = t[parentKey].findIndex((el) => (el.__v_raw || el) === n);
671
+ ~index && this[parentKey].splice(index, 1);
672
+ params.index = index;
673
+ }
674
+ else if (t[parentKey] === n) {
675
+ params.index = 0;
676
+ this[parentKey] = undefined;
677
+ }
678
+ }
679
+ return params;
680
+ }
681
+ removeVariable(options) {
682
+ let variable;
683
+ if (typeof options === 'string') {
684
+ variable = this.variables.find((item) => item.name === options);
685
+ if (!variable) {
686
+ throw new Error('找不到变量 ' + options);
687
+ }
688
+ }
689
+ else {
690
+ variable = options;
691
+ }
692
+ return variable.delete();
693
+ }
694
+ __removeVariable(variable) {
695
+ const parentKey = variable.parentKey;
696
+ const params = {
697
+ parentNode: this,
698
+ parentKey,
699
+ index: -1,
700
+ object: null,
701
+ oldObject: variable,
702
+ };
703
+ if (parentKey) {
704
+ params.parentKey = parentKey;
705
+ // @ts-ignore
706
+ const t = this.__v_raw || this;
707
+ // @ts-ignore
708
+ const n = variable.__v_raw || variable;
709
+ if (Array.isArray(t[parentKey])) {
710
+ // @ts-ignore
711
+ const index = t[parentKey].findIndex((el) => (el.__v_raw || el) === n);
712
+ ~index && this[parentKey].splice(index, 1);
713
+ params.index = index;
714
+ }
715
+ else if (t[parentKey] === n) {
716
+ params.index = 0;
717
+ this[parentKey] = undefined;
718
+ }
719
+ }
720
+ return params;
721
+ }
722
+ removeLogic(options) {
723
+ let logic;
724
+ if (typeof options === 'string') {
725
+ logic = this.logics.find((item) => item.name === options);
726
+ if (!logic) {
727
+ throw new Error('找不到逻辑 ' + options);
728
+ }
729
+ }
730
+ else {
731
+ logic = options;
732
+ }
733
+ return logic.delete();
734
+ }
735
+ __removeLogic(logic) {
736
+ const parentKey = logic.parentKey;
737
+ const params = {
738
+ parentNode: this,
739
+ parentKey,
740
+ index: -1,
741
+ object: null,
742
+ oldObject: logic,
743
+ };
744
+ if (parentKey) {
745
+ params.parentKey = parentKey;
746
+ // @ts-ignore
747
+ const t = this.__v_raw || this;
748
+ // @ts-ignore
749
+ const n = logic.__v_raw || logic;
750
+ if (Array.isArray(t[parentKey])) {
751
+ // @ts-ignore
752
+ const index = t[parentKey].findIndex((el) => (el.__v_raw || el) === n);
753
+ ~index && this[parentKey].splice(index, 1);
754
+ params.index = index;
755
+ }
756
+ else if (t[parentKey] === n) {
757
+ params.index = 0;
758
+ this[parentKey] = undefined;
759
+ }
760
+ }
761
+ return params;
762
+ }
763
+ removeBindEvent(options) {
764
+ let bindEvent;
765
+ if (typeof options === 'string') {
766
+ bindEvent = this.bindEvents.find((item) => item.name === options);
767
+ if (!bindEvent) {
768
+ throw new Error('找不到元素绑定事件 ' + options);
769
+ }
770
+ }
771
+ else {
772
+ bindEvent = options;
773
+ }
774
+ return bindEvent.delete();
775
+ }
776
+ __removeBindEvent(bindEvent) {
777
+ const parentKey = bindEvent.parentKey;
778
+ const params = {
779
+ parentNode: this,
780
+ parentKey,
781
+ index: -1,
782
+ object: null,
783
+ oldObject: bindEvent,
784
+ };
785
+ if (parentKey) {
786
+ params.parentKey = parentKey;
787
+ // @ts-ignore
788
+ const t = this.__v_raw || this;
789
+ // @ts-ignore
790
+ const n = bindEvent.__v_raw || bindEvent;
791
+ if (Array.isArray(t[parentKey])) {
792
+ // @ts-ignore
793
+ const index = t[parentKey].findIndex((el) => (el.__v_raw || el) === n);
794
+ ~index && this[parentKey].splice(index, 1);
795
+ params.index = index;
796
+ }
797
+ else if (t[parentKey] === n) {
798
+ params.index = 0;
799
+ this[parentKey] = undefined;
800
+ }
801
+ }
802
+ return params;
803
+ }
804
+ removeView(options) {
805
+ let view;
806
+ if (typeof options === 'string') {
807
+ view = this.children.find((item) => item.name === options);
808
+ if (!view) {
809
+ throw new Error('找不到页面 ' + options);
810
+ }
811
+ }
812
+ else {
813
+ view = options;
814
+ }
815
+ return view.delete();
816
+ }
817
+ __removeView(view) {
818
+ const parentKey = view.parentKey;
819
+ const params = {
820
+ parentNode: this,
821
+ parentKey,
822
+ index: -1,
823
+ object: null,
824
+ oldObject: view,
825
+ };
826
+ if (parentKey) {
827
+ params.parentKey = parentKey;
828
+ // @ts-ignore
829
+ const t = this.__v_raw || this;
830
+ // @ts-ignore
831
+ const n = view.__v_raw || view;
832
+ if (Array.isArray(t[parentKey])) {
833
+ // @ts-ignore
834
+ const index = t[parentKey].findIndex((el) => (el.__v_raw || el) === n);
835
+ ~index && this[parentKey].splice(index, 1);
836
+ params.index = index;
837
+ }
838
+ else if (t[parentKey] === n) {
839
+ params.index = 0;
840
+ this[parentKey] = undefined;
841
+ }
842
+ }
843
+ return params;
844
+ }
845
+ //================================================================================
846
+ // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
847
+ // 自动生成的代码已结束。下面可以手动编写。
848
+ //================================================================================
849
+ /* 主页面有没有权限 */
850
+ get parentAuth() {
851
+ const _nameSpace = this.getTsNamespace();
852
+ const _nameSpaceArr = _nameSpace.split('.');
853
+ const viewsIndex = _nameSpaceArr.findIndex((item) => item === 'views');
854
+ const mainViewName = _nameSpaceArr[viewsIndex + 1];
855
+ return mainViewName ? this.frontend.views.find((item) => item.name === mainViewName)?.auth : this.auth;
856
+ }
857
+ /**
858
+ * 设置页面权限
859
+ */
860
+ setBindRoles(bindRoles) {
861
+ const object = {
862
+ bindRoles,
863
+ };
864
+ this.update({
865
+ ...object,
866
+ });
867
+ }
868
+ findLogicByName(name) {
869
+ return this.logics.find((logic) => logic.name === name);
870
+ }
871
+ existingViewElement = new Set();
872
+ // 收集已经存在的ViewElement
873
+ collectExistingViewElementName(excludedList = []) {
874
+ const excludedSet = new Set(excludedList);
875
+ this.elements.forEach((element) => {
876
+ utils.traverse(({ node }) => {
877
+ if (!excludedSet.has(node)) {
878
+ this.existingViewElement.add(node.name);
879
+ }
880
+ }, {
881
+ node: element,
882
+ });
883
+ });
884
+ }
885
+ // 获取当前页面的所有组件的名字
886
+ getViewElementExistingNames(excludedList = []) {
887
+ if (!this.existingViewElement.size) {
888
+ this.collectExistingViewElementName();
889
+ }
890
+ return Array.from(this.existingViewElement);
891
+ }
892
+ getViewElementUniqueName(name = 'viewElement1') {
893
+ this.collectExistingViewElementName();
894
+ const viewElementUniqueName = utils.unique(name, this.existingViewElement);
895
+ this.existingViewElement.add(viewElementUniqueName);
896
+ return viewElementUniqueName;
897
+ }
898
+ getAllViewElementNames(excludeName) {
899
+ const res = [];
900
+ this.elements.forEach((element) => {
901
+ utils.traverse(({ node }) => {
902
+ if (node.name !== excludeName)
903
+ res.push(node.name);
904
+ }, {
905
+ node: element,
906
+ });
907
+ });
908
+ return Array.from(res);
909
+ }
910
+ // 组件名是否有效
911
+ isValidElementName(name) {
912
+ if (name) {
913
+ return !this.getViewElementExistingNames().find((existingName) => existingName === name);
914
+ }
915
+ return false;
916
+ }
917
+ static TAG_NAME_PREFIX_REG = /^([lieu]|van)[-_]/;
918
+ mergeBlock({ code, nodePath, position, cb }) {
919
+ const template = utils.sliceTagContent(code, 'template');
920
+ let targetNode = this.app.findNodeByPath(nodePath);
921
+ let parentNode = position === 'append' ? targetNode : targetNode.parentNode;
922
+ if (parentNode.concept === 'View') {
923
+ parentNode = targetNode;
924
+ if (position === 'insertBefore') {
925
+ targetNode = parentNode.children[0];
926
+ }
927
+ else if (position === 'insertAfter') {
928
+ const len = parentNode.children.length;
929
+ targetNode = parentNode.children[len - 1];
930
+ }
931
+ }
932
+ const definitionStr = utils.sliceTagContent(code, 'definition') || '{}';
933
+ const definition = JSON.parse(definitionStr);
934
+ let node = null;
935
+ if (template) {
936
+ node = ViewElement__1.default.fromHTML(template, {
937
+ view: this,
938
+ definition,
939
+ });
940
+ if (!parentNode) {
941
+ return;
942
+ }
943
+ if (position === 'append') {
944
+ parentNode.addViewElement(node);
945
+ cb && cb(parentNode, node);
946
+ }
947
+ else {
948
+ const index = targetNode.getIndexOfParent();
949
+ if (position === 'insertBefore') {
950
+ parentNode.insertViewElementAt(node, index);
951
+ }
952
+ else if (position === 'insertAfter') {
953
+ parentNode.insertViewElementAt(node, index + 1);
954
+ }
955
+ }
956
+ }
957
+ // 服务端逻辑
958
+ if (Array.isArray(definition.logics)) {
959
+ definition.logics.forEach((logicOption) => {
960
+ const logic = Logic__1.default.from({
961
+ ...logicOption,
962
+ }, this.rootNode, 'logics');
963
+ this.rootNode.addLogic(logic);
964
+ });
965
+ }
966
+ // 全局结构体
967
+ if (Array.isArray(definition.structures)) {
968
+ definition.structures.forEach((structureOption) => {
969
+ const structure = Structure__1.Structure.from({
970
+ ...structureOption,
971
+ }, this.rootNode, 'structures');
972
+ this.rootNode.addStructure(structure);
973
+ });
974
+ }
975
+ // 页面入参
976
+ if (Array.isArray(definition.viewParams)) {
977
+ definition.viewParams.forEach((paramsOption) => {
978
+ const param = Param__1.default.from({
979
+ ...paramsOption,
980
+ }, this, 'params');
981
+ this._addParam(param);
982
+ param.addParamsPrepare();
983
+ });
984
+ }
985
+ // 页面变量
986
+ if (Array.isArray(definition.viewVariables)) {
987
+ definition.viewVariables.forEach((variableOption) => {
988
+ const variable = Variable__1.default.from({
989
+ ...variableOption,
990
+ }, this, 'variables');
991
+ this.addVariable(variable);
992
+ });
993
+ }
994
+ // 页面逻辑
995
+ if (Array.isArray(definition.viewLogics)) {
996
+ definition.viewLogics.forEach((logicOption) => {
997
+ // 页面逻辑只有load函数的走之前的逻辑其余不用创建
998
+ if (logicOption.name.startsWith('load')) {
999
+ // const logic = Logic.from(
1000
+ // {
1001
+ // ...logicOption,
1002
+ // },
1003
+ // this,
1004
+ // 'logics'
1005
+ // );
1006
+ // this.addLogic(logic);
1007
+ }
1008
+ });
1009
+ }
1010
+ // 页面事件
1011
+ if (Array.isArray(definition.viewBindEvents)) {
1012
+ definition.viewBindEvents.forEach((eventOption) => {
1013
+ const newLogic = definition.viewLogics.find((logic) => eventOption.calleeName === logic.name);
1014
+ const bindEvent = this.bindEvents.find((currentEventItem) => currentEventItem.name === eventOption.name);
1015
+ // 如果没有event对象就先新增一个,如果已经有了就在内部添加logic
1016
+ if (!bindEvent) {
1017
+ const event = BindEvent__1.default.from({
1018
+ ...eventOption,
1019
+ calleeName: '',
1020
+ logics: [newLogic],
1021
+ }, this, 'events');
1022
+ this.addBindEvent(event);
1023
+ }
1024
+ else {
1025
+ bindEvent.addLogic(newLogic);
1026
+ }
1027
+ });
1028
+ }
1029
+ return node;
1030
+ }
1031
+ onChange($event) {
1032
+ this.emit('change', $event);
1033
+ }
1034
+ getLogicExistingNames(excludedList = []) {
1035
+ const excludedSet = new Set(excludedList);
1036
+ const varList = [];
1037
+ if (Array.isArray(this.params)) {
1038
+ varList.push(...this.params);
1039
+ }
1040
+ if (Array.isArray(this.variables)) {
1041
+ varList.push(...this.variables);
1042
+ }
1043
+ if (Array.isArray(this.logics)) {
1044
+ varList.push(...this.logics);
1045
+ }
1046
+ if (Array.isArray(this.bindEvents)) {
1047
+ this.bindEvents.forEach((bindEvent) => {
1048
+ if (Array.isArray(bindEvent.logics)) {
1049
+ varList.push(...bindEvent.logics);
1050
+ }
1051
+ });
1052
+ }
1053
+ return varList.filter((item) => !excludedSet.has(item)).map((item) => item.name);
1054
+ }
1055
+ getVarExistingNames(excludedList = []) {
1056
+ const excludedSet = new Set(excludedList);
1057
+ const varList = [];
1058
+ if (Array.isArray(this.params)) {
1059
+ varList.push(...this.params);
1060
+ }
1061
+ if (Array.isArray(this.variables)) {
1062
+ varList.push(...this.variables);
1063
+ }
1064
+ if (Array.isArray(this.logics)) {
1065
+ this.logics.forEach((logic) => {
1066
+ varList.push(logic);
1067
+ if (Array.isArray(logic.params)) {
1068
+ varList.push(...logic.params);
1069
+ }
1070
+ if (Array.isArray(logic.returns)) {
1071
+ varList.push(...logic.returns);
1072
+ }
1073
+ if (Array.isArray(logic.variables)) {
1074
+ varList.push(...logic.variables);
1075
+ }
1076
+ });
1077
+ }
1078
+ // 事件逻辑的变量不允许和页面逻辑下的重复
1079
+ if (Array.isArray(this.elementLogicRoot) && this.elementLogicRoot.length) {
1080
+ this.elementLogicRoot[0]?.children.forEach((logic) => {
1081
+ if (Array.isArray(logic.variables)) {
1082
+ varList.push(...logic.variables);
1083
+ }
1084
+ });
1085
+ }
1086
+ return varList.filter((item) => !excludedSet.has(item)).map((item) => item.name);
1087
+ }
1088
+ /**
1089
+ * 生成 Vue 中需要的 JS 代码
1090
+ * @TODO 这一版先做成 componentOptions 式的,后面再美化
1091
+ */
1092
+ genScript() {
1093
+ const componentList = [];
1094
+ const componentListExtra = [];
1095
+ this.elementsAttrs(this.elements, componentList);
1096
+ this.elementsAttrsAll(this.elements, componentListExtra);
1097
+ const definition = {
1098
+ params: this.params,
1099
+ variables: this.variables,
1100
+ logics: this.logics,
1101
+ events: this.bindEvents,
1102
+ title: this.title,
1103
+ crumb: this.crumb,
1104
+ first: this.children.find((child) => child.isIndex)?.name,
1105
+ auth: this.auth ? 'loginAuth' : undefined,
1106
+ viewBindEvents: this.getViewBindEvents(),
1107
+ viewExpressions: this.getViewExpressions(),
1108
+ elements: componentList,
1109
+ elementsAll: componentListExtra,
1110
+ };
1111
+ let code = '';
1112
+ let mixin = '';
1099
1113
  const keyboardEventMixinCode = `const keyboardEventMixin = {
1100
1114
  mounted() {
1101
1115
  document.addEventListener('keydown', this.onKeyDown);
@@ -1107,1133 +1121,1121 @@ let View = class View extends BaseNode_1.default {
1107
1121
  },
1108
1122
  methods: {
1109
1123
  async onKeyDown(e) {
1110
- ${this.bindEvents
1111
- .filter((event) => ['keydown'].includes(event.name))
1112
- .map((event) => `await this.${event.view.name}_${event.name}(e);`)
1124
+ ${this.bindEvents
1125
+ .filter((event) => ['keydown'].includes(event.name))
1126
+ .map((event) => `await this.${event.view.name}_${event.name}(e);`)
1113
1127
  .join('\n')}
1114
1128
  },
1115
1129
  async onKeyUp(e) {
1116
- ${this.bindEvents
1117
- .filter((event) => ['keyup'].includes(event.name))
1118
- .map((event) => `await this.${event.view.name}_${event.name}(e);`)
1130
+ ${this.bindEvents
1131
+ .filter((event) => ['keyup'].includes(event.name))
1132
+ .map((event) => `await this.${event.view.name}_${event.name}(e);`)
1119
1133
  .join('\n')}
1120
1134
  }
1121
1135
  }
1122
- };`;
1123
- code += keyboardEventMixinCode;
1124
- if (this.script) {
1125
- mixin = this.script.trim().replace(/export default |module\.exports +=/, 'const mixin = ');
1126
- }
1127
- if (mixin) {
1128
- code += mixin;
1129
- }
1130
- code += 'export default {\n';
1131
- code += 'mixins: [';
1132
- const mixins = [];
1133
- // mixin
1134
- if (mixin) {
1135
- mixins.push('mixin');
1136
- }
1137
- // 键盘事件mixin
1138
- mixins.push('keyboardEventMixin');
1139
- code += mixins.join(',');
1140
- code += '],';
1141
- code += (0, translator_2.default)(definition);
1142
- code += '};\n';
1143
- return code;
1144
- }
1145
- genVueTemplate(options) {
1146
- return this.elements?.map((element) => `${element?.toVue(options)}\n`).join('');
1147
- }
1148
- /**
1149
- * 转换成 Vue 文件
1150
- */
1151
- toVue(options) {
1152
- let result = '';
1153
- result += `<template>\n${this.genVueTemplate(options)}\n</template>\n`;
1154
- result += `<script>\n${this.genScript()}\n</script>\n`;
1155
- return result;
1156
- }
1157
- /**
1158
- * 转换成设计器中使用的 Vue template 内容
1159
- * @param options
1160
- */
1161
- genDesignerVueTemplate() {
1162
- return this.elements.map((element) => `${element.toDesignerVue()}\n`).join('');
1163
- }
1164
- /**
1165
- * 转换成设计器中使用的 Vue 文件
1166
- * 目前不需要 script 和 style
1167
- * @param options
1168
- */
1169
- toDesignerVue() {
1170
- return `<template>\n${this.genDesignerVueTemplate()}</template>`;
1171
- }
1172
- /**
1173
- * 转换成 VueOptions
1174
- * @TODO 后面 template 可以优化成 render 函数
1175
- */
1176
- toVueOptions(options) {
1177
- return {
1178
- template: this.genVueTemplate(options),
1179
- script: this.genScript(),
1180
- };
1181
- }
1182
- /**
1183
- * 生成宿主语言的文件路径
1184
- * @param name 一般不用传,用于 rename
1185
- */
1186
- getEmbeddedFilePath(name = this.name) {
1187
- let pathName = name;
1188
- let parent = this.parentNode;
1189
- if (parent) {
1190
- while (parent && parent instanceof View_1) {
1191
- pathName = `${parent.name}/${pathName}`;
1192
- parent = parent.parentNode;
1193
- }
1194
- }
1195
- return `/embedded/${this.app.name}/frontends/${this.frontend.name}/views/${pathName}.ts`;
1196
- }
1197
- getNamespace() {
1198
- if (this.parentNode && this.parentNode.getNamespace) {
1199
- const parentNamespace = this.parentNode.getNamespace();
1200
- const parentName = this.parentNode.name;
1201
- const arr = [parentNamespace];
1202
- if (this.parentNode.concept !== 'App' && parentName) {
1203
- arr.push(parentName);
1204
- }
1205
- return `${arr.join('.')}.views`;
1206
- }
1207
- throw new Error('无法获取命名空间,请设置 parentNode!');
1208
- }
1209
- getTsNamespace() {
1210
- const parentNodeNamespace = this.getNamespace();
1211
- let tsCalleeNamespace = parentNodeNamespace.replace(/\.[0-9]/g, (m) => m.replace('.', '.$'));
1212
- tsCalleeNamespace = tsCalleeNamespace.replace(/-/g, '_');
1213
- return tsCalleeNamespace;
1214
- }
1215
- // 获取当前element,铺平
1216
- elementsMethods(elements, allMethods, parentNodeNames) {
1217
- if (elements) {
1218
- elements.forEach((item) => {
1219
- const { bindAttrs = [], name } = item;
1220
- const isDataSource = bindAttrs.some((attr) => attr.name === 'data-source');
1221
- const isInclude = parentNodeNames.includes(name);
1222
- allMethods.push(item);
1223
- if (item.children) {
1224
- if (isDataSource) {
1225
- if (isInclude) {
1226
- this.elementsMethods(item.children, allMethods, parentNodeNames);
1227
- }
1228
- }
1229
- else {
1230
- this.elementsMethods(item.children, allMethods, parentNodeNames);
1231
- }
1232
- }
1233
- });
1234
- }
1235
- }
1236
- // 获取当前element,铺平
1237
- elementsAttrs(elements, componentList) {
1238
- if (elements) {
1239
- elements.forEach((item) => {
1240
- if (exports.PAGE_COMPONENT_INCLUDE_TAG_MAP?.[item.tag]) {
1241
- componentList.push(item);
1242
- }
1243
- if (item.children.length > 0) {
1244
- this.elementsAttrs(item.children, componentList);
1245
- }
1246
- });
1247
- }
1248
- }
1249
- elementsAttrsAll(elements, componentListExtra) {
1250
- if (elements) {
1251
- elements.forEach((item) => {
1252
- if (!exports.PAGE_COMPONENT_INCLUDE_TAG_MAP?.[item.tag]) {
1253
- componentListExtra.push(item);
1254
- }
1255
- if (item.children.length > 0) {
1256
- this.elementsAttrsAll(item.children, componentListExtra);
1257
- }
1258
- });
1259
- }
1260
- }
1261
- toEmbeddedTS(state = (0, translator_1.createCompilerState)()) {
1262
- function chineseTsName(name) {
1263
- let tsName = name;
1264
- // 匹配所有特殊字符都转为_
1265
- tsName = tsName.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, '_');
1266
- return tsName;
1267
- }
1268
- // 获取虚拟logic的参数和内容
1269
- // 用作展示和tots查找引用
1270
- this.getElementLogicRoot();
1271
- let code = `export namespace ${this.tsName} {\n`;
1272
- // 角色
1273
- if (Array.isArray(this.bindRoles) && this.bindRoles.length) {
1274
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1275
- code += 'export let __bindRoles = [\n';
1276
- this.bindRoles.forEach((role) => {
1277
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1278
- code += `${this.app.getNamespace()}.roles.${chineseTsName(role)}.${chineseTsName(role)},`;
1279
- code += '\n';
1280
- });
1281
- code += '\n';
1282
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1283
- code += '];\n';
1284
- }
1285
- // 需要类型推导的局部变量/返回值需要调整申明顺序
1286
- const advanceMap = new Map();
1287
- this.traverseChildren((el) => {
1288
- if (el && (el instanceof BatchAssignment__1.default || (el instanceof Assignment__1.default && el.left?.name))) {
1289
- // 子页面内部逻辑过滤
1290
- if (el.view !== this)
1291
- return;
1292
- if (el instanceof Assignment__1.default) {
1293
- const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && el.left?.name === variable.name);
1294
- if (advanceVar && !advanceMap.get(advanceVar)) {
1295
- advanceMap.set(advanceVar, el);
1296
- }
1297
- }
1298
- else if (el instanceof BatchAssignment__1.default) {
1299
- el.assignmentLines.forEach(({ leftIndex }) => {
1300
- const leftCode = leftIndex.length === 1
1301
- ? el.left?.expression?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
1302
- : el.left?.members[leftIndex[1]]?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1303
- const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && leftCode === variable.name);
1304
- if (advanceVar && !advanceMap.get(advanceVar)) {
1305
- advanceMap.set(advanceVar, el);
1306
- }
1307
- });
1308
- }
1309
- }
1310
- });
1311
- // 用来储存默认值翻译结构是__IDENTIFIER__或者__IDENTIFIER__()的节点
1312
- const IDENTIFIERMAP = new Set();
1313
- if (Array.isArray(this.params)) {
1314
- this.params.forEach((param) => {
1315
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
1316
- code += param.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1317
- code += ';\n';
1318
- });
1319
- }
1320
- if (Array.isArray(this.variables)) {
1321
- this.variables.forEach((variable) => {
1322
- const ts = variable.defaultValue?.expression?.toEmbeddedTS();
1323
- if (['__IDENTIFIER__', '__IDENTIFIER__()'].includes(ts)) {
1324
- IDENTIFIERMAP.add(variable);
1325
- }
1326
- if (!advanceMap.get(variable)) {
1327
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
1328
- code += variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1329
- code += ';\n';
1330
- }
1331
- });
1332
- }
1333
- advanceMap.forEach((assignment, variable) => {
1334
- // 有默认值的用默认值来推导类型, 但是如果是__IDENTIFIER__或者__IDENTIFIER__(),就不需要默认值来推导了
1335
- if (variable.defaultValue?.expression && !IDENTIFIERMAP.has(variable)) {
1336
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
1337
- code += variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1338
- return;
1339
- }
1340
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}// @ts-ignore\n`;
1341
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
1342
- code += variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1343
- code += ' = ';
1344
- if (assignment instanceof BatchAssignment__1.default) {
1345
- assignment.assignmentLines.forEach(({ leftIndex, rightIndex }) => {
1346
- const leftCode = leftIndex.length === 1
1347
- ? assignment.left.expression.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
1348
- : assignment.left.members[leftIndex[1]]?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1349
- if (leftCode === variable.name) {
1350
- const rightNode = rightIndex.length === 1
1351
- ? assignment.rights[rightIndex[0]]?.expression
1352
- : assignment.rights[rightIndex[0]]?.members[rightIndex[1]];
1353
- const rightCode = rightNode?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1354
- code += this.getRightCode(rightCode, assignment, rightNode);
1355
- }
1356
- });
1357
- }
1358
- else {
1359
- let rightCode = '';
1360
- // 因为右侧枚举要赋值就得new 一下;
1361
- if (assignment.right &&
1362
- assignment.right instanceof Identifier__1.default &&
1363
- assignment.right.namespace &&
1364
- assignment.right.namespace.endsWith('enums')) {
1365
- rightCode += 'new ';
1366
- }
1367
- rightCode +=
1368
- assignment.right && assignment.right.toEmbeddedTS
1369
- ? assignment.right.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
1370
- : '__RIGHT__';
1371
- code += this.getRightCode(rightCode, assignment, assignment.right);
1372
- }
1373
- code += ';\n';
1374
- });
1375
- // elements类型声明定义
1376
- code += `interface __elements {\n`;
1377
- // 生成所有的name和类型定义
1378
- this.elements.forEach((element) => {
1379
- code += element.toEmbeddedTSDefinition((0, translator_1.shiftState)(state, code, {
1380
- tabSize: (state?.tabSize || 0) + 1,
1381
- }));
1382
- });
1383
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}}\n`;
1384
- code += `let __elements: __elements;\n`;
1385
- if (Array.isArray(this.elements)) {
1386
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}interface `;
1387
- code += `__elements_completionProperty {\n`;
1388
- const componentList = [];
1389
- this.elementsAttrs(this.elements, componentList);
1390
- const variableList = [];
1391
- this.elements.forEach((item) => {
1392
- code += item.toEmbeddedTSVariableDefinition((0, translator_1.shiftState)(state, code, { inline: true }), variableList);
1393
- });
1394
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1) + `}\n`;
1395
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1396
- code += `let __elements_completionProperty: __elements_completionProperty;\n`;
1397
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1398
- code += `let __elements_variable_function = {\n`;
1399
- this.elements.forEach((item) => {
1400
- code += item.toEmbeddedTSVariableFunctionDefinition((0, translator_1.shiftState)(state, code, { inline: true }));
1401
- });
1402
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1) + `}\n`;
1403
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1404
- code += `let __elements_stashFunctionVariable = {\n`;
1405
- variableList.forEach((item) => {
1406
- code += (0, translator_1.indent)((state?.tabSize || 0) + 2);
1407
- code += `${item}`;
1408
- });
1409
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1) + `}\n`;
1410
- }
1411
- // 逻辑
1412
- if (Array.isArray(this.logics) && this.logics.length) {
1413
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1414
- this.logics.forEach((logic) => {
1415
- code += logic.toEmbeddedTS((0, translator_1.shiftState)(state, code, {
1416
- tabSize: (state?.tabSize || 0) + 2,
1417
- }), 'noExport');
1418
- code += '\n';
1419
- });
1420
- code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1421
- }
1422
- // 事件
1423
- if (Array.isArray(this.bindEvents)) {
1424
- this.bindEvents.forEach((event) => {
1425
- code += event.toEmbeddedTS((0, translator_1.shiftState)(state, code, {
1426
- tabSize: state?.tabSize || 0,
1427
- }), true);
1428
- code += '\n';
1429
- });
1430
- }
1431
- // render函数
1432
- code += `\n${(0, translator_1.indent)((state?.tabSize || 0) + 1)}`;
1433
- code += `export function __render(`;
1434
- code += `){\n`;
1435
- code += (0, translator_1.indent)(state?.tabSize || 0);
1436
- // elements 元素
1437
- if (Array.isArray(this.elements)) {
1438
- // 生成嵌套式的内容
1439
- this.elements.forEach((element) => {
1440
- code += element.toEmbeddedTS((0, translator_1.shiftState)(state, code, {
1441
- tabSize: (state?.tabSize || 0) + 3,
1442
- }));
1443
- code += '\n';
1444
- });
1445
- }
1446
- code += `\n${(0, translator_1.indent)((state?.tabSize || 0) + 1)}}\n`;
1447
- if (Array.isArray(this.params)) {
1448
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}export function $destination(options: {`;
1449
- this.params.forEach((param, index) => {
1450
- code += `${param.name}?: `;
1451
- code += param.typeAnnotation.toEmbeddedTS((0, translator_1.shiftState)(state, code));
1452
- code += ', ';
1453
- });
1454
- // 锚点
1455
- code += `_anchor?: nasl.core.String`;
1456
- code += '}){}\n';
1457
- }
1458
- /* 默认值草稿区 ---------------------------*/
1459
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}export function __playground(){\n`;
1460
- /* 参数的默认值是__IDENTIFIER__或者__IDENTIFIER__()时不赋默认值,但是需要ts翻译出来进行报错校验 */
1461
- IDENTIFIERMAP.forEach((node) => {
1462
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 2)}`;
1463
- code += node.defaultValue.expression.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1464
- code += '; ';
1465
- });
1466
- code += '\n';
1467
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 2)}return\n`;
1468
- if (this.variables.length) {
1469
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 2)}/* -----以下是variables的默认值草稿------ */\n`;
1470
- }
1471
- this.variables.forEach((variable) => {
1472
- if (variable.defaultValue) {
1473
- variable.defaultValue.playground?.forEach((item) => {
1474
- code += item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 2 }));
1475
- code += ';\n';
1476
- });
1477
- }
1478
- });
1479
- if (this.params.length) {
1480
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 2)}/* -----以下是params的默认值草稿------ */\n`;
1481
- }
1482
- this.params.forEach((param) => {
1483
- if (param.defaultValue && param.defaultValue instanceof DefaultValue__1.default) {
1484
- param.defaultValue.playground?.forEach((item) => {
1485
- code += item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 2 }));
1486
- code += ';\n';
1487
- });
1488
- }
1489
- });
1490
- code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}}\n`;
1491
- code += `${(0, translator_1.indent)(state?.tabSize || 0)}}\n`;
1492
- return code;
1493
- }
1494
- toNaturalTS(state = (0, translator_1.createCompilerState)(), currentNode, declaration) {
1495
- // const isCurrentInThisView = currentNode?.getAncestor('View') === this;
1496
- if (declaration) {
1136
+ };`;
1137
+ code += keyboardEventMixinCode;
1138
+ if (this.script) {
1139
+ mixin = this.script.trim().replace(/export default |module\.exports +=/, 'const mixin = ');
1140
+ }
1141
+ if (mixin) {
1142
+ code += mixin;
1143
+ }
1144
+ code += 'export default {\n';
1145
+ code += 'mixins: [';
1146
+ const mixins = [];
1147
+ // mixin
1148
+ if (mixin) {
1149
+ mixins.push('mixin');
1150
+ }
1151
+ // 键盘事件mixin
1152
+ mixins.push('keyboardEventMixin');
1153
+ code += mixins.join(',');
1154
+ code += '],';
1155
+ code += (0, translator_2.default)(definition);
1156
+ code += '};\n';
1157
+ return code;
1158
+ }
1159
+ genVueTemplate(options) {
1160
+ return this.elements?.map((element) => `${element?.toVue(options)}\n`).join('');
1161
+ }
1162
+ /**
1163
+ * 转换成 Vue 文件
1164
+ */
1165
+ toVue(options) {
1166
+ let result = '';
1167
+ result += `<template>\n${this.genVueTemplate(options)}\n</template>\n`;
1168
+ result += `<script>\n${this.genScript()}\n</script>\n`;
1169
+ return result;
1170
+ }
1171
+ /**
1172
+ * 转换成设计器中使用的 Vue template 内容
1173
+ * @param options
1174
+ */
1175
+ genDesignerVueTemplate() {
1176
+ return this.elements.map((element) => `${element.toDesignerVue()}\n`).join('');
1177
+ }
1178
+ /**
1179
+ * 转换成设计器中使用的 Vue 文件
1180
+ * 目前不需要 script 和 style
1181
+ * @param options
1182
+ */
1183
+ toDesignerVue() {
1184
+ return `<template>\n${this.genDesignerVueTemplate()}</template>`;
1185
+ }
1186
+ /**
1187
+ * 转换成 VueOptions
1188
+ * @TODO 后面 template 可以优化成 render 函数
1189
+ */
1190
+ toVueOptions(options) {
1191
+ return {
1192
+ template: this.genVueTemplate(options),
1193
+ script: this.genScript(),
1194
+ };
1195
+ }
1196
+ /**
1197
+ * 生成宿主语言的文件路径
1198
+ * @param name 一般不用传,用于 rename
1199
+ */
1200
+ getEmbeddedFilePath(name = this.name) {
1201
+ let pathName = name;
1202
+ let parent = this.parentNode;
1203
+ if (parent) {
1204
+ while (parent && parent instanceof View_1) {
1205
+ pathName = `${parent.name}/${pathName}`;
1206
+ parent = parent.parentNode;
1207
+ }
1208
+ }
1209
+ return `/embedded/${this.app.name}/frontends/${this.frontend.name}/views/${pathName}.ts`;
1210
+ }
1211
+ getNamespace() {
1212
+ if (this.parentNode && this.parentNode.getNamespace) {
1213
+ const parentNamespace = this.parentNode.getNamespace();
1214
+ const parentName = this.parentNode.name;
1215
+ const arr = [parentNamespace];
1216
+ if (this.parentNode.concept !== 'App' && parentName) {
1217
+ arr.push(parentName);
1218
+ }
1219
+ return `${arr.join('.')}.views`;
1220
+ }
1221
+ throw new Error('无法获取命名空间,请设置 parentNode!');
1222
+ }
1223
+ getTsNamespace() {
1224
+ const parentNodeNamespace = this.getNamespace();
1225
+ let tsCalleeNamespace = parentNodeNamespace.replace(/\.[0-9]/g, (m) => m.replace('.', '.$'));
1226
+ tsCalleeNamespace = tsCalleeNamespace.replace(/-/g, '_');
1227
+ return tsCalleeNamespace;
1228
+ }
1229
+ // 获取当前element,铺平
1230
+ elementsMethods(elements, allMethods, parentNodeNames) {
1231
+ if (elements) {
1232
+ elements.forEach((item) => {
1233
+ const { bindAttrs = [], name } = item;
1234
+ const isDataSource = bindAttrs.some((attr) => attr.name === 'data-source');
1235
+ const isInclude = parentNodeNames.includes(name);
1236
+ allMethods.push(item);
1237
+ if (item.children) {
1238
+ if (isDataSource) {
1239
+ if (isInclude) {
1240
+ this.elementsMethods(item.children, allMethods, parentNodeNames);
1241
+ }
1242
+ }
1243
+ else {
1244
+ this.elementsMethods(item.children, allMethods, parentNodeNames);
1245
+ }
1246
+ }
1247
+ });
1248
+ }
1249
+ }
1250
+ // 获取当前element,铺平
1251
+ elementsAttrs(elements, componentList) {
1252
+ if (elements) {
1253
+ elements.forEach((item) => {
1254
+ if (exports.PAGE_COMPONENT_INCLUDE_TAG_MAP?.[item.tag]) {
1255
+ componentList.push(item);
1256
+ }
1257
+ if (item.children.length > 0) {
1258
+ this.elementsAttrs(item.children, componentList);
1259
+ }
1260
+ });
1261
+ }
1262
+ }
1263
+ elementsAttrsAll(elements, componentListExtra) {
1264
+ if (elements) {
1265
+ elements.forEach((item) => {
1266
+ if (!exports.PAGE_COMPONENT_INCLUDE_TAG_MAP?.[item.tag]) {
1267
+ componentListExtra.push(item);
1268
+ }
1269
+ if (item.children.length > 0) {
1270
+ this.elementsAttrsAll(item.children, componentListExtra);
1271
+ }
1272
+ });
1273
+ }
1274
+ }
1275
+ toEmbeddedTS(state = (0, translator_1.createCompilerState)()) {
1276
+ function chineseTsName(name) {
1277
+ let tsName = name;
1278
+ // 匹配所有特殊字符都转为_
1279
+ tsName = tsName.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, '_');
1280
+ return tsName;
1281
+ }
1282
+ // 获取虚拟logic的参数和内容
1283
+ // 用作展示和tots查找引用
1284
+ this.getElementLogicRoot();
1285
+ let code = `export namespace ${this.tsName} {\n`;
1286
+ // 角色
1287
+ if (Array.isArray(this.bindRoles) && this.bindRoles.length) {
1288
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1289
+ code += 'export let __bindRoles = [\n';
1290
+ this.bindRoles.forEach((role) => {
1291
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1292
+ code += `${this.app.getNamespace()}.roles.${chineseTsName(role)}.${chineseTsName(role)},`;
1293
+ code += '\n';
1294
+ });
1295
+ code += '\n';
1296
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1297
+ code += '];\n';
1298
+ }
1299
+ // 需要类型推导的局部变量/返回值需要调整申明顺序
1300
+ const advanceMap = new Map();
1301
+ this.traverseChildren((el) => {
1302
+ if (el && (el instanceof BatchAssignment__1.default || (el instanceof Assignment__1.default && el.left?.name))) {
1303
+ // 子页面内部逻辑过滤
1304
+ if (el.view !== this)
1305
+ return;
1306
+ if (el instanceof Assignment__1.default) {
1307
+ const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && el.left?.name === variable.name);
1308
+ if (advanceVar && !advanceMap.get(advanceVar)) {
1309
+ advanceMap.set(advanceVar, el);
1310
+ }
1311
+ }
1312
+ else if (el instanceof BatchAssignment__1.default) {
1313
+ el.assignmentLines.forEach(({ leftIndex }) => {
1314
+ const leftCode = leftIndex.length === 1
1315
+ ? el.left?.expression?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
1316
+ : el.left?.members[leftIndex[1]]?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1317
+ const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && leftCode === variable.name);
1318
+ if (advanceVar && !advanceMap.get(advanceVar)) {
1319
+ advanceMap.set(advanceVar, el);
1320
+ }
1321
+ });
1322
+ }
1323
+ }
1324
+ });
1325
+ // 用来储存默认值翻译结构是__IDENTIFIER__或者__IDENTIFIER__()的节点
1326
+ const IDENTIFIERMAP = new Set();
1327
+ if (Array.isArray(this.params)) {
1328
+ this.params.forEach((param) => {
1329
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
1330
+ code += param.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1331
+ code += ';\n';
1332
+ });
1333
+ }
1334
+ if (Array.isArray(this.variables)) {
1335
+ this.variables.forEach((variable) => {
1336
+ const ts = variable.defaultValue?.toEmbeddedTS();
1337
+ if (['__IDENTIFIER__', '__IDENTIFIER__()'].includes(ts)) {
1338
+ IDENTIFIERMAP.add(variable);
1339
+ }
1340
+ if (!advanceMap.get(variable)) {
1341
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
1342
+ code += variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1343
+ code += ';\n';
1344
+ }
1345
+ });
1346
+ }
1347
+ advanceMap.forEach((assignment, variable) => {
1348
+ // 有默认值的用默认值来推导类型, 但是如果是__IDENTIFIER__或者__IDENTIFIER__(),就不需要默认值来推导了
1349
+ if (variable.defaultValue?.expression && !IDENTIFIERMAP.has(variable)) {
1350
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
1351
+ code += variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1352
+ return;
1353
+ }
1354
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}// @ts-ignore\n`;
1355
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}let `;
1356
+ code += variable.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1357
+ code += ' = ';
1358
+ if (assignment instanceof BatchAssignment__1.default) {
1359
+ assignment.assignmentLines.forEach(({ leftIndex, rightIndex }) => {
1360
+ const leftCode = leftIndex.length === 1
1361
+ ? assignment.left.expression.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
1362
+ : assignment.left.members[leftIndex[1]]?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1363
+ if (leftCode === variable.name) {
1364
+ const rightNode = rightIndex.length === 1
1365
+ ? assignment.rights[rightIndex[0]]?.expression
1366
+ : assignment.rights[rightIndex[0]]?.members[rightIndex[1]];
1367
+ const rightCode = rightNode?.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1368
+ code += this.getRightCode(rightCode, assignment, rightNode);
1369
+ }
1370
+ });
1371
+ }
1372
+ else {
1373
+ let rightCode = '';
1374
+ // 因为右侧枚举要赋值就得new 一下;
1375
+ if (assignment.right &&
1376
+ assignment.right instanceof Identifier__1.default &&
1377
+ assignment.right.namespace &&
1378
+ assignment.right.namespace.endsWith('enums')) {
1379
+ rightCode += 'new ';
1380
+ }
1381
+ rightCode +=
1382
+ assignment.right && assignment.right.toEmbeddedTS
1383
+ ? assignment.right.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }))
1384
+ : '__RIGHT__';
1385
+ code += this.getRightCode(rightCode, assignment, assignment.right);
1386
+ }
1387
+ code += ';\n';
1388
+ });
1389
+ // elements类型声明定义
1390
+ code += `interface __elements {\n`;
1391
+ // 生成所有的name和类型定义
1392
+ this.elements.forEach((element) => {
1393
+ code += element.toEmbeddedTSDefinition((0, translator_1.shiftState)(state, code, {
1394
+ tabSize: (state?.tabSize || 0) + 1,
1395
+ }));
1396
+ });
1397
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}}\n`;
1398
+ code += `let __elements: __elements;\n`;
1399
+ if (Array.isArray(this.elements)) {
1400
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}interface `;
1401
+ code += `__elements_completionProperty {\n`;
1402
+ const componentList = [];
1403
+ this.elementsAttrs(this.elements, componentList);
1404
+ const variableList = [];
1405
+ this.elements.forEach((item) => {
1406
+ code += item.toEmbeddedTSVariableDefinition((0, translator_1.shiftState)(state, code, { inline: true }), variableList);
1407
+ });
1408
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1) + `}\n`;
1409
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1410
+ code += `let __elements_completionProperty: __elements_completionProperty;\n`;
1411
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1412
+ code += `let __elements_variable_function = {\n`;
1413
+ this.elements.forEach((item) => {
1414
+ code += item.toEmbeddedTSVariableFunctionDefinition((0, translator_1.shiftState)(state, code, { inline: true }));
1415
+ });
1416
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1) + `}\n`;
1417
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1418
+ code += `let __elements_stashFunctionVariable = {\n`;
1419
+ variableList.forEach((item) => {
1420
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 2);
1421
+ code += `${item}`;
1422
+ });
1423
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1) + `}\n`;
1424
+ }
1425
+ // 逻辑
1426
+ if (Array.isArray(this.logics) && this.logics.length) {
1427
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1428
+ this.logics.forEach((logic) => {
1429
+ code += logic.toEmbeddedTS((0, translator_1.shiftState)(state, code, {
1430
+ tabSize: (state?.tabSize || 0) + 2,
1431
+ }), 'noExport');
1432
+ code += '\n';
1433
+ });
1434
+ code += (0, translator_1.indent)((state?.tabSize || 0) + 1);
1435
+ }
1436
+ // 事件
1437
+ if (Array.isArray(this.bindEvents)) {
1438
+ this.bindEvents.forEach((event) => {
1439
+ code += event.toEmbeddedTS((0, translator_1.shiftState)(state, code, {
1440
+ tabSize: state?.tabSize || 0,
1441
+ }), true);
1442
+ code += '\n';
1443
+ });
1444
+ }
1445
+ // render函数
1446
+ code += `\n${(0, translator_1.indent)((state?.tabSize || 0) + 1)}`;
1447
+ code += `export function __render(`;
1448
+ code += `){\n`;
1449
+ code += (0, translator_1.indent)(state?.tabSize || 0);
1450
+ // elements 元素
1451
+ if (Array.isArray(this.elements)) {
1452
+ // 生成嵌套式的内容
1453
+ this.elements.forEach((element) => {
1454
+ code += element.toEmbeddedTS((0, translator_1.shiftState)(state, code, {
1455
+ tabSize: (state?.tabSize || 0) + 3,
1456
+ }));
1457
+ code += '\n';
1458
+ });
1459
+ }
1460
+ code += `\n${(0, translator_1.indent)((state?.tabSize || 0) + 1)}}\n`;
1461
+ if (Array.isArray(this.params)) {
1462
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}export function $destination(options: {`;
1463
+ this.params.forEach((param, index) => {
1464
+ code += `${param.name}?: `;
1465
+ code += param.typeAnnotation.toEmbeddedTS((0, translator_1.shiftState)(state, code));
1466
+ code += ', ';
1467
+ });
1468
+ // 锚点
1469
+ code += `_anchor?: nasl.core.String`;
1470
+ code += '}){}\n';
1471
+ }
1472
+ /* 默认值草稿区 ---------------------------*/
1473
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}export function __playground(){\n`;
1474
+ /* 参数的默认值是__IDENTIFIER__或者__IDENTIFIER__()时不赋默认值,但是需要ts翻译出来进行报错校验 */
1475
+ IDENTIFIERMAP.forEach((node) => {
1476
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 2)}`;
1477
+ code += node.defaultValue.toEmbeddedTS((0, translator_1.shiftState)(state, code, { inline: true }));
1478
+ code += '; ';
1479
+ });
1480
+ code += '\n';
1481
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 2)}return\n`;
1482
+ if (this.variables.length) {
1483
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 2)}/* -----以下是variables的默认值草稿------ */\n`;
1484
+ }
1485
+ this.variables.forEach((variable) => {
1486
+ if (variable.defaultValue) {
1487
+ variable.defaultValue.playground?.forEach((item) => {
1488
+ code += item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 2 }));
1489
+ code += ';\n';
1490
+ });
1491
+ }
1492
+ });
1493
+ if (this.params.length) {
1494
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 2)}/* -----以下是params的默认值草稿------ */\n`;
1495
+ }
1496
+ this.params.forEach((param) => {
1497
+ if (param.defaultValue && param.defaultValue instanceof DefaultValue__1.default) {
1498
+ param.defaultValue.playground?.forEach((item) => {
1499
+ code += item.toEmbeddedTS((0, translator_1.shiftState)(state, code, { tabSize: (state?.tabSize || 0) + 2 }));
1500
+ code += ';\n';
1501
+ });
1502
+ }
1503
+ });
1504
+ code += `${(0, translator_1.indent)((state?.tabSize || 0) + 1)}}\n`;
1505
+ code += `${(0, translator_1.indent)(state?.tabSize || 0)}}\n`;
1506
+ return code;
1507
+ }
1508
+ toNaturalTS(state = (0, translator_1.createCompilerState)(), currentNode, declaration) {
1509
+ // const isCurrentInThisView = currentNode?.getAncestor('View') === this;
1510
+ if (declaration) {
1497
1511
  let code = `
1498
- ${(0, translator_1.indent)(state.tabSize)}export function ${this.tsName}_view`;
1499
- // 有参数长度
1500
- code += '(';
1501
- this.params.forEach((param, index) => {
1502
- code += param.toNaturalTS((0, translator_1.shiftState)(state, code, { inline: true }));
1503
- if (index !== this.params.length - 1)
1504
- code += ', ';
1505
- });
1506
- code += ') {';
1507
- this.children.forEach((child, index) => {
1508
- code += child.toNaturalTS((0, translator_1.shiftState)(state, code, { tabSize: state.tabSize + 1 }), currentNode, declaration);
1509
- });
1510
- code += `${(0, translator_1.indent)(state.tabSize)}}`;
1511
- return code;
1512
- }
1512
+ ${(0, translator_1.indent)(state.tabSize)}export function ${this.tsName}_view`;
1513
+ // 有参数长度
1514
+ code += '(';
1515
+ this.params.forEach((param, index) => {
1516
+ code += param.toNaturalTS((0, translator_1.shiftState)(state, code, { inline: true }));
1517
+ if (index !== this.params.length - 1)
1518
+ code += ', ';
1519
+ });
1520
+ code += ') {';
1521
+ this.children.forEach((child, index) => {
1522
+ code += child.toNaturalTS((0, translator_1.shiftState)(state, code, { tabSize: state.tabSize + 1 }), currentNode, declaration);
1523
+ });
1524
+ code += `${(0, translator_1.indent)(state.tabSize)}}`;
1525
+ return code;
1526
+ }
1513
1527
  let code = `${(0, translator_1.indent)(state.tabSize)}/**
1514
1528
  ${(0, translator_1.indent)(state.tabSize)} * 当前页面
1515
1529
  ${(0, translator_1.indent)(state.tabSize)} */
1516
- ${(0, translator_1.indent)(state.tabSize)}export function ${this.tsName}_view`;
1517
- const advanceMap = new Map();
1518
- this.traverseChildren((el) => {
1519
- if (el && (el instanceof BatchAssignment__1.default || (el instanceof Assignment__1.default && el.left?.name))) {
1520
- // 子页面内部逻辑过滤
1521
- if (el.view !== this)
1522
- return;
1523
- const jsCode = el.toJS();
1524
- const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && jsCode.includes(`this.${variable.name} = `));
1525
- if (advanceVar && !advanceMap.get(advanceVar)) {
1526
- advanceMap.set(advanceVar, el);
1527
- }
1528
- }
1529
- });
1530
- // 有参数长度
1531
- code += '(';
1532
- this.params.forEach((param, index) => {
1533
- code += param.toNaturalTS((0, translator_1.shiftState)(state, code, { inline: true }));
1534
- if (index !== this.params.length - 1)
1535
- code += ', ';
1536
- });
1537
- code += ')';
1538
- code += ' {\n';
1539
- this.variables.forEach((variable) => {
1540
- if (!advanceMap.get(variable)) {
1541
- code += `${(0, translator_1.indent)(state.tabSize + 1)}let `;
1542
- code += variable.toNaturalTS((0, translator_1.shiftState)(state, code, { inline: true }));
1543
- code += ';\n';
1544
- }
1545
- });
1546
- code += `\n${(0, translator_1.indent)(state.tabSize + 1)}const $refs = {\n`;
1547
- // 生成所有的name和类型定义
1548
- this.elements.forEach((element) => {
1549
- code += element.toNaturalTSDefinition((0, translator_1.shiftState)(state, code, {
1550
- tabSize: state.tabSize + 1,
1551
- }));
1552
- });
1553
- code += `${(0, translator_1.indent)(state.tabSize + 1)}}\n`;
1554
- // 逻辑
1555
- if (currentNode?.concept === 'Logic') {
1556
- code += '\n';
1557
- this.logics.forEach((logic) => {
1558
- if (logic === currentNode)
1559
- return;
1560
- code += logic.toNaturalTS((0, translator_1.shiftState)(state, code, {
1561
- tabSize: state.tabSize + 1,
1562
- }), 'noExport', undefined, currentNode);
1563
- code += '\n';
1564
- });
1565
- // 包含了事件逻辑的处理
1566
- code += currentNode.toNaturalTS((0, translator_1.shiftState)(state, code, {
1567
- tabSize: state.tabSize + 1,
1568
- }), 'noExport', undefined, currentNode);
1569
- code += '\n';
1570
- }
1571
- else if (this.logics.length) {
1572
- code += '\n';
1573
- this.logics.forEach((logic) => {
1574
- code += logic.toNaturalTS((0, translator_1.shiftState)(state, code, {
1575
- tabSize: state.tabSize + 1,
1576
- }), 'noExport', undefined, currentNode);
1577
- code += '\n';
1578
- });
1579
- }
1580
- code += `${(0, translator_1.indent)(state.tabSize)}}\n`;
1581
- return code;
1582
- }
1583
- toEmbeddedTSFile() {
1584
- let code = `namespace ${this.getTsNamespace()} {\n`;
1585
- const state = (0, translator_1.createCompilerState)(code, {
1586
- tabSize: 1,
1587
- });
1588
- try {
1589
- code += this.toEmbeddedTS(state);
1590
- }
1591
- catch (err) {
1592
- code += '';
1593
- console.log(err);
1594
- }
1595
- code += '}\n';
1596
- return {
1597
- code,
1598
- filePath: this.getEmbeddedFilePath(),
1599
- sourceMap: state.sourceMap,
1600
- };
1601
- }
1602
- // IDE内展示需要屏蔽掉“系统统一路径前缀”
1603
- get uiPath() {
1604
- const { basePath } = this.frontend;
1605
- const _path = [];
1606
- let view = this;
1607
- while (view.concept === 'View') {
1608
- _path.push(view.name);
1609
- view = view.parentNode;
1610
- }
1611
- let path = '/';
1612
- if (_path.length) {
1613
- path += `${_path.reverse().join('/')}`;
1614
- }
1615
- return `${basePath}${path}`;
1616
- }
1617
- get path() {
1618
- const { prefixPath } = this.frontend;
1619
- const _path = [];
1620
- let view = this;
1621
- while (view.concept === 'View') {
1622
- _path.push(view.name);
1623
- view = view.parentNode;
1624
- }
1625
- let path = '/';
1626
- if (_path.length) {
1627
- path += `${_path.reverse().join('/')}`;
1628
- }
1629
- return `${prefixPath}${path}`;
1630
- }
1631
- /**
1632
- * 权限领域的资源路径
1633
- */
1634
- get authPath() {
1635
- return this.path;
1636
- }
1637
- /**
1638
- * 获取当前页面下所有elements上bindEvents下的logic
1639
- */
1640
- elementLogicRoot = [];
1641
- getElementLogicRoot() {
1642
- const logics = [];
1643
- // 页面上的绑定的事件
1644
- this.bindEvents.forEach((bindEvent) => {
1645
- bindEvent.logics.forEach((logic) => {
1646
- // 键盘事件
1647
- if (['keydown', 'keyup'].includes(bindEvent.name)) {
1648
- logic.virtualParams = [
1649
- Param__1.default.from({
1650
- name: 'event',
1651
- typeAnnotation: null,
1652
- }, logic, 'virtualParams'),
1653
- ];
1654
- }
1655
- // 生命周期没有event
1656
- logics.push(logic);
1657
- });
1658
- });
1659
- this.elements.forEach((item) => {
1660
- utils.traverse((current) => {
1661
- current.node.bindEvents.forEach((bindEvent) => {
1662
- bindEvent.logics.forEach((logic) => {
1663
- if (logic.name.startsWith('__')) {
1664
- return;
1665
- }
1666
- // 绑定参数才有 event 的 current
1667
- logic.virtualParams = bindEvent.getContextRenderLogicParams(logic);
1668
- logics.push(logic);
1669
- });
1670
- });
1671
- }, { node: item });
1672
- });
1673
- if (logics.length) {
1674
- const expanded = (this.elementLogicRoot.length && this.elementLogicRoot[0].expanded) || false;
1675
- this.elementLogicRoot = [
1676
- {
1677
- concept: 'elementLogicRoot',
1678
- expanded,
1679
- children: logics,
1680
- },
1681
- ];
1682
- }
1683
- else {
1684
- this.elementLogicRoot = [];
1685
- }
1686
- }
1687
- getViewBindEvents() {
1688
- const bindEvents = [];
1689
- // 页面上的绑定的事件
1690
- this.bindEvents.forEach((bindEvent) => {
1691
- bindEvents.push(bindEvent);
1692
- });
1693
- this.elements.forEach((item) => {
1694
- utils.traverse((current) => {
1695
- current.node.bindEvents.forEach((bindEvent) => {
1696
- bindEvents.push(bindEvent);
1697
- });
1698
- }, { node: item });
1699
- });
1700
- return bindEvents;
1701
- }
1702
- // 获取页面上需要替换的表达式
1703
- getViewExpressions() {
1704
- const bindExpressions = [];
1705
- this.elements.forEach((item) => {
1706
- utils.traverse((current) => {
1707
- const { node } = current;
1708
- const playgroundNodePath = (node?.nodePath || '').split('.').find((nodePathNode) => {
1709
- return nodePathNode.match(/(.+)\[.+\]/)?.[1] === 'playground';
1710
- });
1711
- if (!playgroundNodePath) {
1712
- //// 处理三种情况
1713
- //if (
1714
- // ['BindAttribute', 'BindDirective', 'BindStyle'].includes(node.concept)
1715
- // && node.needReplaceWithIdentifier
1716
- //) {
1717
- // bindExpressions.push(node);
1718
- //}
1719
- if (node?.concept === 'Match') {
1720
- bindExpressions.push(node);
1721
- }
1722
- }
1723
- }, {
1724
- node: item,
1725
- }, {
1726
- mode: 'anyObject',
1727
- depthFirst: true,
1728
- excludedKeySet: new Set([
1729
- 'bindEvents',
1730
- 'parentNode',
1731
- 'sourceMap',
1732
- 'storageJSON',
1733
- 'tsErrorDetail',
1734
- 'NaslAnnotatedJSON',
1735
- 'calledFrom',
1736
- '_events',
1737
- '_collectingList',
1738
- '_historyList',
1739
- ]),
1740
- });
1741
- });
1742
- return bindExpressions;
1743
- }
1744
- /**
1745
- * @param path 子路径
1746
- * 比如当前页面路径为:/dashboard
1747
- * path 为要查找子路径:如 /student/list、student/list
1748
- */
1749
- findViewByPath(path) {
1750
- const arr = path.split('/');
1751
- if (arr[0] === '')
1752
- arr.shift();
1753
- if (!arr.length)
1754
- return this;
1755
- const childName = arr.shift();
1756
- const subView = this.children.find((child) => child.name === childName);
1757
- return arr.length ? subView.findViewByPath(arr.join('/')) : subView;
1758
- }
1759
- findViewByName(name) {
1760
- return utils.traverse((current) => {
1761
- if (current.node.name === name)
1762
- return current.node;
1763
- }, { node: this });
1764
- }
1765
- findElementByName(name) {
1766
- return this.elements[0]?.findElementByName(name);
1767
- }
1768
- findElementByTag(tag) {
1769
- return this.elements[0]?.findElementByName(tag);
1770
- }
1771
- findElementByAttr(name, value) {
1772
- return this.elements[0]?.findElementByAttr(name, value);
1773
- }
1774
- _setAsIndexView(isIndex) {
1775
- let views = [];
1776
- if (this.parentNode.concept !== 'View') {
1777
- views = this.parentNode.views;
1778
- }
1779
- else if (this.parentNode.concept === 'View') {
1780
- views = this.parentNode.children;
1781
- }
1782
- if (views.length) {
1783
- if (this.isIndex !== isIndex) {
1784
- this.setIsIndex(isIndex);
1785
- }
1786
- // 设为默认跳转页时,将之前的默认跳转页取消设置
1787
- if (isIndex) {
1788
- views.forEach((view) => {
1789
- if (view !== this && view.id !== this.id && view.isIndex) {
1790
- view.setIsIndex(false);
1791
- }
1792
- });
1793
- }
1794
- }
1795
- }
1796
- setAsIndexView(isIndex) {
1797
- let actionMsg = `设置页面“${this.name}”为默认跳转页`;
1798
- if (this.parentNode.concept !== 'View') {
1799
- actionMsg = `设置页面“${this.name}”为首页`;
1800
- }
1801
- this.rootNode.emit('collect:start', {
1802
- actionMsg,
1803
- });
1804
- this._setAsIndexView(isIndex);
1805
- this.rootNode.emit('collect:end');
1806
- }
1807
- removeExistingViewElement(viewElement) {
1808
- if (this.existingViewElement.has(viewElement.name)) {
1809
- this.existingViewElement.delete(viewElement.name);
1810
- }
1811
- }
1812
- getRightCode(code, assignment, rightNode) {
1813
- code = code.replaceAll('\n', ' ');
1814
- const logic = assignment.logic;
1815
- const logicRtn = logic?.returns[0];
1816
- // 调用接口,参数替换成 null
1817
- if (rightNode instanceof CallInterface__1.default) {
1818
- const { _interface } = rightNode.getModuleInterface();
1819
- return _interface ? `${rightNode.tsCalleeKey}(${_interface.params.map(() => 'null').join(',')})` : null;
1820
- }
1821
- // 调用服务端逻辑,参数替换成 null
1822
- if (rightNode instanceof CallLogic__1.default && rightNode.calleeNamespace === 'app.logics') {
1823
- const calleeName = rightNode?.calleeName;
1824
- const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
1825
- return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
1826
- }
1827
- // view 局部变量,申明提升前增加判断,使用 logic 内的 result 直接替换成对应 logic,logic 内部变量替换成 null
1828
- if (logicRtn && code.includes(logicRtn.name)) {
1829
- if (code === logicRtn.name)
1830
- return `${logic.name}(${logic.params.map(() => 'null').join(',')})`;
1831
- code = this.handleReplaceCode(code, logicRtn.name, `${logic.name}(${logic.params.map(() => 'null').join(',')})`);
1832
- logic.params.forEach((param) => {
1833
- if (code.includes(param.name))
1834
- code = this.handleReplaceCode(code, param.name, 'null');
1835
- });
1836
- logic.variables.forEach((variable) => {
1837
- if (code.includes(variable.name))
1838
- code = this.handleReplaceCode(code, variable.name, 'null');
1839
- });
1840
- return code;
1841
- }
1842
- // 处理 current.item、current1.item 等数据
1843
- if (/current(\d)*\.item/.test(code)) {
1844
- code = this.handleCurrentItemCode(code, logic);
1845
- return code;
1846
- }
1847
- // 直接赋值 logic 内局部变量、输入参数直接提示系统无法推断类型
1848
- const useLogicVar = logic.params.find((param) => code.includes(param.name)) ||
1849
- logic.variables.find((variable) => code.includes(variable.name));
1850
- return useLogicVar ? 'null' : code;
1851
- }
1852
- handleReplaceCode(code, variable, replaceCode) {
1853
- return code.replace(/\S+/g, ($1) => {
1854
- if ($1 === `${variable},`)
1855
- return `${replaceCode},`;
1856
- if ($1 === variable)
1857
- return replaceCode;
1858
- let fnCode = $1;
1859
- if ($1.startsWith(`${variable}.`))
1860
- fnCode = $1.replaceAll(`${variable}.`, `${replaceCode}.`);
1861
- if ($1.startsWith(`${variable},`))
1862
- fnCode = $1.replaceAll(`${variable},`, `${replaceCode},`);
1863
- if ($1.includes(`(${variable},`))
1864
- fnCode = $1.replaceAll(`(${variable},`, `(${replaceCode},`);
1865
- if ($1.includes(`(${variable}.`))
1866
- fnCode = $1.replaceAll(`(${variable}.`, `(${replaceCode}.`);
1867
- if ($1.includes(`(${variable})`))
1868
- fnCode = $1.replaceAll(`(${variable})`, `(${replaceCode})`);
1869
- if ($1.includes(`,${variable},`))
1870
- fnCode = $1.replaceAll(`,${variable},`, `,${replaceCode},`);
1871
- if ($1.includes(`,${variable}.`))
1872
- fnCode = $1.replaceAll(`,${variable}.`, `,${replaceCode}.`);
1873
- if ($1.includes(`,${variable})`))
1874
- fnCode = $1.replaceAll(`,${variable})`, `,${replaceCode})`);
1875
- return fnCode;
1876
- });
1877
- }
1878
- getAncestorViewElementsWithDataSource(logic) {
1879
- let element = logic;
1880
- const viewElements = [];
1881
- while (element) {
1882
- if (element.concept &&
1883
- element.concept === 'ViewElement' &&
1884
- element.bindAttrs.find((bAttr) => bAttr.name === 'data-source')) {
1885
- viewElements.push(element);
1886
- }
1887
- element = element.parentNode;
1888
- }
1889
- return viewElements;
1890
- }
1891
- handleCurrentItemCode(code, logic) {
1892
- const viewElementsWithDataSource = this.getAncestorViewElementsWithDataSource(logic);
1893
- viewElementsWithDataSource.forEach((viewElement, index) => {
1894
- const currentIndex = viewElementsWithDataSource.length - 1 - index;
1895
- const currentItemCode = `current${currentIndex === 0 ? '' : currentIndex}.item`;
1896
- if (code.includes(currentItemCode)) {
1897
- const dataSource = viewElement.bindAttrs.find((bAttr) => bAttr.name === 'data-source');
1898
- if (dataSource) {
1899
- const view = viewElement.getAncestor('View');
1900
- const dataSourceTS = dataSource.expression.toEmbeddedTS();
1901
- const logic = view.logics.find((logic) => logic.name === dataSourceTS);
1902
- if (logic) {
1903
- code = code.replaceAll(currentItemCode, `nasl.ui.getCurrentItemType(${dataSourceTS}(${logic.params.map(() => 'null').join(',')}))`);
1904
- }
1905
- else {
1906
- const variable = view.variables.find((variable) => variable.name === dataSourceTS);
1907
- code = code.replaceAll(currentItemCode, `nasl.ui.getCurrentItemType(${variable ? variable.name : dataSourceTS})`);
1908
- }
1909
- }
1910
- }
1911
- });
1912
- return code;
1913
- }
1914
- getViewCallLogics() {
1915
- const callbackLogics = [];
1916
- this.traverseChildren((el) => {
1917
- if (el instanceof Identifier__1.default && el.namespace?.endsWith('logics')) {
1918
- callbackLogics.push(el.namespace + '.' + el.name);
1919
- }
1920
- });
1921
- return callbackLogics;
1922
- }
1923
- };
1924
- exports.View = View;
1925
- __decorate([
1926
- (0, decorators_1.property)('concept')
1927
- // @ts-ignore
1928
- ], View.prototype, "concept", void 0);
1929
- __decorate([
1930
- (0, decorators_1.property)()
1931
- // @ts-ignore
1932
- ], View.prototype, "pageTemplateId", void 0);
1933
- __decorate([
1934
- (0, decorators_1.property)()
1935
- // @ts-ignore
1936
- ], View.prototype, "name", void 0);
1937
- __decorate([
1938
- (0, decorators_1.property)()
1939
- // @ts-ignore
1940
- ], View.prototype, "uuid", void 0);
1941
- __decorate([
1942
- (0, decorators_1.property)()
1943
- // @ts-ignore
1944
- ], View.prototype, "title", void 0);
1945
- __decorate([
1946
- (0, decorators_1.property)()
1947
- // @ts-ignore
1948
- ], View.prototype, "crumb", void 0);
1949
- __decorate([
1950
- (0, decorators_1.property)()
1951
- // @ts-ignore
1952
- ], View.prototype, "auth", void 0);
1953
- __decorate([
1954
- (0, decorators_1.property)()
1955
- // @ts-ignore
1956
- ], View.prototype, "authDescription", void 0);
1957
- __decorate([
1958
- (0, decorators_1.property)()
1959
- // @ts-ignore
1960
- ], View.prototype, "isIndex", void 0);
1961
- __decorate([
1962
- (0, decorators_1.property)()
1963
- // @ts-ignore
1964
- ], View.prototype, "template", void 0);
1965
- __decorate([
1966
- (0, decorators_1.property)()
1967
- // @ts-ignore
1968
- ], View.prototype, "script", void 0);
1969
- __decorate([
1970
- (0, decorators_1.property)()
1971
- // @ts-ignore
1972
- ], View.prototype, "style", void 0);
1973
- __decorate([
1974
- (0, decorators_1.property)({
1975
- objectRef: 'ViewElement',
1976
- isArray: true,
1977
- defaultValue: [],
1978
- })
1979
- ], View.prototype, "elements", void 0);
1980
- __decorate([
1981
- (0, decorators_1.property)({
1982
- objectRef: 'Param',
1983
- isArray: true,
1984
- defaultValue: [],
1985
- })
1986
- ], View.prototype, "params", void 0);
1987
- __decorate([
1988
- (0, decorators_1.property)({
1989
- objectRef: 'Variable',
1990
- isArray: true,
1991
- defaultValue: [],
1992
- })
1993
- ], View.prototype, "variables", void 0);
1994
- __decorate([
1995
- (0, decorators_1.property)({
1996
- objectRef: 'Logic',
1997
- isArray: true,
1998
- defaultValue: [],
1999
- })
2000
- ], View.prototype, "logics", void 0);
2001
- __decorate([
2002
- (0, decorators_1.property)({
2003
- objectRef: 'BindEvent',
2004
- isArray: true,
2005
- defaultValue: [],
2006
- })
2007
- ], View.prototype, "bindEvents", void 0);
2008
- __decorate([
2009
- (0, decorators_1.property)({
2010
- isArray: true,
2011
- defaultValue: [],
2012
- })
2013
- ], View.prototype, "bindRoles", void 0);
2014
- __decorate([
2015
- (0, decorators_1.property)({
2016
- objectRef: 'View',
2017
- isArray: true,
2018
- defaultValue: [],
2019
- })
2020
- ], View.prototype, "children", void 0);
2021
- __decorate([
2022
- (0, translator_1.withSourceMap)()
2023
- ], View.prototype, "toEmbeddedTS", null);
2024
- __decorate([
2025
- (0, translator_1.withSourceMap)()
2026
- ], View.prototype, "toNaturalTS", null);
2027
- exports.View = View = View_1 = __decorate([
2028
- decorators_1.className,
2029
- (0, decorators_1.concept)('页面')
2030
- // @ts-ignore
2031
- ], View);
2032
- exports.default = View;
2033
- exports.PAGE_COMPONENT_INCLUDE_TAG_MAP = {
2034
- 'u-list-view': {
2035
- 'page-size': {
2036
- value: 'size',
2037
- label: '分页大小',
2038
- },
2039
- 'page-number': {
2040
- value: 'page',
2041
- label: '当前页数',
2042
- },
2043
- 'data-source': {
2044
- value: 'data',
2045
- label: '数据',
2046
- },
2047
- },
2048
- 'u-grid-view': {
2049
- 'page-size': {
2050
- value: 'size',
2051
- label: '分页大小',
2052
- },
2053
- 'page-number': {
2054
- value: 'page',
2055
- label: '当前页数',
2056
- },
2057
- 'data-source': {
2058
- value: 'data',
2059
- label: '数据',
2060
- },
2061
- },
2062
- 'u-list-components': {
2063
- 'data-source': {
2064
- value: 'data',
2065
- label: '数据',
2066
- },
2067
- },
2068
- 'u-table-view': {
2069
- 'page-size': {
2070
- value: 'size',
2071
- label: '分页大小',
2072
- },
2073
- 'page-number': {
2074
- value: 'page',
2075
- label: '当前页数',
2076
- },
2077
- sorting: {
2078
- value: 'sort',
2079
- label: '排序属性',
2080
- },
2081
- value: {
2082
- value: 'value',
2083
- label: '单选选中值',
2084
- },
2085
- values: {
2086
- value: 'values',
2087
- label: '多选选中值',
2088
- },
2089
- 'data-source': {
2090
- value: 'data',
2091
- label: '数据',
2092
- },
2093
- },
2094
- 'u-radios': {
2095
- value: {
2096
- value: 'value',
2097
- label: '选中值',
2098
- },
2099
- 'data-source': {
2100
- value: 'data',
2101
- label: '数据',
2102
- },
2103
- },
2104
- 'u-checkboxes': {
2105
- value: {
2106
- value: 'value',
2107
- label: '选中值',
2108
- },
2109
- 'data-source': {
2110
- value: 'data',
2111
- label: '数据',
2112
- },
2113
- },
2114
- 'u-select': {
2115
- value: {
2116
- value: 'value',
2117
- label: '选中值',
2118
- },
2119
- 'data-source': {
2120
- value: 'data',
2121
- label: '数据',
2122
- },
2123
- opened: {
2124
- value: 'opened',
2125
- label: '弹出状态',
2126
- },
2127
- 'page-size': {
2128
- value: 'size',
2129
- label: '分页大小',
2130
- },
2131
- 'page-number': {
2132
- value: 'page',
2133
- label: '当前页数',
2134
- },
2135
- },
2136
- 'u-cascader': {
2137
- value: {
2138
- value: 'value',
2139
- label: '选中值',
2140
- },
2141
- 'data-source': {
2142
- value: 'data',
2143
- label: '数据',
2144
- },
2145
- },
2146
- 'u-tree-select-new': {
2147
- value: {
2148
- value: 'value',
2149
- label: '选中值',
2150
- },
2151
- 'data-source': {
2152
- value: 'data',
2153
- label: '数据',
2154
- },
2155
- },
2156
- 'van-radio-group': {
2157
- value: {
2158
- value: 'value',
2159
- label: '选中值',
2160
- },
2161
- 'data-source': {
2162
- value: 'data',
2163
- label: '数据',
2164
- },
2165
- },
2166
- 'van-checkbox-group': {
2167
- value: {
2168
- value: 'value',
2169
- label: '选中值',
2170
- },
2171
- 'data-source': {
2172
- value: 'data',
2173
- label: '数据',
2174
- },
2175
- },
2176
- 'van-pickerson': {
2177
- pvalue: {
2178
- value: 'value',
2179
- label: '选中值',
2180
- },
2181
- 'data-source': {
2182
- value: 'data',
2183
- label: '数据',
2184
- },
2185
- 'page-size': {
2186
- value: 'size',
2187
- label: '分页大小',
2188
- },
2189
- 'page-number': {
2190
- value: 'page',
2191
- label: '当前页数',
2192
- },
2193
- },
2194
- 'van-cascader': {
2195
- value: {
2196
- value: 'value',
2197
- label: '选中值',
2198
- },
2199
- 'data-source': {
2200
- value: 'data',
2201
- label: '数据',
2202
- },
2203
- },
2204
- 'van-list-view': {
2205
- 'page-size': {
2206
- value: 'size',
2207
- label: '分页大小',
2208
- },
2209
- 'page-number': {
2210
- value: 'page',
2211
- label: '当前页数',
2212
- },
2213
- 'data-source': {
2214
- value: 'data',
2215
- label: '数据',
2216
- },
2217
- },
2218
- 'van-grid-view': {
2219
- 'page-size': {
2220
- value: 'size',
2221
- label: '分页大小',
2222
- },
2223
- 'page-number': {
2224
- value: 'page',
2225
- label: '当前页数',
2226
- },
2227
- 'data-source': {
2228
- value: 'data',
2229
- label: '数据',
2230
- },
2231
- },
2232
- 'van-for-components': {
2233
- 'data-source': {
2234
- value: 'data',
2235
- label: '数据',
2236
- },
2237
- },
2238
- };
1530
+ ${(0, translator_1.indent)(state.tabSize)}export function ${this.tsName}_view`;
1531
+ const advanceMap = new Map();
1532
+ this.traverseChildren((el) => {
1533
+ if (el && (el instanceof BatchAssignment__1.default || (el instanceof Assignment__1.default && el.left?.name))) {
1534
+ // 子页面内部逻辑过滤
1535
+ if (el.view !== this)
1536
+ return;
1537
+ const jsCode = el.toJS();
1538
+ const advanceVar = this.variables?.find((variable) => !variable.typeAnnotation && jsCode.includes(`this.${variable.name} = `));
1539
+ if (advanceVar && !advanceMap.get(advanceVar)) {
1540
+ advanceMap.set(advanceVar, el);
1541
+ }
1542
+ }
1543
+ });
1544
+ // 有参数长度
1545
+ code += '(';
1546
+ this.params.forEach((param, index) => {
1547
+ code += param.toNaturalTS((0, translator_1.shiftState)(state, code, { inline: true }));
1548
+ if (index !== this.params.length - 1)
1549
+ code += ', ';
1550
+ });
1551
+ code += ')';
1552
+ code += ' {\n';
1553
+ this.variables.forEach((variable) => {
1554
+ if (!advanceMap.get(variable)) {
1555
+ code += `${(0, translator_1.indent)(state.tabSize + 1)}let `;
1556
+ code += variable.toNaturalTS((0, translator_1.shiftState)(state, code, { inline: true }));
1557
+ code += ';\n';
1558
+ }
1559
+ });
1560
+ code += `\n${(0, translator_1.indent)(state.tabSize + 1)}const $refs = {\n`;
1561
+ // 生成所有的name和类型定义
1562
+ this.elements.forEach((element) => {
1563
+ code += element.toNaturalTSDefinition((0, translator_1.shiftState)(state, code, {
1564
+ tabSize: state.tabSize + 1,
1565
+ }));
1566
+ });
1567
+ code += `${(0, translator_1.indent)(state.tabSize + 1)}}\n`;
1568
+ // 逻辑
1569
+ if (currentNode?.concept === 'Logic') {
1570
+ code += '\n';
1571
+ this.logics.forEach((logic) => {
1572
+ if (logic === currentNode)
1573
+ return;
1574
+ code += logic.toNaturalTS((0, translator_1.shiftState)(state, code, {
1575
+ tabSize: state.tabSize + 1,
1576
+ }), 'noExport', undefined, currentNode);
1577
+ code += '\n';
1578
+ });
1579
+ // 包含了事件逻辑的处理
1580
+ code += currentNode.toNaturalTS((0, translator_1.shiftState)(state, code, {
1581
+ tabSize: state.tabSize + 1,
1582
+ }), 'noExport', undefined, currentNode);
1583
+ code += '\n';
1584
+ }
1585
+ else if (this.logics.length) {
1586
+ code += '\n';
1587
+ this.logics.forEach((logic) => {
1588
+ code += logic.toNaturalTS((0, translator_1.shiftState)(state, code, {
1589
+ tabSize: state.tabSize + 1,
1590
+ }), 'noExport', undefined, currentNode);
1591
+ code += '\n';
1592
+ });
1593
+ }
1594
+ code += `${(0, translator_1.indent)(state.tabSize)}}\n`;
1595
+ return code;
1596
+ }
1597
+ toEmbeddedTSFile() {
1598
+ let code = `namespace ${this.getTsNamespace()} {\n`;
1599
+ const state = (0, translator_1.createCompilerState)(code, {
1600
+ tabSize: 1,
1601
+ });
1602
+ try {
1603
+ code += this.toEmbeddedTS(state);
1604
+ }
1605
+ catch (err) {
1606
+ code += '';
1607
+ console.log(err);
1608
+ }
1609
+ code += '}\n';
1610
+ return {
1611
+ code,
1612
+ filePath: this.getEmbeddedFilePath(),
1613
+ sourceMap: state.sourceMap,
1614
+ };
1615
+ }
1616
+ // IDE内展示需要屏蔽掉“系统统一路径前缀”
1617
+ get uiPath() {
1618
+ const { basePath } = this.frontend;
1619
+ const _path = [];
1620
+ let view = this;
1621
+ while (view.concept === 'View') {
1622
+ _path.push(view.name);
1623
+ view = view.parentNode;
1624
+ }
1625
+ let path = '/';
1626
+ if (_path.length) {
1627
+ path += `${_path.reverse().join('/')}`;
1628
+ }
1629
+ return `${basePath}${path}`;
1630
+ }
1631
+ get path() {
1632
+ const { prefixPath } = this.frontend;
1633
+ const _path = [];
1634
+ let view = this;
1635
+ while (view.concept === 'View') {
1636
+ _path.push(view.name);
1637
+ view = view.parentNode;
1638
+ }
1639
+ let path = '/';
1640
+ if (_path.length) {
1641
+ path += `${_path.reverse().join('/')}`;
1642
+ }
1643
+ return `${prefixPath}${path}`;
1644
+ }
1645
+ /**
1646
+ * 权限领域的资源路径
1647
+ */
1648
+ get authPath() {
1649
+ return this.path;
1650
+ }
1651
+ /**
1652
+ * 获取当前页面下所有elements上bindEvents下的logic
1653
+ */
1654
+ elementLogicRoot = [];
1655
+ getElementLogicRoot() {
1656
+ const logics = [];
1657
+ // 页面上的绑定的事件
1658
+ this.bindEvents.forEach((bindEvent) => {
1659
+ bindEvent.logics.forEach((logic) => {
1660
+ // 键盘事件
1661
+ if (['keydown', 'keyup'].includes(bindEvent.name)) {
1662
+ logic.virtualParams = [
1663
+ Param__1.default.from({
1664
+ name: 'event',
1665
+ typeAnnotation: null,
1666
+ }, logic, 'virtualParams'),
1667
+ ];
1668
+ }
1669
+ // 生命周期没有event
1670
+ logics.push(logic);
1671
+ });
1672
+ });
1673
+ this.elements.forEach((item) => {
1674
+ utils.traverse((current) => {
1675
+ current.node.bindEvents.forEach((bindEvent) => {
1676
+ bindEvent.logics.forEach((logic) => {
1677
+ if (logic.name.startsWith('__')) {
1678
+ return;
1679
+ }
1680
+ // 绑定参数才有 event 的 current
1681
+ logic.virtualParams = bindEvent.getContextRenderLogicParams(logic);
1682
+ logics.push(logic);
1683
+ });
1684
+ });
1685
+ }, { node: item });
1686
+ });
1687
+ if (logics.length) {
1688
+ const expanded = (this.elementLogicRoot.length && this.elementLogicRoot[0].expanded) || false;
1689
+ this.elementLogicRoot = [
1690
+ {
1691
+ concept: 'elementLogicRoot',
1692
+ expanded,
1693
+ children: logics,
1694
+ },
1695
+ ];
1696
+ }
1697
+ else {
1698
+ this.elementLogicRoot = [];
1699
+ }
1700
+ }
1701
+ getViewBindEvents() {
1702
+ const bindEvents = [];
1703
+ // 页面上的绑定的事件
1704
+ this.bindEvents.forEach((bindEvent) => {
1705
+ bindEvents.push(bindEvent);
1706
+ });
1707
+ this.elements.forEach((item) => {
1708
+ utils.traverse((current) => {
1709
+ current.node.bindEvents.forEach((bindEvent) => {
1710
+ bindEvents.push(bindEvent);
1711
+ });
1712
+ }, { node: item });
1713
+ });
1714
+ return bindEvents;
1715
+ }
1716
+ // 获取页面上需要替换的表达式
1717
+ getViewExpressions() {
1718
+ const bindExpressions = [];
1719
+ this.elements.forEach((item) => {
1720
+ utils.traverse((current) => {
1721
+ const { node } = current;
1722
+ const playgroundNodePath = (node?.nodePath || '').split('.').find((nodePathNode) => {
1723
+ return nodePathNode.match(/(.+)\[.+\]/)?.[1] === 'playground';
1724
+ });
1725
+ if (!playgroundNodePath) {
1726
+ //// 处理三种情况
1727
+ //if (
1728
+ // ['BindAttribute', 'BindDirective', 'BindStyle'].includes(node.concept)
1729
+ // && node.needReplaceWithIdentifier
1730
+ //) {
1731
+ // bindExpressions.push(node);
1732
+ //}
1733
+ if (node?.concept === 'Match') {
1734
+ bindExpressions.push(node);
1735
+ }
1736
+ }
1737
+ }, {
1738
+ node: item,
1739
+ }, {
1740
+ mode: 'anyObject',
1741
+ depthFirst: true,
1742
+ excludedKeySet: new Set([
1743
+ 'bindEvents',
1744
+ 'parentNode',
1745
+ 'sourceMap',
1746
+ 'storageJSON',
1747
+ 'tsErrorDetail',
1748
+ 'NaslAnnotatedJSON',
1749
+ 'calledFrom',
1750
+ '_events',
1751
+ '_collectingList',
1752
+ '_historyList',
1753
+ ]),
1754
+ });
1755
+ });
1756
+ return bindExpressions;
1757
+ }
1758
+ /**
1759
+ * @param path 子路径
1760
+ * 比如当前页面路径为:/dashboard
1761
+ * path 为要查找子路径:如 /student/list、student/list
1762
+ */
1763
+ findViewByPath(path) {
1764
+ const arr = path.split('/');
1765
+ if (arr[0] === '')
1766
+ arr.shift();
1767
+ if (!arr.length)
1768
+ return this;
1769
+ const childName = arr.shift();
1770
+ const subView = this.children.find((child) => child.name === childName);
1771
+ return arr.length ? subView.findViewByPath(arr.join('/')) : subView;
1772
+ }
1773
+ findViewByName(name) {
1774
+ return utils.traverse((current) => {
1775
+ if (current.node.name === name)
1776
+ return current.node;
1777
+ }, { node: this });
1778
+ }
1779
+ findElementByName(name) {
1780
+ return this.elements[0]?.findElementByName(name);
1781
+ }
1782
+ findElementByTag(tag) {
1783
+ return this.elements[0]?.findElementByName(tag);
1784
+ }
1785
+ findElementByAttr(name, value) {
1786
+ return this.elements[0]?.findElementByAttr(name, value);
1787
+ }
1788
+ _setAsIndexView(isIndex) {
1789
+ let views = [];
1790
+ if (this.parentNode.concept !== 'View') {
1791
+ views = this.parentNode.views;
1792
+ }
1793
+ else if (this.parentNode.concept === 'View') {
1794
+ views = this.parentNode.children;
1795
+ }
1796
+ if (views.length) {
1797
+ if (this.isIndex !== isIndex) {
1798
+ this.setIsIndex(isIndex);
1799
+ }
1800
+ // 设为默认跳转页时,将之前的默认跳转页取消设置
1801
+ if (isIndex) {
1802
+ views.forEach((view) => {
1803
+ if (view !== this && view.id !== this.id && view.isIndex) {
1804
+ view.setIsIndex(false);
1805
+ }
1806
+ });
1807
+ }
1808
+ }
1809
+ }
1810
+ setAsIndexView(isIndex) {
1811
+ let actionMsg = `设置页面“${this.name}”为默认跳转页`;
1812
+ if (this.parentNode.concept !== 'View') {
1813
+ actionMsg = `设置页面“${this.name}”为首页`;
1814
+ }
1815
+ this.rootNode.emit('collect:start', {
1816
+ actionMsg,
1817
+ });
1818
+ this._setAsIndexView(isIndex);
1819
+ this.rootNode.emit('collect:end');
1820
+ }
1821
+ removeExistingViewElement(viewElement) {
1822
+ if (this.existingViewElement.has(viewElement.name)) {
1823
+ this.existingViewElement.delete(viewElement.name);
1824
+ }
1825
+ }
1826
+ getRightCode(code, assignment, rightNode) {
1827
+ code = code.replaceAll('\n', ' ');
1828
+ const logic = assignment.logic;
1829
+ const logicRtn = logic?.returns[0];
1830
+ // 调用接口,参数替换成 null
1831
+ if (rightNode instanceof CallInterface__1.default) {
1832
+ const { _interface } = rightNode.getModuleInterface();
1833
+ return _interface ? `${rightNode.tsCalleeKey}(${_interface.params.map(() => 'null').join(',')})` : null;
1834
+ }
1835
+ // 调用服务端逻辑,参数替换成 null
1836
+ if (rightNode instanceof CallLogic__1.default && rightNode.calleeNamespace === 'app.logics') {
1837
+ const calleeName = rightNode?.calleeName;
1838
+ const calleeLogic = this.app.logics.find((l) => l.name === calleeName);
1839
+ return calleeLogic ? `app.logics.${calleeName}(${calleeLogic.params.map(() => 'null').join(',')})` : null;
1840
+ }
1841
+ // view 局部变量,申明提升前增加判断,使用 logic 内的 result 直接替换成对应 logic,logic 内部变量替换成 null
1842
+ if (logicRtn && code.includes(logicRtn.name)) {
1843
+ if (code === logicRtn.name)
1844
+ return `${logic.name}(${logic.params.map(() => 'null').join(',')})`;
1845
+ code = this.handleReplaceCode(code, logicRtn.name, `${logic.name}(${logic.params.map(() => 'null').join(',')})`);
1846
+ logic.params.forEach((param) => {
1847
+ if (code.includes(param.name))
1848
+ code = this.handleReplaceCode(code, param.name, 'null');
1849
+ });
1850
+ logic.variables.forEach((variable) => {
1851
+ if (code.includes(variable.name))
1852
+ code = this.handleReplaceCode(code, variable.name, 'null');
1853
+ });
1854
+ return code;
1855
+ }
1856
+ // 处理 current.item、current1.item 等数据
1857
+ if (/current(\d)*\.item/.test(code)) {
1858
+ code = this.handleCurrentItemCode(code, logic);
1859
+ return code;
1860
+ }
1861
+ // 直接赋值 logic 内局部变量、输入参数直接提示系统无法推断类型
1862
+ const useLogicVar = logic.params.find((param) => code.includes(param.name)) ||
1863
+ logic.variables.find((variable) => code.includes(variable.name));
1864
+ return useLogicVar ? 'null' : code;
1865
+ }
1866
+ handleReplaceCode(code, variable, replaceCode) {
1867
+ return code.replace(/\S+/g, ($1) => {
1868
+ if ($1 === `${variable},`)
1869
+ return `${replaceCode},`;
1870
+ if ($1 === variable)
1871
+ return replaceCode;
1872
+ let fnCode = $1;
1873
+ if ($1.startsWith(`${variable}.`))
1874
+ fnCode = $1.replaceAll(`${variable}.`, `${replaceCode}.`);
1875
+ if ($1.startsWith(`${variable},`))
1876
+ fnCode = $1.replaceAll(`${variable},`, `${replaceCode},`);
1877
+ if ($1.includes(`(${variable},`))
1878
+ fnCode = $1.replaceAll(`(${variable},`, `(${replaceCode},`);
1879
+ if ($1.includes(`(${variable}.`))
1880
+ fnCode = $1.replaceAll(`(${variable}.`, `(${replaceCode}.`);
1881
+ if ($1.includes(`(${variable})`))
1882
+ fnCode = $1.replaceAll(`(${variable})`, `(${replaceCode})`);
1883
+ if ($1.includes(`,${variable},`))
1884
+ fnCode = $1.replaceAll(`,${variable},`, `,${replaceCode},`);
1885
+ if ($1.includes(`,${variable}.`))
1886
+ fnCode = $1.replaceAll(`,${variable}.`, `,${replaceCode}.`);
1887
+ if ($1.includes(`,${variable})`))
1888
+ fnCode = $1.replaceAll(`,${variable})`, `,${replaceCode})`);
1889
+ return fnCode;
1890
+ });
1891
+ }
1892
+ getAncestorViewElementsWithDataSource(logic) {
1893
+ let element = logic;
1894
+ const viewElements = [];
1895
+ while (element) {
1896
+ if (element.concept &&
1897
+ element.concept === 'ViewElement' &&
1898
+ element.bindAttrs.find((bAttr) => bAttr.name === 'data-source')) {
1899
+ viewElements.push(element);
1900
+ }
1901
+ element = element.parentNode;
1902
+ }
1903
+ return viewElements;
1904
+ }
1905
+ handleCurrentItemCode(code, logic) {
1906
+ const viewElementsWithDataSource = this.getAncestorViewElementsWithDataSource(logic);
1907
+ viewElementsWithDataSource.forEach((viewElement, index) => {
1908
+ const currentIndex = viewElementsWithDataSource.length - 1 - index;
1909
+ const currentItemCode = `current${currentIndex === 0 ? '' : currentIndex}.item`;
1910
+ if (code.includes(currentItemCode)) {
1911
+ const dataSource = viewElement.bindAttrs.find((bAttr) => bAttr.name === 'data-source');
1912
+ if (dataSource) {
1913
+ const view = viewElement.getAncestor('View');
1914
+ const dataSourceTS = dataSource.expression.toEmbeddedTS();
1915
+ const logic = view.logics.find((logic) => logic.name === dataSourceTS);
1916
+ if (logic) {
1917
+ code = code.replaceAll(currentItemCode, `nasl.ui.getCurrentItemType(${dataSourceTS}(${logic.params.map(() => 'null').join(',')}))`);
1918
+ }
1919
+ else {
1920
+ const variable = view.variables.find((variable) => variable.name === dataSourceTS);
1921
+ code = code.replaceAll(currentItemCode, `nasl.ui.getCurrentItemType(${variable ? variable.name : dataSourceTS})`);
1922
+ }
1923
+ }
1924
+ }
1925
+ });
1926
+ return code;
1927
+ }
1928
+ getViewCallLogics() {
1929
+ const callbackLogics = [];
1930
+ this.traverseChildren((el) => {
1931
+ if (el instanceof Identifier__1.default && el.namespace?.endsWith('logics')) {
1932
+ callbackLogics.push(el.namespace + '.' + el.name);
1933
+ }
1934
+ });
1935
+ return callbackLogics;
1936
+ }
1937
+ };
1938
+ __decorate([
1939
+ (0, decorators_1.property)('concept')
1940
+ ], View.prototype, "concept", void 0);
1941
+ __decorate([
1942
+ (0, decorators_1.property)()
1943
+ ], View.prototype, "pageTemplateId", void 0);
1944
+ __decorate([
1945
+ (0, decorators_1.property)()
1946
+ ], View.prototype, "name", void 0);
1947
+ __decorate([
1948
+ (0, decorators_1.property)()
1949
+ ], View.prototype, "uuid", void 0);
1950
+ __decorate([
1951
+ (0, decorators_1.property)()
1952
+ ], View.prototype, "title", void 0);
1953
+ __decorate([
1954
+ (0, decorators_1.property)()
1955
+ ], View.prototype, "crumb", void 0);
1956
+ __decorate([
1957
+ (0, decorators_1.property)()
1958
+ ], View.prototype, "auth", void 0);
1959
+ __decorate([
1960
+ (0, decorators_1.property)()
1961
+ ], View.prototype, "authDescription", void 0);
1962
+ __decorate([
1963
+ (0, decorators_1.property)()
1964
+ ], View.prototype, "isIndex", void 0);
1965
+ __decorate([
1966
+ (0, decorators_1.property)()
1967
+ ], View.prototype, "template", void 0);
1968
+ __decorate([
1969
+ (0, decorators_1.property)()
1970
+ ], View.prototype, "script", void 0);
1971
+ __decorate([
1972
+ (0, decorators_1.property)()
1973
+ ], View.prototype, "style", void 0);
1974
+ __decorate([
1975
+ (0, decorators_1.property)({
1976
+ objectRef: 'ViewElement',
1977
+ isArray: true,
1978
+ defaultValue: [],
1979
+ })
1980
+ ], View.prototype, "elements", void 0);
1981
+ __decorate([
1982
+ (0, decorators_1.property)({
1983
+ objectRef: 'Param',
1984
+ isArray: true,
1985
+ defaultValue: [],
1986
+ })
1987
+ ], View.prototype, "params", void 0);
1988
+ __decorate([
1989
+ (0, decorators_1.property)({
1990
+ objectRef: 'Variable',
1991
+ isArray: true,
1992
+ defaultValue: [],
1993
+ })
1994
+ ], View.prototype, "variables", void 0);
1995
+ __decorate([
1996
+ (0, decorators_1.property)({
1997
+ objectRef: 'Logic',
1998
+ isArray: true,
1999
+ defaultValue: [],
2000
+ })
2001
+ ], View.prototype, "logics", void 0);
2002
+ __decorate([
2003
+ (0, decorators_1.property)({
2004
+ objectRef: 'BindEvent',
2005
+ isArray: true,
2006
+ defaultValue: [],
2007
+ })
2008
+ ], View.prototype, "bindEvents", void 0);
2009
+ __decorate([
2010
+ (0, decorators_1.property)({
2011
+ isArray: true,
2012
+ defaultValue: [],
2013
+ })
2014
+ ], View.prototype, "bindRoles", void 0);
2015
+ __decorate([
2016
+ (0, decorators_1.property)({
2017
+ objectRef: 'View',
2018
+ isArray: true,
2019
+ defaultValue: [],
2020
+ })
2021
+ ], View.prototype, "children", void 0);
2022
+ __decorate([
2023
+ (0, translator_1.withSourceMap)()
2024
+ ], View.prototype, "toEmbeddedTS", null);
2025
+ __decorate([
2026
+ (0, translator_1.withSourceMap)()
2027
+ ], View.prototype, "toNaturalTS", null);
2028
+ View = View_1 = __decorate([
2029
+ decorators_1.className,
2030
+ (0, decorators_1.concept)('页面')
2031
+ // @ts-ignore
2032
+ ], View);
2033
+ exports.View = View;
2034
+ exports.default = View;
2035
+ exports.PAGE_COMPONENT_INCLUDE_TAG_MAP = {
2036
+ 'u-list-view': {
2037
+ 'page-size': {
2038
+ value: 'size',
2039
+ label: '分页大小',
2040
+ },
2041
+ 'page-number': {
2042
+ value: 'page',
2043
+ label: '当前页数',
2044
+ },
2045
+ 'data-source': {
2046
+ value: 'data',
2047
+ label: '数据',
2048
+ },
2049
+ },
2050
+ 'u-grid-view': {
2051
+ 'page-size': {
2052
+ value: 'size',
2053
+ label: '分页大小',
2054
+ },
2055
+ 'page-number': {
2056
+ value: 'page',
2057
+ label: '当前页数',
2058
+ },
2059
+ 'data-source': {
2060
+ value: 'data',
2061
+ label: '数据',
2062
+ },
2063
+ },
2064
+ 'u-list-components': {
2065
+ 'data-source': {
2066
+ value: 'data',
2067
+ label: '数据',
2068
+ },
2069
+ },
2070
+ 'u-table-view': {
2071
+ 'page-size': {
2072
+ value: 'size',
2073
+ label: '分页大小',
2074
+ },
2075
+ 'page-number': {
2076
+ value: 'page',
2077
+ label: '当前页数',
2078
+ },
2079
+ sorting: {
2080
+ value: 'sort',
2081
+ label: '排序属性',
2082
+ },
2083
+ value: {
2084
+ value: 'value',
2085
+ label: '单选选中值',
2086
+ },
2087
+ values: {
2088
+ value: 'values',
2089
+ label: '多选选中值',
2090
+ },
2091
+ 'data-source': {
2092
+ value: 'data',
2093
+ label: '数据',
2094
+ },
2095
+ },
2096
+ 'u-radios': {
2097
+ value: {
2098
+ value: 'value',
2099
+ label: '选中值',
2100
+ },
2101
+ 'data-source': {
2102
+ value: 'data',
2103
+ label: '数据',
2104
+ },
2105
+ },
2106
+ 'u-checkboxes': {
2107
+ value: {
2108
+ value: 'value',
2109
+ label: '选中值',
2110
+ },
2111
+ 'data-source': {
2112
+ value: 'data',
2113
+ label: '数据',
2114
+ },
2115
+ },
2116
+ 'u-select': {
2117
+ value: {
2118
+ value: 'value',
2119
+ label: '选中值',
2120
+ },
2121
+ 'data-source': {
2122
+ value: 'data',
2123
+ label: '数据',
2124
+ },
2125
+ opened: {
2126
+ value: 'opened',
2127
+ label: '弹出状态',
2128
+ },
2129
+ 'page-size': {
2130
+ value: 'size',
2131
+ label: '分页大小',
2132
+ },
2133
+ 'page-number': {
2134
+ value: 'page',
2135
+ label: '当前页数',
2136
+ },
2137
+ },
2138
+ 'u-cascader': {
2139
+ value: {
2140
+ value: 'value',
2141
+ label: '选中值',
2142
+ },
2143
+ 'data-source': {
2144
+ value: 'data',
2145
+ label: '数据',
2146
+ },
2147
+ },
2148
+ 'u-tree-select-new': {
2149
+ value: {
2150
+ value: 'value',
2151
+ label: '选中值',
2152
+ },
2153
+ 'data-source': {
2154
+ value: 'data',
2155
+ label: '数据',
2156
+ },
2157
+ },
2158
+ 'van-radio-group': {
2159
+ value: {
2160
+ value: 'value',
2161
+ label: '选中值',
2162
+ },
2163
+ 'data-source': {
2164
+ value: 'data',
2165
+ label: '数据',
2166
+ },
2167
+ },
2168
+ 'van-checkbox-group': {
2169
+ value: {
2170
+ value: 'value',
2171
+ label: '选中值',
2172
+ },
2173
+ 'data-source': {
2174
+ value: 'data',
2175
+ label: '数据',
2176
+ },
2177
+ },
2178
+ 'van-pickerson': {
2179
+ pvalue: {
2180
+ value: 'value',
2181
+ label: '选中值',
2182
+ },
2183
+ 'data-source': {
2184
+ value: 'data',
2185
+ label: '数据',
2186
+ },
2187
+ 'page-size': {
2188
+ value: 'size',
2189
+ label: '分页大小',
2190
+ },
2191
+ 'page-number': {
2192
+ value: 'page',
2193
+ label: '当前页数',
2194
+ },
2195
+ },
2196
+ 'van-cascader': {
2197
+ value: {
2198
+ value: 'value',
2199
+ label: '选中值',
2200
+ },
2201
+ 'data-source': {
2202
+ value: 'data',
2203
+ label: '数据',
2204
+ },
2205
+ },
2206
+ 'van-list-view': {
2207
+ 'page-size': {
2208
+ value: 'size',
2209
+ label: '分页大小',
2210
+ },
2211
+ 'page-number': {
2212
+ value: 'page',
2213
+ label: '当前页数',
2214
+ },
2215
+ 'data-source': {
2216
+ value: 'data',
2217
+ label: '数据',
2218
+ },
2219
+ },
2220
+ 'van-grid-view': {
2221
+ 'page-size': {
2222
+ value: 'size',
2223
+ label: '分页大小',
2224
+ },
2225
+ 'page-number': {
2226
+ value: 'page',
2227
+ label: '当前页数',
2228
+ },
2229
+ 'data-source': {
2230
+ value: 'data',
2231
+ label: '数据',
2232
+ },
2233
+ },
2234
+ 'van-for-components': {
2235
+ 'data-source': {
2236
+ value: 'data',
2237
+ label: '数据',
2238
+ },
2239
+ },
2240
+ };
2239
2241
  //# sourceMappingURL=View__.js.map