@lcap/nasl 2.19.0-beta.1 → 2.19.0-beta.2

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 (516) hide show
  1. package/out/automate/engine/index.d.ts +2 -2
  2. package/out/automate/engine/index.js +6 -7
  3. package/out/automate/engine/index.js.map +1 -1
  4. package/out/automate/engine/operators.d.ts +2 -2
  5. package/out/automate/engine/operators.js +14 -5
  6. package/out/automate/engine/operators.js.map +1 -1
  7. package/out/automate/engine/uniqueName.d.ts +2 -2
  8. package/out/automate/engine/uniqueName.js +5 -5
  9. package/out/automate/engine/uniqueName.js.map +1 -1
  10. package/out/automate/engine/utils.js +4 -1
  11. package/out/automate/engine/utils.js.map +1 -1
  12. package/out/automate/template/myProcess.d.ts +1 -1
  13. package/out/automate/template/myProcess.js +9023 -9023
  14. package/out/automate/template/myProcess.js.map +1 -1
  15. package/out/bak/translator.js +16 -24
  16. package/out/bak/translator.js.map +1 -1
  17. package/out/common/BaseNode.d.ts +12 -0
  18. package/out/common/BaseNode.js +88 -14
  19. package/out/common/BaseNode.js.map +1 -1
  20. package/out/common/EventEmitter.d.ts +1 -0
  21. package/out/common/EventEmitter.js +3 -0
  22. package/out/common/EventEmitter.js.map +1 -1
  23. package/out/common/Messager.js +1 -0
  24. package/out/common/Messager.js.map +1 -1
  25. package/out/concepts/Abort__.d.ts +25 -0
  26. package/out/concepts/Abort__.js +80 -0
  27. package/out/concepts/Abort__.js.map +1 -0
  28. package/out/concepts/Anchor__.d.ts +1 -0
  29. package/out/concepts/Anchor__.js +3 -0
  30. package/out/concepts/Anchor__.js.map +1 -1
  31. package/out/concepts/AnonymousFunction__.d.ts +1 -0
  32. package/out/concepts/AnonymousFunction__.js +3 -0
  33. package/out/concepts/AnonymousFunction__.js.map +1 -1
  34. package/out/concepts/App__.d.ts +99 -256
  35. package/out/concepts/App__.js +232 -405
  36. package/out/concepts/App__.js.map +1 -1
  37. package/out/concepts/Argument__.d.ts +1 -0
  38. package/out/concepts/Argument__.js +3 -0
  39. package/out/concepts/Argument__.js.map +1 -1
  40. package/out/concepts/Assignee__.d.ts +1 -0
  41. package/out/concepts/Assignee__.js +3 -0
  42. package/out/concepts/Assignee__.js.map +1 -1
  43. package/out/concepts/AssignmentLine__.d.ts +1 -0
  44. package/out/concepts/AssignmentLine__.js +3 -0
  45. package/out/concepts/AssignmentLine__.js.map +1 -1
  46. package/out/concepts/Assignment__.d.ts +1 -0
  47. package/out/concepts/Assignment__.js +3 -0
  48. package/out/concepts/Assignment__.js.map +1 -1
  49. package/out/concepts/Attribute__.d.ts +10 -14
  50. package/out/concepts/Attribute__.js +15 -39
  51. package/out/concepts/Attribute__.js.map +1 -1
  52. package/out/concepts/BatchAssignment__.d.ts +1 -0
  53. package/out/concepts/BatchAssignment__.js +6 -3
  54. package/out/concepts/BatchAssignment__.js.map +1 -1
  55. package/out/concepts/BinaryExpression__.d.ts +1 -0
  56. package/out/concepts/BinaryExpression__.js +3 -0
  57. package/out/concepts/BinaryExpression__.js.map +1 -1
  58. package/out/concepts/BindAttribute__.d.ts +13 -0
  59. package/out/concepts/BindAttribute__.js +296 -38
  60. package/out/concepts/BindAttribute__.js.map +1 -1
  61. package/out/concepts/BindDirective__.d.ts +13 -0
  62. package/out/concepts/BindDirective__.js +223 -15
  63. package/out/concepts/BindDirective__.js.map +1 -1
  64. package/out/concepts/BindEvent__.d.ts +6 -0
  65. package/out/concepts/BindEvent__.js +30 -22
  66. package/out/concepts/BindEvent__.js.map +1 -1
  67. package/out/concepts/BindStyle__.d.ts +13 -0
  68. package/out/concepts/BindStyle__.js +200 -1
  69. package/out/concepts/BindStyle__.js.map +1 -1
  70. package/out/concepts/BooleanLiteral__.d.ts +1 -0
  71. package/out/concepts/BooleanLiteral__.js +3 -0
  72. package/out/concepts/BooleanLiteral__.js.map +1 -1
  73. package/out/concepts/CallFunction__.d.ts +1 -0
  74. package/out/concepts/CallFunction__.js +3 -0
  75. package/out/concepts/CallFunction__.js.map +1 -1
  76. package/out/concepts/CallInterface__.d.ts +2 -0
  77. package/out/concepts/CallInterface__.js +51 -5
  78. package/out/concepts/CallInterface__.js.map +1 -1
  79. package/out/concepts/CallLogic__.d.ts +12 -0
  80. package/out/concepts/CallLogic__.js +141 -131
  81. package/out/concepts/CallLogic__.js.map +1 -1
  82. package/out/concepts/CallQueryComponent__.d.ts +3 -0
  83. package/out/concepts/CallQueryComponent__.js +109 -38
  84. package/out/concepts/CallQueryComponent__.js.map +1 -1
  85. package/out/concepts/Comment__.d.ts +1 -0
  86. package/out/concepts/Comment__.js +3 -0
  87. package/out/concepts/Comment__.js.map +1 -1
  88. package/out/concepts/CompletionProperty__.d.ts +2 -0
  89. package/out/concepts/CompletionProperty__.js +4 -0
  90. package/out/concepts/CompletionProperty__.js.map +1 -1
  91. package/out/concepts/ConfigGroup__.d.ts +2 -0
  92. package/out/concepts/ConfigGroup__.js +16 -0
  93. package/out/concepts/ConfigGroup__.js.map +1 -1
  94. package/out/concepts/ConfigPropertyValue__.d.ts +1 -0
  95. package/out/concepts/ConfigPropertyValue__.js +3 -0
  96. package/out/concepts/ConfigPropertyValue__.js.map +1 -1
  97. package/out/concepts/ConfigProperty__.d.ts +24 -0
  98. package/out/concepts/ConfigProperty__.js +83 -0
  99. package/out/concepts/ConfigProperty__.js.map +1 -1
  100. package/out/concepts/Configuration__.d.ts +2 -0
  101. package/out/concepts/Configuration__.js +16 -0
  102. package/out/concepts/Configuration__.js.map +1 -1
  103. package/out/concepts/Constant__.d.ts +6 -0
  104. package/out/concepts/Constant__.js +9 -0
  105. package/out/concepts/Constant__.js.map +1 -1
  106. package/out/concepts/DataElement__.d.ts +1 -0
  107. package/out/concepts/DataElement__.js +3 -0
  108. package/out/concepts/DataElement__.js.map +1 -1
  109. package/out/concepts/DataSource__.d.ts +3 -0
  110. package/out/concepts/DataSource__.js +20 -5
  111. package/out/concepts/DataSource__.js.map +1 -1
  112. package/out/concepts/DatabaseTypeAnnotation__.d.ts +31 -0
  113. package/out/concepts/DatabaseTypeAnnotation__.js +78 -0
  114. package/out/concepts/DatabaseTypeAnnotation__.js.map +1 -0
  115. package/out/concepts/Destination__.d.ts +3 -0
  116. package/out/concepts/Destination__.js +98 -16
  117. package/out/concepts/Destination__.js.map +1 -1
  118. package/out/concepts/End__.d.ts +1 -0
  119. package/out/concepts/End__.js +4 -1
  120. package/out/concepts/End__.js.map +1 -1
  121. package/out/concepts/EntityIndex__.d.ts +1 -0
  122. package/out/concepts/EntityIndex__.js +3 -0
  123. package/out/concepts/EntityIndex__.js.map +1 -1
  124. package/out/concepts/EntityProperty__.d.ts +34 -5
  125. package/out/concepts/EntityProperty__.js +197 -56
  126. package/out/concepts/EntityProperty__.js.map +1 -1
  127. package/out/concepts/Entity__.d.ts +3 -1
  128. package/out/concepts/Entity__.js +33 -1
  129. package/out/concepts/Entity__.js.map +1 -1
  130. package/out/concepts/EnumItem__.d.ts +6 -5
  131. package/out/concepts/EnumItem__.js +9 -6
  132. package/out/concepts/EnumItem__.js.map +1 -1
  133. package/out/concepts/Enum__.d.ts +21 -19
  134. package/out/concepts/Enum__.js +31 -1
  135. package/out/concepts/Enum__.js.map +1 -1
  136. package/out/concepts/Event__.d.ts +1 -0
  137. package/out/concepts/Event__.js +3 -0
  138. package/out/concepts/Event__.js.map +1 -1
  139. package/out/concepts/ExternalDestination__.d.ts +2 -0
  140. package/out/concepts/ExternalDestination__.js +25 -4
  141. package/out/concepts/ExternalDestination__.js.map +1 -1
  142. package/out/concepts/ForEachStatement__.d.ts +1 -0
  143. package/out/concepts/ForEachStatement__.js +4 -1
  144. package/out/concepts/ForEachStatement__.js.map +1 -1
  145. package/out/concepts/FrontendLibrary__.d.ts +213 -0
  146. package/out/concepts/FrontendLibrary__.js +352 -0
  147. package/out/concepts/FrontendLibrary__.js.map +1 -0
  148. package/out/concepts/Frontend__.d.ts +373 -0
  149. package/out/concepts/Frontend__.js +685 -0
  150. package/out/concepts/Frontend__.js.map +1 -0
  151. package/out/concepts/Function__.d.ts +1 -0
  152. package/out/concepts/Function__.js +3 -0
  153. package/out/concepts/Function__.js.map +1 -1
  154. package/out/concepts/Identifier__.d.ts +1 -0
  155. package/out/concepts/Identifier__.js +26 -5
  156. package/out/concepts/Identifier__.js.map +1 -1
  157. package/out/concepts/IfStatement__.d.ts +1 -0
  158. package/out/concepts/IfStatement__.js +5 -2
  159. package/out/concepts/IfStatement__.js.map +1 -1
  160. package/out/concepts/Integration__.d.ts +53 -0
  161. package/out/concepts/Integration__.js +143 -0
  162. package/out/concepts/Integration__.js.map +1 -0
  163. package/out/concepts/InterfaceParam__.d.ts +1 -3
  164. package/out/concepts/InterfaceParam__.js +3 -56
  165. package/out/concepts/InterfaceParam__.js.map +1 -1
  166. package/out/concepts/Interface__.d.ts +14 -0
  167. package/out/concepts/Interface__.js +87 -0
  168. package/out/concepts/Interface__.js.map +1 -1
  169. package/out/concepts/JSBlock__.d.ts +1 -0
  170. package/out/concepts/JSBlock__.js +8 -1
  171. package/out/concepts/JSBlock__.js.map +1 -1
  172. package/out/concepts/JavaLogic__.d.ts +42 -0
  173. package/out/concepts/JavaLogic__.js +122 -0
  174. package/out/concepts/JavaLogic__.js.map +1 -0
  175. package/out/concepts/LogicItem__.d.ts +7 -1
  176. package/out/concepts/LogicItem__.js +11 -0
  177. package/out/concepts/LogicItem__.js.map +1 -1
  178. package/out/concepts/Logic__.d.ts +7 -0
  179. package/out/concepts/Logic__.js +74 -17
  180. package/out/concepts/Logic__.js.map +1 -1
  181. package/out/concepts/MatchCase__.d.ts +1 -0
  182. package/out/concepts/MatchCase__.js +4 -1
  183. package/out/concepts/MatchCase__.js.map +1 -1
  184. package/out/concepts/Match__.d.ts +6 -3
  185. package/out/concepts/Match__.js +116 -20
  186. package/out/concepts/Match__.js.map +1 -1
  187. package/out/concepts/MemberExpression__.d.ts +1 -0
  188. package/out/concepts/MemberExpression__.js +14 -2
  189. package/out/concepts/MemberExpression__.js.map +1 -1
  190. package/out/concepts/MicroApp__.d.ts +51 -0
  191. package/out/concepts/MicroApp__.js +113 -0
  192. package/out/concepts/MicroApp__.js.map +1 -0
  193. package/out/concepts/Module__.d.ts +96 -56
  194. package/out/concepts/Module__.js +169 -58
  195. package/out/concepts/Module__.js.map +1 -1
  196. package/out/concepts/Namespace__.d.ts +1 -0
  197. package/out/concepts/Namespace__.js +3 -0
  198. package/out/concepts/Namespace__.js.map +1 -1
  199. package/out/concepts/NewComposite__.d.ts +4 -4
  200. package/out/concepts/NewComposite__.js +139 -122
  201. package/out/concepts/NewComposite__.js.map +1 -1
  202. package/out/concepts/NewList__.d.ts +2 -0
  203. package/out/concepts/NewList__.js +49 -24
  204. package/out/concepts/NewList__.js.map +1 -1
  205. package/out/concepts/NewMap__.d.ts +2 -0
  206. package/out/concepts/NewMap__.js +53 -23
  207. package/out/concepts/NewMap__.js.map +1 -1
  208. package/out/concepts/New__.d.ts +1 -0
  209. package/out/concepts/New__.js +3 -0
  210. package/out/concepts/New__.js.map +1 -1
  211. package/out/concepts/NullLiteral__.d.ts +1 -0
  212. package/out/concepts/NullLiteral__.js +3 -0
  213. package/out/concepts/NullLiteral__.js.map +1 -1
  214. package/out/concepts/NumericLiteral__.d.ts +1 -0
  215. package/out/concepts/NumericLiteral__.js +6 -9
  216. package/out/concepts/NumericLiteral__.js.map +1 -1
  217. package/out/concepts/OqlQueryComponent__.d.ts +1 -1
  218. package/out/concepts/OqlQueryComponent__.js +43 -58
  219. package/out/concepts/OqlQueryComponent__.js.map +1 -1
  220. package/out/concepts/Param__.d.ts +7 -3
  221. package/out/concepts/Param__.js +17 -60
  222. package/out/concepts/Param__.js.map +1 -1
  223. package/out/concepts/Point__.d.ts +1 -0
  224. package/out/concepts/Point__.js +3 -0
  225. package/out/concepts/Point__.js.map +1 -1
  226. package/out/concepts/ProcessComponent__.d.ts +1 -0
  227. package/out/concepts/ProcessComponent__.js +3 -0
  228. package/out/concepts/ProcessComponent__.js.map +1 -1
  229. package/out/concepts/ProcessElement__.d.ts +1 -0
  230. package/out/concepts/ProcessElement__.js +16 -4
  231. package/out/concepts/ProcessElement__.js.map +1 -1
  232. package/out/concepts/ProcessOutcome__.d.ts +1 -0
  233. package/out/concepts/ProcessOutcome__.js +3 -0
  234. package/out/concepts/ProcessOutcome__.js.map +1 -1
  235. package/out/concepts/ProcessOutcomes__.d.ts +1 -0
  236. package/out/concepts/ProcessOutcomes__.js +3 -0
  237. package/out/concepts/ProcessOutcomes__.js.map +1 -1
  238. package/out/concepts/Process__.d.ts +5 -20
  239. package/out/concepts/Process__.js +4 -7
  240. package/out/concepts/Process__.js.map +1 -1
  241. package/out/concepts/QueryAggregateExpression__.d.ts +1 -0
  242. package/out/concepts/QueryAggregateExpression__.js +3 -0
  243. package/out/concepts/QueryAggregateExpression__.js.map +1 -1
  244. package/out/concepts/QueryFieldExpression__.d.ts +1 -0
  245. package/out/concepts/QueryFieldExpression__.js +7 -1
  246. package/out/concepts/QueryFieldExpression__.js.map +1 -1
  247. package/out/concepts/QueryFromExpression__.d.ts +1 -0
  248. package/out/concepts/QueryFromExpression__.js +3 -0
  249. package/out/concepts/QueryFromExpression__.js.map +1 -1
  250. package/out/concepts/QueryGroupByExpression__.d.ts +1 -0
  251. package/out/concepts/QueryGroupByExpression__.js +3 -0
  252. package/out/concepts/QueryGroupByExpression__.js.map +1 -1
  253. package/out/concepts/QueryJoinExpression__.d.ts +1 -0
  254. package/out/concepts/QueryJoinExpression__.js +3 -0
  255. package/out/concepts/QueryJoinExpression__.js.map +1 -1
  256. package/out/concepts/QueryLimitExpression__.d.ts +1 -0
  257. package/out/concepts/QueryLimitExpression__.js +3 -0
  258. package/out/concepts/QueryLimitExpression__.js.map +1 -1
  259. package/out/concepts/QueryOrderByExpression__.d.ts +1 -0
  260. package/out/concepts/QueryOrderByExpression__.js +3 -0
  261. package/out/concepts/QueryOrderByExpression__.js.map +1 -1
  262. package/out/concepts/QuerySelectExpression__.d.ts +105 -16
  263. package/out/concepts/QuerySelectExpression__.js +102 -9
  264. package/out/concepts/QuerySelectExpression__.js.map +1 -1
  265. package/out/concepts/Rect__.d.ts +1 -0
  266. package/out/concepts/Rect__.js +3 -0
  267. package/out/concepts/Rect__.js.map +1 -1
  268. package/out/concepts/Return__.d.ts +6 -3
  269. package/out/concepts/Return__.js +13 -59
  270. package/out/concepts/Return__.js.map +1 -1
  271. package/out/concepts/Role__.d.ts +1 -0
  272. package/out/concepts/Role__.js +3 -0
  273. package/out/concepts/Role__.js.map +1 -1
  274. package/out/concepts/SelectMembers__.d.ts +1 -0
  275. package/out/concepts/SelectMembers__.js +3 -0
  276. package/out/concepts/SelectMembers__.js.map +1 -1
  277. package/out/concepts/Slot__.d.ts +17 -0
  278. package/out/concepts/Slot__.js +46 -0
  279. package/out/concepts/Slot__.js.map +1 -1
  280. package/out/concepts/SqlQueryComponent__.d.ts +1 -1
  281. package/out/concepts/SqlQueryComponent__.js +3 -46
  282. package/out/concepts/SqlQueryComponent__.js.map +1 -1
  283. package/out/concepts/Start__.d.ts +1 -0
  284. package/out/concepts/Start__.js +3 -0
  285. package/out/concepts/Start__.js.map +1 -1
  286. package/out/concepts/StringInterpolation__.d.ts +1 -0
  287. package/out/concepts/StringInterpolation__.js +6 -1
  288. package/out/concepts/StringInterpolation__.js.map +1 -1
  289. package/out/concepts/StringLiteral__.d.ts +1 -0
  290. package/out/concepts/StringLiteral__.js +9 -6
  291. package/out/concepts/StringLiteral__.js.map +1 -1
  292. package/out/concepts/StructureProperty__.d.ts +9 -3
  293. package/out/concepts/StructureProperty__.js +21 -57
  294. package/out/concepts/StructureProperty__.js.map +1 -1
  295. package/out/concepts/Structure__.d.ts +1 -0
  296. package/out/concepts/Structure__.js +3 -0
  297. package/out/concepts/Structure__.js.map +1 -1
  298. package/out/concepts/SwitchCase__.d.ts +1 -0
  299. package/out/concepts/SwitchCase__.js +5 -2
  300. package/out/concepts/SwitchCase__.js.map +1 -1
  301. package/out/concepts/SwitchStatement__.d.ts +1 -0
  302. package/out/concepts/SwitchStatement__.js +3 -0
  303. package/out/concepts/SwitchStatement__.js.map +1 -1
  304. package/out/concepts/Theme__.d.ts +1 -0
  305. package/out/concepts/Theme__.js +3 -0
  306. package/out/concepts/Theme__.js.map +1 -1
  307. package/out/concepts/Transactional__.d.ts +6 -0
  308. package/out/concepts/Transactional__.js +9 -0
  309. package/out/concepts/Transactional__.js.map +1 -1
  310. package/out/concepts/TypeAnnotation__.d.ts +9 -3
  311. package/out/concepts/TypeAnnotation__.js +96 -10
  312. package/out/concepts/TypeAnnotation__.js.map +1 -1
  313. package/out/concepts/TypeParam__.d.ts +1 -0
  314. package/out/concepts/TypeParam__.js +3 -0
  315. package/out/concepts/TypeParam__.js.map +1 -1
  316. package/out/concepts/UnaryExpression__.d.ts +1 -0
  317. package/out/concepts/UnaryExpression__.js +3 -0
  318. package/out/concepts/UnaryExpression__.js.map +1 -1
  319. package/out/concepts/Unparsed__.d.ts +1 -0
  320. package/out/concepts/Unparsed__.js +3 -0
  321. package/out/concepts/Unparsed__.js.map +1 -1
  322. package/out/concepts/UseComponent__.d.ts +1 -0
  323. package/out/concepts/UseComponent__.js +3 -0
  324. package/out/concepts/UseComponent__.js.map +1 -1
  325. package/out/concepts/ValidationRule__.d.ts +2 -0
  326. package/out/concepts/ValidationRule__.js +56 -0
  327. package/out/concepts/ValidationRule__.js.map +1 -1
  328. package/out/concepts/Variable__.d.ts +6 -3
  329. package/out/concepts/Variable__.js +14 -60
  330. package/out/concepts/Variable__.js.map +1 -1
  331. package/out/concepts/ViewBlock__.d.ts +35 -0
  332. package/out/concepts/ViewBlock__.js +85 -0
  333. package/out/concepts/ViewBlock__.js.map +1 -0
  334. package/out/concepts/ViewComponent__.d.ts +93 -0
  335. package/out/concepts/ViewComponent__.js +114 -0
  336. package/out/concepts/ViewComponent__.js.map +1 -1
  337. package/out/concepts/ViewElement__.d.ts +8 -0
  338. package/out/concepts/ViewElement__.js +66 -10
  339. package/out/concepts/ViewElement__.js.map +1 -1
  340. package/out/concepts/View__.d.ts +9 -3
  341. package/out/concepts/View__.js +64 -16
  342. package/out/concepts/View__.js.map +1 -1
  343. package/out/concepts/WhileStatement__.d.ts +1 -0
  344. package/out/concepts/WhileStatement__.js +3 -0
  345. package/out/concepts/WhileStatement__.js.map +1 -1
  346. package/out/concepts/basics/stdlib/nasl.collection.js +7 -2
  347. package/out/concepts/basics/stdlib/nasl.collection.js.map +1 -1
  348. package/out/concepts/basics/stdlib/nasl.configuration.js +3 -0
  349. package/out/concepts/basics/stdlib/nasl.configuration.js.map +1 -1
  350. package/out/concepts/basics/stdlib/nasl.core.d.ts +2 -0
  351. package/out/concepts/basics/stdlib/nasl.core.js +34 -0
  352. package/out/concepts/basics/stdlib/nasl.core.js.map +1 -1
  353. package/out/concepts/basics/stdlib/nasl.interface.js +1 -1
  354. package/out/concepts/basics/stdlib/nasl.interface.js.map +1 -1
  355. package/out/concepts/basics/stdlib/nasl.process.js +6 -6
  356. package/out/concepts/basics/stdlib/nasl.process.js.map +1 -1
  357. package/out/concepts/basics/stdlib/nasl.ui.js +71 -43
  358. package/out/concepts/basics/stdlib/nasl.ui.js.map +1 -1
  359. package/out/concepts/basics/stdlib/nasl.util.js +146 -21
  360. package/out/concepts/basics/stdlib/nasl.util.js.map +1 -1
  361. package/out/concepts/basics/stdlib/nasl.validation.js +13 -13
  362. package/out/concepts/basics/stdlib/nasl.validation.js.map +1 -1
  363. package/out/concepts/basics/types/coreTypeList.js +1 -5
  364. package/out/concepts/basics/types/coreTypeList.js.map +1 -1
  365. package/out/concepts/basics/types/index.d.ts +1 -0
  366. package/out/concepts/basics/types/index.js +3 -1
  367. package/out/concepts/basics/types/index.js.map +1 -1
  368. package/out/concepts/index__.d.ts +8 -0
  369. package/out/concepts/index__.js +8 -0
  370. package/out/concepts/index__.js.map +1 -1
  371. package/out/decorators/index.js +3 -3
  372. package/out/decorators/index.js.map +1 -1
  373. package/out/enums/KEYWORDS.d.ts +1 -0
  374. package/out/enums/KEYWORDS.js +16 -1
  375. package/out/enums/KEYWORDS.js.map +1 -1
  376. package/out/generator/genBundleFiles.d.ts +6 -3
  377. package/out/generator/genBundleFiles.js +66 -48
  378. package/out/generator/genBundleFiles.js.map +1 -1
  379. package/out/generator/genMetaData.d.ts +2 -2
  380. package/out/generator/genMetaData.js +3 -3
  381. package/out/generator/genMetaData.js.map +1 -1
  382. package/out/generator/genReleaseBody.d.ts +19 -4
  383. package/out/generator/genReleaseBody.js +147 -54
  384. package/out/generator/genReleaseBody.js.map +1 -1
  385. package/out/generator/icestark.d.ts +2 -0
  386. package/out/generator/icestark.js +48 -0
  387. package/out/generator/icestark.js.map +1 -0
  388. package/out/generator/microApp.d.ts +2 -0
  389. package/out/generator/microApp.js +35 -0
  390. package/out/generator/microApp.js.map +1 -0
  391. package/out/generator/permission.d.ts +1 -0
  392. package/out/generator/permission.js +24 -29
  393. package/out/generator/permission.js.map +1 -1
  394. package/out/generator/qiankun.d.ts +2 -0
  395. package/out/generator/qiankun.js +52 -0
  396. package/out/generator/qiankun.js.map +1 -0
  397. package/out/index.d.ts +2 -1
  398. package/out/index.js +4 -1
  399. package/out/index.js.map +1 -1
  400. package/out/manager/stepRecorder.d.ts +20 -0
  401. package/out/manager/stepRecorder.js +110 -0
  402. package/out/manager/stepRecorder.js.map +1 -0
  403. package/out/sentry/index.d.ts +29 -0
  404. package/out/sentry/index.js +111 -0
  405. package/out/sentry/index.js.map +1 -0
  406. package/out/server/entity2LogicNamespace.js +3 -1
  407. package/out/server/entity2LogicNamespace.js.map +1 -1
  408. package/out/server/extendBaseNode.js +113 -2
  409. package/out/server/extendBaseNode.js.map +1 -1
  410. package/out/server/formatTsUtils.d.ts +2 -1
  411. package/out/server/formatTsUtils.js +163 -17
  412. package/out/server/formatTsUtils.js.map +1 -1
  413. package/out/server/getLogics.d.ts +2 -2
  414. package/out/server/getLogics.js +63 -17
  415. package/out/server/getLogics.js.map +1 -1
  416. package/out/server/getMemberIdentifier.d.ts +1 -0
  417. package/out/server/getMemberIdentifier.js +34 -6
  418. package/out/server/getMemberIdentifier.js.map +1 -1
  419. package/out/server/index.js +1 -0
  420. package/out/server/index.js.map +1 -1
  421. package/out/server/naslServer.d.ts +16 -4
  422. package/out/server/naslServer.js +1170 -181
  423. package/out/server/naslServer.js.map +1 -1
  424. package/out/server/translator.js +114 -38
  425. package/out/server/translator.js.map +1 -1
  426. package/out/service/creator/add.configs.js +2 -0
  427. package/out/service/creator/add.configs.js.map +1 -1
  428. package/out/service/creator/errHandles.js +5 -0
  429. package/out/service/creator/errHandles.js.map +1 -1
  430. package/out/service/creator/index.js +2 -0
  431. package/out/service/creator/index.js.map +1 -1
  432. package/out/service/storage/api.d.ts +27 -0
  433. package/out/service/storage/api.js +19 -0
  434. package/out/service/storage/api.js.map +1 -1
  435. package/out/service/storage/init.d.ts +44 -1
  436. package/out/service/storage/init.js +262 -37
  437. package/out/service/storage/init.js.map +1 -1
  438. package/out/service/storage/service.d.ts +12 -1
  439. package/out/service/storage/service.js +32 -1
  440. package/out/service/storage/service.js.map +1 -1
  441. package/out/templator/genCallComponentLogic.d.ts +1 -1
  442. package/out/templator/genCallComponentLogic.js.map +1 -1
  443. package/out/templator/genCreateBlock.js +7 -4
  444. package/out/templator/genCreateBlock.js.map +1 -1
  445. package/out/templator/genCurdEditMultipleKeyBlock.d.ts +7 -1
  446. package/out/templator/genCurdEditMultipleKeyBlock.js +122 -8
  447. package/out/templator/genCurdEditMultipleKeyBlock.js.map +1 -1
  448. package/out/templator/genCurdMultipleKeyBlock.js +6 -8
  449. package/out/templator/genCurdMultipleKeyBlock.js.map +1 -1
  450. package/out/templator/genEditTableBlock.js +48 -20
  451. package/out/templator/genEditTableBlock.js.map +1 -1
  452. package/out/templator/genGetBlock.js +1 -1
  453. package/out/templator/genGetBlock.js.map +1 -1
  454. package/out/templator/genGridViewBlock.js +2 -2
  455. package/out/templator/genGridViewBlock.js.map +1 -1
  456. package/out/templator/genListViewBlock.js +7 -1
  457. package/out/templator/genListViewBlock.js.map +1 -1
  458. package/out/templator/genQueryComponent.js +23 -9
  459. package/out/templator/genQueryComponent.js.map +1 -1
  460. package/out/templator/genSelectBlock.d.ts +12 -1
  461. package/out/templator/genSelectBlock.js +273 -2
  462. package/out/templator/genSelectBlock.js.map +1 -1
  463. package/out/templator/genTableBlock.js +4 -4
  464. package/out/templator/genTableBlock.js.map +1 -1
  465. package/out/templator/genUpdateBlock.js +9 -4
  466. package/out/templator/genUpdateBlock.js.map +1 -1
  467. package/out/templator/utils.d.ts +19 -33
  468. package/out/templator/utils.js +11 -8
  469. package/out/templator/utils.js.map +1 -1
  470. package/out/translator/index.js +4 -1
  471. package/out/translator/index.js.map +1 -1
  472. package/out/utils/traverse.js +8 -2
  473. package/out/utils/traverse.js.map +1 -1
  474. package/package.json +2 -2
  475. package/sandbox/stdlib/nasl.core.ts +2 -0
  476. package/sandbox/stdlib/nasl.util.ts +2 -1
  477. package/src/concepts/BatchAssignment__.ts +1 -1
  478. package/src/concepts/CallLogic__.ts +2 -64
  479. package/src/concepts/NewComposite__.ts +5 -7
  480. package/src/concepts/NewList__.ts +2 -1
  481. package/src/concepts/NewMap__.ts +2 -1
  482. package/src/concepts/OqlQueryComponent__.ts +2 -0
  483. package/src/concepts/ViewElement__.ts +1 -1
  484. package/src/concepts/basics/stdlib/nasl.util.ts +4 -2
  485. package/src/generator/genBundleFiles.ts +10 -1
  486. package/src/server/naslServer.ts +12 -9
  487. package/src/server/translator.ts +33 -6
  488. package/ts-worker/lib/tsserver.js +4 -1
  489. package/sandbox/stdlib/dist/nasl.logging.js +0 -0
  490. package/sandbox/stdlib/dist/nasl.util.js +0 -0
  491. package/src/automate/engine/dist/index.dev.js +0 -517
  492. package/src/common/dist/BaseNode.js +0 -1101
  493. package/src/concepts/basics/stdlib/dist/nasl.util.js +0 -1602
  494. package/src/concepts/basics/stdlib/dist/reference2TypeAnnotationList.js +0 -24
  495. package/src/concepts/dist/BindAttribute__.js +0 -760
  496. package/src/concepts/dist/BindEvent__.js +0 -732
  497. package/src/concepts/dist/CallFunction__.js +0 -527
  498. package/src/concepts/dist/CallLogic__.js +0 -932
  499. package/src/concepts/dist/Identifier__.js +0 -311
  500. package/src/concepts/dist/StringInterpolation__.js +0 -231
  501. package/src/concepts/dist/TypeAnnotation__.js +0 -834
  502. package/src/concepts/dist/ViewElement__.js +0 -1692
  503. package/src/concepts/dist/View__.js +0 -1601
  504. package/src/generator/dist/genBundleFiles.js +0 -261
  505. package/src/generator/dist/genMetaData.js +0 -245
  506. package/src/generator/dist/permission.js +0 -392
  507. package/src/server/dist/naslServer.js +0 -3590
  508. package/src/service/storage/dist/init.js +0 -579
  509. package/src/templator/dist/genEditTableBlock.js +0 -204
  510. package/src/templator/dist/genGridViewBlock.js +0 -265
  511. package/src/templator/dist/genListViewBlock.js +0 -84
  512. package/src/templator/dist/genTableBlock.js +0 -209
  513. package/src/templator/dist/utils.js +0 -527
  514. package/ts-worker/dist/webpack.config.dev.js +0 -106
  515. /package/src/service/{dataSource → datasource}/api.js +0 -0
  516. /package/src/service/{dataSource → datasource}/index.js +0 -0
@@ -1,1692 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __assign = (this && this.__assign) || function () {
16
- __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
27
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
- 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;
30
- return c > 3 && r && Object.defineProperty(target, key, r), r;
31
- };
32
- var __spreadArrays = (this && this.__spreadArrays) || function () {
33
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
34
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
35
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
36
- r[k] = a[j];
37
- return r;
38
- };
39
- exports.__esModule = true;
40
- exports.ViewElement = void 0;
41
- var translator_1 = require("../translator");
42
- var babelParser = require("@babel/parser");
43
- var json5 = require("json5");
44
- var compiler = require("vue-template-compiler");
45
- var LogicItem__1 = require("./LogicItem__");
46
- var __1 = require("..");
47
- var MemberExpression__1 = require("./MemberExpression__");
48
- var Identifier__1 = require("./Identifier__");
49
- /**
50
- * 自闭合标签
51
- */
52
- var selfClosingTag = [
53
- 'base',
54
- 'meta',
55
- 'area',
56
- 'embed',
57
- 'link',
58
- 'img',
59
- 'input',
60
- 'param',
61
- 'hr',
62
- 'br',
63
- 'source',
64
- 'track',
65
- 'wbr',
66
- 'col',
67
- ];
68
- function genArgumentMemberExpression(arr) {
69
- var expressionNode;
70
- var propertyName = arr.pop();
71
- if (arr.length >= 1) {
72
- expressionNode = {
73
- concept: 'MemberExpression',
74
- name: '',
75
- kind: 'Expression',
76
- object: genArgumentMemberExpression(arr),
77
- property: {
78
- concept: 'Identifier',
79
- kind: 'Expression',
80
- name: propertyName
81
- }
82
- };
83
- }
84
- else {
85
- return {
86
- concept: 'Identifier',
87
- kind: 'Expression',
88
- name: propertyName
89
- };
90
- }
91
- return expressionNode;
92
- }
93
- function transAstNodeToNaslNode(astNode, namespace) {
94
- var _a, _b, _c, _d, _e;
95
- var node = null;
96
- if (astNode.type === 'CallExpression' && astNode.callee.object.name === '$utils') {
97
- var calleeName = astNode.callee.property.name || astNode.callee.property.value;
98
- node = {
99
- concept: 'CallFunction',
100
- name: '',
101
- label: '调用内置函数',
102
- kind: 'Expression',
103
- calleeNamespace: 'nasl.util',
104
- calleeName: calleeName,
105
- arguments: astNode.arguments.map(function (argument) { return ({
106
- concept: 'Argument',
107
- name: '',
108
- kind: 'Statement',
109
- keyword: '',
110
- expression: transAstNodeToNaslNode(Object.assign({}, argument))
111
- }); }).filter(function (item) { return item.expression; }),
112
- typeArguments: astNode.arguments.map(function (argument) { return (transAstNodeToNaslTypeNode(Object.assign({}, argument))); }).filter(function (item) { return item; })
113
- };
114
- }
115
- else if (astNode.type === 'MemberExpression') {
116
- if (((_a = astNode.object) === null || _a === void 0 ? void 0 : _a.name) === '$global') {
117
- if (((_b = astNode.property) === null || _b === void 0 ? void 0 : _b.name) === 'userInfo') {
118
- // 目前只有权限相关的
119
- node = transAstNodeToNaslNode(astNode.property, 'nasl.auth');
120
- }
121
- else if (((_c = astNode.property) === null || _c === void 0 ? void 0 : _c.name) === 'frontendVariables') {
122
- node = 'app.frontendVariables';
123
- }
124
- }
125
- else if (((_d = astNode.object) === null || _d === void 0 ? void 0 : _d.name) === 'frontendVariables') {
126
- node = transAstNodeToNaslNode(astNode.property, 'app.frontendVariables');
127
- }
128
- else {
129
- var object = transAstNodeToNaslNode(astNode.object);
130
- // object如果返回字符串,则将它当成namespace处理
131
- if (Object.prototype.toString.call(object) === '[object String]') {
132
- node = transAstNodeToNaslNode(astNode.property, object);
133
- }
134
- else {
135
- var property_1 = transAstNodeToNaslNode(astNode.property);
136
- node = {
137
- concept: 'MemberExpression',
138
- name: '',
139
- kind: 'Expression',
140
- object: object,
141
- property: property_1
142
- };
143
- }
144
- }
145
- }
146
- else if (astNode.type === 'Identifier') {
147
- node = {
148
- concept: 'Identifier',
149
- namespace: namespace || '',
150
- name: astNode.name,
151
- kind: 'Expression'
152
- };
153
- }
154
- else if (astNode.type === 'ArrayExpression' || astNode.type === 'ObjectExpression') {
155
- node = {
156
- concept: 'Unparsed',
157
- label: '原子项',
158
- code: astNode.value
159
- };
160
- }
161
- else if (astNode.type === 'StringLiteral') {
162
- // 单独特殊处理枚举因为他不是MemberExpression,而是Identifier_
163
- if ((_e = astNode === null || astNode === void 0 ? void 0 : astNode.value) === null || _e === void 0 ? void 0 : _e.startsWith('__enumTypeAnnotation_')) {
164
- return null;
165
- }
166
- else {
167
- node = {
168
- concept: 'StringLiteral',
169
- kind: 'Expression',
170
- name: '',
171
- value: astNode.value
172
- };
173
- }
174
- }
175
- else if (astNode.type === 'UnaryExpression') {
176
- node = {
177
- concept: 'UnaryExpression',
178
- kind: 'Expression',
179
- name: '',
180
- operator: astNode.operator,
181
- argument: transAstNodeToNaslNode(astNode.argument)
182
- };
183
- }
184
- else {
185
- node = astNode;
186
- node.concept = astNode.type;
187
- }
188
- return node;
189
- }
190
- function transAstNodeToNaslTypeNode(astNode, namespace) {
191
- var _a, _b;
192
- var node = null;
193
- // 单独特殊处理枚举因为他不是MemberExpression,而是Identifier_
194
- if ((_a = astNode === null || astNode === void 0 ? void 0 : astNode.value) === null || _a === void 0 ? void 0 : _a.startsWith('__enumTypeAnnotation_')) {
195
- var valueArr = (_b = astNode.value.replace('__enumTypeAnnotation_', '')) === null || _b === void 0 ? void 0 : _b.split('.');
196
- var name = valueArr.pop();
197
- var namespace_1 = valueArr.join('.');
198
- node = {
199
- concept: 'TypeAnnotation',
200
- typeNamespace: namespace_1 || '',
201
- typeName: name || '',
202
- typeKind: 'reference'
203
- };
204
- }
205
- return node;
206
- }
207
- var decorators_1 = require("../decorators");
208
- var utils = require("../utils");
209
- var BaseNode_1 = require("../common/BaseNode");
210
- var classMap_1 = require("../common/classMap");
211
- var BindAttribute__1 = require("./BindAttribute__");
212
- var BindEvent__1 = require("./BindEvent__");
213
- var BindDirective__1 = require("./BindDirective__");
214
- var BindStyle__1 = require("./BindStyle__");
215
- /**
216
- * 页面元素
217
- */
218
- var ViewElement = /** @class */ (function (_super) {
219
- __extends(ViewElement, _super);
220
- /**
221
- * @param source 需要合并的部分参数
222
- */
223
- function ViewElement(source) {
224
- var _this = this;
225
- source = Object.assign({}, ViewElement_1.getDefaultOptions(), source);
226
- _this = _super.call(this, source) || this;
227
- /**
228
- * 产品概念
229
- */
230
- _this.concept = 'ViewElement';
231
- /**
232
- * 类型
233
- */
234
- _this.type = undefined;
235
- /**
236
- * 元素标签
237
- */
238
- _this.tag = undefined;
239
- /**
240
- * 页面元素名称
241
- */
242
- _this.name = undefined;
243
- /**
244
- * 静态 class 名
245
- */
246
- _this.staticClass = undefined;
247
- /**
248
- * 静态 style
249
- */
250
- _this.staticStyle = undefined;
251
- /**
252
- * 权限资源描述
253
- */
254
- _this.authDescription = undefined;
255
- /**
256
- * 插槽目标
257
- */
258
- _this.slotTarget = undefined;
259
- /**
260
- * 插槽 scope 表达式
261
- */
262
- _this.slotScope = undefined;
263
- /**
264
- * 元素绑定属性列表
265
- */
266
- _this.bindAttrs = [];
267
- /**
268
- * 元素绑定事件列表
269
- */
270
- _this.bindEvents = [];
271
- /**
272
- * 元素指令列表
273
- */
274
- _this.bindDirectives = [];
275
- /**
276
- * 绑定的角色
277
- */
278
- _this.bindRoles = [];
279
- /**
280
- * 元素绑定样式列表
281
- */
282
- _this.bindStyles = [];
283
- /**
284
- * 子元素列表
285
- */
286
- _this.children = [];
287
- _this.computedStyle = {};
288
- _super.prototype.subConstructor.call(_this, source);
289
- return _this;
290
- }
291
- ViewElement_1 = ViewElement;
292
- Object.defineProperty(ViewElement.prototype, "view", {
293
- /**
294
- * 祖先 View
295
- */
296
- get: function () {
297
- return this.getAncestor('View');
298
- },
299
- enumerable: false,
300
- configurable: true
301
- });
302
- Object.defineProperty(ViewElement.prototype, "module", {
303
- /**
304
- * 祖先 Module
305
- */
306
- get: function () {
307
- return this.getAncestor('Module');
308
- },
309
- enumerable: false,
310
- configurable: true
311
- });
312
- Object.defineProperty(ViewElement.prototype, "app", {
313
- /**
314
- * 祖先 App
315
- */
316
- get: function () {
317
- return this.getAncestor('App');
318
- },
319
- enumerable: false,
320
- configurable: true
321
- });
322
- /**
323
- * 从父级删除该节点
324
- * @internal
325
- */
326
- ViewElement.prototype._delete = function () {
327
- var _a, _b;
328
- var params = null;
329
- if (this.parentNode) {
330
- params = (_b = (_a = this.parentNode) === null || _a === void 0 ? void 0 : _a.__removeViewElement) === null || _b === void 0 ? void 0 : _b.call(_a, this);
331
- }
332
- return params;
333
- };
334
- /**
335
- * 设置页面元素名称
336
- */
337
- ViewElement.prototype.setName = function (name) {
338
- var object = {
339
- name: name
340
- };
341
- this.update(__assign(__assign({}, object), { field: 'name' }));
342
- };
343
- /**
344
- * 设置静态 style
345
- */
346
- ViewElement.prototype.setStaticStyle = function (staticStyle) {
347
- var object = {
348
- staticStyle: staticStyle
349
- };
350
- this.update(__assign({}, object));
351
- };
352
- /**
353
- * 设置权限资源描述
354
- */
355
- ViewElement.prototype.setAuthDescription = function (authDescription) {
356
- var object = {
357
- authDescription: authDescription
358
- };
359
- this.update(__assign({}, object));
360
- };
361
- ViewElement.prototype.getBindAttributeExistingNames = function (excludedList) {
362
- if (excludedList === void 0) { excludedList = []; }
363
- var excludedSet = new Set(excludedList);
364
- return (this.bindAttrs || []).filter(function (item) { return !excludedSet.has(item); }).map(function (item) { return item.name; });
365
- };
366
- ViewElement.prototype.getBindAttributeUniqueName = function (name) {
367
- if (name === void 0) { name = 'bindAttribute1'; }
368
- return utils.unique(name, this.getBindAttributeExistingNames(), undefined, false);
369
- };
370
- ViewElement.prototype._insertBindAttributeAt = function (options, index) {
371
- var bindAttributeOptions = {};
372
- var relationOptions = { parentNode: this, parentKey: 'bindAttrs' };
373
- var bindAttribute;
374
- if (!options) {
375
- bindAttribute = BindAttribute__1["default"].from(__assign(__assign({}, bindAttributeOptions), { name: this.getBindAttributeUniqueName() }), this, 'bindAttrs');
376
- }
377
- else if (typeof options === 'string') {
378
- bindAttribute = BindAttribute__1["default"].from(__assign(__assign({}, bindAttributeOptions), { name: options }), this, 'bindAttrs');
379
- }
380
- else if (options instanceof BindAttribute__1["default"]) {
381
- options.ensureDelete(); // 同一实例不支持多处存在
382
- bindAttribute = options;
383
- Object.assign(bindAttribute, relationOptions);
384
- }
385
- else {
386
- bindAttribute = BindAttribute__1["default"].from(__assign(__assign({}, bindAttributeOptions), options), this, 'bindAttrs');
387
- }
388
- this.bindAttrs.splice(index, 0, bindAttribute);
389
- return bindAttribute;
390
- };
391
- ViewElement.prototype.insertBindAttributeAt = function (options, index) {
392
- var node = this._insertBindAttributeAt(options, index);
393
- node.create({
394
- index: index,
395
- parentNode: this,
396
- parentKey: 'bindAttrs'
397
- });
398
- return node;
399
- };
400
- ViewElement.prototype._addBindAttribute = function (options) {
401
- var index = this.bindAttrs.length;
402
- return this._insertBindAttributeAt(options, index);
403
- };
404
- ViewElement.prototype.addBindAttribute = function (options) {
405
- var node = this._addBindAttribute(options);
406
- var index = this.bindAttrs.indexOf(node);
407
- node.create({
408
- index: index,
409
- parentNode: this,
410
- parentKey: 'bindAttrs'
411
- });
412
- return node;
413
- };
414
- ViewElement.prototype.getBindEventExistingNames = function (excludedList) {
415
- if (excludedList === void 0) { excludedList = []; }
416
- var excludedSet = new Set(excludedList);
417
- return (this.bindEvents || []).filter(function (item) { return !excludedSet.has(item); }).map(function (item) { return item.name; });
418
- };
419
- ViewElement.prototype.getBindEventUniqueName = function (name) {
420
- if (name === void 0) { name = 'bindEvent1'; }
421
- return utils.unique(name, this.getBindEventExistingNames(), undefined, false);
422
- };
423
- ViewElement.prototype._insertBindEventAt = function (options, index) {
424
- var bindEventOptions = {};
425
- var relationOptions = { parentNode: this, parentKey: 'bindEvents' };
426
- var bindEvent;
427
- if (!options) {
428
- bindEvent = BindEvent__1["default"].from(__assign(__assign({}, bindEventOptions), { name: this.getBindEventUniqueName() }), this, 'bindEvents');
429
- }
430
- else if (typeof options === 'string') {
431
- bindEvent = BindEvent__1["default"].from(__assign(__assign({}, bindEventOptions), { name: options }), this, 'bindEvents');
432
- }
433
- else if (options instanceof BindEvent__1["default"]) {
434
- options.ensureDelete(); // 同一实例不支持多处存在
435
- bindEvent = options;
436
- Object.assign(bindEvent, relationOptions);
437
- }
438
- else {
439
- bindEvent = BindEvent__1["default"].from(__assign(__assign({}, bindEventOptions), options), this, 'bindEvents');
440
- }
441
- this.bindEvents.splice(index, 0, bindEvent);
442
- return bindEvent;
443
- };
444
- ViewElement.prototype.insertBindEventAt = function (options, index) {
445
- var node = this._insertBindEventAt(options, index);
446
- node.create({
447
- index: index,
448
- parentNode: this,
449
- parentKey: 'bindEvents'
450
- });
451
- return node;
452
- };
453
- ViewElement.prototype._addBindEvent = function (options) {
454
- var index = this.bindEvents.length;
455
- return this._insertBindEventAt(options, index);
456
- };
457
- ViewElement.prototype.addBindEvent = function (options) {
458
- var node = this._addBindEvent(options);
459
- var index = this.bindEvents.indexOf(node);
460
- node.create({
461
- index: index,
462
- parentNode: this,
463
- parentKey: 'bindEvents'
464
- });
465
- return node;
466
- };
467
- ViewElement.prototype.getBindDirectiveExistingNames = function (excludedList) {
468
- if (excludedList === void 0) { excludedList = []; }
469
- var excludedSet = new Set(excludedList);
470
- return (this.bindDirectives || []).filter(function (item) { return !excludedSet.has(item); }).map(function (item) { return item.name; });
471
- };
472
- ViewElement.prototype.getBindDirectiveUniqueName = function (name) {
473
- if (name === void 0) { name = 'bindDirective1'; }
474
- return utils.unique(name, this.getBindDirectiveExistingNames(), undefined, false);
475
- };
476
- ViewElement.prototype._insertBindDirectiveAt = function (options, index) {
477
- var bindDirectiveOptions = {};
478
- var relationOptions = { parentNode: this, parentKey: 'bindDirectives' };
479
- var bindDirective;
480
- if (!options) {
481
- bindDirective = BindDirective__1["default"].from(__assign(__assign({}, bindDirectiveOptions), { name: this.getBindDirectiveUniqueName() }), this, 'bindDirectives');
482
- }
483
- else if (typeof options === 'string') {
484
- bindDirective = BindDirective__1["default"].from(__assign(__assign({}, bindDirectiveOptions), { name: options }), this, 'bindDirectives');
485
- }
486
- else if (options instanceof BindDirective__1["default"]) {
487
- options.ensureDelete(); // 同一实例不支持多处存在
488
- bindDirective = options;
489
- Object.assign(bindDirective, relationOptions);
490
- }
491
- else {
492
- bindDirective = BindDirective__1["default"].from(__assign(__assign({}, bindDirectiveOptions), options), this, 'bindDirectives');
493
- }
494
- this.bindDirectives.splice(index, 0, bindDirective);
495
- return bindDirective;
496
- };
497
- ViewElement.prototype.insertBindDirectiveAt = function (options, index) {
498
- var node = this._insertBindDirectiveAt(options, index);
499
- node.create({
500
- index: index,
501
- parentNode: this,
502
- parentKey: 'bindDirectives'
503
- });
504
- return node;
505
- };
506
- ViewElement.prototype._addBindDirective = function (options) {
507
- var index = this.bindDirectives.length;
508
- return this._insertBindDirectiveAt(options, index);
509
- };
510
- ViewElement.prototype.addBindDirective = function (options) {
511
- var node = this._addBindDirective(options);
512
- var index = this.bindDirectives.indexOf(node);
513
- node.create({
514
- index: index,
515
- parentNode: this,
516
- parentKey: 'bindDirectives'
517
- });
518
- return node;
519
- };
520
- ViewElement.prototype.getBindStyleExistingNames = function (excludedList) {
521
- if (excludedList === void 0) { excludedList = []; }
522
- var excludedSet = new Set(excludedList);
523
- return (this.bindStyles || []).filter(function (item) { return !excludedSet.has(item); }).map(function (item) { return item.name; });
524
- };
525
- ViewElement.prototype.getBindStyleUniqueName = function (name) {
526
- if (name === void 0) { name = 'bindStyle1'; }
527
- return utils.unique(name, this.getBindStyleExistingNames(), undefined, false);
528
- };
529
- ViewElement.prototype._insertBindStyleAt = function (options, index) {
530
- var bindStyleOptions = {};
531
- var relationOptions = { parentNode: this, parentKey: 'bindStyles' };
532
- var bindStyle;
533
- if (!options) {
534
- bindStyle = BindStyle__1["default"].from(__assign(__assign({}, bindStyleOptions), { name: this.getBindStyleUniqueName() }), this, 'bindStyles');
535
- }
536
- else if (typeof options === 'string') {
537
- bindStyle = BindStyle__1["default"].from(__assign(__assign({}, bindStyleOptions), { name: options }), this, 'bindStyles');
538
- }
539
- else if (options instanceof BindStyle__1["default"]) {
540
- options.ensureDelete(); // 同一实例不支持多处存在
541
- bindStyle = options;
542
- Object.assign(bindStyle, relationOptions);
543
- }
544
- else {
545
- bindStyle = BindStyle__1["default"].from(__assign(__assign({}, bindStyleOptions), options), this, 'bindStyles');
546
- }
547
- this.bindStyles.splice(index, 0, bindStyle);
548
- return bindStyle;
549
- };
550
- ViewElement.prototype.insertBindStyleAt = function (options, index) {
551
- var node = this._insertBindStyleAt(options, index);
552
- node.create({
553
- index: index,
554
- parentNode: this,
555
- parentKey: 'bindStyles'
556
- });
557
- return node;
558
- };
559
- ViewElement.prototype._addBindStyle = function (options) {
560
- var index = this.bindStyles.length;
561
- return this._insertBindStyleAt(options, index);
562
- };
563
- ViewElement.prototype.addBindStyle = function (options) {
564
- var node = this._addBindStyle(options);
565
- var index = this.bindStyles.indexOf(node);
566
- node.create({
567
- index: index,
568
- parentNode: this,
569
- parentKey: 'bindStyles'
570
- });
571
- return node;
572
- };
573
- ViewElement.prototype._insertViewElementAt = function (options, index) {
574
- var viewElementOptions = {};
575
- var relationOptions = { parentNode: this, parentKey: 'children' };
576
- var viewElement;
577
- if (!options) {
578
- viewElement = ViewElement_1.from(__assign(__assign({}, viewElementOptions), { name: this.getViewElementUniqueName() }), this, 'children');
579
- }
580
- else if (typeof options === 'string') {
581
- viewElement = ViewElement_1.from(__assign(__assign({}, viewElementOptions), { name: options }), this, 'children');
582
- }
583
- else if (options instanceof ViewElement_1) {
584
- options.ensureDelete(); // 同一实例不支持多处存在
585
- viewElement = options;
586
- Object.assign(viewElement, relationOptions);
587
- }
588
- else {
589
- viewElement = ViewElement_1.from(__assign(__assign({}, viewElementOptions), options), this, 'children');
590
- }
591
- this.children.splice(index, 0, viewElement);
592
- return viewElement;
593
- };
594
- ViewElement.prototype.insertViewElementAt = function (options, index) {
595
- var node = this._insertViewElementAt(options, index);
596
- node.create({
597
- index: index,
598
- parentNode: this,
599
- parentKey: 'children'
600
- });
601
- return node;
602
- };
603
- ViewElement.prototype._addViewElement = function (options) {
604
- var index = this.children.length;
605
- return this._insertViewElementAt(options, index);
606
- };
607
- ViewElement.prototype.addViewElement = function (options) {
608
- var node = this._addViewElement(options);
609
- var index = this.children.indexOf(node);
610
- node.create({
611
- index: index,
612
- parentNode: this,
613
- parentKey: 'children'
614
- });
615
- return node;
616
- };
617
- ViewElement.prototype.removeBindAttribute = function (options) {
618
- var bindAttribute;
619
- if (typeof options === 'string') {
620
- bindAttribute = this.bindAttrs.find(function (item) { return item.name === options; });
621
- if (!bindAttribute) {
622
- throw new Error('找不到元素绑定属性 ' + options);
623
- }
624
- }
625
- else {
626
- bindAttribute = options;
627
- }
628
- return bindAttribute["delete"]();
629
- };
630
- ViewElement.prototype.__removeBindAttribute = function (bindAttribute) {
631
- var parentKey = bindAttribute.parentKey;
632
- var params = {
633
- parentNode: this,
634
- parentKey: parentKey,
635
- index: -1,
636
- object: null,
637
- oldObject: bindAttribute
638
- };
639
- if (parentKey) {
640
- params.parentKey = parentKey;
641
- if (Array.isArray(this[parentKey])) {
642
- var index = this[parentKey].indexOf(bindAttribute);
643
- ~index && this[parentKey].splice(index, 1);
644
- params.index = index;
645
- }
646
- else if (this[parentKey] === bindAttribute) {
647
- params.index = 0;
648
- this[parentKey] = undefined;
649
- }
650
- }
651
- return params;
652
- };
653
- ViewElement.prototype.removeBindEvent = function (options) {
654
- var bindEvent;
655
- if (typeof options === 'string') {
656
- bindEvent = this.bindEvents.find(function (item) { return item.name === options; });
657
- if (!bindEvent) {
658
- throw new Error('找不到元素绑定事件 ' + options);
659
- }
660
- }
661
- else {
662
- bindEvent = options;
663
- }
664
- return bindEvent["delete"]();
665
- };
666
- ViewElement.prototype.__removeBindEvent = function (bindEvent) {
667
- var parentKey = bindEvent.parentKey;
668
- var params = {
669
- parentNode: this,
670
- parentKey: parentKey,
671
- index: -1,
672
- object: null,
673
- oldObject: bindEvent
674
- };
675
- if (parentKey) {
676
- params.parentKey = parentKey;
677
- if (Array.isArray(this[parentKey])) {
678
- var index = this[parentKey].indexOf(bindEvent);
679
- ~index && this[parentKey].splice(index, 1);
680
- params.index = index;
681
- }
682
- else if (this[parentKey] === bindEvent) {
683
- params.index = 0;
684
- this[parentKey] = undefined;
685
- }
686
- }
687
- return params;
688
- };
689
- ViewElement.prototype.removeBindDirective = function (options) {
690
- var bindDirective;
691
- if (typeof options === 'string') {
692
- bindDirective = this.bindDirectives.find(function (item) { return item.name === options; });
693
- if (!bindDirective) {
694
- throw new Error('找不到元素指令 ' + options);
695
- }
696
- }
697
- else {
698
- bindDirective = options;
699
- }
700
- return bindDirective["delete"]();
701
- };
702
- ViewElement.prototype.__removeBindDirective = function (bindDirective) {
703
- var parentKey = bindDirective.parentKey;
704
- var params = {
705
- parentNode: this,
706
- parentKey: parentKey,
707
- index: -1,
708
- object: null,
709
- oldObject: bindDirective
710
- };
711
- if (parentKey) {
712
- params.parentKey = parentKey;
713
- if (Array.isArray(this[parentKey])) {
714
- var index = this[parentKey].indexOf(bindDirective);
715
- ~index && this[parentKey].splice(index, 1);
716
- params.index = index;
717
- }
718
- else if (this[parentKey] === bindDirective) {
719
- params.index = 0;
720
- this[parentKey] = undefined;
721
- }
722
- }
723
- return params;
724
- };
725
- ViewElement.prototype.removeBindStyle = function (options) {
726
- var bindStyle;
727
- if (typeof options === 'string') {
728
- bindStyle = this.bindStyles.find(function (item) { return item.name === options; });
729
- if (!bindStyle) {
730
- throw new Error('找不到元素绑定样式 ' + options);
731
- }
732
- }
733
- else {
734
- bindStyle = options;
735
- }
736
- return bindStyle["delete"]();
737
- };
738
- ViewElement.prototype.__removeBindStyle = function (bindStyle) {
739
- var parentKey = bindStyle.parentKey;
740
- var params = {
741
- parentNode: this,
742
- parentKey: parentKey,
743
- index: -1,
744
- object: null,
745
- oldObject: bindStyle
746
- };
747
- if (parentKey) {
748
- params.parentKey = parentKey;
749
- if (Array.isArray(this[parentKey])) {
750
- var index = this[parentKey].indexOf(bindStyle);
751
- ~index && this[parentKey].splice(index, 1);
752
- params.index = index;
753
- }
754
- else if (this[parentKey] === bindStyle) {
755
- params.index = 0;
756
- this[parentKey] = undefined;
757
- }
758
- }
759
- return params;
760
- };
761
- ViewElement.prototype.removeViewElement = function (options) {
762
- var viewElement;
763
- if (typeof options === 'string') {
764
- viewElement = this.children.find(function (item) { return item.name === options; });
765
- if (!viewElement) {
766
- throw new Error('找不到页面元素 ' + options);
767
- }
768
- }
769
- else {
770
- viewElement = options;
771
- }
772
- return viewElement["delete"]();
773
- };
774
- ViewElement.prototype.__removeViewElement = function (viewElement) {
775
- var parentKey = viewElement.parentKey;
776
- var params = {
777
- parentNode: this,
778
- parentKey: parentKey,
779
- index: -1,
780
- object: null,
781
- oldObject: viewElement
782
- };
783
- if (parentKey) {
784
- params.parentKey = parentKey;
785
- if (Array.isArray(this[parentKey])) {
786
- var index = this[parentKey].indexOf(viewElement);
787
- ~index && this[parentKey].splice(index, 1);
788
- params.index = index;
789
- }
790
- else if (this[parentKey] === viewElement) {
791
- params.index = 0;
792
- this[parentKey] = undefined;
793
- }
794
- }
795
- return params;
796
- };
797
- Object.defineProperty(ViewElement.prototype, "parentAuth", {
798
- //================================================================================
799
- // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
800
- // 自动生成的代码已结束。下面可以手动编写。
801
- //================================================================================
802
- /* 主页面有没有权限 */
803
- get: function () {
804
- var _a;
805
- var _nameSpace = this.view.getNamespace();
806
- var mainViewName = _nameSpace.split('.')[2];
807
- return this.view.parentNode.concept === 'App' ? this.view.auth : (_a = this.app.views.find(function (item) { return item.name === mainViewName; })) === null || _a === void 0 ? void 0 : _a.auth;
808
- },
809
- enumerable: false,
810
- configurable: true
811
- });
812
- Object.defineProperty(ViewElement.prototype, "authPath", {
813
- /**
814
- * 权限领域的资源路径
815
- */
816
- get: function () {
817
- return this.view.path + "/" + this.name;
818
- },
819
- enumerable: false,
820
- configurable: true
821
- });
822
- ViewElement.prototype.getViewElementUniqueName = function (name) {
823
- var _a;
824
- if (name === void 0) { name = 'viewElement1'; }
825
- return (_a = this.view) === null || _a === void 0 ? void 0 : _a.getViewElementUniqueName(name);
826
- };
827
- ViewElement.from = function (source, parentNode, parentKey) {
828
- var node = _super.from.call(this, source, parentNode, parentKey);
829
- if (!node.name) {
830
- var tagName = node.tag.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
831
- node.name = node.getViewElementUniqueName(tagName + "1");
832
- }
833
- return node;
834
- };
835
- /**
836
- * 设置组件权限
837
- */
838
- ViewElement.prototype.setBindRoles = function (bindRoles) {
839
- var object = {
840
- bindRoles: bindRoles
841
- };
842
- this.update(__assign({}, object));
843
- };
844
- ViewElement.prototype.getBindAttribute = function (name) {
845
- return this.bindAttrs.find(function (bindAttr) { return bindAttr.name === name; });
846
- };
847
- ViewElement.prototype.toHump = function (name) {
848
- return name.replace(/\-(\w)/g, function (all, letter) { return letter.toUpperCase(); });
849
- };
850
- ViewElement.prototype.toFirstUpper = function (name) {
851
- return name.replace(/^\S/, function (s) { return s.toUpperCase(); });
852
- };
853
- ViewElement.prototype.haveScope = function () {
854
- return Boolean(this.slotScope);
855
- };
856
- ViewElement.prototype.toEmbeddedTSDefinition = function (state) {
857
- var code = '';
858
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1);
859
- // 登录组件不翻译
860
- if (this.toHump(this.tag) === 'lcapLogin' || this.staticClass === 'login-form') {
861
- code += this.name + ": nasl.ui.div<any>;\n";
862
- }
863
- else {
864
- code += this.name + ": nasl.ui." + this.toHump(this.tag) + "<any>;\n";
865
- }
866
- if (Array.isArray(this.children)) {
867
- this.children.forEach(function (element) {
868
- code += element.toEmbeddedTSDefinition(translator_1.shiftState(state, code));
869
- });
870
- }
871
- return code;
872
- };
873
- ViewElement.prototype.getTypeArgmentsStr = function (state) {
874
- // 登录组件不翻译
875
- if (this.toHump(this.tag) === 'lcapLogin' || this.staticClass === 'login-form')
876
- return '<any>';
877
- var code = '';
878
- // formItem的单独处理
879
- if (this.tag === 'u-form-item') {
880
- if (Array.isArray(this.children) && this.children.length) {
881
- var tag = this.children[0].tag;
882
- if (tag === 'u-input') {
883
- code += '<nasl.core.String>';
884
- }
885
- else if (tag === 'u-input-number') {
886
- code += '<nasl.core.Integer>';
887
- }
888
- else {
889
- code += '<any>';
890
- }
891
- }
892
- return code;
893
- }
894
- var bindAttrs = this.bindAttrs;
895
- if (bindAttrs && bindAttrs.length) {
896
- var attr = bindAttrs.find(function (item) { return item.name === 'data-source'; });
897
- if (attr && attr.expression) {
898
- code += "<" + this.__tsDataSourceTypeName + ">";
899
- }
900
- }
901
- return code;
902
- };
903
- ViewElement.prototype.getDatasourceTypeCodeStr = function (state, eleArr) {
904
- var code = '';
905
- (eleArr || []).forEach(function (element, index) {
906
- var bindAttrs = element.bindAttrs;
907
- if (bindAttrs && bindAttrs.length) {
908
- var attr = bindAttrs.find(function (item) { return item.name === 'data-source'; });
909
- if (attr && attr.expression) {
910
- var datasourceName = "datasourceName" + index;
911
- element.__tsDataSourceTypeName = datasourceName;
912
- if (attr.expression instanceof MemberExpression__1["default"] || attr.expression instanceof Identifier__1["default"]) {
913
- var value = attr.expression.toEmbeddedTS(translator_1.shiftState(state, code));
914
- code += "type " + datasourceName + " = ";
915
- code += "nasl.ui.GetItemTypeFromDataSource<typeof " + value + ">;\n";
916
- }
917
- else {
918
- code += "const __funcName" + index + " = () => { return";
919
- code += attr.expression.toEmbeddedTS(translator_1.shiftState(state, code));
920
- code += '};\n';
921
- code += "type " + datasourceName + " = ";
922
- code += "nasl.ui.GetItemTypeFromDataSource<ReturnType<typeof __funcName" + index + ">>;\n";
923
- }
924
- }
925
- }
926
- });
927
- code += '\n';
928
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
929
- return code;
930
- };
931
- ViewElement.prototype.toEmbeddedTS = function (state, parentLevel) {
932
- var _this = this;
933
- // 过滤模板的登录中的一些翻译,这里只过滤h5表格中的两个列
934
- if (this.parentNode.tag && this.toHump(this.parentNode.tag) === 'lcapLogin' || this.staticClass === 'login-cell')
935
- return '';
936
- // pc事件翻译
937
- if (this.toHump(this.tag) === 'lcapLogin') {
938
- var code_1 = "new nasl.ui.div({name: __elements." + this.name + ",\n";
939
- // 事件
940
- if (Array.isArray(this.bindEvents)) {
941
- this.bindEvents.forEach(function (event) {
942
- code_1 += event.toEmbeddedTS(translator_1.shiftState(state, code_1, {
943
- tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2
944
- }));
945
- code_1 += '\n';
946
- });
947
- }
948
- code_1 += "}),\n";
949
- return code_1;
950
- }
951
- var levelIndex = parentLevel || 0;
952
- if (this.tag === 'template' && this.haveScope()) {
953
- var slotTarget = !this.slotTarget ? 'slotDefault' : 'slot' + this.toFirstUpper(this.toHump(this.slotTarget));
954
- var code_2 = '';
955
- code_2 += slotTarget + ": (current" + (levelIndex === 0 ? '' : levelIndex) + ")=> {\n";
956
- code_2 += this.getDatasourceTypeCodeStr(state, this.children);
957
- levelIndex++;
958
- code_2 += 'return [';
959
- this.children.forEach(function (element) {
960
- code_2 += element.toEmbeddedTS(translator_1.shiftState(state, code_2, {
961
- tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0)
962
- }), levelIndex);
963
- });
964
- code_2 += ']';
965
- code_2 += '\n';
966
- code_2 += '},\n';
967
- return code_2;
968
- }
969
- else if (this.tag === 'template') {
970
- var slotTarget = !this.slotTarget ? 'slotDefault' : 'slot' + this.toFirstUpper(this.toHump(this.slotTarget));
971
- var code_3 = '';
972
- code_3 += slotTarget + ": ()=> {\n";
973
- code_3 += this.getDatasourceTypeCodeStr(state, this.children);
974
- code_3 += 'return [';
975
- this.children.forEach(function (element) {
976
- code_3 += element.toEmbeddedTS(translator_1.shiftState(state, code_3, {
977
- tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0)
978
- }));
979
- });
980
- code_3 += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
981
- code_3 += ']';
982
- code_3 += '\n';
983
- code_3 += '},\n';
984
- return code_3;
985
- }
986
- function chineseTsName(name) {
987
- var tsName = name;
988
- // 匹配所有特殊字符都转为_
989
- tsName = tsName.replace(/[^\u4e00-\u9fa5a-zA-Z0-9]/g, '_');
990
- if (/^\d/.test(tsName)) {
991
- tsName = '$' + tsName;
992
- }
993
- return tsName;
994
- }
995
- // 后面那个name是为了查找引用的时候用的
996
- var code = "new nasl.ui." + this.toHump(this.tag) + this.getTypeArgmentsStr(state) + "({name: __elements." + this.name + ",\n";
997
- // 是否开启权限
998
- var hasAuth = false;
999
- if (Array.isArray(this.bindDirectives)) {
1000
- hasAuth = !!this.bindDirectives.filter(function (directive) { return directive.name === 'auth'; }).length;
1001
- }
1002
- // 角色
1003
- if (Array.isArray(this.bindRoles) && this.bindRoles.length) {
1004
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
1005
- code += 'roles = [\n';
1006
- this.bindRoles.forEach(function (role) {
1007
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 3);
1008
- code += _this.app.getNamespace() + ".roles." + chineseTsName(role) + "." + chineseTsName(role) + ",";
1009
- code += '\n';
1010
- });
1011
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
1012
- code += '],\n';
1013
- }
1014
- // 事件
1015
- if (Array.isArray(this.bindEvents)) {
1016
- this.bindEvents.forEach(function (event) {
1017
- code += event.toEmbeddedTS(translator_1.shiftState(state, code, {
1018
- tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2
1019
- }));
1020
- code += '\n';
1021
- });
1022
- }
1023
- // 子元素
1024
- if (Array.isArray(this.children)) {
1025
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1);
1026
- if (Array.isArray(this.bindAttrs)) {
1027
- code += "bindAttr: () => [\n";
1028
- this.bindAttrs.forEach(function (attr) { return code += attr.toEmbeddedTS(translator_1.shiftState(state, code, { tabSize: 1 })) + ',\n'; });
1029
- this.bindDirectives.forEach(function (directive) { return code += directive.toEmbeddedTS(translator_1.shiftState(state, code, { tabSize: 1 })) + ',\n'; });
1030
- this.bindStyles.forEach(function (bindStyle) { return code += bindStyle.toEmbeddedTS(translator_1.shiftState(state, code, { tabSize: 1 })) + ',\n'; });
1031
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2) + '],\n';
1032
- }
1033
- // 如果子集中有插槽的就
1034
- if (this.children.find(function (item) { return item.tag === 'template' && item.slotTarget; })) {
1035
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
1036
- var defaultArr_1 = [];
1037
- // 先把插槽翻译了
1038
- this.children.forEach(function (element) {
1039
- if (element.tag === 'template') {
1040
- code += element.toEmbeddedTS(translator_1.shiftState(state, code, {
1041
- tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0)
1042
- }), levelIndex);
1043
- }
1044
- else {
1045
- defaultArr_1.push(element);
1046
- }
1047
- });
1048
- // 翻译其余的子集
1049
- if (defaultArr_1.length) {
1050
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
1051
- code += "slotDefault: ()=> {\n";
1052
- code += this.getDatasourceTypeCodeStr(state, defaultArr_1);
1053
- code += 'return [';
1054
- defaultArr_1.forEach(function (element) {
1055
- code += element.toEmbeddedTS(translator_1.shiftState(state, code, {
1056
- tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2
1057
- }), levelIndex);
1058
- code += '\n';
1059
- });
1060
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
1061
- code += ']\n';
1062
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1);
1063
- code += '}\n';
1064
- }
1065
- }
1066
- else {
1067
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
1068
- code += "slotDefault: ()=> {\n";
1069
- code += this.getDatasourceTypeCodeStr(state, this.children);
1070
- code += 'return [';
1071
- this.children.forEach(function (element) {
1072
- code += element.toEmbeddedTS(translator_1.shiftState(state, code, {
1073
- tabSize: ((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2
1074
- }), levelIndex);
1075
- code += '\n';
1076
- });
1077
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 2);
1078
- code += ']\n';
1079
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0) + 1);
1080
- code += '}\n';
1081
- }
1082
- }
1083
- code += translator_1.indent(((state === null || state === void 0 ? void 0 : state.tabSize) || 0)) + '}),\n';
1084
- return code;
1085
- };
1086
- ViewElement.prototype._duplicate = function () {
1087
- var element = ViewElement_1.from(this.toTemplateJSON());
1088
- element.deepRenameElements(this);
1089
- this.view.existingViewElement.clear();
1090
- return element;
1091
- };
1092
- // 递归遍历组件
1093
- ViewElement.prototype.traverseChildren = function (cb) {
1094
- utils.traverse(function (current) {
1095
- cb(current.node);
1096
- }, { node: this });
1097
- };
1098
- // 递归生成组件名
1099
- ViewElement.prototype.deepRenameElements = function (node) {
1100
- return this.traverseChildren(function (ele) {
1101
- var tagName = ele.tag.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
1102
- ele.name = node.getViewElementUniqueName(tagName + "1");
1103
- });
1104
- };
1105
- /**
1106
- * 解析属性中的表达式
1107
- * @param value
1108
- * @param $def 目前 $def 只用来查找 $def.variables 和 $def.structures
1109
- * @param dataSchema
1110
- */
1111
- ViewElement._parseExpression = function (value) {
1112
- try {
1113
- var ast = babelParser.parseExpression(value);
1114
- var node = transAstNodeToNaslNode(ast);
1115
- return LogicItem__1["default"].from(node, null, null);
1116
- }
1117
- catch (e) {
1118
- return null;
1119
- }
1120
- };
1121
- ViewElement._parseValidationRule = function (value) {
1122
- var _a, _b, _c, _d, _e;
1123
- var calleeName = value;
1124
- var args = [];
1125
- try {
1126
- var ast = babelParser.parseExpression(value);
1127
- if (ast.type === 'CallExpression') {
1128
- calleeName = ((_b = (_a = ast.callee) === null || _a === void 0 ? void 0 : _a.property) === null || _b === void 0 ? void 0 : _b.name) || ((_d = (_c = ast.callee) === null || _c === void 0 ? void 0 : _c.property) === null || _d === void 0 ? void 0 : _d.value) || ((_e = ast.callee) === null || _e === void 0 ? void 0 : _e.name);
1129
- calleeName = calleeName.replace(/\(.*/, '');
1130
- args = ast.arguments.map(function (argument) { return ({
1131
- concept: 'Argument',
1132
- name: '',
1133
- kind: 'Statement',
1134
- keyword: '',
1135
- expression: transAstNodeToNaslNode(Object.assign({}, argument))
1136
- }); });
1137
- }
1138
- }
1139
- catch (error) { }
1140
- return {
1141
- concept: 'ValidationRule',
1142
- name: '',
1143
- label: '验证规则',
1144
- kind: 'Expression',
1145
- calleeNamespace: 'nasl.validation',
1146
- arguments: args,
1147
- calleeName: calleeName
1148
- };
1149
- };
1150
- /**
1151
- * 从 Vue 的 ASTNode 转换成 ASL 元素
1152
- * @param astNode Vue 的 ASTNode
1153
- */
1154
- ViewElement._fromASTNode = function (astNode, context) {
1155
- var _this = this;
1156
- var _a, _b, _c;
1157
- var view = context === null || context === void 0 ? void 0 : context.view;
1158
- // 临时处理组件的 text
1159
- //h5-mock
1160
- if (['u-text', 'van-text', 'u-link', 'u-button', 'u-label', 'u-radio', 'u-checkbox', 'u-navbar-item', 'u-sidebar-item', 'u-menu-item'].includes(astNode.tag)
1161
- && astNode.children.length === 1
1162
- && astNode.children[0].type === 3) {
1163
- astNode.attrs = astNode.attrs || [];
1164
- astNode.attrs.push({
1165
- name: 'text',
1166
- value: JSON.stringify(astNode.children[0].text)
1167
- });
1168
- astNode.children = [];
1169
- }
1170
- // 将 scopedSlots 合并到 children 中
1171
- if (astNode.scopedSlots) {
1172
- astNode.children = astNode.children || [];
1173
- Object.keys(astNode.scopedSlots).forEach(function (key) {
1174
- if (!astNode.children.find(function (child) { return key === child.slotTarget; })) {
1175
- astNode.children.unshift(astNode.scopedSlots[key]);
1176
- }
1177
- });
1178
- delete astNode.scopedSlots;
1179
- }
1180
- // 提示不支持的属性
1181
- ['component', 'inlineTemplate', 'pre', 'ns', 'transition', 'transitionOnAppear', 'transitionMode', 'slotName', 'classBinding', 'styleBinding'].forEach(function (key) {
1182
- if (astNode[key])
1183
- console.warn("[warn] ViewElement NASL unsupports '" + key + "' field in node ", astNode);
1184
- });
1185
- var element;
1186
- if (astNode.type === 1) {
1187
- if (astNode.tag === 'router-view') {
1188
- if (__1.config.scope === 'h5') {
1189
- astNode.tag = 'van-router-view';
1190
- }
1191
- else {
1192
- astNode.tag = 'u-router-view';
1193
- }
1194
- }
1195
- var tagName = astNode.tag.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
1196
- var newContext_1 = {};
1197
- if (context) {
1198
- newContext_1 = __assign({}, context);
1199
- }
1200
- element = new ViewElement_1({
1201
- tag: astNode.tag,
1202
- name: astNode.attrsMap.ref || view.getViewElementUniqueName(tagName + "1"),
1203
- staticClass: astNode.attrsMap["class"],
1204
- staticStyle: astNode.attrsMap.style,
1205
- slotTarget: astNode.slotTarget && json5.parse(astNode.slotTarget),
1206
- slotScope: astNode.slotScope === '_empty_' ? '' : astNode.slotScope,
1207
- children: astNode.children.map(function (item) { return _this._fromASTNode(item, newContext_1); })
1208
- });
1209
- (_a = astNode === null || astNode === void 0 ? void 0 : astNode.attrs) === null || _a === void 0 ? void 0 : _a.forEach(function (oldAttr) {
1210
- var attr;
1211
- // 获取原始属性
1212
- var orginAttrCode = ((context === null || context === void 0 ? void 0 : context.code) || '').substr(oldAttr.start, oldAttr.end - oldAttr.start);
1213
- if (oldAttr.value === '""' && orginAttrCode.trim() === oldAttr.name) {
1214
- attr = new BindAttribute__1["default"]({
1215
- type: 'static',
1216
- name: oldAttr.name,
1217
- value: 'true'
1218
- });
1219
- }
1220
- else {
1221
- try {
1222
- var tmp = json5.parse(oldAttr.value);
1223
- var source = {
1224
- type: typeof tmp === 'string' ? 'string' : 'static',
1225
- name: oldAttr.name,
1226
- value: typeof tmp === 'string' ? tmp : oldAttr.value
1227
- };
1228
- if (oldAttr.name === 'rules') {
1229
- source.rules = tmp === null || tmp === void 0 ? void 0 : tmp.split('|').map(function (ruleStr) { return _this._parseValidationRule(ruleStr.trim()); });
1230
- }
1231
- attr = new BindAttribute__1["default"](source);
1232
- }
1233
- catch (e) {
1234
- var expression = _this._parseExpression(oldAttr.value);
1235
- attr = new BindAttribute__1["default"]({
1236
- type: 'dynamic',
1237
- name: oldAttr.name,
1238
- value: expression ? '' : oldAttr.value,
1239
- expression: expression
1240
- });
1241
- if (astNode.attrsMap[":" + attr.name + ".sync"]) {
1242
- attr.sync = true;
1243
- }
1244
- }
1245
- }
1246
- element.addBindAttribute(attr);
1247
- });
1248
- // compiler 处理:value.sync 时会加上update:value事件,需要过滤
1249
- astNode.events
1250
- && Object.keys(astNode.events)
1251
- .filter(function (name) { return !name.startsWith('update:'); })
1252
- .forEach(function (name) {
1253
- var _a;
1254
- var oldEvent = astNode.events[name];
1255
- var str = oldEvent.value;
1256
- var calleeName = str.split('(')[0];
1257
- var matchArr = str.match(/\(([^)]*)\)/) || [];
1258
- var argsStr = '';
1259
- if ((matchArr === null || matchArr === void 0 ? void 0 : matchArr.length) >= 2) {
1260
- argsStr = matchArr[1];
1261
- }
1262
- var args = [];
1263
- var argStrs = argsStr.split(',');
1264
- args = argStrs
1265
- .filter(function (argStr) { return !!argStr; })
1266
- .map(function (argStr) {
1267
- var keyword = argStr.trim().split('.');
1268
- return {
1269
- concept: 'Argument',
1270
- expression: genArgumentMemberExpression(keyword)
1271
- };
1272
- });
1273
- var viewLogics = ((_a = context === null || context === void 0 ? void 0 : context.definition) === null || _a === void 0 ? void 0 : _a.viewLogics) || [];
1274
- var currentLogic = viewLogics.find(function (item) { return item.name === calleeName; });
1275
- if (currentLogic) {
1276
- element.addBindEvent(new BindEvent__1["default"]({
1277
- name: name,
1278
- calleeNamespace: '',
1279
- calleeName: '',
1280
- arguments: args,
1281
- logics: [currentLogic]
1282
- }));
1283
- }
1284
- });
1285
- astNode.directives
1286
- && astNode.directives.forEach(function (directive) {
1287
- if (directive.name === 'model') {
1288
- var valueAttr = astNode.attrs && astNode.attrs.find(function (attr) { return attr.name === 'value'; });
1289
- if (!valueAttr) {
1290
- var expression = _this._parseExpression(directive.value);
1291
- element.addBindAttribute(new BindAttribute__1["default"]({
1292
- type: 'dynamic',
1293
- name: 'value',
1294
- value: expression ? '' : directive.value,
1295
- expression: expression,
1296
- sync: true
1297
- }));
1298
- }
1299
- }
1300
- else {
1301
- var expression = _this._parseExpression(directive.value);
1302
- element.addBindDirective(new BindDirective__1["default"]({
1303
- type: expression ? 'string' : 'dynamic',
1304
- name: directive.name,
1305
- rawName: directive.rawName,
1306
- value: expression ? '' : directive.value,
1307
- expression: expression,
1308
- arg: directive.arg
1309
- }));
1310
- }
1311
- });
1312
- if (astNode["if"]) {
1313
- element.addBindDirective(new BindDirective__1["default"]({
1314
- type: 'dynamic',
1315
- name: 'if',
1316
- rawName: 'v-if',
1317
- value: '',
1318
- expression: this._parseExpression(astNode["if"])
1319
- }));
1320
- }
1321
- }
1322
- else if (astNode.type === 2) {
1323
- var tagName = __1.config.scope === 'h5' ? 'van-text' : 'u-text';
1324
- var baseName = tagName.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
1325
- element = new ViewElement_1({
1326
- tag: tagName,
1327
- name: view.getViewElementUniqueName(baseName + "1")
1328
- });
1329
- var value = (_b = astNode.text) === null || _b === void 0 ? void 0 : _b.match(/{{(.*?)}}/)[1].trim();
1330
- var expression = this._parseExpression(value);
1331
- element.addBindAttribute(new BindAttribute__1["default"]({
1332
- type: 'dynamic',
1333
- name: 'text',
1334
- value: expression ? '' : value,
1335
- expression: expression
1336
- }));
1337
- }
1338
- else if (astNode.type === 3) {
1339
- var tagName = __1.config.scope === 'h5' ? 'van-text' : 'u-text';
1340
- var baseName = tagName.replace(ViewElement_1.TAG_NAME_PREFIX_REG, '').replace(/-/g, '_');
1341
- element = new ViewElement_1({
1342
- tag: tagName,
1343
- name: view.getViewElementUniqueName(baseName + "1")
1344
- });
1345
- element.addBindAttribute(new BindAttribute__1["default"]({
1346
- name: 'text',
1347
- type: 'string',
1348
- value: (_c = astNode.text) === null || _c === void 0 ? void 0 : _c.trim()
1349
- }));
1350
- }
1351
- return element;
1352
- };
1353
- /**
1354
- * 解析 Vue 模板
1355
- * 该方法不会绑定 view 和 parent,如果是添加元素优先使用 fromHTML
1356
- * @param html Vue 的模板
1357
- * @TODO 处理多个元素的问题
1358
- */
1359
- ViewElement.parse = function (code, context) {
1360
- code = code || '<div></div>';
1361
- var compilerOptions = {
1362
- preserveWhitespace: false,
1363
- outputSourceRange: true
1364
- };
1365
- var ast = compiler.compile(code, compilerOptions).ast;
1366
- if (ast.tag === 'template' && !ast.slotTarget)
1367
- ast = ast.children[0];
1368
- return this._fromASTNode(ast, __assign(__assign({}, context), { code: code }));
1369
- };
1370
- /**
1371
- * 从模板生成规范的 ViewElement 对象
1372
- */
1373
- ViewElement.fromHTML = function (html, context) {
1374
- return this.parse(html, context);
1375
- };
1376
- /**
1377
- * 转换成设计器中使用的 Vue 文件
1378
- * @param options
1379
- */
1380
- ViewElement.prototype.toDesignerVue = function () {
1381
- return this.toVue({
1382
- finalCode: false,
1383
- nodePathAttr: true,
1384
- attrFormat: function (attr, element, defaultResult) {
1385
- if (attr.concept === 'BindAttribute' && !['href', 'destination', 'externalDestination', 'download'].includes(attr.name)) {
1386
- var api = __1.config.allNodesAPI[element.tag];
1387
- var apiOfAttr_1 = api && api.attrs && api.attrs.find(function (_attr) { return _attr.name === attr.name; });
1388
- if (['u-form-item', 'u-validator', 'van-field'].includes(element.tag) && attr.name === 'rules') {
1389
- return attr.name + "=\"\"";
1390
- }
1391
- if (apiOfAttr_1 && apiOfAttr_1['designer-value'] !== undefined) {
1392
- var designerValue_1 = apiOfAttr_1['designer-value'];
1393
- //对流程模板拖拽进行特判
1394
- element.bindAttrs.forEach(function (property) {
1395
- if (property.name === 'repeat' && property.value === '1')
1396
- designerValue_1 = '[{}, {}]';
1397
- });
1398
- if (typeof designerValue_1 === 'string') {
1399
- designerValue_1 = designerValue_1.replace(/"/g, "'");
1400
- }
1401
- try {
1402
- json5.parse(designerValue_1);
1403
- return ":" + attr.name + "=\"" + designerValue_1 + "\"";
1404
- }
1405
- catch (e) {
1406
- return attr.name + "=\"" + designerValue_1 + "\"";
1407
- }
1408
- }
1409
- if (attr.type === 'dynamic' && !(element.tag === 'u-cascade-select' && attr.name === 'categories'))
1410
- return defaultResult.replace(/:?([\w-]+)(?:.*?)="(.*)"/, function (m, name, value) {
1411
- try {
1412
- var tempValue = json5.parse(value);
1413
- if (typeof tempValue === 'boolean' || typeof tempValue === 'number') {
1414
- // 简单类型走属性
1415
- return ":" + name + "=\"" + value.replace(/"/g, "'") + "\"";
1416
- }
1417
- }
1418
- catch (e) {
1419
- if (apiOfAttr_1 && !apiOfAttr_1.type.includes('string'))
1420
- return '';
1421
- }
1422
- value = value
1423
- .replace(/"/g, "'")
1424
- .replace(/\$utils\['(.+?)'\]/g, '$1')
1425
- .replace(/\$refs./g, 'elements.')
1426
- .replace(/\$global.userInfo/g, 'nasl.auth.userInfo')
1427
- .replace(/\$global./g, 'nasl.')
1428
- .replace(/\bscope\.item\.\b/g, '')
1429
- .replace(/\bcurrent\.item\.\b/g, '');
1430
- return name + "=\"{{ " + value + " }}\"";
1431
- });
1432
- else
1433
- return defaultResult;
1434
- }
1435
- return false;
1436
- },
1437
- bindStylesFormat: function (bindStyles, element) { return false; },
1438
- getExtraParts: function (el) {
1439
- var parts = [];
1440
- var api = __1.config.allNodesAPI[el.tag];
1441
- var emptySlot = api && api.slots && api.slots.find(function (slot) { return slot.name === 'default' && slot['empty-background']; });
1442
- var hasSupport = api && api.slots && api.slots.some(function (slot) { return slot.support; });
1443
- if (emptySlot || hasSupport) {
1444
- // 有些限制的组件如侧边栏分组有title插槽但要限制子元素放入
1445
- var validChildren = el.children.filter(function (elem) { return !(elem.tag === 'template' && elem.slotTarget !== 'default'); });
1446
- var childEmpty = !validChildren.length;
1447
- var defaultSlot = el.children.find(function (elem) { return elem.tag === 'template' && elem.slotTarget === 'default'; });
1448
- if (defaultSlot) {
1449
- childEmpty = !defaultSlot.children.length;
1450
- }
1451
- if (childEmpty) {
1452
- var addEmpty = true;
1453
- if (el.tag === 'u-grid-view' || el.tag === 'u-list-view' || el.tag === 'van-list-view' || el.tag === 'van-grid-view') {
1454
- var hasDataSource = el.bindAttrs.find(function (attr) { return attr.name === 'data-source'; });
1455
- addEmpty = !hasDataSource;
1456
- }
1457
- if (el.tag === 'u-crumb') {
1458
- var attrList = el.bindAttrs;
1459
- var hasAuto = attrList.some(function (attr) { return attr.name === 'auto' && String(attr.value) === 'true'; });
1460
- if (hasAuto)
1461
- addEmpty = false;
1462
- }
1463
- if (['u-select', 'u-dropdown', 'u-panel', 'u-toc', 'u-toc-item', 'u-tree-view-new', 'u-tree-view-node-new', 'u-tree-select', 'u-tree-select-new', 'u-anchor', 'u-drawer', 'u-timeline', 'u-tabs'].includes(el.tag)) {
1464
- addEmpty = false;
1465
- }
1466
- var background = (emptySlot && emptySlot['empty-background']) || (hasSupport ? 'add-sub' : '');
1467
- addEmpty && parts.push("vusion-empty-background=\"" + background + "\"");
1468
- }
1469
- }
1470
- if (['u-router-view', 'van-router-view'].includes(el.tag)) {
1471
- var excludes = ['background-color:', 'background:', 'background-image:'];
1472
- if (excludes.some(function (key) { return (el.staticStyle && el.staticStyle.includes(key)); })) {
1473
- parts.push(':designer="false"');
1474
- }
1475
- }
1476
- return parts;
1477
- }
1478
- });
1479
- };
1480
- /**
1481
- * 转换成 Vue 的模板格式
1482
- */
1483
- ViewElement.prototype.toVue = function (options) {
1484
- var _this = this;
1485
- var currentList = [];
1486
- if (Array.isArray(options === null || options === void 0 ? void 0 : options.currentList)) {
1487
- currentList = __spreadArrays(options === null || options === void 0 ? void 0 : options.currentList);
1488
- }
1489
- if (this.slotScope) {
1490
- currentList.unshift(this.slotScope);
1491
- }
1492
- var newOptions = Object.assign({
1493
- indentStyle: 'space',
1494
- tabSize: 4,
1495
- indentLevel: 0,
1496
- aslIdAttr: false,
1497
- nodePathAttr: false,
1498
- getExtraParts: function () { return []; },
1499
- attrFormat: function (attr, element, defaultResult) { return defaultResult; },
1500
- bindStylesFormat: function (bindStyles, element) {
1501
- if (bindStyles.length === 0)
1502
- return false;
1503
- return ":style=\"{" + bindStyles
1504
- .map(function (item) { return item.toVue(); })
1505
- .filter(function (item) { return item !== undefined; })
1506
- .join(', ') + "}\"";
1507
- }
1508
- }, options, {
1509
- currentList: currentList
1510
- });
1511
- var tabString = ' '.repeat(newOptions.tabSize * newOptions.indentLevel);
1512
- var insideTabString = ' '.repeat(newOptions.tabSize * (newOptions.indentLevel + 1));
1513
- var shouldIndent = true;
1514
- var content = !this.children ? '' : this.children
1515
- .map(function (element) {
1516
- var childOptions = Object.assign({}, newOptions);
1517
- childOptions.indentLevel++;
1518
- return (shouldIndent ? '\n' + insideTabString : '') + (element === null || element === void 0 ? void 0 : element.toVue(childOptions));
1519
- })
1520
- .join('');
1521
- if (!content.length) {
1522
- shouldIndent = false;
1523
- }
1524
- var parts = [];
1525
- if (newOptions.aslIdAttr) {
1526
- if (newOptions.aslIdAttr === true) {
1527
- newOptions.aslIdAttr = 'asl-id';
1528
- }
1529
- parts.push(newOptions.aslIdAttr + "=\"" + this.id + "\"");
1530
- }
1531
- if (newOptions.nodePathAttr) {
1532
- // 注入 asl 的 node-path
1533
- parts.push("vusion-node-path=\"" + this.nodePath + "\"");
1534
- }
1535
- // 模板里解析时候,可能会有多级嵌套的 current,所以当前有多少的长度,当前就是多大的下标
1536
- this.slotTarget && parts.push("#" + this.slotTarget + (this.slotScope ? "=\"" + (currentList.length > 1 ? this.slotScope + (currentList.length - 1) : this.slotScope) + "\"" : ''));
1537
- this.name && parts.push("ref=\"" + this.name + "\"");
1538
- this.staticClass && parts.push("class=\"" + this.staticClass + "\"");
1539
- this.staticStyle && parts.push("style=\"" + this.staticStyle + "\"");
1540
- var vIfs = [];
1541
- [].concat(this.bindAttrs, this.bindDirectives, this.bindEvents).forEach(function (attr) {
1542
- var result = newOptions.attrFormat(attr, _this, attr === null || attr === void 0 ? void 0 : attr.toVue(newOptions));
1543
- // v-auth v-if 都翻译成 v-if
1544
- if (attr instanceof BindDirective__1["default"] && ['if', 'auth'].includes(attr.name) && result !== false) {
1545
- var expr = result.replace(/v-(if|auth)="(.*)"/, function (match, p1, p2) { return p2; });
1546
- if (expr)
1547
- vIfs.push(attr.name === 'if' ? expr : "$auth.has(" + expr + ")");
1548
- return;
1549
- }
1550
- result && parts.push(result);
1551
- });
1552
- if (vIfs.length === 2)
1553
- parts.push("v-if=\"(" + vIfs[0] + ") && (" + vIfs[1] + ")\"");
1554
- else if (vIfs.length === 1)
1555
- parts.push("v-if=\"" + vIfs[0] + "\"");
1556
- var bindStyles = newOptions.bindStylesFormat(this.bindStyles, this);
1557
- if (bindStyles)
1558
- parts.push(bindStyles);
1559
- newOptions.getExtraParts(this).forEach(function (part) { return parts.push(part); });
1560
- if (['u-modal', 'u-drawer'].includes(this.tag)) {
1561
- this.children.forEach(function (citem) {
1562
- if (citem.tag === 'template' && !citem.children.length) {
1563
- parts.push(":is-" + citem.slotTarget + "-slot-empty=true");
1564
- }
1565
- });
1566
- }
1567
- var partsLength = 0;
1568
- var partsString = '';
1569
- parts.forEach(function (part) {
1570
- if (partsLength >= 120 || part.length >= 120) {
1571
- partsString += '\n' + tabString + ' '.repeat(3); // ' '.repeat(el.tag.length + 1);
1572
- partsLength = 0;
1573
- }
1574
- partsString += ' ' + part;
1575
- partsLength += part.length;
1576
- });
1577
- var htmlContent = "<" + this.tag + (partsString.length ? partsString : '') + ">" + content + (shouldIndent ? '\n' + tabString : '') + ("</" + this.tag + ">");
1578
- if (!content.trim() && selfClosingTag.includes(this.tag)) {
1579
- htmlContent = "<" + this.tag + (partsString.length ? partsString : '') + " />";
1580
- }
1581
- return htmlContent;
1582
- };
1583
- /**
1584
- * 从父级删除该节点
1585
- * @internal
1586
- */
1587
- ViewElement.prototype["delete"] = function () {
1588
- var _this = this;
1589
- _super.prototype["delete"].call(this);
1590
- if (this.parentNode) {
1591
- this.traverseChildren(function (ele) {
1592
- var _a;
1593
- (_a = _this.view) === null || _a === void 0 ? void 0 : _a.removeExistingViewElement(ele);
1594
- });
1595
- }
1596
- };
1597
- ViewElement.prototype.findElementByName = function (name) {
1598
- return utils.traverse(function (current) {
1599
- if (current.node.name === name)
1600
- return current.node;
1601
- }, { node: this });
1602
- };
1603
- ViewElement.prototype.findElementByTag = function (tag) {
1604
- return utils.traverse(function (current) {
1605
- if (current.node.tag === tag)
1606
- return current.node;
1607
- }, { node: this });
1608
- };
1609
- ViewElement.prototype.findElementByAttr = function (name, value) {
1610
- return utils.traverse(function (current) {
1611
- if (current.node.bindAttrs.some(function (attr) { return attr.name === name && attr.value === value; }))
1612
- return current.node;
1613
- }, { node: this });
1614
- };
1615
- ViewElement.prototype.getCurrentName = function () {
1616
- var current = 'current';
1617
- var parent = this.parentNode;
1618
- var index = 0;
1619
- while (parent && parent.concept !== 'View') {
1620
- if (parent.slotScope) {
1621
- index++;
1622
- }
1623
- parent = parent.parentNode;
1624
- }
1625
- current = (index === 0 ? 'current' : 'current' + index);
1626
- return current;
1627
- };
1628
- var ViewElement_1;
1629
- ViewElement.TAG_NAME_PREFIX_REG = /^([lieu]|van)[-_]/;
1630
- __decorate([
1631
- decorators_1.property()
1632
- ], ViewElement.prototype, "concept");
1633
- __decorate([
1634
- decorators_1.property()
1635
- ], ViewElement.prototype, "type");
1636
- __decorate([
1637
- decorators_1.property()
1638
- ], ViewElement.prototype, "tag");
1639
- __decorate([
1640
- decorators_1.property()
1641
- ], ViewElement.prototype, "name");
1642
- __decorate([
1643
- decorators_1.property()
1644
- ], ViewElement.prototype, "staticClass");
1645
- __decorate([
1646
- decorators_1.property()
1647
- ], ViewElement.prototype, "staticStyle");
1648
- __decorate([
1649
- decorators_1.property()
1650
- ], ViewElement.prototype, "authDescription");
1651
- __decorate([
1652
- decorators_1.property()
1653
- ], ViewElement.prototype, "slotTarget");
1654
- __decorate([
1655
- decorators_1.property()
1656
- ], ViewElement.prototype, "slotScope");
1657
- __decorate([
1658
- decorators_1.property('BindAttribute')
1659
- ], ViewElement.prototype, "bindAttrs");
1660
- __decorate([
1661
- decorators_1.property('BindEvent')
1662
- ], ViewElement.prototype, "bindEvents");
1663
- __decorate([
1664
- decorators_1.property('BindDirective')
1665
- ], ViewElement.prototype, "bindDirectives");
1666
- __decorate([
1667
- decorators_1.property()
1668
- ], ViewElement.prototype, "bindRoles");
1669
- __decorate([
1670
- decorators_1.property('BindStyle')
1671
- ], ViewElement.prototype, "bindStyles");
1672
- __decorate([
1673
- decorators_1.property('ViewElement')
1674
- ], ViewElement.prototype, "children");
1675
- __decorate([
1676
- translator_1.withSourceMap()
1677
- ], ViewElement.prototype, "toEmbeddedTS");
1678
- __decorate([
1679
- decorators_1.excludedInJSON()
1680
- ], ViewElement.prototype, "computedStyle");
1681
- ViewElement = ViewElement_1 = __decorate([
1682
- decorators_1.concept('页面元素')
1683
- ], ViewElement);
1684
- return ViewElement;
1685
- }(BaseNode_1["default"]));
1686
- exports.ViewElement = ViewElement;
1687
- classMap_1["default"].ViewElement = ViewElement;
1688
- exports["default"] = ViewElement;
1689
- //================================================================================
1690
- // ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑ ↑
1691
- // 自动生成的代码已结束。下面可以手动编写。
1692
- //================================================================================